LOK: custom widgets: check size of API structures
[LibreOffice.git] / configure.ac
blob5e2524745005082e9457478686f76fa44001a01a
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.alpha1+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         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_gtk3_kde5=yes
602     if test "$enable_fuzzers" != yes; then
603         test_freetype=yes
604         test_fontconfig=yes
605     else
606         test_freetype=no
607         test_fontconfig=no
608         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     fi
610     _os=Linux
611     ;;
613 gnu)
614     test_randr=no
615     test_xrender=no
616     _os=GNU
617      ;;
619 cygwin*|interix*)
621     # When building on Windows normally with MSVC under Cygwin,
622     # configure thinks that the host platform (the platform the
623     # built code will run on) is Cygwin, even if it obviously is
624     # Windows, which in Autoconf terminology is called
625     # "mingw32". (Which is misleading as MinGW is the name of the
626     # tool-chain, not an operating system.)
628     # Somewhat confusing, yes. But this configure script doesn't
629     # look at $host etc that much, it mostly uses its own $_os
630     # variable, set here in this case statement.
632     test_cups=no
633     test_dbus=no
634     test_randr=no
635     test_xrender=no
636     test_freetype=no
637     test_fontconfig=no
638     _os=WINNT
640     DLLPOST=".dll"
641     LINKFLAGSNOUNDEFS=
642     ;;
644 darwin*) # Mac OS X or iOS
645     test_gtk=yes
646     test_randr=no
647     test_xrender=no
648     test_freetype=no
649     test_fontconfig=no
650     test_dbus=no
651     if test -n "$LODE_HOME" ; then
652         mac_sanitize_path
653         AC_MSG_NOTICE([sanitized the PATH to $PATH])
654     fi
655     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
656         build_for_ios=YES
657         _os=iOS
658         test_gtk=no
659         test_cups=no
660         enable_mpl_subset=yes
661         enable_lotuswordpro=no
662         enable_coinmp=no
663         enable_lpsolve=no
664         enable_postgresql_sdbc=no
665         enable_extension_integration=no
666         enable_report_builder=no
667         with_ppds=no
668         if test "$enable_ios_simulator" = "yes"; then
669             host=x86_64-apple-darwin
670         fi
671     else
672         _os=Darwin
673         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
674         INSTROOTCONTENTSUFFIX=/Contents
675         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
676     fi
677     # See comment above the case "$host_os"
678     LINKFLAGSSHL="-dynamiclib -single_module"
680     # -fPIC is default
681     PICSWITCH=""
683     DLLPOST=".dylib"
685     # -undefined error is the default
686     LINKFLAGSNOUNDEFS=""
689 freebsd*)
690     test_gtk=yes
691     build_gstreamer_1_0=yes
692     build_gstreamer_0_10=yes
693     test_kde4=yes
694     test_kde5=yes
695     test_gtk3_kde5=yes
696     test_freetype=yes
697     AC_MSG_CHECKING([the FreeBSD operating system release])
698     if test -n "$with_os_version"; then
699         OSVERSION="$with_os_version"
700     else
701         OSVERSION=`/sbin/sysctl -n kern.osreldate`
702     fi
703     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
704     AC_MSG_CHECKING([which thread library to use])
705     if test "$OSVERSION" -lt "500016"; then
706         PTHREAD_CFLAGS="-D_THREAD_SAFE"
707         PTHREAD_LIBS="-pthread"
708     elif test "$OSVERSION" -lt "502102"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-lc_r"
711     else
712         PTHREAD_CFLAGS=""
713         PTHREAD_LIBS="-pthread"
714     fi
715     AC_MSG_RESULT([$PTHREAD_LIBS])
716     _os=FreeBSD
717     ;;
719 *netbsd*)
720     test_gtk=yes
721     build_gstreamer_1_0=yes
722     build_gstreamer_0_10=yes
723     test_kde4=yes
724     test_kde5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_gtk3_kde5=yes
753     test_freetype=yes
754     PTHREAD_LIBS="-pthread"
755     _os=DragonFly
756     ;;
758 linux-android*)
759     build_gstreamer_1_0=no
760     build_gstreamer_0_10=no
761     enable_lotuswordpro=no
762     enable_mpl_subset=yes
763     enable_coinmp=yes
764     enable_lpsolve=no
765     enable_report_builder=no
766     enable_odk=no
767     enable_postgresql_sdbc=no
768     enable_python=no
769     with_theme="tango"
770     test_cups=no
771     test_dbus=no
772     test_fontconfig=no
773     test_freetype=no
774     test_gtk=no
775     test_kde4=no
776     test_kde5=no
777     test_gtk3_kde5=no
778     test_randr=no
779     test_xrender=no
780     _os=Android
782     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
783     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
784     ;;
786 haiku*)
787     test_cups=no
788     test_dbus=no
789     test_randr=no
790     test_xrender=no
791     test_freetype=yes
792     enable_odk=no
793     enable_gstreamer_0_10=no
794     enable_gstreamer_1_0=no
795     enable_vlc=no
796     enable_coinmp=no
797     enable_pdfium=no
798     enable_sdremote=no
799     enable_postgresql_sdbc=no
800     enable_firebird_sdbc=no
801     _os=Haiku
802     ;;
805     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
806     ;;
807 esac
809 if test "$_os" != "WINNT"; then
810 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
811 else
812 ENDIANNESS=little
814 AC_SUBST(ENDIANNESS)
816 if test "$_os" = "Android" ; then
817     # Verify that the NDK and SDK options are proper
818     if test -z "$with_android_ndk"; then
819         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
820     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
821         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
822     fi
824     if test -z "$ANDROID_SDK_HOME"; then
825         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
826     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
827         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
828     fi
830     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
831     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
832         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
833                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
834                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
835         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
836         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
837         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
838     fi
839     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
840         AC_MSG_WARN([android support repository not found - install with
841                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
842                      to allow the build to download the specified version of the android support libraries])
843         add_warning "android support repository not found - install with"
844         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
845         add_warning "to allow the build to download the specified version of the android support libraries"
846     fi
849 if test "$_os" = "AIX"; then
850     AC_PATH_PROG(GAWK, gawk)
851     if test -z "$GAWK"; then
852         AC_MSG_ERROR([gawk not found in \$PATH])
853     fi
856 AC_SUBST(SDKDIRNAME)
858 AC_SUBST(PTHREAD_CFLAGS)
859 AC_SUBST(PTHREAD_LIBS)
861 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
862 # By default use the ones specified by our build system,
863 # but explicit override is possible.
864 AC_MSG_CHECKING(for explicit AFLAGS)
865 if test -n "$AFLAGS"; then
866     AC_MSG_RESULT([$AFLAGS])
867     x_AFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_AFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit CFLAGS)
873 if test -n "$CFLAGS"; then
874     AC_MSG_RESULT([$CFLAGS])
875     x_CFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_CFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit CXXFLAGS)
881 if test -n "$CXXFLAGS"; then
882     AC_MSG_RESULT([$CXXFLAGS])
883     x_CXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_CXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit OBJCFLAGS)
889 if test -n "$OBJCFLAGS"; then
890     AC_MSG_RESULT([$OBJCFLAGS])
891     x_OBJCFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_OBJCFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
897 if test -n "$OBJCXXFLAGS"; then
898     AC_MSG_RESULT([$OBJCXXFLAGS])
899     x_OBJCXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_OBJCXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit LDFLAGS)
905 if test -n "$LDFLAGS"; then
906     AC_MSG_RESULT([$LDFLAGS])
907     x_LDFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_LDFLAGS=[\#]
912 AC_SUBST(AFLAGS)
913 AC_SUBST(CFLAGS)
914 AC_SUBST(CXXFLAGS)
915 AC_SUBST(OBJCFLAGS)
916 AC_SUBST(OBJCXXFLAGS)
917 AC_SUBST(LDFLAGS)
918 AC_SUBST(x_AFLAGS)
919 AC_SUBST(x_CFLAGS)
920 AC_SUBST(x_CXXFLAGS)
921 AC_SUBST(x_OBJCFLAGS)
922 AC_SUBST(x_OBJCXXFLAGS)
923 AC_SUBST(x_LDFLAGS)
925 dnl These are potentially set for MSVC, in the code checking for UCRT below:
926 my_original_CFLAGS=$CFLAGS
927 my_original_CXXFLAGS=$CXXFLAGS
928 my_original_CPPFLAGS=$CPPFLAGS
930 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
931 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
932 dnl AC_PROG_CC internally.
933 if test "$_os" != "WINNT"; then
934     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
935     save_CFLAGS=$CFLAGS
936     AC_PROG_CC
937     CFLAGS=$save_CFLAGS
940 if test $_os != "WINNT"; then
941     save_LIBS="$LIBS"
942     AC_SEARCH_LIBS([dlsym], [dl],
943         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
944         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
945     LIBS="$save_LIBS"
947 AC_SUBST(DLOPEN_LIBS)
949 AC_ARG_ENABLE(ios-simulator,
950     AS_HELP_STRING([--enable-ios-simulator],
951         [build i386 or x86_64 for ios simulator])
954 AC_ARG_ENABLE(ios-libreofficelight-app,
955     AS_HELP_STRING([--enable-ios-libreofficelight-app],
956         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
957          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
958          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
961 ENABLE_IOS_LIBREOFFICELIGHT_APP=
962 if test "$enable_ios_libreofficelight_app" = yes; then
963     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
965 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
967 ###############################################################################
968 # Extensions switches --enable/--disable
969 ###############################################################################
970 # By default these should be enabled unless having extra dependencies.
971 # If there is extra dependency over configure options then the enable should
972 # be automagic based on whether the requiring feature is enabled or not.
973 # All this options change anything only with --enable-extension-integration.
975 # The name of this option and its help string makes it sound as if
976 # extensions are built anyway, just not integrated in the installer,
977 # if you use --disable-extension-integration. Is that really the
978 # case?
980 libo_FUZZ_ARG_ENABLE(extension-integration,
981     AS_HELP_STRING([--disable-extension-integration],
982         [Disable integration of the built extensions in the installer of the
983          product. Use this switch to disable the integration.])
986 AC_ARG_ENABLE(avmedia,
987     AS_HELP_STRING([--disable-avmedia],
988         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
991 AC_ARG_ENABLE(database-connectivity,
992     AS_HELP_STRING([--disable-database-connectivity],
993         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
996 # This doesn't mean not building (or "integrating") extensions
997 # (although it probably should; i.e. it should imply
998 # --disable-extension-integration I guess), it means not supporting
999 # any extension mechanism at all
1000 libo_FUZZ_ARG_ENABLE(extensions,
1001     AS_HELP_STRING([--disable-extensions],
1002         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1005 AC_ARG_ENABLE(scripting,
1006     AS_HELP_STRING([--disable-scripting],
1007         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1010 # This is mainly for Android and iOS, but could potentially be used in some
1011 # special case otherwise, too, so factored out as a separate setting
1013 AC_ARG_ENABLE(dynamic-loading,
1014     AS_HELP_STRING([--disable-dynamic-loading],
1015         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1018 libo_FUZZ_ARG_ENABLE(report-builder,
1019     AS_HELP_STRING([--disable-report-builder],
1020         [Disable the Report Builder.])
1023 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1024     AS_HELP_STRING([--enable-ext-wiki-publisher],
1025         [Enable the Wiki Publisher extension.])
1028 libo_FUZZ_ARG_ENABLE(lpsolve,
1029     AS_HELP_STRING([--disable-lpsolve],
1030         [Disable compilation of the lp solve solver ])
1032 libo_FUZZ_ARG_ENABLE(coinmp,
1033     AS_HELP_STRING([--disable-coinmp],
1034         [Disable compilation of the CoinMP solver ])
1037 libo_FUZZ_ARG_ENABLE(pdfimport,
1038     AS_HELP_STRING([--disable-pdfimport],
1039         [Disable building the PDF import feature.])
1042 libo_FUZZ_ARG_ENABLE(pdfium,
1043     AS_HELP_STRING([--disable-pdfium],
1044         [Disable building PDFium.])
1047 ###############################################################################
1049 dnl ---------- *** ----------
1051 libo_FUZZ_ARG_ENABLE(mergelibs,
1052     AS_HELP_STRING([--enable-mergelibs],
1053         [Merge several of the smaller libraries into one big, "merged", one.])
1056 libo_FUZZ_ARG_ENABLE(breakpad,
1057     AS_HELP_STRING([--enable-breakpad],
1058         [Enables breakpad for crash reporting.])
1061 AC_ARG_ENABLE(fetch-external,
1062     AS_HELP_STRING([--disable-fetch-external],
1063         [Disables fetching external tarballs from web sources.])
1066 AC_ARG_ENABLE(fuzzers,
1067     AS_HELP_STRING([--enable-fuzzers],
1068         [Enables building libfuzzer targets for fuzz testing.])
1071 libo_FUZZ_ARG_ENABLE(pch,
1072     AS_HELP_STRING([--enable-pch],
1073         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1076 libo_FUZZ_ARG_ENABLE(epm,
1077     AS_HELP_STRING([--enable-epm],
1078         [LibreOffice includes self-packaging code, that requires epm, however epm is
1079          useless for large scale package building.])
1082 libo_FUZZ_ARG_ENABLE(odk,
1083     AS_HELP_STRING([--disable-odk],
1084         [LibreOffice includes an ODK, office development kit which some packagers may
1085          wish to build without.])
1088 AC_ARG_ENABLE(mpl-subset,
1089     AS_HELP_STRING([--enable-mpl-subset],
1090         [Don't compile any pieces which are not MPL or more liberally licensed])
1093 libo_FUZZ_ARG_ENABLE(evolution2,
1094     AS_HELP_STRING([--enable-evolution2],
1095         [Allows the built-in evolution 2 addressbook connectivity build to be
1096          enabled.])
1099 AC_ARG_ENABLE(avahi,
1100     AS_HELP_STRING([--enable-avahi],
1101         [Determines whether to use Avahi to advertise Impress to remote controls.])
1104 libo_FUZZ_ARG_ENABLE(werror,
1105     AS_HELP_STRING([--enable-werror],
1106         [Turn warnings to errors. (Has no effect in modules where the treating
1107          of warnings as errors is disabled explicitly.)]),
1110 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1111     AS_HELP_STRING([--enable-assert-always-abort],
1112         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1115 libo_FUZZ_ARG_ENABLE(dbgutil,
1116     AS_HELP_STRING([--enable-dbgutil],
1117         [Provide debugging support from --enable-debug and include additional debugging
1118          utilities such as object counting or more expensive checks.
1119          This is the recommended option for developers.
1120          Note that this makes the build ABI incompatible, it is not possible to mix object
1121          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1123 libo_FUZZ_ARG_ENABLE(debug,
1124     AS_HELP_STRING([--enable-debug],
1125         [Include debugging information, disable compiler optimization and inlining plus
1126          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1128 libo_FUZZ_ARG_ENABLE(split-debug,
1129     AS_HELP_STRING([--enable-split-debug],
1130         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1131          but requires tools that support it (both build tools and debuggers).]))
1133 libo_FUZZ_ARG_ENABLE(gdb-index,
1134     AS_HELP_STRING([--enable-gdb-index],
1135         [Creates debug information in the gdb index format, which makes gdb start faster.
1136          Requires the gold or lld linker.]))
1138 libo_FUZZ_ARG_ENABLE(sal-log,
1139     AS_HELP_STRING([--enable-sal-log],
1140         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1142 AC_ARG_ENABLE(selective-debuginfo,
1143     AS_HELP_STRING([--enable-selective-debuginfo],
1144         [If --enable-debug or --enable-dbgutil is used, build debugging information
1145          (-g compiler flag) only for the specified gbuild build targets
1146          (where all means everything, - prepended means not to enable, / appended means
1147          everything in the directory; there is no ordering, more specific overrides
1148          more general, and disabling takes precedence).
1149          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1151 libo_FUZZ_ARG_ENABLE(symbols,
1152     AS_HELP_STRING([--enable-symbols],
1153         [Generate debug information.
1154          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1155          otherwise.]))
1157 libo_FUZZ_ARG_ENABLE(optimized,
1158     AS_HELP_STRING([--disable-optimized],
1159         [Whether to compile with optimization flags.
1160          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1161          otherwise.]))
1163 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1164     AS_HELP_STRING([--disable-runtime-optimizations],
1165         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1166          JVM JIT) that are known to interact badly with certain dynamic analysis
1167          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1168          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1169          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1171 AC_ARG_WITH(valgrind,
1172     AS_HELP_STRING([--with-valgrind],
1173         [Make availability of Valgrind headers a hard requirement.]))
1175 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1176     AS_HELP_STRING([--enable-compiler-plugins],
1177         [Enable compiler plugins that will perform additional checks during
1178          building. Enabled automatically by --enable-dbgutil.
1179          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1180 COMPILER_PLUGINS_DEBUG=
1181 if test "$enable_compiler_plugins" = debug; then
1182     enable_compiler_plugins=yes
1183     COMPILER_PLUGINS_DEBUG=TRUE
1186 libo_FUZZ_ARG_ENABLE(ooenv,
1187     AS_HELP_STRING([--disable-ooenv],
1188         [Disable ooenv for the instdir installation.]))
1190 libo_FUZZ_ARG_ENABLE(libnumbertext,
1191     AS_HELP_STRING([--disable-libnumbertext],
1192         [Disable use of numbertext external library.]))
1194 AC_ARG_ENABLE(lto,
1195     AS_HELP_STRING([--enable-lto],
1196         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1197          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1198          linker. For MSVC, this option is broken at the moment. This is experimental work
1199          in progress that shouldn't be used unless you are working on it.)]))
1201 AC_ARG_ENABLE(python,
1202     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1203         [Enables or disables Python support at run-time.
1204          Also specifies what Python to use. 'auto' is the default.
1205          'fully-internal' even forces the internal version for uses of Python
1206          during the build.]))
1208 libo_FUZZ_ARG_ENABLE(gtk,
1209     AS_HELP_STRING([--disable-gtk],
1210         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1211 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1213 libo_FUZZ_ARG_ENABLE(gtk3,
1214     AS_HELP_STRING([--disable-gtk3],
1215         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1216 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1218 AC_ARG_ENABLE(split-app-modules,
1219     AS_HELP_STRING([--enable-split-app-modules],
1220         [Split file lists for app modules, e.g. base, calc.
1221          Has effect only with make distro-pack-install]),
1224 AC_ARG_ENABLE(split-opt-features,
1225     AS_HELP_STRING([--enable-split-opt-features],
1226         [Split file lists for some optional features, e.g. pyuno, testtool.
1227          Has effect only with make distro-pack-install]),
1230 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1231     AS_HELP_STRING([--disable-cairo-canvas],
1232         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1235 libo_FUZZ_ARG_ENABLE(dbus,
1236     AS_HELP_STRING([--disable-dbus],
1237         [Determines whether to enable features that depend on dbus.
1238          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1239 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1241 libo_FUZZ_ARG_ENABLE(sdremote,
1242     AS_HELP_STRING([--disable-sdremote],
1243         [Determines whether to enable Impress remote control (i.e. the server component).]),
1244 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1246 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1247     AS_HELP_STRING([--disable-sdremote-bluetooth],
1248         [Determines whether to build sdremote with bluetooth support.
1249          Requires dbus on Linux.]))
1251 libo_FUZZ_ARG_ENABLE(gio,
1252     AS_HELP_STRING([--disable-gio],
1253         [Determines whether to use the GIO support.]),
1254 ,test "${enable_gio+set}" = set || enable_gio=yes)
1256 AC_ARG_ENABLE(kde4,
1257     AS_HELP_STRING([--enable-kde4],
1258         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1259          KDE4 are available.]),
1262 AC_ARG_ENABLE(qt5,
1263     AS_HELP_STRING([--enable-qt5],
1264         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1265          available.]),
1268 AC_ARG_ENABLE(kde5,
1269     AS_HELP_STRING([--enable-kde5],
1270         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1271          KF5 are available.]),
1274 AC_ARG_ENABLE(gtk3_kde5,
1275     AS_HELP_STRING([--enable-gtk3-kde5],
1276         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1277          platforms where Gtk3, Qt5 and Plasma is available.]),
1280 libo_FUZZ_ARG_ENABLE(gui,
1281     AS_HELP_STRING([--disable-gui],
1282         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1283          command-line option. Not related to LibreOffice Online functionality. Don't use
1284          unless you are certain you need to. Nobody will help you if you insist on trying
1285          this and run into problems.]),
1286 ,test "${enable_gui+set}" = set || enable_gui=yes)
1288 libo_FUZZ_ARG_ENABLE(randr,
1289     AS_HELP_STRING([--disable-randr],
1290         [Disable RandR support in the vcl project.]),
1291 ,test "${enable_randr+set}" = set || enable_randr=yes)
1293 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1294     AS_HELP_STRING([--disable-gstreamer-1-0],
1295         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1296 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1298 AC_ARG_ENABLE(gstreamer-0-10,
1299     AS_HELP_STRING([--enable-gstreamer-0-10],
1300         [Enable building with the gstreamer 0.10 avmedia backend.]),
1301 ,enable_gstreamer_0_10=no)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1363 libo_FUZZ_ARG_ENABLE(cups,
1364     AS_HELP_STRING([--disable-cups],
1365         [Do not build cups support.])
1368 AC_ARG_ENABLE(ccache,
1369     AS_HELP_STRING([--disable-ccache],
1370         [Do not try to use ccache automatically.
1371          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1372          CC/CXX are not yet set, and --enable-icecream is not given, we
1373          attempt to use ccache. --disable-ccache disables ccache completely.
1377 AC_ARG_ENABLE(64-bit,
1378     AS_HELP_STRING([--enable-64-bit],
1379         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1380          At the moment meaningful only for Windows.]), ,)
1382 libo_FUZZ_ARG_ENABLE(online-update,
1383     AS_HELP_STRING([--enable-online-update],
1384         [Enable the online update service that will check for new versions of
1385          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1386          If the value is "mar", the experimental Mozilla-like update will be
1387          enabled instead of the traditional update mechanism.]),
1390 AC_ARG_WITH(update-config,
1391     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1392                    [Path to the update config ini file]))
1394 libo_FUZZ_ARG_ENABLE(extension-update,
1395     AS_HELP_STRING([--disable-extension-update],
1396         [Disable possibility to update installed extensions.]),
1399 libo_FUZZ_ARG_ENABLE(release-build,
1400     AS_HELP_STRING([--enable-release-build],
1401         [Enable release build. Note that the "release build" choice is orthogonal to
1402          whether symbols are present, debug info is generated, or optimization
1403          is done.
1404          See http://wiki.documentfoundation.org/Development/DevBuild]),
1407 AC_ARG_ENABLE(windows-build-signing,
1408     AS_HELP_STRING([--enable-windows-build-signing],
1409         [Enable signing of windows binaries (*.exe, *.dll)]),
1412 AC_ARG_ENABLE(silent-msi,
1413     AS_HELP_STRING([--enable-silent-msi],
1414         [Enable MSI with LIMITUI=1 (silent install).]),
1417 AC_ARG_ENABLE(macosx-code-signing,
1418     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1419         [Sign executables, dylibs, frameworks and the app bundle. If you
1420          don't provide an identity the first suitable certificate
1421          in your keychain is used.]),
1424 AC_ARG_ENABLE(macosx-package-signing,
1425     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1426         [Create a .pkg suitable for uploading to the Mac App Store and sign
1427          it. If you don't provide an identity the first suitable certificate
1428          in your keychain is used.]),
1431 AC_ARG_ENABLE(macosx-sandbox,
1432     AS_HELP_STRING([--enable-macosx-sandbox],
1433         [Make the app bundle run in a sandbox. Requires code signing.
1434          Is required by apps distributed in the Mac App Store, and implies
1435          adherence to App Store rules.]),
1438 AC_ARG_WITH(macosx-bundle-identifier,
1439     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1440         [Define the OS X bundle identifier. Default is the somewhat weird
1441          org.libreoffice.script ("script", huh?).]),
1442 ,with_macosx_bundle_identifier=org.libreoffice.script)
1444 AC_ARG_WITH(product-name,
1445     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1446         [Define the product name. Default is AC_PACKAGE_NAME.]),
1447 ,with_product_name=$PRODUCTNAME)
1449 AC_ARG_WITH(package-version,
1450     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1451         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1454 libo_FUZZ_ARG_ENABLE(readonly-installset,
1455     AS_HELP_STRING([--enable-readonly-installset],
1456         [Prevents any attempts by LibreOffice to write into its installation. That means
1457          at least that no "system-wide" extensions can be added. Partly experimental work in
1458          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1461 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1462     AS_HELP_STRING([--disable-postgresql-sdbc],
1463         [Disable the build of the PostgreSQL-SDBC driver.])
1466 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1467     AS_HELP_STRING([--disable-lotuswordpro],
1468         [Disable the build of the Lotus Word Pro filter.]),
1469 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1471 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1472     AS_HELP_STRING([--disable-firebird-sdbc],
1473         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1474 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1476 AC_ARG_ENABLE(bogus-pkg-config,
1477     AS_HELP_STRING([--enable-bogus-pkg-config],
1478         [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.]),
1481 AC_ARG_ENABLE(openssl,
1482     AS_HELP_STRING([--disable-openssl],
1483         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1484          components will either use GNUTLS or NSS. Work in progress,
1485          use only if you are hacking on it.]),
1486 ,enable_openssl=yes)
1488 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1489     AS_HELP_STRING([--enable-cipher-openssl-backend],
1490         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1491          Requires --enable-openssl.]))
1493 AC_ARG_ENABLE(library-bin-tar,
1494     AS_HELP_STRING([--enable-library-bin-tar],
1495         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1496         Some libraries can save their build result in a tarball
1497         stored in TARFILE_LOCATION. That binary tarball is
1498         uniquely identified by the source tarball,
1499         the content of the config_host.mk file and the content
1500         of the top-level directory in core for that library
1501         If this option is enabled, then if such a tarfile exist, it will be untarred
1502         instead of the source tarfile, and the build step will be skipped for that
1503         library.
1504         If a proper tarfile does not exist, then the normal source-based
1505         build is done for that library and a proper binary tarfile is created
1506         for the next time.]),
1509 AC_ARG_ENABLE(dconf,
1510     AS_HELP_STRING([--disable-dconf],
1511         [Disable the dconf configuration backend (enabled by default where
1512          available).]))
1514 libo_FUZZ_ARG_ENABLE(formula-logger,
1515     AS_HELP_STRING(
1516         [--enable-formula-logger],
1517         [Enable formula logger for logging formula calculation flow in Calc.]
1518     )
1521 dnl ===================================================================
1522 dnl Optional Packages (--with/without-)
1523 dnl ===================================================================
1525 AC_ARG_WITH(gcc-home,
1526     AS_HELP_STRING([--with-gcc-home],
1527         [Specify the location of gcc/g++ manually. This can be used in conjunction
1528          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1529          non-default path.]),
1532 AC_ARG_WITH(gnu-patch,
1533     AS_HELP_STRING([--with-gnu-patch],
1534         [Specify location of GNU patch on Solaris or FreeBSD.]),
1537 AC_ARG_WITH(build-platform-configure-options,
1538     AS_HELP_STRING([--with-build-platform-configure-options],
1539         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1542 AC_ARG_WITH(gnu-cp,
1543     AS_HELP_STRING([--with-gnu-cp],
1544         [Specify location of GNU cp on Solaris or FreeBSD.]),
1547 AC_ARG_WITH(external-tar,
1548     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1549         [Specify an absolute path of where to find (and store) tarfiles.]),
1550     TARFILE_LOCATION=$withval ,
1553 AC_ARG_WITH(referenced-git,
1554     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1555         [Specify another checkout directory to reference. This makes use of
1556                  git submodule update --reference, and saves a lot of diskspace
1557                  when having multiple trees side-by-side.]),
1558     GIT_REFERENCE_SRC=$withval ,
1561 AC_ARG_WITH(linked-git,
1562     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1563         [Specify a directory where the repositories of submodules are located.
1564          This uses a method similar to git-new-workdir to get submodules.]),
1565     GIT_LINK_SRC=$withval ,
1568 AC_ARG_WITH(galleries,
1569     AS_HELP_STRING([--with-galleries],
1570         [Specify how galleries should be built. It is possible either to
1571          build these internally from source ("build"),
1572          or to disable them ("no")]),
1575 AC_ARG_WITH(theme,
1576     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1577         [Choose which themes to include. By default those themes with an '*' are included.
1578          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1579          *elementary_svg, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1582 libo_FUZZ_ARG_WITH(helppack-integration,
1583     AS_HELP_STRING([--without-helppack-integration],
1584         [It will not integrate the helppacks to the installer
1585          of the product. Please use this switch to use the online help
1586          or separate help packages.]),
1589 libo_FUZZ_ARG_WITH(fonts,
1590     AS_HELP_STRING([--without-fonts],
1591         [LibreOffice includes some third-party fonts to provide a reliable basis for
1592          help content, templates, samples, etc. When these fonts are already
1593          known to be available on the system then you should use this option.]),
1596 AC_ARG_WITH(epm,
1597     AS_HELP_STRING([--with-epm],
1598         [Decides which epm to use. Default is to use the one from the system if
1599          one is built. When either this is not there or you say =internal epm
1600          will be built.]),
1603 AC_ARG_WITH(package-format,
1604     AS_HELP_STRING([--with-package-format],
1605         [Specify package format(s) for LibreOffice installation sets. The
1606          implicit --without-package-format leads to no installation sets being
1607          generated. Possible values: aix, archive, bsd, deb, dmg,
1608          installed, msi, pkg, and rpm.
1609          Example: --with-package-format='deb rpm']),
1612 AC_ARG_WITH(tls,
1613     AS_HELP_STRING([--with-tls],
1614         [Decides which TLS/SSL and cryptographic implementations to use for
1615          LibreOffice's code. Notice that this doesn't apply for depending
1616          libraries like "neon", for example. Default is to use OpenSSL
1617          although NSS is also possible. Notice that selecting NSS restricts
1618          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1619          restrict by now the usage of NSS in LO's code. Possible values:
1620          openssl, nss. Example: --with-tls="nss"]),
1623 AC_ARG_WITH(system-libs,
1624     AS_HELP_STRING([--with-system-libs],
1625         [Use libraries already on system -- enables all --with-system-* flags.]),
1628 AC_ARG_WITH(system-bzip2,
1629     AS_HELP_STRING([--with-system-bzip2],
1630         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1631     [with_system_bzip2="$with_system_libs"])
1633 AC_ARG_WITH(system-headers,
1634     AS_HELP_STRING([--with-system-headers],
1635         [Use headers already on system -- enables all --with-system-* flags for
1636          external packages whose headers are the only entities used i.e.
1637          boost/odbc/sane-header(s).]),,
1638     [with_system_headers="$with_system_libs"])
1640 AC_ARG_WITH(system-jars,
1641     AS_HELP_STRING([--without-system-jars],
1642         [When building with --with-system-libs, also the needed jars are expected
1643          on the system. Use this to disable that]),,
1644     [with_system_jars="$with_system_libs"])
1646 AC_ARG_WITH(system-cairo,
1647     AS_HELP_STRING([--with-system-cairo],
1648         [Use cairo libraries already on system.  Happens automatically for
1649          (implicit) --enable-gtk and for --enable-gtk3.]))
1651 AC_ARG_WITH(system-epoxy,
1652     AS_HELP_STRING([--with-system-epoxy],
1653         [Use epoxy libraries already on system.  Happens automatically for
1654          --enable-gtk3.]),,
1655        [with_system_epoxy="$with_system_libs"])
1657 AC_ARG_WITH(myspell-dicts,
1658     AS_HELP_STRING([--with-myspell-dicts],
1659         [Adds myspell dictionaries to the LibreOffice installation set]),
1662 AC_ARG_WITH(system-dicts,
1663     AS_HELP_STRING([--without-system-dicts],
1664         [Do not use dictionaries from system paths.]),
1667 AC_ARG_WITH(external-dict-dir,
1668     AS_HELP_STRING([--with-external-dict-dir],
1669         [Specify external dictionary dir.]),
1672 AC_ARG_WITH(external-hyph-dir,
1673     AS_HELP_STRING([--with-external-hyph-dir],
1674         [Specify external hyphenation pattern dir.]),
1677 AC_ARG_WITH(external-thes-dir,
1678     AS_HELP_STRING([--with-external-thes-dir],
1679         [Specify external thesaurus dir.]),
1682 AC_ARG_WITH(system-zlib,
1683     AS_HELP_STRING([--with-system-zlib],
1684         [Use zlib already on system.]),,
1685     [with_system_zlib=auto])
1687 AC_ARG_WITH(system-jpeg,
1688     AS_HELP_STRING([--with-system-jpeg],
1689         [Use jpeg already on system.]),,
1690     [with_system_jpeg="$with_system_libs"])
1692 AC_ARG_WITH(system-clucene,
1693     AS_HELP_STRING([--with-system-clucene],
1694         [Use clucene already on system.]),,
1695     [with_system_clucene="$with_system_libs"])
1697 AC_ARG_WITH(system-expat,
1698     AS_HELP_STRING([--with-system-expat],
1699         [Use expat already on system.]),,
1700     [with_system_expat="$with_system_libs"])
1702 AC_ARG_WITH(system-libxml,
1703     AS_HELP_STRING([--with-system-libxml],
1704         [Use libxml/libxslt already on system.]),,
1705     [with_system_libxml=auto])
1707 AC_ARG_WITH(system-icu,
1708     AS_HELP_STRING([--with-system-icu],
1709         [Use icu already on system.]),,
1710     [with_system_icu="$with_system_libs"])
1712 AC_ARG_WITH(system-ucpp,
1713     AS_HELP_STRING([--with-system-ucpp],
1714         [Use ucpp already on system.]),,
1715     [])
1717 AC_ARG_WITH(system-openldap,
1718     AS_HELP_STRING([--with-system-openldap],
1719         [Use the OpenLDAP LDAP SDK already on system.]),,
1720     [with_system_openldap="$with_system_libs"])
1722 AC_ARG_WITH(system-poppler,
1723     AS_HELP_STRING([--with-system-poppler],
1724         [Use system poppler (only needed for PDF import).]),,
1725     [with_system_poppler="$with_system_libs"])
1727 AC_ARG_WITH(system-gpgmepp,
1728     AS_HELP_STRING([--with-system-gpgmepp],
1729         [Use gpgmepp already on system]),,
1730     [with_system_gpgmepp="$with_system_libs"])
1732 AC_ARG_WITH(system-apache-commons,
1733     AS_HELP_STRING([--with-system-apache-commons],
1734         [Use Apache commons libraries already on system.]),,
1735     [with_system_apache_commons="$with_system_jars"])
1737 AC_ARG_WITH(system-mariadb,
1738     AS_HELP_STRING([--with-system-mariadb],
1739         [Use MariaDB/MySQL libraries already on system.]),,
1740     [with_system_mariadb="$with_system_libs"])
1742 AC_ARG_ENABLE(bundle-mariadb,
1743     AS_HELP_STRING([--enable-bundle-mariadb],
1744         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1747 AC_ARG_WITH(system-postgresql,
1748     AS_HELP_STRING([--with-system-postgresql],
1749         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1750          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1751     [with_system_postgresql="$with_system_libs"])
1753 AC_ARG_WITH(libpq-path,
1754     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1755         [Use this PostgreSQL C interface (libpq) installation for building
1756          the PostgreSQL-SDBC extension.]),
1759 AC_ARG_WITH(system-firebird,
1760     AS_HELP_STRING([--with-system-firebird],
1761         [Use Firebird libraries already on system, for building the Firebird-SDBC
1762          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1763     [with_system_firebird="$with_system_libs"])
1765 AC_ARG_WITH(system-libtommath,
1766             AS_HELP_STRING([--with-system-libtommath],
1767                            [Use libtommath already on system]),,
1768             [with_system_libtommath="$with_system_libs"])
1770 AC_ARG_WITH(system-hsqldb,
1771     AS_HELP_STRING([--with-system-hsqldb],
1772         [Use hsqldb already on system.]))
1774 AC_ARG_WITH(hsqldb-jar,
1775     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1776         [Specify path to jarfile manually.]),
1777     HSQLDB_JAR=$withval)
1779 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1780     AS_HELP_STRING([--disable-scripting-beanshell],
1781         [Disable support for scripts in BeanShell.]),
1785 AC_ARG_WITH(system-beanshell,
1786     AS_HELP_STRING([--with-system-beanshell],
1787         [Use beanshell already on system.]),,
1788     [with_system_beanshell="$with_system_jars"])
1790 AC_ARG_WITH(beanshell-jar,
1791     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1792         [Specify path to jarfile manually.]),
1793     BSH_JAR=$withval)
1795 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1796     AS_HELP_STRING([--disable-scripting-javascript],
1797         [Disable support for scripts in JavaScript.]),
1801 AC_ARG_WITH(system-rhino,
1802     AS_HELP_STRING([--with-system-rhino],
1803         [Use rhino already on system.]),,)
1804 #    [with_system_rhino="$with_system_jars"])
1805 # Above is not used as we have different debug interface
1806 # patched into internal rhino. This code needs to be fixed
1807 # before we can enable it by default.
1809 AC_ARG_WITH(rhino-jar,
1810     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     RHINO_JAR=$withval)
1814 AC_ARG_WITH(commons-logging-jar,
1815     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     COMMONS_LOGGING_JAR=$withval)
1819 AC_ARG_WITH(system-jfreereport,
1820     AS_HELP_STRING([--with-system-jfreereport],
1821         [Use JFreeReport already on system.]),,
1822     [with_system_jfreereport="$with_system_jars"])
1824 AC_ARG_WITH(sac-jar,
1825     AS_HELP_STRING([--with-sac-jar=JARFILE],
1826         [Specify path to jarfile manually.]),
1827     SAC_JAR=$withval)
1829 AC_ARG_WITH(libxml-jar,
1830     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     LIBXML_JAR=$withval)
1834 AC_ARG_WITH(flute-jar,
1835     AS_HELP_STRING([--with-flute-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     FLUTE_JAR=$withval)
1839 AC_ARG_WITH(jfreereport-jar,
1840     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     JFREEREPORT_JAR=$withval)
1844 AC_ARG_WITH(liblayout-jar,
1845     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     LIBLAYOUT_JAR=$withval)
1849 AC_ARG_WITH(libloader-jar,
1850     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1851         [Specify path to jarfile manually.]),
1852     LIBLOADER_JAR=$withval)
1854 AC_ARG_WITH(libformula-jar,
1855     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1856         [Specify path to jarfile manually.]),
1857     LIBFORMULA_JAR=$withval)
1859 AC_ARG_WITH(librepository-jar,
1860     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1861         [Specify path to jarfile manually.]),
1862     LIBREPOSITORY_JAR=$withval)
1864 AC_ARG_WITH(libfonts-jar,
1865     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     LIBFONTS_JAR=$withval)
1869 AC_ARG_WITH(libserializer-jar,
1870     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1871         [Specify path to jarfile manually.]),
1872     LIBSERIALIZER_JAR=$withval)
1874 AC_ARG_WITH(libbase-jar,
1875     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1876         [Specify path to jarfile manually.]),
1877     LIBBASE_JAR=$withval)
1879 AC_ARG_WITH(system-odbc,
1880     AS_HELP_STRING([--with-system-odbc],
1881         [Use the odbc headers already on system.]),,
1882     [with_system_odbc="auto"])
1884 AC_ARG_WITH(system-sane,
1885     AS_HELP_STRING([--with-system-sane],
1886         [Use sane.h already on system.]),,
1887     [with_system_sane="$with_system_headers"])
1889 AC_ARG_WITH(system-bluez,
1890     AS_HELP_STRING([--with-system-bluez],
1891         [Use bluetooth.h already on system.]),,
1892     [with_system_bluez="$with_system_headers"])
1894 AC_ARG_WITH(system-curl,
1895     AS_HELP_STRING([--with-system-curl],
1896         [Use curl already on system.]),,
1897     [with_system_curl=auto])
1899 AC_ARG_WITH(system-boost,
1900     AS_HELP_STRING([--with-system-boost],
1901         [Use boost already on system.]),,
1902     [with_system_boost="$with_system_headers"])
1904 AC_ARG_WITH(system-glm,
1905     AS_HELP_STRING([--with-system-glm],
1906         [Use glm already on system.]),,
1907     [with_system_glm="$with_system_headers"])
1909 AC_ARG_WITH(system-hunspell,
1910     AS_HELP_STRING([--with-system-hunspell],
1911         [Use libhunspell already on system.]),,
1912     [with_system_hunspell="$with_system_libs"])
1914 AC_ARG_WITH(system-mythes,
1915     AS_HELP_STRING([--with-system-mythes],
1916         [Use mythes already on system.]),,
1917     [with_system_mythes="$with_system_libs"])
1919 AC_ARG_WITH(system-altlinuxhyph,
1920     AS_HELP_STRING([--with-system-altlinuxhyph],
1921         [Use ALTLinuxhyph already on system.]),,
1922     [with_system_altlinuxhyph="$with_system_libs"])
1924 AC_ARG_WITH(system-lpsolve,
1925     AS_HELP_STRING([--with-system-lpsolve],
1926         [Use lpsolve already on system.]),,
1927     [with_system_lpsolve="$with_system_libs"])
1929 AC_ARG_WITH(system-coinmp,
1930     AS_HELP_STRING([--with-system-coinmp],
1931         [Use CoinMP already on system.]),,
1932     [with_system_coinmp="$with_system_libs"])
1934 AC_ARG_WITH(system-liblangtag,
1935     AS_HELP_STRING([--with-system-liblangtag],
1936         [Use liblangtag library already on system.]),,
1937     [with_system_liblangtag="$with_system_libs"])
1939 AC_ARG_WITH(webdav,
1940     AS_HELP_STRING([--with-webdav],
1941         [Specify which library to use for webdav implementation.
1942          Possible values: "neon", "serf", "no". The default value is "neon".
1943          Example: --with-webdav="serf"]),
1944     WITH_WEBDAV=$withval,
1945     WITH_WEBDAV="neon")
1947 AC_ARG_WITH(linker-hash-style,
1948     AS_HELP_STRING([--with-linker-hash-style],
1949         [Use linker with --hash-style=<style> when linking shared objects.
1950          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1951          if supported on the build system, and "sysv" otherwise.]))
1953 AC_ARG_WITH(jdk-home,
1954     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1955         [If you have installed JDK 1.6 or later on your system please supply the
1956          path here. Note that this is not the location of the java command but the
1957          location of the entire distribution.]),
1960 AC_ARG_WITH(help,
1961     AS_HELP_STRING([--with-help],
1962         [Enable the build of help. There is a special parameter "common" that
1963          can be used to bundle only the common part, .e.g help-specific icons.
1964          This is useful when you build the helpcontent separately.])
1965     [
1966                           Usage:     --with-help    build the old local help
1967                                  --without-help     no local help (default)
1968                                  --with-help=html   build the new HTML local help
1969                                  --with-help=online build the new HTML online help
1970     ],
1973 libo_FUZZ_ARG_WITH(java,
1974     AS_HELP_STRING([--with-java=<java command>],
1975         [Specify the name of the Java interpreter command. Typically "java"
1976          which is the default.
1978          To build without support for Java components, applets, accessibility
1979          or the XML filters written in Java, use --without-java or --with-java=no.]),
1980     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1981     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1984 AC_ARG_WITH(jvm-path,
1985     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1986         [Use a specific JVM search path at runtime.
1987          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1990 AC_ARG_WITH(ant-home,
1991     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1992         [If you have installed Jakarta Ant on your system, please supply the path here.
1993          Note that this is not the location of the Ant binary but the location
1994          of the entire distribution.]),
1997 AC_ARG_WITH(symbol-config,
1998     AS_HELP_STRING([--with-symbol-config],
1999         [Configuration for the crashreport symbol upload]),
2000         [],
2001         [with_symbol_config=no])
2003 AC_ARG_WITH(export-validation,
2004     AS_HELP_STRING([--without-export-validation],
2005         [Disable validating OOXML and ODF files as exported from in-tree tests.
2006          Use this option e.g. if your system only provides Java 5.]),
2007 ,with_export_validation=auto)
2009 AC_ARG_WITH(bffvalidator,
2010     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2011         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2012          Requires installed Microsoft Office Binary File Format Validator.
2013          Note: export-validation (--with-export-validation) is required to be turned on.
2014          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2015 ,with_bffvalidator=no)
2017 libo_FUZZ_ARG_WITH(junit,
2018     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2019         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2020          --without-junit disables those tests. Not relevant in the --without-java case.]),
2021 ,with_junit=yes)
2023 AC_ARG_WITH(hamcrest,
2024     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2025         [Specifies the hamcrest jar file to use for JUnit-based tests.
2026          --without-junit disables those tests. Not relevant in the --without-java case.]),
2027 ,with_hamcrest=yes)
2029 AC_ARG_WITH(perl-home,
2030     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2031         [If you have installed Perl 5 Distribution, on your system, please
2032          supply the path here. Note that this is not the location of the Perl
2033          binary but the location of the entire distribution.]),
2036 libo_FUZZ_ARG_WITH(doxygen,
2037     AS_HELP_STRING(
2038         [--with-doxygen=<absolute path to doxygen executable>],
2039         [Specifies the doxygen executable to use when generating ODK C/C++
2040          documentation. --without-doxygen disables generation of ODK C/C++
2041          documentation. Not relevant in the --disable-odk case.]),
2042 ,with_doxygen=yes)
2044 AC_ARG_WITH(visual-studio,
2045     AS_HELP_STRING([--with-visual-studio=<2017>],
2046         [Specify which Visual Studio version to use in case several are
2047          installed. Currently only 2017 is supported.]),
2050 AC_ARG_WITH(windows-sdk,
2051     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2052         [Specify which Windows SDK, or "Windows Kit", version to use
2053          in case the one that came with the selected Visual Studio
2054          is not what you want for some reason. Note that not all compiler/SDK
2055          combinations are supported. The intent is that this option should not
2056          be needed.]),
2059 AC_ARG_WITH(lang,
2060     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2061         [Use this option to build LibreOffice with additional UI language support.
2062          English (US) is always included by default.
2063          Separate multiple languages with space.
2064          For all languages, use --with-lang=ALL.]),
2067 AC_ARG_WITH(locales,
2068     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2069         [Use this option to limit the locale information built in.
2070          Separate multiple locales with space.
2071          Very experimental and might well break stuff.
2072          Just a desperate measure to shrink code and data size.
2073          By default all the locales available is included.
2074          This option is completely unrelated to --with-lang.])
2075     [
2076                           Affects also our character encoding conversion
2077                           tables for encodings mainly targeted for a
2078                           particular locale, like EUC-CN and EUC-TW for
2079                           zh, ISO-2022-JP for ja.
2081                           Affects also our add-on break iterator data for
2082                           some languages.
2084                           For the default, all locales, don't use this switch at all.
2085                           Specifying just the language part of a locale means all matching
2086                           locales will be included.
2087     ],
2090 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2091 libo_FUZZ_ARG_WITH(krb5,
2092     AS_HELP_STRING([--with-krb5],
2093         [Enable MIT Kerberos 5 support in modules that support it.
2094          By default automatically enabled on platforms
2095          where a good system Kerberos 5 is available.]),
2098 libo_FUZZ_ARG_WITH(gssapi,
2099     AS_HELP_STRING([--with-gssapi],
2100         [Enable GSSAPI support in modules that support it.
2101          By default automatically enabled on platforms
2102          where a good system GSSAPI is available.]),
2105 AC_ARG_WITH(iwyu,
2106     AS_HELP_STRING([--with-iwyu],
2107         [Use given IWYU binary path to check unneeded includes instead of building.
2108          Use only if you are hacking on it.]),
2111 libo_FUZZ_ARG_WITH(lxml,
2112     AS_HELP_STRING([--without-lxml],
2113         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2114          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2115          report widget classes and ids.]),
2118 dnl ===================================================================
2119 dnl Branding
2120 dnl ===================================================================
2122 AC_ARG_WITH(branding,
2123     AS_HELP_STRING([--with-branding=/path/to/images],
2124         [Use given path to retrieve branding images set.])
2125     [
2126                           Search for intro.png about.svg and flat_logo.svg.
2127                           If any is missing, default ones will be used instead.
2129                           Search also progress.conf for progress
2130                           settings on intro screen :
2132                           PROGRESSBARCOLOR="255,255,255" Set color of
2133                           progress bar. Comma separated RGB decimal values.
2134                           PROGRESSSIZE="407,6" Set size of progress bar.
2135                           Comma separated decimal values (width, height).
2136                           PROGRESSPOSITION="61,317" Set position of progress
2137                           bar from left,top. Comma separated decimal values.
2138                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2139                           bar frame. Comma separated RGB decimal values.
2140                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2141                           bar text. Comma separated RGB decimal values.
2142                           PROGRESSTEXTBASELINE="287" Set vertical position of
2143                           progress bar text from top. Decimal value.
2145                           Default values will be used if not found.
2146     ],
2150 AC_ARG_WITH(extra-buildid,
2151     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2152         [Show addition build identification in about dialog.]),
2156 AC_ARG_WITH(vendor,
2157     AS_HELP_STRING([--with-vendor="John the Builder"],
2158         [Set vendor of the build.]),
2161 AC_ARG_WITH(android-package-name,
2162     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2163         [Set Android package name of the build.]),
2166 AC_ARG_WITH(compat-oowrappers,
2167     AS_HELP_STRING([--with-compat-oowrappers],
2168         [Install oo* wrappers in parallel with
2169          lo* ones to keep backward compatibility.
2170          Has effect only with make distro-pack-install]),
2173 AC_ARG_WITH(os-version,
2174     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2175         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2178 AC_ARG_WITH(mingw-cross-compiler,
2179     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2180         [Specify the MinGW cross-compiler to use.
2181          When building on the ODK on Unix and building unowinreg.dll,
2182          specify the MinGW C++ cross-compiler.]),
2185 AC_ARG_WITH(idlc-cpp,
2186     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2187         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2190 AC_ARG_WITH(build-version,
2191     AS_HELP_STRING([--with-build-version="Built by Jim"],
2192         [Allows the builder to add a custom version tag that will appear in the
2193          Help/About box for QA purposes.]),
2194 with_build_version=$withval,
2197 AC_ARG_WITH(parallelism,
2198     AS_HELP_STRING([--with-parallelism],
2199         [Number of jobs to run simultaneously during build. Parallel builds can
2200         save a lot of time on multi-cpu machines. Defaults to the number of
2201         CPUs on the machine, unless you configure --enable-icecream - then to
2202         10.]),
2205 AC_ARG_WITH(all-tarballs,
2206     AS_HELP_STRING([--with-all-tarballs],
2207         [Download all external tarballs unconditionally]))
2209 AC_ARG_WITH(gdrive-client-id,
2210     AS_HELP_STRING([--with-gdrive-client-id],
2211         [Provides the client id of the application for OAuth2 authentication
2212         on Google Drive. If either this or --with-gdrive-client-secret is
2213         empty, the feature will be disabled]),
2216 AC_ARG_WITH(gdrive-client-secret,
2217     AS_HELP_STRING([--with-gdrive-client-secret],
2218         [Provides the client secret of the application for OAuth2
2219         authentication on Google Drive. If either this or
2220         --with-gdrive-client-id is empty, the feature will be disabled]),
2223 AC_ARG_WITH(alfresco-cloud-client-id,
2224     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2225         [Provides the client id of the application for OAuth2 authentication
2226         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2227         empty, the feature will be disabled]),
2230 AC_ARG_WITH(alfresco-cloud-client-secret,
2231     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2232         [Provides the client secret of the application for OAuth2
2233         authentication on Alfresco Cloud. If either this or
2234         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2237 AC_ARG_WITH(onedrive-client-id,
2238     AS_HELP_STRING([--with-onedrive-client-id],
2239         [Provides the client id of the application for OAuth2 authentication
2240         on OneDrive. If either this or --with-onedrive-client-secret is
2241         empty, the feature will be disabled]),
2244 AC_ARG_WITH(onedrive-client-secret,
2245     AS_HELP_STRING([--with-onedrive-client-secret],
2246         [Provides the client secret of the application for OAuth2
2247         authentication on OneDrive. If either this or
2248         --with-onedrive-client-id is empty, the feature will be disabled]),
2250 dnl ===================================================================
2251 dnl Do we want to use pre-build binary tarball for recompile
2252 dnl ===================================================================
2254 if test "$enable_library_bin_tar" = "yes" ; then
2255     USE_LIBRARY_BIN_TAR=TRUE
2256 else
2257     USE_LIBRARY_BIN_TAR=
2259 AC_SUBST(USE_LIBRARY_BIN_TAR)
2261 dnl ===================================================================
2262 dnl Test whether build target is Release Build
2263 dnl ===================================================================
2264 AC_MSG_CHECKING([whether build target is Release Build])
2265 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2266     AC_MSG_RESULT([no])
2267     ENABLE_RELEASE_BUILD=
2268 else
2269     AC_MSG_RESULT([yes])
2270     ENABLE_RELEASE_BUILD=TRUE
2272 AC_SUBST(ENABLE_RELEASE_BUILD)
2274 dnl ===================================================================
2275 dnl Test whether to sign Windows Build
2276 dnl ===================================================================
2277 AC_MSG_CHECKING([whether to sign windows build])
2278 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2279     AC_MSG_RESULT([yes])
2280     WINDOWS_BUILD_SIGNING="TRUE"
2281 else
2282     AC_MSG_RESULT([no])
2283     WINDOWS_BUILD_SIGNING="FALSE"
2285 AC_SUBST(WINDOWS_BUILD_SIGNING)
2287 dnl ===================================================================
2288 dnl MacOSX build and runtime environment options
2289 dnl ===================================================================
2291 AC_ARG_WITH(macosx-sdk,
2292     AS_HELP_STRING([--with-macosx-sdk=<version>],
2293         [Prefer a specific SDK for building.])
2294     [
2295                           If the requested SDK is not available, a search for the oldest one will be done.
2296                           With current Xcode versions, only the latest SDK is included, so this option is
2297                           not terribly useful. It works fine to build with a new SDK and run the result
2298                           on an older OS.
2300                           e. g.: --with-macosx-sdk=10.9
2302                           there are 3 options to control the MacOSX build:
2303                           --with-macosx-sdk (referred as 'sdk' below)
2304                           --with-macosx-version-min-required (referred as 'min' below)
2305                           --with-macosx-version-max-allowed (referred as 'max' below)
2307                           the connection between these value and the default they take is as follow:
2308                           ( ? means not specified on the command line, s means the SDK version found,
2309                           constraint: 8 <= x <= y <= z)
2311                           ==========================================
2312                            command line      || config result
2313                           ==========================================
2314                           min  | max  | sdk  || min  | max  | sdk  |
2315                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2316                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2317                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2318                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2319                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2320                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2321                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2322                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2325                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2326                           for a detailed technical explanation of these variables
2328                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2329     ],
2332 AC_ARG_WITH(macosx-version-min-required,
2333     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2334         [set the minimum OS version needed to run the built LibreOffice])
2335     [
2336                           e. g.: --with-macos-version-min-required=10.9
2337                           see --with-macosx-sdk for more info
2338     ],
2341 AC_ARG_WITH(macosx-version-max-allowed,
2342     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2343         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2344     [
2345                           e. g.: --with-macos-version-max-allowed=10.9
2346                           see --with-macosx-sdk for more info
2347     ],
2351 dnl ===================================================================
2352 dnl options for stuff used during cross-compilation build
2353 dnl Not quite superseded by --with-build-platform-configure-options.
2354 dnl TODO: check, if the "force" option is still needed anywhere.
2355 dnl ===================================================================
2357 AC_ARG_WITH(system-icu-for-build,
2358     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2359         [Use icu already on system for build tools (cross-compilation only).]))
2362 dnl ===================================================================
2363 dnl Check for incompatible options set by fuzzing, and reset those
2364 dnl automatically to working combinations
2365 dnl ===================================================================
2367 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2368         "$enable_dbus" != "$enable_avahi"; then
2369     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2370     enable_avahi=$enable_dbus
2373 dnl ===================================================================
2374 dnl check for required programs (grep, awk, sed, bash)
2375 dnl ===================================================================
2377 pathmunge ()
2379     if test -n "$1"; then
2380         if test "$build_os" = "cygwin"; then
2381             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2382                 PathFormat "$1"
2383                 new_path=`cygpath -sm "$formatted_path"`
2384             else
2385                 PathFormat "$1"
2386                 new_path=`cygpath -u "$formatted_path"`
2387             fi
2388         else
2389             new_path="$1"
2390         fi
2391         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2392             if test "$2" = "after"; then
2393                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2394             else
2395                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2396             fi
2397         fi
2398         unset new_path
2399     fi
2402 AC_PROG_AWK
2403 AC_PATH_PROG( AWK, $AWK)
2404 if test -z "$AWK"; then
2405     AC_MSG_ERROR([install awk to run this script])
2408 AC_PATH_PROG(BASH, bash)
2409 if test -z "$BASH"; then
2410     AC_MSG_ERROR([bash not found in \$PATH])
2412 AC_SUBST(BASH)
2414 AC_MSG_CHECKING([for en_US.utf8 locale])
2415 if locale -a | egrep -q 'en_US\.(UTF-8|utf8)'; then
2416     AC_MSG_RESULT(present)
2417 else
2418     AC_MSG_RESULT(absent)
2419     AC_MSG_ERROR([you need en_US.utf8 locale to build])
2422 AC_MSG_CHECKING([for GNU or BSD tar])
2423 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2424     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2425     if test $? -eq 0;  then
2426         GNUTAR=$a
2427         break
2428     fi
2429 done
2430 AC_MSG_RESULT($GNUTAR)
2431 if test -z "$GNUTAR"; then
2432     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2434 AC_SUBST(GNUTAR)
2436 AC_MSG_CHECKING([for tar's option to strip components])
2437 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2438 if test $? -eq 0; then
2439     STRIP_COMPONENTS="--strip-components"
2440 else
2441     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2442     if test $? -eq 0; then
2443         STRIP_COMPONENTS="--strip-path"
2444     else
2445         STRIP_COMPONENTS="unsupported"
2446     fi
2448 AC_MSG_RESULT($STRIP_COMPONENTS)
2449 if test x$STRIP_COMPONENTS = xunsupported; then
2450     AC_MSG_ERROR([you need a tar that is able to strip components.])
2452 AC_SUBST(STRIP_COMPONENTS)
2454 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2455 dnl desktop OSes from "mobile" ones.
2457 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2458 dnl In other words, that when building for an OS that is not a
2459 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2461 dnl Note the direction of the implication; there is no assumption that
2462 dnl cross-compiling would imply a non-desktop OS.
2464 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2465     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2466     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2467     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2470 # Whether to build "avmedia" functionality or not.
2472 if test -z "$enable_avmedia"; then
2473     enable_avmedia=yes
2476 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2477 if test "$enable_avmedia" = yes; then
2478     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2479 else
2480     USE_AVMEDIA_DUMMY='TRUE'
2482 AC_SUBST(USE_AVMEDIA_DUMMY)
2484 # Decide whether to build database connectivity stuff (including
2485 # Base) or not. We probably don't want to on non-desktop OSes.
2486 if test -z "$enable_database_connectivity"; then
2487     # --disable-database-connectivity is unfinished work in progress
2488     # and the iOS test app doesn't link if we actually try to use it.
2489     # if test $_os != iOS -a $_os != Android; then
2490     if test $_os != iOS; then
2491         enable_database_connectivity=yes
2492     fi
2495 if test "$enable_database_connectivity" = yes; then
2496     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2497     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2500 if test -z "$enable_extensions"; then
2501     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2502     if test $_os != iOS -a $_os != Android; then
2503         enable_extensions=yes
2504     fi
2507 if test "$enable_extensions" = yes; then
2508     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2509     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2512 if test -z "$enable_scripting"; then
2513     # Disable scripting for iOS unless specifically overridden
2514     # with --enable-scripting.
2515     if test $_os != iOS; then
2516         enable_scripting=yes
2517     fi
2520 DISABLE_SCRIPTING=''
2521 if test "$enable_scripting" = yes; then
2522     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2523     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2524 else
2525     DISABLE_SCRIPTING='TRUE'
2526     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2529 if test $_os = iOS -o $_os = Android; then
2530     # Disable dynamic_loading always for iOS and Android
2531     enable_dynamic_loading=no
2532 elif test -z "$enable_dynamic_loading"; then
2533     # Otherwise enable it unless speficically disabled
2534     enable_dynamic_loading=yes
2537 DISABLE_DYNLOADING=''
2538 if test "$enable_dynamic_loading" = yes; then
2539     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2540 else
2541     DISABLE_DYNLOADING='TRUE'
2543 AC_SUBST(DISABLE_DYNLOADING)
2545 # remenber SYSBASE value
2546 AC_SUBST(SYSBASE)
2548 dnl ===================================================================
2549 dnl  Sort out various gallery compilation options
2550 dnl ===================================================================
2551 AC_MSG_CHECKING([how to build and package galleries])
2552 if test -n "${with_galleries}"; then
2553     if test "$with_galleries" = "build"; then
2554         WITH_GALLERY_BUILD=TRUE
2555         AC_MSG_RESULT([build from source images internally])
2556     elif test "$with_galleries" = "no"; then
2557         WITH_GALLERY_BUILD=
2558         AC_MSG_RESULT([disable non-internal gallery build])
2559     else
2560         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2561     fi
2562 else
2563     if test $_os != iOS -a $_os != Android; then
2564         WITH_GALLERY_BUILD=TRUE
2565         AC_MSG_RESULT([internal src images for desktop])
2566     else
2567         WITH_GALLERY_BUILD=
2568         AC_MSG_RESULT([disable src image build])
2569     fi
2571 AC_SUBST(WITH_GALLERY_BUILD)
2573 dnl ===================================================================
2574 dnl  Checks if ccache is available
2575 dnl ===================================================================
2576 if test "$_os" = "WINNT"; then
2577     # on windows/VC build do not use ccache
2578     CCACHE=""
2579 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2580     case "%$CC%$CXX%" in
2581     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2582     # assume that's good then
2583     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2584         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2585         ;;
2586     *)
2587         AC_PATH_PROG([CCACHE],[ccache],[not found])
2588         if test "$CCACHE" = "not found"; then
2589             CCACHE=""
2590         else
2591             # Need to check for ccache version: otherwise prevents
2592             # caching of the results (like "-x objective-c++" for Mac)
2593             if test $_os = Darwin -o $_os = iOS; then
2594                 # Check ccache version
2595                 AC_MSG_CHECKING([whether version of ccache is suitable])
2596                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2597                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2598                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2599                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2600                 else
2601                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2602                     CCACHE=""
2603                 fi
2604             fi
2605         fi
2606         ;;
2607     esac
2608 else
2609     CCACHE=""
2612 if test "$CCACHE" != ""; then
2613     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2614     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2615     if test "$ccache_size" = ""; then
2616         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2617         if test "$ccache_size" = ""; then
2618             ccache_size=0
2619         fi
2620         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2621         if test $ccache_size -lt 1024; then
2622             CCACHE=""
2623             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2624             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2625         else
2626             # warn that ccache may be too small for debug build
2627             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2628             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2629         fi
2630     else
2631         if test $ccache_size -lt 5; then
2632             #warn that ccache may be too small for debug build
2633             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2634             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2635         fi
2636     fi
2639 dnl ===================================================================
2640 dnl  Checks for C compiler,
2641 dnl  The check for the C++ compiler is later on.
2642 dnl ===================================================================
2643 if test "$_os" != "WINNT"; then
2644     GCC_HOME_SET="true"
2645     AC_MSG_CHECKING([gcc home])
2646     if test -z "$with_gcc_home"; then
2647         if test "$enable_icecream" = "yes"; then
2648             if test -d "/usr/lib/icecc/bin"; then
2649                 GCC_HOME="/usr/lib/icecc/"
2650             elif test -d "/usr/libexec/icecc/bin"; then
2651                 GCC_HOME="/usr/libexec/icecc/"
2652             elif test -d "/opt/icecream/bin"; then
2653                 GCC_HOME="/opt/icecream/"
2654             else
2655                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2657             fi
2658         else
2659             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2660             GCC_HOME_SET="false"
2661         fi
2662     else
2663         GCC_HOME="$with_gcc_home"
2664     fi
2665     AC_MSG_RESULT($GCC_HOME)
2666     AC_SUBST(GCC_HOME)
2668     if test "$GCC_HOME_SET" = "true"; then
2669         if test -z "$CC"; then
2670             CC="$GCC_HOME/bin/gcc"
2671         fi
2672         if test -z "$CXX"; then
2673             CXX="$GCC_HOME/bin/g++"
2674         fi
2675     fi
2678 COMPATH=`dirname "$CC"`
2679 if test "$COMPATH" = "."; then
2680     AC_PATH_PROGS(COMPATH, $CC)
2681     dnl double square bracket to get single because of M4 quote...
2682     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2684 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2686 dnl ===================================================================
2687 dnl Java support
2688 dnl ===================================================================
2689 AC_MSG_CHECKING([whether to build with Java support])
2690 if test "$with_java" != "no"; then
2691     if test "$DISABLE_SCRIPTING" = TRUE; then
2692         AC_MSG_RESULT([no, overridden by --disable-scripting])
2693         ENABLE_JAVA=""
2694         with_java=no
2695     else
2696         AC_MSG_RESULT([yes])
2697         ENABLE_JAVA="TRUE"
2698         AC_DEFINE(HAVE_FEATURE_JAVA)
2699     fi
2700 else
2701     AC_MSG_RESULT([no])
2702     ENABLE_JAVA=""
2705 AC_SUBST(ENABLE_JAVA)
2707 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2709 dnl ENABLE_JAVA="" indicate no Java support at all
2711 dnl ===================================================================
2712 dnl Check OS X SDK and compiler
2713 dnl ===================================================================
2715 if test $_os = Darwin -o $_os = iOS; then
2717     # If no --with-macosx-sdk option is given, look for one
2719     # The intent is that for "most" Mac-based developers, a suitable
2720     # SDK will be found automatically without any configure options.
2722     # For developers with a current Xcode, the lowest-numbered SDK
2723     # higher than or equal to the minimum required should be found.
2725     AC_MSG_CHECKING([what Mac OS X SDK to use])
2726     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2727         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2728         if test -d "$MACOSX_SDK_PATH"; then
2729             with_macosx_sdk="${_macosx_sdk}"
2730             break
2731         else
2732             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2733             if test -d "$MACOSX_SDK_PATH"; then
2734                 with_macosx_sdk="${_macosx_sdk}"
2735                 break
2736             fi
2737         fi
2738     done
2739     if test ! -d "$MACOSX_SDK_PATH"; then
2740         AC_MSG_ERROR([Could not find an appropriate Mac OS X SDK])
2741     fi
2743     if test $_os = iOS; then
2744         if test "$enable_ios_simulator" = "yes"; then
2745             useos=iphonesimulator
2746         else
2747             useos=iphoneos
2748         fi
2749         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2750     fi
2751     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2754     case $with_macosx_sdk in
2755     10.12)
2756         MACOSX_SDK_VERSION=101200
2757         ;;
2758     10.13)
2759         MACOSX_SDK_VERSION=101300
2760         ;;
2761     10.14)
2762         MACOSX_SDK_VERSION=101400
2763         ;;
2764     *)
2765         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2766         ;;
2767     esac
2769     if test "$with_macosx_version_min_required" = "" ; then
2770         with_macosx_version_min_required="10.9";
2771     fi
2773     if test "$with_macosx_version_max_allowed" = "" ; then
2774         with_macosx_version_max_allowed="$with_macosx_sdk"
2775     fi
2777     # export this so that "xcrun" invocations later return matching values
2778     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2779     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2780     export DEVELOPER_DIR
2781     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2782     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2784     case "$with_macosx_version_min_required" in
2785     10.9)
2786         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2787         ;;
2788     10.10)
2789         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2790         ;;
2791     10.11)
2792         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2793         ;;
2794     10.12)
2795         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2796         ;;
2797     10.13)
2798         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2799         ;;
2800     10.14)
2801         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2802         ;;
2803     *)
2804         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--14])
2805         ;;
2806     esac
2807     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2809     LIBTOOL=/usr/bin/libtool
2810     INSTALL_NAME_TOOL=install_name_tool
2811     if test -z "$save_CC"; then
2812         AC_MSG_CHECKING([what compiler to use])
2813         stdlib=-stdlib=libc++
2814         if test "$ENABLE_LTO" = TRUE; then
2815             lto=-flto
2816         fi
2817         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2818         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2819         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2820         AR=`xcrun -find ar`
2821         NM=`xcrun -find nm`
2822         STRIP=`xcrun -find strip`
2823         LIBTOOL=`xcrun -find libtool`
2824         RANLIB=`xcrun -find ranlib`
2825         AC_MSG_RESULT([$CC and $CXX])
2826     fi
2828     case "$with_macosx_version_max_allowed" in
2829     10.9)
2830         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2831         ;;
2832     10.10)
2833         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2834         ;;
2835     10.11)
2836         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2837         ;;
2838     10.12)
2839         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2840         ;;
2841     10.13)
2842         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2843         ;;
2844     10.14)
2845         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2846         ;;
2847     *)
2848         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--14])
2849         ;;
2850     esac
2852     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2853     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2854         AC_MSG_ERROR([the version minimumn required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
2855     else
2856         AC_MSG_RESULT([ok])
2857     fi
2859     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2860     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2861         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2862     else
2863         AC_MSG_RESULT([ok])
2864     fi
2865     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2866     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2868     AC_MSG_CHECKING([whether to do code signing])
2870     if test "$enable_macosx_code_signing" = yes; then
2871         # By default use the first suitable certificate (?).
2873         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2874         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2875         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2876         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2877         # "Developer ID Application" one.
2879         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2880         if test -n "$identity"; then
2881             MACOSX_CODESIGNING_IDENTITY=$identity
2882             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2883             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2884         else
2885             AC_MSG_ERROR([cannot determine identity to use])
2886         fi
2887     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2888         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2889         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2890         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2891     else
2892         AC_MSG_RESULT([no])
2893     fi
2895     AC_MSG_CHECKING([whether to create a Mac App Store package])
2897     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2898         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2899     elif test "$enable_macosx_package_signing" = yes; then
2900         # By default use the first suitable certificate.
2901         # It should be a "3rd Party Mac Developer Installer" one
2903         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2904         if test -n "$identity"; then
2905             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2906             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2907             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2908         else
2909             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2910         fi
2911     elif test -n "$enable_macosx_package_signing"; then
2912         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2913         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2914         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2915     else
2916         AC_MSG_RESULT([no])
2917     fi
2919     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2920         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2921     fi
2923     AC_MSG_CHECKING([whether to sandbox the application])
2925     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2926         AC_MSG_ERROR([OS X sandboxing requires code signing])
2927     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2928         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2929     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2930         ENABLE_MACOSX_SANDBOX=TRUE
2931         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2932         AC_MSG_RESULT([yes])
2933     else
2934         AC_MSG_RESULT([no])
2935     fi
2937     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2938     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2939     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2941 AC_SUBST(MACOSX_SDK_PATH)
2942 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2943 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2944 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2945 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2946 AC_SUBST(INSTALL_NAME_TOOL)
2947 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2948 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2949 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2950 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2951 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2953 dnl ===================================================================
2954 dnl Check iOS SDK and compiler
2955 dnl ===================================================================
2957 if test $_os = iOS; then
2958     AC_MSG_CHECKING([what iOS SDK to use])
2959     current_sdk_ver=12.1
2960     older_sdk_vers="12.0 11.4"
2961     if test "$enable_ios_simulator" = "yes"; then
2962         platform=iPhoneSimulator
2963         versionmin=-mios-simulator-version-min=11.0
2964     else
2965         platform=iPhoneOS
2966         versionmin=-miphoneos-version-min=11.0
2967     fi
2968     xcode_developer=`xcode-select -print-path`
2970     for sdkver in $current_sdk_ver $older_sdk_vers; do
2971         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2972         if test -d $t; then
2973             sysroot=$t
2974             break
2975         fi
2976     done
2978     if test -z "$sysroot"; then
2979         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2980     fi
2982     AC_MSG_RESULT($sysroot)
2984     # LTO is not really recommended for iOS builds,
2985     # the link time will be astronomical
2986     if test "$ENABLE_LTO" = TRUE; then
2987         lto=-flto
2988     fi
2990     stdlib="-stdlib=libc++"
2992     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2993     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2995     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2996     AR=`xcrun -find ar`
2997     NM=`xcrun -find nm`
2998     STRIP=`xcrun -find strip`
2999     LIBTOOL=`xcrun -find libtool`
3000     RANLIB=`xcrun -find ranlib`
3003 AC_MSG_CHECKING([whether to treat the installation as read-only])
3005 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3006         "$enable_extensions" != yes; then
3007     enable_readonly_installset=yes
3009 if test "$enable_readonly_installset" = yes; then
3010     AC_MSG_RESULT([yes])
3011     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3012 else
3013     AC_MSG_RESULT([no])
3016 dnl ===================================================================
3017 dnl Structure of install set
3018 dnl ===================================================================
3020 if test $_os = Darwin; then
3021     LIBO_BIN_FOLDER=MacOS
3022     LIBO_ETC_FOLDER=Resources
3023     LIBO_LIBEXEC_FOLDER=MacOS
3024     LIBO_LIB_FOLDER=Frameworks
3025     LIBO_LIB_PYUNO_FOLDER=Resources
3026     LIBO_SHARE_FOLDER=Resources
3027     LIBO_SHARE_HELP_FOLDER=Resources/help
3028     LIBO_SHARE_JAVA_FOLDER=Resources/java
3029     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3030     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3031     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3032     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3033     LIBO_URE_BIN_FOLDER=MacOS
3034     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3035     LIBO_URE_LIB_FOLDER=Frameworks
3036     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3037     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3038 elif test $_os = WINNT; then
3039     LIBO_BIN_FOLDER=program
3040     LIBO_ETC_FOLDER=program
3041     LIBO_LIBEXEC_FOLDER=program
3042     LIBO_LIB_FOLDER=program
3043     LIBO_LIB_PYUNO_FOLDER=program
3044     LIBO_SHARE_FOLDER=share
3045     LIBO_SHARE_HELP_FOLDER=help
3046     LIBO_SHARE_JAVA_FOLDER=program/classes
3047     LIBO_SHARE_PRESETS_FOLDER=presets
3048     LIBO_SHARE_READMES_FOLDER=readmes
3049     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3050     LIBO_SHARE_SHELL_FOLDER=program/shell
3051     LIBO_URE_BIN_FOLDER=program
3052     LIBO_URE_ETC_FOLDER=program
3053     LIBO_URE_LIB_FOLDER=program
3054     LIBO_URE_MISC_FOLDER=program
3055     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3056 else
3057     LIBO_BIN_FOLDER=program
3058     LIBO_ETC_FOLDER=program
3059     LIBO_LIBEXEC_FOLDER=program
3060     LIBO_LIB_FOLDER=program
3061     LIBO_LIB_PYUNO_FOLDER=program
3062     LIBO_SHARE_FOLDER=share
3063     LIBO_SHARE_HELP_FOLDER=help
3064     LIBO_SHARE_JAVA_FOLDER=program/classes
3065     LIBO_SHARE_PRESETS_FOLDER=presets
3066     LIBO_SHARE_READMES_FOLDER=readmes
3067     if test "$enable_fuzzers" != yes; then
3068         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3069     else
3070         LIBO_SHARE_RESOURCE_FOLDER=resource
3071     fi
3072     LIBO_SHARE_SHELL_FOLDER=program/shell
3073     LIBO_URE_BIN_FOLDER=program
3074     LIBO_URE_ETC_FOLDER=program
3075     LIBO_URE_LIB_FOLDER=program
3076     LIBO_URE_MISC_FOLDER=program
3077     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3079 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3096 # Not all of them needed in config_host.mk, add more if need arises
3097 AC_SUBST(LIBO_BIN_FOLDER)
3098 AC_SUBST(LIBO_ETC_FOLDER)
3099 AC_SUBST(LIBO_LIB_FOLDER)
3100 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3101 AC_SUBST(LIBO_SHARE_FOLDER)
3102 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3103 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3104 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3105 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3106 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3107 AC_SUBST(LIBO_URE_BIN_FOLDER)
3108 AC_SUBST(LIBO_URE_ETC_FOLDER)
3109 AC_SUBST(LIBO_URE_LIB_FOLDER)
3110 AC_SUBST(LIBO_URE_MISC_FOLDER)
3111 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3113 dnl ===================================================================
3114 dnl Windows specific tests and stuff
3115 dnl ===================================================================
3117 reg_get_value()
3119     # Return value: $regvalue
3120     unset regvalue
3122     local _regentry="/proc/registry${1}/${2}"
3123     if test -f "$_regentry"; then
3124         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3125         # Registry keys read via /proc/registry* are always \0 terminated!
3126         local _regvalue=$(tr -d '\0' < "$_regentry")
3127         if test $? -eq 0; then
3128             regvalue=$_regvalue
3129         fi
3130     fi
3133 # Get a value from the 32-bit side of the Registry
3134 reg_get_value_32()
3136     reg_get_value "32" "$1"
3139 # Get a value from the 64-bit side of the Registry
3140 reg_get_value_64()
3142     reg_get_value "64" "$1"
3145 if test "$_os" = "WINNT"; then
3146     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3147     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3148         AC_MSG_RESULT([no])
3149         WINDOWS_SDK_ARCH="x86"
3150     else
3151         AC_MSG_RESULT([yes])
3152         WINDOWS_SDK_ARCH="x64"
3153         BITNESS_OVERRIDE=64
3154     fi
3156 if test "$_os" = "iOS"; then
3157     cross_compiling="yes"
3160 if test "$cross_compiling" = "yes"; then
3161     export CROSS_COMPILING=TRUE
3162 else
3163     CROSS_COMPILING=
3164     BUILD_TYPE="$BUILD_TYPE NATIVE"
3166 AC_SUBST(CROSS_COMPILING)
3168 USE_LD=
3169 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3170     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3171     if test "$GCC" = "yes"; then
3172         ldflags_save=$LDFLAGS
3173         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3174         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3175 #include <stdio.h>
3176             ],[
3177 printf ("hello world\n");
3178             ])], USE_LD=$enable_ld, [])
3179         if test -n "$USE_LD"; then
3180             AC_MSG_RESULT( yes )
3181             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3182         else
3183             AC_MSG_ERROR( no )
3184         fi
3185     else
3186         AC_MSG_ERROR( not supported )
3187     fi
3189 AC_SUBST(USE_LD)
3191 ENABLE_GDB_INDEX=
3192 if test "$enable_gdb_index" = "yes"; then
3193     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3194     save_CFLAGS=$CFLAGS
3195     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3196     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3198     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3199     ldflags_save=$LDFLAGS
3200     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3201     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3202 #include <stdio.h>
3203         ],[
3204 printf ("hello world\n");
3205         ])], ENABLE_GDB_INDEX=TRUE, [])
3206     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3207         AC_MSG_RESULT( yes )
3208     else
3209         AC_MSG_ERROR( no )
3210     fi
3211     CFLAGS=$save_CFLAGS
3212     LDFLAGS=$ldflags_save
3214 AC_SUBST(ENABLE_GDB_INDEX)
3216 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3217 if test "$GCC" = "yes"; then
3218     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3219     bsymbolic_functions_ldflags_save=$LDFLAGS
3220     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3221     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3222 #include <stdio.h>
3223         ],[
3224 printf ("hello world\n");
3225         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3226     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3227         AC_MSG_RESULT( found )
3228     else
3229         AC_MSG_RESULT( not found )
3230     fi
3231     LDFLAGS=$bsymbolic_functions_ldflags_save
3233 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3235 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3236 # NOTE: must _not_ be used for bundled external libraries!
3237 ISYSTEM=
3238 if test "$GCC" = "yes"; then
3239     AC_MSG_CHECKING( for -isystem )
3240     save_CFLAGS=$CFLAGS
3241     CFLAGS="$CFLAGS -Werror"
3242     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3243     CFLAGS=$save_CFLAGS
3244     if test -n "$ISYSTEM"; then
3245         AC_MSG_RESULT(yes)
3246     else
3247         AC_MSG_RESULT(no)
3248     fi
3250 if test -z "$ISYSTEM"; then
3251     # fall back to using -I
3252     ISYSTEM=-I
3254 AC_SUBST(ISYSTEM)
3256 dnl ===================================================================
3257 dnl  Check which Visual Studio compiler is used
3258 dnl ===================================================================
3260 map_vs_year_to_version()
3262     # Return value: $vsversion
3264     unset vsversion
3266     case $1 in
3267     2017)
3268         vsversion=15.0;;
3269     *)
3270         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3271     esac
3274 vs_versions_to_check()
3276     # Args: $1 (optional) : versions to check, in the order of preference
3277     # Return value: $vsversions
3279     unset vsversions
3281     if test -n "$1"; then
3282         map_vs_year_to_version "$1"
3283         vsversions=$vsversion
3284     else
3285         # We accept only 2017
3286         vsversions="15.0"
3287     fi
3290 win_get_env_from_vsvars32bat()
3292     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3293     # Also seems to be located in another directory under the same name: vsvars32.bat
3294     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3295     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3296     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3297     chmod +x $WRAPPERBATCHFILEPATH
3298     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3299     rm -f $WRAPPERBATCHFILEPATH
3300     printf '%s' "$_win_get_env_from_vsvars32bat"
3303 find_ucrt()
3305     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3306     if test -n "$regvalue"; then
3307         PathFormat "$regvalue"
3308         UCRTSDKDIR=$formatted_path
3309         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3310         UCRTVERSION=$regvalue
3311         # Rest if not exist
3312         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3313           UCRTSDKDIR=
3314         fi
3315     fi
3316     if test -z "$UCRTSDKDIR"; then
3317         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3318         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3319         if test -f "$ide_env_file"; then
3320             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3321             UCRTSDKDIR=$formatted_path
3322             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3323             dnl Hack needed at least by tml:
3324             if test "$UCRTVERSION" = 10.0.15063.0 \
3325                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3326                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3327             then
3328                 UCRTVERSION=10.0.14393.0
3329             fi
3330         else
3331           AC_MSG_ERROR([No UCRT found])
3332         fi
3333     fi
3336 find_msvc()
3338     # Find Visual C++ 2017
3339     # Args: $1 (optional) : The VS version year
3340     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3342     unset vctest vcnum vcnumwithdot vcbuildnumber
3344     vs_versions_to_check "$1"
3346     for ver in $vsversions; do
3347         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3348         if test -n "$regvalue"; then
3349             vctest=$regvalue
3350             break
3351         fi
3352         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3353         if test -n "$regvalue"; then
3354             AC_MSG_RESULT([found: $regvalue])
3355             PathFormat "$regvalue"
3356             vctest=$formatted_path
3357             break
3358         fi
3359     done
3360     if test -n "$vctest"; then
3361         vcnumwithdot=$ver
3362         case "$vcnumwithdot" in
3363         15.0)
3364             vcyear=2017
3365             vcnum=150
3366             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3367             ;;
3368         esac
3369     fi
3372 SOLARINC=
3373 MSBUILD_PATH=
3374 DEVENV=
3375 if test "$_os" = "WINNT"; then
3376     AC_MSG_CHECKING([Visual C++])
3378     find_msvc "$with_visual_studio"
3379     if test -z "$vctest"; then
3380         if test -n "$with_visual_studio"; then
3381             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3382         else
3383             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3384         fi
3385     fi
3387     if test "$BITNESS_OVERRIDE" = ""; then
3388         if test -f "$vctest/bin/cl.exe"; then
3389             VC_PRODUCT_DIR=$vctest
3390         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3391             VC_PRODUCT_DIR=$vctest/VC
3392         else
3393             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3394         fi
3395     else
3396         if test -f "$vctest/bin/amd64/cl.exe"; then
3397             VC_PRODUCT_DIR=$vctest
3398         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3399             VC_PRODUCT_DIR=$vctest/VC
3400         else
3401             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])
3402         fi
3403     fi
3405     AC_MSG_CHECKING([for short pathname of VC product directory])
3406     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3407     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3409     UCRTSDKDIR=
3410     UCRTVERSION=
3412     AC_MSG_CHECKING([for UCRT location])
3413     find_ucrt
3414     # find_ucrt errors out if it doesn't find it
3415     AC_MSG_RESULT([found])
3416     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3417     ucrtincpath_formatted=$formatted_path
3418     # SOLARINC is used for external modules and must be set too.
3419     # And no, it's not sufficient to set SOLARINC only, as configure
3420     # itself doesn't honour it.
3421     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3422     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3423     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3424     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3426     AC_SUBST(UCRTSDKDIR)
3427     AC_SUBST(UCRTVERSION)
3429     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3430     # Find the proper version of MSBuild.exe to use based on the VS version
3431     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3432     if test -n "$regvalue" ; then
3433         AC_MSG_RESULT([found: $regvalue])
3434         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3435     else
3436         if test "$BITNESS_OVERRIDE" = ""; then
3437             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3438         else
3439             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3440         fi
3441         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3442         AC_MSG_RESULT([$regvalue])
3443     fi
3445     # Find the version of devenv.exe
3446     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3447     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3448     if test ! -e "$DEVENV"; then
3449         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3450     fi
3452     dnl ===========================================================
3453     dnl  Check for the corresponding mspdb*.dll
3454     dnl ===========================================================
3456     MSPDB_PATH=
3457     CL_DIR=
3458     CL_LIB=
3460     if test "$BITNESS_OVERRIDE" = ""; then
3461         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3462         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3463     else
3464         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3465         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3466     fi
3468     # MSVC 15.0 has libraries from 14.0?
3469     mspdbnum="140"
3471     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3472         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3473     fi
3475     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3476     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3478     dnl The path needs to be added before cl is called
3479     PATH="$MSPDB_PATH:$PATH"
3481     AC_MSG_CHECKING([cl.exe])
3483     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3484     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3485     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3486     # is not enough?
3488     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3489     dnl needed when building CLR code:
3490     if test -z "$MSVC_CXX"; then
3491         if test "$BITNESS_OVERRIDE" = ""; then
3492             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3493                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3494             fi
3495         else
3496             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3497                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3498             fi
3499         fi
3501         # This gives us a posix path with 8.3 filename restrictions
3502         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3503     fi
3505     if test -z "$CC"; then
3506         CC=$MSVC_CXX
3507     fi
3508     if test "$BITNESS_OVERRIDE" = ""; then
3509         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3510         MSVC_CXX="$MSVC_CXX -arch:SSE"
3511     fi
3513     if test -n "$CC"; then
3514         # Remove /cl.exe from CC case insensitive
3515         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3516         if test "$BITNESS_OVERRIDE" = ""; then
3517            COMPATH="$VC_PRODUCT_DIR"
3518         else
3519             if test -n "$VC_PRODUCT_DIR"; then
3520                 COMPATH=$VC_PRODUCT_DIR
3521             fi
3522         fi
3523         if test "$BITNESS_OVERRIDE" = ""; then
3524             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3525             CC="$CC -arch:SSE"
3526         fi
3528         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3530         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3532         PathFormat "$COMPATH"
3533         COMPATH="$formatted_path"
3535         VCVER=$vcnum
3536         MSVSVER=$vcyear
3538         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3539         # are always "better", we list them in reverse chronological order.
3541         case $vcnum in
3542         150)
3543             COMEX=19
3544             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3545             ;;
3546         esac
3548         # The expectation is that --with-windows-sdk should not need to be used
3549         if test -n "$with_windows_sdk"; then
3550             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3551             *" "$with_windows_sdk" "*)
3552                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3553                 ;;
3554             *)
3555                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3556                 ;;
3557             esac
3558         fi
3560         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3561         ac_objext=obj
3562         ac_exeext=exe
3564     else
3565         AC_MSG_ERROR([Visual C++ not found after all, huh])
3566     fi
3568     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3569     # version of the Explorer extension (and maybe other small
3570     # bits, too) needed when installing a 32-bit LibreOffice on a
3571     # 64-bit OS. The 64-bit Explorer extension is a feature that
3572     # has been present since long in OOo. Don't confuse it with
3573     # building LibreOffice itself as 64-bit code.
3575     BUILD_X64=
3576     CXX_X64_BINARY=
3577     LINK_X64_BINARY=
3579     if test "$BITNESS_OVERRIDE" = ""; then
3580         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3581         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3582             # Prefer native x64 compiler to cross-compiler, in case we are running
3583             # the build on a 64-bit OS.
3584             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3585                 BUILD_X64=TRUE
3586                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3587                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3588             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3589                 BUILD_X64=TRUE
3590                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3591                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3592             fi
3593         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3594             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3595             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3596                 BUILD_X64=TRUE
3597                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3598                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3599             fi
3600         fi
3601         if test "$BUILD_X64" = TRUE; then
3602             AC_MSG_RESULT([found])
3603         else
3604             AC_MSG_RESULT([not found])
3605             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3606         fi
3607     fi
3608     AC_SUBST(BUILD_X64)
3610     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3611     AC_SUBST(CXX_X64_BINARY)
3612     AC_SUBST(LINK_X64_BINARY)
3614 AC_SUBST(VCVER)
3615 AC_SUBST(DEVENV)
3616 PathFormat "$MSPDB_PATH"
3617 MSPDB_PATH="$formatted_path"
3618 AC_SUBST(MSVC_CXX)
3621 # unowinreg.dll
3623 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3624 AC_SUBST(UNOWINREG_DLL)
3626 COM_IS_CLANG=
3627 AC_MSG_CHECKING([whether the compiler is actually Clang])
3628 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3629     #ifndef __clang__
3630     you lose
3631     #endif
3632     int foo=42;
3633     ]])],
3634     [AC_MSG_RESULT([yes])
3635      COM_IS_CLANG=TRUE],
3636     [AC_MSG_RESULT([no])])
3638 CC_PLAIN=$CC
3639 if test "$COM_IS_CLANG" = TRUE; then
3640     AC_MSG_CHECKING([the Clang version])
3641     if test "$_os" = WINNT; then
3642         dnl In which case, assume clang-cl:
3643         my_args="/EP /TC"
3644         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3645         dnl clang-cl:
3646         CC_PLAIN=
3647         for i in $CC; do
3648             case $i in
3649             -FIIntrin.h)
3650                 ;;
3651             *)
3652                 CC_PLAIN="$CC_PLAIN $i"
3653                 ;;
3654             esac
3655         done
3656     else
3657         my_args="-E -P"
3658     fi
3659     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3660     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3661     CLANGVER=`echo $clang_version \
3662         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3663     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3664     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3665     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3667 AC_SUBST(COM_IS_CLANG)
3668 AC_SUBST(CLANGVER)
3670 SHOWINCLUDES_PREFIX=
3671 if test "$_os" = WINNT; then
3672     dnl We need to guess the prefix of the -showIncludes output, it can be
3673     dnl localized
3674     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3675     echo "#include <stdlib.h>" > conftest.c
3676     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3677         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3678     rm -f conftest.c conftest.obj
3679     if test -z "$SHOWINCLUDES_PREFIX"; then
3680         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3681     else
3682         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3683     fi
3685 AC_SUBST(SHOWINCLUDES_PREFIX)
3688 # prefix C with ccache if needed
3690 if test "$CCACHE" != ""; then
3691     AC_MSG_CHECKING([whether $CC is already ccached])
3693     AC_LANG_PUSH([C])
3694     save_CFLAGS=$CFLAGS
3695     CFLAGS="$CFLAGS --ccache-skip -O2"
3696     dnl an empty program will do, we're checking the compiler flags
3697     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3698                       [use_ccache=yes], [use_ccache=no])
3699     if test $use_ccache = yes; then
3700         AC_MSG_RESULT([yes])
3701     else
3702         CC="$CCACHE $CC"
3703         AC_MSG_RESULT([no])
3704     fi
3705     CFLAGS=$save_CFLAGS
3706     AC_LANG_POP([C])
3709 # ===================================================================
3710 # check various GCC options that Clang does not support now but maybe
3711 # will somewhen in the future, check them even for GCC, so that the
3712 # flags are set
3713 # ===================================================================
3715 HAVE_GCC_GGDB2=
3716 HAVE_GCC_FINLINE_LIMIT=
3717 HAVE_GCC_FNO_INLINE=
3718 if test "$GCC" = "yes"; then
3719     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3720     save_CFLAGS=$CFLAGS
3721     CFLAGS="$CFLAGS -Werror -ggdb2"
3722     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3723     CFLAGS=$save_CFLAGS
3724     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3725         AC_MSG_RESULT([yes])
3726     else
3727         AC_MSG_RESULT([no])
3728     fi
3730     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3731     save_CFLAGS=$CFLAGS
3732     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3733     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3734     CFLAGS=$save_CFLAGS
3735     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3736         AC_MSG_RESULT([yes])
3737     else
3738         AC_MSG_RESULT([no])
3739     fi
3741     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3742     save_CFLAGS=$CFLAGS
3743     CFLAGS="$CFLAGS -Werror -fno-inline"
3744     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3745     CFLAGS=$save_CFLAGS
3746     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3747         AC_MSG_RESULT([yes])
3748     else
3749         AC_MSG_RESULT([no])
3750     fi
3752     if test "$host_cpu" = "m68k"; then
3753         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3754         save_CFLAGS=$CFLAGS
3755         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3756         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3757         CFLAGS=$save_CFLAGS
3758         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3759             AC_MSG_RESULT([yes])
3760         else
3761             AC_MSG_ERROR([no])
3762         fi
3763     fi
3765 AC_SUBST(HAVE_GCC_GGDB2)
3766 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3767 AC_SUBST(HAVE_GCC_FNO_INLINE)
3769 dnl ===================================================================
3770 dnl  Test the gcc version
3771 dnl ===================================================================
3772 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3773     AC_MSG_CHECKING([the GCC version])
3774     _gcc_version=`$CC -dumpversion`
3775     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3776         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3777     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3779     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3781     if test "$gcc_full_version" -lt 40801; then
3782         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3783     fi
3784 else
3785     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3786     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3787     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3788     # (which reports itself as GCC 4.2.1).
3789     GCC_VERSION=
3791 AC_SUBST(GCC_VERSION)
3793 dnl Set the ENABLE_DBGUTIL variable
3794 dnl ===================================================================
3795 AC_MSG_CHECKING([whether to build with additional debug utilities])
3796 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3797     ENABLE_DBGUTIL="TRUE"
3798     # this is an extra var so it can have different default on different MSVC
3799     # versions (in case there are version specific problems with it)
3800     MSVC_USE_DEBUG_RUNTIME="TRUE"
3802     AC_MSG_RESULT([yes])
3803     # cppunit and graphite expose STL in public headers
3804     if test "$with_system_cppunit" = "yes"; then
3805         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3806     else
3807         with_system_cppunit=no
3808     fi
3809     if test "$with_system_graphite" = "yes"; then
3810         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3811     else
3812         with_system_graphite=no
3813     fi
3814     if test "$with_system_orcus" = "yes"; then
3815         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3816     else
3817         with_system_orcus=no
3818     fi
3819     if test "$with_system_libcmis" = "yes"; then
3820         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3821     else
3822         with_system_libcmis=no
3823     fi
3824     if test "$with_system_hunspell" = "yes"; then
3825         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3826     else
3827         with_system_hunspell=no
3828     fi
3829     if test "$with_system_gpgmepp" = "yes"; then
3830         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3831     else
3832         with_system_gpgmepp=no
3833     fi
3834     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3835     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3836     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3837     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3838     # of those two is using the system variant:
3839     if test "$with_system_libnumbertext" = "yes"; then
3840         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3841     else
3842         with_system_libnumbertext=no
3843     fi
3844     if test "$with_system_libwps" = "yes"; then
3845         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3846     else
3847         with_system_libwps=no
3848     fi
3849 else
3850     ENABLE_DBGUTIL=""
3851     MSVC_USE_DEBUG_RUNTIME=""
3852     AC_MSG_RESULT([no])
3854 AC_SUBST(ENABLE_DBGUTIL)
3855 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3857 dnl Set the ENABLE_DEBUG variable.
3858 dnl ===================================================================
3859 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3860     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3862 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3863     if test -z "$libo_fuzzed_enable_debug"; then
3864         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3865     else
3866         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3867         enable_debug=yes
3868     fi
3871 AC_MSG_CHECKING([whether to do a debug build])
3872 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3873     ENABLE_DEBUG="TRUE"
3874     if test -n "$ENABLE_DBGUTIL" ; then
3875         AC_MSG_RESULT([yes (dbgutil)])
3876     else
3877         AC_MSG_RESULT([yes])
3878     fi
3879 else
3880     ENABLE_DEBUG=""
3881     AC_MSG_RESULT([no])
3883 AC_SUBST(ENABLE_DEBUG)
3885 if test "$enable_split_debug" = yes; then
3886     HAVE_GSPLIT_DWARF=
3887     if test "$GCC" = "yes"; then
3888         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3889         save_CFLAGS=$CFLAGS
3890         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3891         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3892         CFLAGS=$save_CFLAGS
3893         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3894             AC_MSG_RESULT([yes])
3895         else
3896             AC_MSG_RESULT([no])
3897         fi
3898     fi
3899     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3902 if test "$enable_sal_log" = yes; then
3903     ENABLE_SAL_LOG=TRUE
3905 AC_SUBST(ENABLE_SAL_LOG)
3907 dnl Selective debuginfo
3908 ENABLE_DEBUGINFO_FOR=
3909 if test -n "$ENABLE_DEBUG"; then
3910     AC_MSG_CHECKING([whether to use selective debuginfo])
3911     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3912         if test "$enable_selective_debuginfo" = "yes"; then
3913             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3914         fi
3915         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3916         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3917     else
3918         ENABLE_DEBUGINFO_FOR=all
3919         AC_MSG_RESULT([no, for all])
3920     fi
3921 else
3922     if test -n "$enable_selective_debuginfo"; then
3923         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3924     fi
3926 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3928 dnl Check for enable symbols option
3929 dnl ===================================================================
3930 AC_MSG_CHECKING([whether to generate debug information])
3931 if test -z "$enable_symbols"; then
3932     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3933         enable_symbols=yes
3934     else
3935         enable_symbols=no
3936     fi
3938 if test "$enable_symbols" != no; then
3939     ENABLE_SYMBOLS=TRUE
3940     AC_MSG_RESULT([yes])
3941 else
3942     ENABLE_SYMBOLS=
3943     AC_MSG_RESULT([no])
3945 AC_SUBST(ENABLE_SYMBOLS)
3947 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3948     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3949     AC_MSG_CHECKING([whether enough memory is available for linking])
3950     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3951     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3952     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3953         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3954     else
3955         AC_MSG_RESULT([yes])
3956     fi
3959 AC_MSG_CHECKING([whether to compile with optimization flags])
3960 if test -z "$enable_optimized"; then
3961     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3962         enable_optimized=no
3963     else
3964         enable_optimized=yes
3965     fi
3967 if test "$enable_optimized" != no; then
3968     ENABLE_OPTIMIZED=TRUE
3969     AC_MSG_RESULT([yes])
3970 else
3971     ENABLE_OPTIMIZED=
3972     AC_MSG_RESULT([no])
3974 AC_SUBST(ENABLE_OPTIMIZED)
3977 # determine CPUNAME, OS, ...
3978 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3980 case "$host_os" in
3982 aix*)
3983     COM=GCC
3984     CPUNAME=POWERPC
3985     USING_X11=TRUE
3986     OS=AIX
3987     RTL_OS=AIX
3988     RTL_ARCH=PowerPC
3989     PLATFORMID=aix_powerpc
3990     P_SEP=:
3991     ;;
3993 cygwin*)
3994     COM=MSC
3995     USING_X11=
3996     OS=WNT
3997     RTL_OS=Windows
3998     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3999         P_SEP=";"
4000     else
4001         P_SEP=:
4002     fi
4003     case "$host_cpu" in
4004     i*86|x86_64)
4005         if test "$BITNESS_OVERRIDE" = 64; then
4006             CPUNAME=X86_64
4007             RTL_ARCH=X86_64
4008             PLATFORMID=windows_x86_64
4009             WINDOWS_X64=1
4010             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4011         else
4012             CPUNAME=INTEL
4013             RTL_ARCH=x86
4014             PLATFORMID=windows_x86
4015         fi
4016         ;;
4017     *)
4018         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4019         ;;
4020     esac
4021     SCPDEFS="$SCPDEFS -D_MSC_VER"
4022     ;;
4024 darwin*)
4025     COM=GCC
4026     USING_X11=
4027     OS=MACOSX
4028     RTL_OS=MacOSX
4029     P_SEP=:
4031     case "$host_cpu" in
4032     arm)
4033         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4034         ;;
4035     arm64)
4036         OS=iOS
4037         if test "$enable_ios_simulator" = "yes"; then
4038             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4039         else
4040             CPUNAME=ARM64
4041             RTL_ARCH=ARM_EABI
4042             PLATFORMID=ios_arm64
4043         fi
4044         ;;
4045     i*86)
4046         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4047         ;;
4048     x86_64)
4049         if test "$enable_ios_simulator" = "yes"; then
4050             OS=iOS
4051         fi
4052         CPUNAME=X86_64
4053         RTL_ARCH=X86_64
4054         PLATFORMID=macosx_x86_64
4055         ;;
4056     *)
4057         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4058         ;;
4059     esac
4060     ;;
4062 dragonfly*)
4063     COM=GCC
4064     USING_X11=TRUE
4065     OS=DRAGONFLY
4066     RTL_OS=DragonFly
4067     P_SEP=:
4069     case "$host_cpu" in
4070     i*86)
4071         CPUNAME=INTEL
4072         RTL_ARCH=x86
4073         PLATFORMID=dragonfly_x86
4074         ;;
4075     x86_64)
4076         CPUNAME=X86_64
4077         RTL_ARCH=X86_64
4078         PLATFORMID=dragonfly_x86_64
4079         ;;
4080     *)
4081         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4082         ;;
4083     esac
4084     ;;
4086 freebsd*)
4087     COM=GCC
4088     USING_X11=TRUE
4089     RTL_OS=FreeBSD
4090     OS=FREEBSD
4091     P_SEP=:
4093     case "$host_cpu" in
4094     i*86)
4095         CPUNAME=INTEL
4096         RTL_ARCH=x86
4097         PLATFORMID=freebsd_x86
4098         ;;
4099     x86_64|amd64)
4100         CPUNAME=X86_64
4101         RTL_ARCH=X86_64
4102         PLATFORMID=freebsd_x86_64
4103         ;;
4104     *)
4105         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4106         ;;
4107     esac
4108     ;;
4110 haiku*)
4111     COM=GCC
4112     USING_X11=
4113     GUIBASE=haiku
4114     RTL_OS=Haiku
4115     OS=HAIKU
4116     P_SEP=:
4118     case "$host_cpu" in
4119     i*86)
4120         CPUNAME=INTEL
4121         RTL_ARCH=x86
4122         PLATFORMID=haiku_x86
4123         ;;
4124     x86_64|amd64)
4125         CPUNAME=X86_64
4126         RTL_ARCH=X86_64
4127         PLATFORMID=haiku_x86_64
4128         ;;
4129     *)
4130         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4131         ;;
4132     esac
4133     ;;
4135 kfreebsd*)
4136     COM=GCC
4137     USING_X11=TRUE
4138     OS=LINUX
4139     RTL_OS=kFreeBSD
4140     P_SEP=:
4142     case "$host_cpu" in
4144     i*86)
4145         CPUNAME=INTEL
4146         RTL_ARCH=x86
4147         PLATFORMID=kfreebsd_x86
4148         ;;
4149     x86_64)
4150         CPUNAME=X86_64
4151         RTL_ARCH=X86_64
4152         PLATFORMID=kfreebsd_x86_64
4153         ;;
4154     *)
4155         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4156         ;;
4157     esac
4158     ;;
4160 linux-gnu*)
4161     COM=GCC
4162     USING_X11=TRUE
4163     OS=LINUX
4164     RTL_OS=Linux
4165     P_SEP=:
4167     case "$host_cpu" in
4169     aarch64)
4170         CPUNAME=AARCH64
4171         PLATFORMID=linux_aarch64
4172         RTL_ARCH=AARCH64
4173         ;;
4174     alpha)
4175         CPUNAME=AXP
4176         RTL_ARCH=ALPHA
4177         PLATFORMID=linux_alpha
4178         ;;
4179     arm*)
4180         CPUNAME=ARM
4181         EPM_FLAGS="-a arm"
4182         RTL_ARCH=ARM_EABI
4183         PLATFORMID=linux_arm_eabi
4184         case "$host_cpu" in
4185         arm*-linux)
4186             RTL_ARCH=ARM_OABI
4187             PLATFORMID=linux_arm_oabi
4188             ;;
4189         esac
4190         ;;
4191     hppa)
4192         CPUNAME=HPPA
4193         RTL_ARCH=HPPA
4194         EPM_FLAGS="-a hppa"
4195         PLATFORMID=linux_hppa
4196         ;;
4197     i*86)
4198         CPUNAME=INTEL
4199         RTL_ARCH=x86
4200         PLATFORMID=linux_x86
4201         ;;
4202     ia64)
4203         CPUNAME=IA64
4204         RTL_ARCH=IA64
4205         PLATFORMID=linux_ia64
4206         ;;
4207     mips)
4208         CPUNAME=GODSON
4209         RTL_ARCH=MIPS_EB
4210         EPM_FLAGS="-a mips"
4211         PLATFORMID=linux_mips_eb
4212         ;;
4213     mips64)
4214         CPUNAME=GODSON64
4215         RTL_ARCH=MIPS64_EB
4216         EPM_FLAGS="-a mips64"
4217         PLATFORMID=linux_mips64_eb
4218         ;;
4219     mips64el)
4220         CPUNAME=GODSON64
4221         RTL_ARCH=MIPS64_EL
4222         EPM_FLAGS="-a mips64el"
4223         PLATFORMID=linux_mips64_el
4224         ;;
4225     mipsel)
4226         CPUNAME=GODSON
4227         RTL_ARCH=MIPS_EL
4228         EPM_FLAGS="-a mipsel"
4229         PLATFORMID=linux_mips_el
4230         ;;
4231     m68k)
4232         CPUNAME=M68K
4233         RTL_ARCH=M68K
4234         PLATFORMID=linux_m68k
4235         ;;
4236     powerpc)
4237         CPUNAME=POWERPC
4238         RTL_ARCH=PowerPC
4239         PLATFORMID=linux_powerpc
4240         ;;
4241     powerpc64)
4242         CPUNAME=POWERPC64
4243         RTL_ARCH=PowerPC_64
4244         PLATFORMID=linux_powerpc64
4245         ;;
4246     powerpc64le)
4247         CPUNAME=POWERPC64
4248         RTL_ARCH=PowerPC_64_LE
4249         PLATFORMID=linux_powerpc64_le
4250         ;;
4251     sparc)
4252         CPUNAME=SPARC
4253         RTL_ARCH=SPARC
4254         PLATFORMID=linux_sparc
4255         ;;
4256     sparc64)
4257         CPUNAME=SPARC64
4258         RTL_ARCH=SPARC64
4259         PLATFORMID=linux_sparc64
4260         ;;
4261     s390)
4262         CPUNAME=S390
4263         RTL_ARCH=S390
4264         PLATFORMID=linux_s390
4265         ;;
4266     s390x)
4267         CPUNAME=S390X
4268         RTL_ARCH=S390x
4269         PLATFORMID=linux_s390x
4270         ;;
4271     x86_64)
4272         CPUNAME=X86_64
4273         RTL_ARCH=X86_64
4274         PLATFORMID=linux_x86_64
4275         ;;
4276     *)
4277         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4278         ;;
4279     esac
4280     ;;
4282 linux-android*)
4283     COM=GCC
4284     USING_X11=
4285     OS=ANDROID
4286     RTL_OS=Android
4287     P_SEP=:
4289     case "$host_cpu" in
4291     arm|armel)
4292         CPUNAME=ARM
4293         RTL_ARCH=ARM_EABI
4294         PLATFORMID=android_arm_eabi
4295         ;;
4296     aarch64)
4297         CPUNAME=AARCH64
4298         RTL_ARCH=AARCH64
4299         PLATFORMID=android_aarch64
4300         ;;
4301     mips|mipsel)
4302         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4303         RTL_ARCH=MIPS_EL
4304         PLATFORMID=android_mips_el
4305         ;;
4306     i*86)
4307         CPUNAME=INTEL
4308         RTL_ARCH=x86
4309         PLATFORMID=android_x86
4310         ;;
4311     *)
4312         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4313         ;;
4314     esac
4315     ;;
4317 *netbsd*)
4318     COM=GCC
4319     USING_X11=TRUE
4320     OS=NETBSD
4321     RTL_OS=NetBSD
4322     P_SEP=:
4324     case "$host_cpu" in
4325     i*86)
4326         CPUNAME=INTEL
4327         RTL_ARCH=x86
4328         PLATFORMID=netbsd_x86
4329         ;;
4330     powerpc)
4331         CPUNAME=POWERPC
4332         RTL_ARCH=PowerPC
4333         PLATFORMID=netbsd_powerpc
4334         ;;
4335     sparc)
4336         CPUNAME=SPARC
4337         RTL_ARCH=SPARC
4338         PLATFORMID=netbsd_sparc
4339         ;;
4340     x86_64)
4341         CPUNAME=X86_64
4342         RTL_ARCH=X86_64
4343         PLATFORMID=netbsd_x86_64
4344         ;;
4345     *)
4346         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4347         ;;
4348     esac
4349     ;;
4351 openbsd*)
4352     COM=GCC
4353     USING_X11=TRUE
4354     OS=OPENBSD
4355     RTL_OS=OpenBSD
4356     P_SEP=:
4358     case "$host_cpu" in
4359     i*86)
4360         CPUNAME=INTEL
4361         RTL_ARCH=x86
4362         PLATFORMID=openbsd_x86
4363         ;;
4364     x86_64)
4365         CPUNAME=X86_64
4366         RTL_ARCH=X86_64
4367         PLATFORMID=openbsd_x86_64
4368         ;;
4369     *)
4370         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4371         ;;
4372     esac
4373     SOLARINC="$SOLARINC -I/usr/local/include"
4374     ;;
4376 solaris*)
4377     COM=GCC
4378     USING_X11=TRUE
4379     OS=SOLARIS
4380     RTL_OS=Solaris
4381     P_SEP=:
4383     case "$host_cpu" in
4384     i*86)
4385         CPUNAME=INTEL
4386         RTL_ARCH=x86
4387         PLATFORMID=solaris_x86
4388         ;;
4389     sparc)
4390         CPUNAME=SPARC
4391         RTL_ARCH=SPARC
4392         PLATFORMID=solaris_sparc
4393         ;;
4394     sparc64)
4395         CPUNAME=SPARC64
4396         RTL_ARCH=SPARC64
4397         PLATFORMID=solaris_sparc64
4398         ;;
4399     *)
4400         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4401         ;;
4402     esac
4403     SOLARINC="$SOLARINC -I/usr/local/include"
4404     ;;
4407     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4408     ;;
4409 esac
4411 if test "$with_x" = "no"; then
4412     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4415 DISABLE_GUI=""
4416 if test "$enable_gui" = "no"; then
4417     if test "$USING_X11" != TRUE; then
4418         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4419     fi
4420     USING_X11=
4421     DISABLE_GUI=TRUE
4422     AC_DEFINE(HAVE_FEATURE_UI,0)
4423     test_cairo=yes
4425 AC_SUBST(DISABLE_GUI)
4427 WORKDIR="${BUILDDIR}/workdir"
4428 INSTDIR="${BUILDDIR}/instdir"
4429 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4430 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4431 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4432 AC_SUBST(COM)
4433 AC_SUBST(CPUNAME)
4434 AC_SUBST(RTL_OS)
4435 AC_SUBST(RTL_ARCH)
4436 AC_SUBST(EPM_FLAGS)
4437 AC_SUBST(USING_X11)
4438 AC_SUBST([INSTDIR])
4439 AC_SUBST([INSTROOT])
4440 AC_SUBST([INSTROOTBASE])
4441 AC_SUBST(OS)
4442 AC_SUBST(P_SEP)
4443 AC_SUBST(WORKDIR)
4444 AC_SUBST(PLATFORMID)
4445 AC_SUBST(WINDOWS_X64)
4446 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4448 dnl ===================================================================
4449 dnl Test which package format to use
4450 dnl ===================================================================
4451 AC_MSG_CHECKING([which package format to use])
4452 if test -n "$with_package_format" -a "$with_package_format" != no; then
4453     for i in $with_package_format; do
4454         case "$i" in
4455         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4456             ;;
4457         *)
4458             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4459 aix - AIX software distribution
4460 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4461 deb - Debian software distribution
4462 pkg - Solaris software distribution
4463 rpm - RedHat software distribution
4465 LibreOffice additionally supports:
4466 archive - .tar.gz or .zip
4467 dmg - Mac OS X .dmg
4468 installed - installation tree
4469 msi - Windows .msi
4470         ])
4471             ;;
4472         esac
4473     done
4474     # fakeroot is needed to ensure correct file ownerships/permissions
4475     # inside deb packages and tar archives created on Linux and Solaris.
4476     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4477         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4478         if test "$FAKEROOT" = "no"; then
4479             AC_MSG_ERROR(
4480                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4481         fi
4482     fi
4483     PKGFORMAT="$with_package_format"
4484     AC_MSG_RESULT([$PKGFORMAT])
4485 else
4486     PKGFORMAT=
4487     AC_MSG_RESULT([none])
4489 AC_SUBST(PKGFORMAT)
4491 dnl ===================================================================
4492 dnl Set up a different compiler to produce tools to run on the build
4493 dnl machine when doing cross-compilation
4494 dnl ===================================================================
4496 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4497 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4498 if test "$cross_compiling" = "yes"; then
4499     AC_MSG_CHECKING([for BUILD platform configuration])
4500     echo
4501     rm -rf CONF-FOR-BUILD config_build.mk
4502     mkdir CONF-FOR-BUILD
4503     # Here must be listed all files needed when running the configure script. In particular, also
4504     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4505     # keep them in the same order as there.
4506     (cd $SRC_ROOT && tar cf - \
4507         config.guess \
4508         bin/get_config_variables \
4509         solenv/bin/getcompver.awk \
4510         solenv/inc/langlist.mk \
4511         download.lst \
4512         config_host.mk.in \
4513         config_host_lang.mk.in \
4514         Makefile.in \
4515         lo.xcent.in \
4516         bin/bffvalidator.sh.in \
4517         bin/odfvalidator.sh.in \
4518         bin/officeotron.sh.in \
4519         instsetoo_native/util/openoffice.lst.in \
4520         config_host/*.in \
4521         sysui/desktop/macosx/Info.plist.in) \
4522     | (cd CONF-FOR-BUILD && tar xf -)
4523     cp configure CONF-FOR-BUILD
4524     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4525     (
4526     unset COM USING_X11 OS CPUNAME
4527     unset CC CXX SYSBASE CFLAGS
4528     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4529     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4530     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4531     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4532     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4533     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4534     cd CONF-FOR-BUILD
4535     sub_conf_opts=""
4536     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4537     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4538     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4539     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4540     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4541     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4542     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4543     # Don't bother having configure look for stuff not needed for the build platform anyway
4544     ./configure \
4545         --disable-cups \
4546         --disable-gtk3 \
4547         --disable-pdfimport \
4548         --disable-postgresql-sdbc \
4549         --with-parallelism="$with_parallelism" \
4550         --without-doxygen \
4551         --without-java \
4552         $sub_conf_opts \
4553         --srcdir=$srcdir \
4554         2>&1 | sed -e 's/^/    /'
4555     test -f ./config_host.mk 2>/dev/null || exit
4556     cp config_host.mk ../config_build.mk
4557     cp config_host_lang.mk ../config_build_lang.mk
4558     mv config.log ../config.Build.log
4559     mkdir -p ../config_build
4560     mv config_host/*.h ../config_build
4561     . ./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
4563     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
4564         VV='$'$V
4565         VV=`eval "echo $VV"`
4566         if test -n "$VV"; then
4567             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4568             echo "$line" >>build-config
4569         fi
4570     done
4572     for V in INSTDIR INSTROOT WORKDIR; do
4573         VV='$'$V
4574         VV=`eval "echo $VV"`
4575         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4576         if test -n "$VV"; then
4577             line="${V}_FOR_BUILD='$VV'"
4578             echo "$line" >>build-config
4579         fi
4580     done
4582     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4583     echo "$line" >>build-config
4585     )
4586     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4587     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])
4588     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4589              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4591     eval `cat CONF-FOR-BUILD/build-config`
4593     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4595     rm -rf CONF-FOR-BUILD
4596 else
4597     OS_FOR_BUILD="$OS"
4598     CC_FOR_BUILD="$CC"
4599     CXX_FOR_BUILD="$CXX"
4600     INSTDIR_FOR_BUILD="$INSTDIR"
4601     INSTROOT_FOR_BUILD="$INSTROOT"
4602     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4603     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4604     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4605     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4606     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4607     WORKDIR_FOR_BUILD="$WORKDIR"
4609 AC_SUBST(OS_FOR_BUILD)
4610 AC_SUBST(INSTDIR_FOR_BUILD)
4611 AC_SUBST(INSTROOT_FOR_BUILD)
4612 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4613 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4614 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4615 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4616 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4617 AC_SUBST(WORKDIR_FOR_BUILD)
4619 dnl ===================================================================
4620 dnl Check for syslog header
4621 dnl ===================================================================
4622 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4624 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4625 dnl ===================================================================
4626 AC_MSG_CHECKING([whether to turn warnings to errors])
4627 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4628     ENABLE_WERROR="TRUE"
4629     AC_MSG_RESULT([yes])
4630 else
4631     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4632         ENABLE_WERROR="TRUE"
4633         AC_MSG_RESULT([yes])
4634     else
4635         AC_MSG_RESULT([no])
4636     fi
4638 AC_SUBST(ENABLE_WERROR)
4640 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4641 dnl ===================================================================
4642 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4643 if test -z "$enable_assert_always_abort"; then
4644    if test "$ENABLE_DEBUG" = TRUE; then
4645        enable_assert_always_abort=yes
4646    else
4647        enable_assert_always_abort=no
4648    fi
4650 if test "$enable_assert_always_abort" = "yes"; then
4651     ASSERT_ALWAYS_ABORT="TRUE"
4652     AC_MSG_RESULT([yes])
4653 else
4654     ASSERT_ALWAYS_ABORT="FALSE"
4655     AC_MSG_RESULT([no])
4657 AC_SUBST(ASSERT_ALWAYS_ABORT)
4659 # Determine whether to use ooenv for the instdir installation
4660 # ===================================================================
4661 if test $_os != "WINNT" -a $_os != "Darwin"; then
4662     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4663     if test "$enable_ooenv" = "no"; then
4664         AC_MSG_RESULT([no])
4665     else
4666         ENABLE_OOENV="TRUE"
4667         AC_MSG_RESULT([yes])
4668     fi
4670 AC_SUBST(ENABLE_OOENV)
4672 if test "$USING_X11" != TRUE; then
4673     # be sure to do not mess with unneeded stuff
4674     test_randr=no
4675     test_xrender=no
4676     test_cups=no
4677     test_dbus=no
4678     test_gtk=no
4679     build_gstreamer_1_0=no
4680     build_gstreamer_0_10=no
4681     test_kde4=no
4682     test_kde5=no
4683     test_qt5=no
4684     test_gtk3_kde5=no
4685     enable_cairo_canvas=no
4688 if test "$OS" = "HAIKU"; then
4689     enable_cairo_canvas=yes
4690     test_kde5=yes
4693 if test "$test_kde5" = "yes"; then
4694     test_qt5=yes
4697 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4698     if test "$enable_qt5" = "no"; then
4699         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4700     else
4701         enable_qt5=yes
4702     fi
4705 dnl ===================================================================
4706 dnl check for cups support
4707 dnl ===================================================================
4708 ENABLE_CUPS=""
4710 if test "$enable_cups" = "no"; then
4711     test_cups=no
4714 AC_MSG_CHECKING([whether to enable CUPS support])
4715 if test "$test_cups" = "yes"; then
4716     ENABLE_CUPS="TRUE"
4717     AC_MSG_RESULT([yes])
4719     AC_MSG_CHECKING([whether cups support is present])
4720     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4721     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4722     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4723         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4724     fi
4726 else
4727     AC_MSG_RESULT([no])
4730 AC_SUBST(ENABLE_CUPS)
4732 # fontconfig checks
4733 if test "$test_fontconfig" = "yes"; then
4734     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4735     SYSTEM_FONTCONFIG=TRUE
4736     FilterLibs "${FONTCONFIG_LIBS}"
4737     FONTCONFIG_LIBS="${filteredlibs}"
4739 AC_SUBST(FONTCONFIG_CFLAGS)
4740 AC_SUBST(FONTCONFIG_LIBS)
4741 AC_SUBST([SYSTEM_FONTCONFIG])
4743 dnl whether to find & fetch external tarballs?
4744 dnl ===================================================================
4745 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4746    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4747        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4748    else
4749        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4750    fi
4752 if test -z "$TARFILE_LOCATION"; then
4753     if test -d "$SRC_ROOT/src" ; then
4754         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4755         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4756     fi
4757     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4758 else
4759     AbsolutePath "$TARFILE_LOCATION"
4760     PathFormat "${absolute_path}"
4761     TARFILE_LOCATION="${formatted_path}"
4763 AC_SUBST(TARFILE_LOCATION)
4765 AC_MSG_CHECKING([whether we want to fetch tarballs])
4766 if test "$enable_fetch_external" != "no"; then
4767     if test "$with_all_tarballs" = "yes"; then
4768         AC_MSG_RESULT([yes, all of them])
4769         DO_FETCH_TARBALLS="ALL"
4770     else
4771         AC_MSG_RESULT([yes, if we use them])
4772         DO_FETCH_TARBALLS="TRUE"
4773     fi
4774 else
4775     AC_MSG_RESULT([no])
4776     DO_FETCH_TARBALLS=
4778 AC_SUBST(DO_FETCH_TARBALLS)
4780 AC_MSG_CHECKING([whether to build help])
4781 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4782     BUILD_TYPE="$BUILD_TYPE HELP"
4783     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4784     case "$with_help" in
4785     "html")
4786         ENABLE_HTMLHELP=TRUE
4787         SCPDEFS="$SCPDEFS -DWITH_HELP"
4788         AC_MSG_RESULT([HTML])
4789         ;;
4790     "online")
4791         ENABLE_HTMLHELP=TRUE
4792         HELP_ONLINE=TRUE
4793         AC_MSG_RESULT([HTML])
4794         ;;
4795     yes)
4796         SCPDEFS="$SCPDEFS -DWITH_HELP"
4797         AC_MSG_RESULT([yes])
4798         ;;
4799     *)
4800         AC_MSG_ERROR([Unknown --with-help=$with_help])
4801         ;;
4802     esac
4803 else
4804     AC_MSG_RESULT([no])
4806 AC_SUBST([ENABLE_HTMLHELP])
4807 AC_SUBST([HELP_ONLINE])
4809 dnl Test whether to include MySpell dictionaries
4810 dnl ===================================================================
4811 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4812 if test "$with_myspell_dicts" = "yes"; then
4813     AC_MSG_RESULT([yes])
4814     WITH_MYSPELL_DICTS=TRUE
4815     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4816     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4817 else
4818     AC_MSG_RESULT([no])
4819     WITH_MYSPELL_DICTS=
4821 AC_SUBST(WITH_MYSPELL_DICTS)
4823 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4824 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4825     if test "$with_system_dicts" = yes; then
4826         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4827     fi
4828     with_system_dicts=no
4831 AC_MSG_CHECKING([whether to use dicts from external paths])
4832 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4833     AC_MSG_RESULT([yes])
4834     SYSTEM_DICTS=TRUE
4835     AC_MSG_CHECKING([for spelling dictionary directory])
4836     if test -n "$with_external_dict_dir"; then
4837         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4838     else
4839         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4840         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4841             DICT_SYSTEM_DIR=file:///usr/share/myspell
4842         fi
4843     fi
4844     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4845     AC_MSG_CHECKING([for hyphenation patterns directory])
4846     if test -n "$with_external_hyph_dir"; then
4847         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4848     else
4849         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4850     fi
4851     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4852     AC_MSG_CHECKING([for thesaurus directory])
4853     if test -n "$with_external_thes_dir"; then
4854         THES_SYSTEM_DIR=file://$with_external_thes_dir
4855     else
4856         THES_SYSTEM_DIR=file:///usr/share/mythes
4857     fi
4858     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4859 else
4860     AC_MSG_RESULT([no])
4861     SYSTEM_DICTS=
4863 AC_SUBST(SYSTEM_DICTS)
4864 AC_SUBST(DICT_SYSTEM_DIR)
4865 AC_SUBST(HYPH_SYSTEM_DIR)
4866 AC_SUBST(THES_SYSTEM_DIR)
4868 dnl ===================================================================
4869 dnl enable pch by default on windows
4870 dnl enable it explicitly otherwise
4871 ENABLE_PCH=""
4872 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4873     if test -z "$libo_fuzzed_enable_pch"; then
4874         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4875     else
4876         AC_MSG_NOTICE([Resetting --enable-pch=no])
4877         enable_pch=no
4878     fi
4881 AC_MSG_CHECKING([whether to enable pch feature])
4882 if test "$enable_pch" != "no"; then
4883     if test "$_os" = "WINNT"; then
4884         ENABLE_PCH="TRUE"
4885         AC_MSG_RESULT([yes])
4886     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4887         ENABLE_PCH="TRUE"
4888         AC_MSG_RESULT([yes])
4889     elif test -n "$enable_pch"; then
4890         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4891     else
4892         AC_MSG_RESULT([no])
4893     fi
4894 else
4895     AC_MSG_RESULT([no])
4897 AC_SUBST(ENABLE_PCH)
4899 TAB=`printf '\t'`
4901 AC_MSG_CHECKING([the GNU Make version])
4902 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4903 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4904 if test "$_make_longver" -ge "038200"; then
4905     AC_MSG_RESULT([$GNUMAKE $_make_version])
4907 elif test "$_make_longver" -ge "038100"; then
4908     if test "$build_os" = "cygwin"; then
4909         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4910     fi
4911     AC_MSG_RESULT([$GNUMAKE $_make_version])
4913     dnl ===================================================================
4914     dnl Search all the common names for sha1sum
4915     dnl ===================================================================
4916     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4917     if test -z "$SHA1SUM"; then
4918         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4919     elif test "$SHA1SUM" = "openssl"; then
4920         SHA1SUM="openssl sha1"
4921     fi
4922     AC_MSG_CHECKING([for GNU Make bug 20033])
4923     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4924     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4925 A := \$(wildcard *.a)
4927 .PHONY: all
4928 all: \$(A:.a=.b)
4929 <TAB>@echo survived bug20033.
4931 .PHONY: setup
4932 setup:
4933 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4935 define d1
4936 @echo lala \$(1)
4937 @sleep 1
4938 endef
4940 define d2
4941 @echo tyty \$(1)
4942 @sleep 1
4943 endef
4945 %.b : %.a
4946 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4947 <TAB>\$(call d1,\$(CHECKSUM)),\
4948 <TAB>\$(call d2,\$(CHECKSUM)))
4950     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4951         no_parallelism_make="YES"
4952         AC_MSG_RESULT([yes, disable parallelism])
4953     else
4954         AC_MSG_RESULT([no, keep parallelism enabled])
4955     fi
4956     rm -rf $TESTGMAKEBUG20033
4957 else
4958     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4961 # find if gnumake support file function
4962 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4963 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4964 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4965     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4967 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4968 \$(file >test.txt,Success )
4970 .PHONY: all
4971 all:
4972 <TAB>@cat test.txt
4975 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4976 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4977     HAVE_GNUMAKE_FILE_FUNC=TRUE
4978     AC_MSG_RESULT([yes])
4979 else
4980     AC_MSG_RESULT([no])
4982 rm -rf $TESTGMAKEFILEFUNC
4983 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4984 AC_SUBST(GNUMAKE_WIN_NATIVE)
4986 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4987 STALE_MAKE=
4988 if test "$_make_ver_check" = ""; then
4989    STALE_MAKE=TRUE
4992 HAVE_LD_HASH_STYLE=FALSE
4993 WITH_LINKER_HASH_STYLE=
4994 AC_MSG_CHECKING([for --hash-style gcc linker support])
4995 if test "$GCC" = "yes"; then
4996     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4997         hash_styles="gnu sysv"
4998     elif test "$with_linker_hash_style" = "no"; then
4999         hash_styles=
5000     else
5001         hash_styles="$with_linker_hash_style"
5002     fi
5004     for hash_style in $hash_styles; do
5005         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5006         hash_style_ldflags_save=$LDFLAGS
5007         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5009         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5010             [
5011 #include <stdio.h>
5012             ],[
5013 printf ("");
5014             ])],
5015             [
5016                   HAVE_LD_HASH_STYLE=TRUE
5017                   WITH_LINKER_HASH_STYLE=$hash_style
5018             ],
5019             [HAVE_LD_HASH_STYLE=FALSE],
5020             [HAVE_LD_HASH_STYLE=FALSE])
5021         LDFLAGS=$hash_style_ldflags_save
5022     done
5024     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5025         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5026     else
5027         AC_MSG_RESULT( no )
5028     fi
5029     LDFLAGS=$hash_style_ldflags_save
5030 else
5031     AC_MSG_RESULT( no )
5033 AC_SUBST(HAVE_LD_HASH_STYLE)
5034 AC_SUBST(WITH_LINKER_HASH_STYLE)
5036 dnl ===================================================================
5037 dnl Check whether there's a Perl version available.
5038 dnl ===================================================================
5039 if test -z "$with_perl_home"; then
5040     AC_PATH_PROG(PERL, perl)
5041 else
5042     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5043     _perl_path="$with_perl_home/bin/perl"
5044     if test -x "$_perl_path"; then
5045         PERL=$_perl_path
5046     else
5047         AC_MSG_ERROR([$_perl_path not found])
5048     fi
5051 dnl ===================================================================
5052 dnl Testing for Perl version 5 or greater.
5053 dnl $] is the Perl version variable, it is returned as an integer
5054 dnl ===================================================================
5055 if test "$PERL"; then
5056     AC_MSG_CHECKING([the Perl version])
5057     ${PERL} -e "exit($]);"
5058     _perl_version=$?
5059     if test "$_perl_version" -lt 5; then
5060         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5061     fi
5062     AC_MSG_RESULT([Perl $_perl_version])
5063 else
5064     AC_MSG_ERROR([Perl not found, install Perl 5])
5067 dnl ===================================================================
5068 dnl Testing for required Perl modules
5069 dnl ===================================================================
5071 AC_MSG_CHECKING([for required Perl modules])
5072 perl_use_string="use Cwd ; use Digest::MD5"
5073 if test "$_os" = "WINNT"; then
5074     if test -n "$PKGFORMAT"; then
5075         for i in $PKGFORMAT; do
5076             case "$i" in
5077             msi)
5078                 # for getting fonts versions to use in MSI
5079                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5080                 ;;
5081             esac
5082         done
5083     fi
5085 if test "$with_system_hsqldb" = "yes"; then
5086         perl_use_string="$perl_use_string ; use Archive::Zip"
5088 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5089     AC_MSG_RESULT([all modules found])
5090 else
5091     AC_MSG_RESULT([failed to find some modules])
5092     # Find out which modules are missing.
5093     for i in $perl_use_string; do
5094         if test "$i" != "use" -a "$i" != ";"; then
5095             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5096                 missing_perl_modules="$missing_perl_modules $i"
5097             fi
5098         fi
5099     done
5100     AC_MSG_ERROR([
5101     The missing Perl modules are: $missing_perl_modules
5102     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5105 dnl ===================================================================
5106 dnl Check for pkg-config
5107 dnl ===================================================================
5108 if test "$_os" != "WINNT"; then
5109     PKG_PROG_PKG_CONFIG
5112 if test "$_os" != "WINNT"; then
5114     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5115     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5116     # explicitly. Or put /path/to/compiler in PATH yourself.
5118     # Use wrappers for LTO
5119     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5120         AC_CHECK_TOOL(AR,gcc-ar)
5121         AC_CHECK_TOOL(NM,gcc-nm)
5122         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5123     else
5124         AC_CHECK_TOOL(AR,ar)
5125         AC_CHECK_TOOL(NM,nm)
5126         AC_CHECK_TOOL(RANLIB,ranlib)
5127     fi
5128     AC_CHECK_TOOL(OBJDUMP,objdump)
5129     AC_CHECK_TOOL(READELF,readelf)
5130     AC_CHECK_TOOL(STRIP,strip)
5131     if test "$_os" = "WINNT"; then
5132         AC_CHECK_TOOL(DLLTOOL,dlltool)
5133         AC_CHECK_TOOL(WINDRES,windres)
5134     fi
5136 AC_SUBST(AR)
5137 AC_SUBST(DLLTOOL)
5138 AC_SUBST(NM)
5139 AC_SUBST(OBJDUMP)
5140 AC_SUBST(PKG_CONFIG)
5141 AC_SUBST(RANLIB)
5142 AC_SUBST(READELF)
5143 AC_SUBST(STRIP)
5144 AC_SUBST(WINDRES)
5146 dnl ===================================================================
5147 dnl pkg-config checks on Mac OS X
5148 dnl ===================================================================
5150 if test $_os = Darwin; then
5151     AC_MSG_CHECKING([for bogus pkg-config])
5152     if test -n "$PKG_CONFIG"; then
5153         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5154             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5155         else
5156             if test "$enable_bogus_pkg_config" = "yes"; then
5157                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5158             else
5159                 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.])
5160             fi
5161         fi
5162     else
5163         AC_MSG_RESULT([no, good])
5164     fi
5167 find_csc()
5169     # Return value: $csctest
5171     unset csctest
5173     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5174     if test -n "$regvalue"; then
5175         csctest=$regvalue
5176         return
5177     fi
5180 find_al()
5182     # Return value: $altest
5184     unset altest
5186     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5187         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5188         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5189             altest=$regvalue
5190             return
5191         fi
5192     done
5194     # We need this additional check to detect 4.6.1 or above.
5195     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5196         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5197         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5198             altest=$regvalue
5199             return
5200         fi
5202         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5203         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5204             altest=$regvalue
5205             return
5206         fi
5207     done
5210 find_dotnetsdk46()
5212     unset frametest
5214     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5215         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5216         if test -n "$regvalue"; then
5217             frametest=$regvalue
5218             return
5219         fi
5220         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5221         if test -n "$regvalue"; then
5222             frametest=$regvalue
5223             return
5224         fi
5225     done
5228 find_winsdk_version()
5230     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5231     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5233     unset winsdktest winsdkbinsubdir winsdklibsubdir
5235     case "$1" in
5236     7.*)
5237         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5238         if test -n "$regvalue"; then
5239             winsdktest=$regvalue
5240             winsdklibsubdir=.
5241             return
5242         fi
5243         ;;
5244     8.0|8.0A)
5245         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5246         if test -n "$regvalue"; then
5247             winsdktest=$regvalue
5248             winsdklibsubdir=win8
5249             return
5250         fi
5251         ;;
5252     8.1|8.1A)
5253         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5254         if test -n "$regvalue"; then
5255             winsdktest=$regvalue
5256             winsdklibsubdir=winv6.3
5257             return
5258         fi
5259         ;;
5260     10.0)
5261         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5262         if test -n "$regvalue"; then
5263             winsdktest=$regvalue
5264             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5265             if test -n "$regvalue"; then
5266                 winsdkbinsubdir="$regvalue".0
5267                 winsdklibsubdir=$winsdkbinsubdir
5268                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5269                 # test exist the SDK path
5270                 if test -d "$tmppath"; then
5271                    # when path is convertible to a short path then path is okay
5272                    if ! cygpath -d "$tmppath"; then
5273                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5274                    fi
5275                 else
5276                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5277                 fi
5278             fi
5279             return
5280         fi
5281         ;;
5282     esac
5285 find_winsdk()
5287     # Return value: From find_winsdk_version
5289     unset winsdktest
5291     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5292         find_winsdk_version $ver
5293         if test -n "$winsdktest"; then
5294             return
5295         fi
5296     done
5299 find_msms()
5301     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5302     if test $VCVER = 150; then
5303         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5304     fi
5305     AC_MSG_CHECKING([for ${my_msm_files}])
5306     msmdir=
5307     for ver in 14.0 15.0; do
5308         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5309         if test -n "$regvalue"; then
5310             for f in ${my_msm_files}; do
5311                 if test -e "$regvalue/${f}"; then
5312                     msmdir=$regvalue
5313                     break
5314                 fi
5315             done
5316         fi
5317     done
5318     dnl Is the following fallback really necessary, or was it added in response
5319     dnl to never having started Visual Studio on a given machine, so the
5320     dnl registry keys checked above had presumably not yet been created?
5321     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5322     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5323     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5324     dnl expanding to "C:\Program Files\Common Files"), which would need
5325     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5326     dnl obtain its value from cygwin:
5327     if test -z "$msmdir"; then
5328         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5329         for f in ${my_msm_files}; do
5330             if test -e "$my_msm_dir/${f}"; then
5331                 msmdir=$my_msm_dir
5332             fi
5333         done
5334     fi
5336     dnl Starting from MSVC 15.0, merge modules are located in different directory
5337     if test $VCVER = 150; then
5338         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5339             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5340             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5341             for f in ${my_msm_files}; do
5342                 if test -e "$my_msm_dir/${f}"; then
5343                     msmdir=$my_msm_dir
5344                     break
5345                 fi
5346             done
5347         done
5348     fi
5350     if test -n "$msmdir"; then
5351         msmdir=`cygpath -m "$msmdir"`
5352         AC_MSG_RESULT([$msmdir])
5353     else
5354         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5355             AC_MSG_ERROR([not found])
5356         else
5357             AC_MSG_WARN([not found])
5358             add_warning "MSM none of ${my_msm_files} found"
5359         fi
5360     fi
5363 find_msvc_x64_dlls()
5365     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5366     if test "$VCVER" = 150; then
5367         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5368             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5369             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5370                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5371                 break
5372             fi
5373             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5374                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5375                 break
5376             fi
5377         done
5378     fi
5379     msvcdlls="msvcp140.dll vcruntime140.dll"
5380     for dll in $msvcdlls; do
5381         if ! test -f "$msvcdllpath/$dll"; then
5382             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5383         fi
5384     done
5387 dnl =========================================
5388 dnl Check for the Windows  SDK.
5389 dnl =========================================
5390 if test "$_os" = "WINNT"; then
5391     AC_MSG_CHECKING([for Windows SDK])
5392     if test "$build_os" = "cygwin"; then
5393         find_winsdk
5394         WINDOWS_SDK_HOME=$winsdktest
5396         # normalize if found
5397         if test -n "$WINDOWS_SDK_HOME"; then
5398             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5399             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5400         fi
5402         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5403     fi
5405     if test -n "$WINDOWS_SDK_HOME"; then
5406         # Remove a possible trailing backslash
5407         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5409         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5410              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5411              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5412             have_windows_sdk_headers=yes
5413         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5414              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5415              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5416             have_windows_sdk_headers=yes
5417         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5418              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5419              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5420             have_windows_sdk_headers=yes
5421         else
5422             have_windows_sdk_headers=no
5423         fi
5425         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5426             have_windows_sdk_libs=yes
5427         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5428             have_windows_sdk_libs=yes
5429         else
5430             have_windows_sdk_libs=no
5431         fi
5433         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5434             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5435 the  Windows SDK are installed.])
5436         fi
5437     fi
5439     if test -z "$WINDOWS_SDK_HOME"; then
5440         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5441     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5442         WINDOWS_SDK_VERSION=70
5443         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5444     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5445         WINDOWS_SDK_VERSION=80
5446         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5447     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5448         WINDOWS_SDK_VERSION=81
5449         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5450     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5451         WINDOWS_SDK_VERSION=10
5452         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5453     else
5454         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5455     fi
5456     PathFormat "$WINDOWS_SDK_HOME"
5457     WINDOWS_SDK_HOME="$formatted_path"
5458     if test "$build_os" = "cygwin"; then
5459         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5460         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5461             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5462         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5463             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5464         fi
5465     fi
5467     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5468     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5469     dnl but not in v8.0), so allow this to be overridden with a
5470     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5471     dnl and configuration error if no WiLangId.vbs is found would arguably be
5472     dnl better, but I do not know under which conditions exactly it is needed by
5473     dnl msiglobal.pm:
5474     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5475         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5476         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5477             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5478         fi
5479         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5480             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5481         fi
5482         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5483             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5484         fi
5485     fi
5486     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5487         if test -n "$with_package_format" -a "$with_package_format" != no; then
5488             for i in "$with_package_format"; do
5489                 if test "$i" = "msi"; then
5490                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5491                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5492                     fi
5493                 fi
5494             done
5495         fi
5496     fi
5498 AC_SUBST(WINDOWS_SDK_HOME)
5499 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5500 AC_SUBST(WINDOWS_SDK_VERSION)
5501 AC_SUBST(WINDOWS_SDK_WILANGID)
5503 if test "$build_os" = "cygwin"; then
5504     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5505     dnl dir, it also determines that dir's path w/o an arch segment if any,
5506     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5507     AC_MSG_CHECKING([for midl.exe])
5509     find_winsdk
5510     if test -n "$winsdkbinsubdir" \
5511         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5512     then
5513         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5514         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5515     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5516         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5517         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5518     elif test -f "$winsdktest/Bin/midl.exe"; then
5519         MIDL_PATH=$winsdktest/Bin
5520         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5521     fi
5522     if test ! -f "$MIDL_PATH/midl.exe"; then
5523         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5524     else
5525         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5526     fi
5528     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5529     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5531     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5532          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5533          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5534          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5535     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5536          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5537          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5538          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5539     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5540          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5541          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5542          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5543     else
5544         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5545     fi
5547     dnl Check csc.exe
5548     AC_MSG_CHECKING([for csc.exe])
5549     find_csc
5550     if test -f "$csctest/csc.exe"; then
5551         CSC_PATH="$csctest"
5552     fi
5553     if test ! -f "$CSC_PATH/csc.exe"; then
5554         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5555     else
5556         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5557     fi
5559     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5561     dnl Check al.exe
5562     AC_MSG_CHECKING([for al.exe])
5563     find_winsdk
5564     if test -n "$winsdkbinsubdir" \
5565         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5566     then
5567         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5568     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5569         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5570     elif test -f "$winsdktest/Bin/al.exe"; then
5571         AL_PATH="$winsdktest/Bin"
5572     fi
5574     if test -z "$AL_PATH"; then
5575         find_al
5576         if test -f "$altest/bin/al.exe"; then
5577             AL_PATH="$altest/bin"
5578         elif test -f "$altest/al.exe"; then
5579             AL_PATH="$altest"
5580         fi
5581     fi
5582     if test ! -f "$AL_PATH/al.exe"; then
5583         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5584     else
5585         AC_MSG_RESULT([$AL_PATH/al.exe])
5586     fi
5588     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5590     dnl Check mscoree.lib / .NET Framework dir
5591     AC_MSG_CHECKING(.NET Framework)
5592     find_dotnetsdk46
5593     PathFormat "$frametest"
5594     frametest="$formatted_path"
5595     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5596         DOTNET_FRAMEWORK_HOME="$frametest"
5597     else
5598         find_winsdk
5599         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5600             DOTNET_FRAMEWORK_HOME="$winsdktest"
5601         fi
5602     fi
5603     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
5604         AC_MSG_ERROR([mscoree.lib not found])
5605     fi
5606     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5608     PathFormat "$MIDL_PATH"
5609     MIDL_PATH="$formatted_path"
5611     PathFormat "$AL_PATH"
5612     AL_PATH="$formatted_path"
5614     PathFormat "$DOTNET_FRAMEWORK_HOME"
5615     DOTNET_FRAMEWORK_HOME="$formatted_path"
5617     PathFormat "$CSC_PATH"
5618     CSC_PATH="$formatted_path"
5621 dnl ===================================================================
5622 dnl Check if stdc headers are available excluding MSVC.
5623 dnl ===================================================================
5624 if test "$_os" != "WINNT"; then
5625     AC_HEADER_STDC
5628 dnl ===================================================================
5629 dnl Testing for C++ compiler and version...
5630 dnl ===================================================================
5632 if test "$_os" != "WINNT"; then
5633     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5634     save_CXXFLAGS=$CXXFLAGS
5635     AC_PROG_CXX
5636     CXXFLAGS=$save_CXXFLAGS
5637 else
5638     if test -n "$CC" -a -z "$CXX"; then
5639         CXX="$CC"
5640     fi
5643 dnl check for GNU C++ compiler version
5644 if test "$GXX" = "yes"; then
5645     AC_MSG_CHECKING([the GNU C++ compiler version])
5647     _gpp_version=`$CXX -dumpversion`
5648     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5650     if test "$_gpp_majmin" -lt "401"; then
5651         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5652     else
5653         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5654     fi
5656     dnl see https://code.google.com/p/android/issues/detail?id=41770
5657     if test "$_gpp_majmin" -ge "401"; then
5658         glibcxx_threads=no
5659         AC_LANG_PUSH([C++])
5660         AC_REQUIRE_CPP
5661         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5662         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5663             #include <bits/c++config.h>]],[[
5664             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5665             && !defined(_GLIBCXX__PTHREADS) \
5666             && !defined(_GLIBCXX_HAS_GTHREADS)
5667             choke me
5668             #endif
5669         ]])],[AC_MSG_RESULT([yes])
5670         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5671         AC_LANG_POP([C++])
5672         if test $glibcxx_threads = yes; then
5673             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5674         fi
5675      fi
5677 AC_SUBST(BOOST_CXXFLAGS)
5680 # prefx CXX with ccache if needed
5682 if test "$CCACHE" != ""; then
5683     AC_MSG_CHECKING([whether $CXX is already ccached])
5684     AC_LANG_PUSH([C++])
5685     save_CXXFLAGS=$CXXFLAGS
5686     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5687     dnl an empty program will do, we're checking the compiler flags
5688     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5689                       [use_ccache=yes], [use_ccache=no])
5690     if test $use_ccache = yes; then
5691         AC_MSG_RESULT([yes])
5692     else
5693         CXX="$CCACHE $CXX"
5694         AC_MSG_RESULT([no])
5695     fi
5696     CXXFLAGS=$save_CXXFLAGS
5697     AC_LANG_POP([C++])
5700 dnl ===================================================================
5701 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5702 dnl ===================================================================
5704 if test "$_os" != "WINNT"; then
5705     AC_PROG_CXXCPP
5707     dnl Check whether there's a C pre-processor.
5708     AC_PROG_CPP
5712 dnl ===================================================================
5713 dnl Find integral type sizes and alignments
5714 dnl ===================================================================
5716 if test "$_os" != "WINNT"; then
5718 if test "$_os" == "iOS"; then
5719     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5720     ac_cv_sizeof_long=8
5721     ac_cv_sizeof_short=2
5722     ac_cv_sizeof_int=4
5723     ac_cv_sizeof_long_long=8
5724     ac_cv_sizeof_double=8
5725     ac_cv_sizeof_voidp=8
5726 else
5727     AC_CHECK_SIZEOF(long)
5728     AC_CHECK_SIZEOF(short)
5729     AC_CHECK_SIZEOF(int)
5730     AC_CHECK_SIZEOF(long long)
5731     AC_CHECK_SIZEOF(double)
5732     AC_CHECK_SIZEOF(void*)
5735     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5736     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5737     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5738     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5739     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5741     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5742     m4_pattern_allow([AC_CHECK_ALIGNOF])
5743     m4_ifdef([AC_CHECK_ALIGNOF],
5744         [
5745             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5746             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5747             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5748             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5749         ],
5750         [
5751             case "$_os-$host_cpu" in
5752             Linux-i686)
5753                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5754                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5755                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5756                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5757                 ;;
5758             Linux-x86_64)
5759                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5760                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5761                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5762                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5763                 ;;
5764             *)
5765                 if test -z "$ac_cv_alignof_short" -o \
5766                         -z "$ac_cv_alignof_int" -o \
5767                         -z "$ac_cv_alignof_long" -o \
5768                         -z "$ac_cv_alignof_double"; then
5769                    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.])
5770                 fi
5771                 ;;
5772             esac
5773         ])
5775     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5776     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5777     if test $ac_cv_sizeof_long -eq 8; then
5778         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5779     elif test $ac_cv_sizeof_double -eq 8; then
5780         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5781     else
5782         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5783     fi
5785     dnl Check for large file support
5786     AC_SYS_LARGEFILE
5787     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5788         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5789     fi
5790     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5791         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5792     fi
5793 else
5794     # Hardcode for MSVC
5795     SAL_TYPES_SIZEOFSHORT=2
5796     SAL_TYPES_SIZEOFINT=4
5797     SAL_TYPES_SIZEOFLONG=4
5798     SAL_TYPES_SIZEOFLONGLONG=8
5799     if test "$BITNESS_OVERRIDE" = ""; then
5800         SAL_TYPES_SIZEOFPOINTER=4
5801     else
5802         SAL_TYPES_SIZEOFPOINTER=8
5803     fi
5804     SAL_TYPES_ALIGNMENT2=2
5805     SAL_TYPES_ALIGNMENT4=4
5806     SAL_TYPES_ALIGNMENT8=8
5807     LFS_CFLAGS=''
5809 AC_SUBST(LFS_CFLAGS)
5811 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5812 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5813 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5814 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5815 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5816 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5817 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5818 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5820 dnl ===================================================================
5821 dnl Check whether to enable runtime optimizations
5822 dnl ===================================================================
5823 ENABLE_RUNTIME_OPTIMIZATIONS=
5824 AC_MSG_CHECKING([whether to enable runtime optimizations])
5825 if test -z "$enable_runtime_optimizations"; then
5826     for i in $CC; do
5827         case $i in
5828         -fsanitize=*)
5829             enable_runtime_optimizations=no
5830             break
5831             ;;
5832         esac
5833     done
5835 if test "$enable_runtime_optimizations" != no; then
5836     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5837     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5838     AC_MSG_RESULT([yes])
5839 else
5840     AC_MSG_RESULT([no])
5842 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5844 dnl ===================================================================
5845 dnl Check if valgrind headers are available
5846 dnl ===================================================================
5847 ENABLE_VALGRIND=
5848 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5849     prev_cppflags=$CPPFLAGS
5850     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5851     # or where does it come from?
5852     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5853     AC_CHECK_HEADER([valgrind/valgrind.h],
5854         [ENABLE_VALGRIND=TRUE])
5855     CPPFLAGS=$prev_cppflags
5857 AC_SUBST([ENABLE_VALGRIND])
5858 if test -z "$ENABLE_VALGRIND"; then
5859     if test "$with_valgrind" = yes; then
5860         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5861     fi
5862     VALGRIND_CFLAGS=
5864 AC_SUBST([VALGRIND_CFLAGS])
5867 dnl ===================================================================
5868 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5869 dnl ===================================================================
5871 # We need at least the sys/sdt.h include header.
5872 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5873 if test "$SDT_H_FOUND" = "TRUE"; then
5874     # Found sys/sdt.h header, now make sure the c++ compiler works.
5875     # Old g++ versions had problems with probes in constructors/destructors.
5876     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5877     AC_LANG_PUSH([C++])
5878     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5879     #include <sys/sdt.h>
5880     class ProbeClass
5881     {
5882     private:
5883       int& ref;
5884       const char *name;
5886     public:
5887       ProbeClass(int& v, const char *n) : ref(v), name(n)
5888       {
5889         DTRACE_PROBE2(_test_, cons, name, ref);
5890       }
5892       void method(int min)
5893       {
5894         DTRACE_PROBE3(_test_, meth, name, ref, min);
5895         ref -= min;
5896       }
5898       ~ProbeClass()
5899       {
5900         DTRACE_PROBE2(_test_, dest, name, ref);
5901       }
5902     };
5903     ]],[[
5904     int i = 64;
5905     DTRACE_PROBE1(_test_, call, i);
5906     ProbeClass inst = ProbeClass(i, "call");
5907     inst.method(24);
5908     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5909           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5910     AC_LANG_POP([C++])
5912 AC_CONFIG_HEADERS([config_host/config_probes.h])
5914 dnl ===================================================================
5915 dnl GCC features
5916 dnl ===================================================================
5917 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5918     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5919     save_CFLAGS=$CFLAGS
5920     CFLAGS="$CFLAGS -Werror -mno-avx"
5921     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5922     CFLAGS=$save_CFLAGS
5923     if test "$HAVE_GCC_AVX" = "TRUE"; then
5924         AC_MSG_RESULT([yes])
5925     else
5926         AC_MSG_RESULT([no])
5927     fi
5929     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5930     save_CFLAGS=$CFLAGS
5931     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
5932     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5933     CFLAGS=$save_CFLAGS
5934     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5935         AC_MSG_RESULT([yes])
5936     else
5937         AC_MSG_RESULT([no])
5938     fi
5940     AC_MSG_CHECKING([whether $CC supports atomic functions])
5941     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5942     int v = 0;
5943     if (__sync_add_and_fetch(&v, 1) != 1 ||
5944         __sync_sub_and_fetch(&v, 1) != 0)
5945         return 1;
5946     __sync_synchronize();
5947     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5948         v != 1)
5949         return 1;
5950     return 0;
5951 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5952     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5953         AC_MSG_RESULT([yes])
5954         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5955     else
5956         AC_MSG_RESULT([no])
5957     fi
5959     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5960     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5961     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5962         AC_MSG_RESULT([yes])
5963         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5964     else
5965         AC_MSG_RESULT([no])
5966     fi
5968     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5969     save_CFLAGS=$CFLAGS
5970     CFLAGS="$CFLAGS -Werror"
5971     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5972             __attribute__((deprecated("test"))) void f();
5973         ])], [
5974             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5975             AC_MSG_RESULT([yes])
5976         ], [AC_MSG_RESULT([no])])
5977     CFLAGS=$save_CFLAGS
5979     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5980     AC_LANG_PUSH([C++])
5981     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5982             #include <cstddef>
5983             #include <cxxabi.h>
5984             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5985         ])], [
5986             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5987             AC_MSG_RESULT([yes])
5988         ], [AC_MSG_RESULT([no])])
5989     AC_LANG_POP([C++])
5991     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5992     AC_LANG_PUSH([C++])
5993     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5994             #include <cstddef>
5995             #include <cxxabi.h>
5996             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5997         ])], [
5998             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5999             AC_MSG_RESULT([yes])
6000         ], [AC_MSG_RESULT([no])])
6001     AC_LANG_POP([C++])
6003     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6004     AC_LANG_PUSH([C++])
6005     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6006             #include <cxxabi.h>
6007             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6008         ])], [
6009             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6010             AC_MSG_RESULT([yes])
6011         ], [AC_MSG_RESULT([no])])
6012     AC_LANG_POP([C++])
6014     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6015     AC_LANG_PUSH([C++])
6016     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6017             #include <cstddef>
6018             #include <cxxabi.h>
6019             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6020         ])], [
6021             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6022             AC_MSG_RESULT([yes])
6023         ], [AC_MSG_RESULT([no])])
6024     AC_LANG_POP([C++])
6026     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6027     AC_LANG_PUSH([C++])
6028     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6029             #include <cstddef>
6030             #include <cxxabi.h>
6031             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6032         ])], [
6033             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6034             AC_MSG_RESULT([yes])
6035         ], [AC_MSG_RESULT([no])])
6036     AC_LANG_POP([C++])
6038     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6039     AC_LANG_PUSH([C++])
6040     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6041             #include <cxxabi.h>
6042             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6043         ])], [
6044             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6045             AC_MSG_RESULT([yes])
6046         ], [AC_MSG_RESULT([no])])
6047     AC_LANG_POP([C++])
6049     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6050     AC_LANG_PUSH([C++])
6051     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6052             #include <cxxabi.h>
6053             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6054         ])], [
6055             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6056             AC_MSG_RESULT([yes])
6057         ], [AC_MSG_RESULT([no])])
6058     AC_LANG_POP([C++])
6060     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6061     AC_LANG_PUSH([C++])
6062     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6063             #include <cxxabi.h>
6064             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6065         ])], [
6066             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6067             AC_MSG_RESULT([yes])
6068         ], [AC_MSG_RESULT([no])])
6069     AC_LANG_POP([C++])
6071     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6072     AC_LANG_PUSH([C++])
6073     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6074             #include <cstddef>
6075             #include <cxxabi.h>
6076             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6077         ])], [
6078             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6079             AC_MSG_RESULT([yes])
6080         ], [AC_MSG_RESULT([no])])
6081     AC_LANG_POP([C++])
6083     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6084     AC_LANG_PUSH([C++])
6085     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6086             #include <cstddef>
6087             #include <cxxabi.h>
6088             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6089         ])], [
6090             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6091             AC_MSG_RESULT([yes])
6092         ], [AC_MSG_RESULT([no])])
6093     AC_LANG_POP([C++])
6095     dnl Available in GCC 4.9 and at least since Clang 3.4:
6096     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6097     AC_LANG_PUSH([C++])
6098     save_CXXFLAGS=$CXXFLAGS
6099     CXXFLAGS="$CXXFLAGS -Werror"
6100     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6101             struct __attribute__((warn_unused)) dummy {};
6102         ])], [
6103             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6104             AC_MSG_RESULT([yes])
6105         ], [AC_MSG_RESULT([no])])
6106     CXXFLAGS=$save_CXXFLAGS
6107 AC_LANG_POP([C++])
6110 AC_SUBST(HAVE_GCC_AVX)
6111 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6112 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6113 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6115 dnl ===================================================================
6116 dnl Identify the C++ library
6117 dnl ===================================================================
6119 AC_MSG_CHECKING([what the C++ library is])
6120 AC_LANG_PUSH([C++])
6121 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6122 #include <utility>
6123 #ifndef __GLIBCXX__
6124 foo bar
6125 #endif
6126 ]])],
6127     [CPP_LIBRARY=GLIBCXX
6128      cpp_library_name="GNU libstdc++"
6129     ],
6130     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6131 #include <utility>
6132 #ifndef _LIBCPP_VERSION
6133 foo bar
6134 #endif
6135 ]])],
6136     [CPP_LIBRARY=LIBCPP
6137      cpp_library_name="LLVM libc++"
6138      AC_DEFINE([HAVE_LIBCXX])
6139     ],
6140     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6141 #include <utility>
6142 #ifndef _MSC_VER
6143 foo bar
6144 #endif
6145 ]])],
6146     [CPP_LIBRARY=MSVCRT
6147      cpp_library_name="Microsoft"
6148     ],
6149     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6150 AC_MSG_RESULT([$cpp_library_name])
6151 AC_LANG_POP([C++])
6153 dnl ===================================================================
6154 dnl Check for gperf
6155 dnl ===================================================================
6156 AC_PATH_PROG(GPERF, gperf)
6157 if test -z "$GPERF"; then
6158     AC_MSG_ERROR([gperf not found but needed. Install it.])
6160 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6161     GPERF=`cygpath -m $GPERF`
6163 AC_MSG_CHECKING([gperf version])
6164 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6165     AC_MSG_RESULT([OK])
6166 else
6167     AC_MSG_ERROR([too old, you need at least 3.0.0])
6169 AC_SUBST(GPERF)
6171 dnl ===================================================================
6172 dnl Check for system libcmis
6173 dnl ===================================================================
6174 # libcmis requires curl and we can't build curl for iOS
6175 if test $_os != iOS; then
6176     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6177     ENABLE_LIBCMIS=TRUE
6178 else
6179     ENABLE_LIBCMIS=
6181 AC_SUBST(ENABLE_LIBCMIS)
6183 dnl ===================================================================
6184 dnl C++11
6185 dnl ===================================================================
6187 my_cxx17switches=
6188 libo_FUZZ_ARG_ENABLE(c++17,
6189     AS_HELP_STRING([--disable-c++17],
6190         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6193 AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6194 CXXFLAGS_CXX11=
6195 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6196     CXXFLAGS_CXX11=-std:c++17
6197 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6198     dnl But only use C++17 if the gperf that is being used knows not to emit
6199     dnl "register" in C++ output:
6200     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6201     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'
6202     if test "$enable_c__17" != no; then
6203         my_flags="-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6204     fi
6205     for flag in $my_flags; do
6206         if test "$COM" = MSC; then
6207             flag="-Xclang $flag"
6208         fi
6209         save_CXXFLAGS=$CXXFLAGS
6210         CXXFLAGS="$CXXFLAGS $flag -Werror"
6211         if test "$SYSTEM_LIBCMIS" = TRUE; then
6212             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6213         fi
6214         AC_LANG_PUSH([C++])
6215         dnl Clang 3.9 supports __float128 since
6216         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6217         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6218         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6219         dnl $flag is supported below, so check this first):
6220         my_float128hack=
6221         my_float128hack_impl=-D__float128=void
6222         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6223             #include <vector>
6224             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6225             // (__float128)
6226             ]])
6227         ],,[
6228             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6229             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6230             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6231             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6232             dnl place where __float128 is used is in a template specialization, -D__float128=void
6233             dnl will avoid the problem there while still causing a problem if somebody actually uses
6234             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6235             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6236             dnl "fixed" with this hack):
6237             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6238             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6239                 #include <vector>
6240                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6241                 // (__float128)
6242                 ]])
6243             ],[my_float128hack=$my_float128hack_impl])
6244         ])
6245         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6246             #include <algorithm>
6247             #include <functional>
6248             #include <vector>
6250             #include <string.h>
6251             #pragma GCC diagnostic push
6252             #pragma GCC diagnostic ignored "-Wpragmas"
6253                 // make GCC not warn about next pragma
6254             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6255                 // make Clang with -std < C++17 not even warn about register
6256             #include "conftest.inc"
6257             #pragma GCC diagnostic pop
6259             #if defined SYSTEM_LIBCMIS
6260             // See ucb/source/ucp/cmis/auth_provider.hxx:
6261             #if __GNUC__ >= 7
6262             #pragma GCC diagnostic push
6263             #pragma GCC diagnostic ignored "-Wdeprecated"
6264             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6265             #endif
6266             #include <libcmis/libcmis.hxx>
6267             #if __GNUC__ >= 7
6268             #pragma GCC diagnostic pop
6269             #endif
6270             #endif
6272             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6273                 std::sort(v.begin(), v.end(), fn);
6274             }
6275             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6276         AC_LANG_POP([C++])
6277         CXXFLAGS=$save_CXXFLAGS
6278         if test -n "$CXXFLAGS_CXX11"; then
6279             break
6280         fi
6281     done
6282     rm conftest.inc
6284 if test -n "$CXXFLAGS_CXX11"; then
6285     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6286 else
6287     AC_MSG_ERROR(no)
6289 AC_SUBST(CXXFLAGS_CXX11)
6291 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6292 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6293 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6294 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6295 dnl again towards 4.7.2:
6296 if test $CPP_LIBRARY = GLIBCXX; then
6297     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6298     AC_LANG_PUSH([C++])
6299     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6300 #include <list>
6301 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6302     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6303     //   GCC 4.7.0: 20120322
6304     //   GCC 4.7.1: 20120614
6305     // and using a range check is not possible as the mapping between
6306     // __GLIBCXX__ values and GCC versions is not monotonic
6307 /* ok */
6308 #else
6309 abi broken
6310 #endif
6311         ]])], [AC_MSG_RESULT(no, ok)],
6312         [AC_MSG_ERROR(yes)])
6313     AC_LANG_POP([C++])
6316 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6317 save_CXXFLAGS=$CXXFLAGS
6318 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6319 AC_LANG_PUSH([C++])
6321 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6322 #include <stddef.h>
6324 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6326 namespace
6328         struct b
6329         {
6330                 int i;
6331                 int j;
6332         };
6334 ]], [[
6335 struct a
6337         int i;
6338         int j;
6340 a thinga[]={{0,0}, {1,1}};
6341 b thingb[]={{0,0}, {1,1}};
6342 size_t i = sizeof(sal_n_array_size(thinga));
6343 size_t j = sizeof(sal_n_array_size(thingb));
6344 return !(i != 0 && j != 0);
6346     ], [ AC_MSG_RESULT(yes) ],
6347     [ AC_MSG_ERROR(no)])
6348 AC_LANG_POP([C++])
6349 CXXFLAGS=$save_CXXFLAGS
6351 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6352 save_CXXFLAGS=$CXXFLAGS
6353 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6354 AC_LANG_PUSH([C++])
6355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6356     // A somewhat over-complicated way of checking for
6357     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6358     // in constexpr function":
6359     #include <cassert>
6360     template<typename T> inline constexpr T f(T x) { return x; }
6361     template<typename T> inline constexpr T g(T x) {
6362         assert(f(static_cast<int>(x)));
6363         return x;
6364     }
6365     enum E { e };
6366     auto v = g(E::e);
6368     struct S {
6369         int n_;
6370         constexpr bool f() {
6371             int n = n_;
6372             int i = 0;
6373             while (n > 0) { --n; ++i; }
6374             assert(i >= 0);
6375             return i == 0;
6376         }
6377     };
6378     constexpr auto v2 = S{10}.f();
6379     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6380 AC_LANG_POP([C++])
6381 CXXFLAGS=$save_CXXFLAGS
6382 AC_MSG_RESULT([$cxx14_constexpr])
6383 if test "$cxx14_constexpr" = yes; then
6384     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6387 dnl _Pragma support (may require C++11)
6388 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6389     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6390     AC_LANG_PUSH([C++])
6391     save_CXXFLAGS=$CXXFLAGS
6392     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6393     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6394             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6395         ])], [
6396             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6397             AC_MSG_RESULT([yes])
6398         ], [AC_MSG_RESULT([no])])
6399     AC_LANG_POP([C++])
6400     CXXFLAGS=$save_CXXFLAGS
6403 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6404 if test "$GCC" = yes; then
6405     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6406     AC_LANG_PUSH([C++])
6407     save_CXXFLAGS=$CXXFLAGS
6408     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6409     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6410     CXXFLAGS=$save_CXXFLAGS
6411     AC_LANG_POP([C++])
6412     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6413         AC_MSG_RESULT([yes])
6414     else
6415         AC_MSG_RESULT([no])
6416     fi
6418 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6420 AC_MSG_CHECKING([[whether $CXX supports [[fallthrough]]]])
6421 AC_LANG_PUSH([C++])
6422 save_CXXFLAGS=$CXXFLAGS
6423 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6424 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6425 if test "$COM" = MSC; then
6426     CXXFLAGS="$CXXFLAGS /we5030"
6427 else
6428     CXXFLAGS="$CXXFLAGS -Werror"
6430 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6431         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6432         // by checking for __cplusplus:
6433         #if __cplusplus > 201703L
6434         #if !__has_cpp_attribute(fallthrough)
6435         #error
6436         #endif
6437         #else
6438         void f(int & x) {
6439             switch (x) {
6440             case 0:
6441                 ++x;
6442                 [[fallthrough]];
6443             default:
6444                 ++x;
6445             }
6446         }
6447         #endif
6448     ]])], [
6449         AC_DEFINE([HAVE_CPP_ATTRIBUTE_FALLTHROUGH],[1])
6450         AC_MSG_RESULT([yes])
6451     ], [AC_MSG_RESULT([no])])
6452 CXXFLAGS=$save_CXXFLAGS
6453 AC_LANG_POP([C++])
6455 AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
6456 AC_LANG_PUSH([C++])
6457 save_CXXFLAGS=$CXXFLAGS
6458 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6459 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6460 if test "$COM" = MSC; then
6461     CXXFLAGS="$CXXFLAGS /we5030"
6462 else
6463     CXXFLAGS="$CXXFLAGS -Werror"
6465 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6466         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6467         // by checking for __cplusplus:
6468         #if __cplusplus > 201703L
6469         #if !__has_cpp_attribute(nodiscard)
6470         #error
6471         #endif
6472         #else
6473         [[nodiscard]] int f();
6474         #endif
6475     ]])], [
6476         AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
6477         AC_MSG_RESULT([yes])
6478     ], [AC_MSG_RESULT([no])])
6479 CXXFLAGS=$save_CXXFLAGS
6480 AC_LANG_POP([C++])
6482 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6483 AC_LANG_PUSH([C++])
6484 save_CXXFLAGS=$CXXFLAGS
6485 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6486 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6487         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6488         // supporting it:
6489         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6490         struct S {
6491         private:
6492             S(S const &);
6493         public:
6494             S();
6495             ~S();
6496         };
6497         S copy();
6498         void f() { S c(copy()); }
6499         #endif
6500     ])], [
6501         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6502         AC_MSG_RESULT([yes])
6503     ], [AC_MSG_RESULT([no])])
6504 CXXFLAGS=$save_CXXFLAGS
6505 AC_LANG_POP([C++])
6507 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6508 AC_LANG_PUSH([C++])
6509 save_CXXFLAGS=$CXXFLAGS
6510 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6511 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6512         #include <memory>
6513         struct S1 {};
6514         struct S2: S1 {};
6515         std::unique_ptr<S1> f() {
6516             std::unique_ptr<S2> s2(new S2);
6517             return s2;
6518         }
6519     ])], [
6520         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6521         AC_MSG_RESULT([yes])
6522     ], [AC_MSG_RESULT([no])])
6523 CXXFLAGS=$save_CXXFLAGS
6524 AC_LANG_POP([C++])
6526 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6527 AC_LANG_PUSH([C++])
6528 save_CXXFLAGS=$CXXFLAGS
6529 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6530 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6531         struct S1 { S1(S1 &&); };
6532         struct S2: S1 {};
6533         S1 f(S2 s) { return s; }
6534     ])], [
6535         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6536         AC_MSG_RESULT([yes])
6537     ], [AC_MSG_RESULT([no])])
6538 CXXFLAGS=$save_CXXFLAGS
6539 AC_LANG_POP([C++])
6541 dnl ===================================================================
6542 dnl system stl sanity tests
6543 dnl ===================================================================
6544 if test "$_os" != "WINNT"; then
6546     AC_LANG_PUSH([C++])
6548     save_CPPFLAGS="$CPPFLAGS"
6549     if test -n "$MACOSX_SDK_PATH"; then
6550         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6551     fi
6553     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6554     # only.
6555     if test "$CPP_LIBRARY" = GLIBCXX; then
6556         dnl gcc#19664, gcc#22482, rhbz#162935
6557         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6558         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6559         AC_MSG_RESULT([$stlvisok])
6560         if test "$stlvisok" = "no"; then
6561             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6562         fi
6563     fi
6565     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6566     # when we don't make any dynamic libraries?
6567     if test "$DISABLE_DYNLOADING" = ""; then
6568         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6569         cat > conftestlib1.cc <<_ACEOF
6570 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6571 struct S2: S1<int> { virtual ~S2(); };
6572 S2::~S2() {}
6573 _ACEOF
6574         cat > conftestlib2.cc <<_ACEOF
6575 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6576 struct S2: S1<int> { virtual ~S2(); };
6577 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6578 _ACEOF
6579         gccvisinlineshiddenok=yes
6580         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6581             gccvisinlineshiddenok=no
6582         else
6583             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6584             dnl known to not work with -z defs (unsetting which makes the test
6585             dnl moot, though):
6586             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6587             if test "$COM_IS_CLANG" = TRUE; then
6588                 for i in $CXX $CXXFLAGS; do
6589                     case $i in
6590                     -fsanitize=*)
6591                         my_linkflagsnoundefs=
6592                         break
6593                         ;;
6594                     esac
6595                 done
6596             fi
6597             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6598                 gccvisinlineshiddenok=no
6599             fi
6600         fi
6602         rm -fr libconftest*
6603         AC_MSG_RESULT([$gccvisinlineshiddenok])
6604         if test "$gccvisinlineshiddenok" = "no"; then
6605             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6606         fi
6607     fi
6609    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6610     cat >visibility.cxx <<_ACEOF
6611 #pragma GCC visibility push(hidden)
6612 struct __attribute__ ((visibility ("default"))) TestStruct {
6613   static void Init();
6615 __attribute__ ((visibility ("default"))) void TestFunc() {
6616   TestStruct::Init();
6618 _ACEOF
6619     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6620         gccvisbroken=yes
6621     else
6622         case "$host_cpu" in
6623         i?86|x86_64)
6624             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6625                 gccvisbroken=no
6626             else
6627                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6628                     gccvisbroken=no
6629                 else
6630                     gccvisbroken=yes
6631                 fi
6632             fi
6633             ;;
6634         *)
6635             gccvisbroken=no
6636             ;;
6637         esac
6638     fi
6639     rm -f visibility.s visibility.cxx
6641     AC_MSG_RESULT([$gccvisbroken])
6642     if test "$gccvisbroken" = "yes"; then
6643         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6644     fi
6646     CPPFLAGS="$save_CPPFLAGS"
6648     AC_LANG_POP([C++])
6651 dnl ===================================================================
6652 dnl  Clang++ tests
6653 dnl ===================================================================
6655 HAVE_GCC_FNO_DEFAULT_INLINE=
6656 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6657 if test "$GCC" = "yes"; then
6658     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6659     AC_LANG_PUSH([C++])
6660     save_CXXFLAGS=$CXXFLAGS
6661     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6662     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6663     CXXFLAGS=$save_CXXFLAGS
6664     AC_LANG_POP([C++])
6665     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6666         AC_MSG_RESULT([yes])
6667     else
6668         AC_MSG_RESULT([no])
6669     fi
6671     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6672     AC_LANG_PUSH([C++])
6673     save_CXXFLAGS=$CXXFLAGS
6674     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6675     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6676     CXXFLAGS=$save_CXXFLAGS
6677     AC_LANG_POP([C++])
6678     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6679         AC_MSG_RESULT([yes])
6680     else
6681         AC_MSG_RESULT([no])
6682     fi
6684 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6685 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6687 dnl ===================================================================
6688 dnl Compiler plugins
6689 dnl ===================================================================
6691 COMPILER_PLUGINS=
6692 # currently only Clang
6694 if test "$COM_IS_CLANG" != "TRUE"; then
6695     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6696         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6697         enable_compiler_plugins=no
6698     fi
6701 if test "$COM_IS_CLANG" = "TRUE"; then
6702     if test -n "$enable_compiler_plugins"; then
6703         compiler_plugins="$enable_compiler_plugins"
6704     elif test -n "$ENABLE_DBGUTIL"; then
6705         compiler_plugins=test
6706     else
6707         compiler_plugins=no
6708     fi
6709     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6710         if test "$compiler_plugins" = yes; then
6711             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6712         else
6713             compiler_plugins=no
6714         fi
6715     fi
6716     if test "$compiler_plugins" != "no"; then
6717         dnl The prefix where Clang resides, override to where Clang resides if
6718         dnl using a source build:
6719         if test -z "$CLANGDIR"; then
6720             CLANGDIR=/usr
6721         fi
6722         AC_LANG_PUSH([C++])
6723         save_CPPFLAGS=$CPPFLAGS
6724         save_CXX=$CXX
6725         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6726         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6727         CXX=$COMPILER_PLUGINS_CXX
6728         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6729         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6730             [COMPILER_PLUGINS=TRUE],
6731             [
6732             if test "$compiler_plugins" = "yes"; then
6733                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6734             else
6735                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6736                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6737             fi
6738             ])
6739         CXX=$save_CXX
6740         CPPFLAGS=$save_CPPFLAGS
6741         AC_LANG_POP([C++])
6742     fi
6743 else
6744     if test "$enable_compiler_plugins" = "yes"; then
6745         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6746     fi
6748 AC_SUBST(COMPILER_PLUGINS)
6749 AC_SUBST(COMPILER_PLUGINS_CXX)
6750 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6751 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6752 AC_SUBST(CLANGDIR)
6753 AC_SUBST(CLANGLIBDIR)
6755 # Plugin to help linker.
6756 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6757 # This makes --enable-lto build with clang work.
6758 AC_SUBST(LD_PLUGIN)
6760 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6761 AC_SUBST(HAVE_POSIX_FALLOCATE)
6763 dnl ===================================================================
6764 dnl Custom build version
6765 dnl ===================================================================
6767 AC_MSG_CHECKING([whether to add custom build version])
6768 if test "$with_build_version" != ""; then
6769     BUILD_VER_STRING=$with_build_version
6770     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6771 else
6772     BUILD_VER_STRING=
6773     AC_MSG_RESULT([no])
6775 AC_SUBST(BUILD_VER_STRING)
6777 JITC_PROCESSOR_TYPE=""
6778 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6779     # IBMs JDK needs this...
6780     JITC_PROCESSOR_TYPE=6
6781     export JITC_PROCESSOR_TYPE
6783 AC_SUBST([JITC_PROCESSOR_TYPE])
6785 # Misc Windows Stuff
6786 AC_ARG_WITH(ucrt-dir,
6787     AS_HELP_STRING([--with-ucrt-dir],
6788         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6789         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6790         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6791             Windows6.1-KB2999226-x64.msu
6792             Windows6.1-KB2999226-x86.msu
6793             Windows8.1-KB2999226-x64.msu
6794             Windows8.1-KB2999226-x86.msu
6795             Windows8-RT-KB2999226-x64.msu
6796             Windows8-RT-KB2999226-x86.msu
6797         A zip archive including those files is available from Microsoft site:
6798         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6800 UCRT_REDISTDIR="$with_ucrt_dir"
6801 if test $_os = "WINNT"; then
6802     find_msvc_x64_dlls
6803     find_msms
6804     MSVC_DLL_PATH="$msvcdllpath"
6805     MSVC_DLLS="$msvcdlls"
6806     MSM_PATH="$msmdir"
6807     # MSVC 15.3 changed it to VC141
6808     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6809         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6810     else
6811         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6812     fi
6813     if test "$UCRT_REDISTDIR" = "no"; then
6814         dnl explicitly disabled
6815         UCRT_REDISTDIR=""
6816     else
6817         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6818                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6819                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6820                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6821                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6822                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6823             UCRT_REDISTDIR=""
6824             if test -n "$PKGFORMAT"; then
6825                for i in $PKGFORMAT; do
6826                    case "$i" in
6827                    msi)
6828                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6829                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6830                        ;;
6831                    esac
6832                done
6833             fi
6834         fi
6835     fi
6838 AC_SUBST(UCRT_REDISTDIR)
6839 AC_SUBST(MSVC_DLL_PATH)
6840 AC_SUBST(MSVC_DLLS)
6841 AC_SUBST(MSM_PATH)
6843 dnl ===================================================================
6844 dnl Checks for Java
6845 dnl ===================================================================
6846 if test "$ENABLE_JAVA" != ""; then
6848     # Windows-specific tests
6849     if test "$build_os" = "cygwin"; then
6850         if test "$BITNESS_OVERRIDE" = 64; then
6851             bitness=64
6852         else
6853             bitness=32
6854         fi
6856         if test -z "$with_jdk_home"; then
6857             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6858             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6859             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6860             if test -n "$regvalue"; then
6861                 ver=$regvalue
6862                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6863                 _jdk_home=$regvalue
6864             fi
6865             if test -z "$with_jdk_home"; then
6866                 for ver in 1.8 1.7 1.6; do
6867                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6868                     if test -n "$regvalue"; then
6869                         _jdk_home=$regvalue
6870                         break
6871                     fi
6872                 done
6873             fi
6874             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6875                 with_jdk_home="$_jdk_home"
6876                 howfound="found automatically"
6877             else
6878                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6879             fi
6880         else
6881             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6882             howfound="you passed"
6883         fi
6884     fi
6886     # 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.
6887     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6888     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6889         with_jdk_home=`/usr/libexec/java_home`
6890     fi
6892     JAVA_HOME=; export JAVA_HOME
6893     if test -z "$with_jdk_home"; then
6894         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6895     else
6896         _java_path="$with_jdk_home/bin/$with_java"
6897         dnl Check if there is a Java interpreter at all.
6898         if test -x "$_java_path"; then
6899             JAVAINTERPRETER=$_java_path
6900         else
6901             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6902         fi
6903     fi
6905     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6906     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6907     dnl loaded by java to run JunitTests:
6908     if test "$build_os" = "cygwin"; then
6909         shortjdkhome=`cygpath -d "$with_jdk_home"`
6910         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
6911             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6912             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6913         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
6914             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6915             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6916         fi
6918         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6919             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6920         fi
6921         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6922     elif test "$cross_compiling" != "yes"; then
6923         case $CPUNAME in
6924             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6925                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6926                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6927                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6928                 fi
6929                 ;;
6930             *) # assumption: everything else 32-bit
6931                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6932                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6933                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6934                 fi
6935                 ;;
6936         esac
6937     fi
6940 HAVE_JAVA9=
6941 dnl ===================================================================
6942 dnl Checks for JDK.
6943 dnl ===================================================================
6945 # Note that JAVA_HOME as for now always means the *build* platform's
6946 # JAVA_HOME. Whether all the complexity here actually is needed any
6947 # more or not, no idea.
6949 if test "$ENABLE_JAVA" != ""; then
6950     _gij_longver=0
6951     AC_MSG_CHECKING([the installed JDK])
6952     if test -n "$JAVAINTERPRETER"; then
6953         dnl java -version sends output to stderr!
6954         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6955             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6956         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6957             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6958         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6959             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6960         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6961             JDK=ibm
6963             dnl IBM JDK specific tests
6964             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6965             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6967             if test "$_jdk_ver" -lt 10600; then
6968                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6969             fi
6971             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6973             if test "$with_jdk_home" = ""; then
6974                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6975 you must use the "--with-jdk-home" configure option explicitly])
6976             fi
6978             JAVA_HOME=$with_jdk_home
6979         else
6980             JDK=sun
6982             dnl Sun JDK specific tests
6983             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6984             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6986             if test "$_jdk_ver" -lt 10600; then
6987                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6988             fi
6989             if test "$_jdk_ver" -gt 10600; then
6990                 JAVA_CLASSPATH_NOT_SET=TRUE
6991             fi
6992             if test "$_jdk_ver" -ge 10900; then
6993                 HAVE_JAVA9=TRUE
6994             fi
6996             AC_MSG_RESULT([checked (JDK $_jdk)])
6997             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6998             if test "$_os" = "WINNT"; then
6999                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7000             fi
7002             # set to limit VM usage for JunitTests
7003             JAVAIFLAGS=-Xmx64M
7004             # set to limit VM usage for javac
7005             JAVAFLAGS=-J-Xmx128M
7006         fi
7007     else
7008         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7009     fi
7010 else
7011     dnl Java disabled
7012     JAVA_HOME=
7013     export JAVA_HOME
7016 dnl ===================================================================
7017 dnl Set target Java bytecode version
7018 dnl ===================================================================
7019 if test "$ENABLE_JAVA" != ""; then
7020     if test "$HAVE_JAVA9" = "TRUE"; then
7021         _java_target_ver="1.6"
7022     else
7023         _java_target_ver="1.5"
7024     fi
7025     JAVA_SOURCE_VER="$_java_target_ver"
7026     JAVA_TARGET_VER="$_java_target_ver"
7029 dnl ===================================================================
7030 dnl Checks for javac
7031 dnl ===================================================================
7032 if test "$ENABLE_JAVA" != ""; then
7033     javacompiler="javac"
7034     if test -z "$with_jdk_home"; then
7035         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7036     else
7037         _javac_path="$with_jdk_home/bin/$javacompiler"
7038         dnl Check if there is a Java compiler at all.
7039         if test -x "$_javac_path"; then
7040             JAVACOMPILER=$_javac_path
7041         fi
7042     fi
7043     if test -z "$JAVACOMPILER"; then
7044         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7045     fi
7046     if test "$build_os" = "cygwin"; then
7047         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7048             JAVACOMPILER="${JAVACOMPILER}.exe"
7049         fi
7050         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7051     fi
7054 dnl ===================================================================
7055 dnl Checks for javadoc
7056 dnl ===================================================================
7057 if test "$ENABLE_JAVA" != ""; then
7058     if test -z "$with_jdk_home"; then
7059         AC_PATH_PROG(JAVADOC, javadoc)
7060     else
7061         _javadoc_path="$with_jdk_home/bin/javadoc"
7062         dnl Check if there is a javadoc at all.
7063         if test -x "$_javadoc_path"; then
7064             JAVADOC=$_javadoc_path
7065         else
7066             AC_PATH_PROG(JAVADOC, javadoc)
7067         fi
7068     fi
7069     if test -z "$JAVADOC"; then
7070         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7071     fi
7072     if test "$build_os" = "cygwin"; then
7073         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7074             JAVADOC="${JAVADOC}.exe"
7075         fi
7076         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7077     fi
7079     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7080     JAVADOCISGJDOC="yes"
7081     fi
7083 AC_SUBST(JAVADOCISGJDOC)
7085 if test "$ENABLE_JAVA" != ""; then
7086     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7087     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7088         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7089            # try to recover first by looking whether we have a alternatives
7090            # system as in Debian or newer SuSEs where following /usr/bin/javac
7091            # over /etc/alternatives/javac leads to the right bindir where we
7092            # just need to strip a bit away to get a valid JAVA_HOME
7093            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7094         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7095             # maybe only one level of symlink (e.g. on Mac)
7096             JAVA_HOME=$(readlink $JAVACOMPILER)
7097             if test "$(dirname $JAVA_HOME)" = "."; then
7098                 # we've got no path to trim back
7099                 JAVA_HOME=""
7100             fi
7101         else
7102             # else warn
7103             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7104             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7105             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7106             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7107         fi
7108         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7109         if test "$JAVA_HOME" != "/usr"; then
7110             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7111                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7112                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7113                 dnl Tiger already returns a JDK path..
7114                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7115             else
7116                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7117                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7118                 dnl that checks which version to run
7119                 if test -f "$JAVA_HOME"; then
7120                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7121                 fi
7122             fi
7123         fi
7124     fi
7125     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7127     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7128     if test -z "$JAVA_HOME"; then
7129         if test "x$with_jdk_home" = "x"; then
7130             cat > findhome.java <<_ACEOF
7131 [import java.io.File;
7133 class findhome
7135     public static void main(String args[])
7136     {
7137         String jrelocation = System.getProperty("java.home");
7138         File jre = new File(jrelocation);
7139         System.out.println(jre.getParent());
7140     }
7142 _ACEOF
7143             AC_MSG_CHECKING([if javac works])
7144             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7145             AC_TRY_EVAL(javac_cmd)
7146             if test $? = 0 -a -f ./findhome.class; then
7147                 AC_MSG_RESULT([javac works])
7148             else
7149                 echo "configure: javac test failed" >&5
7150                 cat findhome.java >&5
7151                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7152             fi
7153             AC_MSG_CHECKING([if gij knows its java.home])
7154             JAVA_HOME=`$JAVAINTERPRETER findhome`
7155             if test $? = 0 -a "$JAVA_HOME" != ""; then
7156                 AC_MSG_RESULT([$JAVA_HOME])
7157             else
7158                 echo "configure: java test failed" >&5
7159                 cat findhome.java >&5
7160                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7161             fi
7162             # clean-up after ourselves
7163             rm -f ./findhome.java ./findhome.class
7164         else
7165             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7166         fi
7167     fi
7169     # now check if $JAVA_HOME is really valid
7170     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7171         case "${JAVA_HOME}" in
7172             /Library/Java/JavaVirtualMachines/*)
7173                 ;;
7174             *)
7175                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7176                 ;;
7177         esac
7178         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7179             JAVA_HOME_OK="NO"
7180         fi
7181     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7182         JAVA_HOME_OK="NO"
7183     fi
7184     if test "$JAVA_HOME_OK" = "NO"; then
7185         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7186         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7187         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7188         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7189         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7190         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7191     fi
7192     PathFormat "$JAVA_HOME"
7193     JAVA_HOME="$formatted_path"
7196 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7197     "$_os" != Darwin
7198 then
7199     AC_MSG_CHECKING([for JAWT lib])
7200     if test "$_os" = WINNT; then
7201         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7202         JAWTLIB=jawt.lib
7203     else
7204         case "$host_cpu" in
7205         arm*)
7206             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7207             JAVA_ARCH=$my_java_arch
7208             ;;
7209         i*86)
7210             my_java_arch=i386
7211             ;;
7212         m68k)
7213             my_java_arch=m68k
7214             ;;
7215         powerpc)
7216             my_java_arch=ppc
7217             ;;
7218         powerpc64)
7219             my_java_arch=ppc64
7220             ;;
7221         powerpc64le)
7222             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7223             JAVA_ARCH=$my_java_arch
7224             ;;
7225         sparc64)
7226             my_java_arch=sparcv9
7227             ;;
7228         x86_64)
7229             my_java_arch=amd64
7230             ;;
7231         *)
7232             my_java_arch=$host_cpu
7233             ;;
7234         esac
7235         # This is where JDK9 puts the library
7236         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7237             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7238         else
7239             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7240         fi
7241         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7242     fi
7243     AC_MSG_RESULT([$JAWTLIB])
7245 AC_SUBST(JAWTLIB)
7247 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7248     case "$host_os" in
7250     aix*)
7251         JAVAINC="-I$JAVA_HOME/include"
7252         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7253         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7254         ;;
7256     cygwin*)
7257         JAVAINC="-I$JAVA_HOME/include/win32"
7258         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7259         ;;
7261     darwin*)
7262         if test -d "$JAVA_HOME/include/darwin"; then
7263             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7264         else
7265             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7266         fi
7267         ;;
7269     dragonfly*)
7270         JAVAINC="-I$JAVA_HOME/include"
7271         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7272         ;;
7274     freebsd*)
7275         JAVAINC="-I$JAVA_HOME/include"
7276         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7277         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7278         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7279         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7280         ;;
7282     k*bsd*-gnu*)
7283         JAVAINC="-I$JAVA_HOME/include"
7284         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7285         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7286         ;;
7288     linux-gnu*)
7289         JAVAINC="-I$JAVA_HOME/include"
7290         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7291         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7292         ;;
7294     *netbsd*)
7295         JAVAINC="-I$JAVA_HOME/include"
7296         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7297         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7298        ;;
7300     openbsd*)
7301         JAVAINC="-I$JAVA_HOME/include"
7302         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7303         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7304         ;;
7306     solaris*)
7307         JAVAINC="-I$JAVA_HOME/include"
7308         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7309         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7310         ;;
7311     esac
7313 SOLARINC="$SOLARINC $JAVAINC"
7315 AC_SUBST(JAVACOMPILER)
7316 AC_SUBST(JAVADOC)
7317 AC_SUBST(JAVAINTERPRETER)
7318 AC_SUBST(JAVAIFLAGS)
7319 AC_SUBST(JAVAFLAGS)
7320 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7321 AC_SUBST(JAVA_HOME)
7322 AC_SUBST(JAVA_SOURCE_VER)
7323 AC_SUBST(JAVA_TARGET_VER)
7324 AC_SUBST(JDK)
7327 dnl ===================================================================
7328 dnl Export file validation
7329 dnl ===================================================================
7330 AC_MSG_CHECKING([whether to enable export file validation])
7331 if test "$with_export_validation" != "no"; then
7332     if test -z "$ENABLE_JAVA"; then
7333         if test "$with_export_validation" = "yes"; then
7334             AC_MSG_ERROR([requested, but Java is disabled])
7335         else
7336             AC_MSG_RESULT([no, as Java is disabled])
7337         fi
7338     elif test "$_jdk_ver" -lt 10800; then
7339         if test "$with_export_validation" = "yes"; then
7340             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7341         else
7342             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7343         fi
7344     else
7345         AC_MSG_RESULT([yes])
7346         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7348         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7349         if test -z "$ODFVALIDATOR"; then
7350             # remember to download the ODF toolkit with validator later
7351             AC_MSG_NOTICE([no odfvalidator found, will download it])
7352             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7353             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7355             # and fetch name of odfvalidator jar name from download.lst
7356             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7357             AC_SUBST(ODFVALIDATOR_JAR)
7359             if test -z "$ODFVALIDATOR_JAR"; then
7360                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7361             fi
7362         fi
7363         if test "$build_os" = "cygwin"; then
7364             # In case of Cygwin it will be executed from Windows,
7365             # so we need to run bash and absolute path to validator
7366             # so instead of "odfvalidator" it will be
7367             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7368             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7369         else
7370             ODFVALIDATOR="sh $ODFVALIDATOR"
7371         fi
7372         AC_SUBST(ODFVALIDATOR)
7375         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7376         if test -z "$OFFICEOTRON"; then
7377             # remember to download the officeotron with validator later
7378             AC_MSG_NOTICE([no officeotron found, will download it])
7379             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7380             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7382             # and fetch name of officeotron jar name from download.lst
7383             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7384             AC_SUBST(OFFICEOTRON_JAR)
7386             if test -z "$OFFICEOTRON_JAR"; then
7387                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7388             fi
7389         else
7390             # check version of existing officeotron
7391             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7392             if test 0"$OFFICEOTRON_VER" -lt 704; then
7393                 AC_MSG_ERROR([officeotron too old])
7394             fi
7395         fi
7396         if test "$build_os" = "cygwin"; then
7397             # In case of Cygwin it will be executed from Windows,
7398             # so we need to run bash and absolute path to validator
7399             # so instead of "odfvalidator" it will be
7400             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7401             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7402         else
7403             OFFICEOTRON="sh $OFFICEOTRON"
7404         fi
7405     fi
7406     AC_SUBST(OFFICEOTRON)
7407 else
7408     AC_MSG_RESULT([no])
7411 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7412 if test "$with_bffvalidator" != "no"; then
7413     AC_DEFINE(HAVE_BFFVALIDATOR)
7415     if test "$with_export_validation" = "no"; then
7416         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7417     fi
7419     if test "$with_bffvalidator" = "yes"; then
7420         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7421     else
7422         BFFVALIDATOR="$with_bffvalidator"
7423     fi
7425     if test "$build_os" = "cygwin"; then
7426         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7427             AC_MSG_RESULT($BFFVALIDATOR)
7428         else
7429             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7430         fi
7431     elif test -n "$BFFVALIDATOR"; then
7432         # We are not in Cygwin but need to run Windows binary with wine
7433         AC_PATH_PROGS(WINE, wine)
7435         # so swap in a shell wrapper that converts paths transparently
7436         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7437         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7438         AC_SUBST(BFFVALIDATOR_EXE)
7439         AC_MSG_RESULT($BFFVALIDATOR)
7440     else
7441         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7442     fi
7443     AC_SUBST(BFFVALIDATOR)
7444 else
7445     AC_MSG_RESULT([no])
7448 dnl ===================================================================
7449 dnl Check for C preprocessor to use
7450 dnl ===================================================================
7451 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7452 if test -n "$with_idlc_cpp"; then
7453     AC_MSG_RESULT([$with_idlc_cpp])
7454     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7455 else
7456     AC_MSG_RESULT([ucpp])
7457     AC_MSG_CHECKING([which ucpp tp use])
7458     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7459         AC_MSG_RESULT([external])
7460         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7461     else
7462         AC_MSG_RESULT([internal])
7463         BUILD_TYPE="$BUILD_TYPE UCPP"
7464     fi
7466 AC_SUBST(SYSTEM_UCPP)
7468 dnl ===================================================================
7469 dnl Check for epm (not needed for Windows)
7470 dnl ===================================================================
7471 AC_MSG_CHECKING([whether to enable EPM for packing])
7472 if test "$enable_epm" = "yes"; then
7473     AC_MSG_RESULT([yes])
7474     if test "$_os" != "WINNT"; then
7475         if test $_os = Darwin; then
7476             EPM=internal
7477         elif test -n "$with_epm"; then
7478             EPM=$with_epm
7479         else
7480             AC_PATH_PROG(EPM, epm, no)
7481         fi
7482         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7483             AC_MSG_NOTICE([EPM will be built.])
7484             BUILD_TYPE="$BUILD_TYPE EPM"
7485             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7486         else
7487             # Gentoo has some epm which is something different...
7488             AC_MSG_CHECKING([whether the found epm is the right epm])
7489             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7490                 AC_MSG_RESULT([yes])
7491             else
7492                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7493             fi
7494             AC_MSG_CHECKING([epm version])
7495             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7496             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7497                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7498                 AC_MSG_RESULT([OK, >= 3.7])
7499             else
7500                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7501                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7502             fi
7503         fi
7504     fi
7506     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7507         AC_MSG_CHECKING([for rpm])
7508         for a in "$RPM" rpmbuild rpm; do
7509             $a --usage >/dev/null 2> /dev/null
7510             if test $? -eq 0; then
7511                 RPM=$a
7512                 break
7513             else
7514                 $a --version >/dev/null 2> /dev/null
7515                 if test $? -eq 0; then
7516                     RPM=$a
7517                     break
7518                 fi
7519             fi
7520         done
7521         if test -z "$RPM"; then
7522             AC_MSG_ERROR([not found])
7523         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7524             RPM_PATH=`which $RPM`
7525             AC_MSG_RESULT([$RPM_PATH])
7526             SCPDEFS="$SCPDEFS -DWITH_RPM"
7527         else
7528             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7529         fi
7530     fi
7531     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7532         AC_PATH_PROG(DPKG, dpkg, no)
7533         if test "$DPKG" = "no"; then
7534             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7535         fi
7536     fi
7537     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7538        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7539         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7540             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7541                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7542                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7543                     AC_MSG_RESULT([yes])
7544                 else
7545                     AC_MSG_RESULT([no])
7546                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7547                         _pt="rpm"
7548                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7549                         add_warning "the rpms will need to be installed with --nodeps"
7550                     else
7551                         _pt="pkg"
7552                     fi
7553                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7554                     add_warning "the ${_pt}s will not be relocatable"
7555                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7556                                  relocation will work, you need to patch your epm with the
7557                                  patch in epm/epm-3.7.patch or build with
7558                                  --with-epm=internal which will build a suitable epm])
7559                 fi
7560             fi
7561         fi
7562     fi
7563     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7564         AC_PATH_PROG(PKGMK, pkgmk, no)
7565         if test "$PKGMK" = "no"; then
7566             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7567         fi
7568     fi
7569     AC_SUBST(RPM)
7570     AC_SUBST(DPKG)
7571     AC_SUBST(PKGMK)
7572 else
7573     for i in $PKGFORMAT; do
7574         case "$i" in
7575         aix | bsd | deb | pkg | rpm | native | portable)
7576             AC_MSG_ERROR(
7577                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7578             ;;
7579         esac
7580     done
7581     AC_MSG_RESULT([no])
7582     EPM=NO
7584 AC_SUBST(EPM)
7586 ENABLE_LWP=
7587 if test "$enable_lotuswordpro" = "yes"; then
7588     ENABLE_LWP="TRUE"
7590 AC_SUBST(ENABLE_LWP)
7592 dnl ===================================================================
7593 dnl Check for building ODK
7594 dnl ===================================================================
7595 if test "$enable_odk" = no; then
7596     unset DOXYGEN
7597 else
7598     if test "$with_doxygen" = no; then
7599         AC_MSG_CHECKING([for doxygen])
7600         unset DOXYGEN
7601         AC_MSG_RESULT([no])
7602     else
7603         if test "$with_doxygen" = yes; then
7604             AC_PATH_PROG([DOXYGEN], [doxygen])
7605             if test -z "$DOXYGEN"; then
7606                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7607             fi
7608             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7609                 if ! dot -V 2>/dev/null; then
7610                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7611                 fi
7612             fi
7613         else
7614             AC_MSG_CHECKING([for doxygen])
7615             DOXYGEN=$with_doxygen
7616             AC_MSG_RESULT([$DOXYGEN])
7617         fi
7618         if test -n "$DOXYGEN"; then
7619             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7620             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7621             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7622                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7623             fi
7624         fi
7625     fi
7627 AC_SUBST([DOXYGEN])
7629 AC_MSG_CHECKING([whether to build the ODK])
7630 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7631     AC_MSG_RESULT([yes])
7633     if test "$with_java" != "no"; then
7634         AC_MSG_CHECKING([whether to build unowinreg.dll])
7635         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7636             # build on Win by default
7637             enable_build_unowinreg=yes
7638         fi
7639         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7640             AC_MSG_RESULT([no])
7641             BUILD_UNOWINREG=
7642         else
7643             AC_MSG_RESULT([yes])
7644             BUILD_UNOWINREG=TRUE
7645         fi
7646         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7647             if test -z "$with_mingw_cross_compiler"; then
7648                 dnl Guess...
7649                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7650             elif test -x "$with_mingw_cross_compiler"; then
7651                  MINGWCXX="$with_mingw_cross_compiler"
7652             else
7653                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7654             fi
7656             if test "$MINGWCXX" = "false"; then
7657                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7658             fi
7660             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7661             if test -x "$mingwstrip_test"; then
7662                 MINGWSTRIP="$mingwstrip_test"
7663             else
7664                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7665             fi
7667             if test "$MINGWSTRIP" = "false"; then
7668                 AC_MSG_ERROR(MinGW32 binutils not found.)
7669             fi
7670         fi
7671     fi
7672     BUILD_TYPE="$BUILD_TYPE ODK"
7673 else
7674     AC_MSG_RESULT([no])
7675     BUILD_UNOWINREG=
7677 AC_SUBST(BUILD_UNOWINREG)
7678 AC_SUBST(MINGWCXX)
7679 AC_SUBST(MINGWSTRIP)
7681 dnl ===================================================================
7682 dnl Check for system zlib
7683 dnl ===================================================================
7684 if test "$with_system_zlib" = "auto"; then
7685     case "$_os" in
7686     WINNT)
7687         with_system_zlib="$with_system_libs"
7688         ;;
7689     *)
7690         if test "$enable_fuzzers" != "yes"; then
7691             with_system_zlib=yes
7692         else
7693             with_system_zlib=no
7694         fi
7695         ;;
7696     esac
7699 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7700 dnl and has no pkg-config for it at least on some tinderboxes,
7701 dnl so leaving that out for now
7702 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7703 AC_MSG_CHECKING([which zlib to use])
7704 if test "$with_system_zlib" = "yes"; then
7705     AC_MSG_RESULT([external])
7706     SYSTEM_ZLIB=TRUE
7707     AC_CHECK_HEADER(zlib.h, [],
7708         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7709     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7710         [AC_MSG_ERROR(zlib not found or functional)], [])
7711 else
7712     AC_MSG_RESULT([internal])
7713     SYSTEM_ZLIB=
7714     BUILD_TYPE="$BUILD_TYPE ZLIB"
7715     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7716     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7718 AC_SUBST(ZLIB_CFLAGS)
7719 AC_SUBST(ZLIB_LIBS)
7720 AC_SUBST(SYSTEM_ZLIB)
7722 dnl ===================================================================
7723 dnl Check for system jpeg
7724 dnl ===================================================================
7725 AC_MSG_CHECKING([which libjpeg to use])
7726 if test "$with_system_jpeg" = "yes"; then
7727     AC_MSG_RESULT([external])
7728     SYSTEM_LIBJPEG=TRUE
7729     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7730         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7731     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7732         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7733 else
7734     SYSTEM_LIBJPEG=
7735     AC_MSG_RESULT([internal, libjpeg-turbo])
7736     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7737     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7738     if test "$COM" = "MSC"; then
7739         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7740     else
7741         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7742     fi
7744     case "$host_cpu" in
7745     x86_64 | amd64 | i*86 | x86 | ia32)
7746         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7747         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7748             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7749                 NASM="$LODE_HOME/opt/bin/nasm"
7750             elif test -x "/opt/lo/bin/nasm"; then
7751                 NASM="/opt/lo/bin/nasm"
7752             fi
7753         fi
7755         if test -n "$NASM"; then
7756             AC_MSG_CHECKING([for object file format of host system])
7757             case "$host_os" in
7758               cygwin* | mingw* | pw32* | interix*)
7759                 case "$host_cpu" in
7760                   x86_64)
7761                     objfmt='Win64-COFF'
7762                     ;;
7763                   *)
7764                     objfmt='Win32-COFF'
7765                     ;;
7766                 esac
7767               ;;
7768               msdosdjgpp* | go32*)
7769                 objfmt='COFF'
7770               ;;
7771               os2-emx*)                 # not tested
7772                 objfmt='MSOMF'          # obj
7773               ;;
7774               linux*coff* | linux*oldld*)
7775                 objfmt='COFF'           # ???
7776               ;;
7777               linux*aout*)
7778                 objfmt='a.out'
7779               ;;
7780               linux*)
7781                 case "$host_cpu" in
7782                   x86_64)
7783                     objfmt='ELF64'
7784                     ;;
7785                   *)
7786                     objfmt='ELF'
7787                     ;;
7788                 esac
7789               ;;
7790               kfreebsd* | freebsd* | netbsd* | openbsd*)
7791                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7792                   objfmt='BSD-a.out'
7793                 else
7794                   case "$host_cpu" in
7795                     x86_64 | amd64)
7796                       objfmt='ELF64'
7797                       ;;
7798                     *)
7799                       objfmt='ELF'
7800                       ;;
7801                   esac
7802                 fi
7803               ;;
7804               solaris* | sunos* | sysv* | sco*)
7805                 case "$host_cpu" in
7806                   x86_64)
7807                     objfmt='ELF64'
7808                     ;;
7809                   *)
7810                     objfmt='ELF'
7811                     ;;
7812                 esac
7813               ;;
7814               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7815                 case "$host_cpu" in
7816                   x86_64)
7817                     objfmt='Mach-O64'
7818                     ;;
7819                   *)
7820                     objfmt='Mach-O'
7821                     ;;
7822                 esac
7823               ;;
7824               *)
7825                 objfmt='ELF ?'
7826               ;;
7827             esac
7829             AC_MSG_RESULT([$objfmt])
7830             if test "$objfmt" = 'ELF ?'; then
7831               objfmt='ELF'
7832               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7833             fi
7835             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7836             case "$objfmt" in
7837               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7838               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7839               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7840               COFF)       NAFLAGS='-fcoff -DCOFF';;
7841               a.out)      NAFLAGS='-faout -DAOUT';;
7842               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7843               ELF)        NAFLAGS='-felf -DELF';;
7844               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7845               RDF)        NAFLAGS='-frdf -DRDF';;
7846               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7847               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7848             esac
7849             AC_MSG_RESULT([$NAFLAGS])
7851             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7852             cat > conftest.asm << EOF
7853             [%line __oline__ "configure"
7854                     section .text
7855                     global  _main,main
7856             _main:
7857             main:   xor     eax,eax
7858                     ret
7859             ]
7861             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7862             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7863               AC_MSG_RESULT(yes)
7864             else
7865               echo "configure: failed program was:" >&AC_FD_CC
7866               cat conftest.asm >&AC_FD_CC
7867               rm -rf conftest*
7868               AC_MSG_RESULT(no)
7869               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7870               NASM=""
7871             fi
7873         fi
7875         if test -z "$NASM"; then
7876 cat << _EOS
7877 ****************************************************************************
7878 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7879 To get one please:
7881 _EOS
7882             if test "$build_os" = "cygwin"; then
7883 cat << _EOS
7884 install a pre-compiled binary for Win32
7886 mkdir -p /opt/lo/bin
7887 cd /opt/lo/bin
7888 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7889 chmod +x nasm
7891 or get and install one from http://www.nasm.us/
7893 Then re-run autogen.sh
7895 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7896 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7898 _EOS
7899             else
7900 cat << _EOS
7901 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7903 _EOS
7904             fi
7905             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7906             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7907         fi
7908       ;;
7909     esac
7912 AC_SUBST(NASM)
7913 AC_SUBST(LIBJPEG_CFLAGS)
7914 AC_SUBST(LIBJPEG_LIBS)
7915 AC_SUBST(SYSTEM_LIBJPEG)
7917 dnl ===================================================================
7918 dnl Check for system clucene
7919 dnl ===================================================================
7920 dnl we should rather be using
7921 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7922 dnl but the contribs-lib check seems tricky
7923 AC_MSG_CHECKING([which clucene to use])
7924 if test "$with_system_clucene" = "yes"; then
7925     AC_MSG_RESULT([external])
7926     SYSTEM_CLUCENE=TRUE
7927     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7928     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7929     FilterLibs "${CLUCENE_LIBS}"
7930     CLUCENE_LIBS="${filteredlibs}"
7931     AC_LANG_PUSH([C++])
7932     save_CXXFLAGS=$CXXFLAGS
7933     save_CPPFLAGS=$CPPFLAGS
7934     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7935     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7936     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7937     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7938     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7939                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7940     CXXFLAGS=$save_CXXFLAGS
7941     CPPFLAGS=$save_CPPFLAGS
7942     AC_LANG_POP([C++])
7944     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7945 else
7946     AC_MSG_RESULT([internal])
7947     SYSTEM_CLUCENE=
7948     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7950 AC_SUBST(SYSTEM_CLUCENE)
7951 AC_SUBST(CLUCENE_CFLAGS)
7952 AC_SUBST(CLUCENE_LIBS)
7954 dnl ===================================================================
7955 dnl Check for system expat
7956 dnl ===================================================================
7957 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7959 dnl ===================================================================
7960 dnl Check for system xmlsec
7961 dnl ===================================================================
7962 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7964 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7965 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7966     ENABLE_EOT="TRUE"
7967     AC_DEFINE([ENABLE_EOT])
7968     AC_MSG_RESULT([yes])
7970     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7971 else
7972     ENABLE_EOT=
7973     AC_MSG_RESULT([no])
7975 AC_SUBST([ENABLE_EOT])
7977 dnl ===================================================================
7978 dnl Check for DLP libs
7979 dnl ===================================================================
7980 AS_IF([test "$COM" = "MSC"],
7981       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7982       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7984 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7986 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7988 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7990 AS_IF([test "$COM" = "MSC"],
7991       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7992       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7994 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7996 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7998 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7999 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8001 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8003 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8005 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8007 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8008 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8010 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8011 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8013 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8015 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8016 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8018 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8020 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8022 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8024 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8026 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8027 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8029 dnl ===================================================================
8030 dnl Check for system lcms2
8031 dnl ===================================================================
8032 if test "$with_system_lcms2" != "yes"; then
8033     SYSTEM_LCMS2=
8035 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8036 if test "$GCC" = "yes"; then
8037     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8039 if test "$COM" = "MSC"; then # override the above
8040     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8043 dnl ===================================================================
8044 dnl Check for system cppunit
8045 dnl ===================================================================
8046 if test "$_os" != "Android" ; then
8047     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8050 dnl ===================================================================
8051 dnl Check whether freetype is available
8052 dnl ===================================================================
8053 if test  "$test_freetype" = "yes"; then
8054     AC_MSG_CHECKING([whether freetype is available])
8055     # FreeType has 3 different kinds of versions
8056     # * release, like 2.4.10
8057     # * libtool, like 13.0.7 (this what pkg-config returns)
8058     # * soname
8059     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8060     #
8061     # 9.9.3 is 2.2.0
8062     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8063     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8064     FilterLibs "${FREETYPE_LIBS}"
8065     FREETYPE_LIBS="${filteredlibs}"
8066     SYSTEM_FREETYPE=TRUE
8067 else
8068     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8069     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8071 AC_SUBST(FREETYPE_CFLAGS)
8072 AC_SUBST(FREETYPE_LIBS)
8073 AC_SUBST([SYSTEM_FREETYPE])
8075 # ===================================================================
8076 # Check for system libxslt
8077 # to prevent incompatibilities between internal libxml2 and external libxslt,
8078 # or vice versa, use with_system_libxml here
8079 # ===================================================================
8080 if test "$with_system_libxml" = "auto"; then
8081     case "$_os" in
8082     WINNT|iOS|Android)
8083         with_system_libxml="$with_system_libs"
8084         ;;
8085     *)
8086         if test "$enable_fuzzers" != "yes"; then
8087             with_system_libxml=yes
8088         else
8089             with_system_libxml=no
8090         fi
8091         ;;
8092     esac
8095 AC_MSG_CHECKING([which libxslt to use])
8096 if test "$with_system_libxml" = "yes"; then
8097     AC_MSG_RESULT([external])
8098     SYSTEM_LIBXSLT=TRUE
8099     if test "$_os" = "Darwin"; then
8100         dnl make sure to use SDK path
8101         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8102         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8103         dnl omit -L/usr/lib
8104         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8105         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8106     else
8107         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8108         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8109         FilterLibs "${LIBXSLT_LIBS}"
8110         LIBXSLT_LIBS="${filteredlibs}"
8111         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8112         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8113         FilterLibs "${LIBEXSLT_LIBS}"
8114         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8115     fi
8117     dnl Check for xsltproc
8118     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8119     if test "$XSLTPROC" = "no"; then
8120         AC_MSG_ERROR([xsltproc is required])
8121     fi
8122 else
8123     AC_MSG_RESULT([internal])
8124     SYSTEM_LIBXSLT=
8125     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8127     if test "$cross_compiling" = "yes"; then
8128         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8129         if test "$XSLTPROC" = "no"; then
8130             AC_MSG_ERROR([xsltproc is required])
8131         fi
8132     fi
8134 AC_SUBST(SYSTEM_LIBXSLT)
8135 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8136     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8138 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8140 AC_SUBST(LIBEXSLT_CFLAGS)
8141 AC_SUBST(LIBEXSLT_LIBS)
8142 AC_SUBST(LIBXSLT_CFLAGS)
8143 AC_SUBST(LIBXSLT_LIBS)
8144 AC_SUBST(XSLTPROC)
8146 # ===================================================================
8147 # Check for system libxml
8148 # ===================================================================
8149 AC_MSG_CHECKING([which libxml to use])
8150 if test "$with_system_libxml" = "yes"; then
8151     AC_MSG_RESULT([external])
8152     SYSTEM_LIBXML=TRUE
8153     if test "$_os" = "Darwin"; then
8154         dnl make sure to use SDK path
8155         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8156         dnl omit -L/usr/lib
8157         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8158     elif test $_os = iOS; then
8159         dnl make sure to use SDK path
8160         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8161         LIBXML_CFLAGS="-I$usr/include/libxml2"
8162         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8163     else
8164         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8165         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8166         FilterLibs "${LIBXML_LIBS}"
8167         LIBXML_LIBS="${filteredlibs}"
8168     fi
8170     dnl Check for xmllint
8171     AC_PATH_PROG(XMLLINT, xmllint, no)
8172     if test "$XMLLINT" = "no"; then
8173         AC_MSG_ERROR([xmllint is required])
8174     fi
8175 else
8176     AC_MSG_RESULT([internal])
8177     SYSTEM_LIBXML=
8178     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8179     if test "$COM" = "MSC"; then
8180         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8181     fi
8182     if test "$COM" = "MSC"; then
8183         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8184     else
8185         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8186     fi
8187     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8189 AC_SUBST(SYSTEM_LIBXML)
8190 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8191     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8193 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8194 AC_SUBST(LIBXML_CFLAGS)
8195 AC_SUBST(LIBXML_LIBS)
8196 AC_SUBST(XMLLINT)
8198 # =====================================================================
8199 # Checking for a Python interpreter with version >= 2.7.
8200 # Build and runtime requires Python 3 compatible version (>= 2.7).
8201 # Optionally user can pass an option to configure, i. e.
8202 # ./configure PYTHON=/usr/bin/python
8203 # =====================================================================
8204 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8205     # This allows a lack of system python with no error, we use internal one in that case.
8206     AM_PATH_PYTHON([2.7],, [:])
8207     # Clean PYTHON_VERSION checked below if cross-compiling
8208     PYTHON_VERSION=""
8209     if test "$PYTHON" != ":"; then
8210         PYTHON_FOR_BUILD=$PYTHON
8211     fi
8213 AC_SUBST(PYTHON_FOR_BUILD)
8215 # Checks for Python to use for Pyuno
8216 AC_MSG_CHECKING([which Python to use for Pyuno])
8217 case "$enable_python" in
8218 no|disable)
8219     if test -z $PYTHON_FOR_BUILD; then
8220         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8221         # requirement from the choice whether to include Python stuff in the installer, but why
8222         # bother?
8223         AC_MSG_ERROR([Python is required at build time.])
8224     fi
8225     enable_python=no
8226     AC_MSG_RESULT([none])
8227     ;;
8228 ""|yes|auto)
8229     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8230         AC_MSG_RESULT([no, overridden by --disable-scripting])
8231         enable_python=no
8232     elif test $build_os = cygwin; then
8233         dnl When building on Windows we don't attempt to use any installed
8234         dnl "system"  Python.
8235         AC_MSG_RESULT([fully internal])
8236         enable_python=internal
8237     elif test "$cross_compiling" = yes; then
8238         AC_MSG_RESULT([system])
8239         enable_python=system
8240     else
8241         # Unset variables set by the above AM_PATH_PYTHON so that
8242         # we actually do check anew.
8243         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
8244         AM_PATH_PYTHON([3.3],, [:])
8245         if test "$PYTHON" = ":"; then
8246             if test -z "$PYTHON_FOR_BUILD"; then
8247                 AC_MSG_RESULT([fully internal])
8248             else
8249                 AC_MSG_RESULT([internal])
8250             fi
8251             enable_python=internal
8252         else
8253             AC_MSG_RESULT([system])
8254             enable_python=system
8255         fi
8256     fi
8257     ;;
8258 internal)
8259     AC_MSG_RESULT([internal])
8260     ;;
8261 fully-internal)
8262     AC_MSG_RESULT([fully internal])
8263     enable_python=internal
8264     ;;
8265 system)
8266     AC_MSG_RESULT([system])
8267     ;;
8269     AC_MSG_ERROR([Incorrect --enable-python option])
8270     ;;
8271 esac
8273 if test $enable_python != no; then
8274     BUILD_TYPE="$BUILD_TYPE PYUNO"
8277 if test $enable_python = system; then
8278     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8279         python_version=2.7
8280         PYTHON=python$python_version
8281         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8282             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8283             PYTHON_LIBS="-framework Python"
8284         else
8285             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8286             PYTHON_LIBS="`$PYTHON-config --libs`"
8287         fi
8288     fi
8289     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8290         # Fallback: Accept these in the environment, or as set above
8291         # for MacOSX.
8292         :
8293     elif test "$cross_compiling" != yes; then
8294         # Unset variables set by the above AM_PATH_PYTHON so that
8295         # we actually do check anew.
8296         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
8297         # This causes an error if no python command is found
8298         AM_PATH_PYTHON([3.3])
8299         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8300         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8301         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8302         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8303         if test -z "$PKG_CONFIG"; then
8304             PYTHON_CFLAGS="-I$python_include"
8305             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8306         elif $PKG_CONFIG --exists python-$python_version; then
8307             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8308             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8309         else
8310             PYTHON_CFLAGS="-I$python_include"
8311             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8312         fi
8313         FilterLibs "${PYTHON_LIBS}"
8314         PYTHON_LIBS="${filteredlibs}"
8315     else
8316         dnl How to find out the cross-compilation Python installation path?
8317         AC_MSG_CHECKING([for python version])
8318         AS_IF([test -n "$PYTHON_VERSION"],
8319               [AC_MSG_RESULT([$PYTHON_VERSION])],
8320               [AC_MSG_RESULT([not found])
8321                AC_MSG_ERROR([no usable python found])])
8322         test -n "$PYTHON_CFLAGS" && break
8323     fi
8325     dnl Check if the headers really work
8326     save_CPPFLAGS="$CPPFLAGS"
8327     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8328     AC_CHECK_HEADER(Python.h)
8329     CPPFLAGS="$save_CPPFLAGS"
8331     # let the PYTHON_FOR_BUILD match the same python installation that
8332     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8333     # better for PythonTests.
8334     PYTHON_FOR_BUILD=$PYTHON
8337 if test "$with_lxml" != no; then
8338     if test -z "$PYTHON_FOR_BUILD"; then
8339         case $build_os in
8340             cygwin)
8341                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8342                 ;;
8343             *)
8344                 if test "$cross_compiling" != yes ; then
8345                     BUILD_TYPE="$BUILD_TYPE LXML"
8346                 fi
8347                 ;;
8348         esac
8349     else
8350         AC_MSG_CHECKING([for python lxml])
8351         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8352             AC_MSG_RESULT([yes])
8353         else
8354             case $build_os in
8355                 cygwin)
8356                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8357                     ;;
8358                 *)
8359                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8360                         BUILD_TYPE="$BUILD_TYPE LXML"
8361                         AC_MSG_RESULT([no, using internal lxml])
8362                     else
8363                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8364                     fi
8365                     ;;
8366             esac
8367         fi
8368     fi
8371 dnl By now enable_python should be "system", "internal" or "no"
8372 case $enable_python in
8373 system)
8374     SYSTEM_PYTHON=TRUE
8376     if test "x$ac_cv_header_Python_h" != "xyes"; then
8377        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8378     fi
8380     AC_LANG_PUSH(C)
8381     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8382     AC_MSG_CHECKING([for correct python library version])
8383        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8384 #include <Python.h>
8386 int main(int argc, char **argv) {
8387    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8388        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8389    else return 1;
8391        ]])],[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])])
8392     CFLAGS=$save_CFLAGS
8393     AC_LANG_POP(C)
8395     dnl FIXME Check if the Python library can be linked with, too?
8396     ;;
8398 internal)
8399     SYSTEM_PYTHON=
8400     PYTHON_VERSION_MAJOR=3
8401     PYTHON_VERSION_MINOR=5
8402     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8403     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8404         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8405     fi
8406     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8407     BUILD_TYPE="$BUILD_TYPE PYTHON"
8408     # Embedded Python dies without Home set
8409     if test "$HOME" = ""; then
8410         export HOME=""
8411     fi
8412     ;;
8414     DISABLE_PYTHON=TRUE
8415     SYSTEM_PYTHON=
8416     ;;
8418     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8419     ;;
8420 esac
8422 AC_SUBST(DISABLE_PYTHON)
8423 AC_SUBST(SYSTEM_PYTHON)
8424 AC_SUBST(PYTHON_CFLAGS)
8425 AC_SUBST(PYTHON_LIBS)
8426 AC_SUBST(PYTHON_VERSION)
8427 AC_SUBST(PYTHON_VERSION_MAJOR)
8428 AC_SUBST(PYTHON_VERSION_MINOR)
8430 ENABLE_MARIADBC=TRUE
8431 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8432     ENABLE_MARIADBC=
8434 MARIADBC_MAJOR=1
8435 MARIADBC_MINOR=0
8436 MARIADBC_MICRO=2
8437 if test "$ENABLE_MARIADBC" = "TRUE"; then
8438     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8441 AC_SUBST(ENABLE_MARIADBC)
8442 AC_SUBST(MARIADBC_MAJOR)
8443 AC_SUBST(MARIADBC_MINOR)
8444 AC_SUBST(MARIADBC_MICRO)
8446 if test "$ENABLE_MARIADBC" = "TRUE"; then
8447     dnl ===================================================================
8448     dnl Check for system MariaDB
8449     dnl ===================================================================
8450     AC_MSG_CHECKING([which MariaDB to use])
8451     if test "$with_system_mariadb" = "yes"; then
8452         AC_MSG_RESULT([external])
8453         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8454         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8455         if test -z "$MARIADBCONFIG"; then
8456             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8457             if test -z "$MARIADBCONFIG"; then
8458                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8459                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8460             fi
8461         fi
8462         AC_MSG_CHECKING([MariaDB version])
8463         MARIADB_VERSION=`$MARIADBCONFIG --version`
8464         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8465         if test "$MARIADB_MAJOR" -ge "5"; then
8466             AC_MSG_RESULT([OK])
8467         else
8468             AC_MSG_ERROR([too old, use 5.0.x or later])
8469         fi
8470         AC_MSG_CHECKING([for MariaDB Client library])
8471         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8472         if test "$COM_IS_CLANG" = TRUE; then
8473             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8474         fi
8475         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8476         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8477         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8478         dnl linux32:
8479         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8480             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8481             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8482                 | sed -e 's|/lib64/|/lib/|')
8483         fi
8484         FilterLibs "${MARIADB_LIBS}"
8485         MARIADB_LIBS="${filteredlibs}"
8486         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8487         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8488         if test "$enable_bundle_mariadb" = "yes"; then
8489             AC_MSG_RESULT([yes])
8490             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8491             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8493 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8495 /g' | grep -E '(mysqlclient|mariadb)')
8496             if test "$_os" = "Darwin"; then
8497                 LIBMARIADB=${LIBMARIADB}.dylib
8498             elif test "$_os" = "WINNT"; then
8499                 LIBMARIADB=${LIBMARIADB}.dll
8500             else
8501                 LIBMARIADB=${LIBMARIADB}.so
8502             fi
8503             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8504             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8505             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8506                 AC_MSG_RESULT([found.])
8507                 PathFormat "$LIBMARIADB_PATH"
8508                 LIBMARIADB_PATH="$formatted_path"
8509             else
8510                 AC_MSG_ERROR([not found.])
8511             fi
8512         else
8513             AC_MSG_RESULT([no])
8514             BUNDLE_MARIADB_CONNECTOR_C=
8515         fi
8516     else
8517         AC_MSG_RESULT([internal])
8518         SYSTEM_MARIADB_CONNECTOR_C=
8519         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8520         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8521         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8522     fi
8524     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8525     AC_SUBST(MARIADB_CFLAGS)
8526     AC_SUBST(MARIADB_LIBS)
8527     AC_SUBST(LIBMARIADB)
8528     AC_SUBST(LIBMARIADB_PATH)
8529     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8532 dnl ===================================================================
8533 dnl Check for system hsqldb
8534 dnl ===================================================================
8535 if test "$with_java" != "no"; then
8536     HSQLDB_USE_JDBC_4_1=
8537     AC_MSG_CHECKING([which hsqldb to use])
8538     if test "$with_system_hsqldb" = "yes"; then
8539         AC_MSG_RESULT([external])
8540         SYSTEM_HSQLDB=TRUE
8541         if test -z $HSQLDB_JAR; then
8542             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8543         fi
8544         if ! test -f $HSQLDB_JAR; then
8545                AC_MSG_ERROR(hsqldb.jar not found.)
8546         fi
8547         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8548         export HSQLDB_JAR
8549         if $PERL -e \
8550            'use Archive::Zip;
8551             my $file = "$ENV{'HSQLDB_JAR'}";
8552             my $zip = Archive::Zip->new( $file );
8553             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8554             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8555             {
8556                 push @l, split(/\n/, $mf);
8557                 foreach my $line (@l)
8558                 {
8559                     if ($line =~ m/Specification-Version:/)
8560                     {
8561                         ($t, $version) = split (/:/,$line);
8562                         $version =~ s/^\s//;
8563                         ($a, $b, $c, $d) = split (/\./,$version);
8564                         if ($c == "0" && $d > "8")
8565                         {
8566                             exit 0;
8567                         }
8568                         else
8569                         {
8570                             exit 1;
8571                         }
8572                     }
8573                 }
8574             }
8575             else
8576             {
8577                 exit 1;
8578             }'; then
8579             AC_MSG_RESULT([yes])
8580         else
8581             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8582         fi
8583     else
8584         AC_MSG_RESULT([internal])
8585         SYSTEM_HSQLDB=
8586         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8587         NEED_ANT=TRUE
8588         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8589         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8590         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8591             AC_MSG_RESULT([yes])
8592             HSQLDB_USE_JDBC_4_1=TRUE
8593         else
8594             AC_MSG_RESULT([no])
8595         fi
8596     fi
8597     AC_SUBST(SYSTEM_HSQLDB)
8598     AC_SUBST(HSQLDB_JAR)
8599     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8602 dnl ===================================================================
8603 dnl Check for PostgreSQL stuff
8604 dnl ===================================================================
8605 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8606 if test "x$enable_postgresql_sdbc" != "xno"; then
8607     AC_MSG_RESULT([yes])
8608     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8610     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8611         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8612     fi
8613     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8614         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8615     fi
8617     postgres_interface=""
8618     if test "$with_system_postgresql" = "yes"; then
8619         postgres_interface="external PostgreSQL"
8620         SYSTEM_POSTGRESQL=TRUE
8621         if test "$_os" = Darwin; then
8622             supp_path=''
8623             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8624                 pg_supp_path="$P_SEP$d$pg_supp_path"
8625             done
8626         fi
8627         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8628         if test -z "$PGCONFIG"; then
8629             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8630         fi
8631         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8632         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8633         FilterLibs "${POSTGRESQL_LIB}"
8634         POSTGRESQL_LIB="${filteredlibs}"
8635     else
8636         # if/when anything else than PostgreSQL uses Kerberos,
8637         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8638         WITH_KRB5=
8639         WITH_GSSAPI=
8640         case "$_os" in
8641         Darwin)
8642             # MacOS X has system MIT Kerberos 5 since 10.4
8643             if test "$with_krb5" != "no"; then
8644                 WITH_KRB5=TRUE
8645                 save_LIBS=$LIBS
8646                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8647                 # that the libraries where these functions are located on macOS will change, is it?
8648                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8649                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8650                 KRB5_LIBS=$LIBS
8651                 LIBS=$save_LIBS
8652                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8653                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8654                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8655                 LIBS=$save_LIBS
8656             fi
8657             if test "$with_gssapi" != "no"; then
8658                 WITH_GSSAPI=TRUE
8659                 save_LIBS=$LIBS
8660                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8661                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8662                 GSSAPI_LIBS=$LIBS
8663                 LIBS=$save_LIBS
8664             fi
8665             ;;
8666         WINNT)
8667             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8668                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8669             fi
8670             ;;
8671         Linux|GNU|*BSD|DragonFly)
8672             if test "$with_krb5" != "no"; then
8673                 WITH_KRB5=TRUE
8674                 save_LIBS=$LIBS
8675                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8676                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8677                 KRB5_LIBS=$LIBS
8678                 LIBS=$save_LIBS
8679                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8680                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8681                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8682                 LIBS=$save_LIBS
8683             fi
8684             if test "$with_gssapi" != "no"; then
8685                 WITH_GSSAPI=TRUE
8686                 save_LIBS=$LIBS
8687                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8688                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8689                 GSSAPI_LIBS=$LIBS
8690                 LIBS=$save_LIBS
8691             fi
8692             ;;
8693         *)
8694             if test "$with_krb5" = "yes"; then
8695                 WITH_KRB5=TRUE
8696                 save_LIBS=$LIBS
8697                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8698                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8699                 KRB5_LIBS=$LIBS
8700                 LIBS=$save_LIBS
8701                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8702                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8703                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8704                 LIBS=$save_LIBS
8705             fi
8706             if test "$with_gssapi" = "yes"; then
8707                 WITH_GSSAPI=TRUE
8708                 save_LIBS=$LIBS
8709                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8710                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8711                 LIBS=$save_LIBS
8712                 GSSAPI_LIBS=$LIBS
8713             fi
8714         esac
8716         if test -n "$with_libpq_path"; then
8717             SYSTEM_POSTGRESQL=TRUE
8718             postgres_interface="external libpq"
8719             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8720             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8721         else
8722             SYSTEM_POSTGRESQL=
8723             postgres_interface="internal"
8724             POSTGRESQL_LIB=""
8725             POSTGRESQL_INC="%OVERRIDE_ME%"
8726             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8727         fi
8728     fi
8730     AC_MSG_CHECKING([PostgreSQL C interface])
8731     AC_MSG_RESULT([$postgres_interface])
8733     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8734         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8735         save_CFLAGS=$CFLAGS
8736         save_CPPFLAGS=$CPPFLAGS
8737         save_LIBS=$LIBS
8738         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8739         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8740         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8741         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8742             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8743         CFLAGS=$save_CFLAGS
8744         CPPFLAGS=$save_CPPFLAGS
8745         LIBS=$save_LIBS
8746     fi
8747     BUILD_POSTGRESQL_SDBC=TRUE
8748 else
8749     AC_MSG_RESULT([no])
8751 AC_SUBST(WITH_KRB5)
8752 AC_SUBST(WITH_GSSAPI)
8753 AC_SUBST(GSSAPI_LIBS)
8754 AC_SUBST(KRB5_LIBS)
8755 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8756 AC_SUBST(SYSTEM_POSTGRESQL)
8757 AC_SUBST(POSTGRESQL_INC)
8758 AC_SUBST(POSTGRESQL_LIB)
8760 dnl ===================================================================
8761 dnl Check for Firebird stuff
8762 dnl ===================================================================
8763 ENABLE_FIREBIRD_SDBC=
8764 if test "$enable_firebird_sdbc" = "yes" ; then
8765     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8767     dnl ===================================================================
8768     dnl Check for system Firebird
8769     dnl ===================================================================
8770     AC_MSG_CHECKING([which Firebird to use])
8771     if test "$with_system_firebird" = "yes"; then
8772         AC_MSG_RESULT([external])
8773         SYSTEM_FIREBIRD=TRUE
8774         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8775         if test -z "$FIREBIRDCONFIG"; then
8776             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8777             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8778                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8779             ])
8780             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8781         else
8782             AC_MSG_NOTICE([fb_config found])
8783             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8784             AC_MSG_CHECKING([for Firebird Client library])
8785             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8786             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8787             FilterLibs "${FIREBIRD_LIBS}"
8788             FIREBIRD_LIBS="${filteredlibs}"
8789         fi
8790         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8791         AC_MSG_CHECKING([Firebird version])
8792         if test -n "${FIREBIRD_VERSION}"; then
8793             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8794             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8795             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8796                 AC_MSG_RESULT([OK])
8797             else
8798                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8799             fi
8800         else
8801             __save_CFLAGS="${CFLAGS}"
8802             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8803             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8804 #if defined(FB_API_VER) && FB_API_VER == 30
8805 int fb_api_is_30(void) { return 0; }
8806 #else
8807 #error "Wrong Firebird API version"
8808 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8809             CFLAGS="${__save_CFLAGS}"
8810         fi
8811         ENABLE_FIREBIRD_SDBC=TRUE
8812         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8813     elif test "$enable_database_connectivity" != yes; then
8814         AC_MSG_RESULT([none])
8815     elif test "$cross_compiling" = "yes"; then
8816         AC_MSG_RESULT([none])
8817     else
8818         dnl Embedded Firebird has version 3.0
8819         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8820         dnl We need libatomic-ops for any non X86/X64 system
8821         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8822             dnl ===================================================================
8823             dnl Check for system libatomic-ops
8824             dnl ===================================================================
8825             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8826             if test "$with_system_libatomic_ops" = "yes"; then
8827                 SYSTEM_LIBATOMIC_OPS=TRUE
8828                 AC_CHECK_HEADERS(atomic_ops.h, [],
8829                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8830             else
8831                 SYSTEM_LIBATOMIC_OPS=
8832                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8833                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8834                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8835             fi
8836         fi
8838         AC_MSG_RESULT([internal])
8839         SYSTEM_FIREBIRD=
8840         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8841         FIREBIRD_LIBS="-lfbclient"
8843         if test "$with_system_libtommath" = "yes"; then
8844             SYSTEM_LIBTOMMATH=TRUE
8845             dnl check for tommath presence
8846             save_LIBS=$LIBS
8847             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8848             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8849             LIBS=$save_LIBS
8850         else
8851             SYSTEM_LIBTOMMATH=
8852             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8853             LIBTOMMATH_LIBS="-ltommath"
8854             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8855         fi
8857         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8858         ENABLE_FIREBIRD_SDBC=TRUE
8859         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8860     fi
8862 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8863 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8864 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8865 AC_SUBST(LIBATOMIC_OPS_LIBS)
8866 AC_SUBST(SYSTEM_FIREBIRD)
8867 AC_SUBST(FIREBIRD_CFLAGS)
8868 AC_SUBST(FIREBIRD_LIBS)
8869 AC_SUBST([TOMMATH_CFLAGS])
8870 AC_SUBST([TOMMATH_LIBS])
8872 dnl ===================================================================
8873 dnl Check for system curl
8874 dnl ===================================================================
8875 AC_MSG_CHECKING([which libcurl to use])
8876 if test "$with_system_curl" = "auto"; then
8877     with_system_curl="$with_system_libs"
8880 if test "$with_system_curl" = "yes"; then
8881     AC_MSG_RESULT([external])
8882     SYSTEM_CURL=TRUE
8884     # First try PKGCONFIG and then fall back
8885     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8887     if test -n "$CURL_PKG_ERRORS"; then
8888         AC_PATH_PROG(CURLCONFIG, curl-config)
8889         if test -z "$CURLCONFIG"; then
8890             AC_MSG_ERROR([curl development files not found])
8891         fi
8892         CURL_LIBS=`$CURLCONFIG --libs`
8893         FilterLibs "${CURL_LIBS}"
8894         CURL_LIBS="${filteredlibs}"
8895         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8896         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8898         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8899         case $curl_version in
8900         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8901         dnl so they need to be doubled to end up in the configure script
8902         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8903             AC_MSG_RESULT([yes])
8904             ;;
8905         *)
8906             AC_MSG_ERROR([no, you have $curl_version])
8907             ;;
8908         esac
8909     fi
8911     ENABLE_CURL=TRUE
8912 elif test $_os = iOS; then
8913     # Let's see if we need curl, I think not?
8914     AC_MSG_RESULT([none])
8915     ENABLE_CURL=
8916 else
8917     AC_MSG_RESULT([internal])
8918     SYSTEM_CURL=
8919     BUILD_TYPE="$BUILD_TYPE CURL"
8920     ENABLE_CURL=TRUE
8922 AC_SUBST(SYSTEM_CURL)
8923 AC_SUBST(CURL_CFLAGS)
8924 AC_SUBST(CURL_LIBS)
8925 AC_SUBST(ENABLE_CURL)
8927 dnl ===================================================================
8928 dnl Check for system boost
8929 dnl ===================================================================
8930 AC_MSG_CHECKING([which boost to use])
8931 if test "$with_system_boost" = "yes"; then
8932     AC_MSG_RESULT([external])
8933     SYSTEM_BOOST=TRUE
8934     AX_BOOST_BASE(1.47)
8935     AX_BOOST_DATE_TIME
8936     AX_BOOST_FILESYSTEM
8937     AX_BOOST_IOSTREAMS
8938     AX_BOOST_LOCALE
8939     AC_LANG_PUSH([C++])
8940     save_CXXFLAGS=$CXXFLAGS
8941     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8942     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8943        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8944     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8945        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8946     CXXFLAGS=$save_CXXFLAGS
8947     AC_LANG_POP([C++])
8948     # this is in m4/ax_boost_base.m4
8949     FilterLibs "${BOOST_LDFLAGS}"
8950     BOOST_LDFLAGS="${filteredlibs}"
8951 else
8952     AC_MSG_RESULT([internal])
8953     BUILD_TYPE="$BUILD_TYPE BOOST"
8954     SYSTEM_BOOST=
8955     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8956         # use warning-suppressing wrapper headers
8957         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8958     else
8959         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8960     fi
8962 AC_SUBST(SYSTEM_BOOST)
8964 dnl ===================================================================
8965 dnl Check for system mdds
8966 dnl ===================================================================
8967 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8969 dnl ===================================================================
8970 dnl Check for system glm
8971 dnl ===================================================================
8972 AC_MSG_CHECKING([which glm to use])
8973 if test "$with_system_glm" = "yes"; then
8974     AC_MSG_RESULT([external])
8975     SYSTEM_GLM=TRUE
8976     AC_LANG_PUSH([C++])
8977     AC_CHECK_HEADER([glm/glm.hpp], [],
8978        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8979     AC_LANG_POP([C++])
8980 else
8981     AC_MSG_RESULT([internal])
8982     BUILD_TYPE="$BUILD_TYPE GLM"
8983     SYSTEM_GLM=
8984     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8986 AC_SUBST([GLM_CFLAGS])
8987 AC_SUBST([SYSTEM_GLM])
8989 dnl ===================================================================
8990 dnl Check for system odbc
8991 dnl ===================================================================
8992 AC_MSG_CHECKING([which odbc headers to use])
8993 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
8994     AC_MSG_RESULT([external])
8995     SYSTEM_ODBC_HEADERS=TRUE
8997     if test "$build_os" = "cygwin"; then
8998         save_CPPFLAGS=$CPPFLAGS
8999         find_winsdk
9000         PathFormat "$winsdktest"
9001         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"
9002         AC_CHECK_HEADER(sqlext.h, [],
9003             [AC_MSG_ERROR(odbc not found. install odbc)],
9004             [#include <windows.h>])
9005         CPPFLAGS=$save_CPPFLAGS
9006     else
9007         AC_CHECK_HEADER(sqlext.h, [],
9008             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9009     fi
9010 elif test "$enable_database_connectivity" != yes; then
9011     AC_MSG_RESULT([none])
9012 else
9013     AC_MSG_RESULT([internal])
9014     SYSTEM_ODBC_HEADERS=
9016 AC_SUBST(SYSTEM_ODBC_HEADERS)
9019 dnl ===================================================================
9020 dnl Check for system openldap
9021 dnl ===================================================================
9023 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9024 AC_MSG_CHECKING([which openldap library to use])
9025 if test "$with_system_openldap" = "yes"; then
9026     AC_MSG_RESULT([external])
9027     SYSTEM_OPENLDAP=TRUE
9028     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9029     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9030     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9031 else
9032     AC_MSG_RESULT([internal])
9033     SYSTEM_OPENLDAP=
9034     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9037 AC_SUBST(SYSTEM_OPENLDAP)
9039 dnl ===================================================================
9040 dnl Check for system NSS
9041 dnl ===================================================================
9042 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9043     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9044     AC_DEFINE(HAVE_FEATURE_NSS)
9045     ENABLE_NSS="TRUE"
9046     AC_DEFINE(ENABLE_NSS)
9047 elif test $_os != iOS ; then
9048     with_tls=openssl
9050 AC_SUBST(ENABLE_NSS)
9052 dnl ===================================================================
9053 dnl Check for TLS/SSL and cryptographic implementation to use
9054 dnl ===================================================================
9055 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9056 if test -n "$with_tls"; then
9057     case $with_tls in
9058     openssl)
9059         AC_DEFINE(USE_TLS_OPENSSL)
9060         TLS=OPENSSL
9062         if test "$enable_openssl" != "yes"; then
9063             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9064         fi
9066         # warn that OpenSSL has been selected but not all TLS code has this option
9067         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9068         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9069         ;;
9070     nss)
9071         AC_DEFINE(USE_TLS_NSS)
9072         TLS=NSS
9073         ;;
9074     no)
9075         AC_MSG_WARN([Skipping TLS/SSL])
9076         ;;
9077     *)
9078         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9079 openssl - OpenSSL
9080 nss - Mozilla's Network Security Services (NSS)
9081     ])
9082         ;;
9083     esac
9084 else
9085     # default to using NSS, it results in smaller oox lib
9086     AC_DEFINE(USE_TLS_NSS)
9087     TLS=NSS
9089 AC_MSG_RESULT([$TLS])
9090 AC_SUBST(TLS)
9092 dnl ===================================================================
9093 dnl Check for system sane
9094 dnl ===================================================================
9095 AC_MSG_CHECKING([which sane header to use])
9096 if test "$with_system_sane" = "yes"; then
9097     AC_MSG_RESULT([external])
9098     AC_CHECK_HEADER(sane/sane.h, [],
9099       [AC_MSG_ERROR(sane not found. install sane)], [])
9100 else
9101     AC_MSG_RESULT([internal])
9102     BUILD_TYPE="$BUILD_TYPE SANE"
9105 dnl ===================================================================
9106 dnl Check for system icu
9107 dnl ===================================================================
9108 SYSTEM_GENBRK=
9109 SYSTEM_GENCCODE=
9110 SYSTEM_GENCMN=
9112 ICU_MAJOR=63
9113 ICU_MINOR=1
9114 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9115 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9116 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9117 AC_MSG_CHECKING([which icu to use])
9118 if test "$with_system_icu" = "yes"; then
9119     AC_MSG_RESULT([external])
9120     SYSTEM_ICU=TRUE
9121     AC_LANG_PUSH([C++])
9122     AC_MSG_CHECKING([for unicode/rbbi.h])
9123     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9124     AC_LANG_POP([C++])
9126     if test "$cross_compiling" != "yes"; then
9127         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9128         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9129         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9130         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9131     fi
9133     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9134         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9135         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9136         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9137         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9138         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9139             AC_MSG_RESULT([yes])
9140         else
9141             AC_MSG_RESULT([no])
9142             if test "$with_system_icu_for_build" != "force"; then
9143                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9144 You can use --with-system-icu-for-build=force to use it anyway.])
9145             fi
9146         fi
9147     fi
9149     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9150         # using the system icu tools can lead to version confusion, use the
9151         # ones from the build environment when cross-compiling
9152         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9153         if test -z "$SYSTEM_GENBRK"; then
9154             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9155         fi
9156         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9157         if test -z "$SYSTEM_GENCCODE"; then
9158             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9159         fi
9160         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9161         if test -z "$SYSTEM_GENCMN"; then
9162             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9163         fi
9164         if test "$ICU_MAJOR" -ge "49"; then
9165             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9166             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9167             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9168         else
9169             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9170             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9171             ICU_RECLASSIFIED_HEBREW_LETTER=
9172         fi
9173     fi
9175     if test "$cross_compiling" = "yes"; then
9176         if test "$ICU_MAJOR" -ge "50"; then
9177             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9178             ICU_MINOR=""
9179         fi
9180     fi
9181 else
9182     AC_MSG_RESULT([internal])
9183     SYSTEM_ICU=
9184     BUILD_TYPE="$BUILD_TYPE ICU"
9185     # surprisingly set these only for "internal" (to be used by various other
9186     # external libs): the system icu-config is quite unhelpful and spits out
9187     # dozens of weird flags and also default path -I/usr/include
9188     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9189     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9191 if test "$ICU_MAJOR" -ge "59"; then
9192     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9193     # with -std=c++11 but not all external libraries can be built with that,
9194     # for those use a bit-compatible typedef uint16_t UChar; see
9195     # icu/source/common/unicode/umachine.h
9196     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9197 else
9198     ICU_UCHAR_TYPE=""
9200 AC_SUBST(SYSTEM_ICU)
9201 AC_SUBST(SYSTEM_GENBRK)
9202 AC_SUBST(SYSTEM_GENCCODE)
9203 AC_SUBST(SYSTEM_GENCMN)
9204 AC_SUBST(ICU_MAJOR)
9205 AC_SUBST(ICU_MINOR)
9206 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9207 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9208 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9209 AC_SUBST(ICU_CFLAGS)
9210 AC_SUBST(ICU_LIBS)
9211 AC_SUBST(ICU_UCHAR_TYPE)
9213 dnl ==================================================================
9214 dnl Breakpad
9215 dnl ==================================================================
9216 AC_MSG_CHECKING([whether to enable breakpad])
9217 if test "$enable_breakpad" != yes; then
9218     AC_MSG_RESULT([no])
9219 else
9220     AC_MSG_RESULT([yes])
9221     ENABLE_BREAKPAD="TRUE"
9222     AC_DEFINE(ENABLE_BREAKPAD)
9223     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9224     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9226     AC_MSG_CHECKING([for crashreport config])
9227     if test "$with_symbol_config" = "no"; then
9228         BREAKPAD_SYMBOL_CONFIG="invalid"
9229         AC_MSG_RESULT([no])
9230     else
9231         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9232         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9233         AC_MSG_RESULT([yes])
9234     fi
9235     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9237 AC_SUBST(ENABLE_BREAKPAD)
9239 dnl ==================================================================
9240 dnl libfuzzer
9241 dnl ==================================================================
9242 AC_MSG_CHECKING([whether to enable fuzzers])
9243 if test "$enable_fuzzers" != yes; then
9244     AC_MSG_RESULT([no])
9245 else
9246     AC_MSG_RESULT([yes])
9247     ENABLE_FUZZERS="TRUE"
9248     AC_DEFINE([ENABLE_FUZZERS],1)
9249     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9251 AC_SUBST(ENABLE_FUZZERS)
9253 dnl ===================================================================
9254 dnl Orcus
9255 dnl ===================================================================
9256 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9257 if test "$with_system_orcus" != "yes"; then
9258     if test "$SYSTEM_BOOST" = "TRUE"; then
9259         # ===========================================================
9260         # Determine if we are going to need to link with Boost.System
9261         # ===========================================================
9262         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9263         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9264         dnl in documentation has no effect.
9265         AC_MSG_CHECKING([if we need to link with Boost.System])
9266         AC_LANG_PUSH([C++])
9267         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9268                 @%:@include <boost/version.hpp>
9269             ]],[[
9270                 #if BOOST_VERSION >= 105000
9271                 #   error yes, we need to link with Boost.System
9272                 #endif
9273             ]])],[
9274                 AC_MSG_RESULT([no])
9275             ],[
9276                 AC_MSG_RESULT([yes])
9277                 AX_BOOST_SYSTEM
9278         ])
9279         AC_LANG_POP([C++])
9280     fi
9282 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9283 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9284 AC_SUBST([BOOST_SYSTEM_LIB])
9285 AC_SUBST(SYSTEM_LIBORCUS)
9287 dnl ===================================================================
9288 dnl HarfBuzz
9289 dnl ===================================================================
9290 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9291                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9292                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9294 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9295                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9296                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9298 if test "$COM" = "MSC"; then # override the above
9299     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9300     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9303 if test "$with_system_harfbuzz" = "yes"; then
9304     if test "$with_system_graphite" = "no"; then
9305         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9306     fi
9307     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9308     _save_libs="$LIBS"
9309     _save_cflags="$CFLAGS"
9310     LIBS="$LIBS $HARFBUZZ_LIBS"
9311     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9312     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9313     LIBS="$_save_libs"
9314     CFLAGS="$_save_cflags"
9315 else
9316     if test "$with_system_graphite" = "yes"; then
9317         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9318     fi
9321 AC_MSG_CHECKING([whether to use X11])
9322 dnl ***************************************
9323 dnl testing for X libraries and includes...
9324 dnl ***************************************
9325 if test "$USING_X11" = TRUE; then
9326     AC_DEFINE(HAVE_FEATURE_X11)
9328 AC_MSG_RESULT([$USING_X11])
9330 if test "$USING_X11" = TRUE; then
9331     AC_PATH_X
9332     AC_PATH_XTRA
9333     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9335     if test -z "$x_includes"; then
9336         x_includes="default_x_includes"
9337     fi
9338     if test -z "$x_libraries"; then
9339         x_libraries="default_x_libraries"
9340     fi
9341     CFLAGS="$CFLAGS $X_CFLAGS"
9342     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9343     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9344 else
9345     x_includes="no_x_includes"
9346     x_libraries="no_x_libraries"
9349 if test "$USING_X11" = TRUE; then
9350     dnl ===================================================================
9351     dnl Check for extension headers
9352     dnl ===================================================================
9353     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9354      [#include <X11/extensions/shape.h>])
9356     # vcl needs ICE and SM
9357     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9358     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9359         [AC_MSG_ERROR(ICE library not found)])
9360     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9361     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9362         [AC_MSG_ERROR(SM library not found)])
9365 dnl ===================================================================
9366 dnl Check for system Xrender
9367 dnl ===================================================================
9368 AC_MSG_CHECKING([whether to use Xrender])
9369 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9370     AC_MSG_RESULT([yes])
9371     PKG_CHECK_MODULES(XRENDER, xrender)
9372     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9373     FilterLibs "${XRENDER_LIBS}"
9374     XRENDER_LIBS="${filteredlibs}"
9375     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9376       [AC_MSG_ERROR(libXrender not found or functional)], [])
9377     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9378       [AC_MSG_ERROR(Xrender not found. install X)], [])
9379 else
9380     AC_MSG_RESULT([no])
9382 AC_SUBST(XRENDER_CFLAGS)
9383 AC_SUBST(XRENDER_LIBS)
9385 dnl ===================================================================
9386 dnl Check for XRandr
9387 dnl ===================================================================
9388 AC_MSG_CHECKING([whether to enable RandR support])
9389 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9390     AC_MSG_RESULT([yes])
9391     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9392     if test "$ENABLE_RANDR" != "TRUE"; then
9393         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9394                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9395         XRANDR_CFLAGS=" "
9396         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9397           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9398         XRANDR_LIBS="-lXrandr "
9399         ENABLE_RANDR="TRUE"
9400     fi
9401     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9402     FilterLibs "${XRANDR_LIBS}"
9403     XRANDR_LIBS="${filteredlibs}"
9404 else
9405     ENABLE_RANDR=""
9406     AC_MSG_RESULT([no])
9408 AC_SUBST(XRANDR_CFLAGS)
9409 AC_SUBST(XRANDR_LIBS)
9410 AC_SUBST(ENABLE_RANDR)
9412 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9413     WITH_WEBDAV="serf"
9415 if test $_os = iOS -o $_os = Android; then
9416     WITH_WEBDAV="no"
9418 AC_MSG_CHECKING([for webdav library])
9419 case "$WITH_WEBDAV" in
9420 serf)
9421     AC_MSG_RESULT([serf])
9422     # Check for system apr-util
9423     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9424                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9425                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9426     if test "$COM" = "MSC"; then
9427         APR_LIB_DIR="LibR"
9428         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9429         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9430     fi
9432     # Check for system serf
9433     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9434                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9435     if test "$COM" = "MSC"; then
9436         SERF_LIB_DIR="Release"
9437         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9438         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9439     fi
9440     ;;
9441 neon)
9442     AC_MSG_RESULT([neon])
9443     # Check for system neon
9444     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9445     if test "$with_system_neon" = "yes"; then
9446         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9447     else
9448         NEON_VERSION=0295
9449     fi
9450     AC_SUBST(NEON_VERSION)
9451     ;;
9453     AC_MSG_RESULT([none, disabled])
9454     WITH_WEBDAV=""
9455     ;;
9456 esac
9457 AC_SUBST(WITH_WEBDAV)
9459 dnl ===================================================================
9460 dnl Check for disabling cve_tests
9461 dnl ===================================================================
9462 AC_MSG_CHECKING([whether to execute CVE tests])
9463 # If not explicitly enabled or disabled, default
9464 if test -z "$enable_cve_tests"; then
9465     case "$OS" in
9466     WNT)
9467         # Default cves off for windows with its wild and wonderful
9468         # varienty of AV software kicking in and panicking
9469         enable_cve_tests=no
9470         ;;
9471     *)
9472         # otherwise yes
9473         enable_cve_tests=yes
9474         ;;
9475     esac
9477 if test "$enable_cve_tests" = "no"; then
9478     AC_MSG_RESULT([no])
9479     DISABLE_CVE_TESTS=TRUE
9480     AC_SUBST(DISABLE_CVE_TESTS)
9481 else
9482     AC_MSG_RESULT([yes])
9485 dnl ===================================================================
9486 dnl Check for enabling chart XShape tests
9487 dnl ===================================================================
9488 AC_MSG_CHECKING([whether to execute chart XShape tests])
9489 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9490     AC_MSG_RESULT([yes])
9491     ENABLE_CHART_TESTS=TRUE
9492     AC_SUBST(ENABLE_CHART_TESTS)
9493 else
9494     AC_MSG_RESULT([no])
9497 dnl ===================================================================
9498 dnl Check for system openssl
9499 dnl ===================================================================
9500 DISABLE_OPENSSL=
9501 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9502 if test "$enable_openssl" = "yes"; then
9503     AC_MSG_RESULT([no])
9504     if test "$_os" = Darwin ; then
9505         # OpenSSL is deprecated when building for 10.7 or later.
9506         #
9507         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9508         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9510         with_system_openssl=no
9511         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9512     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9513             && test "$with_system_openssl" != "no"; then
9514         with_system_openssl=yes
9515         SYSTEM_OPENSSL=TRUE
9516         OPENSSL_CFLAGS=
9517         OPENSSL_LIBS="-lssl -lcrypto"
9518     else
9519         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9520     fi
9521     if test "$with_system_openssl" = "yes"; then
9522         AC_MSG_CHECKING([whether openssl supports SHA512])
9523         AC_LANG_PUSH([C])
9524         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9525             SHA512_CTX context;
9526 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9527         AC_LANG_POP(C)
9528     fi
9529 else
9530     AC_MSG_RESULT([yes])
9531     DISABLE_OPENSSL=TRUE
9533     # warn that although OpenSSL is disabled, system libraries may depend on it
9534     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9535     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9538 AC_SUBST([DISABLE_OPENSSL])
9540 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9541     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9542         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9543         enable_cipher_openssl_backend=no
9544     else
9545         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9546     fi
9548 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9549 ENABLE_CIPHER_OPENSSL_BACKEND=
9550 if test "$enable_cipher_openssl_backend" = yes; then
9551     AC_MSG_RESULT([yes])
9552     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9553 else
9554     AC_MSG_RESULT([no])
9556 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9558 dnl ===================================================================
9559 dnl Check for building gnutls
9560 dnl ===================================================================
9561 AC_MSG_CHECKING([whether to use gnutls])
9562 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9563     AC_MSG_RESULT([yes])
9564     AM_PATH_LIBGCRYPT()
9565     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9566         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9567                       available in the system to use as replacement.]]))
9568     FilterLibs "${LIBGCRYPT_LIBS}"
9569     LIBGCRYPT_LIBS="${filteredlibs}"
9570 else
9571     AC_MSG_RESULT([no])
9574 AC_SUBST([LIBGCRYPT_CFLAGS])
9575 AC_SUBST([LIBGCRYPT_LIBS])
9577 dnl ===================================================================
9578 dnl Check for system redland
9579 dnl ===================================================================
9580 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9581 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9582 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9583 if test "$with_system_redland" = "yes"; then
9584     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9585             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9586 else
9587     RAPTOR_MAJOR="0"
9588     RASQAL_MAJOR="3"
9589     REDLAND_MAJOR="0"
9591 AC_SUBST(RAPTOR_MAJOR)
9592 AC_SUBST(RASQAL_MAJOR)
9593 AC_SUBST(REDLAND_MAJOR)
9595 dnl ===================================================================
9596 dnl Check for system hunspell
9597 dnl ===================================================================
9598 AC_MSG_CHECKING([which libhunspell to use])
9599 if test "$with_system_hunspell" = "yes"; then
9600     AC_MSG_RESULT([external])
9601     SYSTEM_HUNSPELL=TRUE
9602     AC_LANG_PUSH([C++])
9603     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9604     if test "$HUNSPELL_PC" != "TRUE"; then
9605         AC_CHECK_HEADER(hunspell.hxx, [],
9606             [
9607             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9608             [AC_MSG_ERROR(hunspell headers not found.)], [])
9609             ], [])
9610         AC_CHECK_LIB([hunspell], [main], [:],
9611            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9612         HUNSPELL_LIBS=-lhunspell
9613     fi
9614     AC_LANG_POP([C++])
9615     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9616     FilterLibs "${HUNSPELL_LIBS}"
9617     HUNSPELL_LIBS="${filteredlibs}"
9618 else
9619     AC_MSG_RESULT([internal])
9620     SYSTEM_HUNSPELL=
9621     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9622     if test "$COM" = "MSC"; then
9623         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9624     else
9625         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9626     fi
9627     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9629 AC_SUBST(SYSTEM_HUNSPELL)
9630 AC_SUBST(HUNSPELL_CFLAGS)
9631 AC_SUBST(HUNSPELL_LIBS)
9633 dnl ===================================================================
9634 dnl Checking for altlinuxhyph
9635 dnl ===================================================================
9636 AC_MSG_CHECKING([which altlinuxhyph to use])
9637 if test "$with_system_altlinuxhyph" = "yes"; then
9638     AC_MSG_RESULT([external])
9639     SYSTEM_HYPH=TRUE
9640     AC_CHECK_HEADER(hyphen.h, [],
9641        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9642     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9643        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9644        [#include <hyphen.h>])
9645     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9646         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9647     if test -z "$HYPHEN_LIB"; then
9648         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9649            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9650     fi
9651     if test -z "$HYPHEN_LIB"; then
9652         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9653            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9654     fi
9655 else
9656     AC_MSG_RESULT([internal])
9657     SYSTEM_HYPH=
9658     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9659     if test "$COM" = "MSC"; then
9660         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9661     else
9662         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9663     fi
9665 AC_SUBST(SYSTEM_HYPH)
9666 AC_SUBST(HYPHEN_LIB)
9668 dnl ===================================================================
9669 dnl Checking for mythes
9670 dnl ===================================================================
9671 AC_MSG_CHECKING([which mythes to use])
9672 if test "$with_system_mythes" = "yes"; then
9673     AC_MSG_RESULT([external])
9674     SYSTEM_MYTHES=TRUE
9675     AC_LANG_PUSH([C++])
9676     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9677     if test "$MYTHES_PKGCONFIG" = "no"; then
9678         AC_CHECK_HEADER(mythes.hxx, [],
9679             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9680         AC_CHECK_LIB([mythes-1.2], [main], [:],
9681             [ MYTHES_FOUND=no], [])
9682     if test "$MYTHES_FOUND" = "no"; then
9683         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9684                 [ MYTHES_FOUND=no], [])
9685     fi
9686     if test "$MYTHES_FOUND" = "no"; then
9687         AC_MSG_ERROR([mythes library not found!.])
9688     fi
9689     fi
9690     AC_LANG_POP([C++])
9691     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9692     FilterLibs "${MYTHES_LIBS}"
9693     MYTHES_LIBS="${filteredlibs}"
9694 else
9695     AC_MSG_RESULT([internal])
9696     SYSTEM_MYTHES=
9697     BUILD_TYPE="$BUILD_TYPE MYTHES"
9698     if test "$COM" = "MSC"; then
9699         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9700     else
9701         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9702     fi
9704 AC_SUBST(SYSTEM_MYTHES)
9705 AC_SUBST(MYTHES_CFLAGS)
9706 AC_SUBST(MYTHES_LIBS)
9708 dnl ===================================================================
9709 dnl How should we build the linear programming solver ?
9710 dnl ===================================================================
9712 ENABLE_COINMP=
9713 AC_MSG_CHECKING([whether to build with CoinMP])
9714 if test "$enable_coinmp" != "no"; then
9715     ENABLE_COINMP=TRUE
9716     AC_MSG_RESULT([yes])
9717     if test "$with_system_coinmp" = "yes"; then
9718         SYSTEM_COINMP=TRUE
9719         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9720         FilterLibs "${COINMP_LIBS}"
9721         COINMP_LIBS="${filteredlibs}"
9722     else
9723         BUILD_TYPE="$BUILD_TYPE COINMP"
9724     fi
9725 else
9726     AC_MSG_RESULT([no])
9728 AC_SUBST(ENABLE_COINMP)
9729 AC_SUBST(SYSTEM_COINMP)
9730 AC_SUBST(COINMP_CFLAGS)
9731 AC_SUBST(COINMP_LIBS)
9733 ENABLE_LPSOLVE=
9734 AC_MSG_CHECKING([whether to build with lpsolve])
9735 if test "$enable_lpsolve" != "no"; then
9736     ENABLE_LPSOLVE=TRUE
9737     AC_MSG_RESULT([yes])
9738 else
9739     AC_MSG_RESULT([no])
9741 AC_SUBST(ENABLE_LPSOLVE)
9743 if test "$ENABLE_LPSOLVE" = TRUE; then
9744     AC_MSG_CHECKING([which lpsolve to use])
9745     if test "$with_system_lpsolve" = "yes"; then
9746         AC_MSG_RESULT([external])
9747         SYSTEM_LPSOLVE=TRUE
9748         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9749            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9750         save_LIBS=$LIBS
9751         # some systems need this. Like Ubuntu....
9752         AC_CHECK_LIB(m, floor)
9753         AC_CHECK_LIB(dl, dlopen)
9754         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9755             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9756         LIBS=$save_LIBS
9757     else
9758         AC_MSG_RESULT([internal])
9759         SYSTEM_LPSOLVE=
9760         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9761     fi
9763 AC_SUBST(SYSTEM_LPSOLVE)
9765 dnl ===================================================================
9766 dnl Checking for libexttextcat
9767 dnl ===================================================================
9768 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9769 if test "$with_system_libexttextcat" = "yes"; then
9770     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9772 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9774 dnl ===================================================================
9775 dnl Checking for libnumbertext
9776 dnl ===================================================================
9777 AC_MSG_CHECKING([whether to use libnumbertext])
9778 if test "$enable_libnumbertext" = "no"; then
9779     AC_MSG_RESULT([no])
9780     ENABLE_LIBNUMBERTEXT=
9781     SYSTEM_LIBNUMBERTEXT=
9782 else
9783     AC_MSG_RESULT([yes])
9784     ENABLE_LIBNUMBERTEXT=TRUE
9785     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9786     if test "$with_system_libnumbertext" = "yes"; then
9787         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9788         SYSTEM_LIBNUMBERTEXT=YES
9789     else
9790         SYSTEM_LIBNUMBERTEXT=
9791         AC_LANG_PUSH([C++])
9792         save_CPPFLAGS=$CPPFLAGS
9793         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9794         AC_CHECK_HEADERS([codecvt regex])
9795         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9796                 [ ENABLE_LIBNUMBERTEXT=''
9797                   LIBNUMBERTEXT_CFLAGS=''
9798                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9799                                Enable libnumbertext fallback (missing number to number name conversion).])
9800                 ])
9801         CPPFLAGS=$save_CPPFLAGS
9802         AC_LANG_POP([C++])
9803     fi
9804     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9805         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9806     fi
9808 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9809 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9810 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9811 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9813 dnl ***************************************
9814 dnl testing libc version for Linux...
9815 dnl ***************************************
9816 if test "$_os" = "Linux"; then
9817     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9818     exec 6>/dev/null # no output
9819     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9820     exec 6>&1 # output on again
9821     if test "$HAVE_LIBC"; then
9822         AC_MSG_RESULT([yes])
9823     else
9824         AC_MSG_ERROR([no, upgrade libc])
9825     fi
9828 dnl =========================================
9829 dnl Check for uuidgen
9830 dnl =========================================
9831 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9832     # presence is already tested above in the WINDOWS_SDK_HOME check
9833     UUIDGEN=uuidgen.exe
9834     AC_SUBST(UUIDGEN)
9835 else
9836     AC_PATH_PROG([UUIDGEN], [uuidgen])
9837     if test -z "$UUIDGEN"; then
9838         AC_MSG_WARN([uuid is needed for building installation sets])
9839     fi
9842 dnl ***************************************
9843 dnl Checking for bison and flex
9844 dnl ***************************************
9845 AC_PATH_PROG(BISON, bison)
9846 if test -z "$BISON"; then
9847     AC_MSG_ERROR([no bison found in \$PATH, install it])
9848 else
9849     AC_MSG_CHECKING([the bison version])
9850     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9851     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9852     # Accept newer than 2.0
9853     if test "$_bison_longver" -lt 2000; then
9854         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9855     fi
9858 AC_PATH_PROG(FLEX, flex)
9859 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9860     FLEX=`cygpath -m $FLEX`
9862 if test -z "$FLEX"; then
9863     AC_MSG_ERROR([no flex found in \$PATH, install it])
9864 else
9865     AC_MSG_CHECKING([the flex version])
9866     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9867     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9868         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9869     fi
9871 AC_SUBST([FLEX])
9872 dnl ***************************************
9873 dnl Checking for patch
9874 dnl ***************************************
9875 AC_PATH_PROG(PATCH, patch)
9876 if test -z "$PATCH"; then
9877     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9880 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9881 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9882     if test -z "$with_gnu_patch"; then
9883         GNUPATCH=$PATCH
9884     else
9885         if test -x "$with_gnu_patch"; then
9886             GNUPATCH=$with_gnu_patch
9887         else
9888             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9889         fi
9890     fi
9892     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9893     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9894         AC_MSG_RESULT([yes])
9895     else
9896         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9897     fi
9898 else
9899     GNUPATCH=$PATCH
9902 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9903     GNUPATCH=`cygpath -m $GNUPATCH`
9906 dnl We also need to check for --with-gnu-cp
9908 if test -z "$with_gnu_cp"; then
9909     # check the place where the good stuff is hidden on Solaris...
9910     if test -x /usr/gnu/bin/cp; then
9911         GNUCP=/usr/gnu/bin/cp
9912     else
9913         AC_PATH_PROGS(GNUCP, gnucp cp)
9914     fi
9915     if test -z $GNUCP; then
9916         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9917     fi
9918 else
9919     if test -x "$with_gnu_cp"; then
9920         GNUCP=$with_gnu_cp
9921     else
9922         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9923     fi
9926 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9927     GNUCP=`cygpath -m $GNUCP`
9930 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9931 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9932     AC_MSG_RESULT([yes])
9933 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9934     AC_MSG_RESULT([yes])
9935 else
9936     case "$build_os" in
9937     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9938         x_GNUCP=[\#]
9939         GNUCP=''
9940         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9941         ;;
9942     *)
9943         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9944         ;;
9945     esac
9948 AC_SUBST(GNUPATCH)
9949 AC_SUBST(GNUCP)
9950 AC_SUBST(x_GNUCP)
9952 dnl ***************************************
9953 dnl testing assembler path
9954 dnl ***************************************
9955 ML_EXE=""
9956 if test "$_os" = "WINNT"; then
9957     if test "$BITNESS_OVERRIDE" = ""; then
9958         assembler=ml.exe
9959         assembler_bin=$CL_DIR
9960     else
9961         assembler=ml64.exe
9962         assembler_bin=$CL_DIR
9963     fi
9965     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9966     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9967         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9968         AC_MSG_RESULT([found])
9969         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9970     else
9971         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9972     fi
9974     PathFormat "$ASM_HOME"
9975     ASM_HOME="$formatted_path"
9976 else
9977     ASM_HOME=""
9980 AC_SUBST(ML_EXE)
9982 dnl ===================================================================
9983 dnl We need zip and unzip
9984 dnl ===================================================================
9985 AC_PATH_PROG(ZIP, zip)
9986 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9987 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9988     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],,)
9991 AC_PATH_PROG(UNZIP, unzip)
9992 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9994 dnl ===================================================================
9995 dnl Zip must be a specific type for different build types.
9996 dnl ===================================================================
9997 if test $build_os = cygwin; then
9998     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9999         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10000     fi
10003 dnl ===================================================================
10004 dnl We need touch with -h option support.
10005 dnl ===================================================================
10006 AC_PATH_PROG(TOUCH, touch)
10007 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10008 touch warn
10009 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10010     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],,)
10013 dnl ===================================================================
10014 dnl Check for system epoxy
10015 dnl ===================================================================
10016 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10018 dnl ===================================================================
10019 dnl Set vcl option: coordinate device in double or sal_Int32
10020 dnl ===================================================================
10022 dnl disabled for now, we don't want subtle differences between OSs
10023 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10024 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10025 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10026 dnl     AC_MSG_RESULT([double])
10027 dnl else
10028 dnl     AC_MSG_RESULT([sal_Int32])
10029 dnl fi
10031 dnl ===================================================================
10032 dnl Test which vclplugs have to be built.
10033 dnl ===================================================================
10034 R=""
10035 if test "$USING_X11" != TRUE; then
10036     enable_gtk=no
10037     enable_gtk3=no
10039 GTK3_CFLAGS=""
10040 GTK3_LIBS=""
10041 ENABLE_GTK3=""
10042 if test "x$enable_gtk3" = "xyes"; then
10043     if test "$with_system_cairo" = no; then
10044         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10045     fi
10046     : ${with_system_cairo:=yes}
10047     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="")
10048     if test "x$ENABLE_GTK3" = "xTRUE"; then
10049         R="gtk3"
10050         dnl Avoid installed by unpackaged files for now.
10051         if test -z "$PKGFORMAT"; then
10052             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10053         fi
10054     else
10055         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10056     fi
10057     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10058     FilterLibs "${GTK3_LIBS}"
10059     GTK3_LIBS="${filteredlibs}"
10061     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10062     if test "$with_system_epoxy" != "yes"; then
10063         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10064         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10065                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10066     fi
10068 AC_SUBST(GTK3_LIBS)
10069 AC_SUBST(GTK3_CFLAGS)
10070 AC_SUBST(ENABLE_GTK3)
10072 ENABLE_GTK=""
10073 if test "x$enable_gtk" = "xyes"; then
10074     if test "$with_system_cairo" = no; then
10075         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10076     fi
10077     : ${with_system_cairo:=yes}
10078     ENABLE_GTK="TRUE"
10079     AC_DEFINE(ENABLE_GTK)
10080     R="gtk $R"
10082 AC_SUBST(ENABLE_GTK)
10084 ENABLE_KDE4=""
10085 if test "x$enable_kde4" = "xyes"; then
10086     ENABLE_KDE4="TRUE"
10087     AC_DEFINE(ENABLE_KDE4)
10088     R="$R kde4"
10090 AC_SUBST(ENABLE_KDE4)
10092 ENABLE_QT5=""
10093 if test "x$enable_qt5" = "xyes"; then
10094     ENABLE_QT5="TRUE"
10095     AC_DEFINE(ENABLE_QT5)
10096     R="$R qt5"
10098 AC_SUBST(ENABLE_QT5)
10100 ENABLE_KDE5=""
10101 if test "x$enable_kde5" = "xyes"; then
10102     ENABLE_KDE5="TRUE"
10103     AC_DEFINE(ENABLE_KDE5)
10104     R="$R kde5"
10106 AC_SUBST(ENABLE_KDE5)
10108 ENABLE_GTK3_KDE5=""
10109 if test "x$enable_gtk3_kde5" = "xyes"; then
10110     ENABLE_GTK3_KDE5="TRUE"
10111     AC_DEFINE(ENABLE_GTK3_KDE5)
10112     R="$R gtk3_kde5"
10114 AC_SUBST(ENABLE_GTK3_KDE5)
10116 build_vcl_plugins="$R"
10117 if test -z "$build_vcl_plugins"; then
10118     build_vcl_plugins="none"
10120 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10122 dnl ===================================================================
10123 dnl check for dbus support
10124 dnl ===================================================================
10125 ENABLE_DBUS=""
10126 DBUS_CFLAGS=""
10127 DBUS_LIBS=""
10128 DBUS_GLIB_CFLAGS=""
10129 DBUS_GLIB_LIBS=""
10130 DBUS_HAVE_GLIB=""
10132 if test "$enable_dbus" = "no"; then
10133     test_dbus=no
10136 AC_MSG_CHECKING([whether to enable DBUS support])
10137 if test "$test_dbus" = "yes"; then
10138     ENABLE_DBUS="TRUE"
10139     AC_MSG_RESULT([yes])
10140     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10141     AC_DEFINE(ENABLE_DBUS)
10142     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10143     FilterLibs "${DBUS_LIBS}"
10144     DBUS_LIBS="${filteredlibs}"
10146     # Glib is needed for BluetoothServer
10147     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10148     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10149         [
10150             DBUS_HAVE_GLIB="TRUE"
10151             AC_DEFINE(DBUS_HAVE_GLIB,1)
10152         ],
10153         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10154     )
10155 else
10156     AC_MSG_RESULT([no])
10159 AC_SUBST(ENABLE_DBUS)
10160 AC_SUBST(DBUS_CFLAGS)
10161 AC_SUBST(DBUS_LIBS)
10162 AC_SUBST(DBUS_GLIB_CFLAGS)
10163 AC_SUBST(DBUS_GLIB_LIBS)
10164 AC_SUBST(DBUS_HAVE_GLIB)
10166 AC_MSG_CHECKING([whether to enable Impress remote control])
10167 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10168     AC_MSG_RESULT([yes])
10169     ENABLE_SDREMOTE=TRUE
10170     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10172     # If not explicitly enabled or disabled, default
10173     if test -z "$enable_sdremote_bluetooth"; then
10174         case "$OS" in
10175         LINUX|MACOSX|WNT)
10176             # Default to yes for these
10177             enable_sdremote_bluetooth=yes
10178             ;;
10179         *)
10180             # otherwise no
10181             enable_sdremote_bluetooth=no
10182             ;;
10183         esac
10184     fi
10185     # $enable_sdremote_bluetooth is guaranteed non-empty now
10187     if test "$enable_sdremote_bluetooth" != "no"; then
10188         if test "$OS" = "LINUX"; then
10189             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10190                 AC_MSG_RESULT([yes])
10191                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10192                 dnl ===================================================================
10193                 dnl Check for system bluez
10194                 dnl ===================================================================
10195                 AC_MSG_CHECKING([which Bluetooth header to use])
10196                 if test "$with_system_bluez" = "yes"; then
10197                     AC_MSG_RESULT([external])
10198                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10199                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10200                     SYSTEM_BLUEZ=TRUE
10201                 else
10202                     AC_MSG_RESULT([internal])
10203                     SYSTEM_BLUEZ=
10204                 fi
10205             else
10206                 AC_MSG_RESULT([no, dbus disabled])
10207                 ENABLE_SDREMOTE_BLUETOOTH=
10208                 SYSTEM_BLUEZ=
10209             fi
10210         else
10211             AC_MSG_RESULT([yes])
10212             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10213             SYSTEM_BLUEZ=
10214         fi
10215     else
10216         AC_MSG_RESULT([no])
10217         ENABLE_SDREMOTE_BLUETOOTH=
10218         SYSTEM_BLUEZ=
10219     fi
10220 else
10221     ENABLE_SDREMOTE=
10222     SYSTEM_BLUEZ=
10223     AC_MSG_RESULT([no])
10225 AC_SUBST(ENABLE_SDREMOTE)
10226 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10227 AC_SUBST(SYSTEM_BLUEZ)
10229 dnl ===================================================================
10230 dnl Check whether the gtk 2.0 libraries are available.
10231 dnl ===================================================================
10233 GTK_CFLAGS=""
10234 GTK_LIBS=""
10235 if test  "$test_gtk" = "yes"; then
10237     if test "$ENABLE_GTK" = "TRUE"; then
10238         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]))
10239         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10240         FilterLibs "${GTK_LIBS}"
10241         GTK_LIBS="${filteredlibs}"
10242         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]))
10243         BUILD_TYPE="$BUILD_TYPE GTK"
10244         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10245         FilterLibs "${GTHREAD_LIBS}"
10246         GTHREAD_LIBS="${filteredlibs}"
10248         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10249         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10250                           [ENABLE_GTK_PRINT="TRUE"],
10251                           [ENABLE_GTK_PRINT=""])
10252         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10253         FilterLibs "${GTK_PRINT_LIBS}"
10254         GTK_PRINT_LIBS="${filteredlibs}"
10255     fi
10257     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10258         AC_MSG_CHECKING([whether to enable GIO support])
10259         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10260             dnl Need at least 2.26 for the dbus support.
10261             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10262                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10263             if test "$ENABLE_GIO" = "TRUE"; then
10264                 AC_DEFINE(ENABLE_GIO)
10265                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10266                 FilterLibs "${GIO_LIBS}"
10267                 GIO_LIBS="${filteredlibs}"
10268             fi
10269         else
10270             AC_MSG_RESULT([no])
10271         fi
10272     fi
10274 AC_SUBST(ENABLE_GIO)
10275 AC_SUBST(GIO_CFLAGS)
10276 AC_SUBST(GIO_LIBS)
10277 AC_SUBST(GTK_CFLAGS)
10278 AC_SUBST(GTK_LIBS)
10279 AC_SUBST(GTHREAD_CFLAGS)
10280 AC_SUBST(GTHREAD_LIBS)
10281 AC_SUBST([ENABLE_GTK_PRINT])
10282 AC_SUBST([GTK_PRINT_CFLAGS])
10283 AC_SUBST([GTK_PRINT_LIBS])
10286 dnl ===================================================================
10288 SPLIT_APP_MODULES=""
10289 if test "$enable_split_app_modules" = "yes"; then
10290     SPLIT_APP_MODULES="TRUE"
10292 AC_SUBST(SPLIT_APP_MODULES)
10294 SPLIT_OPT_FEATURES=""
10295 if test "$enable_split_opt_features" = "yes"; then
10296     SPLIT_OPT_FEATURES="TRUE"
10298 AC_SUBST(SPLIT_OPT_FEATURES)
10300 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10301     if test "$enable_cairo_canvas" = yes; then
10302         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10303     fi
10304     enable_cairo_canvas=no
10305 elif test -z "$enable_cairo_canvas"; then
10306     enable_cairo_canvas=yes
10309 ENABLE_CAIRO_CANVAS=""
10310 if test "$enable_cairo_canvas" = "yes"; then
10311     test_cairo=yes
10312     ENABLE_CAIRO_CANVAS="TRUE"
10313     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10315 AC_SUBST(ENABLE_CAIRO_CANVAS)
10317 dnl ===================================================================
10318 dnl Check whether the GStreamer libraries are available.
10319 dnl It's possible to build avmedia with both GStreamer backends!
10320 dnl ===================================================================
10322 ENABLE_GSTREAMER_1_0=""
10324 if test "$build_gstreamer_1_0" = "yes"; then
10326     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10327     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10328         ENABLE_GSTREAMER_1_0="TRUE"
10329         AC_MSG_RESULT([yes])
10330         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10331         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10332         FilterLibs "${GSTREAMER_1_0_LIBS}"
10333         GSTREAMER_1_0_LIBS="${filteredlibs}"
10334     else
10335         AC_MSG_RESULT([no])
10336     fi
10338 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10339 AC_SUBST(GSTREAMER_1_0_LIBS)
10340 AC_SUBST(ENABLE_GSTREAMER_1_0)
10343 ENABLE_GSTREAMER_0_10=""
10344 if test "$build_gstreamer_0_10" = "yes"; then
10346     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10347     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10348         ENABLE_GSTREAMER_0_10="TRUE"
10349         AC_MSG_RESULT([yes])
10350         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10351             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10352         ])
10353         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10354         FilterLibs "${GSTREAMER_0_10_LIBS}"
10355         GSTREAMER_0_10_LIBS="${filteredlibs}"
10356     else
10357         AC_MSG_RESULT([no])
10358     fi
10361 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10362 AC_SUBST(GSTREAMER_0_10_LIBS)
10363 AC_SUBST(ENABLE_GSTREAMER_0_10)
10365 dnl ===================================================================
10366 dnl Check whether to build the VLC avmedia backend
10367 dnl ===================================================================
10369 ENABLE_VLC=""
10371 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10372 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10373     ENABLE_VLC="TRUE"
10374     AC_MSG_RESULT([yes])
10375 else
10376     AC_MSG_RESULT([no])
10378 AC_SUBST(ENABLE_VLC)
10380 ENABLE_OPENGL_TRANSITIONS=
10381 ENABLE_OPENGL_CANVAS=
10382 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10383    : # disable
10384 elif test "$_os" = "Darwin"; then
10385     # We use frameworks on Mac OS X, no need for detail checks
10386     ENABLE_OPENGL_TRANSITIONS=TRUE
10387     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10388     ENABLE_OPENGL_CANVAS=TRUE
10389 elif test $_os = WINNT; then
10390     ENABLE_OPENGL_TRANSITIONS=TRUE
10391     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10392     ENABLE_OPENGL_CANVAS=TRUE
10393 else
10394     if test "$USING_X11" = TRUE; then
10395         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10396         ENABLE_OPENGL_TRANSITIONS=TRUE
10397         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10398         ENABLE_OPENGL_CANVAS=TRUE
10399     fi
10402 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10403 AC_SUBST(ENABLE_OPENGL_CANVAS)
10405 dnl =================================================
10406 dnl Check whether to build with OpenCL support.
10407 dnl =================================================
10409 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10410     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10411     # platform (optional at run-time, used through clew).
10412     BUILD_TYPE="$BUILD_TYPE OPENCL"
10413     AC_DEFINE(HAVE_FEATURE_OPENCL)
10416 dnl =================================================
10417 dnl Check whether to build with dconf support.
10418 dnl =================================================
10420 if test "$enable_dconf" != no; then
10421     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10422         if test "$enable_dconf" = yes; then
10423             AC_MSG_ERROR([dconf not found])
10424         else
10425             enable_dconf=no
10426         fi])
10428 AC_MSG_CHECKING([whether to enable dconf])
10429 if test "$enable_dconf" = no; then
10430     DCONF_CFLAGS=
10431     DCONF_LIBS=
10432     ENABLE_DCONF=
10433     AC_MSG_RESULT([no])
10434 else
10435     ENABLE_DCONF=TRUE
10436     AC_DEFINE(ENABLE_DCONF)
10437     AC_MSG_RESULT([yes])
10439 AC_SUBST([DCONF_CFLAGS])
10440 AC_SUBST([DCONF_LIBS])
10441 AC_SUBST([ENABLE_DCONF])
10443 # pdf import?
10444 AC_MSG_CHECKING([whether to build the PDF import feature])
10445 ENABLE_PDFIMPORT=
10446 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10447     AC_MSG_RESULT([yes])
10448     ENABLE_PDFIMPORT=TRUE
10449     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10451     dnl ===================================================================
10452     dnl Check for system poppler
10453     dnl ===================================================================
10454     AC_MSG_CHECKING([which PDF import backend to use])
10455     if test "$with_system_poppler" = "yes"; then
10456         AC_MSG_RESULT([external])
10457         SYSTEM_POPPLER=TRUE
10458         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10459         AC_LANG_PUSH([C++])
10460         save_CXXFLAGS=$CXXFLAGS
10461         save_CPPFLAGS=$CPPFLAGS
10462         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10463         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10464         AC_CHECK_HEADER([cpp/poppler-version.h],
10465             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10466             [])
10467         CXXFLAGS=$save_CXXFLAGS
10468         CPPFLAGS=$save_CPPFLAGS
10469         AC_LANG_POP([C++])
10470         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10472         FilterLibs "${POPPLER_LIBS}"
10473         POPPLER_LIBS="${filteredlibs}"
10474     else
10475         AC_MSG_RESULT([internal])
10476         SYSTEM_POPPLER=
10477         BUILD_TYPE="$BUILD_TYPE POPPLER"
10478         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10479     fi
10480     AC_DEFINE([ENABLE_PDFIMPORT],1)
10481 else
10482     AC_MSG_RESULT([no])
10484 AC_SUBST(ENABLE_PDFIMPORT)
10485 AC_SUBST(SYSTEM_POPPLER)
10486 AC_SUBST(POPPLER_CFLAGS)
10487 AC_SUBST(POPPLER_LIBS)
10489 # pdf import?
10490 AC_MSG_CHECKING([whether to build PDFium])
10491 ENABLE_PDFIUM=
10492 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10493     AC_MSG_RESULT([yes])
10494     ENABLE_PDFIUM=TRUE
10495     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10496     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10497 else
10498     AC_MSG_RESULT([no])
10500 AC_SUBST(ENABLE_PDFIUM)
10502 SYSTEM_GPGMEPP=
10504 if test "$build_for_ios" = "YES"; then
10505     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10506     AC_MSG_RESULT([yes])
10507 elif test "$enable_mpl_subset" = "yes"; then
10508     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10509     AC_MSG_RESULT([yes])
10510 elif test "$enable_fuzzers" = "yes"; then
10511     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10512     AC_MSG_RESULT([yes])
10513 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10514     dnl ===================================================================
10515     dnl Check for system gpgme
10516     dnl ===================================================================
10517     AC_MSG_CHECKING([which gpgmepp to use])
10518     if test "$with_system_gpgmepp" = "yes"; then
10519         AC_MSG_RESULT([external])
10520         SYSTEM_GPGMEPP=TRUE
10522         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10523         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10524             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10525         # progress_callback is the only func with plain C linkage
10526         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10527         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10528             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10529         AC_CHECK_HEADER(gpgme.h, [],
10530             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10531     else
10532         AC_MSG_RESULT([internal])
10533         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10534         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10536         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10537         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10538         if test "$_os" != "WINNT"; then
10539             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10540             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10541         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10542             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10543         fi
10544     fi
10545     ENABLE_GPGMEPP=TRUE
10546     AC_DEFINE([HAVE_FEATURE_GPGME])
10547     AC_PATH_PROG(GPG, gpg)
10548     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10549     # so let's exclude that manually for the moment
10550     if test -n "$GPG" -a "$_os" != "WINNT"; then
10551         # make sure we not only have a working gpgme, but a full working
10552         # gpg installation to run OpenPGP signature verification
10553         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10554     fi
10555     if test "$_os" = "Linux"; then
10556       uid=`id -u`
10557       AC_MSG_CHECKING([for /run/user/$uid])
10558       if test -d /run/user/$uid; then
10559         AC_MSG_RESULT([yes])
10560         AC_PATH_PROG(GPGCONF, gpgconf)
10561         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10562         if $GPGCONF --dump-options > /dev/null ; then
10563           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10564             AC_MSG_RESULT([yes])
10565             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10566             AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10567           else
10568             AC_MSG_RESULT([no])
10569           fi
10570         else
10571           AC_MSG_RESULT([no. missing or broken gpgconf?])
10572         fi
10573       else
10574         AC_MSG_RESULT([no])
10575      fi
10576    fi
10578 AC_SUBST(ENABLE_GPGMEPP)
10579 AC_SUBST(SYSTEM_GPGMEPP)
10580 AC_SUBST(GPG_ERROR_CFLAGS)
10581 AC_SUBST(GPG_ERROR_LIBS)
10582 AC_SUBST(LIBASSUAN_CFLAGS)
10583 AC_SUBST(LIBASSUAN_LIBS)
10584 AC_SUBST(GPGMEPP_CFLAGS)
10585 AC_SUBST(GPGMEPP_LIBS)
10587 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10588 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10589     AC_MSG_RESULT([yes])
10590     ENABLE_MEDIAWIKI=TRUE
10591     BUILD_TYPE="$BUILD_TYPE XSLTML"
10592     if test  "x$with_java" = "xno"; then
10593         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10594     fi
10595 else
10596     AC_MSG_RESULT([no])
10597     ENABLE_MEDIAWIKI=
10598     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10600 AC_SUBST(ENABLE_MEDIAWIKI)
10602 AC_MSG_CHECKING([whether to build the Report Builder])
10603 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10604     AC_MSG_RESULT([yes])
10605     ENABLE_REPORTBUILDER=TRUE
10606     AC_MSG_CHECKING([which jfreereport libs to use])
10607     if test "$with_system_jfreereport" = "yes"; then
10608         SYSTEM_JFREEREPORT=TRUE
10609         AC_MSG_RESULT([external])
10610         if test -z $SAC_JAR; then
10611             SAC_JAR=/usr/share/java/sac.jar
10612         fi
10613         if ! test -f $SAC_JAR; then
10614              AC_MSG_ERROR(sac.jar not found.)
10615         fi
10617         if test -z $LIBXML_JAR; then
10618             if test -f /usr/share/java/libxml-1.0.0.jar; then
10619                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10620             elif test -f /usr/share/java/libxml.jar; then
10621                 LIBXML_JAR=/usr/share/java/libxml.jar
10622             else
10623                 AC_MSG_ERROR(libxml.jar replacement not found.)
10624             fi
10625         elif ! test -f $LIBXML_JAR; then
10626             AC_MSG_ERROR(libxml.jar not found.)
10627         fi
10629         if test -z $FLUTE_JAR; then
10630             if test -f/usr/share/java/flute-1.3.0.jar; then
10631                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10632             elif test -f /usr/share/java/flute.jar; then
10633                 FLUTE_JAR=/usr/share/java/flute.jar
10634             else
10635                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10636             fi
10637         elif ! test -f $FLUTE_JAR; then
10638             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10639         fi
10641         if test -z $JFREEREPORT_JAR; then
10642             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10643                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10644             elif test -f /usr/share/java/flow-engine.jar; then
10645                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10646             else
10647                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10648             fi
10649         elif ! test -f  $JFREEREPORT_JAR; then
10650                 AC_MSG_ERROR(jfreereport.jar not found.)
10651         fi
10653         if test -z $LIBLAYOUT_JAR; then
10654             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10655                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10656             elif test -f /usr/share/java/liblayout.jar; then
10657                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10658             else
10659                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10660             fi
10661         elif ! test -f $LIBLAYOUT_JAR; then
10662                 AC_MSG_ERROR(liblayout.jar not found.)
10663         fi
10665         if test -z $LIBLOADER_JAR; then
10666             if test -f /usr/share/java/libloader-1.0.0.jar; then
10667                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10668             elif test -f /usr/share/java/libloader.jar; then
10669                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10670             else
10671                 AC_MSG_ERROR(libloader.jar replacement not found.)
10672             fi
10673         elif ! test -f  $LIBLOADER_JAR; then
10674             AC_MSG_ERROR(libloader.jar not found.)
10675         fi
10677         if test -z $LIBFORMULA_JAR; then
10678             if test -f /usr/share/java/libformula-0.2.0.jar; then
10679                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10680             elif test -f /usr/share/java/libformula.jar; then
10681                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10682             else
10683                 AC_MSG_ERROR(libformula.jar replacement not found.)
10684             fi
10685         elif ! test -f $LIBFORMULA_JAR; then
10686                 AC_MSG_ERROR(libformula.jar not found.)
10687         fi
10689         if test -z $LIBREPOSITORY_JAR; then
10690             if test -f /usr/share/java/librepository-1.0.0.jar; then
10691                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10692             elif test -f /usr/share/java/librepository.jar; then
10693                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10694             else
10695                 AC_MSG_ERROR(librepository.jar replacement not found.)
10696             fi
10697         elif ! test -f $LIBREPOSITORY_JAR; then
10698             AC_MSG_ERROR(librepository.jar not found.)
10699         fi
10701         if test -z $LIBFONTS_JAR; then
10702             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10703                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10704             elif test -f /usr/share/java/libfonts.jar; then
10705                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10706             else
10707                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10708             fi
10709         elif ! test -f $LIBFONTS_JAR; then
10710                 AC_MSG_ERROR(libfonts.jar not found.)
10711         fi
10713         if test -z $LIBSERIALIZER_JAR; then
10714             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10715                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10716             elif test -f /usr/share/java/libserializer.jar; then
10717                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10718             else
10719                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10720             fi
10721         elif ! test -f $LIBSERIALIZER_JAR; then
10722                 AC_MSG_ERROR(libserializer.jar not found.)
10723         fi
10725         if test -z $LIBBASE_JAR; then
10726             if test -f /usr/share/java/libbase-1.0.0.jar; then
10727                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10728             elif test -f /usr/share/java/libbase.jar; then
10729                 LIBBASE_JAR=/usr/share/java/libbase.jar
10730             else
10731                 AC_MSG_ERROR(libbase.jar replacement not found.)
10732             fi
10733         elif ! test -f $LIBBASE_JAR; then
10734             AC_MSG_ERROR(libbase.jar not found.)
10735         fi
10737     else
10738         AC_MSG_RESULT([internal])
10739         SYSTEM_JFREEREPORT=
10740         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10741         NEED_ANT=TRUE
10742     fi
10743 else
10744     AC_MSG_RESULT([no])
10745     ENABLE_REPORTBUILDER=
10746     SYSTEM_JFREEREPORT=
10748 AC_SUBST(ENABLE_REPORTBUILDER)
10749 AC_SUBST(SYSTEM_JFREEREPORT)
10750 AC_SUBST(SAC_JAR)
10751 AC_SUBST(LIBXML_JAR)
10752 AC_SUBST(FLUTE_JAR)
10753 AC_SUBST(JFREEREPORT_JAR)
10754 AC_SUBST(LIBBASE_JAR)
10755 AC_SUBST(LIBLAYOUT_JAR)
10756 AC_SUBST(LIBLOADER_JAR)
10757 AC_SUBST(LIBFORMULA_JAR)
10758 AC_SUBST(LIBREPOSITORY_JAR)
10759 AC_SUBST(LIBFONTS_JAR)
10760 AC_SUBST(LIBSERIALIZER_JAR)
10762 # this has to be here because both the Wiki Publisher and the SRB use
10763 # commons-logging
10764 COMMONS_LOGGING_VERSION=1.2
10765 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10766     AC_MSG_CHECKING([which Apache commons-* libs to use])
10767     if test "$with_system_apache_commons" = "yes"; then
10768         SYSTEM_APACHE_COMMONS=TRUE
10769         AC_MSG_RESULT([external])
10770         if test -z $COMMONS_LOGGING_JAR; then
10771             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10772                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10773            elif test -f /usr/share/java/commons-logging.jar; then
10774                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10775             else
10776                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10777             fi
10778         elif ! test -f $COMMONS_LOGGING_JAR; then
10779             AC_MSG_ERROR(commons-logging.jar not found.)
10780         fi
10781     else
10782         AC_MSG_RESULT([internal])
10783         SYSTEM_APACHE_COMMONS=
10784         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10785         NEED_ANT=TRUE
10786     fi
10788 AC_SUBST(SYSTEM_APACHE_COMMONS)
10789 AC_SUBST(COMMONS_LOGGING_JAR)
10790 AC_SUBST(COMMONS_LOGGING_VERSION)
10792 # scripting provider for BeanShell?
10793 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10794 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10795     AC_MSG_RESULT([yes])
10796     ENABLE_SCRIPTING_BEANSHELL=TRUE
10798     dnl ===================================================================
10799     dnl Check for system beanshell
10800     dnl ===================================================================
10801     AC_MSG_CHECKING([which beanshell to use])
10802     if test "$with_system_beanshell" = "yes"; then
10803         AC_MSG_RESULT([external])
10804         SYSTEM_BSH=TRUE
10805         if test -z $BSH_JAR; then
10806             BSH_JAR=/usr/share/java/bsh.jar
10807         fi
10808         if ! test -f $BSH_JAR; then
10809             AC_MSG_ERROR(bsh.jar not found.)
10810         fi
10811     else
10812         AC_MSG_RESULT([internal])
10813         SYSTEM_BSH=
10814         BUILD_TYPE="$BUILD_TYPE BSH"
10815     fi
10816 else
10817     AC_MSG_RESULT([no])
10818     ENABLE_SCRIPTING_BEANSHELL=
10819     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10821 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10822 AC_SUBST(SYSTEM_BSH)
10823 AC_SUBST(BSH_JAR)
10825 # scripting provider for JavaScript?
10826 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10827 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10828     AC_MSG_RESULT([yes])
10829     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10831     dnl ===================================================================
10832     dnl Check for system rhino
10833     dnl ===================================================================
10834     AC_MSG_CHECKING([which rhino to use])
10835     if test "$with_system_rhino" = "yes"; then
10836         AC_MSG_RESULT([external])
10837         SYSTEM_RHINO=TRUE
10838         if test -z $RHINO_JAR; then
10839             RHINO_JAR=/usr/share/java/js.jar
10840         fi
10841         if ! test -f $RHINO_JAR; then
10842             AC_MSG_ERROR(js.jar not found.)
10843         fi
10844     else
10845         AC_MSG_RESULT([internal])
10846         SYSTEM_RHINO=
10847         BUILD_TYPE="$BUILD_TYPE RHINO"
10848         NEED_ANT=TRUE
10849     fi
10850 else
10851     AC_MSG_RESULT([no])
10852     ENABLE_SCRIPTING_JAVASCRIPT=
10853     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10855 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10856 AC_SUBST(SYSTEM_RHINO)
10857 AC_SUBST(RHINO_JAR)
10859 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10860 # paths should be added to library search path. So lets put all 64-bit
10861 # platforms there.
10862 supports_multilib=
10863 case "$host_cpu" in
10864 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10865     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10866         supports_multilib="yes"
10867     fi
10868     ;;
10870     ;;
10871 esac
10873 dnl ===================================================================
10874 dnl KDE4 Integration
10875 dnl ===================================================================
10877 KDE4_CFLAGS=""
10878 KDE4_LIBS=""
10879 QMAKE4="qmake"
10880 MOC4="moc"
10881 KDE4_GLIB_CFLAGS=""
10882 KDE4_GLIB_LIBS=""
10883 KDE4_HAVE_GLIB=""
10884 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10885     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10886     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10888     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10889     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10891     if test -n "$supports_multilib"; then
10892         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10893         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10894     fi
10896     if test -n "$QTDIR"; then
10897         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10898         if test -z "$supports_multilib"; then
10899             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10900         else
10901             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10902         fi
10903     fi
10904     if test -n "$QT4DIR"; then
10905         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10906         if test -z "$supports_multilib"; then
10907             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10908         else
10909             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10910         fi
10911     fi
10913     if test -n "$KDEDIR"; then
10914         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10915         if test -z "$supports_multilib"; then
10916             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10917         else
10918             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10919         fi
10920     fi
10921     if test -n "$KDE4DIR"; then
10922         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10923         if test -z "$supports_multilib"; then
10924             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10925         else
10926             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10927         fi
10928     fi
10930     qt4_test_include="Qt/qobject.h"
10931     qt4_test_library="libQtNetwork.so"
10932     kde4_test_include="kwindowsystem.h"
10933     kde4_test_library="libsolid.so"
10935     AC_MSG_CHECKING([for Qt4 headers])
10936     qt4_header_dir="no"
10937     for inc_dir in $qt4_incdirs; do
10938         if test -r "$inc_dir/$qt4_test_include"; then
10939             qt4_header_dir="$inc_dir"
10940             break
10941         fi
10942     done
10944     AC_MSG_RESULT([$qt4_header_dir])
10945     if test "x$qt4_header_dir" = "xno"; then
10946         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10947     fi
10949     dnl Check for qmake
10950     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10951     if test "$QMAKE4" = "no"; then
10952         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10953     else
10954         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10955         if test -z "$qmake4_test_ver"; then
10956             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10957         fi
10958     fi
10960     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10961     AC_MSG_CHECKING([for Qt4 libraries])
10962     qt4_lib_dir="no"
10963     for lib_dir in $qt4_libdirs; do
10964         if test -r "$lib_dir/$qt4_test_library"; then
10965             qt4_lib_dir="$lib_dir"
10966             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10967             break
10968         fi
10969     done
10971     AC_MSG_RESULT([$qt4_lib_dir])
10973     if test "x$qt4_lib_dir" = "xno"; then
10974         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10975     fi
10977     dnl Check for Meta Object Compiler
10979     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10980     MOC4="$MOCQT4"
10981     if test "$MOC4" = "no"; then
10982         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10983         if test "$MOC4" = "no"; then
10984             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10985 the root of your Qt installation by exporting QT4DIR before running "configure".])
10986         fi
10987     fi
10989     dnl Check for KDE4 headers
10990     AC_MSG_CHECKING([for KDE4 headers])
10991     kde4_incdir="no"
10992     for kde4_check in $kde4_incdirs; do
10993         if test -r "$kde4_check/$kde4_test_include"; then
10994             kde4_incdir="$kde4_check"
10995             break
10996         fi
10997     done
10998     AC_MSG_RESULT([$kde4_incdir])
10999     if test "x$kde4_incdir" = "xno"; then
11000         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11001     fi
11002     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11004     dnl Check for KDE4 libraries
11005     AC_MSG_CHECKING([for KDE4 libraries])
11006     kde4_libdir="no"
11007     for kde4_check in $kde4_libdirs; do
11008         if test -r "$kde4_check/$kde4_test_library"; then
11009             kde4_libdir="$kde4_check"
11010             break
11011         fi
11012     done
11014     AC_MSG_RESULT([$kde4_libdir])
11015     if test "x$kde4_libdir" = "xno"; then
11016         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11017     fi
11019     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11020     if ! test -z "$kde4_incdir"; then
11021         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11022     else
11023         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11024     fi
11026     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11027     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11028     FilterLibs "$KDE4_LIBS"
11029     KDE4_LIBS="$filteredlibs"
11031     AC_LANG_PUSH([C++])
11032     save_CXXFLAGS=$CXXFLAGS
11033     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11034     AC_MSG_CHECKING([whether KDE is >= 4.2])
11035        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11036 #include <kdeversion.h>
11038 int main(int argc, char **argv) {
11039        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11040        else return 1;
11042 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11043     CXXFLAGS=$save_CXXFLAGS
11044     AC_LANG_POP([C++])
11046     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11047     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11048     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11049         [
11050             KDE4_HAVE_GLIB=TRUE
11051             AC_DEFINE(KDE4_HAVE_GLIB,1)
11052             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11053             FilterLibs "${KDE4_GLIB_LIBS}"
11054             KDE4_GLIB_LIBS="${filteredlibs}"
11056             qt4_fix_warning=
11058             AC_LANG_PUSH([C++])
11059             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11060             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11061             #  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
11062             #               ^~~~~~~~~~~~~~~~~~~~~~~
11063             #               vptr for 'QObjectPrivate'
11064             # so temporarily ignore here whichever way would be used to make such errors fatal
11065             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11066             save_CXX=$CXX
11067             CXX=$(printf %s "$CXX" \
11068                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11069             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11070             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11071             save_CXXFLAGS=$CXXFLAGS
11072             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11073             save_LIBS=$LIBS
11074             LIBS="$LIBS $KDE4_LIBS"
11075             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11077             # Prepare meta object data
11078             TSTBASE="tst_exclude_socket_notifiers"
11079             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11080             ln -fs "${TSTMOC}.hxx"
11081             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11083             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11084 #include <cstdlib>
11085 #include "tst_exclude_socket_notifiers.moc"
11087 int main(int argc, char *argv[])
11089     QCoreApplication app(argc, argv);
11090     exit(tst_processEventsExcludeSocket());
11091     return 0;
11093             ]])],[
11094                 AC_MSG_RESULT([yes])
11095             ],[
11096                 AC_MSG_RESULT([no])
11097                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11098                 if test -z "$qt4_fix_warning"; then
11099                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11100                 fi
11101                 qt4_fix_warning=1
11102                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11103                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11105             # Remove meta object data
11106             rm -f "${TSTBASE}."*
11108             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11110             # Prepare meta object data
11111             TSTBASE="tst_exclude_posted_events"
11112             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11113             ln -fs "${TSTMOC}.hxx"
11114             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11116             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11117 #include <cstdlib>
11118 #include "tst_exclude_posted_events.moc"
11120 int main(int argc, char *argv[])
11122     QCoreApplication app(argc, argv);
11123     exit(tst_excludePostedEvents());
11124     return 0;
11126             ]])],[
11127                 AC_MSG_RESULT([yes])
11128             ],[
11129                 AC_MSG_RESULT([no])
11130                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11131                 if test -z "$qt4_fix_warning"; then
11132                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11133                 fi
11134                 qt4_fix_warning=1
11135                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11136             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11138             # Remove meta object data
11139             rm -f "${TSTBASE}."*
11141             if test -n "$qt4_fix_warning"; then
11142                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11143             fi
11145             LIBS=$save_LIBS
11146             CXXFLAGS=$save_CXXFLAGS
11147             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11148             CXX=$save_CXX
11149             AC_LANG_POP([C++])
11150         ],
11151         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11153 AC_SUBST(KDE4_CFLAGS)
11154 AC_SUBST(KDE4_LIBS)
11155 AC_SUBST(MOC4)
11156 AC_SUBST(KDE4_GLIB_CFLAGS)
11157 AC_SUBST(KDE4_GLIB_LIBS)
11158 AC_SUBST(KDE4_HAVE_GLIB)
11160 dnl ===================================================================
11161 dnl QT5 Integration
11162 dnl ===================================================================
11164 QT5_CFLAGS=""
11165 QT5_LIBS=""
11166 QMAKE5="qmake"
11167 MOC5="moc"
11168 QT5_GLIB_CFLAGS=""
11169 QT5_GLIB_LIBS=""
11170 QT5_HAVE_GLIB=""
11171 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11172         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11173         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11174 then
11175     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11176     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11178     if test -n "$supports_multilib"; then
11179         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11180     fi
11182     qt5_test_include="QtWidgets/qapplication.h"
11183     qt5_test_library="libQt5Widgets.so"
11185     dnl Check for qmake5
11186     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11187     if test "$QMAKE5" = "no"; then
11188         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11189     else
11190         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11191         if test -z "$qmake5_test_ver"; then
11192             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11193         fi
11194         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11195         qt5_minimal_minor="6"
11196         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11197             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11198         else
11199             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11200         fi
11201     fi
11203     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11204     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11206     AC_MSG_CHECKING([for Qt5 headers])
11207     qt5_incdir="no"
11208     for inc_dir in $qt5_incdirs; do
11209         if test -r "$inc_dir/$qt5_test_include"; then
11210             qt5_incdir="$inc_dir"
11211             break
11212         fi
11213     done
11214     AC_MSG_RESULT([$qt5_incdir])
11215     if test "x$qt5_incdir" = "xno"; then
11216         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11217     fi
11219     AC_MSG_CHECKING([for Qt5 libraries])
11220     qt5_libdir="no"
11221     for lib_dir in $qt5_libdirs; do
11222         if test -r "$lib_dir/$qt5_test_library"; then
11223             qt5_libdir="$lib_dir"
11224             break
11225         fi
11226     done
11227     AC_MSG_RESULT([$qt5_libdir])
11228     if test "x$qt5_libdir" = "xno"; then
11229         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11230     fi
11232     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11233     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11234     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11236     dnl Check for Meta Object Compiler
11238     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11239     if test "$MOC5" = "no"; then
11240         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11241 the root of your Qt installation by exporting QT5DIR before running "configure".])
11242     fi
11244     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11245     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11246     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11247         [
11248             QT5_HAVE_GLIB=1
11249             AC_DEFINE(QT5_HAVE_GLIB,1)
11250         ],
11251         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11252     )
11254 AC_SUBST(QT5_CFLAGS)
11255 AC_SUBST(QT5_LIBS)
11256 AC_SUBST(MOC5)
11257 AC_SUBST(QT5_GLIB_CFLAGS)
11258 AC_SUBST(QT5_GLIB_LIBS)
11259 AC_SUBST(QT5_HAVE_GLIB)
11261 dnl ===================================================================
11262 dnl KDE5 Integration
11263 dnl ===================================================================
11265 KF5_CFLAGS=""
11266 KF5_LIBS=""
11267 KF5_CONFIG="kf5-config"
11268 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11269         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11270         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11271 then
11272     if test "$OS" = "HAIKU"; then
11273         haiku_arch="`echo $RTL_ARCH | tr X x`"
11274         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11275         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11276     fi
11278     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11279     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11280     if test -n "$supports_multilib"; then
11281         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11282     fi
11284     kf5_test_include="KF5/kcoreaddons_version.h"
11285     kf5_test_library="libKF5CoreAddons.so"
11286     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11288     dnl kf5 KDE4 support compatibility installed
11289     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11290     if test "$KF5_CONFIG" != "no"; then
11291         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11292         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11293     fi
11295     dnl Check for KF5 headers
11296     AC_MSG_CHECKING([for KF5 headers])
11297     kf5_incdir="no"
11298     for kf5_check in $kf5_incdirs; do
11299         if test -r "$kf5_check/$kf5_test_include"; then
11300             kf5_incdir="$kf5_check/KF5"
11301             break
11302         fi
11303     done
11304     AC_MSG_RESULT([$kf5_incdir])
11305     if test "x$kf5_incdir" = "xno"; then
11306         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11307     fi
11309     dnl Check for KF5 libraries
11310     AC_MSG_CHECKING([for KF5 libraries])
11311     kf5_libdir="no"
11312     for kf5_check in $kf5_libdirs; do
11313         if test -r "$kf5_check/$kf5_test_library"; then
11314             kf5_libdir="$kf5_check"
11315             break
11316         fi
11317     done
11319     AC_MSG_RESULT([$kf5_libdir])
11320     if test "x$kf5_libdir" = "xno"; then
11321         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11322     fi
11324     if test "$USING_X11" = TRUE; then
11325         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11326     fi
11328     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"
11329     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11330     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11332     if test "$USING_X11" = TRUE; then
11333         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11334     fi
11336     AC_LANG_PUSH([C++])
11337     save_CXXFLAGS=$CXXFLAGS
11338     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11339     AC_MSG_CHECKING([whether KDE is >= 5.0])
11340        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11341 #include <kcoreaddons_version.h>
11343 int main(int argc, char **argv) {
11344        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11345        else return 1;
11347        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11348     CXXFLAGS=$save_CXXFLAGS
11349     AC_LANG_POP([C++])
11351 AC_SUBST(KF5_CFLAGS)
11352 AC_SUBST(KF5_LIBS)
11354 dnl ===================================================================
11355 dnl Test whether to include Evolution 2 support
11356 dnl ===================================================================
11357 AC_MSG_CHECKING([whether to enable evolution 2 support])
11358 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11359     AC_MSG_RESULT([yes])
11360     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11361     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11362     FilterLibs "${GOBJECT_LIBS}"
11363     GOBJECT_LIBS="${filteredlibs}"
11364     ENABLE_EVOAB2="TRUE"
11365 else
11366     ENABLE_EVOAB2=""
11367     AC_MSG_RESULT([no])
11369 AC_SUBST(ENABLE_EVOAB2)
11370 AC_SUBST(GOBJECT_CFLAGS)
11371 AC_SUBST(GOBJECT_LIBS)
11373 dnl ===================================================================
11374 dnl Test which themes to include
11375 dnl ===================================================================
11376 AC_MSG_CHECKING([which themes to include])
11377 # if none given use default subset of available themes
11378 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11379     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_dark tango"
11382 WITH_THEMES=""
11383 if test "x$with_theme" != "xno"; then
11384     for theme in $with_theme; do
11385         case $theme in
11386         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11387         default) real_theme=colibre ;;
11388         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11389         esac
11390         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11391     done
11393 AC_MSG_RESULT([$WITH_THEMES])
11394 AC_SUBST([WITH_THEMES])
11395 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11396 for theme in $with_theme; do
11397     case $theme in
11398     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11399     *) ;;
11400     esac
11401 done
11403 dnl ===================================================================
11404 dnl Test whether to integrate helppacks into the product's installer
11405 dnl ===================================================================
11406 AC_MSG_CHECKING([for helppack integration])
11407 if test "$with_helppack_integration" = "no"; then
11408     AC_MSG_RESULT([no integration])
11409 else
11410     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11411     AC_MSG_RESULT([integration])
11414 ###############################################################################
11415 # Extensions checking
11416 ###############################################################################
11417 AC_MSG_CHECKING([for extensions integration])
11418 if test "x$enable_extension_integration" != "xno"; then
11419     WITH_EXTENSION_INTEGRATION=TRUE
11420     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11421     AC_MSG_RESULT([yes, use integration])
11422 else
11423     WITH_EXTENSION_INTEGRATION=
11424     AC_MSG_RESULT([no, do not integrate])
11426 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11428 dnl Should any extra extensions be included?
11429 dnl There are standalone tests for each of these below.
11430 WITH_EXTRA_EXTENSIONS=
11431 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11433 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11434 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11435 if test "x$with_java" != "xno"; then
11436     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11437     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11440 AC_MSG_CHECKING([whether to build opens___.ttf])
11441 if test "$enable_build_opensymbol" = "yes"; then
11442     AC_MSG_RESULT([yes])
11443     AC_PATH_PROG(FONTFORGE, fontforge)
11444     if test -z "$FONTFORGE"; then
11445         AC_MSG_ERROR([fontforge not installed])
11446     fi
11447 else
11448     AC_MSG_RESULT([no])
11449     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11450     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11452 AC_SUBST(OPENSYMBOL_TTF)
11453 AC_SUBST(FONTFORGE)
11455 dnl ===================================================================
11456 dnl Test whether to include fonts
11457 dnl ===================================================================
11458 AC_MSG_CHECKING([whether to include third-party fonts])
11459 if test "$with_fonts" != "no"; then
11460     AC_MSG_RESULT([yes])
11461     WITH_FONTS=TRUE
11462     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11463     AC_DEFINE(HAVE_MORE_FONTS)
11464 else
11465     AC_MSG_RESULT([no])
11466     WITH_FONTS=
11467     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11469 AC_SUBST(WITH_FONTS)
11472 dnl ===================================================================
11473 dnl Test whether to enable online update service
11474 dnl ===================================================================
11475 AC_MSG_CHECKING([whether to enable online update])
11476 ENABLE_ONLINE_UPDATE=
11477 ENABLE_ONLINE_UPDATE_MAR=
11478 UPDATE_CONFIG=
11479 if test "$enable_online_update" = ""; then
11480     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11481         AC_MSG_RESULT([yes])
11482         ENABLE_ONLINE_UPDATE="TRUE"
11483     else
11484         AC_MSG_RESULT([no])
11485     fi
11486 else
11487     if test "$enable_online_update" = "mar"; then
11488         AC_MSG_RESULT([yes - MAR-based online update])
11489         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11490         if test "$with_update_config" = ""; then
11491             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11492         fi
11493         UPDATE_CONFIG="$with_update_config"
11494         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11495     elif test "$enable_online_update" = "yes"; then
11496         AC_MSG_RESULT([yes])
11497         ENABLE_ONLINE_UPDATE="TRUE"
11498     else
11499         AC_MSG_RESULT([no])
11500     fi
11502 AC_SUBST(ENABLE_ONLINE_UPDATE)
11503 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11504 AC_SUBST(UPDATE_CONFIG)
11506 dnl ===================================================================
11507 dnl Test whether we need bzip2
11508 dnl ===================================================================
11509 SYSTEM_BZIP2=
11510 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11511     AC_MSG_CHECKING([whether to use system bzip2])
11512     if test "$with_system_bzip2" = yes; then
11513         SYSTEM_BZIP2=TRUE
11514         AC_MSG_RESULT([yes])
11515         PKG_CHECK_MODULES(BZIP2, bzip2)
11516         FilterLibs "${BZIP2_LIBS}"
11517         BZIP2_LIBS="${filteredlibs}"
11518     else
11519         AC_MSG_RESULT([no])
11520         BUILD_TYPE="$BUILD_TYPE BZIP2"
11521     fi
11523 AC_SUBST(SYSTEM_BZIP2)
11524 AC_SUBST(BZIP2_CFLAGS)
11525 AC_SUBST(BZIP2_LIBS)
11527 dnl ===================================================================
11528 dnl Test whether to enable extension update
11529 dnl ===================================================================
11530 AC_MSG_CHECKING([whether to enable extension update])
11531 ENABLE_EXTENSION_UPDATE=
11532 if test "x$enable_extension_update" = "xno"; then
11533     AC_MSG_RESULT([no])
11534 else
11535     AC_MSG_RESULT([yes])
11536     ENABLE_EXTENSION_UPDATE="TRUE"
11537     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11538     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11540 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11543 dnl ===================================================================
11544 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11545 dnl ===================================================================
11546 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11547 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11548     AC_MSG_RESULT([no])
11549     ENABLE_SILENT_MSI=
11550 else
11551     AC_MSG_RESULT([yes])
11552     ENABLE_SILENT_MSI=TRUE
11553     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11555 AC_SUBST(ENABLE_SILENT_MSI)
11557 AC_MSG_CHECKING([whether and how to use Xinerama])
11558 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11559     if test "$x_libraries" = "default_x_libraries"; then
11560         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11561         if test "x$XINERAMALIB" = x; then
11562            XINERAMALIB="/usr/lib"
11563         fi
11564     else
11565         XINERAMALIB="$x_libraries"
11566     fi
11567     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11568         # we have both versions, let the user decide but use the dynamic one
11569         # per default
11570         USE_XINERAMA=TRUE
11571         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11572             XINERAMA_LINK=dynamic
11573         else
11574             XINERAMA_LINK=static
11575         fi
11576     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11577         # we have only the dynamic version
11578         USE_XINERAMA=TRUE
11579         XINERAMA_LINK=dynamic
11580     elif test -e "$XINERAMALIB/libXinerama.a"; then
11581         # static version
11582         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11583             USE_XINERAMA=TRUE
11584             XINERAMA_LINK=static
11585         else
11586             USE_XINERAMA=
11587             XINERAMA_LINK=none
11588         fi
11589     else
11590         # no Xinerama
11591         USE_XINERAMA=
11592         XINERAMA_LINK=none
11593     fi
11594     if test "$USE_XINERAMA" = "TRUE"; then
11595         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11596         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11597             [AC_MSG_ERROR(Xinerama header not found.)], [])
11598         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11599         if test "x$XEXTLIB" = x; then
11600            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11601         fi
11602         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11603         if test "$_os" = "FreeBSD"; then
11604             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11605         fi
11606         if test "$_os" = "Linux"; then
11607             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11608         fi
11609         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11610             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11611     else
11612         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11613     fi
11614 else
11615     USE_XINERAMA=
11616     XINERAMA_LINK=none
11617     AC_MSG_RESULT([no])
11619 AC_SUBST(USE_XINERAMA)
11620 AC_SUBST(XINERAMA_LINK)
11622 dnl ===================================================================
11623 dnl Test whether to build cairo or rely on the system version
11624 dnl ===================================================================
11626 if test "$USING_X11" = TRUE; then
11627     # Used in vcl/Library_vclplug_gen.mk
11628     test_cairo=yes
11631 if test "$test_cairo" = "yes"; then
11632     AC_MSG_CHECKING([whether to use the system cairo])
11634     : ${with_system_cairo:=$with_system_libs}
11635     if test "$with_system_cairo" = "yes"; then
11636         SYSTEM_CAIRO=TRUE
11637         AC_MSG_RESULT([yes])
11639         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11640         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11641         FilterLibs "${CAIRO_LIBS}"
11642         CAIRO_LIBS="${filteredlibs}"
11644         if test "$test_xrender" = "yes"; then
11645             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11646             AC_LANG_PUSH([C])
11647             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11648 #ifdef PictStandardA8
11649 #else
11650       return fail;
11651 #endif
11652 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11654             AC_LANG_POP([C])
11655         fi
11656     else
11657         SYSTEM_CAIRO=
11658         AC_MSG_RESULT([no])
11660         BUILD_TYPE="$BUILD_TYPE CAIRO"
11661     fi
11664 AC_SUBST(SYSTEM_CAIRO)
11665 AC_SUBST(CAIRO_CFLAGS)
11666 AC_SUBST(CAIRO_LIBS)
11668 dnl ===================================================================
11669 dnl Test whether to use avahi
11670 dnl ===================================================================
11671 if test "$_os" = "WINNT"; then
11672     # Windows uses bundled mDNSResponder
11673     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11674 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11675     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11676                       [ENABLE_AVAHI="TRUE"])
11677     AC_DEFINE(HAVE_FEATURE_AVAHI)
11678     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11679     FilterLibs "${AVAHI_LIBS}"
11680     AVAHI_LIBS="${filteredlibs}"
11683 AC_SUBST(ENABLE_AVAHI)
11684 AC_SUBST(AVAHI_CFLAGS)
11685 AC_SUBST(AVAHI_LIBS)
11687 dnl ===================================================================
11688 dnl Test whether to use liblangtag
11689 dnl ===================================================================
11690 SYSTEM_LIBLANGTAG=
11691 AC_MSG_CHECKING([whether to use system liblangtag])
11692 if test "$with_system_liblangtag" = yes; then
11693     SYSTEM_LIBLANGTAG=TRUE
11694     AC_MSG_RESULT([yes])
11695     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11696     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11697     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11698     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11699     FilterLibs "${LIBLANGTAG_LIBS}"
11700     LIBLANGTAG_LIBS="${filteredlibs}"
11701 else
11702     SYSTEM_LIBLANGTAG=
11703     AC_MSG_RESULT([no])
11704     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11705     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11706     if test "$COM" = "MSC"; then
11707         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11708     else
11709         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11710     fi
11712 AC_SUBST(SYSTEM_LIBLANGTAG)
11713 AC_SUBST(LIBLANGTAG_CFLAGS)
11714 AC_SUBST(LIBLANGTAG_LIBS)
11716 dnl ===================================================================
11717 dnl Test whether to build libpng or rely on the system version
11718 dnl ===================================================================
11720 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11722 dnl ===================================================================
11723 dnl Check for runtime JVM search path
11724 dnl ===================================================================
11725 if test "$ENABLE_JAVA" != ""; then
11726     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11727     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11728         AC_MSG_RESULT([yes])
11729         if ! test -d "$with_jvm_path"; then
11730             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11731         fi
11732         if ! test -d "$with_jvm_path"jvm; then
11733             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11734         fi
11735         JVM_ONE_PATH_CHECK="$with_jvm_path"
11736         AC_SUBST(JVM_ONE_PATH_CHECK)
11737     else
11738         AC_MSG_RESULT([no])
11739     fi
11742 dnl ===================================================================
11743 dnl Test for the presence of Ant and that it works
11744 dnl ===================================================================
11746 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11747     ANT_HOME=; export ANT_HOME
11748     WITH_ANT_HOME=; export WITH_ANT_HOME
11749     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11750         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11751             if test "$_os" = "WINNT"; then
11752                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11753             else
11754                 with_ant_home="$LODE_HOME/opt/ant"
11755             fi
11756         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11757             with_ant_home="$LODE_HOME/opt/ant"
11758         fi
11759     fi
11760     if test -z "$with_ant_home"; then
11761         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11762     else
11763         if test "$_os" = "WINNT"; then
11764             # AC_PATH_PROGS needs unix path
11765             with_ant_home=`cygpath -u "$with_ant_home"`
11766         fi
11767         AbsolutePath "$with_ant_home"
11768         with_ant_home=$absolute_path
11769         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11770         WITH_ANT_HOME=$with_ant_home
11771         ANT_HOME=$with_ant_home
11772     fi
11774     if test -z "$ANT"; then
11775         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11776     else
11777         # resolve relative or absolute symlink
11778         while test -h "$ANT"; do
11779             a_cwd=`pwd`
11780             a_basename=`basename "$ANT"`
11781             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11782             cd "`dirname "$ANT"`"
11783             cd "`dirname "$a_script"`"
11784             ANT="`pwd`"/"`basename "$a_script"`"
11785             cd "$a_cwd"
11786         done
11788         AC_MSG_CHECKING([if $ANT works])
11789         mkdir -p conftest.dir
11790         a_cwd=$(pwd)
11791         cd conftest.dir
11792         cat > conftest.java << EOF
11793         public class conftest {
11794             int testmethod(int a, int b) {
11795                     return a + b;
11796             }
11797         }
11800         cat > conftest.xml << EOF
11801         <project name="conftest" default="conftest">
11802         <target name="conftest">
11803             <javac srcdir="." includes="conftest.java">
11804             </javac>
11805         </target>
11806         </project>
11809         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11810         if test $? = 0 -a -f ./conftest.class; then
11811             AC_MSG_RESULT([Ant works])
11812             if test -z "$WITH_ANT_HOME"; then
11813                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11814                 if test -z "$ANT_HOME"; then
11815                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11816                 fi
11817             else
11818                 ANT_HOME="$WITH_ANT_HOME"
11819             fi
11820         else
11821             echo "configure: Ant test failed" >&5
11822             cat conftest.java >&5
11823             cat conftest.xml >&5
11824             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11825         fi
11826         cd "$a_cwd"
11827         rm -fr conftest.dir
11828     fi
11829     if test -z "$ANT_HOME"; then
11830         ANT_HOME="NO_ANT_HOME"
11831     else
11832         PathFormat "$ANT_HOME"
11833         ANT_HOME="$formatted_path"
11834         PathFormat "$ANT"
11835         ANT="$formatted_path"
11836     fi
11837     AC_SUBST(ANT_HOME)
11838     AC_SUBST(ANT)
11840     dnl Checking for ant.jar
11841     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11842         AC_MSG_CHECKING([Ant lib directory])
11843         if test -f $ANT_HOME/lib/ant.jar; then
11844             ANT_LIB="$ANT_HOME/lib"
11845         else
11846             if test -f $ANT_HOME/ant.jar; then
11847                 ANT_LIB="$ANT_HOME"
11848             else
11849                 if test -f /usr/share/java/ant.jar; then
11850                     ANT_LIB=/usr/share/java
11851                 else
11852                     if test -f /usr/share/ant-core/lib/ant.jar; then
11853                         ANT_LIB=/usr/share/ant-core/lib
11854                     else
11855                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11856                             ANT_LIB="$ANT_HOME/lib/ant"
11857                         else
11858                             if test -f /usr/share/lib/ant/ant.jar; then
11859                                 ANT_LIB=/usr/share/lib/ant
11860                             else
11861                                 AC_MSG_ERROR([Ant libraries not found!])
11862                             fi
11863                         fi
11864                     fi
11865                 fi
11866             fi
11867         fi
11868         PathFormat "$ANT_LIB"
11869         ANT_LIB="$formatted_path"
11870         AC_MSG_RESULT([Ant lib directory found.])
11871     fi
11872     AC_SUBST(ANT_LIB)
11874     ant_minver=1.6.0
11875     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11877     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11878     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11879     ant_version_major=`echo $ant_version | cut -d. -f1`
11880     ant_version_minor=`echo $ant_version | cut -d. -f2`
11881     echo "configure: ant_version $ant_version " >&5
11882     echo "configure: ant_version_major $ant_version_major " >&5
11883     echo "configure: ant_version_minor $ant_version_minor " >&5
11884     if test "$ant_version_major" -ge "2"; then
11885         AC_MSG_RESULT([yes, $ant_version])
11886     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11887         AC_MSG_RESULT([yes, $ant_version])
11888     else
11889         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11890     fi
11892     rm -f conftest* core core.* *.core
11895 OOO_JUNIT_JAR=
11896 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11897     AC_MSG_CHECKING([for JUnit 4])
11898     if test "$with_junit" = "yes"; then
11899         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11900             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11901         elif test -e /usr/share/java/junit4.jar; then
11902             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11903         else
11904            if test -e /usr/share/lib/java/junit.jar; then
11905               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11906            else
11907               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11908            fi
11909         fi
11910     else
11911         OOO_JUNIT_JAR=$with_junit
11912     fi
11913     if test "$_os" = "WINNT"; then
11914         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11915     fi
11916     printf 'import org.junit.Before;' > conftest.java
11917     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11918         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11919     else
11920         AC_MSG_ERROR(
11921 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11922  specify its pathname via --with-junit=..., or disable it via --without-junit])
11923     fi
11924     rm -f conftest.class conftest.java
11925     if test $OOO_JUNIT_JAR != ""; then
11926     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11927     fi
11929 AC_SUBST(OOO_JUNIT_JAR)
11931 HAMCREST_JAR=
11932 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11933     AC_MSG_CHECKING([for included Hamcrest])
11934     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11935     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11936         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11937     else
11938         AC_MSG_RESULT([Not included])
11939         AC_MSG_CHECKING([for standalone hamcrest jar.])
11940         if test "$with_hamcrest" = "yes"; then
11941             if test -e /usr/share/lib/java/hamcrest.jar; then
11942                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11943             elif test -e /usr/share/java/hamcrest/core.jar; then
11944                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11945             else
11946                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11947             fi
11948         else
11949             HAMCREST_JAR=$with_hamcrest
11950         fi
11951         if test "$_os" = "WINNT"; then
11952             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11953         fi
11954         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11955             AC_MSG_RESULT([$HAMCREST_JAR])
11956         else
11957             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),
11958                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11959         fi
11960     fi
11961     rm -f conftest.class conftest.java
11963 AC_SUBST(HAMCREST_JAR)
11966 AC_SUBST(SCPDEFS)
11969 # check for wget and curl
11971 WGET=
11972 CURL=
11974 if test "$enable_fetch_external" != "no"; then
11976 CURL=`which curl 2>/dev/null`
11978 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11979     # wget new enough?
11980     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11981     if test $? -eq 0; then
11982         WGET=$i
11983         break
11984     fi
11985 done
11987 if test -z "$WGET" -a -z "$CURL"; then
11988     AC_MSG_ERROR([neither wget nor curl found!])
11993 AC_SUBST(WGET)
11994 AC_SUBST(CURL)
11997 # check for sha256sum
11999 SHA256SUM=
12001 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12002     eval "$i -a 256 --version" > /dev/null 2>&1
12003     ret=$?
12004     if test $ret -eq 0; then
12005         SHA256SUM="$i -a 256"
12006         break
12007     fi
12008 done
12010 if test -z "$SHA256SUM"; then
12011     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12012         eval "$i --version" > /dev/null 2>&1
12013         ret=$?
12014         if test $ret -eq 0; then
12015             SHA256SUM=$i
12016             break
12017         fi
12018     done
12021 if test -z "$SHA256SUM"; then
12022     AC_MSG_ERROR([no sha256sum found!])
12025 AC_SUBST(SHA256SUM)
12027 dnl ===================================================================
12028 dnl Dealing with l10n options
12029 dnl ===================================================================
12030 AC_MSG_CHECKING([which languages to be built])
12031 # get list of all languages
12032 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12033 # the sed command does the following:
12034 #   + if a line ends with a backslash, append the next line to it
12035 #   + adds " on the beginning of the value (after =)
12036 #   + adds " at the end of the value
12037 #   + removes en-US; we want to put it on the beginning
12038 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12039 [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)]
12040 ALL_LANGS="en-US $completelangiso"
12041 # check the configured localizations
12042 WITH_LANG="$with_lang"
12044 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12045 # (Norwegian is "nb" and "nn".)
12046 if test "$WITH_LANG" = "no"; then
12047     WITH_LANG=
12050 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12051     AC_MSG_RESULT([en-US])
12052 else
12053     AC_MSG_RESULT([$WITH_LANG])
12054     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12055     if test -z "$MSGFMT"; then
12056         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12057             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12058         elif test -x "/opt/lo/bin/msgfmt"; then
12059             MSGFMT="/opt/lo/bin/msgfmt"
12060         else
12061             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12062             if test -z "$MSGFMT"; then
12063                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12064             fi
12065         fi
12066     fi
12067     if test -z "$MSGUNIQ"; then
12068         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12069             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12070         elif test -x "/opt/lo/bin/msguniq"; then
12071             MSGUNIQ="/opt/lo/bin/msguniq"
12072         else
12073             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12074             if test -z "$MSGUNIQ"; then
12075                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12076             fi
12077         fi
12078     fi
12080 AC_SUBST(MSGFMT)
12081 AC_SUBST(MSGUNIQ)
12082 # check that the list is valid
12083 for lang in $WITH_LANG; do
12084     test "$lang" = "ALL" && continue
12085     # need to check for the exact string, so add space before and after the list of all languages
12086     for vl in $ALL_LANGS; do
12087         if test "$vl" = "$lang"; then
12088            break
12089         fi
12090     done
12091     if test "$vl" != "$lang"; then
12092         # if you're reading this - you prolly quoted your languages remove the quotes ...
12093         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12094     fi
12095 done
12096 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12097     echo $WITH_LANG | grep -q en-US
12098     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12100 # list with substituted ALL
12101 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12102 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12103 test "$WITH_LANG" = "en-US" && WITH_LANG=
12104 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12105     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12106     ALL_LANGS=`echo $ALL_LANGS qtz`
12108 AC_SUBST(ALL_LANGS)
12109 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12110 AC_SUBST(WITH_LANG)
12111 AC_SUBST(WITH_LANG_LIST)
12112 AC_SUBST(GIT_NEEDED_SUBMODULES)
12114 WITH_POOR_HELP_LOCALIZATIONS=
12115 if test -d "$SRC_ROOT/translations/source"; then
12116     for l in `ls -1 $SRC_ROOT/translations/source`; do
12117         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12118             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12119         fi
12120     done
12122 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12124 if test -n "$with_locales"; then
12125     WITH_LOCALES="$with_locales"
12127     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12128     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12129     # config_host/config_locales.h.in
12130     for locale in $WITH_LOCALES; do
12131         lang=${locale%_*}
12133         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12135         case $lang in
12136         hi|mr*ne)
12137             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12138             ;;
12139         bg|ru)
12140             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12141             ;;
12142         esac
12143     done
12144 else
12145     AC_DEFINE(WITH_LOCALE_ALL)
12147 AC_SUBST(WITH_LOCALES)
12149 dnl git submodule update --reference
12150 dnl ===================================================================
12151 if test -n "${GIT_REFERENCE_SRC}"; then
12152     for repo in ${GIT_NEEDED_SUBMODULES}; do
12153         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12154             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12155         fi
12156     done
12158 AC_SUBST(GIT_REFERENCE_SRC)
12160 dnl git submodules linked dirs
12161 dnl ===================================================================
12162 if test -n "${GIT_LINK_SRC}"; then
12163     for repo in ${GIT_NEEDED_SUBMODULES}; do
12164         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12165             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12166         fi
12167     done
12169 AC_SUBST(GIT_LINK_SRC)
12171 dnl branding
12172 dnl ===================================================================
12173 AC_MSG_CHECKING([for alternative branding images directory])
12174 # initialize mapped arrays
12175 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12176 brand_files="$BRAND_INTRO_IMAGES about.svg"
12178 if test -z "$with_branding" -o "$with_branding" = "no"; then
12179     AC_MSG_RESULT([none])
12180     DEFAULT_BRAND_IMAGES="$brand_files"
12181 else
12182     if ! test -d $with_branding ; then
12183         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12184     else
12185         AC_MSG_RESULT([$with_branding])
12186         CUSTOM_BRAND_DIR="$with_branding"
12187         for lfile in $brand_files
12188         do
12189             if ! test -f $with_branding/$lfile ; then
12190                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12191                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12192             else
12193                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12194             fi
12195         done
12196         check_for_progress="yes"
12197     fi
12199 AC_SUBST([BRAND_INTRO_IMAGES])
12200 AC_SUBST([CUSTOM_BRAND_DIR])
12201 AC_SUBST([CUSTOM_BRAND_IMAGES])
12202 AC_SUBST([DEFAULT_BRAND_IMAGES])
12205 AC_MSG_CHECKING([for 'intro' progress settings])
12206 PROGRESSBARCOLOR=
12207 PROGRESSSIZE=
12208 PROGRESSPOSITION=
12209 PROGRESSFRAMECOLOR=
12210 PROGRESSTEXTCOLOR=
12211 PROGRESSTEXTBASELINE=
12213 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12214     source "$with_branding/progress.conf"
12215     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12216 else
12217     AC_MSG_RESULT([none])
12220 AC_SUBST(PROGRESSBARCOLOR)
12221 AC_SUBST(PROGRESSSIZE)
12222 AC_SUBST(PROGRESSPOSITION)
12223 AC_SUBST(PROGRESSFRAMECOLOR)
12224 AC_SUBST(PROGRESSTEXTCOLOR)
12225 AC_SUBST(PROGRESSTEXTBASELINE)
12228 AC_MSG_CHECKING([for extra build ID])
12229 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12230     EXTRA_BUILDID="$with_extra_buildid"
12232 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12233 if test -n "$EXTRA_BUILDID" ; then
12234     AC_MSG_RESULT([$EXTRA_BUILDID])
12235 else
12236     AC_MSG_RESULT([not set])
12238 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12240 OOO_VENDOR=
12241 AC_MSG_CHECKING([for vendor])
12242 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12243     OOO_VENDOR="$USERNAME"
12245     if test -z "$OOO_VENDOR"; then
12246         OOO_VENDOR="$USER"
12247     fi
12249     if test -z "$OOO_VENDOR"; then
12250         OOO_VENDOR="`id -u -n`"
12251     fi
12253     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12254 else
12255     OOO_VENDOR="$with_vendor"
12256     AC_MSG_RESULT([$OOO_VENDOR])
12258 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12259 AC_SUBST(OOO_VENDOR)
12261 if test "$_os" = "Android" ; then
12262     ANDROID_PACKAGE_NAME=
12263     AC_MSG_CHECKING([for Android package name])
12264     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12265         if test -n "$ENABLE_DEBUG"; then
12266             # Default to the package name that makes ndk-gdb happy.
12267             ANDROID_PACKAGE_NAME="org.libreoffice"
12268         else
12269             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12270         fi
12272         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12273     else
12274         ANDROID_PACKAGE_NAME="$with_android_package_name"
12275         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12276     fi
12277     AC_SUBST(ANDROID_PACKAGE_NAME)
12280 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12281 if test "$with_compat_oowrappers" = "yes"; then
12282     WITH_COMPAT_OOWRAPPERS=TRUE
12283     AC_MSG_RESULT(yes)
12284 else
12285     WITH_COMPAT_OOWRAPPERS=
12286     AC_MSG_RESULT(no)
12288 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12290 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12291 AC_MSG_CHECKING([for install dirname])
12292 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12293     INSTALLDIRNAME="$with_install_dirname"
12295 AC_MSG_RESULT([$INSTALLDIRNAME])
12296 AC_SUBST(INSTALLDIRNAME)
12298 AC_MSG_CHECKING([for prefix])
12299 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12300 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12301 PREFIXDIR="$prefix"
12302 AC_MSG_RESULT([$PREFIXDIR])
12303 AC_SUBST(PREFIXDIR)
12305 LIBDIR=[$(eval echo $(eval echo $libdir))]
12306 AC_SUBST(LIBDIR)
12308 DATADIR=[$(eval echo $(eval echo $datadir))]
12309 AC_SUBST(DATADIR)
12311 MANDIR=[$(eval echo $(eval echo $mandir))]
12312 AC_SUBST(MANDIR)
12314 DOCDIR=[$(eval echo $(eval echo $docdir))]
12315 AC_SUBST(DOCDIR)
12317 BINDIR=[$(eval echo $(eval echo $bindir))]
12318 AC_SUBST(BINDIR)
12320 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12321 AC_SUBST(INSTALLDIR)
12323 TESTINSTALLDIR="${BUILDDIR}/test-install"
12324 AC_SUBST(TESTINSTALLDIR)
12327 # ===================================================================
12328 # OAuth2 id and secrets
12329 # ===================================================================
12331 AC_MSG_CHECKING([for Google Drive client id and secret])
12332 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12333     AC_MSG_RESULT([not set])
12334     GDRIVE_CLIENT_ID="\"\""
12335     GDRIVE_CLIENT_SECRET="\"\""
12336 else
12337     AC_MSG_RESULT([set])
12338     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12339     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12341 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12342 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12344 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12345 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12346     AC_MSG_RESULT([not set])
12347     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12348     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12349 else
12350     AC_MSG_RESULT([set])
12351     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12352     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12354 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12355 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12357 AC_MSG_CHECKING([for OneDrive client id and secret])
12358 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12359     AC_MSG_RESULT([not set])
12360     ONEDRIVE_CLIENT_ID="\"\""
12361     ONEDRIVE_CLIENT_SECRET="\"\""
12362 else
12363     AC_MSG_RESULT([set])
12364     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12365     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12367 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12368 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12371 dnl ===================================================================
12372 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12373 dnl --enable-dependency-tracking configure option
12374 dnl ===================================================================
12375 AC_MSG_CHECKING([whether to enable dependency tracking])
12376 if test "$enable_dependency_tracking" = "no"; then
12377     nodep=TRUE
12378     AC_MSG_RESULT([no])
12379 else
12380     AC_MSG_RESULT([yes])
12382 AC_SUBST(nodep)
12384 dnl ===================================================================
12385 dnl Number of CPUs to use during the build
12386 dnl ===================================================================
12387 AC_MSG_CHECKING([for number of processors to use])
12388 # plain --with-parallelism is just the default
12389 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12390     if test "$with_parallelism" = "no"; then
12391         PARALLELISM=0
12392     else
12393         PARALLELISM=$with_parallelism
12394     fi
12395 else
12396     if test "$enable_icecream" = "yes"; then
12397         PARALLELISM="10"
12398     else
12399         case `uname -s` in
12401         Darwin|FreeBSD|NetBSD|OpenBSD)
12402             PARALLELISM=`sysctl -n hw.ncpu`
12403             ;;
12405         Linux)
12406             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12407         ;;
12408         # what else than above does profit here *and* has /proc?
12409         *)
12410             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12411             ;;
12412         esac
12414         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12415         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12416     fi
12419 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12420     if test -z "$with_parallelism"; then
12421             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12422             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12423             PARALLELISM="1"
12424     else
12425         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."
12426     fi
12429 if test $PARALLELISM -eq 0; then
12430     AC_MSG_RESULT([explicit make -j option needed])
12431 else
12432     AC_MSG_RESULT([$PARALLELISM])
12434 AC_SUBST(PARALLELISM)
12436 IWYU_PATH="$with_iwyu"
12437 AC_SUBST(IWYU_PATH)
12438 if test ! -z "$IWYU_PATH"; then
12439     if test ! -f "$IWYU_PATH"; then
12440         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12441     fi
12445 # Set up ILIB for MSVC build
12447 ILIB1=
12448 if test "$build_os" = "cygwin"; then
12449     ILIB="."
12450     if test -n "$JAVA_HOME"; then
12451         ILIB="$ILIB;$JAVA_HOME/lib"
12452     fi
12453     ILIB1=-link
12454     if test "$BITNESS_OVERRIDE" = 64; then
12455         ILIB="$ILIB;$COMPATH/lib/x64"
12456         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12457         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12458         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12459         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12460             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12461             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12462         fi
12463         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12464         ucrtlibpath_formatted=$formatted_path
12465         ILIB="$ILIB;$ucrtlibpath_formatted"
12466         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12467     else
12468         ILIB="$ILIB;$COMPATH/lib/x86"
12469         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12470         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12471         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12472         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12473             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12474             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12475         fi
12476         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12477         ucrtlibpath_formatted=$formatted_path
12478         ILIB="$ILIB;$ucrtlibpath_formatted"
12479         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12480     fi
12481     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12482         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12483     else
12484         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12485     fi
12487     AC_SUBST(ILIB)
12490 AC_MSG_CHECKING([whether $CXX supports inline variables])
12491 AC_LANG_PUSH([C++])
12492 save_CXXFLAGS=$CXXFLAGS
12493 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12494 if test "$build_os" = cygwin; then
12495     save_LIB=$LIB
12496     export LIB=$ILIB
12498 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12499         #if !defined __cpp_inline_variables
12500         // This tests for one specific aspect of inline variables that is actually used by
12501         // ORegistry::ROOT (registry/source/regimpl.cxx):
12502         struct S { constexpr S() {} };
12503         struct T { static constexpr S s{}; };
12504         S const * f() { return &T::s; }
12505         #endif
12506     ]])], [
12507         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
12508         AC_MSG_RESULT([yes])
12509     ], [AC_MSG_RESULT([no])])
12510 CXXFLAGS=$save_CXXFLAGS
12511 if test "$build_os" = cygwin; then
12512     LIB=$save_LIB
12514 AC_LANG_POP([C++])
12516 dnl We should be able to drop the below check when bumping the GCC baseline to
12517 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12518 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12519 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12520 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12521 AC_MSG_CHECKING(
12522     [whether C++11 use of const_iterator in standard containers is broken])
12523 save_CXXFLAGS=$CXXFLAGS
12524 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12525 AC_LANG_PUSH([C++])
12526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12527     #include <list>
12528     ]],[[
12529         std::list<int> l;
12530         l.erase(l.cbegin());
12531     ]])],
12532     [broken=no], [broken=yes])
12533 AC_LANG_POP([C++])
12534 CXXFLAGS=$save_CXXFLAGS
12535 AC_MSG_RESULT([$broken])
12536 if test "$broken" = yes; then
12537     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12541 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12542 save_CXXFLAGS=$CXXFLAGS
12543 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12544 save_LIBS=$LIBS
12545 if test -n "$ILIB1"; then
12546     LIBS="$LIBS $ILIB1"
12548 AC_LANG_PUSH([C++])
12549 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12550     // Exit with failure if the static initializer_list is stored on the
12551     // stack (as done by Clang < 3.4):
12552     #include <initializer_list>
12553     struct S {};
12554     bool g(void const * p1, void const * p2) {
12555         int n;
12556         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12557     }
12558     bool f(void const * p1) {
12559         static std::initializer_list<S> s { S() };
12560         return g(p1, s.begin());
12561     }
12562     ]],[[
12563         int n;
12564         return f(&n) ? 0 : 1;
12565     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12566 AC_LANG_POP([C++])
12567 LIBS=$save_LIBS
12568 CXXFLAGS=$save_CXXFLAGS
12569 AC_MSG_RESULT([$broken])
12570 if test "$broken" = yes -a "$_os" != "iOS"; then
12571     AC_MSG_ERROR([working support for static initializer_list needed])
12575 # ===================================================================
12576 # Creating bigger shared library to link against
12577 # ===================================================================
12578 AC_MSG_CHECKING([whether to create huge library])
12579 MERGELIBS=
12581 if test $_os = iOS -o $_os = Android; then
12582     # Never any point in mergelibs for these as we build just static
12583     # libraries anyway...
12584     enable_mergelibs=no
12587 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12588     if test $_os != Linux -a $_os != WINNT; then
12589         add_warning "--enable-mergelibs is not tested for this platform"
12590     fi
12591     MERGELIBS="TRUE"
12592     AC_MSG_RESULT([yes])
12593 else
12594     AC_MSG_RESULT([no])
12596 AC_SUBST([MERGELIBS])
12598 dnl ===================================================================
12599 dnl icerun is a wrapper that stops us spawning tens of processes
12600 dnl locally - for tools that can't be executed on the compile cluster
12601 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12602 dnl ===================================================================
12603 AC_MSG_CHECKING([whether to use icerun wrapper])
12604 ICECREAM_RUN=
12605 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12606     ICECREAM_RUN=icerun
12607     AC_MSG_RESULT([yes])
12608 else
12609     AC_MSG_RESULT([no])
12611 AC_SUBST(ICECREAM_RUN)
12613 dnl ===================================================================
12614 dnl Setup the ICECC_VERSION for the build the same way it was set for
12615 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12616 dnl ===================================================================
12617 x_ICECC_VERSION=[\#]
12618 if test -n "$ICECC_VERSION" ; then
12619     x_ICECC_VERSION=
12621 AC_SUBST(x_ICECC_VERSION)
12622 AC_SUBST(ICECC_VERSION)
12624 dnl ===================================================================
12626 AC_MSG_CHECKING([MPL subset])
12627 MPL_SUBSET=
12629 if test "$enable_mpl_subset" = "yes"; then
12630     warn_report=false
12631     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12632         warn_report=true
12633     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12634         warn_report=true
12635     fi
12636     if test "$warn_report" = "true"; then
12637         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12638     fi
12639     if test "x$enable_postgresql_sdbc" != "xno"; then
12640         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12641     fi
12642     if test "$enable_lotuswordpro" = "yes"; then
12643         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12644     fi
12645     if test "$WITH_WEBDAV" = "neon"; then
12646         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12647     fi
12648     if test -n "$ENABLE_PDFIMPORT"; then
12649         if test "x$SYSTEM_POPPLER" = "x"; then
12650             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12651         fi
12652     fi
12653     # cf. m4/libo_check_extension.m4
12654     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12655         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12656     fi
12657     for theme in $WITH_THEMES; do
12658         case $theme in
12659         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12660             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12661         *) : ;;
12662         esac
12663     done
12665     ENABLE_OPENGL_TRANSITIONS=
12667     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12668         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12669     fi
12671     MPL_SUBSET="TRUE"
12672     AC_DEFINE(MPL_HAVE_SUBSET)
12673     AC_MSG_RESULT([only])
12674 else
12675     AC_MSG_RESULT([no restrictions])
12677 AC_SUBST(MPL_SUBSET)
12679 dnl ===================================================================
12681 AC_MSG_CHECKING([formula logger])
12682 ENABLE_FORMULA_LOGGER=
12684 if test "x$enable_formula_logger" = "xyes"; then
12685     AC_MSG_RESULT([yes])
12686     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12687     ENABLE_FORMULA_LOGGER=TRUE
12688 elif test -n "$ENABLE_DBGUTIL" ; then
12689     AC_MSG_RESULT([yes])
12690     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12691     ENABLE_FORMULA_LOGGER=TRUE
12692 else
12693     AC_MSG_RESULT([no])
12696 AC_SUBST(ENABLE_FORMULA_LOGGER)
12698 dnl ===================================================================
12699 dnl Setting up the environment.
12700 dnl ===================================================================
12701 AC_MSG_NOTICE([setting up the build environment variables...])
12703 AC_SUBST(COMPATH)
12705 if test "$build_os" = "cygwin"; then
12706     if test -d "$COMPATH/atlmfc/lib"; then
12707         ATL_LIB="$COMPATH/atlmfc/lib"
12708         ATL_INCLUDE="$COMPATH/atlmfc/include"
12709     else
12710         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12711         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12712     fi
12713     if test "$BITNESS_OVERRIDE" = 64; then
12714         if test $VCVER = "150"; then
12715             ATL_LIB="$ATL_LIB/x64"
12716         else
12717             ATL_LIB="$ATL_LIB/amd64"
12718         fi
12719     else
12720         if test $VCVER = "150"; then
12721             ATL_LIB="$ATL_LIB/x86"
12722         fi
12723     fi
12724     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12725     PathFormat "/usr/bin/find.exe"
12726     FIND="$formatted_path"
12727     PathFormat "/usr/bin/sort.exe"
12728     SORT="$formatted_path"
12729     PathFormat "/usr/bin/grep.exe"
12730     WIN_GREP="$formatted_path"
12731     PathFormat "/usr/bin/ls.exe"
12732     WIN_LS="$formatted_path"
12733     PathFormat "/usr/bin/touch.exe"
12734     WIN_TOUCH="$formatted_path"
12735 else
12736     FIND=find
12737     SORT=sort
12740 AC_SUBST(ATL_INCLUDE)
12741 AC_SUBST(ATL_LIB)
12742 AC_SUBST(FIND)
12743 AC_SUBST(SORT)
12744 AC_SUBST(WIN_GREP)
12745 AC_SUBST(WIN_LS)
12746 AC_SUBST(WIN_TOUCH)
12748 AC_SUBST(BUILD_TYPE)
12750 AC_SUBST(SOLARINC)
12752 PathFormat "$PERL"
12753 PERL="$formatted_path"
12754 AC_SUBST(PERL)
12756 if test -n "$TMPDIR"; then
12757     TEMP_DIRECTORY="$TMPDIR"
12758 else
12759     TEMP_DIRECTORY="/tmp"
12761 if test "$build_os" = "cygwin"; then
12762     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12764 AC_SUBST(TEMP_DIRECTORY)
12766 # setup the PATH for the environment
12767 if test -n "$LO_PATH_FOR_BUILD"; then
12768     LO_PATH="$LO_PATH_FOR_BUILD"
12769 else
12770     LO_PATH="$PATH"
12772     case "$host_os" in
12774     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12775         if test "$ENABLE_JAVA" != ""; then
12776             pathmunge "$JAVA_HOME/bin" "after"
12777         fi
12778         ;;
12780     cygwin*)
12781         # Win32 make needs native paths
12782         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12783             LO_PATH=`cygpath -p -m "$PATH"`
12784         fi
12785         if test "$BITNESS_OVERRIDE" = 64; then
12786             # needed for msi packaging
12787             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12788         fi
12789         # .NET 4.6 and higher don't have bin directory
12790         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12791             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12792         fi
12793         pathmunge "$ASM_HOME" "before"
12794         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12795         pathmunge "$CSC_PATH" "before"
12796         pathmunge "$MIDL_PATH" "before"
12797         pathmunge "$AL_PATH" "before"
12798         pathmunge "$MSPDB_PATH" "before"
12799         if test -n "$MSBUILD_PATH" ; then
12800             pathmunge "$MSBUILD_PATH" "before"
12801         fi
12802         if test "$BITNESS_OVERRIDE" = 64; then
12803             pathmunge "$COMPATH/bin/amd64" "before"
12804             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12805         else
12806             pathmunge "$COMPATH/bin" "before"
12807             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12808         fi
12809         if test "$ENABLE_JAVA" != ""; then
12810             if test -d "$JAVA_HOME/jre/bin/client"; then
12811                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12812             fi
12813             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12814                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12815             fi
12816             pathmunge "$JAVA_HOME/bin" "before"
12817         fi
12818         ;;
12820     solaris*)
12821         pathmunge "/usr/css/bin" "before"
12822         if test "$ENABLE_JAVA" != ""; then
12823             pathmunge "$JAVA_HOME/bin" "after"
12824         fi
12825         ;;
12826     esac
12829 AC_SUBST(LO_PATH)
12831 libo_FUZZ_SUMMARY
12833 # Generate a configuration sha256 we can use for deps
12834 if test -f config_host.mk; then
12835     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12837 if test -f config_host_lang.mk; then
12838     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12841 CFLAGS=$my_original_CFLAGS
12842 CXXFLAGS=$my_original_CXXFLAGS
12843 CPPFLAGS=$my_original_CPPFLAGS
12845 AC_CONFIG_FILES([config_host.mk
12846                  config_host_lang.mk
12847                  Makefile
12848                  lo.xcent
12849                  bin/bffvalidator.sh
12850                  bin/odfvalidator.sh
12851                  bin/officeotron.sh
12852                  instsetoo_native/util/openoffice.lst
12853                  sysui/desktop/macosx/Info.plist])
12854 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12855 AC_CONFIG_HEADERS([config_host/config_clang.h])
12856 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12857 AC_CONFIG_HEADERS([config_host/config_eot.h])
12858 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12859 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12860 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12861 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12862 AC_CONFIG_HEADERS([config_host/config_features.h])
12863 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12864 AC_CONFIG_HEADERS([config_host/config_folders.h])
12865 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12866 AC_CONFIG_HEADERS([config_host/config_gio.h])
12867 AC_CONFIG_HEADERS([config_host/config_global.h])
12868 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12869 AC_CONFIG_HEADERS([config_host/config_java.h])
12870 AC_CONFIG_HEADERS([config_host/config_langs.h])
12871 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12872 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12873 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12874 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12875 AC_CONFIG_HEADERS([config_host/config_locales.h])
12876 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12877 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12878 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12879 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12880 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12881 AC_CONFIG_HEADERS([config_host/config_oox.h])
12882 AC_CONFIG_HEADERS([config_host/config_options.h])
12883 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12884 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12885 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12886 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12887 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12888 AC_CONFIG_HEADERS([config_host/config_version.h])
12889 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12890 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12891 AC_CONFIG_HEADERS([config_host/config_python.h])
12892 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12893 AC_OUTPUT
12895 if test "$CROSS_COMPILING" = TRUE; then
12896     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12899 # touch the config timestamp file
12900 if test ! -f config_host.mk.stamp; then
12901     echo > config_host.mk.stamp
12902 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12903     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12904 else
12905     echo > config_host.mk.stamp
12908 # touch the config lang timestamp file
12909 if test ! -f config_host_lang.mk.stamp; then
12910     echo > config_host_lang.mk.stamp
12911 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12912     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12913 else
12914     echo > config_host_lang.mk.stamp
12918 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12920 cat << _EOS
12921 ****************************************************************************
12922 WARNING:
12923 Your make version is known to be horribly slow, and hard to debug
12924 problems with. To get a reasonably functional make please do:
12926 to install a pre-compiled binary make for Win32
12928  mkdir -p /opt/lo/bin
12929  cd /opt/lo/bin
12930  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12931  cp make-85047eb-msvc.exe make
12932  chmod +x make
12934 to install from source:
12935 place yourself in a working directory of you choice.
12937  git clone git://git.savannah.gnu.org/make.git
12939  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12940  set PATH=%PATH%;C:\Cygwin\bin
12941  [or Cygwin64, if that is what you have]
12942  cd path-to-make-repo-you-cloned-above
12943  build_w32.bat --without-guile
12945 should result in a WinRel/gnumake.exe.
12946 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12948 Then re-run autogen.sh
12950 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12951 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12953 _EOS
12956 cat << _EOF
12957 ****************************************************************************
12959 To build, run:
12960 $GNUMAKE
12962 To view some help, run:
12963 $GNUMAKE help
12965 _EOF
12967 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12968     cat << _EOF
12969 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12970 _EOF
12972     if test $_os = Darwin; then
12973         echo open instdir/$PRODUCTNAME.app
12974     else
12975         echo instdir/program/soffice
12976     fi
12977     cat << _EOF
12979 If you want to run the smoketest, run:
12980 $GNUMAKE check
12982 _EOF
12985 if test -f warn; then
12986     cat warn
12987     rm warn
12990 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: