Implement qt5 plain text copy to clipboard
[LibreOffice.git] / configure.ac
blob5f0f7080bcedfa254007e8ab9f97709b08e6c909
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
85         if test "$fp_count_space" != "0"; then
86             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
87         fi
88     fi
91 AbsolutePath()
93     # There appears to be no simple and portable method to get an absolute and
94     # canonical path, so we try creating the directory if does not exist and
95     # utilizing the shell and pwd.
96     rel="$1"
97     absolute_path=""
98     test ! -e "$rel" && mkdir -p "$rel"
99     if test -d "$rel" ; then
100         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
101         absolute_path="$(pwd)"
102         cd - > /dev/null
103     else
104         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
105     fi
108 rm -f warn
109 have_WARNINGS="no"
110 add_warning()
112     if test "$have_WARNINGS" = "no"; then
113         echo "*************************************" > warn
114         have_WARNINGS="yes"
115         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
116             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
117             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
118         else
119             COLORWARN="* WARNING :"
120         fi
121     fi
122     echo "$COLORWARN $@" >> warn
125 dnl Some Mac User have the bad habbit of letting a lot fo crap
126 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
127 dnl that confuse the build.
128 dnl For the ones that use LODE, let's be nice and protect them
129 dnl from themselves
131 mac_sanitize_path()
133     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
134 dnl a common but nevertheless necessary thing that may be in a fancy
135 dnl path location is git, so make sure we have it
136     mac_git_path=`which git 2>/dev/null`
137     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
138         mac_path="$mac_path:`dirname $mac_git_path`"
139     fi
140 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
141 dnl path location is gpg, so make sure we find it
142     mac_gpg_path=`which gpg 2>/dev/null`
143     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
144         mac_path="$mac_path:`dirname $mac_gpg_path`"
145     fi
146     PATH="$mac_path"
147     unset mac_path
148     unset mac_git_path
149     unset mac_gpg_path
152 echo "********************************************************************"
153 echo "*"
154 echo "*   Running ${PACKAGE_NAME} build configuration."
155 echo "*"
156 echo "********************************************************************"
157 echo ""
159 dnl ===================================================================
160 dnl checks build and host OSes
161 dnl do this before argument processing to allow for platform dependent defaults
162 dnl ===================================================================
163 AC_CANONICAL_HOST
165 AC_MSG_CHECKING([for product name])
166 PRODUCTNAME="AC_PACKAGE_NAME"
167 if test -n "$with_product_name" -a "$with_product_name" != no; then
168     PRODUCTNAME="$with_product_name"
170 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
171     PRODUCTNAME="${PRODUCTNAME}Dev"
173 AC_MSG_RESULT([$PRODUCTNAME])
174 AC_SUBST(PRODUCTNAME)
175 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
176 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
178 dnl ===================================================================
179 dnl Our version is defined by the AC_INIT() at the top of this script.
180 dnl ===================================================================
182 AC_MSG_CHECKING([for package version])
183 if test -n "$with_package_version" -a "$with_package_version" != no; then
184     PACKAGE_VERSION="$with_package_version"
186 AC_MSG_RESULT([$PACKAGE_VERSION])
188 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
190 LIBO_VERSION_MAJOR=$1
191 LIBO_VERSION_MINOR=$2
192 LIBO_VERSION_MICRO=$3
193 LIBO_VERSION_PATCH=$4
195 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
196 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
197 # no way to encode that into an integer in general.
198 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
200 LIBO_VERSION_SUFFIX=$5
201 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
202 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
203 # they get undoubled before actually passed to sed.
204 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
205 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
206 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
207 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
209 AC_SUBST(LIBO_VERSION_MAJOR)
210 AC_SUBST(LIBO_VERSION_MINOR)
211 AC_SUBST(LIBO_VERSION_MICRO)
212 AC_SUBST(LIBO_VERSION_PATCH)
213 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
214 AC_SUBST(LIBO_VERSION_SUFFIX)
215 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
217 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
218 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
219 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
220 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
222 LIBO_THIS_YEAR=`date +%Y`
223 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
225 dnl ===================================================================
226 dnl Product version
227 dnl ===================================================================
228 AC_MSG_CHECKING([for product version])
229 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
230 AC_MSG_RESULT([$PRODUCTVERSION])
231 AC_SUBST(PRODUCTVERSION)
233 AC_PROG_EGREP
234 # AC_PROG_EGREP doesn't set GREP on all systems as well
235 AC_PATH_PROG(GREP, grep)
237 BUILDDIR=`pwd`
238 cd $srcdir
239 SRC_ROOT=`pwd`
240 cd $BUILDDIR
241 x_Cygwin=[\#]
243 dnl ======================================
244 dnl Required GObject introspection version
245 dnl ======================================
246 INTROSPECTION_REQUIRED_VERSION=1.32.0
248 dnl ===================================================================
249 dnl Search all the common names for GNU Make
250 dnl ===================================================================
251 AC_MSG_CHECKING([for GNU Make])
253 # try to use our own make if it is available and GNUMAKE was not already defined
254 if test -z "$GNUMAKE"; then
255     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
256         GNUMAKE="$LODE_HOME/opt/bin/make"
257     elif test -x "/opt/lo/bin/make"; then
258         GNUMAKE="/opt/lo/bin/make"
259     fi
262 GNUMAKE_WIN_NATIVE=
263 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
264     if test -n "$a"; then
265         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
266         if test $? -eq 0;  then
267             if test "$build_os" = "cygwin"; then
268                 if test -n "$($a -v | grep 'Built for Windows')" ; then
269                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
270                     GNUMAKE_WIN_NATIVE="TRUE"
271                 else
272                     GNUMAKE=`which $a`
273                 fi
274             else
275                 GNUMAKE=`which $a`
276             fi
277             break
278         fi
279     fi
280 done
281 AC_MSG_RESULT($GNUMAKE)
282 if test -z "$GNUMAKE"; then
283     AC_MSG_ERROR([not found. install GNU Make.])
284 else
285     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
286         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
287     fi
290 win_short_path_for_make()
292     local_short_path="$1"
293     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
294         cygpath -sm "$local_short_path"
295     else
296         cygpath -u "$(cygpath -d "$local_short_path")"
297     fi
301 if test "$build_os" = "cygwin"; then
302     PathFormat "$SRC_ROOT"
303     SRC_ROOT="$formatted_path"
304     PathFormat "$BUILDDIR"
305     BUILDDIR="$formatted_path"
306     x_Cygwin=
307     AC_MSG_CHECKING(for explicit COMSPEC)
308     if test -z "$COMSPEC"; then
309         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
310     else
311         AC_MSG_RESULT([found: $COMSPEC])
312     fi
315 AC_SUBST(SRC_ROOT)
316 AC_SUBST(BUILDDIR)
317 AC_SUBST(x_Cygwin)
318 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
319 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
321 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
322     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
325 # need sed in os checks...
326 AC_PATH_PROGS(SED, sed)
327 if test -z "$SED"; then
328     AC_MSG_ERROR([install sed to run this script])
331 # Set the ENABLE_LTO variable
332 # ===================================================================
333 AC_MSG_CHECKING([whether to use link-time optimization])
334 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
335     ENABLE_LTO="TRUE"
336     AC_MSG_RESULT([yes])
337     AC_DEFINE(STATIC_LINKING)
338 else
339     ENABLE_LTO=""
340     AC_MSG_RESULT([no])
342 AC_SUBST(ENABLE_LTO)
344 AC_ARG_ENABLE(fuzz-options,
345     AS_HELP_STRING([--enable-fuzz-options],
346         [Randomly enable or disable each of those configurable options
347          that are supposed to be freely selectable without interdependencies,
348          or where bad interaction from interdependencies is automatically avoided.])
351 dnl ===================================================================
352 dnl When building for Android, --with-android-ndk,
353 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
354 dnl mandatory
355 dnl ===================================================================
357 AC_ARG_WITH(android-ndk,
358     AS_HELP_STRING([--with-android-ndk],
359         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
362 AC_ARG_WITH(android-ndk-toolchain-version,
363     AS_HELP_STRING([--with-android-ndk-toolchain-version],
364         [Specify which toolchain version to use, of those present in the
365         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
366         with_android_ndk_toolchain_version=clang5.0)
368 AC_ARG_WITH(android-sdk,
369     AS_HELP_STRING([--with-android-sdk],
370         [Specify location of the Android SDK. Mandatory when building for Android.]),
373 ANDROID_NDK_HOME=
374 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
375     with_android_ndk="$SRC_ROOT/external/android-ndk"
377 if test -n "$with_android_ndk"; then
378     ANDROID_NDK_HOME=$with_android_ndk
380     # Set up a lot of pre-canned defaults
382     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
383         if test ! -f $ANDROID_NDK_HOME/source.properties; then
384             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
385         fi
386         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
387     else
388         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
389     fi
390     if test -z "$ANDROID_NDK_VERSION";  then
391         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
392     fi
393     case $ANDROID_NDK_VERSION in
394     r9*|r10*)
395         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
396         ;;
397     11.1.*|12.1.*|13.1.*|14.1.*)
398         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
399         ;;
400     16.*)
401         ;;
402     *)
403         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
404         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
405         ;;
406     esac
408     ANDROID_API_LEVEL=14
409     android_cpu=$host_cpu
410     ANDROID_ARCH=$android_cpu
411     if test $host_cpu = arm; then
412         android_platform_prefix=$android_cpu-linux-androideabi
413         android_gnu_prefix=$android_platform_prefix
414         LLVM_TRIPLE=armv7-none-linux-androideabi
415         ANDROID_APP_ABI=armeabi-v7a
416         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
417     elif test $host_cpu = aarch64; then
418         android_platform_prefix=$android_cpu-linux-android
419         android_gnu_prefix=$android_platform_prefix
420         LLVM_TRIPLE=aarch64-none-linux-android
421         # minimum android version that supports aarch64
422         ANDROID_API_LEVEL=21
423         ANDROID_APP_ABI=arm64-v8a
424         ANDROID_ARCH=arm64
425     elif test $host_cpu = mips; then
426         android_platform_prefix=mipsel-linux-android
427         android_gnu_prefix=$android_platform_prefix
428         LLVM_TRIPLE=mipsel-none-linux-android
429         ANDROID_APP_ABI=mips
430     else
431         # host_cpu is something like "i386" or "i686" I guess, NDK uses
432         # "x86" in some contexts
433         android_cpu=x86
434         android_platform_prefix=$android_cpu
435         android_gnu_prefix=i686-linux-android
436         LLVM_TRIPLE=i686-none-linux-android
437         ANDROID_APP_ABI=x86
438         ANDROID_ARCH=$android_cpu
439         ANDROIDCFLAGS="-march=atom"
440     fi
442     case "$with_android_ndk_toolchain_version" in
443     clang5.0)
444         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
445         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
446         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
447         ;;
448     *)
449         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
450     esac
452     if test ! -d $ANDROID_BINUTILS_DIR; then
453         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
454     elif test ! -d $ANDROID_COMPILER_DIR; then
455         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
456     fi
458     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
459     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
460     # manage to link the (app-specific) single huge .so that is built for the app in
461     # android/source/ if there is debug information in a significant part of the object files.
462     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
463     # all objects have been built with debug information.)
464     case $build_os in
465     linux-gnu*)
466         ndk_build_os=linux
467         ;;
468     darwin*)
469         ndk_build_os=darwin
470         ;;
471     *)
472         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
473         ;;
474     esac
475     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
476     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
477     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
479     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
480     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
481     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
482     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
483     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
484     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
487     # android is using different sysroots for compilation and linking, but as
488     # there is no full separation in configure and elsewhere, use isystem for
489     # compilation stuff and sysroot for linking
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
493     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
494     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
495     else
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
497     fi
498     if test "$ENABLE_LTO" = TRUE; then
499         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
500         # $CC and $CXX when building external libraries
501         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
502     fi
504     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
505     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
506     else
507     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
508     fi
510     if test -z "$CC"; then
511         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
512     fi
513     if test -z "$CXX"; then
514         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
515     fi
517     # remember to download the ownCloud Android library later
518     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
520 AC_SUBST(ANDROID_NDK_HOME)
521 AC_SUBST(ANDROID_APP_ABI)
522 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
524 dnl ===================================================================
525 dnl --with-android-sdk
526 dnl ===================================================================
527 ANDROID_SDK_HOME=
528 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
529     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
531 if test -n "$with_android_sdk"; then
532     ANDROID_SDK_HOME=$with_android_sdk
533     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
535 AC_SUBST(ANDROID_SDK_HOME)
537 dnl ===================================================================
538 dnl The following is a list of supported systems.
539 dnl Sequential to keep the logic very simple
540 dnl These values may be checked and reset later.
541 dnl ===================================================================
542 #defaults unless the os test overrides this:
543 test_randr=yes
544 test_xrender=yes
545 test_cups=yes
546 test_dbus=yes
547 test_fontconfig=yes
548 test_cairo=no
550 # Default values, as such probably valid just for Linux, set
551 # differently below just for Mac OSX,but at least better than
552 # hardcoding these as we used to do. Much of this is duplicated also
553 # in solenv for old build system and for gbuild, ideally we should
554 # perhaps define stuff like this only here in configure.ac?
556 LINKFLAGSSHL="-shared"
557 PICSWITCH="-fpic"
558 DLLPOST=".so"
560 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
562 INSTROOTBASESUFFIX=
563 INSTROOTCONTENTSUFFIX=
564 SDKDIRNAME=sdk
566 case "$host_os" in
568 solaris*)
569     test_gtk=yes
570     build_gstreamer_1_0=yes
571     build_gstreamer_0_10=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     build_gstreamer_0_10=yes
599     test_kde4=yes
600     test_kde5=yes
601     test_qt5=yes
602     test_gtk3_kde5=yes
603     if test "$enable_fuzzers" != yes; then
604         test_freetype=yes
605         test_fontconfig=yes
606     else
607         test_freetype=no
608         test_fontconfig=no
609         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
610     fi
611     _os=Linux
612     ;;
614 gnu)
615     test_randr=no
616     test_xrender=no
617     _os=GNU
618      ;;
620 cygwin*|interix*)
622     # When building on Windows normally with MSVC under Cygwin,
623     # configure thinks that the host platform (the platform the
624     # built code will run on) is Cygwin, even if it obviously is
625     # Windows, which in Autoconf terminology is called
626     # "mingw32". (Which is misleading as MinGW is the name of the
627     # tool-chain, not an operating system.)
629     # Somewhat confusing, yes. But this configure script doesn't
630     # look at $host etc that much, it mostly uses its own $_os
631     # variable, set here in this case statement.
633     test_cups=no
634     test_dbus=no
635     test_randr=no
636     test_xrender=no
637     test_freetype=no
638     test_fontconfig=no
639     _os=WINNT
641     DLLPOST=".dll"
642     LINKFLAGSNOUNDEFS=
643     ;;
645 darwin*) # Mac OS X or iOS
646     test_gtk=yes
647     test_randr=no
648     test_xrender=no
649     test_freetype=no
650     test_fontconfig=no
651     test_dbus=no
652     if test -n "$LODE_HOME" ; then
653         mac_sanitize_path
654         AC_MSG_NOTICE([sanitized the PATH to $PATH])
655     fi
656     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
657         build_for_ios=YES
658         _os=iOS
659         test_gtk=no
660         test_cups=no
661         enable_mpl_subset=yes
662         enable_lotuswordpro=no
663         enable_coinmp=no
664         enable_lpsolve=no
665         enable_postgresql_sdbc=no
666         enable_extension_integration=no
667         enable_report_builder=no
668         with_theme="tango"
669         with_ppds=no
670         if test "$enable_ios_simulator" = "yes"; then
671             host=x86_64-apple-darwin
672         fi
673     else
674         _os=Darwin
675         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
676         INSTROOTCONTENTSUFFIX=/Contents
677         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
678     fi
679     # See comment above the case "$host_os"
680     LINKFLAGSSHL="-dynamiclib -single_module"
682     # -fPIC is default
683     PICSWITCH=""
685     DLLPOST=".dylib"
687     # -undefined error is the default
688     LINKFLAGSNOUNDEFS=""
691 freebsd*)
692     test_gtk=yes
693     build_gstreamer_1_0=yes
694     build_gstreamer_0_10=yes
695     test_kde4=yes
696     test_kde5=yes
697     test_qt5=yes
698     test_gtk3_kde5=yes
699     test_freetype=yes
700     AC_MSG_CHECKING([the FreeBSD operating system release])
701     if test -n "$with_os_version"; then
702         OSVERSION="$with_os_version"
703     else
704         OSVERSION=`/sbin/sysctl -n kern.osreldate`
705     fi
706     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
707     AC_MSG_CHECKING([which thread library to use])
708     if test "$OSVERSION" -lt "500016"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-pthread"
711     elif test "$OSVERSION" -lt "502102"; then
712         PTHREAD_CFLAGS="-D_THREAD_SAFE"
713         PTHREAD_LIBS="-lc_r"
714     else
715         PTHREAD_CFLAGS=""
716         PTHREAD_LIBS="-pthread"
717     fi
718     AC_MSG_RESULT([$PTHREAD_LIBS])
719     _os=FreeBSD
720     ;;
722 *netbsd*)
723     test_gtk=yes
724     build_gstreamer_1_0=yes
725     build_gstreamer_0_10=yes
726     test_kde4=yes
727     test_kde5=yes
728     test_qt5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     PTHREAD_LIBS="-pthread -lpthread"
732     _os=NetBSD
733     ;;
735 aix*)
736     test_randr=no
737     test_freetype=yes
738     PTHREAD_LIBS=-pthread
739     _os=AIX
740     ;;
742 openbsd*)
743     test_gtk=yes
744     test_freetype=yes
745     PTHREAD_CFLAGS="-D_THREAD_SAFE"
746     PTHREAD_LIBS="-pthread"
747     _os=OpenBSD
748     ;;
750 dragonfly*)
751     test_gtk=yes
752     build_gstreamer_1_0=yes
753     build_gstreamer_0_10=yes
754     test_kde4=yes
755     test_kde5=yes
756     test_qt5=yes
757     test_gtk3_kde5=yes
758     test_freetype=yes
759     PTHREAD_LIBS="-pthread"
760     _os=DragonFly
761     ;;
763 linux-android*)
764     build_gstreamer_1_0=no
765     build_gstreamer_0_10=no
766     enable_lotuswordpro=no
767     enable_mpl_subset=yes
768     enable_coinmp=yes
769     enable_lpsolve=no
770     enable_report_builder=no
771     enable_odk=no
772     enable_postgresql_sdbc=no
773     enable_python=no
774     with_theme="tango"
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_gtk=no
780     test_kde4=no
781     test_kde5=no
782     test_qt5=no
783     test_gtk3_kde5=no
784     test_randr=no
785     test_xrender=no
786     _os=Android
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
790     ;;
792 haiku*)
793     test_cups=no
794     test_dbus=no
795     test_randr=no
796     test_xrender=no
797     test_freetype=yes
798     enable_odk=no
799     enable_gstreamer_0_10=no
800     enable_gstreamer_1_0=no
801     enable_vlc=no
802     enable_coinmp=no
803     enable_pdfium=no
804     enable_sdremote=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" != "WINNT"; then
816 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
817 else
818 ENDIANNESS=little
820 AC_SUBST(ENDIANNESS)
822 if test "$_os" = "Android" ; then
823     # Verify that the NDK and SDK options are proper
824     if test -z "$with_android_ndk"; then
825         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
826     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
827         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
828     fi
830     if test -z "$ANDROID_SDK_HOME"; then
831         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
832     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
833         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
834     fi
836     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
837     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
838         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
839                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
840                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
841         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
842         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
843         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
844     fi
845     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
846         AC_MSG_WARN([android support repository not found - install with
847                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
848                      to allow the build to download the specified version of the android support libraries])
849         add_warning "android support repository not found - install with"
850         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
851         add_warning "to allow the build to download the specified version of the android support libraries"
852     fi
855 if test "$_os" = "AIX"; then
856     AC_PATH_PROG(GAWK, gawk)
857     if test -z "$GAWK"; then
858         AC_MSG_ERROR([gawk not found in \$PATH])
859     fi
862 AC_SUBST(SDKDIRNAME)
864 AC_SUBST(PTHREAD_CFLAGS)
865 AC_SUBST(PTHREAD_LIBS)
867 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
868 # By default use the ones specified by our build system,
869 # but explicit override is possible.
870 AC_MSG_CHECKING(for explicit AFLAGS)
871 if test -n "$AFLAGS"; then
872     AC_MSG_RESULT([$AFLAGS])
873     x_AFLAGS=
874 else
875     AC_MSG_RESULT(no)
876     x_AFLAGS=[\#]
878 AC_MSG_CHECKING(for explicit CFLAGS)
879 if test -n "$CFLAGS"; then
880     AC_MSG_RESULT([$CFLAGS])
881     x_CFLAGS=
882 else
883     AC_MSG_RESULT(no)
884     x_CFLAGS=[\#]
886 AC_MSG_CHECKING(for explicit CXXFLAGS)
887 if test -n "$CXXFLAGS"; then
888     AC_MSG_RESULT([$CXXFLAGS])
889     x_CXXFLAGS=
890 else
891     AC_MSG_RESULT(no)
892     x_CXXFLAGS=[\#]
894 AC_MSG_CHECKING(for explicit OBJCFLAGS)
895 if test -n "$OBJCFLAGS"; then
896     AC_MSG_RESULT([$OBJCFLAGS])
897     x_OBJCFLAGS=
898 else
899     AC_MSG_RESULT(no)
900     x_OBJCFLAGS=[\#]
902 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
903 if test -n "$OBJCXXFLAGS"; then
904     AC_MSG_RESULT([$OBJCXXFLAGS])
905     x_OBJCXXFLAGS=
906 else
907     AC_MSG_RESULT(no)
908     x_OBJCXXFLAGS=[\#]
910 AC_MSG_CHECKING(for explicit LDFLAGS)
911 if test -n "$LDFLAGS"; then
912     AC_MSG_RESULT([$LDFLAGS])
913     x_LDFLAGS=
914 else
915     AC_MSG_RESULT(no)
916     x_LDFLAGS=[\#]
918 AC_SUBST(AFLAGS)
919 AC_SUBST(CFLAGS)
920 AC_SUBST(CXXFLAGS)
921 AC_SUBST(OBJCFLAGS)
922 AC_SUBST(OBJCXXFLAGS)
923 AC_SUBST(LDFLAGS)
924 AC_SUBST(x_AFLAGS)
925 AC_SUBST(x_CFLAGS)
926 AC_SUBST(x_CXXFLAGS)
927 AC_SUBST(x_OBJCFLAGS)
928 AC_SUBST(x_OBJCXXFLAGS)
929 AC_SUBST(x_LDFLAGS)
931 dnl These are potentially set for MSVC, in the code checking for UCRT below:
932 my_original_CFLAGS=$CFLAGS
933 my_original_CXXFLAGS=$CXXFLAGS
934 my_original_CPPFLAGS=$CPPFLAGS
936 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
937 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
938 dnl AC_PROG_CC internally.
939 if test "$_os" != "WINNT"; then
940     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
941     save_CFLAGS=$CFLAGS
942     AC_PROG_CC
943     CFLAGS=$save_CFLAGS
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 AC_ARG_ENABLE(fetch-external,
1068     AS_HELP_STRING([--disable-fetch-external],
1069         [Disables fetching external tarballs from web sources.])
1072 AC_ARG_ENABLE(fuzzers,
1073     AS_HELP_STRING([--enable-fuzzers],
1074         [Enables building libfuzzer targets for fuzz testing.])
1077 libo_FUZZ_ARG_ENABLE(pch,
1078     AS_HELP_STRING([--enable-pch],
1079         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1082 libo_FUZZ_ARG_ENABLE(epm,
1083     AS_HELP_STRING([--enable-epm],
1084         [LibreOffice includes self-packaging code, that requires epm, however epm is
1085          useless for large scale package building.])
1088 libo_FUZZ_ARG_ENABLE(odk,
1089     AS_HELP_STRING([--disable-odk],
1090         [LibreOffice includes an ODK, office development kit which some packagers may
1091          wish to build without.])
1094 AC_ARG_ENABLE(mpl-subset,
1095     AS_HELP_STRING([--enable-mpl-subset],
1096         [Don't compile any pieces which are not MPL or more liberally licensed])
1099 libo_FUZZ_ARG_ENABLE(evolution2,
1100     AS_HELP_STRING([--enable-evolution2],
1101         [Allows the built-in evolution 2 addressbook connectivity build to be
1102          enabled.])
1105 AC_ARG_ENABLE(avahi,
1106     AS_HELP_STRING([--enable-avahi],
1107         [Determines whether to use Avahi to advertise Impress to remote controls.])
1110 libo_FUZZ_ARG_ENABLE(werror,
1111     AS_HELP_STRING([--enable-werror],
1112         [Turn warnings to errors. (Has no effect in modules where the treating
1113          of warnings as errors is disabled explicitly.)]),
1116 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1117     AS_HELP_STRING([--enable-assert-always-abort],
1118         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1121 libo_FUZZ_ARG_ENABLE(dbgutil,
1122     AS_HELP_STRING([--enable-dbgutil],
1123         [Provide debugging support from --enable-debug and include additional debugging
1124          utilities such as object counting or more expensive checks.
1125          This is the recommended option for developers.
1126          Note that this makes the build ABI incompatible, it is not possible to mix object
1127          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1129 libo_FUZZ_ARG_ENABLE(debug,
1130     AS_HELP_STRING([--enable-debug],
1131         [Include debugging information, disable compiler optimization and inlining plus
1132          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1134 libo_FUZZ_ARG_ENABLE(split-debug,
1135     AS_HELP_STRING([--enable-split-debug],
1136         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1137          but requires tools that support it (both build tools and debuggers).]))
1139 libo_FUZZ_ARG_ENABLE(gdb-index,
1140     AS_HELP_STRING([--enable-gdb-index],
1141         [Creates debug information in the gdb index format, which makes gdb start faster.
1142          Requires the gold or lld linker.]))
1144 libo_FUZZ_ARG_ENABLE(sal-log,
1145     AS_HELP_STRING([--enable-sal-log],
1146         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1148 AC_ARG_ENABLE(selective-debuginfo,
1149     AS_HELP_STRING([--enable-selective-debuginfo],
1150         [If --enable-debug or --enable-dbgutil is used, build debugging information
1151          (-g compiler flag) only for the specified gbuild build targets
1152          (where all means everything, - prepended means not to enable, / appended means
1153          everything in the directory; there is no ordering, more specific overrides
1154          more general, and disabling takes precedence).
1155          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1157 libo_FUZZ_ARG_ENABLE(symbols,
1158     AS_HELP_STRING([--enable-symbols],
1159         [Generate debug information.
1160          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1161          otherwise.]))
1163 libo_FUZZ_ARG_ENABLE(optimized,
1164     AS_HELP_STRING([--disable-optimized],
1165         [Whether to compile with optimization flags.
1166          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1167          otherwise.]))
1169 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1170     AS_HELP_STRING([--disable-runtime-optimizations],
1171         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1172          JVM JIT) that are known to interact badly with certain dynamic analysis
1173          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1174          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1175          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1177 AC_ARG_WITH(valgrind,
1178     AS_HELP_STRING([--with-valgrind],
1179         [Make availability of Valgrind headers a hard requirement.]))
1181 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1182     AS_HELP_STRING([--enable-compiler-plugins],
1183         [Enable compiler plugins that will perform additional checks during
1184          building. Enabled automatically by --enable-dbgutil.
1185          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1186 COMPILER_PLUGINS_DEBUG=
1187 if test "$enable_compiler_plugins" = debug; then
1188     enable_compiler_plugins=yes
1189     COMPILER_PLUGINS_DEBUG=TRUE
1192 libo_FUZZ_ARG_ENABLE(ooenv,
1193     AS_HELP_STRING([--disable-ooenv],
1194         [Disable ooenv for the instdir installation.]))
1196 libo_FUZZ_ARG_ENABLE(libnumbertext,
1197     AS_HELP_STRING([--disable-libnumbertext],
1198         [Disable use of numbertext external library.]))
1200 AC_ARG_ENABLE(lto,
1201     AS_HELP_STRING([--enable-lto],
1202         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1203          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1204          linker. For MSVC, this option is broken at the moment. This is experimental work
1205          in progress that shouldn't be used unless you are working on it.)]))
1207 AC_ARG_ENABLE(python,
1208     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1209         [Enables or disables Python support at run-time.
1210          Also specifies what Python to use. 'auto' is the default.
1211          'fully-internal' even forces the internal version for uses of Python
1212          during the build.]))
1214 libo_FUZZ_ARG_ENABLE(gtk,
1215     AS_HELP_STRING([--disable-gtk],
1216         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1217 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1219 libo_FUZZ_ARG_ENABLE(gtk3,
1220     AS_HELP_STRING([--disable-gtk3],
1221         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1222 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1224 AC_ARG_ENABLE(split-app-modules,
1225     AS_HELP_STRING([--enable-split-app-modules],
1226         [Split file lists for app modules, e.g. base, calc.
1227          Has effect only with make distro-pack-install]),
1230 AC_ARG_ENABLE(split-opt-features,
1231     AS_HELP_STRING([--enable-split-opt-features],
1232         [Split file lists for some optional features, e.g. pyuno, testtool.
1233          Has effect only with make distro-pack-install]),
1236 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1237     AS_HELP_STRING([--disable-cairo-canvas],
1238         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1241 libo_FUZZ_ARG_ENABLE(dbus,
1242     AS_HELP_STRING([--disable-dbus],
1243         [Determines whether to enable features that depend on dbus.
1244          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1245 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1247 libo_FUZZ_ARG_ENABLE(sdremote,
1248     AS_HELP_STRING([--disable-sdremote],
1249         [Determines whether to enable Impress remote control (i.e. the server component).]),
1250 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1252 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1253     AS_HELP_STRING([--disable-sdremote-bluetooth],
1254         [Determines whether to build sdremote with bluetooth support.
1255          Requires dbus on Linux.]))
1257 libo_FUZZ_ARG_ENABLE(gio,
1258     AS_HELP_STRING([--disable-gio],
1259         [Determines whether to use the GIO support.]),
1260 ,test "${enable_gio+set}" = set || enable_gio=yes)
1262 AC_ARG_ENABLE(kde4,
1263     AS_HELP_STRING([--enable-kde4],
1264         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1265          KDE4 are available.]),
1268 AC_ARG_ENABLE(qt5,
1269     AS_HELP_STRING([--enable-qt5],
1270         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1271          available.]),
1274 AC_ARG_ENABLE(kde5,
1275     AS_HELP_STRING([--enable-kde5],
1276         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1277          KF5 are available.]),
1280 AC_ARG_ENABLE(gtk3_kde5,
1281     AS_HELP_STRING([--enable-gtk3-kde5],
1282         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1283          platforms where Gtk3, Qt5 and Plasma is available.]),
1286 libo_FUZZ_ARG_ENABLE(gui,
1287     AS_HELP_STRING([--disable-gui],
1288         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1289          command-line option. Not related to LibreOffice Online functionality. Don't use
1290          unless you are certain you need to. Nobody will help you if you insist on trying
1291          this and run into problems.]),
1292 ,test "${enable_gui+set}" = set || enable_gui=yes)
1294 libo_FUZZ_ARG_ENABLE(randr,
1295     AS_HELP_STRING([--disable-randr],
1296         [Disable RandR support in the vcl project.]),
1297 ,test "${enable_randr+set}" = set || enable_randr=yes)
1299 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1300     AS_HELP_STRING([--disable-gstreamer-1-0],
1301         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1302 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1304 AC_ARG_ENABLE(gstreamer-0-10,
1305     AS_HELP_STRING([--enable-gstreamer-0-10],
1306         [Enable building with the gstreamer 0.10 avmedia backend.]),
1307 ,enable_gstreamer_0_10=no)
1309 libo_FUZZ_ARG_ENABLE(vlc,
1310     AS_HELP_STRING([--enable-vlc],
1311         [Enable building with the (experimental) VLC avmedia backend.]),
1312 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1314 libo_FUZZ_ARG_ENABLE(neon,
1315     AS_HELP_STRING([--disable-neon],
1316         [Disable neon and the compilation of webdav binding.]),
1319 libo_FUZZ_ARG_ENABLE([eot],
1320     [AS_HELP_STRING([--enable-eot],
1321         [Enable support for Embedded OpenType fonts.])],
1322 ,test "${enable_eot+set}" = set || enable_eot=no)
1324 libo_FUZZ_ARG_ENABLE(cve-tests,
1325     AS_HELP_STRING([--disable-cve-tests],
1326         [Prevent CVE tests to be executed]),
1329 libo_FUZZ_ARG_ENABLE(chart-tests,
1330     AS_HELP_STRING([--enable-chart-tests],
1331         [Executes chart XShape tests. In a perfect world these tests would be
1332          stable and everyone could run them, in reality it is best to run them
1333          only on a few machines that are known to work and maintained by people
1334          who can judge if a test failure is a regression or not.]),
1337 AC_ARG_ENABLE(build-unowinreg,
1338     AS_HELP_STRING([--enable-build-unowinreg],
1339         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1340          compiler is needed on Linux.]),
1343 AC_ARG_ENABLE(build-opensymbol,
1344     AS_HELP_STRING([--enable-build-opensymbol],
1345         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1346          fontforge installed.]),
1349 AC_ARG_ENABLE(dependency-tracking,
1350     AS_HELP_STRING([--enable-dependency-tracking],
1351         [Do not reject slow dependency extractors.])[
1352   --disable-dependency-tracking
1353                           Disables generation of dependency information.
1354                           Speed up one-time builds.],
1357 AC_ARG_ENABLE(icecream,
1358     AS_HELP_STRING([--enable-icecream],
1359         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1360          It defaults to /opt/icecream for the location of the icecream gcc/g++
1361          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1364 AC_ARG_ENABLE(ld,
1365     AS_HELP_STRING([--enable-ld=<linker>],
1366         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1369 libo_FUZZ_ARG_ENABLE(cups,
1370     AS_HELP_STRING([--disable-cups],
1371         [Do not build cups support.])
1374 AC_ARG_ENABLE(ccache,
1375     AS_HELP_STRING([--disable-ccache],
1376         [Do not try to use ccache automatically.
1377          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1378          CC/CXX are not yet set, and --enable-icecream is not given, we
1379          attempt to use ccache. --disable-ccache disables ccache completely.
1383 AC_ARG_ENABLE(64-bit,
1384     AS_HELP_STRING([--enable-64-bit],
1385         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1386          At the moment meaningful only for Windows.]), ,)
1388 libo_FUZZ_ARG_ENABLE(online-update,
1389     AS_HELP_STRING([--enable-online-update],
1390         [Enable the online update service that will check for new versions of
1391          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1392          If the value is "mar", the experimental Mozilla-like update will be
1393          enabled instead of the traditional update mechanism.]),
1396 AC_ARG_WITH(update-config,
1397     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1398                    [Path to the update config ini file]))
1400 libo_FUZZ_ARG_ENABLE(extension-update,
1401     AS_HELP_STRING([--disable-extension-update],
1402         [Disable possibility to update installed extensions.]),
1405 libo_FUZZ_ARG_ENABLE(release-build,
1406     AS_HELP_STRING([--enable-release-build],
1407         [Enable release build. Note that the "release build" choice is orthogonal to
1408          whether symbols are present, debug info is generated, or optimization
1409          is done.
1410          See http://wiki.documentfoundation.org/Development/DevBuild]),
1413 AC_ARG_ENABLE(windows-build-signing,
1414     AS_HELP_STRING([--enable-windows-build-signing],
1415         [Enable signing of windows binaries (*.exe, *.dll)]),
1418 AC_ARG_ENABLE(silent-msi,
1419     AS_HELP_STRING([--enable-silent-msi],
1420         [Enable MSI with LIMITUI=1 (silent install).]),
1423 AC_ARG_ENABLE(macosx-code-signing,
1424     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1425         [Sign executables, dylibs, frameworks and the app bundle. If you
1426          don't provide an identity the first suitable certificate
1427          in your keychain is used.]),
1430 AC_ARG_ENABLE(macosx-package-signing,
1431     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1432         [Create a .pkg suitable for uploading to the Mac App Store and sign
1433          it. If you don't provide an identity the first suitable certificate
1434          in your keychain is used.]),
1437 AC_ARG_ENABLE(macosx-sandbox,
1438     AS_HELP_STRING([--enable-macosx-sandbox],
1439         [Make the app bundle run in a sandbox. Requires code signing.
1440          Is required by apps distributed in the Mac App Store, and implies
1441          adherence to App Store rules.]),
1444 AC_ARG_WITH(macosx-bundle-identifier,
1445     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1446         [Define the OS X bundle identifier. Default is the somewhat weird
1447          org.libreoffice.script ("script", huh?).]),
1448 ,with_macosx_bundle_identifier=org.libreoffice.script)
1450 AC_ARG_WITH(product-name,
1451     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1452         [Define the product name. Default is AC_PACKAGE_NAME.]),
1453 ,with_product_name=$PRODUCTNAME)
1455 AC_ARG_WITH(package-version,
1456     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1457         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1460 libo_FUZZ_ARG_ENABLE(readonly-installset,
1461     AS_HELP_STRING([--enable-readonly-installset],
1462         [Prevents any attempts by LibreOffice to write into its installation. That means
1463          at least that no "system-wide" extensions can be added. Partly experimental work in
1464          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1467 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1468     AS_HELP_STRING([--disable-postgresql-sdbc],
1469         [Disable the build of the PostgreSQL-SDBC driver.])
1472 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1473     AS_HELP_STRING([--disable-lotuswordpro],
1474         [Disable the build of the Lotus Word Pro filter.]),
1475 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1477 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1478     AS_HELP_STRING([--disable-firebird-sdbc],
1479         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1480 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1482 AC_ARG_ENABLE(bogus-pkg-config,
1483     AS_HELP_STRING([--enable-bogus-pkg-config],
1484         [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.]),
1487 AC_ARG_ENABLE(openssl,
1488     AS_HELP_STRING([--disable-openssl],
1489         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1490          components will either use GNUTLS or NSS. Work in progress,
1491          use only if you are hacking on it.]),
1492 ,enable_openssl=yes)
1494 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1495     AS_HELP_STRING([--enable-cipher-openssl-backend],
1496         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1497          Requires --enable-openssl.]))
1499 AC_ARG_ENABLE(library-bin-tar,
1500     AS_HELP_STRING([--enable-library-bin-tar],
1501         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1502         Some libraries can save their build result in a tarball
1503         stored in TARFILE_LOCATION. That binary tarball is
1504         uniquely identified by the source tarball,
1505         the content of the config_host.mk file and the content
1506         of the top-level directory in core for that library
1507         If this option is enabled, then if such a tarfile exist, it will be untarred
1508         instead of the source tarfile, and the build step will be skipped for that
1509         library.
1510         If a proper tarfile does not exist, then the normal source-based
1511         build is done for that library and a proper binary tarfile is created
1512         for the next time.]),
1515 AC_ARG_ENABLE(dconf,
1516     AS_HELP_STRING([--disable-dconf],
1517         [Disable the dconf configuration backend (enabled by default where
1518          available).]))
1520 libo_FUZZ_ARG_ENABLE(formula-logger,
1521     AS_HELP_STRING(
1522         [--enable-formula-logger],
1523         [Enable formula logger for logging formula calculation flow in Calc.]
1524     )
1527 dnl ===================================================================
1528 dnl Optional Packages (--with/without-)
1529 dnl ===================================================================
1531 AC_ARG_WITH(gcc-home,
1532     AS_HELP_STRING([--with-gcc-home],
1533         [Specify the location of gcc/g++ manually. This can be used in conjunction
1534          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1535          non-default path.]),
1538 AC_ARG_WITH(gnu-patch,
1539     AS_HELP_STRING([--with-gnu-patch],
1540         [Specify location of GNU patch on Solaris or FreeBSD.]),
1543 AC_ARG_WITH(build-platform-configure-options,
1544     AS_HELP_STRING([--with-build-platform-configure-options],
1545         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1548 AC_ARG_WITH(gnu-cp,
1549     AS_HELP_STRING([--with-gnu-cp],
1550         [Specify location of GNU cp on Solaris or FreeBSD.]),
1553 AC_ARG_WITH(external-tar,
1554     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1555         [Specify an absolute path of where to find (and store) tarfiles.]),
1556     TARFILE_LOCATION=$withval ,
1559 AC_ARG_WITH(referenced-git,
1560     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1561         [Specify another checkout directory to reference. This makes use of
1562                  git submodule update --reference, and saves a lot of diskspace
1563                  when having multiple trees side-by-side.]),
1564     GIT_REFERENCE_SRC=$withval ,
1567 AC_ARG_WITH(linked-git,
1568     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1569         [Specify a directory where the repositories of submodules are located.
1570          This uses a method similar to git-new-workdir to get submodules.]),
1571     GIT_LINK_SRC=$withval ,
1574 AC_ARG_WITH(galleries,
1575     AS_HELP_STRING([--with-galleries],
1576         [Specify how galleries should be built. It is possible either to
1577          build these internally from source ("build"),
1578          or to disable them ("no")]),
1581 AC_ARG_WITH(theme,
1582     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1583         [Choose which themes to include. By default those themes with an '*' are included.
1584          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1587 libo_FUZZ_ARG_WITH(helppack-integration,
1588     AS_HELP_STRING([--without-helppack-integration],
1589         [It will not integrate the helppacks to the installer
1590          of the product. Please use this switch to use the online help
1591          or separate help packages.]),
1594 libo_FUZZ_ARG_WITH(fonts,
1595     AS_HELP_STRING([--without-fonts],
1596         [LibreOffice includes some third-party fonts to provide a reliable basis for
1597          help content, templates, samples, etc. When these fonts are already
1598          known to be available on the system then you should use this option.]),
1601 AC_ARG_WITH(epm,
1602     AS_HELP_STRING([--with-epm],
1603         [Decides which epm to use. Default is to use the one from the system if
1604          one is built. When either this is not there or you say =internal epm
1605          will be built.]),
1608 AC_ARG_WITH(package-format,
1609     AS_HELP_STRING([--with-package-format],
1610         [Specify package format(s) for LibreOffice installation sets. The
1611          implicit --without-package-format leads to no installation sets being
1612          generated. Possible values: aix, archive, bsd, deb, dmg,
1613          installed, msi, pkg, and rpm.
1614          Example: --with-package-format='deb rpm']),
1617 AC_ARG_WITH(tls,
1618     AS_HELP_STRING([--with-tls],
1619         [Decides which TLS/SSL and cryptographic implementations to use for
1620          LibreOffice's code. Notice that this doesn't apply for depending
1621          libraries like "neon", for example. Default is to use OpenSSL
1622          although NSS is also possible. Notice that selecting NSS restricts
1623          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1624          restrict by now the usage of NSS in LO's code. Possible values:
1625          openssl, nss. Example: --with-tls="nss"]),
1628 AC_ARG_WITH(system-libs,
1629     AS_HELP_STRING([--with-system-libs],
1630         [Use libraries already on system -- enables all --with-system-* flags.]),
1633 AC_ARG_WITH(system-bzip2,
1634     AS_HELP_STRING([--with-system-bzip2],
1635         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1636     [with_system_bzip2="$with_system_libs"])
1638 AC_ARG_WITH(system-headers,
1639     AS_HELP_STRING([--with-system-headers],
1640         [Use headers already on system -- enables all --with-system-* flags for
1641          external packages whose headers are the only entities used i.e.
1642          boost/odbc/sane-header(s).]),,
1643     [with_system_headers="$with_system_libs"])
1645 AC_ARG_WITH(system-jars,
1646     AS_HELP_STRING([--without-system-jars],
1647         [When building with --with-system-libs, also the needed jars are expected
1648          on the system. Use this to disable that]),,
1649     [with_system_jars="$with_system_libs"])
1651 AC_ARG_WITH(system-cairo,
1652     AS_HELP_STRING([--with-system-cairo],
1653         [Use cairo libraries already on system.  Happens automatically for
1654          (implicit) --enable-gtk and for --enable-gtk3.]))
1656 AC_ARG_WITH(system-epoxy,
1657     AS_HELP_STRING([--with-system-epoxy],
1658         [Use epoxy libraries already on system.  Happens automatically for
1659          --enable-gtk3.]),,
1660        [with_system_epoxy="$with_system_libs"])
1662 AC_ARG_WITH(myspell-dicts,
1663     AS_HELP_STRING([--with-myspell-dicts],
1664         [Adds myspell dictionaries to the LibreOffice installation set]),
1667 AC_ARG_WITH(system-dicts,
1668     AS_HELP_STRING([--without-system-dicts],
1669         [Do not use dictionaries from system paths.]),
1672 AC_ARG_WITH(external-dict-dir,
1673     AS_HELP_STRING([--with-external-dict-dir],
1674         [Specify external dictionary dir.]),
1677 AC_ARG_WITH(external-hyph-dir,
1678     AS_HELP_STRING([--with-external-hyph-dir],
1679         [Specify external hyphenation pattern dir.]),
1682 AC_ARG_WITH(external-thes-dir,
1683     AS_HELP_STRING([--with-external-thes-dir],
1684         [Specify external thesaurus dir.]),
1687 AC_ARG_WITH(system-zlib,
1688     AS_HELP_STRING([--with-system-zlib],
1689         [Use zlib already on system.]),,
1690     [with_system_zlib=auto])
1692 AC_ARG_WITH(system-jpeg,
1693     AS_HELP_STRING([--with-system-jpeg],
1694         [Use jpeg already on system.]),,
1695     [with_system_jpeg="$with_system_libs"])
1697 AC_ARG_WITH(system-clucene,
1698     AS_HELP_STRING([--with-system-clucene],
1699         [Use clucene already on system.]),,
1700     [with_system_clucene="$with_system_libs"])
1702 AC_ARG_WITH(system-expat,
1703     AS_HELP_STRING([--with-system-expat],
1704         [Use expat already on system.]),,
1705     [with_system_expat="$with_system_libs"])
1707 AC_ARG_WITH(system-libxml,
1708     AS_HELP_STRING([--with-system-libxml],
1709         [Use libxml/libxslt already on system.]),,
1710     [with_system_libxml=auto])
1712 AC_ARG_WITH(system-icu,
1713     AS_HELP_STRING([--with-system-icu],
1714         [Use icu already on system.]),,
1715     [with_system_icu="$with_system_libs"])
1717 AC_ARG_WITH(system-ucpp,
1718     AS_HELP_STRING([--with-system-ucpp],
1719         [Use ucpp already on system.]),,
1720     [])
1722 AC_ARG_WITH(system-openldap,
1723     AS_HELP_STRING([--with-system-openldap],
1724         [Use the OpenLDAP LDAP SDK already on system.]),,
1725     [with_system_openldap="$with_system_libs"])
1727 AC_ARG_WITH(system-poppler,
1728     AS_HELP_STRING([--with-system-poppler],
1729         [Use system poppler (only needed for PDF import).]),,
1730     [with_system_poppler="$with_system_libs"])
1732 AC_ARG_WITH(system-gpgmepp,
1733     AS_HELP_STRING([--with-system-gpgmepp],
1734         [Use gpgmepp already on system]),,
1735     [with_system_gpgmepp="$with_system_libs"])
1737 AC_ARG_WITH(system-apache-commons,
1738     AS_HELP_STRING([--with-system-apache-commons],
1739         [Use Apache commons libraries already on system.]),,
1740     [with_system_apache_commons="$with_system_jars"])
1742 AC_ARG_WITH(system-mariadb,
1743     AS_HELP_STRING([--with-system-mariadb],
1744         [Use MariaDB/MySQL libraries already on system.]),,
1745     [with_system_mariadb="$with_system_libs"])
1747 AC_ARG_ENABLE(bundle-mariadb,
1748     AS_HELP_STRING([--enable-bundle-mariadb],
1749         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1752 AC_ARG_WITH(system-postgresql,
1753     AS_HELP_STRING([--with-system-postgresql],
1754         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1755          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1756     [with_system_postgresql="$with_system_libs"])
1758 AC_ARG_WITH(libpq-path,
1759     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1760         [Use this PostgreSQL C interface (libpq) installation for building
1761          the PostgreSQL-SDBC extension.]),
1764 AC_ARG_WITH(system-firebird,
1765     AS_HELP_STRING([--with-system-firebird],
1766         [Use Firebird libraries already on system, for building the Firebird-SDBC
1767          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1768     [with_system_firebird="$with_system_libs"])
1770 AC_ARG_WITH(system-libtommath,
1771             AS_HELP_STRING([--with-system-libtommath],
1772                            [Use libtommath already on system]),,
1773             [with_system_libtommath="$with_system_libs"])
1775 AC_ARG_WITH(system-hsqldb,
1776     AS_HELP_STRING([--with-system-hsqldb],
1777         [Use hsqldb already on system.]))
1779 AC_ARG_WITH(hsqldb-jar,
1780     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1781         [Specify path to jarfile manually.]),
1782     HSQLDB_JAR=$withval)
1784 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1785     AS_HELP_STRING([--disable-scripting-beanshell],
1786         [Disable support for scripts in BeanShell.]),
1790 AC_ARG_WITH(system-beanshell,
1791     AS_HELP_STRING([--with-system-beanshell],
1792         [Use beanshell already on system.]),,
1793     [with_system_beanshell="$with_system_jars"])
1795 AC_ARG_WITH(beanshell-jar,
1796     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1797         [Specify path to jarfile manually.]),
1798     BSH_JAR=$withval)
1800 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1801     AS_HELP_STRING([--disable-scripting-javascript],
1802         [Disable support for scripts in JavaScript.]),
1806 AC_ARG_WITH(system-rhino,
1807     AS_HELP_STRING([--with-system-rhino],
1808         [Use rhino already on system.]),,)
1809 #    [with_system_rhino="$with_system_jars"])
1810 # Above is not used as we have different debug interface
1811 # patched into internal rhino. This code needs to be fixed
1812 # before we can enable it by default.
1814 AC_ARG_WITH(rhino-jar,
1815     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     RHINO_JAR=$withval)
1819 AC_ARG_WITH(commons-logging-jar,
1820     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1821         [Specify path to jarfile manually.]),
1822     COMMONS_LOGGING_JAR=$withval)
1824 AC_ARG_WITH(system-jfreereport,
1825     AS_HELP_STRING([--with-system-jfreereport],
1826         [Use JFreeReport already on system.]),,
1827     [with_system_jfreereport="$with_system_jars"])
1829 AC_ARG_WITH(sac-jar,
1830     AS_HELP_STRING([--with-sac-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     SAC_JAR=$withval)
1834 AC_ARG_WITH(libxml-jar,
1835     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     LIBXML_JAR=$withval)
1839 AC_ARG_WITH(flute-jar,
1840     AS_HELP_STRING([--with-flute-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     FLUTE_JAR=$withval)
1844 AC_ARG_WITH(jfreereport-jar,
1845     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     JFREEREPORT_JAR=$withval)
1849 AC_ARG_WITH(liblayout-jar,
1850     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1851         [Specify path to jarfile manually.]),
1852     LIBLAYOUT_JAR=$withval)
1854 AC_ARG_WITH(libloader-jar,
1855     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1856         [Specify path to jarfile manually.]),
1857     LIBLOADER_JAR=$withval)
1859 AC_ARG_WITH(libformula-jar,
1860     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1861         [Specify path to jarfile manually.]),
1862     LIBFORMULA_JAR=$withval)
1864 AC_ARG_WITH(librepository-jar,
1865     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     LIBREPOSITORY_JAR=$withval)
1869 AC_ARG_WITH(libfonts-jar,
1870     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1871         [Specify path to jarfile manually.]),
1872     LIBFONTS_JAR=$withval)
1874 AC_ARG_WITH(libserializer-jar,
1875     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1876         [Specify path to jarfile manually.]),
1877     LIBSERIALIZER_JAR=$withval)
1879 AC_ARG_WITH(libbase-jar,
1880     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1881         [Specify path to jarfile manually.]),
1882     LIBBASE_JAR=$withval)
1884 AC_ARG_WITH(system-odbc,
1885     AS_HELP_STRING([--with-system-odbc],
1886         [Use the odbc headers already on system.]),,
1887     [with_system_odbc="auto"])
1889 AC_ARG_WITH(system-sane,
1890     AS_HELP_STRING([--with-system-sane],
1891         [Use sane.h already on system.]),,
1892     [with_system_sane="$with_system_headers"])
1894 AC_ARG_WITH(system-bluez,
1895     AS_HELP_STRING([--with-system-bluez],
1896         [Use bluetooth.h already on system.]),,
1897     [with_system_bluez="$with_system_headers"])
1899 AC_ARG_WITH(system-curl,
1900     AS_HELP_STRING([--with-system-curl],
1901         [Use curl already on system.]),,
1902     [with_system_curl=auto])
1904 AC_ARG_WITH(system-boost,
1905     AS_HELP_STRING([--with-system-boost],
1906         [Use boost already on system.]),,
1907     [with_system_boost="$with_system_headers"])
1909 AC_ARG_WITH(system-glm,
1910     AS_HELP_STRING([--with-system-glm],
1911         [Use glm already on system.]),,
1912     [with_system_glm="$with_system_headers"])
1914 AC_ARG_WITH(system-hunspell,
1915     AS_HELP_STRING([--with-system-hunspell],
1916         [Use libhunspell already on system.]),,
1917     [with_system_hunspell="$with_system_libs"])
1919 AC_ARG_WITH(system-mythes,
1920     AS_HELP_STRING([--with-system-mythes],
1921         [Use mythes already on system.]),,
1922     [with_system_mythes="$with_system_libs"])
1924 AC_ARG_WITH(system-altlinuxhyph,
1925     AS_HELP_STRING([--with-system-altlinuxhyph],
1926         [Use ALTLinuxhyph already on system.]),,
1927     [with_system_altlinuxhyph="$with_system_libs"])
1929 AC_ARG_WITH(system-lpsolve,
1930     AS_HELP_STRING([--with-system-lpsolve],
1931         [Use lpsolve already on system.]),,
1932     [with_system_lpsolve="$with_system_libs"])
1934 AC_ARG_WITH(system-coinmp,
1935     AS_HELP_STRING([--with-system-coinmp],
1936         [Use CoinMP already on system.]),,
1937     [with_system_coinmp="$with_system_libs"])
1939 AC_ARG_WITH(system-liblangtag,
1940     AS_HELP_STRING([--with-system-liblangtag],
1941         [Use liblangtag library already on system.]),,
1942     [with_system_liblangtag="$with_system_libs"])
1944 AC_ARG_WITH(webdav,
1945     AS_HELP_STRING([--with-webdav],
1946         [Specify which library to use for webdav implementation.
1947          Possible values: "neon", "serf", "no". The default value is "neon".
1948          Example: --with-webdav="serf"]),
1949     WITH_WEBDAV=$withval,
1950     WITH_WEBDAV="neon")
1952 AC_ARG_WITH(linker-hash-style,
1953     AS_HELP_STRING([--with-linker-hash-style],
1954         [Use linker with --hash-style=<style> when linking shared objects.
1955          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1956          if supported on the build system, and "sysv" otherwise.]))
1958 AC_ARG_WITH(jdk-home,
1959     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1960         [If you have installed JDK 1.6 or later on your system please supply the
1961          path here. Note that this is not the location of the java command but the
1962          location of the entire distribution.]),
1965 AC_ARG_WITH(help,
1966     AS_HELP_STRING([--with-help],
1967         [Enable the build of help. There is a special parameter "common" that
1968          can be used to bundle only the common part, .e.g help-specific icons.
1969          This is useful when you build the helpcontent separately.])
1970     [
1971                           Usage:     --with-help    build the old local help
1972                                  --without-help     no local help (default)
1973                                  --with-help=html   build the new HTML local help
1974                                  --with-help=online build the new HTML online help
1975     ],
1978 libo_FUZZ_ARG_WITH(java,
1979     AS_HELP_STRING([--with-java=<java command>],
1980         [Specify the name of the Java interpreter command. Typically "java"
1981          which is the default.
1983          To build without support for Java components, applets, accessibility
1984          or the XML filters written in Java, use --without-java or --with-java=no.]),
1985     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1986     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1989 AC_ARG_WITH(jvm-path,
1990     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1991         [Use a specific JVM search path at runtime.
1992          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1995 AC_ARG_WITH(ant-home,
1996     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1997         [If you have installed Jakarta Ant on your system, please supply the path here.
1998          Note that this is not the location of the Ant binary but the location
1999          of the entire distribution.]),
2002 AC_ARG_WITH(symbol-config,
2003     AS_HELP_STRING([--with-symbol-config],
2004         [Configuration for the crashreport symbol upload]),
2005         [],
2006         [with_symbol_config=no])
2008 AC_ARG_WITH(export-validation,
2009     AS_HELP_STRING([--without-export-validation],
2010         [Disable validating OOXML and ODF files as exported from in-tree tests.
2011          Use this option e.g. if your system only provides Java 5.]),
2012 ,with_export_validation=auto)
2014 AC_ARG_WITH(bffvalidator,
2015     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2016         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2017          Requires installed Microsoft Office Binary File Format Validator.
2018          Note: export-validation (--with-export-validation) is required to be turned on.
2019          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2020 ,with_bffvalidator=no)
2022 libo_FUZZ_ARG_WITH(junit,
2023     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2024         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2025          --without-junit disables those tests. Not relevant in the --without-java case.]),
2026 ,with_junit=yes)
2028 AC_ARG_WITH(hamcrest,
2029     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2030         [Specifies the hamcrest jar file to use for JUnit-based tests.
2031          --without-junit disables those tests. Not relevant in the --without-java case.]),
2032 ,with_hamcrest=yes)
2034 AC_ARG_WITH(perl-home,
2035     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2036         [If you have installed Perl 5 Distribution, on your system, please
2037          supply the path here. Note that this is not the location of the Perl
2038          binary but the location of the entire distribution.]),
2041 libo_FUZZ_ARG_WITH(doxygen,
2042     AS_HELP_STRING(
2043         [--with-doxygen=<absolute path to doxygen executable>],
2044         [Specifies the doxygen executable to use when generating ODK C/C++
2045          documentation. --without-doxygen disables generation of ODK C/C++
2046          documentation. Not relevant in the --disable-odk case.]),
2047 ,with_doxygen=yes)
2049 AC_ARG_WITH(visual-studio,
2050     AS_HELP_STRING([--with-visual-studio=<2017>],
2051         [Specify which Visual Studio version to use in case several are
2052          installed. Currently only 2017 is supported.]),
2055 AC_ARG_WITH(windows-sdk,
2056     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2057         [Specify which Windows SDK, or "Windows Kit", version to use
2058          in case the one that came with the selected Visual Studio
2059          is not what you want for some reason. Note that not all compiler/SDK
2060          combinations are supported. The intent is that this option should not
2061          be needed.]),
2064 AC_ARG_WITH(lang,
2065     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2066         [Use this option to build LibreOffice with additional UI language support.
2067          English (US) is always included by default.
2068          Separate multiple languages with space.
2069          For all languages, use --with-lang=ALL.]),
2072 AC_ARG_WITH(locales,
2073     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2074         [Use this option to limit the locale information built in.
2075          Separate multiple locales with space.
2076          Very experimental and might well break stuff.
2077          Just a desperate measure to shrink code and data size.
2078          By default all the locales available is included.
2079          This option is completely unrelated to --with-lang.])
2080     [
2081                           Affects also our character encoding conversion
2082                           tables for encodings mainly targeted for a
2083                           particular locale, like EUC-CN and EUC-TW for
2084                           zh, ISO-2022-JP for ja.
2086                           Affects also our add-on break iterator data for
2087                           some languages.
2089                           For the default, all locales, don't use this switch at all.
2090                           Specifying just the language part of a locale means all matching
2091                           locales will be included.
2092     ],
2095 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2096 libo_FUZZ_ARG_WITH(krb5,
2097     AS_HELP_STRING([--with-krb5],
2098         [Enable MIT Kerberos 5 support in modules that support it.
2099          By default automatically enabled on platforms
2100          where a good system Kerberos 5 is available.]),
2103 libo_FUZZ_ARG_WITH(gssapi,
2104     AS_HELP_STRING([--with-gssapi],
2105         [Enable GSSAPI support in modules that support it.
2106          By default automatically enabled on platforms
2107          where a good system GSSAPI is available.]),
2110 AC_ARG_WITH(iwyu,
2111     AS_HELP_STRING([--with-iwyu],
2112         [Use given IWYU binary path to check unneeded includes instead of building.
2113          Use only if you are hacking on it.]),
2116 libo_FUZZ_ARG_WITH(lxml,
2117     AS_HELP_STRING([--without-lxml],
2118         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2119          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2120          report widget classes and ids.]),
2123 dnl ===================================================================
2124 dnl Branding
2125 dnl ===================================================================
2127 AC_ARG_WITH(branding,
2128     AS_HELP_STRING([--with-branding=/path/to/images],
2129         [Use given path to retrieve branding images set.])
2130     [
2131                           Search for intro.png about.svg and flat_logo.svg.
2132                           If any is missing, default ones will be used instead.
2134                           Search also progress.conf for progress
2135                           settings on intro screen :
2137                           PROGRESSBARCOLOR="255,255,255" Set color of
2138                           progress bar. Comma separated RGB decimal values.
2139                           PROGRESSSIZE="407,6" Set size of progress bar.
2140                           Comma separated decimal values (width, height).
2141                           PROGRESSPOSITION="61,317" Set position of progress
2142                           bar from left,top. Comma separated decimal values.
2143                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2144                           bar frame. Comma separated RGB decimal values.
2145                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2146                           bar text. Comma separated RGB decimal values.
2147                           PROGRESSTEXTBASELINE="287" Set vertical position of
2148                           progress bar text from top. Decimal value.
2150                           Default values will be used if not found.
2151     ],
2155 AC_ARG_WITH(extra-buildid,
2156     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2157         [Show addition build identification in about dialog.]),
2161 AC_ARG_WITH(vendor,
2162     AS_HELP_STRING([--with-vendor="John the Builder"],
2163         [Set vendor of the build.]),
2166 AC_ARG_WITH(android-package-name,
2167     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2168         [Set Android package name of the build.]),
2171 AC_ARG_WITH(compat-oowrappers,
2172     AS_HELP_STRING([--with-compat-oowrappers],
2173         [Install oo* wrappers in parallel with
2174          lo* ones to keep backward compatibility.
2175          Has effect only with make distro-pack-install]),
2178 AC_ARG_WITH(os-version,
2179     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2180         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2183 AC_ARG_WITH(mingw-cross-compiler,
2184     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2185         [Specify the MinGW cross-compiler to use.
2186          When building on the ODK on Unix and building unowinreg.dll,
2187          specify the MinGW C++ cross-compiler.]),
2190 AC_ARG_WITH(idlc-cpp,
2191     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2192         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2195 AC_ARG_WITH(build-version,
2196     AS_HELP_STRING([--with-build-version="Built by Jim"],
2197         [Allows the builder to add a custom version tag that will appear in the
2198          Help/About box for QA purposes.]),
2199 with_build_version=$withval,
2202 AC_ARG_WITH(parallelism,
2203     AS_HELP_STRING([--with-parallelism],
2204         [Number of jobs to run simultaneously during build. Parallel builds can
2205         save a lot of time on multi-cpu machines. Defaults to the number of
2206         CPUs on the machine, unless you configure --enable-icecream - then to
2207         10.]),
2210 AC_ARG_WITH(all-tarballs,
2211     AS_HELP_STRING([--with-all-tarballs],
2212         [Download all external tarballs unconditionally]))
2214 AC_ARG_WITH(gdrive-client-id,
2215     AS_HELP_STRING([--with-gdrive-client-id],
2216         [Provides the client id of the application for OAuth2 authentication
2217         on Google Drive. If either this or --with-gdrive-client-secret is
2218         empty, the feature will be disabled]),
2221 AC_ARG_WITH(gdrive-client-secret,
2222     AS_HELP_STRING([--with-gdrive-client-secret],
2223         [Provides the client secret of the application for OAuth2
2224         authentication on Google Drive. If either this or
2225         --with-gdrive-client-id is empty, the feature will be disabled]),
2228 AC_ARG_WITH(alfresco-cloud-client-id,
2229     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2230         [Provides the client id of the application for OAuth2 authentication
2231         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2232         empty, the feature will be disabled]),
2235 AC_ARG_WITH(alfresco-cloud-client-secret,
2236     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2237         [Provides the client secret of the application for OAuth2
2238         authentication on Alfresco Cloud. If either this or
2239         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2242 AC_ARG_WITH(onedrive-client-id,
2243     AS_HELP_STRING([--with-onedrive-client-id],
2244         [Provides the client id of the application for OAuth2 authentication
2245         on OneDrive. If either this or --with-onedrive-client-secret is
2246         empty, the feature will be disabled]),
2249 AC_ARG_WITH(onedrive-client-secret,
2250     AS_HELP_STRING([--with-onedrive-client-secret],
2251         [Provides the client secret of the application for OAuth2
2252         authentication on OneDrive. If either this or
2253         --with-onedrive-client-id is empty, the feature will be disabled]),
2255 dnl ===================================================================
2256 dnl Do we want to use pre-build binary tarball for recompile
2257 dnl ===================================================================
2259 if test "$enable_library_bin_tar" = "yes" ; then
2260     USE_LIBRARY_BIN_TAR=TRUE
2261 else
2262     USE_LIBRARY_BIN_TAR=
2264 AC_SUBST(USE_LIBRARY_BIN_TAR)
2266 dnl ===================================================================
2267 dnl Test whether build target is Release Build
2268 dnl ===================================================================
2269 AC_MSG_CHECKING([whether build target is Release Build])
2270 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2271     AC_MSG_RESULT([no])
2272     ENABLE_RELEASE_BUILD=
2273 else
2274     AC_MSG_RESULT([yes])
2275     ENABLE_RELEASE_BUILD=TRUE
2277 AC_SUBST(ENABLE_RELEASE_BUILD)
2279 dnl ===================================================================
2280 dnl Test whether to sign Windows Build
2281 dnl ===================================================================
2282 AC_MSG_CHECKING([whether to sign windows build])
2283 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2284     AC_MSG_RESULT([yes])
2285     WINDOWS_BUILD_SIGNING="TRUE"
2286 else
2287     AC_MSG_RESULT([no])
2288     WINDOWS_BUILD_SIGNING="FALSE"
2290 AC_SUBST(WINDOWS_BUILD_SIGNING)
2292 dnl ===================================================================
2293 dnl MacOSX build and runtime environment options
2294 dnl ===================================================================
2296 AC_ARG_WITH(macosx-sdk,
2297     AS_HELP_STRING([--with-macosx-sdk=<version>],
2298         [Prefer a specific SDK for building.])
2299     [
2300                           If the requested SDK is not available, a search for the oldest one will be done.
2301                           With current Xcode versions, only the latest SDK is included, so this option is
2302                           not terribly useful. It works fine to build with a new SDK and run the result
2303                           on an older OS.
2305                           e. g.: --with-macosx-sdk=10.9
2307                           there are 3 options to control the MacOSX build:
2308                           --with-macosx-sdk (referred as 'sdk' below)
2309                           --with-macosx-version-min-required (referred as 'min' below)
2310                           --with-macosx-version-max-allowed (referred as 'max' below)
2312                           the connection between these value and the default they take is as follow:
2313                           ( ? means not specified on the command line, s means the SDK version found,
2314                           constraint: 8 <= x <= y <= z)
2316                           ==========================================
2317                            command line      || config result
2318                           ==========================================
2319                           min  | max  | sdk  || min  | max  | sdk  |
2320                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2321                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2322                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2323                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2324                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2325                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2326                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2327                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2330                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2331                           for a detailed technical explanation of these variables
2333                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2334     ],
2337 AC_ARG_WITH(macosx-version-min-required,
2338     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2339         [set the minimum OS version needed to run the built LibreOffice])
2340     [
2341                           e. g.: --with-macos-version-min-required=10.9
2342                           see --with-macosx-sdk for more info
2343     ],
2346 AC_ARG_WITH(macosx-version-max-allowed,
2347     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2348         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2349     [
2350                           e. g.: --with-macos-version-max-allowed=10.9
2351                           see --with-macosx-sdk for more info
2352     ],
2356 dnl ===================================================================
2357 dnl options for stuff used during cross-compilation build
2358 dnl Not quite superseded by --with-build-platform-configure-options.
2359 dnl TODO: check, if the "force" option is still needed anywhere.
2360 dnl ===================================================================
2362 AC_ARG_WITH(system-icu-for-build,
2363     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2364         [Use icu already on system for build tools (cross-compilation only).]))
2367 dnl ===================================================================
2368 dnl Check for incompatible options set by fuzzing, and reset those
2369 dnl automatically to working combinations
2370 dnl ===================================================================
2372 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2373         "$enable_dbus" != "$enable_avahi"; then
2374     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2375     enable_avahi=$enable_dbus
2378 dnl ===================================================================
2379 dnl check for required programs (grep, awk, sed, bash)
2380 dnl ===================================================================
2382 pathmunge ()
2384     if test -n "$1"; then
2385         if test "$build_os" = "cygwin"; then
2386             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2387                 PathFormat "$1"
2388                 new_path=`cygpath -sm "$formatted_path"`
2389             else
2390                 PathFormat "$1"
2391                 new_path=`cygpath -u "$formatted_path"`
2392             fi
2393         else
2394             new_path="$1"
2395         fi
2396         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2397             if test "$2" = "after"; then
2398                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2399             else
2400                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2401             fi
2402         fi
2403         unset new_path
2404     fi
2407 AC_PROG_AWK
2408 AC_PATH_PROG( AWK, $AWK)
2409 if test -z "$AWK"; then
2410     AC_MSG_ERROR([install awk to run this script])
2413 AC_PATH_PROG(BASH, bash)
2414 if test -z "$BASH"; then
2415     AC_MSG_ERROR([bash not found in \$PATH])
2417 AC_SUBST(BASH)
2419 AC_MSG_CHECKING([for GNU or BSD tar])
2420 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2421     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2422     if test $? -eq 0;  then
2423         GNUTAR=$a
2424         break
2425     fi
2426 done
2427 AC_MSG_RESULT($GNUTAR)
2428 if test -z "$GNUTAR"; then
2429     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2431 AC_SUBST(GNUTAR)
2433 AC_MSG_CHECKING([for tar's option to strip components])
2434 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2435 if test $? -eq 0; then
2436     STRIP_COMPONENTS="--strip-components"
2437 else
2438     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2439     if test $? -eq 0; then
2440         STRIP_COMPONENTS="--strip-path"
2441     else
2442         STRIP_COMPONENTS="unsupported"
2443     fi
2445 AC_MSG_RESULT($STRIP_COMPONENTS)
2446 if test x$STRIP_COMPONENTS = xunsupported; then
2447     AC_MSG_ERROR([you need a tar that is able to strip components.])
2449 AC_SUBST(STRIP_COMPONENTS)
2451 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2452 dnl desktop OSes from "mobile" ones.
2454 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2455 dnl In other words, that when building for an OS that is not a
2456 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2458 dnl Note the direction of the implication; there is no assumption that
2459 dnl cross-compiling would imply a non-desktop OS.
2461 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2462     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2463     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2464     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2467 # Whether to build "avmedia" functionality or not.
2469 if test -z "$enable_avmedia"; then
2470     enable_avmedia=yes
2473 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2474 if test "$enable_avmedia" = yes; then
2475     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2476 else
2477     USE_AVMEDIA_DUMMY='TRUE'
2479 AC_SUBST(USE_AVMEDIA_DUMMY)
2481 # Decide whether to build database connectivity stuff (including
2482 # Base) or not. We probably don't want to on non-desktop OSes.
2483 if test -z "$enable_database_connectivity"; then
2484     # --disable-database-connectivity is unfinished work in progress
2485     # and the iOS test app doesn't link if we actually try to use it.
2486     # if test $_os != iOS -a $_os != Android; then
2487     if test $_os != iOS; then
2488         enable_database_connectivity=yes
2489     fi
2492 if test "$enable_database_connectivity" = yes; then
2493     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2494     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2497 if test -z "$enable_extensions"; then
2498     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2499     if test $_os != iOS -a $_os != Android; then
2500         enable_extensions=yes
2501     fi
2504 if test "$enable_extensions" = yes; then
2505     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2506     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2509 if test -z "$enable_scripting"; then
2510     # Disable scripting for iOS unless specifically overridden
2511     # with --enable-scripting.
2512     if test $_os != iOS; then
2513         enable_scripting=yes
2514     fi
2517 DISABLE_SCRIPTING=''
2518 if test "$enable_scripting" = yes; then
2519     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2520     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2521 else
2522     DISABLE_SCRIPTING='TRUE'
2523     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2526 if test $_os = iOS -o $_os = Android; then
2527     # Disable dynamic_loading always for iOS and Android
2528     enable_dynamic_loading=no
2529 elif test -z "$enable_dynamic_loading"; then
2530     # Otherwise enable it unless speficically disabled
2531     enable_dynamic_loading=yes
2534 DISABLE_DYNLOADING=''
2535 if test "$enable_dynamic_loading" = yes; then
2536     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2537 else
2538     DISABLE_DYNLOADING='TRUE'
2540 AC_SUBST(DISABLE_DYNLOADING)
2542 # remenber SYSBASE value
2543 AC_SUBST(SYSBASE)
2545 dnl ===================================================================
2546 dnl  Sort out various gallery compilation options
2547 dnl ===================================================================
2548 AC_MSG_CHECKING([how to build and package galleries])
2549 if test -n "${with_galleries}"; then
2550     if test "$with_galleries" = "build"; then
2551         WITH_GALLERY_BUILD=TRUE
2552         AC_MSG_RESULT([build from source images internally])
2553     elif test "$with_galleries" = "no"; then
2554         WITH_GALLERY_BUILD=
2555         AC_MSG_RESULT([disable non-internal gallery build])
2556     else
2557         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2558     fi
2559 else
2560     if test $_os != iOS -a $_os != Android; then
2561         WITH_GALLERY_BUILD=TRUE
2562         AC_MSG_RESULT([internal src images for desktop])
2563     else
2564         WITH_GALLERY_BUILD=
2565         AC_MSG_RESULT([disable src image build])
2566     fi
2568 AC_SUBST(WITH_GALLERY_BUILD)
2570 dnl ===================================================================
2571 dnl  Checks if ccache is available
2572 dnl ===================================================================
2573 if test "$_os" = "WINNT"; then
2574     # on windows/VC build do not use ccache
2575     CCACHE=""
2576 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2577     case "%$CC%$CXX%" in
2578     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2579     # assume that's good then
2580     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2581         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2582         ;;
2583     *)
2584         AC_PATH_PROG([CCACHE],[ccache],[not found])
2585         if test "$CCACHE" = "not found"; then
2586             CCACHE=""
2587         else
2588             # Need to check for ccache version: otherwise prevents
2589             # caching of the results (like "-x objective-c++" for Mac)
2590             if test $_os = Darwin -o $_os = iOS; then
2591                 # Check ccache version
2592                 AC_MSG_CHECKING([whether version of ccache is suitable])
2593                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2594                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2595                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2596                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2597                 else
2598                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2599                     CCACHE=""
2600                 fi
2601             fi
2602         fi
2603         ;;
2604     esac
2605 else
2606     CCACHE=""
2609 if test "$CCACHE" != ""; then
2610     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2611     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2612     if test "$ccache_size" = ""; then
2613         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2614         if test "$ccache_size" = ""; then
2615             ccache_size=0
2616         fi
2617         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2618         if test $ccache_size -lt 1024; then
2619             CCACHE=""
2620             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2621             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2622         else
2623             # warn that ccache may be too small for debug build
2624             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2625             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2626         fi
2627     else
2628         if test $ccache_size -lt 5; then
2629             #warn that ccache may be too small for debug build
2630             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2631             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2632         fi
2633     fi
2636 dnl ===================================================================
2637 dnl  Checks for C compiler,
2638 dnl  The check for the C++ compiler is later on.
2639 dnl ===================================================================
2640 if test "$_os" != "WINNT"; then
2641     GCC_HOME_SET="true"
2642     AC_MSG_CHECKING([gcc home])
2643     if test -z "$with_gcc_home"; then
2644         if test "$enable_icecream" = "yes"; then
2645             if test -d "/usr/lib/icecc/bin"; then
2646                 GCC_HOME="/usr/lib/icecc/"
2647             elif test -d "/usr/libexec/icecc/bin"; then
2648                 GCC_HOME="/usr/libexec/icecc/"
2649             elif test -d "/opt/icecream/bin"; then
2650                 GCC_HOME="/opt/icecream/"
2651             else
2652                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2654             fi
2655         else
2656             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2657             GCC_HOME_SET="false"
2658         fi
2659     else
2660         GCC_HOME="$with_gcc_home"
2661     fi
2662     AC_MSG_RESULT($GCC_HOME)
2663     AC_SUBST(GCC_HOME)
2665     if test "$GCC_HOME_SET" = "true"; then
2666         if test -z "$CC"; then
2667             CC="$GCC_HOME/bin/gcc"
2668         fi
2669         if test -z "$CXX"; then
2670             CXX="$GCC_HOME/bin/g++"
2671         fi
2672     fi
2675 COMPATH=`dirname "$CC"`
2676 if test "$COMPATH" = "."; then
2677     AC_PATH_PROGS(COMPATH, $CC)
2678     dnl double square bracket to get single because of M4 quote...
2679     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2681 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2683 dnl ===================================================================
2684 dnl Java support
2685 dnl ===================================================================
2686 AC_MSG_CHECKING([whether to build with Java support])
2687 if test "$with_java" != "no"; then
2688     if test "$DISABLE_SCRIPTING" = TRUE; then
2689         AC_MSG_RESULT([no, overridden by --disable-scripting])
2690         ENABLE_JAVA=""
2691         with_java=no
2692     else
2693         AC_MSG_RESULT([yes])
2694         ENABLE_JAVA="TRUE"
2695         AC_DEFINE(HAVE_FEATURE_JAVA)
2696     fi
2697 else
2698     AC_MSG_RESULT([no])
2699     ENABLE_JAVA=""
2702 AC_SUBST(ENABLE_JAVA)
2704 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2706 dnl ENABLE_JAVA="" indicate no Java support at all
2708 dnl ===================================================================
2709 dnl Check OS X SDK and compiler
2710 dnl ===================================================================
2712 if test $_os = Darwin -o $_os = iOS; then
2714     # If no --with-macosx-sdk option is given, look for one
2716     # The intent is that for "most" Mac-based developers, a suitable
2717     # SDK will be found automatically without any configure options.
2719     # For developers with a current Xcode, the lowest-numbered SDK
2720     # higher than or equal to the minimum required should be found.
2722     AC_MSG_CHECKING([what Mac OS X SDK to use])
2723     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2724         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2725         if test -d "$MACOSX_SDK_PATH"; then
2726             with_macosx_sdk="${_macosx_sdk}"
2727             break
2728         else
2729             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2730             if test -d "$MACOSX_SDK_PATH"; then
2731                 with_macosx_sdk="${_macosx_sdk}"
2732                 break
2733             fi
2734         fi
2735     done
2736     if test ! -d "$MACOSX_SDK_PATH"; then
2737         AC_MSG_ERROR([Could not find an appropriate Mac OS X SDK])
2738     fi
2740     if test $_os = iOS; then
2741         if test "$enable_ios_simulator" = "yes"; then
2742             useos=iphonesimulator
2743         else
2744             useos=iphoneos
2745         fi
2746         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2747     fi
2748     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2751     case $with_macosx_sdk in
2752     10.12)
2753         MACOSX_SDK_VERSION=101200
2754         ;;
2755     10.13)
2756         MACOSX_SDK_VERSION=101300
2757         ;;
2758     10.14)
2759         MACOSX_SDK_VERSION=101400
2760         ;;
2761     *)
2762         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2763         ;;
2764     esac
2766     if test "$with_macosx_version_min_required" = "" ; then
2767         with_macosx_version_min_required="10.9";
2768     fi
2770     if test "$with_macosx_version_max_allowed" = "" ; then
2771         with_macosx_version_max_allowed="$with_macosx_sdk"
2772     fi
2774     # export this so that "xcrun" invocations later return matching values
2775     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2776     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2777     export DEVELOPER_DIR
2778     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2779     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2781     case "$with_macosx_version_min_required" in
2782     10.9)
2783         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2784         ;;
2785     10.10)
2786         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2787         ;;
2788     10.11)
2789         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2790         ;;
2791     10.12)
2792         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2793         ;;
2794     10.13)
2795         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2796         ;;
2797     10.14)
2798         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2799         ;;
2800     *)
2801         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--14])
2802         ;;
2803     esac
2804     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2806     LIBTOOL=/usr/bin/libtool
2807     INSTALL_NAME_TOOL=install_name_tool
2808     if test -z "$save_CC"; then
2809         AC_MSG_CHECKING([what compiler to use])
2810         stdlib=-stdlib=libc++
2811         if test "$ENABLE_LTO" = TRUE; then
2812             lto=-flto
2813         fi
2814         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2815         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2816         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2817         AR=`xcrun -find ar`
2818         NM=`xcrun -find nm`
2819         STRIP=`xcrun -find strip`
2820         LIBTOOL=`xcrun -find libtool`
2821         RANLIB=`xcrun -find ranlib`
2822         AC_MSG_RESULT([$CC and $CXX])
2823     fi
2825     case "$with_macosx_version_max_allowed" in
2826     10.9)
2827         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2828         ;;
2829     10.10)
2830         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2831         ;;
2832     10.11)
2833         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2834         ;;
2835     10.12)
2836         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2837         ;;
2838     10.13)
2839         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2840         ;;
2841     10.14)
2842         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2843         ;;
2844     *)
2845         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--14])
2846         ;;
2847     esac
2849     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2850     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2851         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])
2852     else
2853         AC_MSG_RESULT([ok])
2854     fi
2856     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2857     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2858         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2859     else
2860         AC_MSG_RESULT([ok])
2861     fi
2862     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2863     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2865     AC_MSG_CHECKING([whether to do code signing])
2867     if test "$enable_macosx_code_signing" = yes; then
2868         # By default use the first suitable certificate (?).
2870         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2871         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2872         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2873         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2874         # "Developer ID Application" one.
2876         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2877         if test -n "$identity"; then
2878             MACOSX_CODESIGNING_IDENTITY=$identity
2879             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2880             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2881         else
2882             AC_MSG_ERROR([cannot determine identity to use])
2883         fi
2884     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2885         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2886         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2887         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2888     else
2889         AC_MSG_RESULT([no])
2890     fi
2892     AC_MSG_CHECKING([whether to create a Mac App Store package])
2894     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2895         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2896     elif test "$enable_macosx_package_signing" = yes; then
2897         # By default use the first suitable certificate.
2898         # It should be a "3rd Party Mac Developer Installer" one
2900         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2901         if test -n "$identity"; then
2902             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2903             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2904             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2905         else
2906             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2907         fi
2908     elif test -n "$enable_macosx_package_signing"; then
2909         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2910         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2911         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2912     else
2913         AC_MSG_RESULT([no])
2914     fi
2916     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2917         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2918     fi
2920     AC_MSG_CHECKING([whether to sandbox the application])
2922     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2923         AC_MSG_ERROR([OS X sandboxing requires code signing])
2924     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2925         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2926     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2927         ENABLE_MACOSX_SANDBOX=TRUE
2928         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2929         AC_MSG_RESULT([yes])
2930     else
2931         AC_MSG_RESULT([no])
2932     fi
2934     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2935     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2936     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2938 AC_SUBST(MACOSX_SDK_PATH)
2939 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2940 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2941 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2942 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2943 AC_SUBST(INSTALL_NAME_TOOL)
2944 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2945 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2946 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2947 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2948 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2950 dnl ===================================================================
2951 dnl Check iOS SDK and compiler
2952 dnl ===================================================================
2954 if test $_os = iOS; then
2955     AC_MSG_CHECKING([what iOS SDK to use])
2956     current_sdk_ver=12.0
2957     if test "$enable_ios_simulator" = "yes"; then
2958         platform=iPhoneSimulator
2959         versionmin=-mios-simulator-version-min=$current_sdk_ver
2960     else
2961         platform=iPhoneOS
2962         versionmin=-miphoneos-version-min=11.0
2963     fi
2964     xcode_developer=`xcode-select -print-path`
2966     for sdkver in $current_sdk_ver; do
2967         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2968         if test -d $t; then
2969             ios_sdk=$sdkver
2970             sysroot=$t
2971             break
2972         fi
2973     done
2975     if test -z "$sysroot"; then
2976         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2977     fi
2979     AC_MSG_RESULT($sysroot)
2981     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2982     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
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_SUBST(IOS_SDK)
3004 AC_SUBST(IOS_DEPLOYMENT_VERSION)
3006 AC_MSG_CHECKING([whether to treat the installation as read-only])
3008 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3009         "$enable_extensions" != yes; then
3010     enable_readonly_installset=yes
3012 if test "$enable_readonly_installset" = yes; then
3013     AC_MSG_RESULT([yes])
3014     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3015 else
3016     AC_MSG_RESULT([no])
3019 dnl ===================================================================
3020 dnl Structure of install set
3021 dnl ===================================================================
3023 if test $_os = Darwin; then
3024     LIBO_BIN_FOLDER=MacOS
3025     LIBO_ETC_FOLDER=Resources
3026     LIBO_LIBEXEC_FOLDER=MacOS
3027     LIBO_LIB_FOLDER=Frameworks
3028     LIBO_LIB_PYUNO_FOLDER=Resources
3029     LIBO_SHARE_FOLDER=Resources
3030     LIBO_SHARE_HELP_FOLDER=Resources/help
3031     LIBO_SHARE_JAVA_FOLDER=Resources/java
3032     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3033     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3034     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3035     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3036     LIBO_URE_BIN_FOLDER=MacOS
3037     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3038     LIBO_URE_LIB_FOLDER=Frameworks
3039     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3040     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3041 elif test $_os = WINNT; then
3042     LIBO_BIN_FOLDER=program
3043     LIBO_ETC_FOLDER=program
3044     LIBO_LIBEXEC_FOLDER=program
3045     LIBO_LIB_FOLDER=program
3046     LIBO_LIB_PYUNO_FOLDER=program
3047     LIBO_SHARE_FOLDER=share
3048     LIBO_SHARE_HELP_FOLDER=help
3049     LIBO_SHARE_JAVA_FOLDER=program/classes
3050     LIBO_SHARE_PRESETS_FOLDER=presets
3051     LIBO_SHARE_READMES_FOLDER=readmes
3052     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3053     LIBO_SHARE_SHELL_FOLDER=program/shell
3054     LIBO_URE_BIN_FOLDER=program
3055     LIBO_URE_ETC_FOLDER=program
3056     LIBO_URE_LIB_FOLDER=program
3057     LIBO_URE_MISC_FOLDER=program
3058     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3059 else
3060     LIBO_BIN_FOLDER=program
3061     LIBO_ETC_FOLDER=program
3062     LIBO_LIBEXEC_FOLDER=program
3063     LIBO_LIB_FOLDER=program
3064     LIBO_LIB_PYUNO_FOLDER=program
3065     LIBO_SHARE_FOLDER=share
3066     LIBO_SHARE_HELP_FOLDER=help
3067     LIBO_SHARE_JAVA_FOLDER=program/classes
3068     LIBO_SHARE_PRESETS_FOLDER=presets
3069     LIBO_SHARE_READMES_FOLDER=readmes
3070     if test "$enable_fuzzers" != yes; then
3071         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3072     else
3073         LIBO_SHARE_RESOURCE_FOLDER=resource
3074     fi
3075     LIBO_SHARE_SHELL_FOLDER=program/shell
3076     LIBO_URE_BIN_FOLDER=program
3077     LIBO_URE_ETC_FOLDER=program
3078     LIBO_URE_LIB_FOLDER=program
3079     LIBO_URE_MISC_FOLDER=program
3080     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3082 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3095 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3096 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3097 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3099 # Not all of them needed in config_host.mk, add more if need arises
3100 AC_SUBST(LIBO_BIN_FOLDER)
3101 AC_SUBST(LIBO_ETC_FOLDER)
3102 AC_SUBST(LIBO_LIB_FOLDER)
3103 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3104 AC_SUBST(LIBO_SHARE_FOLDER)
3105 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3106 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3107 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3108 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3109 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3110 AC_SUBST(LIBO_URE_BIN_FOLDER)
3111 AC_SUBST(LIBO_URE_ETC_FOLDER)
3112 AC_SUBST(LIBO_URE_LIB_FOLDER)
3113 AC_SUBST(LIBO_URE_MISC_FOLDER)
3114 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3116 dnl ===================================================================
3117 dnl Windows specific tests and stuff
3118 dnl ===================================================================
3120 reg_get_value()
3122     # Return value: $regvalue
3123     unset regvalue
3125     local _regentry="/proc/registry${1}/${2}"
3126     if test -f "$_regentry"; then
3127         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3128         # Registry keys read via /proc/registry* are always \0 terminated!
3129         local _regvalue=$(tr -d '\0' < "$_regentry")
3130         if test $? -eq 0; then
3131             regvalue=$_regvalue
3132         fi
3133     fi
3136 # Get a value from the 32-bit side of the Registry
3137 reg_get_value_32()
3139     reg_get_value "32" "$1"
3142 # Get a value from the 64-bit side of the Registry
3143 reg_get_value_64()
3145     reg_get_value "64" "$1"
3148 if test "$_os" = "WINNT"; then
3149     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3150     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3151         AC_MSG_RESULT([no])
3152         WINDOWS_SDK_ARCH="x86"
3153     else
3154         AC_MSG_RESULT([yes])
3155         WINDOWS_SDK_ARCH="x64"
3156         BITNESS_OVERRIDE=64
3157     fi
3159 if test "$_os" = "iOS"; then
3160     cross_compiling="yes"
3163 if test "$cross_compiling" = "yes"; then
3164     export CROSS_COMPILING=TRUE
3165 else
3166     CROSS_COMPILING=
3167     BUILD_TYPE="$BUILD_TYPE NATIVE"
3169 AC_SUBST(CROSS_COMPILING)
3171 USE_LD=
3172 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3173     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3174     if test "$GCC" = "yes"; then
3175         ldflags_save=$LDFLAGS
3176         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3177         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3178 #include <stdio.h>
3179             ],[
3180 printf ("hello world\n");
3181             ])], USE_LD=$enable_ld, [])
3182         if test -n "$USE_LD"; then
3183             AC_MSG_RESULT( yes )
3184             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3185         else
3186             AC_MSG_ERROR( no )
3187         fi
3188     else
3189         AC_MSG_ERROR( not supported )
3190     fi
3192 AC_SUBST(USE_LD)
3194 ENABLE_GDB_INDEX=
3195 if test "$enable_gdb_index" = "yes"; then
3196     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3197     save_CFLAGS=$CFLAGS
3198     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3199     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3201     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3202     ldflags_save=$LDFLAGS
3203     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3204     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3205 #include <stdio.h>
3206         ],[
3207 printf ("hello world\n");
3208         ])], ENABLE_GDB_INDEX=TRUE, [])
3209     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3210         AC_MSG_RESULT( yes )
3211     else
3212         AC_MSG_ERROR( no )
3213     fi
3214     CFLAGS=$save_CFLAGS
3215     LDFLAGS=$ldflags_save
3217 AC_SUBST(ENABLE_GDB_INDEX)
3219 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3220 if test "$GCC" = "yes"; then
3221     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3222     bsymbolic_functions_ldflags_save=$LDFLAGS
3223     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3224     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3225 #include <stdio.h>
3226         ],[
3227 printf ("hello world\n");
3228         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3229     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3230         AC_MSG_RESULT( found )
3231     else
3232         AC_MSG_RESULT( not found )
3233     fi
3234     LDFLAGS=$bsymbolic_functions_ldflags_save
3236 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3238 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3239 # NOTE: must _not_ be used for bundled external libraries!
3240 ISYSTEM=
3241 if test "$GCC" = "yes"; then
3242     AC_MSG_CHECKING( for -isystem )
3243     save_CFLAGS=$CFLAGS
3244     CFLAGS="$CFLAGS -Werror"
3245     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3246     CFLAGS=$save_CFLAGS
3247     if test -n "$ISYSTEM"; then
3248         AC_MSG_RESULT(yes)
3249     else
3250         AC_MSG_RESULT(no)
3251     fi
3253 if test -z "$ISYSTEM"; then
3254     # fall back to using -I
3255     ISYSTEM=-I
3257 AC_SUBST(ISYSTEM)
3259 dnl ===================================================================
3260 dnl  Check which Visual Studio compiler is used
3261 dnl ===================================================================
3263 map_vs_year_to_version()
3265     # Return value: $vsversion
3267     unset vsversion
3269     case $1 in
3270     2017)
3271         vsversion=15.0;;
3272     *)
3273         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3274     esac
3277 vs_versions_to_check()
3279     # Args: $1 (optional) : versions to check, in the order of preference
3280     # Return value: $vsversions
3282     unset vsversions
3284     if test -n "$1"; then
3285         map_vs_year_to_version "$1"
3286         vsversions=$vsversion
3287     else
3288         # We accept only 2017
3289         vsversions="15.0"
3290     fi
3293 win_get_env_from_vsvars32bat()
3295     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3296     # Also seems to be located in another directory under the same name: vsvars32.bat
3297     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3298     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3299     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3300     chmod +x $WRAPPERBATCHFILEPATH
3301     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3302     rm -f $WRAPPERBATCHFILEPATH
3303     printf '%s' "$_win_get_env_from_vsvars32bat"
3306 find_ucrt()
3308     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3309     if test -n "$regvalue"; then
3310         PathFormat "$regvalue"
3311         UCRTSDKDIR=$formatted_path
3312         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3313         UCRTVERSION=$regvalue
3314         # Rest if not exist
3315         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3316           UCRTSDKDIR=
3317         fi
3318     fi
3319     if test -z "$UCRTSDKDIR"; then
3320         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3321         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3322         if test -f "$ide_env_file"; then
3323             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3324             UCRTSDKDIR=$formatted_path
3325             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3326             dnl Hack needed at least by tml:
3327             if test "$UCRTVERSION" = 10.0.15063.0 \
3328                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3329                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3330             then
3331                 UCRTVERSION=10.0.14393.0
3332             fi
3333         else
3334           AC_MSG_ERROR([No UCRT found])
3335         fi
3336     fi
3339 find_msvc()
3341     # Find Visual C++ 2017
3342     # Args: $1 (optional) : The VS version year
3343     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3345     unset vctest vcnum vcnumwithdot vcbuildnumber
3347     vs_versions_to_check "$1"
3349     for ver in $vsversions; do
3350         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3351         if test -n "$regvalue"; then
3352             vctest=$regvalue
3353             break
3354         fi
3355         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3356         if test -n "$regvalue"; then
3357             AC_MSG_RESULT([found: $regvalue])
3358             PathFormat "$regvalue"
3359             vctest=$formatted_path
3360             break
3361         fi
3362     done
3363     if test -n "$vctest"; then
3364         vcnumwithdot=$ver
3365         case "$vcnumwithdot" in
3366         15.0)
3367             vcyear=2017
3368             vcnum=150
3369             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3370             ;;
3371         esac
3372     fi
3375 SOLARINC=
3376 MSBUILD_PATH=
3377 DEVENV=
3378 if test "$_os" = "WINNT"; then
3379     AC_MSG_CHECKING([Visual C++])
3381     find_msvc "$with_visual_studio"
3382     if test -z "$vctest"; then
3383         if test -n "$with_visual_studio"; then
3384             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3385         else
3386             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3387         fi
3388     fi
3390     if test "$BITNESS_OVERRIDE" = ""; then
3391         if test -f "$vctest/bin/cl.exe"; then
3392             VC_PRODUCT_DIR=$vctest
3393         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3394             VC_PRODUCT_DIR=$vctest/VC
3395         else
3396             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3397         fi
3398     else
3399         if test -f "$vctest/bin/amd64/cl.exe"; then
3400             VC_PRODUCT_DIR=$vctest
3401         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3402             VC_PRODUCT_DIR=$vctest/VC
3403         else
3404             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])
3405         fi
3406     fi
3408     AC_MSG_CHECKING([for short pathname of VC product directory])
3409     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3410     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3412     UCRTSDKDIR=
3413     UCRTVERSION=
3415     AC_MSG_CHECKING([for UCRT location])
3416     find_ucrt
3417     # find_ucrt errors out if it doesn't find it
3418     AC_MSG_RESULT([found])
3419     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3420     ucrtincpath_formatted=$formatted_path
3421     # SOLARINC is used for external modules and must be set too.
3422     # And no, it's not sufficient to set SOLARINC only, as configure
3423     # itself doesn't honour it.
3424     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3425     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3426     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3427     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3429     AC_SUBST(UCRTSDKDIR)
3430     AC_SUBST(UCRTVERSION)
3432     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3433     # Find the proper version of MSBuild.exe to use based on the VS version
3434     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3435     if test -n "$regvalue" ; then
3436         AC_MSG_RESULT([found: $regvalue])
3437         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3438     else
3439         if test "$BITNESS_OVERRIDE" = ""; then
3440             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3441         else
3442             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3443         fi
3444         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3445         AC_MSG_RESULT([$regvalue])
3446     fi
3448     # Find the version of devenv.exe
3449     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3450     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3451     if test ! -e "$DEVENV"; then
3452         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3453     fi
3455     dnl ===========================================================
3456     dnl  Check for the corresponding mspdb*.dll
3457     dnl ===========================================================
3459     MSPDB_PATH=
3460     CL_DIR=
3461     CL_LIB=
3463     if test "$BITNESS_OVERRIDE" = ""; then
3464         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3465         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3466     else
3467         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3468         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3469     fi
3471     # MSVC 15.0 has libraries from 14.0?
3472     mspdbnum="140"
3474     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3475         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3476     fi
3478     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3479     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3481     dnl The path needs to be added before cl is called
3482     PATH="$MSPDB_PATH:$PATH"
3484     AC_MSG_CHECKING([cl.exe])
3486     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3487     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3488     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3489     # is not enough?
3491     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3492     dnl needed when building CLR code:
3493     if test -z "$MSVC_CXX"; then
3494         if test "$BITNESS_OVERRIDE" = ""; then
3495             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3496                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3497             fi
3498         else
3499             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3500                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3501             fi
3502         fi
3504         # This gives us a posix path with 8.3 filename restrictions
3505         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3506     fi
3508     if test -z "$CC"; then
3509         CC=$MSVC_CXX
3510     fi
3511     if test "$BITNESS_OVERRIDE" = ""; then
3512         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3513         MSVC_CXX="$MSVC_CXX -arch:SSE"
3514     fi
3516     if test -n "$CC"; then
3517         # Remove /cl.exe from CC case insensitive
3518         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3519         if test "$BITNESS_OVERRIDE" = ""; then
3520            COMPATH="$VC_PRODUCT_DIR"
3521         else
3522             if test -n "$VC_PRODUCT_DIR"; then
3523                 COMPATH=$VC_PRODUCT_DIR
3524             fi
3525         fi
3526         if test "$BITNESS_OVERRIDE" = ""; then
3527             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3528             CC="$CC -arch:SSE"
3529         fi
3531         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3533         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3535         PathFormat "$COMPATH"
3536         COMPATH="$formatted_path"
3538         VCVER=$vcnum
3539         MSVSVER=$vcyear
3541         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3542         # are always "better", we list them in reverse chronological order.
3544         case $vcnum in
3545         150)
3546             COMEX=19
3547             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3548             ;;
3549         esac
3551         # The expectation is that --with-windows-sdk should not need to be used
3552         if test -n "$with_windows_sdk"; then
3553             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3554             *" "$with_windows_sdk" "*)
3555                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3556                 ;;
3557             *)
3558                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3559                 ;;
3560             esac
3561         fi
3563         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3564         ac_objext=obj
3565         ac_exeext=exe
3567     else
3568         AC_MSG_ERROR([Visual C++ not found after all, huh])
3569     fi
3571     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3572     # version of the Explorer extension (and maybe other small
3573     # bits, too) needed when installing a 32-bit LibreOffice on a
3574     # 64-bit OS. The 64-bit Explorer extension is a feature that
3575     # has been present since long in OOo. Don't confuse it with
3576     # building LibreOffice itself as 64-bit code.
3578     BUILD_X64=
3579     CXX_X64_BINARY=
3580     LINK_X64_BINARY=
3582     if test "$BITNESS_OVERRIDE" = ""; then
3583         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3584         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3585             # Prefer native x64 compiler to cross-compiler, in case we are running
3586             # the build on a 64-bit OS.
3587             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3588                 BUILD_X64=TRUE
3589                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3590                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3591             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3592                 BUILD_X64=TRUE
3593                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3594                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3595             fi
3596         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3597             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3598             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3599                 BUILD_X64=TRUE
3600                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3601                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3602             fi
3603         fi
3604         if test "$BUILD_X64" = TRUE; then
3605             AC_MSG_RESULT([found])
3606         else
3607             AC_MSG_RESULT([not found])
3608             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3609         fi
3610     fi
3611     AC_SUBST(BUILD_X64)
3613     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3614     AC_SUBST(CXX_X64_BINARY)
3615     AC_SUBST(LINK_X64_BINARY)
3617 AC_SUBST(VCVER)
3618 AC_SUBST(DEVENV)
3619 PathFormat "$MSPDB_PATH"
3620 MSPDB_PATH="$formatted_path"
3621 AC_SUBST(MSVC_CXX)
3624 # unowinreg.dll
3626 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3627 AC_SUBST(UNOWINREG_DLL)
3629 COM_IS_CLANG=
3630 AC_MSG_CHECKING([whether the compiler is actually Clang])
3631 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3632     #ifndef __clang__
3633     you lose
3634     #endif
3635     int foo=42;
3636     ]])],
3637     [AC_MSG_RESULT([yes])
3638      COM_IS_CLANG=TRUE],
3639     [AC_MSG_RESULT([no])])
3641 CC_PLAIN=$CC
3642 if test "$COM_IS_CLANG" = TRUE; then
3643     AC_MSG_CHECKING([the Clang version])
3644     if test "$_os" = WINNT; then
3645         dnl In which case, assume clang-cl:
3646         my_args="/EP /TC"
3647         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3648         dnl clang-cl:
3649         CC_PLAIN=
3650         for i in $CC; do
3651             case $i in
3652             -FIIntrin.h)
3653                 ;;
3654             *)
3655                 CC_PLAIN="$CC_PLAIN $i"
3656                 ;;
3657             esac
3658         done
3659     else
3660         my_args="-E -P"
3661     fi
3662     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3663     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3664     CLANGVER=`echo $clang_version \
3665         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3666     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3667     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3668     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3670 AC_SUBST(COM_IS_CLANG)
3671 AC_SUBST(CLANGVER)
3673 SHOWINCLUDES_PREFIX=
3674 if test "$_os" = WINNT; then
3675     dnl We need to guess the prefix of the -showIncludes output, it can be
3676     dnl localized
3677     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3678     echo "#include <stdlib.h>" > conftest.c
3679     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3680         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3681     rm -f conftest.c conftest.obj
3682     if test -z "$SHOWINCLUDES_PREFIX"; then
3683         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3684     else
3685         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3686     fi
3688 AC_SUBST(SHOWINCLUDES_PREFIX)
3691 # prefix C with ccache if needed
3693 if test "$CCACHE" != ""; then
3694     AC_MSG_CHECKING([whether $CC is already ccached])
3696     AC_LANG_PUSH([C])
3697     save_CFLAGS=$CFLAGS
3698     CFLAGS="$CFLAGS --ccache-skip -O2"
3699     dnl an empty program will do, we're checking the compiler flags
3700     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3701                       [use_ccache=yes], [use_ccache=no])
3702     if test $use_ccache = yes; then
3703         AC_MSG_RESULT([yes])
3704     else
3705         CC="$CCACHE $CC"
3706         AC_MSG_RESULT([no])
3707     fi
3708     CFLAGS=$save_CFLAGS
3709     AC_LANG_POP([C])
3712 # ===================================================================
3713 # check various GCC options that Clang does not support now but maybe
3714 # will somewhen in the future, check them even for GCC, so that the
3715 # flags are set
3716 # ===================================================================
3718 HAVE_GCC_GGDB2=
3719 HAVE_GCC_FINLINE_LIMIT=
3720 HAVE_GCC_FNO_INLINE=
3721 if test "$GCC" = "yes"; then
3722     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3723     save_CFLAGS=$CFLAGS
3724     CFLAGS="$CFLAGS -Werror -ggdb2"
3725     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3726     CFLAGS=$save_CFLAGS
3727     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3728         AC_MSG_RESULT([yes])
3729     else
3730         AC_MSG_RESULT([no])
3731     fi
3733     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3734     save_CFLAGS=$CFLAGS
3735     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3736     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3737     CFLAGS=$save_CFLAGS
3738     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3739         AC_MSG_RESULT([yes])
3740     else
3741         AC_MSG_RESULT([no])
3742     fi
3744     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3745     save_CFLAGS=$CFLAGS
3746     CFLAGS="$CFLAGS -Werror -fno-inline"
3747     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3748     CFLAGS=$save_CFLAGS
3749     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3750         AC_MSG_RESULT([yes])
3751     else
3752         AC_MSG_RESULT([no])
3753     fi
3755     if test "$host_cpu" = "m68k"; then
3756         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3757         save_CFLAGS=$CFLAGS
3758         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3759         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3760         CFLAGS=$save_CFLAGS
3761         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3762             AC_MSG_RESULT([yes])
3763         else
3764             AC_MSG_ERROR([no])
3765         fi
3766     fi
3768 AC_SUBST(HAVE_GCC_GGDB2)
3769 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3770 AC_SUBST(HAVE_GCC_FNO_INLINE)
3772 dnl ===================================================================
3773 dnl  Test the gcc version
3774 dnl ===================================================================
3775 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3776     AC_MSG_CHECKING([the GCC version])
3777     _gcc_version=`$CC -dumpversion`
3778     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3779         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3780     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3782     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3784     if test "$gcc_full_version" -lt 40801; then
3785         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3786     fi
3787 else
3788     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3789     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3790     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3791     # (which reports itself as GCC 4.2.1).
3792     GCC_VERSION=
3794 AC_SUBST(GCC_VERSION)
3796 dnl Set the ENABLE_DBGUTIL variable
3797 dnl ===================================================================
3798 AC_MSG_CHECKING([whether to build with additional debug utilities])
3799 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3800     ENABLE_DBGUTIL="TRUE"
3801     # this is an extra var so it can have different default on different MSVC
3802     # versions (in case there are version specific problems with it)
3803     MSVC_USE_DEBUG_RUNTIME="TRUE"
3805     AC_MSG_RESULT([yes])
3806     # cppunit and graphite expose STL in public headers
3807     if test "$with_system_cppunit" = "yes"; then
3808         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3809     else
3810         with_system_cppunit=no
3811     fi
3812     if test "$with_system_graphite" = "yes"; then
3813         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3814     else
3815         with_system_graphite=no
3816     fi
3817     if test "$with_system_orcus" = "yes"; then
3818         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3819     else
3820         with_system_orcus=no
3821     fi
3822     if test "$with_system_libcmis" = "yes"; then
3823         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3824     else
3825         with_system_libcmis=no
3826     fi
3827     if test "$with_system_hunspell" = "yes"; then
3828         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3829     else
3830         with_system_hunspell=no
3831     fi
3832     if test "$with_system_gpgmepp" = "yes"; then
3833         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3834     else
3835         with_system_gpgmepp=no
3836     fi
3837     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3838     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3839     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3840     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3841     # of those two is using the system variant:
3842     if test "$with_system_libnumbertext" = "yes"; then
3843         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3844     else
3845         with_system_libnumbertext=no
3846     fi
3847     if test "$with_system_libwps" = "yes"; then
3848         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3849     else
3850         with_system_libwps=no
3851     fi
3852 else
3853     ENABLE_DBGUTIL=""
3854     MSVC_USE_DEBUG_RUNTIME=""
3855     AC_MSG_RESULT([no])
3857 AC_SUBST(ENABLE_DBGUTIL)
3858 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3860 dnl Set the ENABLE_DEBUG variable.
3861 dnl ===================================================================
3862 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3863     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3865 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3866     if test -z "$libo_fuzzed_enable_debug"; then
3867         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3868     else
3869         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3870         enable_debug=yes
3871     fi
3874 AC_MSG_CHECKING([whether to do a debug build])
3875 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3876     ENABLE_DEBUG="TRUE"
3877     if test -n "$ENABLE_DBGUTIL" ; then
3878         AC_MSG_RESULT([yes (dbgutil)])
3879     else
3880         AC_MSG_RESULT([yes])
3881     fi
3882 else
3883     ENABLE_DEBUG=""
3884     AC_MSG_RESULT([no])
3886 AC_SUBST(ENABLE_DEBUG)
3888 if test "$enable_split_debug" = yes; then
3889     HAVE_GSPLIT_DWARF=
3890     if test "$GCC" = "yes"; then
3891         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3892         save_CFLAGS=$CFLAGS
3893         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3894         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3895         CFLAGS=$save_CFLAGS
3896         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3897             AC_MSG_RESULT([yes])
3898         else
3899             AC_MSG_RESULT([no])
3900         fi
3901     fi
3902     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3905 if test "$enable_sal_log" = yes; then
3906     ENABLE_SAL_LOG=TRUE
3908 AC_SUBST(ENABLE_SAL_LOG)
3910 dnl Selective debuginfo
3911 ENABLE_DEBUGINFO_FOR=
3912 if test -n "$ENABLE_DEBUG"; then
3913     AC_MSG_CHECKING([whether to use selective debuginfo])
3914     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3915         if test "$enable_selective_debuginfo" = "yes"; then
3916             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3917         fi
3918         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3919         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3920     else
3921         ENABLE_DEBUGINFO_FOR=all
3922         AC_MSG_RESULT([no, for all])
3923     fi
3924 else
3925     if test -n "$enable_selective_debuginfo"; then
3926         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3927     fi
3929 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3931 dnl Check for enable symbols option
3932 dnl ===================================================================
3933 AC_MSG_CHECKING([whether to generate debug information])
3934 if test -z "$enable_symbols"; then
3935     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3936         enable_symbols=yes
3937     else
3938         enable_symbols=no
3939     fi
3941 if test "$enable_symbols" != no; then
3942     ENABLE_SYMBOLS=TRUE
3943     AC_MSG_RESULT([yes])
3944 else
3945     ENABLE_SYMBOLS=
3946     AC_MSG_RESULT([no])
3948 AC_SUBST(ENABLE_SYMBOLS)
3950 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3951     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3952     AC_MSG_CHECKING([whether enough memory is available for linking])
3953     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3954     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3955     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3956         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3957     else
3958         AC_MSG_RESULT([yes])
3959     fi
3962 AC_MSG_CHECKING([whether to compile with optimization flags])
3963 if test -z "$enable_optimized"; then
3964     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3965         enable_optimized=no
3966     else
3967         enable_optimized=yes
3968     fi
3970 if test "$enable_optimized" != no; then
3971     ENABLE_OPTIMIZED=TRUE
3972     AC_MSG_RESULT([yes])
3973 else
3974     ENABLE_OPTIMIZED=
3975     AC_MSG_RESULT([no])
3977 AC_SUBST(ENABLE_OPTIMIZED)
3980 # determine CPUNAME, OS, ...
3981 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3983 case "$host_os" in
3985 aix*)
3986     COM=GCC
3987     CPUNAME=POWERPC
3988     USING_X11=TRUE
3989     OS=AIX
3990     RTL_OS=AIX
3991     RTL_ARCH=PowerPC
3992     PLATFORMID=aix_powerpc
3993     P_SEP=:
3994     ;;
3996 cygwin*)
3997     COM=MSC
3998     USING_X11=
3999     OS=WNT
4000     RTL_OS=Windows
4001     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4002         P_SEP=";"
4003     else
4004         P_SEP=:
4005     fi
4006     case "$host_cpu" in
4007     i*86|x86_64)
4008         if test "$BITNESS_OVERRIDE" = 64; then
4009             CPUNAME=X86_64
4010             RTL_ARCH=X86_64
4011             PLATFORMID=windows_x86_64
4012             WINDOWS_X64=1
4013             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4014         else
4015             CPUNAME=INTEL
4016             RTL_ARCH=x86
4017             PLATFORMID=windows_x86
4018         fi
4019         ;;
4020     *)
4021         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4022         ;;
4023     esac
4024     SCPDEFS="$SCPDEFS -D_MSC_VER"
4025     ;;
4027 darwin*)
4028     COM=GCC
4029     USING_X11=
4030     OS=MACOSX
4031     RTL_OS=MacOSX
4032     P_SEP=:
4034     case "$host_cpu" in
4035     arm)
4036         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4037         ;;
4038     arm64)
4039         OS=IOS
4040         if test "$enable_ios_simulator" = "yes"; then
4041             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4042         else
4043             CPUNAME=ARM64
4044             RTL_ARCH=ARM_EABI
4045             PLATFORMID=ios_arm64
4046         fi
4047         ;;
4048     i*86)
4049         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4050         ;;
4051     x86_64)
4052         if test "$enable_ios_simulator" = "yes"; then
4053             OS=IOS
4054         fi
4055         CPUNAME=X86_64
4056         RTL_ARCH=X86_64
4057         PLATFORMID=macosx_x86_64
4058         ;;
4059     *)
4060         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4061         ;;
4062     esac
4063     ;;
4065 dragonfly*)
4066     COM=GCC
4067     USING_X11=TRUE
4068     OS=DRAGONFLY
4069     RTL_OS=DragonFly
4070     P_SEP=:
4072     case "$host_cpu" in
4073     i*86)
4074         CPUNAME=INTEL
4075         RTL_ARCH=x86
4076         PLATFORMID=dragonfly_x86
4077         ;;
4078     x86_64)
4079         CPUNAME=X86_64
4080         RTL_ARCH=X86_64
4081         PLATFORMID=dragonfly_x86_64
4082         ;;
4083     *)
4084         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4085         ;;
4086     esac
4087     ;;
4089 freebsd*)
4090     COM=GCC
4091     USING_X11=TRUE
4092     RTL_OS=FreeBSD
4093     OS=FREEBSD
4094     P_SEP=:
4096     case "$host_cpu" in
4097     i*86)
4098         CPUNAME=INTEL
4099         RTL_ARCH=x86
4100         PLATFORMID=freebsd_x86
4101         ;;
4102     x86_64|amd64)
4103         CPUNAME=X86_64
4104         RTL_ARCH=X86_64
4105         PLATFORMID=freebsd_x86_64
4106         ;;
4107     *)
4108         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4109         ;;
4110     esac
4111     ;;
4113 haiku*)
4114     COM=GCC
4115     USING_X11=
4116     GUIBASE=haiku
4117     RTL_OS=Haiku
4118     OS=HAIKU
4119     P_SEP=:
4121     case "$host_cpu" in
4122     i*86)
4123         CPUNAME=INTEL
4124         RTL_ARCH=x86
4125         PLATFORMID=haiku_x86
4126         ;;
4127     x86_64|amd64)
4128         CPUNAME=X86_64
4129         RTL_ARCH=X86_64
4130         PLATFORMID=haiku_x86_64
4131         ;;
4132     *)
4133         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4134         ;;
4135     esac
4136     ;;
4138 kfreebsd*)
4139     COM=GCC
4140     USING_X11=TRUE
4141     OS=LINUX
4142     RTL_OS=kFreeBSD
4143     P_SEP=:
4145     case "$host_cpu" in
4147     i*86)
4148         CPUNAME=INTEL
4149         RTL_ARCH=x86
4150         PLATFORMID=kfreebsd_x86
4151         ;;
4152     x86_64)
4153         CPUNAME=X86_64
4154         RTL_ARCH=X86_64
4155         PLATFORMID=kfreebsd_x86_64
4156         ;;
4157     *)
4158         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4159         ;;
4160     esac
4161     ;;
4163 linux-gnu*)
4164     COM=GCC
4165     USING_X11=TRUE
4166     OS=LINUX
4167     RTL_OS=Linux
4168     P_SEP=:
4170     case "$host_cpu" in
4172     aarch64)
4173         CPUNAME=AARCH64
4174         PLATFORMID=linux_aarch64
4175         RTL_ARCH=AARCH64
4176         ;;
4177     alpha)
4178         CPUNAME=AXP
4179         RTL_ARCH=ALPHA
4180         PLATFORMID=linux_alpha
4181         ;;
4182     arm*)
4183         CPUNAME=ARM
4184         EPM_FLAGS="-a arm"
4185         RTL_ARCH=ARM_EABI
4186         PLATFORMID=linux_arm_eabi
4187         case "$host_cpu" in
4188         arm*-linux)
4189             RTL_ARCH=ARM_OABI
4190             PLATFORMID=linux_arm_oabi
4191             ;;
4192         esac
4193         ;;
4194     hppa)
4195         CPUNAME=HPPA
4196         RTL_ARCH=HPPA
4197         EPM_FLAGS="-a hppa"
4198         PLATFORMID=linux_hppa
4199         ;;
4200     i*86)
4201         CPUNAME=INTEL
4202         RTL_ARCH=x86
4203         PLATFORMID=linux_x86
4204         ;;
4205     ia64)
4206         CPUNAME=IA64
4207         RTL_ARCH=IA64
4208         PLATFORMID=linux_ia64
4209         ;;
4210     mips)
4211         CPUNAME=GODSON
4212         RTL_ARCH=MIPS_EB
4213         EPM_FLAGS="-a mips"
4214         PLATFORMID=linux_mips_eb
4215         ;;
4216     mips64)
4217         CPUNAME=GODSON64
4218         RTL_ARCH=MIPS64_EB
4219         EPM_FLAGS="-a mips64"
4220         PLATFORMID=linux_mips64_eb
4221         ;;
4222     mips64el)
4223         CPUNAME=GODSON64
4224         RTL_ARCH=MIPS64_EL
4225         EPM_FLAGS="-a mips64el"
4226         PLATFORMID=linux_mips64_el
4227         ;;
4228     mipsel)
4229         CPUNAME=GODSON
4230         RTL_ARCH=MIPS_EL
4231         EPM_FLAGS="-a mipsel"
4232         PLATFORMID=linux_mips_el
4233         ;;
4234     m68k)
4235         CPUNAME=M68K
4236         RTL_ARCH=M68K
4237         PLATFORMID=linux_m68k
4238         ;;
4239     powerpc)
4240         CPUNAME=POWERPC
4241         RTL_ARCH=PowerPC
4242         PLATFORMID=linux_powerpc
4243         ;;
4244     powerpc64)
4245         CPUNAME=POWERPC64
4246         RTL_ARCH=PowerPC_64
4247         PLATFORMID=linux_powerpc64
4248         ;;
4249     powerpc64le)
4250         CPUNAME=POWERPC64
4251         RTL_ARCH=PowerPC_64_LE
4252         PLATFORMID=linux_powerpc64_le
4253         ;;
4254     sparc)
4255         CPUNAME=SPARC
4256         RTL_ARCH=SPARC
4257         PLATFORMID=linux_sparc
4258         ;;
4259     sparc64)
4260         CPUNAME=SPARC64
4261         RTL_ARCH=SPARC64
4262         PLATFORMID=linux_sparc64
4263         ;;
4264     s390)
4265         CPUNAME=S390
4266         RTL_ARCH=S390
4267         PLATFORMID=linux_s390
4268         ;;
4269     s390x)
4270         CPUNAME=S390X
4271         RTL_ARCH=S390x
4272         PLATFORMID=linux_s390x
4273         ;;
4274     x86_64)
4275         CPUNAME=X86_64
4276         RTL_ARCH=X86_64
4277         PLATFORMID=linux_x86_64
4278         ;;
4279     *)
4280         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4281         ;;
4282     esac
4283     ;;
4285 linux-android*)
4286     COM=GCC
4287     USING_X11=
4288     OS=ANDROID
4289     RTL_OS=Android
4290     P_SEP=:
4292     case "$host_cpu" in
4294     arm|armel)
4295         CPUNAME=ARM
4296         RTL_ARCH=ARM_EABI
4297         PLATFORMID=android_arm_eabi
4298         ;;
4299     aarch64)
4300         CPUNAME=AARCH64
4301         RTL_ARCH=AARCH64
4302         PLATFORMID=android_aarch64
4303         ;;
4304     mips|mipsel)
4305         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4306         RTL_ARCH=MIPS_EL
4307         PLATFORMID=android_mips_el
4308         ;;
4309     i*86)
4310         CPUNAME=INTEL
4311         RTL_ARCH=x86
4312         PLATFORMID=android_x86
4313         ;;
4314     *)
4315         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4316         ;;
4317     esac
4318     ;;
4320 *netbsd*)
4321     COM=GCC
4322     USING_X11=TRUE
4323     OS=NETBSD
4324     RTL_OS=NetBSD
4325     P_SEP=:
4327     case "$host_cpu" in
4328     i*86)
4329         CPUNAME=INTEL
4330         RTL_ARCH=x86
4331         PLATFORMID=netbsd_x86
4332         ;;
4333     powerpc)
4334         CPUNAME=POWERPC
4335         RTL_ARCH=PowerPC
4336         PLATFORMID=netbsd_powerpc
4337         ;;
4338     sparc)
4339         CPUNAME=SPARC
4340         RTL_ARCH=SPARC
4341         PLATFORMID=netbsd_sparc
4342         ;;
4343     x86_64)
4344         CPUNAME=X86_64
4345         RTL_ARCH=X86_64
4346         PLATFORMID=netbsd_x86_64
4347         ;;
4348     *)
4349         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4350         ;;
4351     esac
4352     ;;
4354 openbsd*)
4355     COM=GCC
4356     USING_X11=TRUE
4357     OS=OPENBSD
4358     RTL_OS=OpenBSD
4359     P_SEP=:
4361     case "$host_cpu" in
4362     i*86)
4363         CPUNAME=INTEL
4364         RTL_ARCH=x86
4365         PLATFORMID=openbsd_x86
4366         ;;
4367     x86_64)
4368         CPUNAME=X86_64
4369         RTL_ARCH=X86_64
4370         PLATFORMID=openbsd_x86_64
4371         ;;
4372     *)
4373         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4374         ;;
4375     esac
4376     SOLARINC="$SOLARINC -I/usr/local/include"
4377     ;;
4379 solaris*)
4380     COM=GCC
4381     USING_X11=TRUE
4382     OS=SOLARIS
4383     RTL_OS=Solaris
4384     P_SEP=:
4386     case "$host_cpu" in
4387     i*86)
4388         CPUNAME=INTEL
4389         RTL_ARCH=x86
4390         PLATFORMID=solaris_x86
4391         ;;
4392     sparc)
4393         CPUNAME=SPARC
4394         RTL_ARCH=SPARC
4395         PLATFORMID=solaris_sparc
4396         ;;
4397     sparc64)
4398         CPUNAME=SPARC64
4399         RTL_ARCH=SPARC64
4400         PLATFORMID=solaris_sparc64
4401         ;;
4402     *)
4403         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4404         ;;
4405     esac
4406     SOLARINC="$SOLARINC -I/usr/local/include"
4407     ;;
4410     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4411     ;;
4412 esac
4414 if test "$with_x" = "no"; then
4415     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4418 DISABLE_GUI=""
4419 if test "$enable_gui" = "no"; then
4420     if test "$USING_X11" != TRUE; then
4421         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4422     fi
4423     USING_X11=
4424     DISABLE_GUI=TRUE
4425     AC_DEFINE(HAVE_FEATURE_UI,0)
4426     test_cairo=yes
4428 AC_SUBST(DISABLE_GUI)
4430 WORKDIR="${BUILDDIR}/workdir"
4431 INSTDIR="${BUILDDIR}/instdir"
4432 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4433 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4434 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4435 AC_SUBST(COM)
4436 AC_SUBST(CPUNAME)
4437 AC_SUBST(RTL_OS)
4438 AC_SUBST(RTL_ARCH)
4439 AC_SUBST(EPM_FLAGS)
4440 AC_SUBST(USING_X11)
4441 AC_SUBST([INSTDIR])
4442 AC_SUBST([INSTROOT])
4443 AC_SUBST([INSTROOTBASE])
4444 AC_SUBST(OS)
4445 AC_SUBST(P_SEP)
4446 AC_SUBST(WORKDIR)
4447 AC_SUBST(PLATFORMID)
4448 AC_SUBST(WINDOWS_X64)
4449 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4451 dnl ===================================================================
4452 dnl Test which package format to use
4453 dnl ===================================================================
4454 AC_MSG_CHECKING([which package format to use])
4455 if test -n "$with_package_format" -a "$with_package_format" != no; then
4456     for i in $with_package_format; do
4457         case "$i" in
4458         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4459             ;;
4460         *)
4461             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4462 aix - AIX software distribution
4463 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4464 deb - Debian software distribution
4465 pkg - Solaris software distribution
4466 rpm - RedHat software distribution
4468 LibreOffice additionally supports:
4469 archive - .tar.gz or .zip
4470 dmg - Mac OS X .dmg
4471 installed - installation tree
4472 msi - Windows .msi
4473         ])
4474             ;;
4475         esac
4476     done
4477     # fakeroot is needed to ensure correct file ownerships/permissions
4478     # inside deb packages and tar archives created on Linux and Solaris.
4479     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4480         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4481         if test "$FAKEROOT" = "no"; then
4482             AC_MSG_ERROR(
4483                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4484         fi
4485     fi
4486     PKGFORMAT="$with_package_format"
4487     AC_MSG_RESULT([$PKGFORMAT])
4488 else
4489     PKGFORMAT=
4490     AC_MSG_RESULT([none])
4492 AC_SUBST(PKGFORMAT)
4494 dnl ===================================================================
4495 dnl Set up a different compiler to produce tools to run on the build
4496 dnl machine when doing cross-compilation
4497 dnl ===================================================================
4499 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4500 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4501 if test "$cross_compiling" = "yes"; then
4502     AC_MSG_CHECKING([for BUILD platform configuration])
4503     echo
4504     rm -rf CONF-FOR-BUILD config_build.mk
4505     mkdir CONF-FOR-BUILD
4506     # Here must be listed all files needed when running the configure script. In particular, also
4507     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4508     # keep them in the same order as there.
4509     (cd $SRC_ROOT && tar cf - \
4510         config.guess \
4511         bin/get_config_variables \
4512         solenv/bin/getcompver.awk \
4513         solenv/inc/langlist.mk \
4514         download.lst \
4515         config_host.mk.in \
4516         config_host_lang.mk.in \
4517         Makefile.in \
4518         lo.xcent.in \
4519         bin/bffvalidator.sh.in \
4520         bin/odfvalidator.sh.in \
4521         bin/officeotron.sh.in \
4522         instsetoo_native/util/openoffice.lst.in \
4523         config_host/*.in \
4524         sysui/desktop/macosx/Info.plist.in) \
4525     | (cd CONF-FOR-BUILD && tar xf -)
4526     cp configure CONF-FOR-BUILD
4527     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4528     (
4529     unset COM USING_X11 OS CPUNAME
4530     unset CC CXX SYSBASE CFLAGS
4531     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4532     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4533     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4534     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4535     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4536     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4537     cd CONF-FOR-BUILD
4538     sub_conf_opts=""
4539     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4540     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4541     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4542     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4543     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4544     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4545     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4546     # Don't bother having configure look for stuff not needed for the build platform anyway
4547     ./configure \
4548         --disable-cups \
4549         --disable-gtk3 \
4550         --disable-pdfimport \
4551         --disable-postgresql-sdbc \
4552         --with-parallelism="$with_parallelism" \
4553         --without-doxygen \
4554         --without-java \
4555         $sub_conf_opts \
4556         --srcdir=$srcdir \
4557         2>&1 | sed -e 's/^/    /'
4558     test -f ./config_host.mk 2>/dev/null || exit
4559     cp config_host.mk ../config_build.mk
4560     cp config_host_lang.mk ../config_build_lang.mk
4561     mv config.log ../config.Build.log
4562     mkdir -p ../config_build
4563     mv config_host/*.h ../config_build
4564     . ./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
4566     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
4567         VV='$'$V
4568         VV=`eval "echo $VV"`
4569         if test -n "$VV"; then
4570             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4571             echo "$line" >>build-config
4572         fi
4573     done
4575     for V in INSTDIR INSTROOT WORKDIR; do
4576         VV='$'$V
4577         VV=`eval "echo $VV"`
4578         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4579         if test -n "$VV"; then
4580             line="${V}_FOR_BUILD='$VV'"
4581             echo "$line" >>build-config
4582         fi
4583     done
4585     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4586     echo "$line" >>build-config
4588     )
4589     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4590     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])
4591     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4592              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4594     eval `cat CONF-FOR-BUILD/build-config`
4596     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4598     rm -rf CONF-FOR-BUILD
4599 else
4600     OS_FOR_BUILD="$OS"
4601     CC_FOR_BUILD="$CC"
4602     CXX_FOR_BUILD="$CXX"
4603     INSTDIR_FOR_BUILD="$INSTDIR"
4604     INSTROOT_FOR_BUILD="$INSTROOT"
4605     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4606     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4607     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4608     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4609     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4610     WORKDIR_FOR_BUILD="$WORKDIR"
4612 AC_SUBST(OS_FOR_BUILD)
4613 AC_SUBST(INSTDIR_FOR_BUILD)
4614 AC_SUBST(INSTROOT_FOR_BUILD)
4615 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4616 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4617 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4618 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4619 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4620 AC_SUBST(WORKDIR_FOR_BUILD)
4622 dnl ===================================================================
4623 dnl Check for syslog header
4624 dnl ===================================================================
4625 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4627 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4628 dnl ===================================================================
4629 AC_MSG_CHECKING([whether to turn warnings to errors])
4630 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4631     ENABLE_WERROR="TRUE"
4632     AC_MSG_RESULT([yes])
4633 else
4634     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4635         ENABLE_WERROR="TRUE"
4636         AC_MSG_RESULT([yes])
4637     else
4638         AC_MSG_RESULT([no])
4639     fi
4641 AC_SUBST(ENABLE_WERROR)
4643 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4644 dnl ===================================================================
4645 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4646 if test -z "$enable_assert_always_abort"; then
4647    if test "$ENABLE_DEBUG" = TRUE; then
4648        enable_assert_always_abort=yes
4649    else
4650        enable_assert_always_abort=no
4651    fi
4653 if test "$enable_assert_always_abort" = "yes"; then
4654     ASSERT_ALWAYS_ABORT="TRUE"
4655     AC_MSG_RESULT([yes])
4656 else
4657     ASSERT_ALWAYS_ABORT="FALSE"
4658     AC_MSG_RESULT([no])
4660 AC_SUBST(ASSERT_ALWAYS_ABORT)
4662 # Determine whether to use ooenv for the instdir installation
4663 # ===================================================================
4664 if test $_os != "WINNT" -a $_os != "Darwin"; then
4665     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4666     if test "$enable_ooenv" = "no"; then
4667         AC_MSG_RESULT([no])
4668     else
4669         ENABLE_OOENV="TRUE"
4670         AC_MSG_RESULT([yes])
4671     fi
4673 AC_SUBST(ENABLE_OOENV)
4675 if test "$USING_X11" != TRUE; then
4676     # be sure to do not mess with unneeded stuff
4677     test_randr=no
4678     test_xrender=no
4679     test_cups=no
4680     test_dbus=no
4681     test_gtk=no
4682     build_gstreamer_1_0=no
4683     build_gstreamer_0_10=no
4684     test_kde4=no
4685     test_kde5=no
4686     test_qt5=no
4687     test_gtk3_kde5=no
4688     enable_cairo_canvas=no
4691 if test "$OS" = "HAIKU"; then
4692     enable_cairo_canvas=yes
4693     test_qt5=yes
4694     test_kde5=yes
4697 dnl ===================================================================
4698 dnl check for cups support
4699 dnl ===================================================================
4700 ENABLE_CUPS=""
4702 if test "$enable_cups" = "no"; then
4703     test_cups=no
4706 AC_MSG_CHECKING([whether to enable CUPS support])
4707 if test "$test_cups" = "yes"; then
4708     ENABLE_CUPS="TRUE"
4709     AC_MSG_RESULT([yes])
4711     AC_MSG_CHECKING([whether cups support is present])
4712     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4713     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4714     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4715         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4716     fi
4718 else
4719     AC_MSG_RESULT([no])
4722 AC_SUBST(ENABLE_CUPS)
4724 # fontconfig checks
4725 if test "$test_fontconfig" = "yes"; then
4726     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4727     SYSTEM_FONTCONFIG=TRUE
4728     FilterLibs "${FONTCONFIG_LIBS}"
4729     FONTCONFIG_LIBS="${filteredlibs}"
4731 AC_SUBST(FONTCONFIG_CFLAGS)
4732 AC_SUBST(FONTCONFIG_LIBS)
4733 AC_SUBST([SYSTEM_FONTCONFIG])
4735 dnl whether to find & fetch external tarballs?
4736 dnl ===================================================================
4737 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4738    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4739        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4740    else
4741        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4742    fi
4744 if test -z "$TARFILE_LOCATION"; then
4745     if test -d "$SRC_ROOT/src" ; then
4746         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4747         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4748     fi
4749     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4750 else
4751     AbsolutePath "$TARFILE_LOCATION"
4752     PathFormat "${absolute_path}"
4753     TARFILE_LOCATION="${formatted_path}"
4755 AC_SUBST(TARFILE_LOCATION)
4757 AC_MSG_CHECKING([whether we want to fetch tarballs])
4758 if test "$enable_fetch_external" != "no"; then
4759     if test "$with_all_tarballs" = "yes"; then
4760         AC_MSG_RESULT([yes, all of them])
4761         DO_FETCH_TARBALLS="ALL"
4762     else
4763         AC_MSG_RESULT([yes, if we use them])
4764         DO_FETCH_TARBALLS="TRUE"
4765     fi
4766 else
4767     AC_MSG_RESULT([no])
4768     DO_FETCH_TARBALLS=
4770 AC_SUBST(DO_FETCH_TARBALLS)
4772 AC_MSG_CHECKING([whether to build help])
4773 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4774     BUILD_TYPE="$BUILD_TYPE HELP"
4775     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4776     case "$with_help" in
4777     "html")
4778         ENABLE_HTMLHELP=TRUE
4779         SCPDEFS="$SCPDEFS -DWITH_HELP"
4780         AC_MSG_RESULT([HTML])
4781         ;;
4782     "online")
4783         ENABLE_HTMLHELP=TRUE
4784         HELP_ONLINE=TRUE
4785         AC_MSG_RESULT([HTML])
4786         ;;
4787     yes)
4788         SCPDEFS="$SCPDEFS -DWITH_HELP"
4789         AC_MSG_RESULT([yes])
4790         ;;
4791     *)
4792         AC_MSG_ERROR([Unknown --with-help=$with_help])
4793         ;;
4794     esac
4795 else
4796     AC_MSG_RESULT([no])
4798 AC_SUBST([ENABLE_HTMLHELP])
4799 AC_SUBST([HELP_ONLINE])
4801 dnl Test whether to include MySpell dictionaries
4802 dnl ===================================================================
4803 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4804 if test "$with_myspell_dicts" = "yes"; then
4805     AC_MSG_RESULT([yes])
4806     WITH_MYSPELL_DICTS=TRUE
4807     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4808     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4809 else
4810     AC_MSG_RESULT([no])
4811     WITH_MYSPELL_DICTS=
4813 AC_SUBST(WITH_MYSPELL_DICTS)
4815 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4816 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4817     if test "$with_system_dicts" = yes; then
4818         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4819     fi
4820     with_system_dicts=no
4823 AC_MSG_CHECKING([whether to use dicts from external paths])
4824 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4825     AC_MSG_RESULT([yes])
4826     SYSTEM_DICTS=TRUE
4827     AC_MSG_CHECKING([for spelling dictionary directory])
4828     if test -n "$with_external_dict_dir"; then
4829         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4830     else
4831         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4832         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4833             DICT_SYSTEM_DIR=file:///usr/share/myspell
4834         fi
4835     fi
4836     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4837     AC_MSG_CHECKING([for hyphenation patterns directory])
4838     if test -n "$with_external_hyph_dir"; then
4839         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4840     else
4841         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4842     fi
4843     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4844     AC_MSG_CHECKING([for thesaurus directory])
4845     if test -n "$with_external_thes_dir"; then
4846         THES_SYSTEM_DIR=file://$with_external_thes_dir
4847     else
4848         THES_SYSTEM_DIR=file:///usr/share/mythes
4849     fi
4850     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4851 else
4852     AC_MSG_RESULT([no])
4853     SYSTEM_DICTS=
4855 AC_SUBST(SYSTEM_DICTS)
4856 AC_SUBST(DICT_SYSTEM_DIR)
4857 AC_SUBST(HYPH_SYSTEM_DIR)
4858 AC_SUBST(THES_SYSTEM_DIR)
4860 dnl ===================================================================
4861 dnl enable pch by default on windows
4862 dnl enable it explicitly otherwise
4863 ENABLE_PCH=""
4864 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4865     if test -z "$libo_fuzzed_enable_pch"; then
4866         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4867     else
4868         AC_MSG_NOTICE([Resetting --enable-pch=no])
4869         enable_pch=no
4870     fi
4873 AC_MSG_CHECKING([whether to enable pch feature])
4874 if test "$enable_pch" != "no"; then
4875     if test "$_os" = "WINNT"; then
4876         ENABLE_PCH="TRUE"
4877         AC_MSG_RESULT([yes])
4878     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4879         ENABLE_PCH="TRUE"
4880         AC_MSG_RESULT([yes])
4881     elif test -n "$enable_pch"; then
4882         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4883     else
4884         AC_MSG_RESULT([no])
4885     fi
4886 else
4887     AC_MSG_RESULT([no])
4889 AC_SUBST(ENABLE_PCH)
4891 TAB=`printf '\t'`
4893 AC_MSG_CHECKING([the GNU Make version])
4894 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4895 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4896 if test "$_make_longver" -ge "038200"; then
4897     AC_MSG_RESULT([$GNUMAKE $_make_version])
4899 elif test "$_make_longver" -ge "038100"; then
4900     if test "$build_os" = "cygwin"; then
4901         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4902     fi
4903     AC_MSG_RESULT([$GNUMAKE $_make_version])
4905     dnl ===================================================================
4906     dnl Search all the common names for sha1sum
4907     dnl ===================================================================
4908     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4909     if test -z "$SHA1SUM"; then
4910         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4911     elif test "$SHA1SUM" = "openssl"; then
4912         SHA1SUM="openssl sha1"
4913     fi
4914     AC_MSG_CHECKING([for GNU Make bug 20033])
4915     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4916     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4917 A := \$(wildcard *.a)
4919 .PHONY: all
4920 all: \$(A:.a=.b)
4921 <TAB>@echo survived bug20033.
4923 .PHONY: setup
4924 setup:
4925 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4927 define d1
4928 @echo lala \$(1)
4929 @sleep 1
4930 endef
4932 define d2
4933 @echo tyty \$(1)
4934 @sleep 1
4935 endef
4937 %.b : %.a
4938 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4939 <TAB>\$(call d1,\$(CHECKSUM)),\
4940 <TAB>\$(call d2,\$(CHECKSUM)))
4942     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4943         no_parallelism_make="YES"
4944         AC_MSG_RESULT([yes, disable parallelism])
4945     else
4946         AC_MSG_RESULT([no, keep parallelism enabled])
4947     fi
4948     rm -rf $TESTGMAKEBUG20033
4949 else
4950     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4953 # find if gnumake support file function
4954 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4955 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4956 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4957     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4959 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4960 \$(file >test.txt,Success )
4962 .PHONY: all
4963 all:
4964 <TAB>@cat test.txt
4967 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4968 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4969     HAVE_GNUMAKE_FILE_FUNC=TRUE
4970     AC_MSG_RESULT([yes])
4971 else
4972     AC_MSG_RESULT([no])
4974 rm -rf $TESTGMAKEFILEFUNC
4975 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4976 AC_SUBST(GNUMAKE_WIN_NATIVE)
4978 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4979 STALE_MAKE=
4980 if test "$_make_ver_check" = ""; then
4981    STALE_MAKE=TRUE
4984 HAVE_LD_HASH_STYLE=FALSE
4985 WITH_LINKER_HASH_STYLE=
4986 AC_MSG_CHECKING([for --hash-style gcc linker support])
4987 if test "$GCC" = "yes"; then
4988     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4989         hash_styles="gnu sysv"
4990     elif test "$with_linker_hash_style" = "no"; then
4991         hash_styles=
4992     else
4993         hash_styles="$with_linker_hash_style"
4994     fi
4996     for hash_style in $hash_styles; do
4997         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4998         hash_style_ldflags_save=$LDFLAGS
4999         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5001         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5002             [
5003 #include <stdio.h>
5004             ],[
5005 printf ("");
5006             ])],
5007             [
5008                   HAVE_LD_HASH_STYLE=TRUE
5009                   WITH_LINKER_HASH_STYLE=$hash_style
5010             ],
5011             [HAVE_LD_HASH_STYLE=FALSE],
5012             [HAVE_LD_HASH_STYLE=FALSE])
5013         LDFLAGS=$hash_style_ldflags_save
5014     done
5016     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5017         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5018     else
5019         AC_MSG_RESULT( no )
5020     fi
5021     LDFLAGS=$hash_style_ldflags_save
5022 else
5023     AC_MSG_RESULT( no )
5025 AC_SUBST(HAVE_LD_HASH_STYLE)
5026 AC_SUBST(WITH_LINKER_HASH_STYLE)
5028 dnl ===================================================================
5029 dnl Check whether there's a Perl version available.
5030 dnl ===================================================================
5031 if test -z "$with_perl_home"; then
5032     AC_PATH_PROG(PERL, perl)
5033 else
5034     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5035     _perl_path="$with_perl_home/bin/perl"
5036     if test -x "$_perl_path"; then
5037         PERL=$_perl_path
5038     else
5039         AC_MSG_ERROR([$_perl_path not found])
5040     fi
5043 dnl ===================================================================
5044 dnl Testing for Perl version 5 or greater.
5045 dnl $] is the Perl version variable, it is returned as an integer
5046 dnl ===================================================================
5047 if test "$PERL"; then
5048     AC_MSG_CHECKING([the Perl version])
5049     ${PERL} -e "exit($]);"
5050     _perl_version=$?
5051     if test "$_perl_version" -lt 5; then
5052         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5053     fi
5054     AC_MSG_RESULT([Perl $_perl_version])
5055 else
5056     AC_MSG_ERROR([Perl not found, install Perl 5])
5059 dnl ===================================================================
5060 dnl Testing for required Perl modules
5061 dnl ===================================================================
5063 AC_MSG_CHECKING([for required Perl modules])
5064 perl_use_string="use Cwd ; use Digest::MD5"
5065 if test "$_os" = "WINNT"; then
5066     if test -n "$PKGFORMAT"; then
5067         for i in $PKGFORMAT; do
5068             case "$i" in
5069             msi)
5070                 # for getting fonts versions to use in MSI
5071                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5072                 ;;
5073             esac
5074         done
5075     fi
5077 if test "$with_system_hsqldb" = "yes"; then
5078         perl_use_string="$perl_use_string ; use Archive::Zip"
5080 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5081     AC_MSG_RESULT([all modules found])
5082 else
5083     AC_MSG_RESULT([failed to find some modules])
5084     # Find out which modules are missing.
5085     for i in $perl_use_string; do
5086         if test "$i" != "use" -a "$i" != ";"; then
5087             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5088                 missing_perl_modules="$missing_perl_modules $i"
5089             fi
5090         fi
5091     done
5092     AC_MSG_ERROR([
5093     The missing Perl modules are: $missing_perl_modules
5094     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5097 dnl ===================================================================
5098 dnl Check for pkg-config
5099 dnl ===================================================================
5100 if test "$_os" != "WINNT"; then
5101     PKG_PROG_PKG_CONFIG
5104 if test "$_os" != "WINNT"; then
5106     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5107     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5108     # explicitly. Or put /path/to/compiler in PATH yourself.
5110     # Use wrappers for LTO
5111     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5112         AC_CHECK_TOOL(AR,gcc-ar)
5113         AC_CHECK_TOOL(NM,gcc-nm)
5114         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5115     else
5116         AC_CHECK_TOOL(AR,ar)
5117         AC_CHECK_TOOL(NM,nm)
5118         AC_CHECK_TOOL(RANLIB,ranlib)
5119     fi
5120     AC_CHECK_TOOL(OBJDUMP,objdump)
5121     AC_CHECK_TOOL(READELF,readelf)
5122     AC_CHECK_TOOL(STRIP,strip)
5123     if test "$_os" = "WINNT"; then
5124         AC_CHECK_TOOL(DLLTOOL,dlltool)
5125         AC_CHECK_TOOL(WINDRES,windres)
5126     fi
5128 AC_SUBST(AR)
5129 AC_SUBST(DLLTOOL)
5130 AC_SUBST(NM)
5131 AC_SUBST(OBJDUMP)
5132 AC_SUBST(PKG_CONFIG)
5133 AC_SUBST(RANLIB)
5134 AC_SUBST(READELF)
5135 AC_SUBST(STRIP)
5136 AC_SUBST(WINDRES)
5138 dnl ===================================================================
5139 dnl pkg-config checks on Mac OS X
5140 dnl ===================================================================
5142 if test $_os = Darwin; then
5143     AC_MSG_CHECKING([for bogus pkg-config])
5144     if test -n "$PKG_CONFIG"; then
5145         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5146             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5147         else
5148             if test "$enable_bogus_pkg_config" = "yes"; then
5149                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5150             else
5151                 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.])
5152             fi
5153         fi
5154     else
5155         AC_MSG_RESULT([no, good])
5156     fi
5159 find_csc()
5161     # Return value: $csctest
5163     unset csctest
5165     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5166     if test -n "$regvalue"; then
5167         csctest=$regvalue
5168         return
5169     fi
5172 find_al()
5174     # Return value: $altest
5176     unset altest
5178     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5179         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5180         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5181             altest=$regvalue
5182             return
5183         fi
5184     done
5186     # We need this additional check to detect 4.6.1 or above.
5187     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5188         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5189         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5190             altest=$regvalue
5191             return
5192         fi
5194         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5195         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5196             altest=$regvalue
5197             return
5198         fi
5199     done
5202 find_dotnetsdk46()
5204     unset frametest
5206     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5207         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5208         if test -n "$regvalue"; then
5209             frametest=$regvalue
5210             return
5211         fi
5212         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5213         if test -n "$regvalue"; then
5214             frametest=$regvalue
5215             return
5216         fi
5217     done
5220 find_winsdk_version()
5222     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5223     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5225     unset winsdktest winsdkbinsubdir winsdklibsubdir
5227     case "$1" in
5228     7.*)
5229         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5230         if test -n "$regvalue"; then
5231             winsdktest=$regvalue
5232             winsdklibsubdir=.
5233             return
5234         fi
5235         ;;
5236     8.0|8.0A)
5237         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5238         if test -n "$regvalue"; then
5239             winsdktest=$regvalue
5240             winsdklibsubdir=win8
5241             return
5242         fi
5243         ;;
5244     8.1|8.1A)
5245         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5246         if test -n "$regvalue"; then
5247             winsdktest=$regvalue
5248             winsdklibsubdir=winv6.3
5249             return
5250         fi
5251         ;;
5252     10.0)
5253         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5254         if test -n "$regvalue"; then
5255             winsdktest=$regvalue
5256             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5257             if test -n "$regvalue"; then
5258                 winsdkbinsubdir="$regvalue".0
5259                 winsdklibsubdir=$winsdkbinsubdir
5260                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5261                 # test exist the SDK path
5262                 if test -d "$tmppath"; then
5263                    # when path is convertible to a short path then path is okay
5264                    if ! cygpath -d "$tmppath"; then
5265                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5266                    fi
5267                 else
5268                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5269                 fi
5270             fi
5271             return
5272         fi
5273         ;;
5274     esac
5277 find_winsdk()
5279     # Return value: From find_winsdk_version
5281     unset winsdktest
5283     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5284         find_winsdk_version $ver
5285         if test -n "$winsdktest"; then
5286             return
5287         fi
5288     done
5291 find_msms()
5293     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5294     if test $VCVER = 150; then
5295         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5296     fi
5297     AC_MSG_CHECKING([for ${my_msm_files}])
5298     msmdir=
5299     for ver in 14.0 15.0; do
5300         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5301         if test -n "$regvalue"; then
5302             for f in ${my_msm_files}; do
5303                 if test -e "$regvalue/${f}"; then
5304                     msmdir=$regvalue
5305                     break
5306                 fi
5307             done
5308         fi
5309     done
5310     dnl Is the following fallback really necessary, or was it added in response
5311     dnl to never having started Visual Studio on a given machine, so the
5312     dnl registry keys checked above had presumably not yet been created?
5313     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5314     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5315     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5316     dnl expanding to "C:\Program Files\Common Files"), which would need
5317     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5318     dnl obtain its value from cygwin:
5319     if test -z "$msmdir"; then
5320         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5321         for f in ${my_msm_files}; do
5322             if test -e "$my_msm_dir/${f}"; then
5323                 msmdir=$my_msm_dir
5324             fi
5325         done
5326     fi
5328     dnl Starting from MSVC 15.0, merge modules are located in different directory
5329     if test $VCVER = 150; then
5330         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5331             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5332             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5333             for f in ${my_msm_files}; do
5334                 if test -e "$my_msm_dir/${f}"; then
5335                     msmdir=$my_msm_dir
5336                     break
5337                 fi
5338             done
5339         done
5340     fi
5342     if test -n "$msmdir"; then
5343         msmdir=`cygpath -m "$msmdir"`
5344         AC_MSG_RESULT([$msmdir])
5345     else
5346         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5347             AC_MSG_ERROR([not found])
5348         else
5349             AC_MSG_WARN([not found])
5350             add_warning "MSM none of ${my_msm_files} found"
5351         fi
5352     fi
5355 find_msvc_x64_dlls()
5357     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5358     if test "$VCVER" = 150; then
5359         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5360             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5361             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5362                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5363                 break
5364             fi
5365             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5366                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5367                 break
5368             fi
5369         done
5370     fi
5371     msvcdlls="msvcp140.dll vcruntime140.dll"
5372     for dll in $msvcdlls; do
5373         if ! test -f "$msvcdllpath/$dll"; then
5374             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5375         fi
5376     done
5379 dnl =========================================
5380 dnl Check for the Windows  SDK.
5381 dnl =========================================
5382 if test "$_os" = "WINNT"; then
5383     AC_MSG_CHECKING([for Windows SDK])
5384     if test "$build_os" = "cygwin"; then
5385         find_winsdk
5386         WINDOWS_SDK_HOME=$winsdktest
5388         # normalize if found
5389         if test -n "$WINDOWS_SDK_HOME"; then
5390             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5391             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5392         fi
5394         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5395     fi
5397     if test -n "$WINDOWS_SDK_HOME"; then
5398         # Remove a possible trailing backslash
5399         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5401         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5402              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5403              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5404             have_windows_sdk_headers=yes
5405         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5406              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5407              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5408             have_windows_sdk_headers=yes
5409         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5410              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5411              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5412             have_windows_sdk_headers=yes
5413         else
5414             have_windows_sdk_headers=no
5415         fi
5417         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5418             have_windows_sdk_libs=yes
5419         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5420             have_windows_sdk_libs=yes
5421         else
5422             have_windows_sdk_libs=no
5423         fi
5425         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5426             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5427 the  Windows SDK are installed.])
5428         fi
5429     fi
5431     if test -z "$WINDOWS_SDK_HOME"; then
5432         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5433     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5434         WINDOWS_SDK_VERSION=70
5435         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5436     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5437         WINDOWS_SDK_VERSION=80
5438         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5439     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5440         WINDOWS_SDK_VERSION=81
5441         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5442     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5443         WINDOWS_SDK_VERSION=10
5444         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5445     else
5446         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5447     fi
5448     PathFormat "$WINDOWS_SDK_HOME"
5449     WINDOWS_SDK_HOME="$formatted_path"
5450     if test "$build_os" = "cygwin"; then
5451         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5452         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5453             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5454         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5455             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5456         fi
5457     fi
5459     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5460     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5461     dnl but not in v8.0), so allow this to be overridden with a
5462     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5463     dnl and configuration error if no WiLangId.vbs is found would arguably be
5464     dnl better, but I do not know under which conditions exactly it is needed by
5465     dnl msiglobal.pm:
5466     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5467         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5468         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5469             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5470         fi
5471         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5472             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5473         fi
5474         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5475             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5476         fi
5477     fi
5478     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5479         if test -n "$with_package_format" -a "$with_package_format" != no; then
5480             for i in "$with_package_format"; do
5481                 if test "$i" = "msi"; then
5482                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5483                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5484                     fi
5485                 fi
5486             done
5487         fi
5488     fi
5490 AC_SUBST(WINDOWS_SDK_HOME)
5491 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5492 AC_SUBST(WINDOWS_SDK_VERSION)
5493 AC_SUBST(WINDOWS_SDK_WILANGID)
5495 if test "$build_os" = "cygwin"; then
5496     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5497     dnl dir, it also determines that dir's path w/o an arch segment if any,
5498     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5499     AC_MSG_CHECKING([for midl.exe])
5501     find_winsdk
5502     if test -n "$winsdkbinsubdir" \
5503         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5504     then
5505         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5506         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5507     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5508         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5509         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5510     elif test -f "$winsdktest/Bin/midl.exe"; then
5511         MIDL_PATH=$winsdktest/Bin
5512         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5513     fi
5514     if test ! -f "$MIDL_PATH/midl.exe"; then
5515         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5516     else
5517         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5518     fi
5520     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5521     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5523     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5524          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5525          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5526          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5527     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5528          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5529          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5530          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5531     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5532          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5533          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5534          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5535     else
5536         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5537     fi
5539     dnl Check csc.exe
5540     AC_MSG_CHECKING([for csc.exe])
5541     find_csc
5542     if test -f "$csctest/csc.exe"; then
5543         CSC_PATH="$csctest"
5544     fi
5545     if test ! -f "$CSC_PATH/csc.exe"; then
5546         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5547     else
5548         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5549     fi
5551     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5553     dnl Check al.exe
5554     AC_MSG_CHECKING([for al.exe])
5555     find_winsdk
5556     if test -n "$winsdkbinsubdir" \
5557         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5558     then
5559         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5560     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5561         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5562     elif test -f "$winsdktest/Bin/al.exe"; then
5563         AL_PATH="$winsdktest/Bin"
5564     fi
5566     if test -z "$AL_PATH"; then
5567         find_al
5568         if test -f "$altest/bin/al.exe"; then
5569             AL_PATH="$altest/bin"
5570         elif test -f "$altest/al.exe"; then
5571             AL_PATH="$altest"
5572         fi
5573     fi
5574     if test ! -f "$AL_PATH/al.exe"; then
5575         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5576     else
5577         AC_MSG_RESULT([$AL_PATH/al.exe])
5578     fi
5580     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5582     dnl Check mscoree.lib / .NET Framework dir
5583     AC_MSG_CHECKING(.NET Framework)
5584     find_dotnetsdk46
5585     PathFormat "$frametest"
5586     frametest="$formatted_path"
5587     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5588         DOTNET_FRAMEWORK_HOME="$frametest"
5589     else
5590         find_winsdk
5591         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5592             DOTNET_FRAMEWORK_HOME="$winsdktest"
5593         fi
5594     fi
5595     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
5596         AC_MSG_ERROR([mscoree.lib not found])
5597     fi
5598     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5600     PathFormat "$MIDL_PATH"
5601     MIDL_PATH="$formatted_path"
5603     PathFormat "$AL_PATH"
5604     AL_PATH="$formatted_path"
5606     PathFormat "$DOTNET_FRAMEWORK_HOME"
5607     DOTNET_FRAMEWORK_HOME="$formatted_path"
5609     PathFormat "$CSC_PATH"
5610     CSC_PATH="$formatted_path"
5613 dnl ===================================================================
5614 dnl Check if stdc headers are available excluding MSVC.
5615 dnl ===================================================================
5616 if test "$_os" != "WINNT"; then
5617     AC_HEADER_STDC
5620 dnl ===================================================================
5621 dnl Testing for C++ compiler and version...
5622 dnl ===================================================================
5624 if test "$_os" != "WINNT"; then
5625     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5626     save_CXXFLAGS=$CXXFLAGS
5627     AC_PROG_CXX
5628     CXXFLAGS=$save_CXXFLAGS
5629 else
5630     if test -n "$CC" -a -z "$CXX"; then
5631         CXX="$CC"
5632     fi
5635 dnl check for GNU C++ compiler version
5636 if test "$GXX" = "yes"; then
5637     AC_MSG_CHECKING([the GNU C++ compiler version])
5639     _gpp_version=`$CXX -dumpversion`
5640     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5642     if test "$_gpp_majmin" -lt "401"; then
5643         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5644     else
5645         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5646     fi
5648     dnl see https://code.google.com/p/android/issues/detail?id=41770
5649     if test "$_gpp_majmin" -ge "401"; then
5650         glibcxx_threads=no
5651         AC_LANG_PUSH([C++])
5652         AC_REQUIRE_CPP
5653         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5654         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5655             #include <bits/c++config.h>]],[[
5656             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5657             && !defined(_GLIBCXX__PTHREADS) \
5658             && !defined(_GLIBCXX_HAS_GTHREADS)
5659             choke me
5660             #endif
5661         ]])],[AC_MSG_RESULT([yes])
5662         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5663         AC_LANG_POP([C++])
5664         if test $glibcxx_threads = yes; then
5665             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5666         fi
5667      fi
5669 AC_SUBST(BOOST_CXXFLAGS)
5672 # prefx CXX with ccache if needed
5674 if test "$CCACHE" != ""; then
5675     AC_MSG_CHECKING([whether $CXX is already ccached])
5676     AC_LANG_PUSH([C++])
5677     save_CXXFLAGS=$CXXFLAGS
5678     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5679     dnl an empty program will do, we're checking the compiler flags
5680     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5681                       [use_ccache=yes], [use_ccache=no])
5682     if test $use_ccache = yes; then
5683         AC_MSG_RESULT([yes])
5684     else
5685         CXX="$CCACHE $CXX"
5686         AC_MSG_RESULT([no])
5687     fi
5688     CXXFLAGS=$save_CXXFLAGS
5689     AC_LANG_POP([C++])
5692 dnl ===================================================================
5693 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5694 dnl ===================================================================
5696 if test "$_os" != "WINNT"; then
5697     AC_PROG_CXXCPP
5699     dnl Check whether there's a C pre-processor.
5700     AC_PROG_CPP
5704 dnl ===================================================================
5705 dnl Find integral type sizes and alignments
5706 dnl ===================================================================
5708 if test "$_os" != "WINNT"; then
5710 if test "$_os" == "iOS"; then
5711     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5712     ac_cv_sizeof_long=8
5713     ac_cv_sizeof_short=2
5714     ac_cv_sizeof_int=4
5715     ac_cv_sizeof_long_long=8
5716     ac_cv_sizeof_double=8
5717     ac_cv_sizeof_voidp=8
5718 else
5719     AC_CHECK_SIZEOF(long)
5720     AC_CHECK_SIZEOF(short)
5721     AC_CHECK_SIZEOF(int)
5722     AC_CHECK_SIZEOF(long long)
5723     AC_CHECK_SIZEOF(double)
5724     AC_CHECK_SIZEOF(void*)
5727     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5728     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5729     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5730     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5731     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5733     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5734     m4_pattern_allow([AC_CHECK_ALIGNOF])
5735     m4_ifdef([AC_CHECK_ALIGNOF],
5736         [
5737             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5738             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5739             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5740             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5741         ],
5742         [
5743             case "$_os-$host_cpu" in
5744             Linux-i686)
5745                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5746                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5747                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5748                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5749                 ;;
5750             Linux-x86_64)
5751                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5752                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5753                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5754                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5755                 ;;
5756             *)
5757                 if test -z "$ac_cv_alignof_short" -o \
5758                         -z "$ac_cv_alignof_int" -o \
5759                         -z "$ac_cv_alignof_long" -o \
5760                         -z "$ac_cv_alignof_double"; then
5761                    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.])
5762                 fi
5763                 ;;
5764             esac
5765         ])
5767     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5768     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5769     if test $ac_cv_sizeof_long -eq 8; then
5770         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5771     elif test $ac_cv_sizeof_double -eq 8; then
5772         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5773     else
5774         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5775     fi
5777     dnl Check for large file support
5778     AC_SYS_LARGEFILE
5779     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5780         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5781     fi
5782     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5783         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5784     fi
5785 else
5786     # Hardcode for MSVC
5787     SAL_TYPES_SIZEOFSHORT=2
5788     SAL_TYPES_SIZEOFINT=4
5789     SAL_TYPES_SIZEOFLONG=4
5790     SAL_TYPES_SIZEOFLONGLONG=8
5791     if test "$BITNESS_OVERRIDE" = ""; then
5792         SAL_TYPES_SIZEOFPOINTER=4
5793     else
5794         SAL_TYPES_SIZEOFPOINTER=8
5795     fi
5796     SAL_TYPES_ALIGNMENT2=2
5797     SAL_TYPES_ALIGNMENT4=4
5798     SAL_TYPES_ALIGNMENT8=8
5799     LFS_CFLAGS=''
5801 AC_SUBST(LFS_CFLAGS)
5803 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5804 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5805 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5806 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5807 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5808 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5809 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5810 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5812 dnl ===================================================================
5813 dnl Check whether to enable runtime optimizations
5814 dnl ===================================================================
5815 ENABLE_RUNTIME_OPTIMIZATIONS=
5816 AC_MSG_CHECKING([whether to enable runtime optimizations])
5817 if test -z "$enable_runtime_optimizations"; then
5818     for i in $CC; do
5819         case $i in
5820         -fsanitize=*)
5821             enable_runtime_optimizations=no
5822             break
5823             ;;
5824         esac
5825     done
5827 if test "$enable_runtime_optimizations" != no; then
5828     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5829     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5830     AC_MSG_RESULT([yes])
5831 else
5832     AC_MSG_RESULT([no])
5834 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5836 dnl ===================================================================
5837 dnl Check if valgrind headers are available
5838 dnl ===================================================================
5839 ENABLE_VALGRIND=
5840 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5841     prev_cppflags=$CPPFLAGS
5842     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5843     # or where does it come from?
5844     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5845     AC_CHECK_HEADER([valgrind/valgrind.h],
5846         [ENABLE_VALGRIND=TRUE])
5847     CPPFLAGS=$prev_cppflags
5849 AC_SUBST([ENABLE_VALGRIND])
5850 if test -z "$ENABLE_VALGRIND"; then
5851     if test "$with_valgrind" = yes; then
5852         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5853     fi
5854     VALGRIND_CFLAGS=
5856 AC_SUBST([VALGRIND_CFLAGS])
5859 dnl ===================================================================
5860 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5861 dnl ===================================================================
5863 # We need at least the sys/sdt.h include header.
5864 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5865 if test "$SDT_H_FOUND" = "TRUE"; then
5866     # Found sys/sdt.h header, now make sure the c++ compiler works.
5867     # Old g++ versions had problems with probes in constructors/destructors.
5868     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5869     AC_LANG_PUSH([C++])
5870     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5871     #include <sys/sdt.h>
5872     class ProbeClass
5873     {
5874     private:
5875       int& ref;
5876       const char *name;
5878     public:
5879       ProbeClass(int& v, const char *n) : ref(v), name(n)
5880       {
5881         DTRACE_PROBE2(_test_, cons, name, ref);
5882       }
5884       void method(int min)
5885       {
5886         DTRACE_PROBE3(_test_, meth, name, ref, min);
5887         ref -= min;
5888       }
5890       ~ProbeClass()
5891       {
5892         DTRACE_PROBE2(_test_, dest, name, ref);
5893       }
5894     };
5895     ]],[[
5896     int i = 64;
5897     DTRACE_PROBE1(_test_, call, i);
5898     ProbeClass inst = ProbeClass(i, "call");
5899     inst.method(24);
5900     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5901           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5902     AC_LANG_POP([C++])
5904 AC_CONFIG_HEADERS([config_host/config_probes.h])
5906 dnl ===================================================================
5907 dnl GCC features
5908 dnl ===================================================================
5909 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5910     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5911     save_CFLAGS=$CFLAGS
5912     CFLAGS="$CFLAGS -Werror -mno-avx"
5913     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5914     CFLAGS=$save_CFLAGS
5915     if test "$HAVE_GCC_AVX" = "TRUE"; then
5916         AC_MSG_RESULT([yes])
5917     else
5918         AC_MSG_RESULT([no])
5919     fi
5921     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5922     save_CFLAGS=$CFLAGS
5923     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5924     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5925     CFLAGS=$save_CFLAGS
5926     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5927         AC_MSG_RESULT([yes])
5928     else
5929         AC_MSG_RESULT([no])
5930     fi
5932     AC_MSG_CHECKING([whether $CC supports atomic functions])
5933     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5934     int v = 0;
5935     if (__sync_add_and_fetch(&v, 1) != 1 ||
5936         __sync_sub_and_fetch(&v, 1) != 0)
5937         return 1;
5938     __sync_synchronize();
5939     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5940         v != 1)
5941         return 1;
5942     return 0;
5943 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5944     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5945         AC_MSG_RESULT([yes])
5946         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5947     else
5948         AC_MSG_RESULT([no])
5949     fi
5951     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5952     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5953     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5954         AC_MSG_RESULT([yes])
5955         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5956     else
5957         AC_MSG_RESULT([no])
5958     fi
5960     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5961     save_CFLAGS=$CFLAGS
5962     CFLAGS="$CFLAGS -Werror"
5963     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5964             __attribute__((deprecated("test"))) void f();
5965         ])], [
5966             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5967             AC_MSG_RESULT([yes])
5968         ], [AC_MSG_RESULT([no])])
5969     CFLAGS=$save_CFLAGS
5971     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5972     AC_LANG_PUSH([C++])
5973     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5974             #include <cstddef>
5975             #include <cxxabi.h>
5976             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5977         ])], [
5978             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5979             AC_MSG_RESULT([yes])
5980         ], [AC_MSG_RESULT([no])])
5981     AC_LANG_POP([C++])
5983     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5984     AC_LANG_PUSH([C++])
5985     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5986             #include <cstddef>
5987             #include <cxxabi.h>
5988             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5989         ])], [
5990             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5991             AC_MSG_RESULT([yes])
5992         ], [AC_MSG_RESULT([no])])
5993     AC_LANG_POP([C++])
5995     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5996     AC_LANG_PUSH([C++])
5997     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5998             #include <cxxabi.h>
5999             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6000         ])], [
6001             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6002             AC_MSG_RESULT([yes])
6003         ], [AC_MSG_RESULT([no])])
6004     AC_LANG_POP([C++])
6006     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6007     AC_LANG_PUSH([C++])
6008     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6009             #include <cstddef>
6010             #include <cxxabi.h>
6011             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6012         ])], [
6013             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6014             AC_MSG_RESULT([yes])
6015         ], [AC_MSG_RESULT([no])])
6016     AC_LANG_POP([C++])
6018     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6019     AC_LANG_PUSH([C++])
6020     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6021             #include <cstddef>
6022             #include <cxxabi.h>
6023             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6024         ])], [
6025             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6026             AC_MSG_RESULT([yes])
6027         ], [AC_MSG_RESULT([no])])
6028     AC_LANG_POP([C++])
6030     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6031     AC_LANG_PUSH([C++])
6032     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6033             #include <cxxabi.h>
6034             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6035         ])], [
6036             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6037             AC_MSG_RESULT([yes])
6038         ], [AC_MSG_RESULT([no])])
6039     AC_LANG_POP([C++])
6041     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6042     AC_LANG_PUSH([C++])
6043     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6044             #include <cxxabi.h>
6045             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6046         ])], [
6047             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6048             AC_MSG_RESULT([yes])
6049         ], [AC_MSG_RESULT([no])])
6050     AC_LANG_POP([C++])
6052     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6053     AC_LANG_PUSH([C++])
6054     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6055             #include <cxxabi.h>
6056             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6057         ])], [
6058             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6059             AC_MSG_RESULT([yes])
6060         ], [AC_MSG_RESULT([no])])
6061     AC_LANG_POP([C++])
6063     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6064     AC_LANG_PUSH([C++])
6065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6066             #include <cstddef>
6067             #include <cxxabi.h>
6068             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6069         ])], [
6070             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6071             AC_MSG_RESULT([yes])
6072         ], [AC_MSG_RESULT([no])])
6073     AC_LANG_POP([C++])
6075     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6076     AC_LANG_PUSH([C++])
6077     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6078             #include <cstddef>
6079             #include <cxxabi.h>
6080             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6081         ])], [
6082             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6083             AC_MSG_RESULT([yes])
6084         ], [AC_MSG_RESULT([no])])
6085     AC_LANG_POP([C++])
6087     dnl Available in GCC 4.9 and at least since Clang 3.4:
6088     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6089     AC_LANG_PUSH([C++])
6090     save_CXXFLAGS=$CXXFLAGS
6091     CXXFLAGS="$CXXFLAGS -Werror"
6092     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6093             struct __attribute__((warn_unused)) dummy {};
6094         ])], [
6095             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6096             AC_MSG_RESULT([yes])
6097         ], [AC_MSG_RESULT([no])])
6098     CXXFLAGS=$save_CXXFLAGS
6099 AC_LANG_POP([C++])
6102 AC_SUBST(HAVE_GCC_AVX)
6103 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6104 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6105 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6107 dnl ===================================================================
6108 dnl Identify the C++ library
6109 dnl ===================================================================
6111 AC_MSG_CHECKING([what the C++ library is])
6112 AC_LANG_PUSH([C++])
6113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6114 #include <utility>
6115 #ifndef __GLIBCXX__
6116 foo bar
6117 #endif
6118 ]])],
6119     [CPP_LIBRARY=GLIBCXX
6120      cpp_library_name="GNU libstdc++"
6121     ],
6122     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6123 #include <utility>
6124 #ifndef _LIBCPP_VERSION
6125 foo bar
6126 #endif
6127 ]])],
6128     [CPP_LIBRARY=LIBCPP
6129      cpp_library_name="LLVM libc++"
6130      AC_DEFINE([HAVE_LIBCXX])
6131     ],
6132     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6133 #include <utility>
6134 #ifndef _MSC_VER
6135 foo bar
6136 #endif
6137 ]])],
6138     [CPP_LIBRARY=MSVCRT
6139      cpp_library_name="Microsoft"
6140     ],
6141     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6142 AC_MSG_RESULT([$cpp_library_name])
6143 AC_LANG_POP([C++])
6145 dnl ===================================================================
6146 dnl Check for gperf
6147 dnl ===================================================================
6148 AC_PATH_PROG(GPERF, gperf)
6149 if test -z "$GPERF"; then
6150     AC_MSG_ERROR([gperf not found but needed. Install it.])
6152 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6153     GPERF=`cygpath -m $GPERF`
6155 AC_MSG_CHECKING([gperf version])
6156 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6157     AC_MSG_RESULT([OK])
6158 else
6159     AC_MSG_ERROR([too old, you need at least 3.0.0])
6161 AC_SUBST(GPERF)
6163 dnl ===================================================================
6164 dnl Check for system libcmis
6165 dnl ===================================================================
6166 # libcmis requires curl and we can't build curl for iOS
6167 if test $_os != iOS; then
6168     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6169     ENABLE_LIBCMIS=TRUE
6170 else
6171     ENABLE_LIBCMIS=
6173 AC_SUBST(ENABLE_LIBCMIS)
6175 dnl ===================================================================
6176 dnl C++11
6177 dnl ===================================================================
6179 my_cxx17switches=
6180 libo_FUZZ_ARG_ENABLE(c++17,
6181     AS_HELP_STRING([--disable-c++17],
6182         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6185 AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6186 CXXFLAGS_CXX11=
6187 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6188     CXXFLAGS_CXX11=-std:c++17
6189 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6190     dnl But only use C++17 if the gperf that is being used knows not to emit
6191     dnl "register" in C++ output:
6192     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6193     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'
6194     if test "$enable_c__17" != no; then
6195         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6196     fi
6197     for flag in $my_flags; do
6198         if test "$COM" = MSC; then
6199             flag="-Xclang $flag"
6200         fi
6201         save_CXXFLAGS=$CXXFLAGS
6202         CXXFLAGS="$CXXFLAGS $flag -Werror"
6203         if test "$SYSTEM_LIBCMIS" = TRUE; then
6204             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6205         fi
6206         AC_LANG_PUSH([C++])
6207         dnl Clang 3.9 supports __float128 since
6208         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6209         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6210         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6211         dnl $flag is supported below, so check this first):
6212         my_float128hack=
6213         my_float128hack_impl=-D__float128=void
6214         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6215             #include <vector>
6216             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6217             // (__float128)
6218             ]])
6219         ],,[
6220             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6221             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6222             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6223             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6224             dnl place where __float128 is used is in a template specialization, -D__float128=void
6225             dnl will avoid the problem there while still causing a problem if somebody actually uses
6226             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6227             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6228             dnl "fixed" with this hack):
6229             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6230             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6231                 #include <vector>
6232                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6233                 // (__float128)
6234                 ]])
6235             ],[my_float128hack=$my_float128hack_impl])
6236         ])
6237         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6238             #include <algorithm>
6239             #include <functional>
6240             #include <vector>
6242             #include <string.h>
6243             #pragma GCC diagnostic push
6244             #pragma GCC diagnostic ignored "-Wpragmas"
6245                 // make GCC not warn about next pragma
6246             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6247                 // make Clang with -std < C++17 not even warn about register
6248             #include "conftest.inc"
6249             #pragma GCC diagnostic pop
6251             #if defined SYSTEM_LIBCMIS
6252             // See ucb/source/ucp/cmis/auth_provider.hxx:
6253             #if __GNUC__ >= 7
6254             #pragma GCC diagnostic push
6255             #pragma GCC diagnostic ignored "-Wdeprecated"
6256             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6257             #endif
6258             #include <libcmis/libcmis.hxx>
6259             #if __GNUC__ >= 7
6260             #pragma GCC diagnostic pop
6261             #endif
6262             #endif
6264             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6265                 std::sort(v.begin(), v.end(), fn);
6266             }
6267             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6268         AC_LANG_POP([C++])
6269         CXXFLAGS=$save_CXXFLAGS
6270         if test -n "$CXXFLAGS_CXX11"; then
6271             break
6272         fi
6273     done
6274     rm conftest.inc
6276 if test -n "$CXXFLAGS_CXX11"; then
6277     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6278 else
6279     AC_MSG_ERROR(no)
6281 AC_SUBST(CXXFLAGS_CXX11)
6283 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6284 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6285 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6286 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6287 dnl again towards 4.7.2:
6288 if test $CPP_LIBRARY = GLIBCXX; then
6289     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6290     AC_LANG_PUSH([C++])
6291     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6292 #include <list>
6293 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6294     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6295     //   GCC 4.7.0: 20120322
6296     //   GCC 4.7.1: 20120614
6297     // and using a range check is not possible as the mapping between
6298     // __GLIBCXX__ values and GCC versions is not monotonic
6299 /* ok */
6300 #else
6301 abi broken
6302 #endif
6303         ]])], [AC_MSG_RESULT(no, ok)],
6304         [AC_MSG_ERROR(yes)])
6305     AC_LANG_POP([C++])
6308 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6309 save_CXXFLAGS=$CXXFLAGS
6310 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6311 AC_LANG_PUSH([C++])
6313 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6314 #include <stddef.h>
6316 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6318 namespace
6320         struct b
6321         {
6322                 int i;
6323                 int j;
6324         };
6326 ]], [[
6327 struct a
6329         int i;
6330         int j;
6332 a thinga[]={{0,0}, {1,1}};
6333 b thingb[]={{0,0}, {1,1}};
6334 size_t i = sizeof(sal_n_array_size(thinga));
6335 size_t j = sizeof(sal_n_array_size(thingb));
6336 return !(i != 0 && j != 0);
6338     ], [ AC_MSG_RESULT(yes) ],
6339     [ AC_MSG_ERROR(no)])
6340 AC_LANG_POP([C++])
6341 CXXFLAGS=$save_CXXFLAGS
6343 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6344 save_CXXFLAGS=$CXXFLAGS
6345 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6346 AC_LANG_PUSH([C++])
6347 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6348     // A somewhat over-complicated way of checking for
6349     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6350     // in constexpr function":
6351     #include <cassert>
6352     template<typename T> inline constexpr T f(T x) { return x; }
6353     template<typename T> inline constexpr T g(T x) {
6354         assert(f(static_cast<int>(x)));
6355         return x;
6356     }
6357     enum E { e };
6358     auto v = g(E::e);
6360     struct S {
6361         int n_;
6362         constexpr bool f() {
6363             int n = n_;
6364             int i = 0;
6365             while (n > 0) { --n; ++i; }
6366             assert(i >= 0);
6367             return i == 0;
6368         }
6369     };
6370     constexpr auto v2 = S{10}.f();
6371     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6372 AC_LANG_POP([C++])
6373 CXXFLAGS=$save_CXXFLAGS
6374 AC_MSG_RESULT([$cxx14_constexpr])
6375 if test "$cxx14_constexpr" = yes; then
6376     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6379 dnl _Pragma support (may require C++11)
6380 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6381     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6382     AC_LANG_PUSH([C++])
6383     save_CXXFLAGS=$CXXFLAGS
6384     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6386             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6387         ])], [
6388             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6389             AC_MSG_RESULT([yes])
6390         ], [AC_MSG_RESULT([no])])
6391     AC_LANG_POP([C++])
6392     CXXFLAGS=$save_CXXFLAGS
6395 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6396 if test "$GCC" = yes; then
6397     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6398     AC_LANG_PUSH([C++])
6399     save_CXXFLAGS=$CXXFLAGS
6400     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6401     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6402     CXXFLAGS=$save_CXXFLAGS
6403     AC_LANG_POP([C++])
6404     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6405         AC_MSG_RESULT([yes])
6406     else
6407         AC_MSG_RESULT([no])
6408     fi
6410 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6412 AC_MSG_CHECKING([[whether $CXX supports [[fallthrough]]]])
6413 AC_LANG_PUSH([C++])
6414 save_CXXFLAGS=$CXXFLAGS
6415 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6416 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6417 if test "$COM" = MSC; then
6418     CXXFLAGS="$CXXFLAGS /we5030"
6419 else
6420     CXXFLAGS="$CXXFLAGS -Werror"
6422 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6423         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6424         // by checking for __cplusplus:
6425         #if __cplusplus > 201703L
6426         #if !__has_cpp_attribute(fallthrough)
6427         #error
6428         #endif
6429         #else
6430         void f(int & x) {
6431             switch (x) {
6432             case 0:
6433                 ++x;
6434                 [[fallthrough]];
6435             default:
6436                 ++x;
6437             }
6438         }
6439         #endif
6440     ]])], [
6441         AC_DEFINE([HAVE_CPP_ATTRIBUTE_FALLTHROUGH],[1])
6442         AC_MSG_RESULT([yes])
6443     ], [AC_MSG_RESULT([no])])
6444 CXXFLAGS=$save_CXXFLAGS
6445 AC_LANG_POP([C++])
6447 AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
6448 AC_LANG_PUSH([C++])
6449 save_CXXFLAGS=$CXXFLAGS
6450 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6451 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6452 if test "$COM" = MSC; then
6453     CXXFLAGS="$CXXFLAGS /we5030"
6454 else
6455     CXXFLAGS="$CXXFLAGS -Werror"
6457 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6458         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6459         // by checking for __cplusplus:
6460         #if __cplusplus > 201703L
6461         #if !__has_cpp_attribute(nodiscard)
6462         #error
6463         #endif
6464         #else
6465         [[nodiscard]] int f();
6466         #endif
6467     ]])], [
6468         AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
6469         AC_MSG_RESULT([yes])
6470     ], [AC_MSG_RESULT([no])])
6471 CXXFLAGS=$save_CXXFLAGS
6472 AC_LANG_POP([C++])
6474 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6475 AC_LANG_PUSH([C++])
6476 save_CXXFLAGS=$CXXFLAGS
6477 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6478 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6479         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6480         // supporting it:
6481         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6482         struct S {
6483         private:
6484             S(S const &);
6485         public:
6486             S();
6487             ~S();
6488         };
6489         S copy();
6490         void f() { S c(copy()); }
6491         #endif
6492     ])], [
6493         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6494         AC_MSG_RESULT([yes])
6495     ], [AC_MSG_RESULT([no])])
6496 CXXFLAGS=$save_CXXFLAGS
6497 AC_LANG_POP([C++])
6499 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6500 AC_LANG_PUSH([C++])
6501 save_CXXFLAGS=$CXXFLAGS
6502 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6503 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6504         #include <memory>
6505         struct S1 {};
6506         struct S2: S1 {};
6507         std::unique_ptr<S1> f() {
6508             std::unique_ptr<S2> s2(new S2);
6509             return s2;
6510         }
6511     ])], [
6512         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6513         AC_MSG_RESULT([yes])
6514     ], [AC_MSG_RESULT([no])])
6515 CXXFLAGS=$save_CXXFLAGS
6516 AC_LANG_POP([C++])
6518 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6519 AC_LANG_PUSH([C++])
6520 save_CXXFLAGS=$CXXFLAGS
6521 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6522 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6523         struct S1 { S1(S1 &&); };
6524         struct S2: S1 {};
6525         S1 f(S2 s) { return s; }
6526     ])], [
6527         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6528         AC_MSG_RESULT([yes])
6529     ], [AC_MSG_RESULT([no])])
6530 CXXFLAGS=$save_CXXFLAGS
6531 AC_LANG_POP([C++])
6533 dnl ===================================================================
6534 dnl system stl sanity tests
6535 dnl ===================================================================
6536 if test "$_os" != "WINNT"; then
6538     AC_LANG_PUSH([C++])
6540     save_CPPFLAGS="$CPPFLAGS"
6541     if test -n "$MACOSX_SDK_PATH"; then
6542         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6543     fi
6545     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6546     # only.
6547     if test "$CPP_LIBRARY" = GLIBCXX; then
6548         dnl gcc#19664, gcc#22482, rhbz#162935
6549         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6550         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6551         AC_MSG_RESULT([$stlvisok])
6552         if test "$stlvisok" = "no"; then
6553             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6554         fi
6555     fi
6557     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6558     # when we don't make any dynamic libraries?
6559     if test "$DISABLE_DYNLOADING" = ""; then
6560         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6561         cat > conftestlib1.cc <<_ACEOF
6562 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6563 struct S2: S1<int> { virtual ~S2(); };
6564 S2::~S2() {}
6565 _ACEOF
6566         cat > conftestlib2.cc <<_ACEOF
6567 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6568 struct S2: S1<int> { virtual ~S2(); };
6569 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6570 _ACEOF
6571         gccvisinlineshiddenok=yes
6572         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6573             gccvisinlineshiddenok=no
6574         else
6575             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6576             dnl known to not work with -z defs (unsetting which makes the test
6577             dnl moot, though):
6578             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6579             if test "$COM_IS_CLANG" = TRUE; then
6580                 for i in $CXX $CXXFLAGS; do
6581                     case $i in
6582                     -fsanitize=*)
6583                         my_linkflagsnoundefs=
6584                         break
6585                         ;;
6586                     esac
6587                 done
6588             fi
6589             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6590                 gccvisinlineshiddenok=no
6591             fi
6592         fi
6594         rm -fr libconftest*
6595         AC_MSG_RESULT([$gccvisinlineshiddenok])
6596         if test "$gccvisinlineshiddenok" = "no"; then
6597             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6598         fi
6599     fi
6601    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6602     cat >visibility.cxx <<_ACEOF
6603 #pragma GCC visibility push(hidden)
6604 struct __attribute__ ((visibility ("default"))) TestStruct {
6605   static void Init();
6607 __attribute__ ((visibility ("default"))) void TestFunc() {
6608   TestStruct::Init();
6610 _ACEOF
6611     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6612         gccvisbroken=yes
6613     else
6614         case "$host_cpu" in
6615         i?86|x86_64)
6616             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6617                 gccvisbroken=no
6618             else
6619                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6620                     gccvisbroken=no
6621                 else
6622                     gccvisbroken=yes
6623                 fi
6624             fi
6625             ;;
6626         *)
6627             gccvisbroken=no
6628             ;;
6629         esac
6630     fi
6631     rm -f visibility.s visibility.cxx
6633     AC_MSG_RESULT([$gccvisbroken])
6634     if test "$gccvisbroken" = "yes"; then
6635         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6636     fi
6638     CPPFLAGS="$save_CPPFLAGS"
6640     AC_LANG_POP([C++])
6643 dnl ===================================================================
6644 dnl  Clang++ tests
6645 dnl ===================================================================
6647 HAVE_GCC_FNO_DEFAULT_INLINE=
6648 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6649 if test "$GCC" = "yes"; then
6650     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6651     AC_LANG_PUSH([C++])
6652     save_CXXFLAGS=$CXXFLAGS
6653     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6654     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6655     CXXFLAGS=$save_CXXFLAGS
6656     AC_LANG_POP([C++])
6657     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6658         AC_MSG_RESULT([yes])
6659     else
6660         AC_MSG_RESULT([no])
6661     fi
6663     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6664     AC_LANG_PUSH([C++])
6665     save_CXXFLAGS=$CXXFLAGS
6666     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6667     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6668     CXXFLAGS=$save_CXXFLAGS
6669     AC_LANG_POP([C++])
6670     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6671         AC_MSG_RESULT([yes])
6672     else
6673         AC_MSG_RESULT([no])
6674     fi
6676 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6677 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6679 dnl ===================================================================
6680 dnl Compiler plugins
6681 dnl ===================================================================
6683 COMPILER_PLUGINS=
6684 # currently only Clang
6686 if test "$COM_IS_CLANG" != "TRUE"; then
6687     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6688         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6689         enable_compiler_plugins=no
6690     fi
6693 if test "$COM_IS_CLANG" = "TRUE"; then
6694     if test -n "$enable_compiler_plugins"; then
6695         compiler_plugins="$enable_compiler_plugins"
6696     elif test -n "$ENABLE_DBGUTIL"; then
6697         compiler_plugins=test
6698     else
6699         compiler_plugins=no
6700     fi
6701     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6702         if test "$compiler_plugins" = yes; then
6703             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6704         else
6705             compiler_plugins=no
6706         fi
6707     fi
6708     if test "$compiler_plugins" != "no"; then
6709         dnl The prefix where Clang resides, override to where Clang resides if
6710         dnl using a source build:
6711         if test -z "$CLANGDIR"; then
6712             CLANGDIR=/usr
6713         fi
6714         AC_LANG_PUSH([C++])
6715         save_CPPFLAGS=$CPPFLAGS
6716         save_CXX=$CXX
6717         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6718         : "${COMPILER_PLUGINS_CXX=g++}"
6719         CXX=$COMPILER_PLUGINS_CXX
6720         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6721         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6722             [COMPILER_PLUGINS=TRUE],
6723             [
6724             if test "$compiler_plugins" = "yes"; then
6725                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6726             else
6727                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6728                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6729             fi
6730             ])
6731         CXX=$save_CXX
6732         CPPFLAGS=$save_CPPFLAGS
6733         AC_LANG_POP([C++])
6734     fi
6735 else
6736     if test "$enable_compiler_plugins" = "yes"; then
6737         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6738     fi
6740 AC_SUBST(COMPILER_PLUGINS)
6741 AC_SUBST(COMPILER_PLUGINS_CXX)
6742 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6743 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6744 AC_SUBST(CLANGDIR)
6745 AC_SUBST(CLANGLIBDIR)
6747 # Plugin to help linker.
6748 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6749 # This makes --enable-lto build with clang work.
6750 AC_SUBST(LD_PLUGIN)
6752 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6753 AC_SUBST(HAVE_POSIX_FALLOCATE)
6755 dnl ===================================================================
6756 dnl Custom build version
6757 dnl ===================================================================
6759 AC_MSG_CHECKING([whether to add custom build version])
6760 if test "$with_build_version" != ""; then
6761     BUILD_VER_STRING=$with_build_version
6762     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6763 else
6764     BUILD_VER_STRING=
6765     AC_MSG_RESULT([no])
6767 AC_SUBST(BUILD_VER_STRING)
6769 JITC_PROCESSOR_TYPE=""
6770 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6771     # IBMs JDK needs this...
6772     JITC_PROCESSOR_TYPE=6
6773     export JITC_PROCESSOR_TYPE
6775 AC_SUBST([JITC_PROCESSOR_TYPE])
6777 # Misc Windows Stuff
6778 AC_ARG_WITH(ucrt-dir,
6779     AS_HELP_STRING([--with-ucrt-dir],
6780         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6781         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6782         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6783             Windows6.1-KB2999226-x64.msu
6784             Windows6.1-KB2999226-x86.msu
6785             Windows8.1-KB2999226-x64.msu
6786             Windows8.1-KB2999226-x86.msu
6787             Windows8-RT-KB2999226-x64.msu
6788             Windows8-RT-KB2999226-x86.msu
6789         A zip archive including those files is available from Microsoft site:
6790         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6792 UCRT_REDISTDIR="$with_ucrt_dir"
6793 if test $_os = "WINNT"; then
6794     find_msvc_x64_dlls
6795     find_msms
6796     MSVC_DLL_PATH="$msvcdllpath"
6797     MSVC_DLLS="$msvcdlls"
6798     MSM_PATH="$msmdir"
6799     # MSVC 15.3 changed it to VC141
6800     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6801         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6802     else
6803         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6804     fi
6805     if test "$UCRT_REDISTDIR" = "no"; then
6806         dnl explicitly disabled
6807         UCRT_REDISTDIR=""
6808     else
6809         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6810                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6811                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6812                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6813                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6814                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6815             UCRT_REDISTDIR=""
6816             if test -n "$PKGFORMAT"; then
6817                for i in $PKGFORMAT; do
6818                    case "$i" in
6819                    msi)
6820                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6821                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6822                        ;;
6823                    esac
6824                done
6825             fi
6826         fi
6827     fi
6830 AC_SUBST(UCRT_REDISTDIR)
6831 AC_SUBST(MSVC_DLL_PATH)
6832 AC_SUBST(MSVC_DLLS)
6833 AC_SUBST(MSM_PATH)
6835 dnl ===================================================================
6836 dnl Checks for Java
6837 dnl ===================================================================
6838 if test "$ENABLE_JAVA" != ""; then
6840     # Windows-specific tests
6841     if test "$build_os" = "cygwin"; then
6842         if test "$BITNESS_OVERRIDE" = 64; then
6843             bitness=64
6844         else
6845             bitness=32
6846         fi
6848         if test -z "$with_jdk_home"; then
6849             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6850             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6851             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6852             if test -n "$regvalue"; then
6853                 ver=$regvalue
6854                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6855                 _jdk_home=$regvalue
6856             fi
6857             if test -z "$with_jdk_home"; then
6858                 for ver in 1.8 1.7 1.6; do
6859                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6860                     if test -n "$regvalue"; then
6861                         _jdk_home=$regvalue
6862                         break
6863                     fi
6864                 done
6865             fi
6866             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6867                 with_jdk_home="$_jdk_home"
6868                 howfound="found automatically"
6869             else
6870                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6871             fi
6872         else
6873             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6874             howfound="you passed"
6875         fi
6876     fi
6878     # 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.
6879     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6880     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6881         with_jdk_home=`/usr/libexec/java_home`
6882     fi
6884     JAVA_HOME=; export JAVA_HOME
6885     if test -z "$with_jdk_home"; then
6886         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6887     else
6888         _java_path="$with_jdk_home/bin/$with_java"
6889         dnl Check if there is a Java interpreter at all.
6890         if test -x "$_java_path"; then
6891             JAVAINTERPRETER=$_java_path
6892         else
6893             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6894         fi
6895     fi
6897     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6898     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6899     dnl loaded by java to run JunitTests:
6900     if test "$build_os" = "cygwin"; then
6901         shortjdkhome=`cygpath -d "$with_jdk_home"`
6902         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
6903             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6904             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6905         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
6906             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6907             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6908         fi
6910         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6911             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6912         fi
6913         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6914     elif test "$cross_compiling" != "yes"; then
6915         case $CPUNAME in
6916             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6917                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6918                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6919                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6920                 fi
6921                 ;;
6922             *) # assumption: everything else 32-bit
6923                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6924                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6925                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6926                 fi
6927                 ;;
6928         esac
6929     fi
6932 HAVE_JAVA9=
6933 dnl ===================================================================
6934 dnl Checks for JDK.
6935 dnl ===================================================================
6937 # Note that JAVA_HOME as for now always means the *build* platform's
6938 # JAVA_HOME. Whether all the complexity here actually is needed any
6939 # more or not, no idea.
6941 if test "$ENABLE_JAVA" != ""; then
6942     _gij_longver=0
6943     AC_MSG_CHECKING([the installed JDK])
6944     if test -n "$JAVAINTERPRETER"; then
6945         dnl java -version sends output to stderr!
6946         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6947             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6948         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6949             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6950         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6951             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6952         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6953             JDK=ibm
6955             dnl IBM JDK specific tests
6956             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6957             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6959             if test "$_jdk_ver" -lt 10600; then
6960                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6961             fi
6963             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6965             if test "$with_jdk_home" = ""; then
6966                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6967 you must use the "--with-jdk-home" configure option explicitly])
6968             fi
6970             JAVA_HOME=$with_jdk_home
6971         else
6972             JDK=sun
6974             dnl Sun JDK specific tests
6975             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6976             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6978             if test "$_jdk_ver" -lt 10600; then
6979                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6980             fi
6981             if test "$_jdk_ver" -gt 10600; then
6982                 JAVA_CLASSPATH_NOT_SET=TRUE
6983             fi
6984             if test "$_jdk_ver" -ge 10900; then
6985                 HAVE_JAVA9=TRUE
6986             fi
6988             AC_MSG_RESULT([checked (JDK $_jdk)])
6989             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6990             if test "$_os" = "WINNT"; then
6991                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6992             fi
6994             # set to limit VM usage for JunitTests
6995             JAVAIFLAGS=-Xmx64M
6996             # set to limit VM usage for javac
6997             JAVAFLAGS=-J-Xmx128M
6998         fi
6999     else
7000         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7001     fi
7002 else
7003     dnl Java disabled
7004     JAVA_HOME=
7005     export JAVA_HOME
7008 dnl ===================================================================
7009 dnl Set target Java bytecode version
7010 dnl ===================================================================
7011 if test "$ENABLE_JAVA" != ""; then
7012     if test "$HAVE_JAVA9" = "TRUE"; then
7013         _java_target_ver="1.6"
7014     else
7015         _java_target_ver="1.5"
7016     fi
7017     JAVA_SOURCE_VER="$_java_target_ver"
7018     JAVA_TARGET_VER="$_java_target_ver"
7021 dnl ===================================================================
7022 dnl Checks for javac
7023 dnl ===================================================================
7024 if test "$ENABLE_JAVA" != ""; then
7025     javacompiler="javac"
7026     if test -z "$with_jdk_home"; then
7027         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7028     else
7029         _javac_path="$with_jdk_home/bin/$javacompiler"
7030         dnl Check if there is a Java compiler at all.
7031         if test -x "$_javac_path"; then
7032             JAVACOMPILER=$_javac_path
7033         fi
7034     fi
7035     if test -z "$JAVACOMPILER"; then
7036         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7037     fi
7038     if test "$build_os" = "cygwin"; then
7039         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7040             JAVACOMPILER="${JAVACOMPILER}.exe"
7041         fi
7042         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7043     fi
7046 dnl ===================================================================
7047 dnl Checks for javadoc
7048 dnl ===================================================================
7049 if test "$ENABLE_JAVA" != ""; then
7050     if test -z "$with_jdk_home"; then
7051         AC_PATH_PROG(JAVADOC, javadoc)
7052     else
7053         _javadoc_path="$with_jdk_home/bin/javadoc"
7054         dnl Check if there is a javadoc at all.
7055         if test -x "$_javadoc_path"; then
7056             JAVADOC=$_javadoc_path
7057         else
7058             AC_PATH_PROG(JAVADOC, javadoc)
7059         fi
7060     fi
7061     if test -z "$JAVADOC"; then
7062         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7063     fi
7064     if test "$build_os" = "cygwin"; then
7065         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7066             JAVADOC="${JAVADOC}.exe"
7067         fi
7068         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7069     fi
7071     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7072     JAVADOCISGJDOC="yes"
7073     fi
7075 AC_SUBST(JAVADOCISGJDOC)
7077 if test "$ENABLE_JAVA" != ""; then
7078     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7079     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7080         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7081            # try to recover first by looking whether we have a alternatives
7082            # system as in Debian or newer SuSEs where following /usr/bin/javac
7083            # over /etc/alternatives/javac leads to the right bindir where we
7084            # just need to strip a bit away to get a valid JAVA_HOME
7085            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7086         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7087             # maybe only one level of symlink (e.g. on Mac)
7088             JAVA_HOME=$(readlink $JAVACOMPILER)
7089             if test "$(dirname $JAVA_HOME)" = "."; then
7090                 # we've got no path to trim back
7091                 JAVA_HOME=""
7092             fi
7093         else
7094             # else warn
7095             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7096             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7097             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7098             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7099         fi
7100         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7101         if test "$JAVA_HOME" != "/usr"; then
7102             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7103                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7104                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7105                 dnl Tiger already returns a JDK path..
7106                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7107             else
7108                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7109                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7110                 dnl that checks which version to run
7111                 if test -f "$JAVA_HOME"; then
7112                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7113                 fi
7114             fi
7115         fi
7116     fi
7117     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7119     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7120     if test -z "$JAVA_HOME"; then
7121         if test "x$with_jdk_home" = "x"; then
7122             cat > findhome.java <<_ACEOF
7123 [import java.io.File;
7125 class findhome
7127     public static void main(String args[])
7128     {
7129         String jrelocation = System.getProperty("java.home");
7130         File jre = new File(jrelocation);
7131         System.out.println(jre.getParent());
7132     }
7134 _ACEOF
7135             AC_MSG_CHECKING([if javac works])
7136             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7137             AC_TRY_EVAL(javac_cmd)
7138             if test $? = 0 -a -f ./findhome.class; then
7139                 AC_MSG_RESULT([javac works])
7140             else
7141                 echo "configure: javac test failed" >&5
7142                 cat findhome.java >&5
7143                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7144             fi
7145             AC_MSG_CHECKING([if gij knows its java.home])
7146             JAVA_HOME=`$JAVAINTERPRETER findhome`
7147             if test $? = 0 -a "$JAVA_HOME" != ""; then
7148                 AC_MSG_RESULT([$JAVA_HOME])
7149             else
7150                 echo "configure: java test failed" >&5
7151                 cat findhome.java >&5
7152                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7153             fi
7154             # clean-up after ourselves
7155             rm -f ./findhome.java ./findhome.class
7156         else
7157             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7158         fi
7159     fi
7161     # now check if $JAVA_HOME is really valid
7162     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7163         case "${JAVA_HOME}" in
7164             /Library/Java/JavaVirtualMachines/*)
7165                 ;;
7166             *)
7167                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7168                 ;;
7169         esac
7170         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7171             JAVA_HOME_OK="NO"
7172         fi
7173     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7174         JAVA_HOME_OK="NO"
7175     fi
7176     if test "$JAVA_HOME_OK" = "NO"; then
7177         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7178         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7179         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7180         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7181         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7182         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7183     fi
7184     PathFormat "$JAVA_HOME"
7185     JAVA_HOME="$formatted_path"
7188 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7189     "$_os" != Darwin
7190 then
7191     AC_MSG_CHECKING([for JAWT lib])
7192     if test "$_os" = WINNT; then
7193         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7194         JAWTLIB=jawt.lib
7195     else
7196         case "$host_cpu" in
7197         arm*)
7198             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7199             JAVA_ARCH=$my_java_arch
7200             ;;
7201         i*86)
7202             my_java_arch=i386
7203             ;;
7204         m68k)
7205             my_java_arch=m68k
7206             ;;
7207         powerpc)
7208             my_java_arch=ppc
7209             ;;
7210         powerpc64)
7211             my_java_arch=ppc64
7212             ;;
7213         powerpc64le)
7214             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7215             JAVA_ARCH=$my_java_arch
7216             ;;
7217         sparc64)
7218             my_java_arch=sparcv9
7219             ;;
7220         x86_64)
7221             my_java_arch=amd64
7222             ;;
7223         *)
7224             my_java_arch=$host_cpu
7225             ;;
7226         esac
7227         # This is where JDK9 puts the library
7228         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7229             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7230         else
7231             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7232         fi
7233         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7234     fi
7235     AC_MSG_RESULT([$JAWTLIB])
7237 AC_SUBST(JAWTLIB)
7239 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7240     case "$host_os" in
7242     aix*)
7243         JAVAINC="-I$JAVA_HOME/include"
7244         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7245         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7246         ;;
7248     cygwin*)
7249         JAVAINC="-I$JAVA_HOME/include/win32"
7250         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7251         ;;
7253     darwin*)
7254         if test -d "$JAVA_HOME/include/darwin"; then
7255             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7256         else
7257             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7258         fi
7259         ;;
7261     dragonfly*)
7262         JAVAINC="-I$JAVA_HOME/include"
7263         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7264         ;;
7266     freebsd*)
7267         JAVAINC="-I$JAVA_HOME/include"
7268         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7269         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7270         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7271         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7272         ;;
7274     k*bsd*-gnu*)
7275         JAVAINC="-I$JAVA_HOME/include"
7276         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7277         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7278         ;;
7280     linux-gnu*)
7281         JAVAINC="-I$JAVA_HOME/include"
7282         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7283         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7284         ;;
7286     *netbsd*)
7287         JAVAINC="-I$JAVA_HOME/include"
7288         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7289         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7290        ;;
7292     openbsd*)
7293         JAVAINC="-I$JAVA_HOME/include"
7294         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7295         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7296         ;;
7298     solaris*)
7299         JAVAINC="-I$JAVA_HOME/include"
7300         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7301         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7302         ;;
7303     esac
7305 SOLARINC="$SOLARINC $JAVAINC"
7307 AC_SUBST(JAVACOMPILER)
7308 AC_SUBST(JAVADOC)
7309 AC_SUBST(JAVAINTERPRETER)
7310 AC_SUBST(JAVAIFLAGS)
7311 AC_SUBST(JAVAFLAGS)
7312 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7313 AC_SUBST(JAVA_HOME)
7314 AC_SUBST(JAVA_SOURCE_VER)
7315 AC_SUBST(JAVA_TARGET_VER)
7316 AC_SUBST(JDK)
7319 dnl ===================================================================
7320 dnl Export file validation
7321 dnl ===================================================================
7322 AC_MSG_CHECKING([whether to enable export file validation])
7323 if test "$with_export_validation" != "no"; then
7324     if test -z "$ENABLE_JAVA"; then
7325         if test "$with_export_validation" = "yes"; then
7326             AC_MSG_ERROR([requested, but Java is disabled])
7327         else
7328             AC_MSG_RESULT([no, as Java is disabled])
7329         fi
7330     elif test "$_jdk_ver" -lt 10800; then
7331         if test "$with_export_validation" = "yes"; then
7332             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7333         else
7334             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7335         fi
7336     else
7337         AC_MSG_RESULT([yes])
7338         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7340         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7341         if test -z "$ODFVALIDATOR"; then
7342             # remember to download the ODF toolkit with validator later
7343             AC_MSG_NOTICE([no odfvalidator found, will download it])
7344             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7345             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7347             # and fetch name of odfvalidator jar name from download.lst
7348             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7349             AC_SUBST(ODFVALIDATOR_JAR)
7351             if test -z "$ODFVALIDATOR_JAR"; then
7352                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7353             fi
7354         fi
7355         if test "$build_os" = "cygwin"; then
7356             # In case of Cygwin it will be executed from Windows,
7357             # so we need to run bash and absolute path to validator
7358             # so instead of "odfvalidator" it will be
7359             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7360             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7361         else
7362             ODFVALIDATOR="sh $ODFVALIDATOR"
7363         fi
7364         AC_SUBST(ODFVALIDATOR)
7367         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7368         if test -z "$OFFICEOTRON"; then
7369             # remember to download the officeotron with validator later
7370             AC_MSG_NOTICE([no officeotron found, will download it])
7371             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7372             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7374             # and fetch name of officeotron jar name from download.lst
7375             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7376             AC_SUBST(OFFICEOTRON_JAR)
7378             if test -z "$OFFICEOTRON_JAR"; then
7379                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7380             fi
7381         else
7382             # check version of existing officeotron
7383             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7384             if test 0"$OFFICEOTRON_VER" -lt 704; then
7385                 AC_MSG_ERROR([officeotron too old])
7386             fi
7387         fi
7388         if test "$build_os" = "cygwin"; then
7389             # In case of Cygwin it will be executed from Windows,
7390             # so we need to run bash and absolute path to validator
7391             # so instead of "odfvalidator" it will be
7392             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7393             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7394         else
7395             OFFICEOTRON="sh $OFFICEOTRON"
7396         fi
7397     fi
7398     AC_SUBST(OFFICEOTRON)
7399 else
7400     AC_MSG_RESULT([no])
7403 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7404 if test "$with_bffvalidator" != "no"; then
7405     AC_DEFINE(HAVE_BFFVALIDATOR)
7407     if test "$with_export_validation" = "no"; then
7408         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7409     fi
7411     if test "$with_bffvalidator" = "yes"; then
7412         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7413     else
7414         BFFVALIDATOR="$with_bffvalidator"
7415     fi
7417     if test "$build_os" = "cygwin"; then
7418         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7419             AC_MSG_RESULT($BFFVALIDATOR)
7420         else
7421             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7422         fi
7423     elif test -n "$BFFVALIDATOR"; then
7424         # We are not in Cygwin but need to run Windows binary with wine
7425         AC_PATH_PROGS(WINE, wine)
7427         # so swap in a shell wrapper that converts paths transparently
7428         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7429         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7430         AC_SUBST(BFFVALIDATOR_EXE)
7431         AC_MSG_RESULT($BFFVALIDATOR)
7432     else
7433         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7434     fi
7435     AC_SUBST(BFFVALIDATOR)
7436 else
7437     AC_MSG_RESULT([no])
7440 dnl ===================================================================
7441 dnl Check for C preprocessor to use
7442 dnl ===================================================================
7443 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7444 if test -n "$with_idlc_cpp"; then
7445     AC_MSG_RESULT([$with_idlc_cpp])
7446     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7447 else
7448     AC_MSG_RESULT([ucpp])
7449     AC_MSG_CHECKING([which ucpp tp use])
7450     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7451         AC_MSG_RESULT([external])
7452         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7453     else
7454         AC_MSG_RESULT([internal])
7455         BUILD_TYPE="$BUILD_TYPE UCPP"
7456     fi
7458 AC_SUBST(SYSTEM_UCPP)
7460 dnl ===================================================================
7461 dnl Check for epm (not needed for Windows)
7462 dnl ===================================================================
7463 AC_MSG_CHECKING([whether to enable EPM for packing])
7464 if test "$enable_epm" = "yes"; then
7465     AC_MSG_RESULT([yes])
7466     if test "$_os" != "WINNT"; then
7467         if test $_os = Darwin; then
7468             EPM=internal
7469         elif test -n "$with_epm"; then
7470             EPM=$with_epm
7471         else
7472             AC_PATH_PROG(EPM, epm, no)
7473         fi
7474         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7475             AC_MSG_NOTICE([EPM will be built.])
7476             BUILD_TYPE="$BUILD_TYPE EPM"
7477             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7478         else
7479             # Gentoo has some epm which is something different...
7480             AC_MSG_CHECKING([whether the found epm is the right epm])
7481             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7482                 AC_MSG_RESULT([yes])
7483             else
7484                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7485             fi
7486             AC_MSG_CHECKING([epm version])
7487             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7488             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7489                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7490                 AC_MSG_RESULT([OK, >= 3.7])
7491             else
7492                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7493                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7494             fi
7495         fi
7496     fi
7498     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7499         AC_MSG_CHECKING([for rpm])
7500         for a in "$RPM" rpmbuild rpm; do
7501             $a --usage >/dev/null 2> /dev/null
7502             if test $? -eq 0; then
7503                 RPM=$a
7504                 break
7505             else
7506                 $a --version >/dev/null 2> /dev/null
7507                 if test $? -eq 0; then
7508                     RPM=$a
7509                     break
7510                 fi
7511             fi
7512         done
7513         if test -z "$RPM"; then
7514             AC_MSG_ERROR([not found])
7515         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7516             RPM_PATH=`which $RPM`
7517             AC_MSG_RESULT([$RPM_PATH])
7518             SCPDEFS="$SCPDEFS -DWITH_RPM"
7519         else
7520             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7521         fi
7522     fi
7523     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7524         AC_PATH_PROG(DPKG, dpkg, no)
7525         if test "$DPKG" = "no"; then
7526             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7527         fi
7528     fi
7529     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7530        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7531         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7532             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7533                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7534                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7535                     AC_MSG_RESULT([yes])
7536                 else
7537                     AC_MSG_RESULT([no])
7538                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7539                         _pt="rpm"
7540                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7541                         add_warning "the rpms will need to be installed with --nodeps"
7542                     else
7543                         _pt="pkg"
7544                     fi
7545                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7546                     add_warning "the ${_pt}s will not be relocatable"
7547                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7548                                  relocation will work, you need to patch your epm with the
7549                                  patch in epm/epm-3.7.patch or build with
7550                                  --with-epm=internal which will build a suitable epm])
7551                 fi
7552             fi
7553         fi
7554     fi
7555     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7556         AC_PATH_PROG(PKGMK, pkgmk, no)
7557         if test "$PKGMK" = "no"; then
7558             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7559         fi
7560     fi
7561     AC_SUBST(RPM)
7562     AC_SUBST(DPKG)
7563     AC_SUBST(PKGMK)
7564 else
7565     for i in $PKGFORMAT; do
7566         case "$i" in
7567         aix | bsd | deb | pkg | rpm | native | portable)
7568             AC_MSG_ERROR(
7569                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7570             ;;
7571         esac
7572     done
7573     AC_MSG_RESULT([no])
7574     EPM=NO
7576 AC_SUBST(EPM)
7578 ENABLE_LWP=
7579 if test "$enable_lotuswordpro" = "yes"; then
7580     ENABLE_LWP="TRUE"
7582 AC_SUBST(ENABLE_LWP)
7584 dnl ===================================================================
7585 dnl Check for building ODK
7586 dnl ===================================================================
7587 if test "$enable_odk" = no; then
7588     unset DOXYGEN
7589 else
7590     if test "$with_doxygen" = no; then
7591         AC_MSG_CHECKING([for doxygen])
7592         unset DOXYGEN
7593         AC_MSG_RESULT([no])
7594     else
7595         if test "$with_doxygen" = yes; then
7596             AC_PATH_PROG([DOXYGEN], [doxygen])
7597             if test -z "$DOXYGEN"; then
7598                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7599             fi
7600             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7601                 if ! dot -V 2>/dev/null; then
7602                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7603                 fi
7604             fi
7605         else
7606             AC_MSG_CHECKING([for doxygen])
7607             DOXYGEN=$with_doxygen
7608             AC_MSG_RESULT([$DOXYGEN])
7609         fi
7610         if test -n "$DOXYGEN"; then
7611             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7612             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7613             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7614                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7615             fi
7616         fi
7617     fi
7619 AC_SUBST([DOXYGEN])
7621 AC_MSG_CHECKING([whether to build the ODK])
7622 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7623     AC_MSG_RESULT([yes])
7625     if test "$with_java" != "no"; then
7626         AC_MSG_CHECKING([whether to build unowinreg.dll])
7627         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7628             # build on Win by default
7629             enable_build_unowinreg=yes
7630         fi
7631         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7632             AC_MSG_RESULT([no])
7633             BUILD_UNOWINREG=
7634         else
7635             AC_MSG_RESULT([yes])
7636             BUILD_UNOWINREG=TRUE
7637         fi
7638         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7639             if test -z "$with_mingw_cross_compiler"; then
7640                 dnl Guess...
7641                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7642             elif test -x "$with_mingw_cross_compiler"; then
7643                  MINGWCXX="$with_mingw_cross_compiler"
7644             else
7645                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7646             fi
7648             if test "$MINGWCXX" = "false"; then
7649                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7650             fi
7652             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7653             if test -x "$mingwstrip_test"; then
7654                 MINGWSTRIP="$mingwstrip_test"
7655             else
7656                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7657             fi
7659             if test "$MINGWSTRIP" = "false"; then
7660                 AC_MSG_ERROR(MinGW32 binutils not found.)
7661             fi
7662         fi
7663     fi
7664     BUILD_TYPE="$BUILD_TYPE ODK"
7665 else
7666     AC_MSG_RESULT([no])
7667     BUILD_UNOWINREG=
7669 AC_SUBST(BUILD_UNOWINREG)
7670 AC_SUBST(MINGWCXX)
7671 AC_SUBST(MINGWSTRIP)
7673 dnl ===================================================================
7674 dnl Check for system zlib
7675 dnl ===================================================================
7676 if test "$with_system_zlib" = "auto"; then
7677     case "$_os" in
7678     WINNT)
7679         with_system_zlib="$with_system_libs"
7680         ;;
7681     *)
7682         if test "$enable_fuzzers" != "yes"; then
7683             with_system_zlib=yes
7684         else
7685             with_system_zlib=no
7686         fi
7687         ;;
7688     esac
7691 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7692 dnl and has no pkg-config for it at least on some tinderboxes,
7693 dnl so leaving that out for now
7694 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7695 AC_MSG_CHECKING([which zlib to use])
7696 if test "$with_system_zlib" = "yes"; then
7697     AC_MSG_RESULT([external])
7698     SYSTEM_ZLIB=TRUE
7699     AC_CHECK_HEADER(zlib.h, [],
7700         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7701     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7702         [AC_MSG_ERROR(zlib not found or functional)], [])
7703 else
7704     AC_MSG_RESULT([internal])
7705     SYSTEM_ZLIB=
7706     BUILD_TYPE="$BUILD_TYPE ZLIB"
7707     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7708     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7710 AC_SUBST(ZLIB_CFLAGS)
7711 AC_SUBST(ZLIB_LIBS)
7712 AC_SUBST(SYSTEM_ZLIB)
7714 dnl ===================================================================
7715 dnl Check for system jpeg
7716 dnl ===================================================================
7717 AC_MSG_CHECKING([which libjpeg to use])
7718 if test "$with_system_jpeg" = "yes"; then
7719     AC_MSG_RESULT([external])
7720     SYSTEM_LIBJPEG=TRUE
7721     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7722         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7723     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7724         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7725 else
7726     SYSTEM_LIBJPEG=
7727     AC_MSG_RESULT([internal, libjpeg-turbo])
7728     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7729     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7730     if test "$COM" = "MSC"; then
7731         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7732     else
7733         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7734     fi
7736     case "$host_cpu" in
7737     x86_64 | amd64 | i*86 | x86 | ia32)
7738         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7739         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7740             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7741                 NASM="$LODE_HOME/opt/bin/nasm"
7742             elif test -x "/opt/lo/bin/nasm"; then
7743                 NASM="/opt/lo/bin/nasm"
7744             fi
7745         fi
7747         if test -n "$NASM"; then
7748             AC_MSG_CHECKING([for object file format of host system])
7749             case "$host_os" in
7750               cygwin* | mingw* | pw32* | interix*)
7751                 case "$host_cpu" in
7752                   x86_64)
7753                     objfmt='Win64-COFF'
7754                     ;;
7755                   *)
7756                     objfmt='Win32-COFF'
7757                     ;;
7758                 esac
7759               ;;
7760               msdosdjgpp* | go32*)
7761                 objfmt='COFF'
7762               ;;
7763               os2-emx*)                 # not tested
7764                 objfmt='MSOMF'          # obj
7765               ;;
7766               linux*coff* | linux*oldld*)
7767                 objfmt='COFF'           # ???
7768               ;;
7769               linux*aout*)
7770                 objfmt='a.out'
7771               ;;
7772               linux*)
7773                 case "$host_cpu" in
7774                   x86_64)
7775                     objfmt='ELF64'
7776                     ;;
7777                   *)
7778                     objfmt='ELF'
7779                     ;;
7780                 esac
7781               ;;
7782               kfreebsd* | freebsd* | netbsd* | openbsd*)
7783                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7784                   objfmt='BSD-a.out'
7785                 else
7786                   case "$host_cpu" in
7787                     x86_64 | amd64)
7788                       objfmt='ELF64'
7789                       ;;
7790                     *)
7791                       objfmt='ELF'
7792                       ;;
7793                   esac
7794                 fi
7795               ;;
7796               solaris* | sunos* | sysv* | sco*)
7797                 case "$host_cpu" in
7798                   x86_64)
7799                     objfmt='ELF64'
7800                     ;;
7801                   *)
7802                     objfmt='ELF'
7803                     ;;
7804                 esac
7805               ;;
7806               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7807                 case "$host_cpu" in
7808                   x86_64)
7809                     objfmt='Mach-O64'
7810                     ;;
7811                   *)
7812                     objfmt='Mach-O'
7813                     ;;
7814                 esac
7815               ;;
7816               *)
7817                 objfmt='ELF ?'
7818               ;;
7819             esac
7821             AC_MSG_RESULT([$objfmt])
7822             if test "$objfmt" = 'ELF ?'; then
7823               objfmt='ELF'
7824               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7825             fi
7827             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7828             case "$objfmt" in
7829               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7830               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7831               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7832               COFF)       NAFLAGS='-fcoff -DCOFF';;
7833               a.out)      NAFLAGS='-faout -DAOUT';;
7834               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7835               ELF)        NAFLAGS='-felf -DELF';;
7836               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7837               RDF)        NAFLAGS='-frdf -DRDF';;
7838               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7839               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7840             esac
7841             AC_MSG_RESULT([$NAFLAGS])
7843             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7844             cat > conftest.asm << EOF
7845             [%line __oline__ "configure"
7846                     section .text
7847                     global  _main,main
7848             _main:
7849             main:   xor     eax,eax
7850                     ret
7851             ]
7853             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7854             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7855               AC_MSG_RESULT(yes)
7856             else
7857               echo "configure: failed program was:" >&AC_FD_CC
7858               cat conftest.asm >&AC_FD_CC
7859               rm -rf conftest*
7860               AC_MSG_RESULT(no)
7861               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7862               NASM=""
7863             fi
7865         fi
7867         if test -z "$NASM"; then
7868 cat << _EOS
7869 ****************************************************************************
7870 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7871 To get one please:
7873 _EOS
7874             if test "$build_os" = "cygwin"; then
7875 cat << _EOS
7876 install a pre-compiled binary for Win32
7878 mkdir -p /opt/lo/bin
7879 cd /opt/lo/bin
7880 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7881 chmod +x nasm
7883 or get and install one from http://www.nasm.us/
7885 Then re-run autogen.sh
7887 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7888 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7890 _EOS
7891             else
7892 cat << _EOS
7893 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7895 _EOS
7896             fi
7897             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7898             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7899         fi
7900       ;;
7901     esac
7904 AC_SUBST(NASM)
7905 AC_SUBST(LIBJPEG_CFLAGS)
7906 AC_SUBST(LIBJPEG_LIBS)
7907 AC_SUBST(SYSTEM_LIBJPEG)
7909 dnl ===================================================================
7910 dnl Check for system clucene
7911 dnl ===================================================================
7912 dnl we should rather be using
7913 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7914 dnl but the contribs-lib check seems tricky
7915 AC_MSG_CHECKING([which clucene to use])
7916 if test "$with_system_clucene" = "yes"; then
7917     AC_MSG_RESULT([external])
7918     SYSTEM_CLUCENE=TRUE
7919     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7920     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7921     FilterLibs "${CLUCENE_LIBS}"
7922     CLUCENE_LIBS="${filteredlibs}"
7923     AC_LANG_PUSH([C++])
7924     save_CXXFLAGS=$CXXFLAGS
7925     save_CPPFLAGS=$CPPFLAGS
7926     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7927     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7928     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7929     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7930     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7931                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7932     CXXFLAGS=$save_CXXFLAGS
7933     CPPFLAGS=$save_CPPFLAGS
7934     AC_LANG_POP([C++])
7936     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7937 else
7938     AC_MSG_RESULT([internal])
7939     SYSTEM_CLUCENE=
7940     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7942 AC_SUBST(SYSTEM_CLUCENE)
7943 AC_SUBST(CLUCENE_CFLAGS)
7944 AC_SUBST(CLUCENE_LIBS)
7946 dnl ===================================================================
7947 dnl Check for system expat
7948 dnl ===================================================================
7949 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7951 dnl ===================================================================
7952 dnl Check for system xmlsec
7953 dnl ===================================================================
7954 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7956 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7957 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7958     ENABLE_EOT="TRUE"
7959     AC_DEFINE([ENABLE_EOT])
7960     AC_MSG_RESULT([yes])
7962     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7963 else
7964     ENABLE_EOT=
7965     AC_MSG_RESULT([no])
7967 AC_SUBST([ENABLE_EOT])
7969 dnl ===================================================================
7970 dnl Check for DLP libs
7971 dnl ===================================================================
7972 AS_IF([test "$COM" = "MSC"],
7973       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7974       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7976 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7978 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7980 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7982 AS_IF([test "$COM" = "MSC"],
7983       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7984       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7986 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7988 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7990 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7991 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
7993 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7995 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7997 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7999 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8000 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8002 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8003 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8005 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8007 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8008 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8010 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8012 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8014 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8016 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8018 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8019 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8021 dnl ===================================================================
8022 dnl Check for system lcms2
8023 dnl ===================================================================
8024 if test "$with_system_lcms2" != "yes"; then
8025     SYSTEM_LCMS2=
8027 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8028 if test "$GCC" = "yes"; then
8029     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8031 if test "$COM" = "MSC"; then # override the above
8032     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8035 dnl ===================================================================
8036 dnl Check for system cppunit
8037 dnl ===================================================================
8038 if test "$_os" != "Android" ; then
8039     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8042 dnl ===================================================================
8043 dnl Check whether freetype is available
8044 dnl ===================================================================
8045 if test  "$test_freetype" = "yes"; then
8046     AC_MSG_CHECKING([whether freetype is available])
8047     # FreeType has 3 different kinds of versions
8048     # * release, like 2.4.10
8049     # * libtool, like 13.0.7 (this what pkg-config returns)
8050     # * soname
8051     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8052     #
8053     # 9.9.3 is 2.2.0
8054     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8055     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8056     FilterLibs "${FREETYPE_LIBS}"
8057     FREETYPE_LIBS="${filteredlibs}"
8058     SYSTEM_FREETYPE=TRUE
8059 else
8060     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8061     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8063 AC_SUBST(FREETYPE_CFLAGS)
8064 AC_SUBST(FREETYPE_LIBS)
8065 AC_SUBST([SYSTEM_FREETYPE])
8067 # ===================================================================
8068 # Check for system libxslt
8069 # to prevent incompatibilities between internal libxml2 and external libxslt,
8070 # or vice versa, use with_system_libxml here
8071 # ===================================================================
8072 if test "$with_system_libxml" = "auto"; then
8073     case "$_os" in
8074     WINNT|iOS|Android)
8075         with_system_libxml="$with_system_libs"
8076         ;;
8077     *)
8078         if test "$enable_fuzzers" != "yes"; then
8079             with_system_libxml=yes
8080         else
8081             with_system_libxml=no
8082         fi
8083         ;;
8084     esac
8087 AC_MSG_CHECKING([which libxslt to use])
8088 if test "$with_system_libxml" = "yes"; then
8089     AC_MSG_RESULT([external])
8090     SYSTEM_LIBXSLT=TRUE
8091     if test "$_os" = "Darwin"; then
8092         dnl make sure to use SDK path
8093         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8094         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8095         dnl omit -L/usr/lib
8096         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8097         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8098     else
8099         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8100         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8101         FilterLibs "${LIBXSLT_LIBS}"
8102         LIBXSLT_LIBS="${filteredlibs}"
8103         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8104         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8105         FilterLibs "${LIBEXSLT_LIBS}"
8106         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8107     fi
8109     dnl Check for xsltproc
8110     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8111     if test "$XSLTPROC" = "no"; then
8112         AC_MSG_ERROR([xsltproc is required])
8113     fi
8114 else
8115     AC_MSG_RESULT([internal])
8116     SYSTEM_LIBXSLT=
8117     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8119     if test "$cross_compiling" = "yes"; then
8120         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8121         if test "$XSLTPROC" = "no"; then
8122             AC_MSG_ERROR([xsltproc is required])
8123         fi
8124     fi
8126 AC_SUBST(SYSTEM_LIBXSLT)
8127 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8128     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8130 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8132 AC_SUBST(LIBEXSLT_CFLAGS)
8133 AC_SUBST(LIBEXSLT_LIBS)
8134 AC_SUBST(LIBXSLT_CFLAGS)
8135 AC_SUBST(LIBXSLT_LIBS)
8136 AC_SUBST(XSLTPROC)
8138 # ===================================================================
8139 # Check for system libxml
8140 # ===================================================================
8141 AC_MSG_CHECKING([which libxml to use])
8142 if test "$with_system_libxml" = "yes"; then
8143     AC_MSG_RESULT([external])
8144     SYSTEM_LIBXML=TRUE
8145     if test "$_os" = "Darwin"; then
8146         dnl make sure to use SDK path
8147         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8148         dnl omit -L/usr/lib
8149         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8150     elif test $_os = iOS; then
8151         dnl make sure to use SDK path
8152         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8153         LIBXML_CFLAGS="-I$usr/include/libxml2"
8154         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8155     else
8156         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8157         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8158         FilterLibs "${LIBXML_LIBS}"
8159         LIBXML_LIBS="${filteredlibs}"
8160     fi
8162     dnl Check for xmllint
8163     AC_PATH_PROG(XMLLINT, xmllint, no)
8164     if test "$XMLLINT" = "no"; then
8165         AC_MSG_ERROR([xmllint is required])
8166     fi
8167 else
8168     AC_MSG_RESULT([internal])
8169     SYSTEM_LIBXML=
8170     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8171     if test "$COM" = "MSC"; then
8172         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8173     fi
8174     if test "$COM" = "MSC"; then
8175         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8176     else
8177         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8178     fi
8179     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8181 AC_SUBST(SYSTEM_LIBXML)
8182 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8183     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8185 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8186 AC_SUBST(LIBXML_CFLAGS)
8187 AC_SUBST(LIBXML_LIBS)
8188 AC_SUBST(XMLLINT)
8190 # =====================================================================
8191 # Checking for a Python interpreter with version >= 2.7.
8192 # Build and runtime requires Python 3 compatible version (>= 2.7).
8193 # Optionally user can pass an option to configure, i. e.
8194 # ./configure PYTHON=/usr/bin/python
8195 # =====================================================================
8196 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8197     # This allows a lack of system python with no error, we use internal one in that case.
8198     AM_PATH_PYTHON([2.7],, [:])
8199     # Clean PYTHON_VERSION checked below if cross-compiling
8200     PYTHON_VERSION=""
8201     if test "$PYTHON" != ":"; then
8202         PYTHON_FOR_BUILD=$PYTHON
8203     fi
8205 AC_SUBST(PYTHON_FOR_BUILD)
8207 # Checks for Python to use for Pyuno
8208 AC_MSG_CHECKING([which Python to use for Pyuno])
8209 case "$enable_python" in
8210 no|disable)
8211     if test -z $PYTHON_FOR_BUILD; then
8212         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8213         # requirement from the choice whether to include Python stuff in the installer, but why
8214         # bother?
8215         AC_MSG_ERROR([Python is required at build time.])
8216     fi
8217     enable_python=no
8218     AC_MSG_RESULT([none])
8219     ;;
8220 ""|yes|auto)
8221     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8222         AC_MSG_RESULT([no, overridden by --disable-scripting])
8223         enable_python=no
8224     elif test $build_os = cygwin; then
8225         dnl When building on Windows we don't attempt to use any installed
8226         dnl "system"  Python.
8227         AC_MSG_RESULT([fully internal])
8228         enable_python=internal
8229     elif test "$cross_compiling" = yes; then
8230         AC_MSG_RESULT([system])
8231         enable_python=system
8232     else
8233         # Unset variables set by the above AM_PATH_PYTHON so that
8234         # we actually do check anew.
8235         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
8236         AM_PATH_PYTHON([3.3],, [:])
8237         if test "$PYTHON" = ":"; then
8238             if test -z "$PYTHON_FOR_BUILD"; then
8239                 AC_MSG_RESULT([fully internal])
8240             else
8241                 AC_MSG_RESULT([internal])
8242             fi
8243             enable_python=internal
8244         else
8245             AC_MSG_RESULT([system])
8246             enable_python=system
8247         fi
8248     fi
8249     ;;
8250 internal)
8251     AC_MSG_RESULT([internal])
8252     ;;
8253 fully-internal)
8254     AC_MSG_RESULT([fully internal])
8255     enable_python=internal
8256     ;;
8257 system)
8258     AC_MSG_RESULT([system])
8259     ;;
8261     AC_MSG_ERROR([Incorrect --enable-python option])
8262     ;;
8263 esac
8265 if test $enable_python != no; then
8266     BUILD_TYPE="$BUILD_TYPE PYUNO"
8269 if test $enable_python = system; then
8270     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8271         python_version=2.7
8272         PYTHON=python$python_version
8273         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8274             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8275             PYTHON_LIBS="-framework Python"
8276         else
8277             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8278             PYTHON_LIBS="`$PYTHON-config --libs`"
8279         fi
8280     fi
8281     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8282         # Fallback: Accept these in the environment, or as set above
8283         # for MacOSX.
8284         :
8285     elif test "$cross_compiling" != yes; then
8286         # Unset variables set by the above AM_PATH_PYTHON so that
8287         # we actually do check anew.
8288         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
8289         # This causes an error if no python command is found
8290         AM_PATH_PYTHON([3.3])
8291         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8292         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8293         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8294         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8295         if test -z "$PKG_CONFIG"; then
8296             PYTHON_CFLAGS="-I$python_include"
8297             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8298         elif $PKG_CONFIG --exists python-$python_version; then
8299             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8300             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8301         else
8302             PYTHON_CFLAGS="-I$python_include"
8303             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8304         fi
8305         FilterLibs "${PYTHON_LIBS}"
8306         PYTHON_LIBS="${filteredlibs}"
8307     else
8308         dnl How to find out the cross-compilation Python installation path?
8309         AC_MSG_CHECKING([for python version])
8310         AS_IF([test -n "$PYTHON_VERSION"],
8311               [AC_MSG_RESULT([$PYTHON_VERSION])],
8312               [AC_MSG_RESULT([not found])
8313                AC_MSG_ERROR([no usable python found])])
8314         test -n "$PYTHON_CFLAGS" && break
8315     fi
8317     dnl Check if the headers really work
8318     save_CPPFLAGS="$CPPFLAGS"
8319     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8320     AC_CHECK_HEADER(Python.h)
8321     CPPFLAGS="$save_CPPFLAGS"
8323     # let the PYTHON_FOR_BUILD match the same python installation that
8324     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8325     # better for PythonTests.
8326     PYTHON_FOR_BUILD=$PYTHON
8329 if test "$with_lxml" != no; then
8330     if test -z "$PYTHON_FOR_BUILD"; then
8331         case $build_os in
8332             cygwin)
8333                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8334                 ;;
8335             *)
8336                 if test "$cross_compiling" != yes ; then
8337                     BUILD_TYPE="$BUILD_TYPE LXML"
8338                 fi
8339                 ;;
8340         esac
8341     else
8342         AC_MSG_CHECKING([for python lxml])
8343         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8344             AC_MSG_RESULT([yes])
8345         else
8346             case $build_os in
8347                 cygwin)
8348                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8349                     ;;
8350                 *)
8351                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8352                         BUILD_TYPE="$BUILD_TYPE LXML"
8353                         AC_MSG_RESULT([no, using internal lxml])
8354                     else
8355                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8356                     fi
8357                     ;;
8358             esac
8359         fi
8360     fi
8363 dnl By now enable_python should be "system", "internal" or "no"
8364 case $enable_python in
8365 system)
8366     SYSTEM_PYTHON=TRUE
8368     if test "x$ac_cv_header_Python_h" != "xyes"; then
8369        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8370     fi
8372     AC_LANG_PUSH(C)
8373     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8374     AC_MSG_CHECKING([for correct python library version])
8375        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8376 #include <Python.h>
8378 int main(int argc, char **argv) {
8379    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8380        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8381    else return 1;
8383        ]])],[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])])
8384     CFLAGS=$save_CFLAGS
8385     AC_LANG_POP(C)
8387     dnl FIXME Check if the Python library can be linked with, too?
8388     ;;
8390 internal)
8391     SYSTEM_PYTHON=
8392     PYTHON_VERSION_MAJOR=3
8393     PYTHON_VERSION_MINOR=5
8394     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8395     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8396         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8397     fi
8398     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8399     BUILD_TYPE="$BUILD_TYPE PYTHON"
8400     # Embedded Python dies without Home set
8401     if test "$HOME" = ""; then
8402         export HOME=""
8403     fi
8404     ;;
8406     DISABLE_PYTHON=TRUE
8407     SYSTEM_PYTHON=
8408     ;;
8410     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8411     ;;
8412 esac
8414 AC_SUBST(DISABLE_PYTHON)
8415 AC_SUBST(SYSTEM_PYTHON)
8416 AC_SUBST(PYTHON_CFLAGS)
8417 AC_SUBST(PYTHON_LIBS)
8418 AC_SUBST(PYTHON_VERSION)
8419 AC_SUBST(PYTHON_VERSION_MAJOR)
8420 AC_SUBST(PYTHON_VERSION_MINOR)
8422 ENABLE_MARIADBC=TRUE
8423 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8424     ENABLE_MARIADBC=
8426 MARIADBC_MAJOR=1
8427 MARIADBC_MINOR=0
8428 MARIADBC_MICRO=2
8429 if test "$ENABLE_MARIADBC" = "TRUE"; then
8430     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8433 AC_SUBST(ENABLE_MARIADBC)
8434 AC_SUBST(MARIADBC_MAJOR)
8435 AC_SUBST(MARIADBC_MINOR)
8436 AC_SUBST(MARIADBC_MICRO)
8438 if test "$ENABLE_MARIADBC" = "TRUE"; then
8439     dnl ===================================================================
8440     dnl Check for system MariaDB
8441     dnl ===================================================================
8442     AC_MSG_CHECKING([which MariaDB to use])
8443     if test "$with_system_mariadb" = "yes"; then
8444         AC_MSG_RESULT([external])
8445         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8446         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8447         if test -z "$MARIADBCONFIG"; then
8448             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8449             if test -z "$MARIADBCONFIG"; then
8450                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8451                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8452             fi
8453         fi
8454         AC_MSG_CHECKING([MariaDB version])
8455         MARIADB_VERSION=`$MARIADBCONFIG --version`
8456         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8457         if test "$MARIADB_MAJOR" -ge "5"; then
8458             AC_MSG_RESULT([OK])
8459         else
8460             AC_MSG_ERROR([too old, use 5.0.x or later])
8461         fi
8462         AC_MSG_CHECKING([for MariaDB Client library])
8463         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8464         if test "$COM_IS_CLANG" = TRUE; then
8465             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8466         fi
8467         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8468         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8469         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8470         dnl linux32:
8471         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8472             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8473             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8474                 | sed -e 's|/lib64/|/lib/|')
8475         fi
8476         FilterLibs "${MARIADB_LIBS}"
8477         MARIADB_LIBS="${filteredlibs}"
8478         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8479         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8480         if test "$enable_bundle_mariadb" = "yes"; then
8481             AC_MSG_RESULT([yes])
8482             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8483             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8485 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8487 /g' | grep -E '(mysqlclient|mariadb)')
8488             if test "$_os" = "Darwin"; then
8489                 LIBMARIADB=${LIBMARIADB}.dylib
8490             elif test "$_os" = "WINNT"; then
8491                 LIBMARIADB=${LIBMARIADB}.dll
8492             else
8493                 LIBMARIADB=${LIBMARIADB}.so
8494             fi
8495             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8496             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8497             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8498                 AC_MSG_RESULT([found.])
8499                 PathFormat "$LIBMARIADB_PATH"
8500                 LIBMARIADB_PATH="$formatted_path"
8501             else
8502                 AC_MSG_ERROR([not found.])
8503             fi
8504         else
8505             AC_MSG_RESULT([no])
8506             BUNDLE_MARIADB_CONNECTOR_C=
8507         fi
8508     else
8509         AC_MSG_RESULT([internal])
8510         SYSTEM_MARIADB_CONNECTOR_C=
8511         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8512         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8513         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8514     fi
8516     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8517     AC_SUBST(MARIADB_CFLAGS)
8518     AC_SUBST(MARIADB_LIBS)
8519     AC_SUBST(LIBMARIADB)
8520     AC_SUBST(LIBMARIADB_PATH)
8521     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8524 dnl ===================================================================
8525 dnl Check for system hsqldb
8526 dnl ===================================================================
8527 if test "$with_java" != "no"; then
8528     HSQLDB_USE_JDBC_4_1=
8529     AC_MSG_CHECKING([which hsqldb to use])
8530     if test "$with_system_hsqldb" = "yes"; then
8531         AC_MSG_RESULT([external])
8532         SYSTEM_HSQLDB=TRUE
8533         if test -z $HSQLDB_JAR; then
8534             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8535         fi
8536         if ! test -f $HSQLDB_JAR; then
8537                AC_MSG_ERROR(hsqldb.jar not found.)
8538         fi
8539         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8540         export HSQLDB_JAR
8541         if $PERL -e \
8542            'use Archive::Zip;
8543             my $file = "$ENV{'HSQLDB_JAR'}";
8544             my $zip = Archive::Zip->new( $file );
8545             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8546             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8547             {
8548                 push @l, split(/\n/, $mf);
8549                 foreach my $line (@l)
8550                 {
8551                     if ($line =~ m/Specification-Version:/)
8552                     {
8553                         ($t, $version) = split (/:/,$line);
8554                         $version =~ s/^\s//;
8555                         ($a, $b, $c, $d) = split (/\./,$version);
8556                         if ($c == "0" && $d > "8")
8557                         {
8558                             exit 0;
8559                         }
8560                         else
8561                         {
8562                             exit 1;
8563                         }
8564                     }
8565                 }
8566             }
8567             else
8568             {
8569                 exit 1;
8570             }'; then
8571             AC_MSG_RESULT([yes])
8572         else
8573             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8574         fi
8575     else
8576         AC_MSG_RESULT([internal])
8577         SYSTEM_HSQLDB=
8578         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8579         NEED_ANT=TRUE
8580         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8581         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8582         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8583             AC_MSG_RESULT([yes])
8584             HSQLDB_USE_JDBC_4_1=TRUE
8585         else
8586             AC_MSG_RESULT([no])
8587         fi
8588     fi
8589     AC_SUBST(SYSTEM_HSQLDB)
8590     AC_SUBST(HSQLDB_JAR)
8591     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8594 dnl ===================================================================
8595 dnl Check for PostgreSQL stuff
8596 dnl ===================================================================
8597 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8598 if test "x$enable_postgresql_sdbc" != "xno"; then
8599     AC_MSG_RESULT([yes])
8600     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8602     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8603         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8604     fi
8605     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8606         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8607     fi
8609     postgres_interface=""
8610     if test "$with_system_postgresql" = "yes"; then
8611         postgres_interface="external PostgreSQL"
8612         SYSTEM_POSTGRESQL=TRUE
8613         if test "$_os" = Darwin; then
8614             supp_path=''
8615             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8616                 pg_supp_path="$P_SEP$d$pg_supp_path"
8617             done
8618         fi
8619         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8620         if test -z "$PGCONFIG"; then
8621             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8622         fi
8623         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8624         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8625         FilterLibs "${POSTGRESQL_LIB}"
8626         POSTGRESQL_LIB="${filteredlibs}"
8627     else
8628         # if/when anything else than PostgreSQL uses Kerberos,
8629         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8630         WITH_KRB5=
8631         WITH_GSSAPI=
8632         case "$_os" in
8633         Darwin)
8634             # MacOS X has system MIT Kerberos 5 since 10.4
8635             if test "$with_krb5" != "no"; then
8636                 WITH_KRB5=TRUE
8637                 save_LIBS=$LIBS
8638                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8639                 # that the libraries where these functions are located on macOS will change, is it?
8640                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8641                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8642                 KRB5_LIBS=$LIBS
8643                 LIBS=$save_LIBS
8644                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8645                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8646                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8647                 LIBS=$save_LIBS
8648             fi
8649             if test "$with_gssapi" != "no"; then
8650                 WITH_GSSAPI=TRUE
8651                 save_LIBS=$LIBS
8652                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8653                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8654                 GSSAPI_LIBS=$LIBS
8655                 LIBS=$save_LIBS
8656             fi
8657             ;;
8658         WINNT)
8659             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8660                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8661             fi
8662             ;;
8663         Linux|GNU|*BSD|DragonFly)
8664             if test "$with_krb5" != "no"; then
8665                 WITH_KRB5=TRUE
8666                 save_LIBS=$LIBS
8667                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8668                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8669                 KRB5_LIBS=$LIBS
8670                 LIBS=$save_LIBS
8671                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8672                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8673                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8674                 LIBS=$save_LIBS
8675             fi
8676             if test "$with_gssapi" != "no"; then
8677                 WITH_GSSAPI=TRUE
8678                 save_LIBS=$LIBS
8679                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8680                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8681                 GSSAPI_LIBS=$LIBS
8682                 LIBS=$save_LIBS
8683             fi
8684             ;;
8685         *)
8686             if test "$with_krb5" = "yes"; then
8687                 WITH_KRB5=TRUE
8688                 save_LIBS=$LIBS
8689                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8690                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8691                 KRB5_LIBS=$LIBS
8692                 LIBS=$save_LIBS
8693                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8694                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8695                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8696                 LIBS=$save_LIBS
8697             fi
8698             if test "$with_gssapi" = "yes"; then
8699                 WITH_GSSAPI=TRUE
8700                 save_LIBS=$LIBS
8701                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8702                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8703                 LIBS=$save_LIBS
8704                 GSSAPI_LIBS=$LIBS
8705             fi
8706         esac
8708         if test -n "$with_libpq_path"; then
8709             SYSTEM_POSTGRESQL=TRUE
8710             postgres_interface="external libpq"
8711             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8712             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8713         else
8714             SYSTEM_POSTGRESQL=
8715             postgres_interface="internal"
8716             POSTGRESQL_LIB=""
8717             POSTGRESQL_INC="%OVERRIDE_ME%"
8718             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8719         fi
8720     fi
8722     AC_MSG_CHECKING([PostgreSQL C interface])
8723     AC_MSG_RESULT([$postgres_interface])
8725     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8726         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8727         save_CFLAGS=$CFLAGS
8728         save_CPPFLAGS=$CPPFLAGS
8729         save_LIBS=$LIBS
8730         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8731         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8732         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8733         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8734             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8735         CFLAGS=$save_CFLAGS
8736         CPPFLAGS=$save_CPPFLAGS
8737         LIBS=$save_LIBS
8738     fi
8739     BUILD_POSTGRESQL_SDBC=TRUE
8740 else
8741     AC_MSG_RESULT([no])
8743 AC_SUBST(WITH_KRB5)
8744 AC_SUBST(WITH_GSSAPI)
8745 AC_SUBST(GSSAPI_LIBS)
8746 AC_SUBST(KRB5_LIBS)
8747 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8748 AC_SUBST(SYSTEM_POSTGRESQL)
8749 AC_SUBST(POSTGRESQL_INC)
8750 AC_SUBST(POSTGRESQL_LIB)
8752 dnl ===================================================================
8753 dnl Check for Firebird stuff
8754 dnl ===================================================================
8755 ENABLE_FIREBIRD_SDBC=""
8756 if test "$enable_firebird_sdbc" = "yes" ; then
8757     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8759     dnl ===================================================================
8760     dnl Check for system Firebird
8761     dnl ===================================================================
8762     AC_MSG_CHECKING([which Firebird to use])
8763     if test "$with_system_firebird" = "yes"; then
8764         AC_MSG_RESULT([external])
8765         SYSTEM_FIREBIRD=TRUE
8766         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8767         if test -z "$FIREBIRDCONFIG"; then
8768             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8769             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8770                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8771             ])
8772             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8773         else
8774             AC_MSG_NOTICE([fb_config found])
8775             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8776             AC_MSG_CHECKING([for Firebird Client library])
8777             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8778             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8779             FilterLibs "${FIREBIRD_LIBS}"
8780             FIREBIRD_LIBS="${filteredlibs}"
8781         fi
8782         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8783         AC_MSG_CHECKING([Firebird version])
8784         if test -n "${FIREBIRD_VERSION}"; then
8785             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8786             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8787             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8788                 AC_MSG_RESULT([OK])
8789             else
8790                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8791             fi
8792         else
8793             __save_CFLAGS="${CFLAGS}"
8794             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8795             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8796 #if defined(FB_API_VER) && FB_API_VER == 30
8797 int fb_api_is_30(void) { return 0; }
8798 #else
8799 #error "Wrong Firebird API version"
8800 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8801             CFLAGS="${__save_CFLAGS}"
8802         fi
8803         ENABLE_FIREBIRD_SDBC="TRUE"
8804     elif test "$enable_database_connectivity" != yes; then
8805         AC_MSG_RESULT([none])
8806     elif test "$cross_compiling" = "yes"; then
8807         AC_MSG_RESULT([none])
8808     else
8809         dnl Embedded Firebird has version 3.0
8810         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8811         dnl We need libatomic-ops for any non X86/X64 system
8812         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8813             dnl ===================================================================
8814             dnl Check for system libatomic-ops
8815             dnl ===================================================================
8816             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8817             if test "$with_system_libatomic_ops" = "yes"; then
8818                 SYSTEM_LIBATOMIC_OPS=TRUE
8819                 AC_CHECK_HEADERS(atomic_ops.h, [],
8820                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8821             else
8822                 SYSTEM_LIBATOMIC_OPS=
8823                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8824                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8825                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8826             fi
8827         fi
8829         AC_MSG_RESULT([internal])
8830         SYSTEM_FIREBIRD=
8831         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8832         FIREBIRD_LIBS="-lfbclient"
8834         if test "$with_system_libtommath" = "yes"; then
8835             SYSTEM_LIBTOMMATH=TRUE
8836             dnl check for tommath presence
8837             save_LIBS=$LIBS
8838             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8839             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8840             LIBS=$save_LIBS
8841         else
8842             SYSTEM_LIBTOMMATH=
8843             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8844             LIBTOMMATH_LIBS="-ltommath"
8845             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8846         fi
8848         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8849         ENABLE_FIREBIRD_SDBC="TRUE"
8850         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8851     fi
8853 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8854 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8855 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8856 AC_SUBST(LIBATOMIC_OPS_LIBS)
8857 AC_SUBST(SYSTEM_FIREBIRD)
8858 AC_SUBST(FIREBIRD_CFLAGS)
8859 AC_SUBST(FIREBIRD_LIBS)
8860 AC_SUBST([TOMMATH_CFLAGS])
8861 AC_SUBST([TOMMATH_LIBS])
8863 dnl ===================================================================
8864 dnl Check for system curl
8865 dnl ===================================================================
8866 AC_MSG_CHECKING([which libcurl to use])
8867 if test "$with_system_curl" = "auto"; then
8868     with_system_curl="$with_system_libs"
8871 if test "$with_system_curl" = "yes"; then
8872     AC_MSG_RESULT([external])
8873     SYSTEM_CURL=TRUE
8875     # First try PKGCONFIG and then fall back
8876     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8878     if test -n "$CURL_PKG_ERRORS"; then
8879         AC_PATH_PROG(CURLCONFIG, curl-config)
8880         if test -z "$CURLCONFIG"; then
8881             AC_MSG_ERROR([curl development files not found])
8882         fi
8883         CURL_LIBS=`$CURLCONFIG --libs`
8884         FilterLibs "${CURL_LIBS}"
8885         CURL_LIBS="${filteredlibs}"
8886         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8887         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8889         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8890         case $curl_version in
8891         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8892         dnl so they need to be doubled to end up in the configure script
8893         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8894             AC_MSG_RESULT([yes])
8895             ;;
8896         *)
8897             AC_MSG_ERROR([no, you have $curl_version])
8898             ;;
8899         esac
8900     fi
8902     ENABLE_CURL=TRUE
8903 elif test $_os = iOS; then
8904     # Let's see if we need curl, I think not?
8905     AC_MSG_RESULT([none])
8906     ENABLE_CURL=
8907 else
8908     AC_MSG_RESULT([internal])
8909     SYSTEM_CURL=
8910     BUILD_TYPE="$BUILD_TYPE CURL"
8911     ENABLE_CURL=TRUE
8913 AC_SUBST(SYSTEM_CURL)
8914 AC_SUBST(CURL_CFLAGS)
8915 AC_SUBST(CURL_LIBS)
8916 AC_SUBST(ENABLE_CURL)
8918 dnl ===================================================================
8919 dnl Check for system boost
8920 dnl ===================================================================
8921 AC_MSG_CHECKING([which boost to use])
8922 if test "$with_system_boost" = "yes"; then
8923     AC_MSG_RESULT([external])
8924     SYSTEM_BOOST=TRUE
8925     AX_BOOST_BASE(1.47)
8926     AX_BOOST_DATE_TIME
8927     AX_BOOST_FILESYSTEM
8928     AX_BOOST_IOSTREAMS
8929     AX_BOOST_LOCALE
8930     AC_LANG_PUSH([C++])
8931     save_CXXFLAGS=$CXXFLAGS
8932     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8933     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8934        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8935     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8936        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8937     CXXFLAGS=$save_CXXFLAGS
8938     AC_LANG_POP([C++])
8939     # this is in m4/ax_boost_base.m4
8940     FilterLibs "${BOOST_LDFLAGS}"
8941     BOOST_LDFLAGS="${filteredlibs}"
8942 else
8943     AC_MSG_RESULT([internal])
8944     BUILD_TYPE="$BUILD_TYPE BOOST"
8945     SYSTEM_BOOST=
8946     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8947         # use warning-suppressing wrapper headers
8948         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8949     else
8950         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8951     fi
8953 AC_SUBST(SYSTEM_BOOST)
8955 dnl ===================================================================
8956 dnl Check for system mdds
8957 dnl ===================================================================
8958 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8960 dnl ===================================================================
8961 dnl Check for system glm
8962 dnl ===================================================================
8963 AC_MSG_CHECKING([which glm to use])
8964 if test "$with_system_glm" = "yes"; then
8965     AC_MSG_RESULT([external])
8966     SYSTEM_GLM=TRUE
8967     AC_LANG_PUSH([C++])
8968     AC_CHECK_HEADER([glm/glm.hpp], [],
8969        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8970     AC_LANG_POP([C++])
8971 else
8972     AC_MSG_RESULT([internal])
8973     BUILD_TYPE="$BUILD_TYPE GLM"
8974     SYSTEM_GLM=
8975     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8977 AC_SUBST([GLM_CFLAGS])
8978 AC_SUBST([SYSTEM_GLM])
8980 dnl ===================================================================
8981 dnl Check for system odbc
8982 dnl ===================================================================
8983 AC_MSG_CHECKING([which odbc headers to use])
8984 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
8985     AC_MSG_RESULT([external])
8986     SYSTEM_ODBC_HEADERS=TRUE
8988     if test "$build_os" = "cygwin"; then
8989         save_CPPFLAGS=$CPPFLAGS
8990         find_winsdk
8991         PathFormat "$winsdktest"
8992         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"
8993         AC_CHECK_HEADER(sqlext.h, [],
8994             [AC_MSG_ERROR(odbc not found. install odbc)],
8995             [#include <windows.h>])
8996         CPPFLAGS=$save_CPPFLAGS
8997     else
8998         AC_CHECK_HEADER(sqlext.h, [],
8999             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9000     fi
9001 elif test "$enable_database_connectivity" != yes; then
9002     AC_MSG_RESULT([none])
9003 else
9004     AC_MSG_RESULT([internal])
9005     SYSTEM_ODBC_HEADERS=
9007 AC_SUBST(SYSTEM_ODBC_HEADERS)
9010 dnl ===================================================================
9011 dnl Check for system openldap
9012 dnl ===================================================================
9014 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9015 AC_MSG_CHECKING([which openldap library to use])
9016 if test "$with_system_openldap" = "yes"; then
9017     AC_MSG_RESULT([external])
9018     SYSTEM_OPENLDAP=TRUE
9019     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9020     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9021     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9022 else
9023     AC_MSG_RESULT([internal])
9024     SYSTEM_OPENLDAP=
9025     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9028 AC_SUBST(SYSTEM_OPENLDAP)
9030 dnl ===================================================================
9031 dnl Check for system NSS
9032 dnl ===================================================================
9033 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9034     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9035     AC_DEFINE(HAVE_FEATURE_NSS)
9036     ENABLE_NSS="TRUE"
9037     AC_DEFINE(ENABLE_NSS)
9038 elif test $_os != iOS ; then
9039     with_tls=openssl
9041 AC_SUBST(ENABLE_NSS)
9043 dnl ===================================================================
9044 dnl Check for TLS/SSL and cryptographic implementation to use
9045 dnl ===================================================================
9046 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9047 if test -n "$with_tls"; then
9048     case $with_tls in
9049     openssl)
9050         AC_DEFINE(USE_TLS_OPENSSL)
9051         TLS=OPENSSL
9053         if test "$enable_openssl" != "yes"; then
9054             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9055         fi
9057         # warn that OpenSSL has been selected but not all TLS code has this option
9058         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9059         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9060         ;;
9061     nss)
9062         AC_DEFINE(USE_TLS_NSS)
9063         TLS=NSS
9064         ;;
9065     no)
9066         AC_MSG_WARN([Skipping TLS/SSL])
9067         ;;
9068     *)
9069         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9070 openssl - OpenSSL
9071 nss - Mozilla's Network Security Services (NSS)
9072     ])
9073         ;;
9074     esac
9075 else
9076     # default to using NSS, it results in smaller oox lib
9077     AC_DEFINE(USE_TLS_NSS)
9078     TLS=NSS
9080 AC_MSG_RESULT([$TLS])
9081 AC_SUBST(TLS)
9083 dnl ===================================================================
9084 dnl Check for system sane
9085 dnl ===================================================================
9086 AC_MSG_CHECKING([which sane header to use])
9087 if test "$with_system_sane" = "yes"; then
9088     AC_MSG_RESULT([external])
9089     AC_CHECK_HEADER(sane/sane.h, [],
9090       [AC_MSG_ERROR(sane not found. install sane)], [])
9091 else
9092     AC_MSG_RESULT([internal])
9093     BUILD_TYPE="$BUILD_TYPE SANE"
9096 dnl ===================================================================
9097 dnl Check for system icu
9098 dnl ===================================================================
9099 SYSTEM_GENBRK=
9100 SYSTEM_GENCCODE=
9101 SYSTEM_GENCMN=
9103 ICU_MAJOR=62
9104 ICU_MINOR=1
9105 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9106 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9107 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9108 AC_MSG_CHECKING([which icu to use])
9109 if test "$with_system_icu" = "yes"; then
9110     AC_MSG_RESULT([external])
9111     SYSTEM_ICU=TRUE
9112     AC_LANG_PUSH([C++])
9113     AC_MSG_CHECKING([for unicode/rbbi.h])
9114     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9115     AC_LANG_POP([C++])
9117     if test "$cross_compiling" != "yes"; then
9118         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9119         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9120         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9121         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9122     fi
9124     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9125         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9126         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9127         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9128         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9129         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9130             AC_MSG_RESULT([yes])
9131         else
9132             AC_MSG_RESULT([no])
9133             if test "$with_system_icu_for_build" != "force"; then
9134                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9135 You can use --with-system-icu-for-build=force to use it anyway.])
9136             fi
9137         fi
9138     fi
9140     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9141         # using the system icu tools can lead to version confusion, use the
9142         # ones from the build environment when cross-compiling
9143         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9144         if test -z "$SYSTEM_GENBRK"; then
9145             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9146         fi
9147         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9148         if test -z "$SYSTEM_GENCCODE"; then
9149             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9150         fi
9151         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9152         if test -z "$SYSTEM_GENCMN"; then
9153             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9154         fi
9155         if test "$ICU_MAJOR" -ge "49"; then
9156             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9157             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9158             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9159         else
9160             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9161             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9162             ICU_RECLASSIFIED_HEBREW_LETTER=
9163         fi
9164     fi
9166     if test "$cross_compiling" = "yes"; then
9167         if test "$ICU_MAJOR" -ge "50"; then
9168             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9169             ICU_MINOR=""
9170         fi
9171     fi
9172 else
9173     AC_MSG_RESULT([internal])
9174     SYSTEM_ICU=
9175     BUILD_TYPE="$BUILD_TYPE ICU"
9176     # surprisingly set these only for "internal" (to be used by various other
9177     # external libs): the system icu-config is quite unhelpful and spits out
9178     # dozens of weird flags and also default path -I/usr/include
9179     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9180     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9182 if test "$ICU_MAJOR" -ge "59"; then
9183     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9184     # with -std=c++11 but not all external libraries can be built with that,
9185     # for those use a bit-compatible typedef uint16_t UChar; see
9186     # icu/source/common/unicode/umachine.h
9187     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9188 else
9189     ICU_UCHAR_TYPE=""
9191 AC_SUBST(SYSTEM_ICU)
9192 AC_SUBST(SYSTEM_GENBRK)
9193 AC_SUBST(SYSTEM_GENCCODE)
9194 AC_SUBST(SYSTEM_GENCMN)
9195 AC_SUBST(ICU_MAJOR)
9196 AC_SUBST(ICU_MINOR)
9197 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9198 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9199 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9200 AC_SUBST(ICU_CFLAGS)
9201 AC_SUBST(ICU_LIBS)
9202 AC_SUBST(ICU_UCHAR_TYPE)
9204 dnl ==================================================================
9205 dnl Breakpad
9206 dnl ==================================================================
9207 AC_MSG_CHECKING([whether to enable breakpad])
9208 if test "$enable_breakpad" != yes; then
9209     AC_MSG_RESULT([no])
9210 else
9211     AC_MSG_RESULT([yes])
9212     ENABLE_BREAKPAD="TRUE"
9213     AC_DEFINE(ENABLE_BREAKPAD)
9214     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9215     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9217     AC_MSG_CHECKING([for crashreport config])
9218     if test "$with_symbol_config" = "no"; then
9219         BREAKPAD_SYMBOL_CONFIG="invalid"
9220         AC_MSG_RESULT([no])
9221     else
9222         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9223         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9224         AC_MSG_RESULT([yes])
9225     fi
9226     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9228 AC_SUBST(ENABLE_BREAKPAD)
9230 dnl ==================================================================
9231 dnl libfuzzer
9232 dnl ==================================================================
9233 AC_MSG_CHECKING([whether to enable fuzzers])
9234 if test "$enable_fuzzers" != yes; then
9235     AC_MSG_RESULT([no])
9236 else
9237     AC_MSG_RESULT([yes])
9238     ENABLE_FUZZERS="TRUE"
9239     AC_DEFINE(ENABLE_FUZZERS)
9240     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9242 AC_SUBST(ENABLE_FUZZERS)
9244 dnl ===================================================================
9245 dnl Orcus
9246 dnl ===================================================================
9247 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9248 if test "$with_system_orcus" != "yes"; then
9249     if test "$SYSTEM_BOOST" = "TRUE"; then
9250         # ===========================================================
9251         # Determine if we are going to need to link with Boost.System
9252         # ===========================================================
9253         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9254         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9255         dnl in documentation has no effect.
9256         AC_MSG_CHECKING([if we need to link with Boost.System])
9257         AC_LANG_PUSH([C++])
9258         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9259                 @%:@include <boost/version.hpp>
9260             ]],[[
9261                 #if BOOST_VERSION >= 105000
9262                 #   error yes, we need to link with Boost.System
9263                 #endif
9264             ]])],[
9265                 AC_MSG_RESULT([no])
9266             ],[
9267                 AC_MSG_RESULT([yes])
9268                 AX_BOOST_SYSTEM
9269         ])
9270         AC_LANG_POP([C++])
9271     fi
9273 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9274 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9275 AC_SUBST([BOOST_SYSTEM_LIB])
9276 AC_SUBST(SYSTEM_LIBORCUS)
9278 dnl ===================================================================
9279 dnl HarfBuzz
9280 dnl ===================================================================
9281 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9282                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9283                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9285 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9286                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9287                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9289 if test "$COM" = "MSC"; then # override the above
9290     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9291     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9294 if test "$with_system_harfbuzz" = "yes"; then
9295     if test "$with_system_graphite" = "no"; then
9296         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9297     fi
9298     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9299     _save_libs="$LIBS"
9300     _save_cflags="$CFLAGS"
9301     LIBS="$LIBS $HARFBUZZ_LIBS"
9302     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9303     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9304     LIBS="$_save_libs"
9305     CFLAGS="$_save_cflags"
9306 else
9307     if test "$with_system_graphite" = "yes"; then
9308         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9309     fi
9312 AC_MSG_CHECKING([whether to use X11])
9313 dnl ***************************************
9314 dnl testing for X libraries and includes...
9315 dnl ***************************************
9316 if test "$USING_X11" = TRUE; then
9317     AC_DEFINE(HAVE_FEATURE_X11)
9319 AC_MSG_RESULT([$USING_X11])
9321 if test "$USING_X11" = TRUE; then
9322     AC_PATH_X
9323     AC_PATH_XTRA
9324     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9326     if test -z "$x_includes"; then
9327         x_includes="default_x_includes"
9328     fi
9329     if test -z "$x_libraries"; then
9330         x_libraries="default_x_libraries"
9331     fi
9332     CFLAGS="$CFLAGS $X_CFLAGS"
9333     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9334     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9335 else
9336     x_includes="no_x_includes"
9337     x_libraries="no_x_libraries"
9340 if test "$USING_X11" = TRUE; then
9341     dnl ===================================================================
9342     dnl Check for extension headers
9343     dnl ===================================================================
9344     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9345      [#include <X11/extensions/shape.h>])
9347     # vcl needs ICE and SM
9348     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9349     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9350         [AC_MSG_ERROR(ICE library not found)])
9351     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9352     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9353         [AC_MSG_ERROR(SM library not found)])
9356 dnl ===================================================================
9357 dnl Check for system Xrender
9358 dnl ===================================================================
9359 AC_MSG_CHECKING([whether to use Xrender])
9360 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9361     AC_MSG_RESULT([yes])
9362     PKG_CHECK_MODULES(XRENDER, xrender)
9363     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9364     FilterLibs "${XRENDER_LIBS}"
9365     XRENDER_LIBS="${filteredlibs}"
9366     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9367       [AC_MSG_ERROR(libXrender not found or functional)], [])
9368     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9369       [AC_MSG_ERROR(Xrender not found. install X)], [])
9370 else
9371     AC_MSG_RESULT([no])
9373 AC_SUBST(XRENDER_CFLAGS)
9374 AC_SUBST(XRENDER_LIBS)
9376 dnl ===================================================================
9377 dnl Check for XRandr
9378 dnl ===================================================================
9379 AC_MSG_CHECKING([whether to enable RandR support])
9380 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9381     AC_MSG_RESULT([yes])
9382     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9383     if test "$ENABLE_RANDR" != "TRUE"; then
9384         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9385                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9386         XRANDR_CFLAGS=" "
9387         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9388           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9389         XRANDR_LIBS="-lXrandr "
9390         ENABLE_RANDR="TRUE"
9391     fi
9392     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9393     FilterLibs "${XRANDR_LIBS}"
9394     XRANDR_LIBS="${filteredlibs}"
9395 else
9396     ENABLE_RANDR=""
9397     AC_MSG_RESULT([no])
9399 AC_SUBST(XRANDR_CFLAGS)
9400 AC_SUBST(XRANDR_LIBS)
9401 AC_SUBST(ENABLE_RANDR)
9403 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9404     WITH_WEBDAV="serf"
9406 if test $_os = iOS -o $_os = Android; then
9407     WITH_WEBDAV="no"
9409 AC_MSG_CHECKING([for webdav library])
9410 case "$WITH_WEBDAV" in
9411 serf)
9412     AC_MSG_RESULT([serf])
9413     # Check for system apr-util
9414     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9415                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9416                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9417     if test "$COM" = "MSC"; then
9418         APR_LIB_DIR="LibR"
9419         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9420         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9421     fi
9423     # Check for system serf
9424     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9425                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9426     if test "$COM" = "MSC"; then
9427         SERF_LIB_DIR="Release"
9428         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9429         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9430     fi
9431     ;;
9432 neon)
9433     AC_MSG_RESULT([neon])
9434     # Check for system neon
9435     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9436     if test "$with_system_neon" = "yes"; then
9437         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9438     else
9439         NEON_VERSION=0295
9440     fi
9441     AC_SUBST(NEON_VERSION)
9442     ;;
9444     AC_MSG_RESULT([none, disabled])
9445     WITH_WEBDAV=""
9446     ;;
9447 esac
9448 AC_SUBST(WITH_WEBDAV)
9450 dnl ===================================================================
9451 dnl Check for disabling cve_tests
9452 dnl ===================================================================
9453 AC_MSG_CHECKING([whether to execute CVE tests])
9454 # If not explicitly enabled or disabled, default
9455 if test -z "$enable_cve_tests"; then
9456     case "$OS" in
9457     WNT)
9458         # Default cves off for windows with its wild and wonderful
9459         # varienty of AV software kicking in and panicking
9460         enable_cve_tests=no
9461         ;;
9462     *)
9463         # otherwise yes
9464         enable_cve_tests=yes
9465         ;;
9466     esac
9468 if test "$enable_cve_tests" = "no"; then
9469     AC_MSG_RESULT([no])
9470     DISABLE_CVE_TESTS=TRUE
9471     AC_SUBST(DISABLE_CVE_TESTS)
9472 else
9473     AC_MSG_RESULT([yes])
9476 dnl ===================================================================
9477 dnl Check for enabling chart XShape tests
9478 dnl ===================================================================
9479 AC_MSG_CHECKING([whether to execute chart XShape tests])
9480 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9481     AC_MSG_RESULT([yes])
9482     ENABLE_CHART_TESTS=TRUE
9483     AC_SUBST(ENABLE_CHART_TESTS)
9484 else
9485     AC_MSG_RESULT([no])
9488 dnl ===================================================================
9489 dnl Check for system openssl
9490 dnl ===================================================================
9491 DISABLE_OPENSSL=
9492 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9493 if test "$enable_openssl" = "yes"; then
9494     AC_MSG_RESULT([no])
9495     if test "$_os" = Darwin ; then
9496         # OpenSSL is deprecated when building for 10.7 or later.
9497         #
9498         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9499         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9501         with_system_openssl=no
9502         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9503     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9504             && test "$with_system_openssl" != "no"; then
9505         with_system_openssl=yes
9506         SYSTEM_OPENSSL=TRUE
9507         OPENSSL_CFLAGS=
9508         OPENSSL_LIBS="-lssl -lcrypto"
9509     else
9510         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9511     fi
9512     if test "$with_system_openssl" = "yes"; then
9513         AC_MSG_CHECKING([whether openssl supports SHA512])
9514         AC_LANG_PUSH([C])
9515         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9516             SHA512_CTX context;
9517 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9518         AC_LANG_POP(C)
9519     fi
9520 else
9521     AC_MSG_RESULT([yes])
9522     DISABLE_OPENSSL=TRUE
9524     # warn that although OpenSSL is disabled, system libraries may depend on it
9525     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9526     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9529 AC_SUBST([DISABLE_OPENSSL])
9531 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9532     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9533         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9534         enable_cipher_openssl_backend=no
9535     else
9536         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9537     fi
9539 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9540 ENABLE_CIPHER_OPENSSL_BACKEND=
9541 if test "$enable_cipher_openssl_backend" = yes; then
9542     AC_MSG_RESULT([yes])
9543     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9544 else
9545     AC_MSG_RESULT([no])
9547 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9549 dnl ===================================================================
9550 dnl Check for building gnutls
9551 dnl ===================================================================
9552 AC_MSG_CHECKING([whether to use gnutls])
9553 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9554     AC_MSG_RESULT([yes])
9555     AM_PATH_LIBGCRYPT()
9556     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9557         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9558                       available in the system to use as replacement.]]))
9559     FilterLibs "${LIBGCRYPT_LIBS}"
9560     LIBGCRYPT_LIBS="${filteredlibs}"
9561 else
9562     AC_MSG_RESULT([no])
9565 AC_SUBST([LIBGCRYPT_CFLAGS])
9566 AC_SUBST([LIBGCRYPT_LIBS])
9568 dnl ===================================================================
9569 dnl Check for system redland
9570 dnl ===================================================================
9571 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9572 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9573 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9574 if test "$with_system_redland" = "yes"; then
9575     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9576             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9577 else
9578     RAPTOR_MAJOR="0"
9579     RASQAL_MAJOR="3"
9580     REDLAND_MAJOR="0"
9582 AC_SUBST(RAPTOR_MAJOR)
9583 AC_SUBST(RASQAL_MAJOR)
9584 AC_SUBST(REDLAND_MAJOR)
9586 dnl ===================================================================
9587 dnl Check for system hunspell
9588 dnl ===================================================================
9589 AC_MSG_CHECKING([which libhunspell to use])
9590 if test "$with_system_hunspell" = "yes"; then
9591     AC_MSG_RESULT([external])
9592     SYSTEM_HUNSPELL=TRUE
9593     AC_LANG_PUSH([C++])
9594     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9595     if test "$HUNSPELL_PC" != "TRUE"; then
9596         AC_CHECK_HEADER(hunspell.hxx, [],
9597             [
9598             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9599             [AC_MSG_ERROR(hunspell headers not found.)], [])
9600             ], [])
9601         AC_CHECK_LIB([hunspell], [main], [:],
9602            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9603         HUNSPELL_LIBS=-lhunspell
9604     fi
9605     AC_LANG_POP([C++])
9606     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9607     FilterLibs "${HUNSPELL_LIBS}"
9608     HUNSPELL_LIBS="${filteredlibs}"
9609 else
9610     AC_MSG_RESULT([internal])
9611     SYSTEM_HUNSPELL=
9612     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9613     if test "$COM" = "MSC"; then
9614         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9615     else
9616         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9617     fi
9618     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9620 AC_SUBST(SYSTEM_HUNSPELL)
9621 AC_SUBST(HUNSPELL_CFLAGS)
9622 AC_SUBST(HUNSPELL_LIBS)
9624 dnl ===================================================================
9625 dnl Checking for altlinuxhyph
9626 dnl ===================================================================
9627 AC_MSG_CHECKING([which altlinuxhyph to use])
9628 if test "$with_system_altlinuxhyph" = "yes"; then
9629     AC_MSG_RESULT([external])
9630     SYSTEM_HYPH=TRUE
9631     AC_CHECK_HEADER(hyphen.h, [],
9632        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9633     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9634        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9635        [#include <hyphen.h>])
9636     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9637         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9638     if test -z "$HYPHEN_LIB"; then
9639         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9640            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9641     fi
9642     if test -z "$HYPHEN_LIB"; then
9643         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9644            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9645     fi
9646 else
9647     AC_MSG_RESULT([internal])
9648     SYSTEM_HYPH=
9649     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9650     if test "$COM" = "MSC"; then
9651         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9652     else
9653         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9654     fi
9656 AC_SUBST(SYSTEM_HYPH)
9657 AC_SUBST(HYPHEN_LIB)
9659 dnl ===================================================================
9660 dnl Checking for mythes
9661 dnl ===================================================================
9662 AC_MSG_CHECKING([which mythes to use])
9663 if test "$with_system_mythes" = "yes"; then
9664     AC_MSG_RESULT([external])
9665     SYSTEM_MYTHES=TRUE
9666     AC_LANG_PUSH([C++])
9667     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9668     if test "$MYTHES_PKGCONFIG" = "no"; then
9669         AC_CHECK_HEADER(mythes.hxx, [],
9670             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9671         AC_CHECK_LIB([mythes-1.2], [main], [:],
9672             [ MYTHES_FOUND=no], [])
9673     if test "$MYTHES_FOUND" = "no"; then
9674         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9675                 [ MYTHES_FOUND=no], [])
9676     fi
9677     if test "$MYTHES_FOUND" = "no"; then
9678         AC_MSG_ERROR([mythes library not found!.])
9679     fi
9680     fi
9681     AC_LANG_POP([C++])
9682     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9683     FilterLibs "${MYTHES_LIBS}"
9684     MYTHES_LIBS="${filteredlibs}"
9685 else
9686     AC_MSG_RESULT([internal])
9687     SYSTEM_MYTHES=
9688     BUILD_TYPE="$BUILD_TYPE MYTHES"
9689     if test "$COM" = "MSC"; then
9690         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9691     else
9692         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9693     fi
9695 AC_SUBST(SYSTEM_MYTHES)
9696 AC_SUBST(MYTHES_CFLAGS)
9697 AC_SUBST(MYTHES_LIBS)
9699 dnl ===================================================================
9700 dnl How should we build the linear programming solver ?
9701 dnl ===================================================================
9703 ENABLE_COINMP=
9704 AC_MSG_CHECKING([whether to build with CoinMP])
9705 if test "$enable_coinmp" != "no"; then
9706     ENABLE_COINMP=TRUE
9707     AC_MSG_RESULT([yes])
9708     if test "$with_system_coinmp" = "yes"; then
9709         SYSTEM_COINMP=TRUE
9710         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9711         FilterLibs "${COINMP_LIBS}"
9712         COINMP_LIBS="${filteredlibs}"
9713     else
9714         BUILD_TYPE="$BUILD_TYPE COINMP"
9715     fi
9716 else
9717     AC_MSG_RESULT([no])
9719 AC_SUBST(ENABLE_COINMP)
9720 AC_SUBST(SYSTEM_COINMP)
9721 AC_SUBST(COINMP_CFLAGS)
9722 AC_SUBST(COINMP_LIBS)
9724 ENABLE_LPSOLVE=
9725 AC_MSG_CHECKING([whether to build with lpsolve])
9726 if test "$enable_lpsolve" != "no"; then
9727     ENABLE_LPSOLVE=TRUE
9728     AC_MSG_RESULT([yes])
9729 else
9730     AC_MSG_RESULT([no])
9732 AC_SUBST(ENABLE_LPSOLVE)
9734 if test "$ENABLE_LPSOLVE" = TRUE; then
9735     AC_MSG_CHECKING([which lpsolve to use])
9736     if test "$with_system_lpsolve" = "yes"; then
9737         AC_MSG_RESULT([external])
9738         SYSTEM_LPSOLVE=TRUE
9739         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9740            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9741         save_LIBS=$LIBS
9742         # some systems need this. Like Ubuntu....
9743         AC_CHECK_LIB(m, floor)
9744         AC_CHECK_LIB(dl, dlopen)
9745         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9746             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9747         LIBS=$save_LIBS
9748     else
9749         AC_MSG_RESULT([internal])
9750         SYSTEM_LPSOLVE=
9751         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9752     fi
9754 AC_SUBST(SYSTEM_LPSOLVE)
9756 dnl ===================================================================
9757 dnl Checking for libexttextcat
9758 dnl ===================================================================
9759 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9760 if test "$with_system_libexttextcat" = "yes"; then
9761     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9763 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9765 dnl ===================================================================
9766 dnl Checking for libnumbertext
9767 dnl ===================================================================
9768 AC_MSG_CHECKING([whether to use libnumbertext])
9769 if test "$enable_libnumbertext" = "no"; then
9770     AC_MSG_RESULT([no])
9771     ENABLE_LIBNUMBERTEXT=
9772     SYSTEM_LIBNUMBERTEXT=
9773 else
9774     AC_MSG_RESULT([yes])
9775     ENABLE_LIBNUMBERTEXT=TRUE
9776     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9777     if test "$with_system_libnumbertext" = "yes"; then
9778         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9779         SYSTEM_LIBNUMBERTEXT=YES
9780     else
9781         SYSTEM_LIBNUMBERTEXT=
9782         AC_LANG_PUSH([C++])
9783         save_CPPFLAGS=$CPPFLAGS
9784         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9785         AC_CHECK_HEADERS([codecvt regex])
9786         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9787                 [ ENABLE_LIBNUMBERTEXT=''
9788                   LIBNUMBERTEXT_CFLAGS=''
9789                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9790                                Enable libnumbertext fallback (missing number to number name conversion).])
9791                 ])
9792         CPPFLAGS=$save_CPPFLAGS
9793         AC_LANG_POP([C++])
9794     fi
9795     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9796         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9797     fi
9799 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9800 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9801 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9802 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9804 dnl ***************************************
9805 dnl testing libc version for Linux...
9806 dnl ***************************************
9807 if test "$_os" = "Linux"; then
9808     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9809     exec 6>/dev/null # no output
9810     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9811     exec 6>&1 # output on again
9812     if test "$HAVE_LIBC"; then
9813         AC_MSG_RESULT([yes])
9814     else
9815         AC_MSG_ERROR([no, upgrade libc])
9816     fi
9819 dnl =========================================
9820 dnl Check for uuidgen
9821 dnl =========================================
9822 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9823     # presence is already tested above in the WINDOWS_SDK_HOME check
9824     UUIDGEN=uuidgen.exe
9825     AC_SUBST(UUIDGEN)
9826 else
9827     AC_PATH_PROG([UUIDGEN], [uuidgen])
9828     if test -z "$UUIDGEN"; then
9829         AC_MSG_WARN([uuid is needed for building installation sets])
9830     fi
9833 dnl ***************************************
9834 dnl Checking for bison and flex
9835 dnl ***************************************
9836 AC_PATH_PROG(BISON, bison)
9837 if test -z "$BISON"; then
9838     AC_MSG_ERROR([no bison found in \$PATH, install it])
9839 else
9840     AC_MSG_CHECKING([the bison version])
9841     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9842     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9843     # Accept newer than 2.0
9844     if test "$_bison_longver" -lt 2000; then
9845         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9846     fi
9849 AC_PATH_PROG(FLEX, flex)
9850 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9851     FLEX=`cygpath -m $FLEX`
9853 if test -z "$FLEX"; then
9854     AC_MSG_ERROR([no flex found in \$PATH, install it])
9855 else
9856     AC_MSG_CHECKING([the flex version])
9857     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9858     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9859         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9860     fi
9862 AC_SUBST([FLEX])
9863 dnl ***************************************
9864 dnl Checking for patch
9865 dnl ***************************************
9866 AC_PATH_PROG(PATCH, patch)
9867 if test -z "$PATCH"; then
9868     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9871 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9872 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9873     if test -z "$with_gnu_patch"; then
9874         GNUPATCH=$PATCH
9875     else
9876         if test -x "$with_gnu_patch"; then
9877             GNUPATCH=$with_gnu_patch
9878         else
9879             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9880         fi
9881     fi
9883     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9884     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9885         AC_MSG_RESULT([yes])
9886     else
9887         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9888     fi
9889 else
9890     GNUPATCH=$PATCH
9893 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9894     GNUPATCH=`cygpath -m $GNUPATCH`
9897 dnl We also need to check for --with-gnu-cp
9899 if test -z "$with_gnu_cp"; then
9900     # check the place where the good stuff is hidden on Solaris...
9901     if test -x /usr/gnu/bin/cp; then
9902         GNUCP=/usr/gnu/bin/cp
9903     else
9904         AC_PATH_PROGS(GNUCP, gnucp cp)
9905     fi
9906     if test -z $GNUCP; then
9907         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9908     fi
9909 else
9910     if test -x "$with_gnu_cp"; then
9911         GNUCP=$with_gnu_cp
9912     else
9913         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9914     fi
9917 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9918     GNUCP=`cygpath -m $GNUCP`
9921 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9922 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9923     AC_MSG_RESULT([yes])
9924 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9925     AC_MSG_RESULT([yes])
9926 else
9927     case "$build_os" in
9928     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9929         x_GNUCP=[\#]
9930         GNUCP=''
9931         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9932         ;;
9933     *)
9934         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9935         ;;
9936     esac
9939 AC_SUBST(GNUPATCH)
9940 AC_SUBST(GNUCP)
9941 AC_SUBST(x_GNUCP)
9943 dnl ***************************************
9944 dnl testing assembler path
9945 dnl ***************************************
9946 ML_EXE=""
9947 if test "$_os" = "WINNT"; then
9948     if test "$BITNESS_OVERRIDE" = ""; then
9949         assembler=ml.exe
9950         assembler_bin=$CL_DIR
9951     else
9952         assembler=ml64.exe
9953         assembler_bin=$CL_DIR
9954     fi
9956     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9957     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9958         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9959         AC_MSG_RESULT([found])
9960         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9961     else
9962         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9963     fi
9965     PathFormat "$ASM_HOME"
9966     ASM_HOME="$formatted_path"
9967 else
9968     ASM_HOME=""
9971 AC_SUBST(ML_EXE)
9973 dnl ===================================================================
9974 dnl We need zip and unzip
9975 dnl ===================================================================
9976 AC_PATH_PROG(ZIP, zip)
9977 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9978 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9979     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],,)
9982 AC_PATH_PROG(UNZIP, unzip)
9983 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9985 dnl ===================================================================
9986 dnl Zip must be a specific type for different build types.
9987 dnl ===================================================================
9988 if test $build_os = cygwin; then
9989     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9990         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9991     fi
9994 dnl ===================================================================
9995 dnl We need touch with -h option support.
9996 dnl ===================================================================
9997 AC_PATH_PROG(TOUCH, touch)
9998 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9999 touch warn
10000 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10001     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],,)
10004 dnl ===================================================================
10005 dnl Check for system epoxy
10006 dnl ===================================================================
10007 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10009 dnl ===================================================================
10010 dnl Set vcl option: coordinate device in double or sal_Int32
10011 dnl ===================================================================
10013 dnl disabled for now, we don't want subtle differences between OSs
10014 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10015 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10016 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10017 dnl     AC_MSG_RESULT([double])
10018 dnl else
10019 dnl     AC_MSG_RESULT([sal_Int32])
10020 dnl fi
10022 dnl ===================================================================
10023 dnl Test which vclplugs have to be built.
10024 dnl ===================================================================
10025 R=""
10026 if test "$USING_X11" != TRUE; then
10027     enable_gtk=no
10028     enable_gtk3=no
10030 GTK3_CFLAGS=""
10031 GTK3_LIBS=""
10032 ENABLE_GTK3=""
10033 if test "x$enable_gtk3" = "xyes"; then
10034     if test "$with_system_cairo" = no; then
10035         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10036     fi
10037     : ${with_system_cairo:=yes}
10038     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="")
10039     if test "x$ENABLE_GTK3" = "xTRUE"; then
10040         R="gtk3"
10041         dnl Avoid installed by unpackaged files for now.
10042         if test -z "$PKGFORMAT"; then
10043             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10044         fi
10045     else
10046         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10047     fi
10048     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10049     FilterLibs "${GTK3_LIBS}"
10050     GTK3_LIBS="${filteredlibs}"
10052     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10053     if test "$with_system_epoxy" != "yes"; then
10054         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10055         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10056                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10057     fi
10059 AC_SUBST(GTK3_LIBS)
10060 AC_SUBST(GTK3_CFLAGS)
10061 AC_SUBST(ENABLE_GTK3)
10063 ENABLE_GTK=""
10064 if test "x$enable_gtk" = "xyes"; then
10065     if test "$with_system_cairo" = no; then
10066         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10067     fi
10068     : ${with_system_cairo:=yes}
10069     ENABLE_GTK="TRUE"
10070     AC_DEFINE(ENABLE_GTK)
10071     R="gtk $R"
10073 AC_SUBST(ENABLE_GTK)
10075 ENABLE_KDE4=""
10076 if test "x$enable_kde4" = "xyes"; then
10077     ENABLE_KDE4="TRUE"
10078     AC_DEFINE(ENABLE_KDE4)
10079     R="$R kde4"
10081 AC_SUBST(ENABLE_KDE4)
10083 ENABLE_QT5=""
10084 if test "x$enable_qt5" = "xyes"; then
10085     ENABLE_QT5="TRUE"
10086     AC_DEFINE(ENABLE_QT5)
10087     R="$R qt5"
10089 AC_SUBST(ENABLE_QT5)
10091 ENABLE_KDE5=""
10092 if test "x$enable_kde5" = "xyes"; then
10093     ENABLE_KDE5="TRUE"
10094     AC_DEFINE(ENABLE_KDE5)
10095     R="$R kde5"
10097 AC_SUBST(ENABLE_KDE5)
10099 ENABLE_GTK3_KDE5=""
10100 if test "x$enable_gtk3_kde5" = "xyes"; then
10101     ENABLE_GTK3_KDE5="TRUE"
10102     AC_DEFINE(ENABLE_GTK3_KDE5)
10103     R="$R gtk3_kde5"
10105 AC_SUBST(ENABLE_GTK3_KDE5)
10107 build_vcl_plugins="$R"
10108 if test -z "$build_vcl_plugins"; then
10109     build_vcl_plugins="none"
10111 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10113 dnl ===================================================================
10114 dnl check for dbus support
10115 dnl ===================================================================
10116 ENABLE_DBUS=""
10117 DBUS_CFLAGS=""
10118 DBUS_LIBS=""
10119 DBUS_GLIB_CFLAGS=""
10120 DBUS_GLIB_LIBS=""
10121 DBUS_HAVE_GLIB=""
10123 if test "$enable_dbus" = "no"; then
10124     test_dbus=no
10127 AC_MSG_CHECKING([whether to enable DBUS support])
10128 if test "$test_dbus" = "yes"; then
10129     ENABLE_DBUS="TRUE"
10130     AC_MSG_RESULT([yes])
10131     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10132     AC_DEFINE(ENABLE_DBUS)
10133     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10134     FilterLibs "${DBUS_LIBS}"
10135     DBUS_LIBS="${filteredlibs}"
10137     # Glib is needed for BluetoothServer
10138     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10139     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10140         [
10141             DBUS_HAVE_GLIB="TRUE"
10142             AC_DEFINE(DBUS_HAVE_GLIB,1)
10143         ],
10144         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10145     )
10146 else
10147     AC_MSG_RESULT([no])
10150 AC_SUBST(ENABLE_DBUS)
10151 AC_SUBST(DBUS_CFLAGS)
10152 AC_SUBST(DBUS_LIBS)
10153 AC_SUBST(DBUS_GLIB_CFLAGS)
10154 AC_SUBST(DBUS_GLIB_LIBS)
10155 AC_SUBST(DBUS_HAVE_GLIB)
10157 AC_MSG_CHECKING([whether to enable Impress remote control])
10158 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10159     AC_MSG_RESULT([yes])
10160     ENABLE_SDREMOTE=TRUE
10161     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10163     # If not explicitly enabled or disabled, default
10164     if test -z "$enable_sdremote_bluetooth"; then
10165         case "$OS" in
10166         LINUX|MACOSX|WNT)
10167             # Default to yes for these
10168             enable_sdremote_bluetooth=yes
10169             ;;
10170         *)
10171             # otherwise no
10172             enable_sdremote_bluetooth=no
10173             ;;
10174         esac
10175     fi
10176     # $enable_sdremote_bluetooth is guaranteed non-empty now
10178     if test "$enable_sdremote_bluetooth" != "no"; then
10179         if test "$OS" = "LINUX"; then
10180             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10181                 AC_MSG_RESULT([yes])
10182                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10183                 dnl ===================================================================
10184                 dnl Check for system bluez
10185                 dnl ===================================================================
10186                 AC_MSG_CHECKING([which Bluetooth header to use])
10187                 if test "$with_system_bluez" = "yes"; then
10188                     AC_MSG_RESULT([external])
10189                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10190                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10191                     SYSTEM_BLUEZ=TRUE
10192                 else
10193                     AC_MSG_RESULT([internal])
10194                     SYSTEM_BLUEZ=
10195                 fi
10196             else
10197                 AC_MSG_RESULT([no, dbus disabled])
10198                 ENABLE_SDREMOTE_BLUETOOTH=
10199                 SYSTEM_BLUEZ=
10200             fi
10201         else
10202             AC_MSG_RESULT([yes])
10203             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10204             SYSTEM_BLUEZ=
10205         fi
10206     else
10207         AC_MSG_RESULT([no])
10208         ENABLE_SDREMOTE_BLUETOOTH=
10209         SYSTEM_BLUEZ=
10210     fi
10211 else
10212     ENABLE_SDREMOTE=
10213     SYSTEM_BLUEZ=
10214     AC_MSG_RESULT([no])
10216 AC_SUBST(ENABLE_SDREMOTE)
10217 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10218 AC_SUBST(SYSTEM_BLUEZ)
10220 dnl ===================================================================
10221 dnl Check whether the gtk 2.0 libraries are available.
10222 dnl ===================================================================
10224 GTK_CFLAGS=""
10225 GTK_LIBS=""
10226 if test  "$test_gtk" = "yes"; then
10228     if test "$ENABLE_GTK" = "TRUE"; then
10229         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]))
10230         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10231         FilterLibs "${GTK_LIBS}"
10232         GTK_LIBS="${filteredlibs}"
10233         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]))
10234         BUILD_TYPE="$BUILD_TYPE GTK"
10235         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10236         FilterLibs "${GTHREAD_LIBS}"
10237         GTHREAD_LIBS="${filteredlibs}"
10239         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10240         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10241                           [ENABLE_GTK_PRINT="TRUE"],
10242                           [ENABLE_GTK_PRINT=""])
10243         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10244         FilterLibs "${GTK_PRINT_LIBS}"
10245         GTK_PRINT_LIBS="${filteredlibs}"
10246     fi
10248     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10249         AC_MSG_CHECKING([whether to enable GIO support])
10250         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10251             dnl Need at least 2.26 for the dbus support.
10252             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10253                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10254             if test "$ENABLE_GIO" = "TRUE"; then
10255                 AC_DEFINE(ENABLE_GIO)
10256                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10257                 FilterLibs "${GIO_LIBS}"
10258                 GIO_LIBS="${filteredlibs}"
10259             fi
10260         else
10261             AC_MSG_RESULT([no])
10262         fi
10263     fi
10265 AC_SUBST(ENABLE_GIO)
10266 AC_SUBST(GIO_CFLAGS)
10267 AC_SUBST(GIO_LIBS)
10268 AC_SUBST(GTK_CFLAGS)
10269 AC_SUBST(GTK_LIBS)
10270 AC_SUBST(GTHREAD_CFLAGS)
10271 AC_SUBST(GTHREAD_LIBS)
10272 AC_SUBST([ENABLE_GTK_PRINT])
10273 AC_SUBST([GTK_PRINT_CFLAGS])
10274 AC_SUBST([GTK_PRINT_LIBS])
10277 dnl ===================================================================
10279 SPLIT_APP_MODULES=""
10280 if test "$enable_split_app_modules" = "yes"; then
10281     SPLIT_APP_MODULES="TRUE"
10283 AC_SUBST(SPLIT_APP_MODULES)
10285 SPLIT_OPT_FEATURES=""
10286 if test "$enable_split_opt_features" = "yes"; then
10287     SPLIT_OPT_FEATURES="TRUE"
10289 AC_SUBST(SPLIT_OPT_FEATURES)
10291 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10292     if test "$enable_cairo_canvas" = yes; then
10293         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10294     fi
10295     enable_cairo_canvas=no
10296 elif test -z "$enable_cairo_canvas"; then
10297     enable_cairo_canvas=yes
10300 ENABLE_CAIRO_CANVAS=""
10301 if test "$enable_cairo_canvas" = "yes"; then
10302     test_cairo=yes
10303     ENABLE_CAIRO_CANVAS="TRUE"
10304     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10306 AC_SUBST(ENABLE_CAIRO_CANVAS)
10308 dnl ===================================================================
10309 dnl Check whether the GStreamer libraries are available.
10310 dnl It's possible to build avmedia with both GStreamer backends!
10311 dnl ===================================================================
10313 ENABLE_GSTREAMER_1_0=""
10315 if test "$build_gstreamer_1_0" = "yes"; then
10317     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10318     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10319         ENABLE_GSTREAMER_1_0="TRUE"
10320         AC_MSG_RESULT([yes])
10321         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10322         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10323         FilterLibs "${GSTREAMER_1_0_LIBS}"
10324         GSTREAMER_1_0_LIBS="${filteredlibs}"
10325     else
10326         AC_MSG_RESULT([no])
10327     fi
10329 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10330 AC_SUBST(GSTREAMER_1_0_LIBS)
10331 AC_SUBST(ENABLE_GSTREAMER_1_0)
10334 ENABLE_GSTREAMER_0_10=""
10335 if test "$build_gstreamer_0_10" = "yes"; then
10337     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10338     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10339         ENABLE_GSTREAMER_0_10="TRUE"
10340         AC_MSG_RESULT([yes])
10341         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10342             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10343         ])
10344         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10345         FilterLibs "${GSTREAMER_0_10_LIBS}"
10346         GSTREAMER_0_10_LIBS="${filteredlibs}"
10347     else
10348         AC_MSG_RESULT([no])
10349     fi
10352 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10353 AC_SUBST(GSTREAMER_0_10_LIBS)
10354 AC_SUBST(ENABLE_GSTREAMER_0_10)
10356 dnl ===================================================================
10357 dnl Check whether to build the VLC avmedia backend
10358 dnl ===================================================================
10360 ENABLE_VLC=""
10362 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10363 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10364     ENABLE_VLC="TRUE"
10365     AC_MSG_RESULT([yes])
10366 else
10367     AC_MSG_RESULT([no])
10369 AC_SUBST(ENABLE_VLC)
10371 ENABLE_OPENGL_TRANSITIONS=
10372 ENABLE_OPENGL_CANVAS=
10373 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10374    : # disable
10375 elif test "$_os" = "Darwin"; then
10376     # We use frameworks on Mac OS X, no need for detail checks
10377     ENABLE_OPENGL_TRANSITIONS=TRUE
10378     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10379     ENABLE_OPENGL_CANVAS=TRUE
10380 elif test $_os = WINNT; then
10381     ENABLE_OPENGL_TRANSITIONS=TRUE
10382     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10383     ENABLE_OPENGL_CANVAS=TRUE
10384 else
10385     if test "$USING_X11" = TRUE; then
10386         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10387         ENABLE_OPENGL_TRANSITIONS=TRUE
10388         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10389         ENABLE_OPENGL_CANVAS=TRUE
10390     fi
10393 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10394 AC_SUBST(ENABLE_OPENGL_CANVAS)
10396 dnl =================================================
10397 dnl Check whether to build with OpenCL support.
10398 dnl =================================================
10400 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10401     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10402     # platform (optional at run-time, used through clew).
10403     BUILD_TYPE="$BUILD_TYPE OPENCL"
10404     AC_DEFINE(HAVE_FEATURE_OPENCL)
10407 dnl =================================================
10408 dnl Check whether to build with dconf support.
10409 dnl =================================================
10411 if test "$enable_dconf" != no; then
10412     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10413         if test "$enable_dconf" = yes; then
10414             AC_MSG_ERROR([dconf not found])
10415         else
10416             enable_dconf=no
10417         fi])
10419 AC_MSG_CHECKING([whether to enable dconf])
10420 if test "$enable_dconf" = no; then
10421     DCONF_CFLAGS=
10422     DCONF_LIBS=
10423     ENABLE_DCONF=
10424     AC_MSG_RESULT([no])
10425 else
10426     ENABLE_DCONF=TRUE
10427     AC_DEFINE(ENABLE_DCONF)
10428     AC_MSG_RESULT([yes])
10430 AC_SUBST([DCONF_CFLAGS])
10431 AC_SUBST([DCONF_LIBS])
10432 AC_SUBST([ENABLE_DCONF])
10434 # pdf import?
10435 AC_MSG_CHECKING([whether to build the PDF import feature])
10436 ENABLE_PDFIMPORT=
10437 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10438     AC_MSG_RESULT([yes])
10439     ENABLE_PDFIMPORT=TRUE
10440     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10442     dnl ===================================================================
10443     dnl Check for system poppler
10444     dnl ===================================================================
10445     AC_MSG_CHECKING([which PDF import backend to use])
10446     if test "$with_system_poppler" = "yes"; then
10447         AC_MSG_RESULT([external])
10448         SYSTEM_POPPLER=TRUE
10449         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10450         AC_LANG_PUSH([C++])
10451         save_CXXFLAGS=$CXXFLAGS
10452         save_CPPFLAGS=$CPPFLAGS
10453         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10454         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10455         AC_CHECK_HEADER([cpp/poppler-version.h],
10456             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10457             [])
10458         CXXFLAGS=$save_CXXFLAGS
10459         CPPFLAGS=$save_CPPFLAGS
10460         AC_LANG_POP([C++])
10461         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10463         FilterLibs "${POPPLER_LIBS}"
10464         POPPLER_LIBS="${filteredlibs}"
10465     else
10466         AC_MSG_RESULT([internal])
10467         SYSTEM_POPPLER=
10468         BUILD_TYPE="$BUILD_TYPE POPPLER"
10469         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10470     fi
10471     AC_DEFINE([ENABLE_PDFIMPORT],1)
10472 else
10473     AC_MSG_RESULT([no])
10475 AC_SUBST(ENABLE_PDFIMPORT)
10476 AC_SUBST(SYSTEM_POPPLER)
10477 AC_SUBST(POPPLER_CFLAGS)
10478 AC_SUBST(POPPLER_LIBS)
10480 # pdf import?
10481 AC_MSG_CHECKING([whether to build PDFium])
10482 ENABLE_PDFIUM=
10483 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10484     AC_MSG_RESULT([yes])
10485     ENABLE_PDFIUM=TRUE
10486     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10487     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10488 else
10489     AC_MSG_RESULT([no])
10491 AC_SUBST(ENABLE_PDFIUM)
10493 SYSTEM_GPGMEPP=
10495 if test "$build_for_ios" = "YES"; then
10496     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10497     AC_MSG_RESULT([yes])
10498 elif test "$enable_mpl_subset" = "yes"; then
10499     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10500     AC_MSG_RESULT([yes])
10501 elif test "$enable_fuzzers" = "yes"; then
10502     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10503     AC_MSG_RESULT([yes])
10504 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10505     dnl ===================================================================
10506     dnl Check for system gpgme
10507     dnl ===================================================================
10508     AC_MSG_CHECKING([which gpgmepp to use])
10509     if test "$with_system_gpgmepp" = "yes"; then
10510         AC_MSG_RESULT([external])
10511         SYSTEM_GPGMEPP=TRUE
10513         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10514         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10515             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10516         # progress_callback is the only func with plain C linkage
10517         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10518         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10519             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10520         AC_CHECK_HEADER(gpgme.h, [],
10521             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10522     else
10523         AC_MSG_RESULT([internal])
10524         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10525         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10527         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10528         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10529         if test "$_os" != "WINNT"; then
10530             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10531             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10532         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10533             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10534         fi
10535     fi
10536     ENABLE_GPGMEPP=TRUE
10537     AC_DEFINE([HAVE_FEATURE_GPGME])
10538     AC_PATH_PROG(GPG, gpg)
10539     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10540     # so let's exclude that manually for the moment
10541     if test -n "$GPG" -a "$_os" != "WINNT"; then
10542         # make sure we not only have a working gpgme, but a full working
10543         # gpg installation to run OpenPGP signature verification
10544         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10545     fi
10546     if test "$_os" = "Linux"; then
10547       uid=`id -u`
10548       AC_MSG_CHECKING([for /run/user/$uid])
10549       if test -d /run/user/$uid; then
10550         AC_MSG_RESULT([yes])
10551         AC_PATH_PROG(GPGCONF, gpgconf)
10552         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10553         if $GPGCONF --dump-options > /dev/null ; then
10554           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10555             AC_MSG_RESULT([yes])
10556             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10557           else
10558             AC_MSG_RESULT([no])
10559           fi
10560         else
10561           AC_MSG_RESULT([no. missing or broken gpgconf?])
10562         fi
10563       else
10564         AC_MSG_RESULT([no])
10565      fi
10566    fi
10568 AC_SUBST(ENABLE_GPGMEPP)
10569 AC_SUBST(SYSTEM_GPGMEPP)
10570 AC_SUBST(GPG_ERROR_CFLAGS)
10571 AC_SUBST(GPG_ERROR_LIBS)
10572 AC_SUBST(LIBASSUAN_CFLAGS)
10573 AC_SUBST(LIBASSUAN_LIBS)
10574 AC_SUBST(GPGMEPP_CFLAGS)
10575 AC_SUBST(GPGMEPP_LIBS)
10576 AC_SUBST(GPGCONF)
10577 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10579 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10580 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10581     AC_MSG_RESULT([yes])
10582     ENABLE_MEDIAWIKI=TRUE
10583     BUILD_TYPE="$BUILD_TYPE XSLTML"
10584     if test  "x$with_java" = "xno"; then
10585         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10586     fi
10587 else
10588     AC_MSG_RESULT([no])
10589     ENABLE_MEDIAWIKI=
10590     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10592 AC_SUBST(ENABLE_MEDIAWIKI)
10594 AC_MSG_CHECKING([whether to build the Report Builder])
10595 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10596     AC_MSG_RESULT([yes])
10597     ENABLE_REPORTBUILDER=TRUE
10598     AC_MSG_CHECKING([which jfreereport libs to use])
10599     if test "$with_system_jfreereport" = "yes"; then
10600         SYSTEM_JFREEREPORT=TRUE
10601         AC_MSG_RESULT([external])
10602         if test -z $SAC_JAR; then
10603             SAC_JAR=/usr/share/java/sac.jar
10604         fi
10605         if ! test -f $SAC_JAR; then
10606              AC_MSG_ERROR(sac.jar not found.)
10607         fi
10609         if test -z $LIBXML_JAR; then
10610             if test -f /usr/share/java/libxml-1.0.0.jar; then
10611                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10612             elif test -f /usr/share/java/libxml.jar; then
10613                 LIBXML_JAR=/usr/share/java/libxml.jar
10614             else
10615                 AC_MSG_ERROR(libxml.jar replacement not found.)
10616             fi
10617         elif ! test -f $LIBXML_JAR; then
10618             AC_MSG_ERROR(libxml.jar not found.)
10619         fi
10621         if test -z $FLUTE_JAR; then
10622             if test -f/usr/share/java/flute-1.3.0.jar; then
10623                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10624             elif test -f /usr/share/java/flute.jar; then
10625                 FLUTE_JAR=/usr/share/java/flute.jar
10626             else
10627                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10628             fi
10629         elif ! test -f $FLUTE_JAR; then
10630             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10631         fi
10633         if test -z $JFREEREPORT_JAR; then
10634             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10635                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10636             elif test -f /usr/share/java/flow-engine.jar; then
10637                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10638             else
10639                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10640             fi
10641         elif ! test -f  $JFREEREPORT_JAR; then
10642                 AC_MSG_ERROR(jfreereport.jar not found.)
10643         fi
10645         if test -z $LIBLAYOUT_JAR; then
10646             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10647                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10648             elif test -f /usr/share/java/liblayout.jar; then
10649                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10650             else
10651                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10652             fi
10653         elif ! test -f $LIBLAYOUT_JAR; then
10654                 AC_MSG_ERROR(liblayout.jar not found.)
10655         fi
10657         if test -z $LIBLOADER_JAR; then
10658             if test -f /usr/share/java/libloader-1.0.0.jar; then
10659                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10660             elif test -f /usr/share/java/libloader.jar; then
10661                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10662             else
10663                 AC_MSG_ERROR(libloader.jar replacement not found.)
10664             fi
10665         elif ! test -f  $LIBLOADER_JAR; then
10666             AC_MSG_ERROR(libloader.jar not found.)
10667         fi
10669         if test -z $LIBFORMULA_JAR; then
10670             if test -f /usr/share/java/libformula-0.2.0.jar; then
10671                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10672             elif test -f /usr/share/java/libformula.jar; then
10673                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10674             else
10675                 AC_MSG_ERROR(libformula.jar replacement not found.)
10676             fi
10677         elif ! test -f $LIBFORMULA_JAR; then
10678                 AC_MSG_ERROR(libformula.jar not found.)
10679         fi
10681         if test -z $LIBREPOSITORY_JAR; then
10682             if test -f /usr/share/java/librepository-1.0.0.jar; then
10683                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10684             elif test -f /usr/share/java/librepository.jar; then
10685                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10686             else
10687                 AC_MSG_ERROR(librepository.jar replacement not found.)
10688             fi
10689         elif ! test -f $LIBREPOSITORY_JAR; then
10690             AC_MSG_ERROR(librepository.jar not found.)
10691         fi
10693         if test -z $LIBFONTS_JAR; then
10694             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10695                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10696             elif test -f /usr/share/java/libfonts.jar; then
10697                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10698             else
10699                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10700             fi
10701         elif ! test -f $LIBFONTS_JAR; then
10702                 AC_MSG_ERROR(libfonts.jar not found.)
10703         fi
10705         if test -z $LIBSERIALIZER_JAR; then
10706             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10707                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10708             elif test -f /usr/share/java/libserializer.jar; then
10709                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10710             else
10711                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10712             fi
10713         elif ! test -f $LIBSERIALIZER_JAR; then
10714                 AC_MSG_ERROR(libserializer.jar not found.)
10715         fi
10717         if test -z $LIBBASE_JAR; then
10718             if test -f /usr/share/java/libbase-1.0.0.jar; then
10719                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10720             elif test -f /usr/share/java/libbase.jar; then
10721                 LIBBASE_JAR=/usr/share/java/libbase.jar
10722             else
10723                 AC_MSG_ERROR(libbase.jar replacement not found.)
10724             fi
10725         elif ! test -f $LIBBASE_JAR; then
10726             AC_MSG_ERROR(libbase.jar not found.)
10727         fi
10729     else
10730         AC_MSG_RESULT([internal])
10731         SYSTEM_JFREEREPORT=
10732         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10733         NEED_ANT=TRUE
10734     fi
10735 else
10736     AC_MSG_RESULT([no])
10737     ENABLE_REPORTBUILDER=
10738     SYSTEM_JFREEREPORT=
10740 AC_SUBST(ENABLE_REPORTBUILDER)
10741 AC_SUBST(SYSTEM_JFREEREPORT)
10742 AC_SUBST(SAC_JAR)
10743 AC_SUBST(LIBXML_JAR)
10744 AC_SUBST(FLUTE_JAR)
10745 AC_SUBST(JFREEREPORT_JAR)
10746 AC_SUBST(LIBBASE_JAR)
10747 AC_SUBST(LIBLAYOUT_JAR)
10748 AC_SUBST(LIBLOADER_JAR)
10749 AC_SUBST(LIBFORMULA_JAR)
10750 AC_SUBST(LIBREPOSITORY_JAR)
10751 AC_SUBST(LIBFONTS_JAR)
10752 AC_SUBST(LIBSERIALIZER_JAR)
10754 # this has to be here because both the Wiki Publisher and the SRB use
10755 # commons-logging
10756 COMMONS_LOGGING_VERSION=1.2
10757 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10758     AC_MSG_CHECKING([which Apache commons-* libs to use])
10759     if test "$with_system_apache_commons" = "yes"; then
10760         SYSTEM_APACHE_COMMONS=TRUE
10761         AC_MSG_RESULT([external])
10762         if test -z $COMMONS_LOGGING_JAR; then
10763             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10764                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10765            elif test -f /usr/share/java/commons-logging.jar; then
10766                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10767             else
10768                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10769             fi
10770         elif ! test -f $COMMONS_LOGGING_JAR; then
10771             AC_MSG_ERROR(commons-logging.jar not found.)
10772         fi
10773     else
10774         AC_MSG_RESULT([internal])
10775         SYSTEM_APACHE_COMMONS=
10776         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10777         NEED_ANT=TRUE
10778     fi
10780 AC_SUBST(SYSTEM_APACHE_COMMONS)
10781 AC_SUBST(COMMONS_LOGGING_JAR)
10782 AC_SUBST(COMMONS_LOGGING_VERSION)
10784 # scripting provider for BeanShell?
10785 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10786 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10787     AC_MSG_RESULT([yes])
10788     ENABLE_SCRIPTING_BEANSHELL=TRUE
10790     dnl ===================================================================
10791     dnl Check for system beanshell
10792     dnl ===================================================================
10793     AC_MSG_CHECKING([which beanshell to use])
10794     if test "$with_system_beanshell" = "yes"; then
10795         AC_MSG_RESULT([external])
10796         SYSTEM_BSH=TRUE
10797         if test -z $BSH_JAR; then
10798             BSH_JAR=/usr/share/java/bsh.jar
10799         fi
10800         if ! test -f $BSH_JAR; then
10801             AC_MSG_ERROR(bsh.jar not found.)
10802         fi
10803     else
10804         AC_MSG_RESULT([internal])
10805         SYSTEM_BSH=
10806         BUILD_TYPE="$BUILD_TYPE BSH"
10807     fi
10808 else
10809     AC_MSG_RESULT([no])
10810     ENABLE_SCRIPTING_BEANSHELL=
10811     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10813 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10814 AC_SUBST(SYSTEM_BSH)
10815 AC_SUBST(BSH_JAR)
10817 # scripting provider for JavaScript?
10818 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10819 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10820     AC_MSG_RESULT([yes])
10821     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10823     dnl ===================================================================
10824     dnl Check for system rhino
10825     dnl ===================================================================
10826     AC_MSG_CHECKING([which rhino to use])
10827     if test "$with_system_rhino" = "yes"; then
10828         AC_MSG_RESULT([external])
10829         SYSTEM_RHINO=TRUE
10830         if test -z $RHINO_JAR; then
10831             RHINO_JAR=/usr/share/java/js.jar
10832         fi
10833         if ! test -f $RHINO_JAR; then
10834             AC_MSG_ERROR(js.jar not found.)
10835         fi
10836     else
10837         AC_MSG_RESULT([internal])
10838         SYSTEM_RHINO=
10839         BUILD_TYPE="$BUILD_TYPE RHINO"
10840         NEED_ANT=TRUE
10841     fi
10842 else
10843     AC_MSG_RESULT([no])
10844     ENABLE_SCRIPTING_JAVASCRIPT=
10845     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10847 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10848 AC_SUBST(SYSTEM_RHINO)
10849 AC_SUBST(RHINO_JAR)
10851 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10852 # paths should be added to library search path. So lets put all 64-bit
10853 # platforms there.
10854 supports_multilib=
10855 case "$host_cpu" in
10856 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10857     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10858         supports_multilib="yes"
10859     fi
10860     ;;
10862     ;;
10863 esac
10865 dnl ===================================================================
10866 dnl KDE4 Integration
10867 dnl ===================================================================
10869 KDE4_CFLAGS=""
10870 KDE4_LIBS=""
10871 QMAKE4="qmake"
10872 MOC4="moc"
10873 KDE4_GLIB_CFLAGS=""
10874 KDE4_GLIB_LIBS=""
10875 KDE4_HAVE_GLIB=""
10876 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10877     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10878     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10880     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10881     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10883     if test -n "$supports_multilib"; then
10884         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10885         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10886     fi
10888     if test -n "$QTDIR"; then
10889         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10890         if test -z "$supports_multilib"; then
10891             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10892         else
10893             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10894         fi
10895     fi
10896     if test -n "$QT4DIR"; then
10897         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10898         if test -z "$supports_multilib"; then
10899             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10900         else
10901             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10902         fi
10903     fi
10905     if test -n "$KDEDIR"; then
10906         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10907         if test -z "$supports_multilib"; then
10908             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10909         else
10910             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10911         fi
10912     fi
10913     if test -n "$KDE4DIR"; then
10914         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10915         if test -z "$supports_multilib"; then
10916             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10917         else
10918             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10919         fi
10920     fi
10922     qt4_test_include="Qt/qobject.h"
10923     qt4_test_library="libQtNetwork.so"
10924     kde4_test_include="kwindowsystem.h"
10925     kde4_test_library="libsolid.so"
10927     AC_MSG_CHECKING([for Qt4 headers])
10928     qt4_header_dir="no"
10929     for inc_dir in $qt4_incdirs; do
10930         if test -r "$inc_dir/$qt4_test_include"; then
10931             qt4_header_dir="$inc_dir"
10932             break
10933         fi
10934     done
10936     AC_MSG_RESULT([$qt4_header_dir])
10937     if test "x$qt4_header_dir" = "xno"; then
10938         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10939     fi
10941     dnl Check for qmake
10942     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10943     if test "$QMAKE4" = "no"; then
10944         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10945     else
10946         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10947         if test -z "$qmake4_test_ver"; then
10948             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10949         fi
10950     fi
10952     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10953     AC_MSG_CHECKING([for Qt4 libraries])
10954     qt4_lib_dir="no"
10955     for lib_dir in $qt4_libdirs; do
10956         if test -r "$lib_dir/$qt4_test_library"; then
10957             qt4_lib_dir="$lib_dir"
10958             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10959             break
10960         fi
10961     done
10963     AC_MSG_RESULT([$qt4_lib_dir])
10965     if test "x$qt4_lib_dir" = "xno"; then
10966         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10967     fi
10969     dnl Check for Meta Object Compiler
10971     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10972     MOC4="$MOCQT4"
10973     if test "$MOC4" = "no"; then
10974         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10975         if test "$MOC4" = "no"; then
10976             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10977 the root of your Qt installation by exporting QT4DIR before running "configure".])
10978         fi
10979     fi
10981     dnl Check for KDE4 headers
10982     AC_MSG_CHECKING([for KDE4 headers])
10983     kde4_incdir="no"
10984     for kde4_check in $kde4_incdirs; do
10985         if test -r "$kde4_check/$kde4_test_include"; then
10986             kde4_incdir="$kde4_check"
10987             break
10988         fi
10989     done
10990     AC_MSG_RESULT([$kde4_incdir])
10991     if test "x$kde4_incdir" = "xno"; then
10992         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10993     fi
10994     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10996     dnl Check for KDE4 libraries
10997     AC_MSG_CHECKING([for KDE4 libraries])
10998     kde4_libdir="no"
10999     for kde4_check in $kde4_libdirs; do
11000         if test -r "$kde4_check/$kde4_test_library"; then
11001             kde4_libdir="$kde4_check"
11002             break
11003         fi
11004     done
11006     AC_MSG_RESULT([$kde4_libdir])
11007     if test "x$kde4_libdir" = "xno"; then
11008         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11009     fi
11011     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11012     if ! test -z "$kde4_incdir"; then
11013         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11014     else
11015         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11016     fi
11018     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11019     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11020     FilterLibs "$KDE4_LIBS"
11021     KDE4_LIBS="$filteredlibs"
11023     AC_LANG_PUSH([C++])
11024     save_CXXFLAGS=$CXXFLAGS
11025     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11026     AC_MSG_CHECKING([whether KDE is >= 4.2])
11027        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11028 #include <kdeversion.h>
11030 int main(int argc, char **argv) {
11031        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11032        else return 1;
11034 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11035     CXXFLAGS=$save_CXXFLAGS
11036     AC_LANG_POP([C++])
11038     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11039     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11040     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11041         [
11042             KDE4_HAVE_GLIB=TRUE
11043             AC_DEFINE(KDE4_HAVE_GLIB,1)
11044             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11045             FilterLibs "${KDE4_GLIB_LIBS}"
11046             KDE4_GLIB_LIBS="${filteredlibs}"
11048             qt4_fix_warning=
11050             AC_LANG_PUSH([C++])
11051             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11052             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11053             #  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
11054             #               ^~~~~~~~~~~~~~~~~~~~~~~
11055             #               vptr for 'QObjectPrivate'
11056             # so temporarily ignore here whichever way would be used to make such errors fatal
11057             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11058             save_CXX=$CXX
11059             CXX=$(printf %s "$CXX" \
11060                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11061             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11062             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11063             save_CXXFLAGS=$CXXFLAGS
11064             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11065             save_LIBS=$LIBS
11066             LIBS="$LIBS $KDE4_LIBS"
11067             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11069             # Prepare meta object data
11070             TSTBASE="tst_exclude_socket_notifiers"
11071             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11072             ln -fs "${TSTMOC}.hxx"
11073             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11075             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11076 #include <cstdlib>
11077 #include "tst_exclude_socket_notifiers.moc"
11079 int main(int argc, char *argv[])
11081     QCoreApplication app(argc, argv);
11082     exit(tst_processEventsExcludeSocket());
11083     return 0;
11085             ]])],[
11086                 AC_MSG_RESULT([yes])
11087             ],[
11088                 AC_MSG_RESULT([no])
11089                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11090                 if test -z "$qt4_fix_warning"; then
11091                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11092                 fi
11093                 qt4_fix_warning=1
11094                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11095                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11097             # Remove meta object data
11098             rm -f "${TSTBASE}."*
11100             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11102             # Prepare meta object data
11103             TSTBASE="tst_exclude_posted_events"
11104             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11105             ln -fs "${TSTMOC}.hxx"
11106             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11108             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11109 #include <cstdlib>
11110 #include "tst_exclude_posted_events.moc"
11112 int main(int argc, char *argv[])
11114     QCoreApplication app(argc, argv);
11115     exit(tst_excludePostedEvents());
11116     return 0;
11118             ]])],[
11119                 AC_MSG_RESULT([yes])
11120             ],[
11121                 AC_MSG_RESULT([no])
11122                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11123                 if test -z "$qt4_fix_warning"; then
11124                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11125                 fi
11126                 qt4_fix_warning=1
11127                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11128             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11130             # Remove meta object data
11131             rm -f "${TSTBASE}."*
11133             if test -n "$qt4_fix_warning"; then
11134                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11135             fi
11137             LIBS=$save_LIBS
11138             CXXFLAGS=$save_CXXFLAGS
11139             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11140             CXX=$save_CXX
11141             AC_LANG_POP([C++])
11142         ],
11143         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11145 AC_SUBST(KDE4_CFLAGS)
11146 AC_SUBST(KDE4_LIBS)
11147 AC_SUBST(MOC4)
11148 AC_SUBST(KDE4_GLIB_CFLAGS)
11149 AC_SUBST(KDE4_GLIB_LIBS)
11150 AC_SUBST(KDE4_HAVE_GLIB)
11152 dnl ===================================================================
11153 dnl QT5 Integration
11154 dnl ===================================================================
11156 QT5_CFLAGS=""
11157 QT5_LIBS=""
11158 QMAKE5="qmake"
11159 MOC5="moc"
11160 QT5_GLIB_CFLAGS=""
11161 QT5_GLIB_LIBS=""
11162 QT5_HAVE_GLIB=""
11163 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11164         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11165         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11166 then
11167     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11168     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11170     if test -n "$supports_multilib"; then
11171         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11172     fi
11174     qt5_test_include="QtWidgets/qapplication.h"
11175     qt5_test_library="libQt5Widgets.so"
11177     dnl Check for qmake5
11178     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11179     if test "$QMAKE5" = "no"; then
11180         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11181     else
11182         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11183         if test -z "$qmake5_test_ver"; then
11184             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11185         fi
11186         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11187         qt5_minimal_minor="6"
11188         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11189             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11190         else
11191             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11192         fi
11193     fi
11195     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11196     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11198     AC_MSG_CHECKING([for Qt5 headers])
11199     qt5_incdir="no"
11200     for inc_dir in $qt5_incdirs; do
11201         if test -r "$inc_dir/$qt5_test_include"; then
11202             qt5_incdir="$inc_dir"
11203             break
11204         fi
11205     done
11206     AC_MSG_RESULT([$qt5_incdir])
11207     if test "x$qt5_incdir" = "xno"; then
11208         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11209     fi
11211     AC_MSG_CHECKING([for Qt5 libraries])
11212     qt5_libdir="no"
11213     for lib_dir in $qt5_libdirs; do
11214         if test -r "$lib_dir/$qt5_test_library"; then
11215             qt5_libdir="$lib_dir"
11216             break
11217         fi
11218     done
11219     AC_MSG_RESULT([$qt5_libdir])
11220     if test "x$qt5_libdir" = "xno"; then
11221         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11222     fi
11224     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11225     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11226     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11228     dnl Check for Meta Object Compiler
11230     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11231     if test "$MOC5" = "no"; then
11232         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11233 the root of your Qt installation by exporting QT5DIR before running "configure".])
11234     fi
11236     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11237     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11238     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11239         [
11240             QT5_HAVE_GLIB=1
11241             AC_DEFINE(QT5_HAVE_GLIB,1)
11242         ],
11243         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11244     )
11246 AC_SUBST(QT5_CFLAGS)
11247 AC_SUBST(QT5_LIBS)
11248 AC_SUBST(MOC5)
11249 AC_SUBST(QT5_GLIB_CFLAGS)
11250 AC_SUBST(QT5_GLIB_LIBS)
11251 AC_SUBST(QT5_HAVE_GLIB)
11253 dnl ===================================================================
11254 dnl KDE5 Integration
11255 dnl ===================================================================
11257 KF5_CFLAGS=""
11258 KF5_LIBS=""
11259 KF5_CONFIG="kf5-config"
11260 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11261         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11262         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11263 then
11264     if test "$OS" = "HAIKU"; then
11265         haiku_arch="`echo $RTL_ARCH | tr X x`"
11266         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11267         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11268     fi
11270     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11271     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11272     if test -n "$supports_multilib"; then
11273         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11274     fi
11276     kf5_test_include="KF5/kcoreaddons_version.h"
11277     kf5_test_library="libKF5CoreAddons.so"
11278     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11280     dnl kf5 KDE4 support compatibility installed
11281     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11282     if test "$KF5_CONFIG" != "no"; then
11283         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11284         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11285     fi
11287     dnl Check for KF5 headers
11288     AC_MSG_CHECKING([for KF5 headers])
11289     kf5_incdir="no"
11290     for kf5_check in $kf5_incdirs; do
11291         if test -r "$kf5_check/$kf5_test_include"; then
11292             kf5_incdir="$kf5_check/KF5"
11293             break
11294         fi
11295     done
11296     AC_MSG_RESULT([$kf5_incdir])
11297     if test "x$kf5_incdir" = "xno"; then
11298         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11299     fi
11301     dnl Check for KF5 libraries
11302     AC_MSG_CHECKING([for KF5 libraries])
11303     kf5_libdir="no"
11304     for kf5_check in $kf5_libdirs; do
11305         if test -r "$kf5_check/$kf5_test_library"; then
11306             kf5_libdir="$kf5_check"
11307             break
11308         fi
11309     done
11311     AC_MSG_RESULT([$kf5_libdir])
11312     if test "x$kf5_libdir" = "xno"; then
11313         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11314     fi
11316     if test "$USING_X11" = TRUE; then
11317         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11318     fi
11320     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"
11321     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11322     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11324     if test "$USING_X11" = TRUE; then
11325         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11326     fi
11328     AC_LANG_PUSH([C++])
11329     save_CXXFLAGS=$CXXFLAGS
11330     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11331     AC_MSG_CHECKING([whether KDE is >= 5.0])
11332        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11333 #include <kcoreaddons_version.h>
11335 int main(int argc, char **argv) {
11336        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11337        else return 1;
11339        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11340     CXXFLAGS=$save_CXXFLAGS
11341     AC_LANG_POP([C++])
11343 AC_SUBST(KF5_CFLAGS)
11344 AC_SUBST(KF5_LIBS)
11346 dnl ===================================================================
11347 dnl Test whether to include Evolution 2 support
11348 dnl ===================================================================
11349 AC_MSG_CHECKING([whether to enable evolution 2 support])
11350 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11351     AC_MSG_RESULT([yes])
11352     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11353     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11354     FilterLibs "${GOBJECT_LIBS}"
11355     GOBJECT_LIBS="${filteredlibs}"
11356     ENABLE_EVOAB2="TRUE"
11357 else
11358     ENABLE_EVOAB2=""
11359     AC_MSG_RESULT([no])
11361 AC_SUBST(ENABLE_EVOAB2)
11362 AC_SUBST(GOBJECT_CFLAGS)
11363 AC_SUBST(GOBJECT_LIBS)
11365 dnl ===================================================================
11366 dnl Test which themes to include
11367 dnl ===================================================================
11368 AC_MSG_CHECKING([which themes to include])
11369 # if none given use default subset of available themes
11370 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11371     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11374 WITH_THEMES=""
11375 if test "x$with_theme" != "xno"; then
11376     for theme in $with_theme; do
11377         case $theme in
11378         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11379         default) real_theme=colibre ;;
11380         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11381         esac
11382         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11383     done
11385 AC_MSG_RESULT([$WITH_THEMES])
11386 AC_SUBST([WITH_THEMES])
11387 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11388 for theme in $with_theme; do
11389     case $theme in
11390     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11391     *) ;;
11392     esac
11393 done
11395 dnl ===================================================================
11396 dnl Test whether to integrate helppacks into the product's installer
11397 dnl ===================================================================
11398 AC_MSG_CHECKING([for helppack integration])
11399 if test "$with_helppack_integration" = "no"; then
11400     AC_MSG_RESULT([no integration])
11401 else
11402     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11403     AC_MSG_RESULT([integration])
11406 ###############################################################################
11407 # Extensions checking
11408 ###############################################################################
11409 AC_MSG_CHECKING([for extensions integration])
11410 if test "x$enable_extension_integration" != "xno"; then
11411     WITH_EXTENSION_INTEGRATION=TRUE
11412     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11413     AC_MSG_RESULT([yes, use integration])
11414 else
11415     WITH_EXTENSION_INTEGRATION=
11416     AC_MSG_RESULT([no, do not integrate])
11418 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11420 dnl Should any extra extensions be included?
11421 dnl There are standalone tests for each of these below.
11422 WITH_EXTRA_EXTENSIONS=
11423 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11425 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11426 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11427 if test "x$with_java" != "xno"; then
11428     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11429     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11432 AC_MSG_CHECKING([whether to build opens___.ttf])
11433 if test "$enable_build_opensymbol" = "yes"; then
11434     AC_MSG_RESULT([yes])
11435     AC_PATH_PROG(FONTFORGE, fontforge)
11436     if test -z "$FONTFORGE"; then
11437         AC_MSG_ERROR([fontforge not installed])
11438     fi
11439 else
11440     AC_MSG_RESULT([no])
11441     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11442     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11444 AC_SUBST(OPENSYMBOL_TTF)
11445 AC_SUBST(FONTFORGE)
11447 dnl ===================================================================
11448 dnl Test whether to include fonts
11449 dnl ===================================================================
11450 AC_MSG_CHECKING([whether to include third-party fonts])
11451 if test "$with_fonts" != "no"; then
11452     AC_MSG_RESULT([yes])
11453     WITH_FONTS=TRUE
11454     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11455     AC_DEFINE(HAVE_MORE_FONTS)
11456 else
11457     AC_MSG_RESULT([no])
11458     WITH_FONTS=
11459     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11461 AC_SUBST(WITH_FONTS)
11464 dnl ===================================================================
11465 dnl Test whether to enable online update service
11466 dnl ===================================================================
11467 AC_MSG_CHECKING([whether to enable online update])
11468 ENABLE_ONLINE_UPDATE=
11469 ENABLE_ONLINE_UPDATE_MAR=
11470 UPDATE_CONFIG=
11471 if test "$enable_online_update" = ""; then
11472     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11473         AC_MSG_RESULT([yes])
11474         ENABLE_ONLINE_UPDATE="TRUE"
11475     else
11476         AC_MSG_RESULT([no])
11477     fi
11478 else
11479     if test "$enable_online_update" = "mar"; then
11480         AC_MSG_RESULT([yes - MAR-based online update])
11481         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11482         if test "$with_update_config" = ""; then
11483             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11484         fi
11485         UPDATE_CONFIG="$with_update_config"
11486         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11487     elif test "$enable_online_update" = "yes"; then
11488         AC_MSG_RESULT([yes])
11489         ENABLE_ONLINE_UPDATE="TRUE"
11490     else
11491         AC_MSG_RESULT([no])
11492     fi
11494 AC_SUBST(ENABLE_ONLINE_UPDATE)
11495 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11496 AC_SUBST(UPDATE_CONFIG)
11498 dnl ===================================================================
11499 dnl Test whether we need bzip2
11500 dnl ===================================================================
11501 SYSTEM_BZIP2=
11502 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11503     AC_MSG_CHECKING([whether to use system bzip2])
11504     if test "$with_system_bzip2" = yes; then
11505         SYSTEM_BZIP2=TRUE
11506         AC_MSG_RESULT([yes])
11507         PKG_CHECK_MODULES(BZIP2, bzip2)
11508         FilterLibs "${BZIP2_LIBS}"
11509         BZIP2_LIBS="${filteredlibs}"
11510     else
11511         AC_MSG_RESULT([no])
11512         BUILD_TYPE="$BUILD_TYPE BZIP2"
11513     fi
11515 AC_SUBST(SYSTEM_BZIP2)
11516 AC_SUBST(BZIP2_CFLAGS)
11517 AC_SUBST(BZIP2_LIBS)
11519 dnl ===================================================================
11520 dnl Test whether to enable extension update
11521 dnl ===================================================================
11522 AC_MSG_CHECKING([whether to enable extension update])
11523 ENABLE_EXTENSION_UPDATE=
11524 if test "x$enable_extension_update" = "xno"; then
11525     AC_MSG_RESULT([no])
11526 else
11527     AC_MSG_RESULT([yes])
11528     ENABLE_EXTENSION_UPDATE="TRUE"
11529     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11530     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11532 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11535 dnl ===================================================================
11536 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11537 dnl ===================================================================
11538 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11539 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11540     AC_MSG_RESULT([no])
11541     ENABLE_SILENT_MSI=
11542 else
11543     AC_MSG_RESULT([yes])
11544     ENABLE_SILENT_MSI=TRUE
11545     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11547 AC_SUBST(ENABLE_SILENT_MSI)
11549 AC_MSG_CHECKING([whether and how to use Xinerama])
11550 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11551     if test "$x_libraries" = "default_x_libraries"; then
11552         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11553         if test "x$XINERAMALIB" = x; then
11554            XINERAMALIB="/usr/lib"
11555         fi
11556     else
11557         XINERAMALIB="$x_libraries"
11558     fi
11559     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11560         # we have both versions, let the user decide but use the dynamic one
11561         # per default
11562         USE_XINERAMA=TRUE
11563         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11564             XINERAMA_LINK=dynamic
11565         else
11566             XINERAMA_LINK=static
11567         fi
11568     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11569         # we have only the dynamic version
11570         USE_XINERAMA=TRUE
11571         XINERAMA_LINK=dynamic
11572     elif test -e "$XINERAMALIB/libXinerama.a"; then
11573         # static version
11574         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11575             USE_XINERAMA=TRUE
11576             XINERAMA_LINK=static
11577         else
11578             USE_XINERAMA=
11579             XINERAMA_LINK=none
11580         fi
11581     else
11582         # no Xinerama
11583         USE_XINERAMA=
11584         XINERAMA_LINK=none
11585     fi
11586     if test "$USE_XINERAMA" = "TRUE"; then
11587         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11588         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11589             [AC_MSG_ERROR(Xinerama header not found.)], [])
11590         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11591         if test "x$XEXTLIB" = x; then
11592            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11593         fi
11594         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11595         if test "$_os" = "FreeBSD"; then
11596             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11597         fi
11598         if test "$_os" = "Linux"; then
11599             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11600         fi
11601         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11602             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11603     else
11604         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11605     fi
11606 else
11607     USE_XINERAMA=
11608     XINERAMA_LINK=none
11609     AC_MSG_RESULT([no])
11611 AC_SUBST(USE_XINERAMA)
11612 AC_SUBST(XINERAMA_LINK)
11614 dnl ===================================================================
11615 dnl Test whether to build cairo or rely on the system version
11616 dnl ===================================================================
11618 if test "$USING_X11" = TRUE; then
11619     # Used in vcl/Library_vclplug_gen.mk
11620     test_cairo=yes
11623 if test "$test_cairo" = "yes"; then
11624     AC_MSG_CHECKING([whether to use the system cairo])
11626     : ${with_system_cairo:=$with_system_libs}
11627     if test "$with_system_cairo" = "yes"; then
11628         SYSTEM_CAIRO=TRUE
11629         AC_MSG_RESULT([yes])
11631         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11632         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11633         FilterLibs "${CAIRO_LIBS}"
11634         CAIRO_LIBS="${filteredlibs}"
11636         if test "$test_xrender" = "yes"; then
11637             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11638             AC_LANG_PUSH([C])
11639             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11640 #ifdef PictStandardA8
11641 #else
11642       return fail;
11643 #endif
11644 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11646             AC_LANG_POP([C])
11647         fi
11648     else
11649         SYSTEM_CAIRO=
11650         AC_MSG_RESULT([no])
11652         BUILD_TYPE="$BUILD_TYPE CAIRO"
11653     fi
11656 AC_SUBST(SYSTEM_CAIRO)
11657 AC_SUBST(CAIRO_CFLAGS)
11658 AC_SUBST(CAIRO_LIBS)
11660 dnl ===================================================================
11661 dnl Test whether to use avahi
11662 dnl ===================================================================
11663 if test "$_os" = "WINNT"; then
11664     # Windows uses bundled mDNSResponder
11665     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11666 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11667     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11668                       [ENABLE_AVAHI="TRUE"])
11669     AC_DEFINE(HAVE_FEATURE_AVAHI)
11670     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11671     FilterLibs "${AVAHI_LIBS}"
11672     AVAHI_LIBS="${filteredlibs}"
11675 AC_SUBST(ENABLE_AVAHI)
11676 AC_SUBST(AVAHI_CFLAGS)
11677 AC_SUBST(AVAHI_LIBS)
11679 dnl ===================================================================
11680 dnl Test whether to use liblangtag
11681 dnl ===================================================================
11682 SYSTEM_LIBLANGTAG=
11683 AC_MSG_CHECKING([whether to use system liblangtag])
11684 if test "$with_system_liblangtag" = yes; then
11685     SYSTEM_LIBLANGTAG=TRUE
11686     AC_MSG_RESULT([yes])
11687     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11688     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11689     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11690     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11691     FilterLibs "${LIBLANGTAG_LIBS}"
11692     LIBLANGTAG_LIBS="${filteredlibs}"
11693 else
11694     SYSTEM_LIBLANGTAG=
11695     AC_MSG_RESULT([no])
11696     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11697     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11698     if test "$COM" = "MSC"; then
11699         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11700     else
11701         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11702     fi
11704 AC_SUBST(SYSTEM_LIBLANGTAG)
11705 AC_SUBST(LIBLANGTAG_CFLAGS)
11706 AC_SUBST(LIBLANGTAG_LIBS)
11708 dnl ===================================================================
11709 dnl Test whether to build libpng or rely on the system version
11710 dnl ===================================================================
11712 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11714 dnl ===================================================================
11715 dnl Check for runtime JVM search path
11716 dnl ===================================================================
11717 if test "$ENABLE_JAVA" != ""; then
11718     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11719     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11720         AC_MSG_RESULT([yes])
11721         if ! test -d "$with_jvm_path"; then
11722             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11723         fi
11724         if ! test -d "$with_jvm_path"jvm; then
11725             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11726         fi
11727         JVM_ONE_PATH_CHECK="$with_jvm_path"
11728         AC_SUBST(JVM_ONE_PATH_CHECK)
11729     else
11730         AC_MSG_RESULT([no])
11731     fi
11734 dnl ===================================================================
11735 dnl Test for the presence of Ant and that it works
11736 dnl ===================================================================
11738 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11739     ANT_HOME=; export ANT_HOME
11740     WITH_ANT_HOME=; export WITH_ANT_HOME
11741     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11742         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11743             if test "$_os" = "WINNT"; then
11744                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11745             else
11746                 with_ant_home="$LODE_HOME/opt/ant"
11747             fi
11748         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11749             with_ant_home="$LODE_HOME/opt/ant"
11750         fi
11751     fi
11752     if test -z "$with_ant_home"; then
11753         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11754     else
11755         if test "$_os" = "WINNT"; then
11756             # AC_PATH_PROGS needs unix path
11757             with_ant_home=`cygpath -u "$with_ant_home"`
11758         fi
11759         AbsolutePath "$with_ant_home"
11760         with_ant_home=$absolute_path
11761         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11762         WITH_ANT_HOME=$with_ant_home
11763         ANT_HOME=$with_ant_home
11764     fi
11766     if test -z "$ANT"; then
11767         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11768     else
11769         # resolve relative or absolute symlink
11770         while test -h "$ANT"; do
11771             a_cwd=`pwd`
11772             a_basename=`basename "$ANT"`
11773             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11774             cd "`dirname "$ANT"`"
11775             cd "`dirname "$a_script"`"
11776             ANT="`pwd`"/"`basename "$a_script"`"
11777             cd "$a_cwd"
11778         done
11780         AC_MSG_CHECKING([if $ANT works])
11781         mkdir -p conftest.dir
11782         a_cwd=$(pwd)
11783         cd conftest.dir
11784         cat > conftest.java << EOF
11785         public class conftest {
11786             int testmethod(int a, int b) {
11787                     return a + b;
11788             }
11789         }
11792         cat > conftest.xml << EOF
11793         <project name="conftest" default="conftest">
11794         <target name="conftest">
11795             <javac srcdir="." includes="conftest.java">
11796             </javac>
11797         </target>
11798         </project>
11801         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11802         if test $? = 0 -a -f ./conftest.class; then
11803             AC_MSG_RESULT([Ant works])
11804             if test -z "$WITH_ANT_HOME"; then
11805                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11806                 if test -z "$ANT_HOME"; then
11807                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11808                 fi
11809             else
11810                 ANT_HOME="$WITH_ANT_HOME"
11811             fi
11812         else
11813             echo "configure: Ant test failed" >&5
11814             cat conftest.java >&5
11815             cat conftest.xml >&5
11816             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11817         fi
11818         cd "$a_cwd"
11819         rm -fr conftest.dir
11820     fi
11821     if test -z "$ANT_HOME"; then
11822         ANT_HOME="NO_ANT_HOME"
11823     else
11824         PathFormat "$ANT_HOME"
11825         ANT_HOME="$formatted_path"
11826         PathFormat "$ANT"
11827         ANT="$formatted_path"
11828     fi
11829     AC_SUBST(ANT_HOME)
11830     AC_SUBST(ANT)
11832     dnl Checking for ant.jar
11833     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11834         AC_MSG_CHECKING([Ant lib directory])
11835         if test -f $ANT_HOME/lib/ant.jar; then
11836             ANT_LIB="$ANT_HOME/lib"
11837         else
11838             if test -f $ANT_HOME/ant.jar; then
11839                 ANT_LIB="$ANT_HOME"
11840             else
11841                 if test -f /usr/share/java/ant.jar; then
11842                     ANT_LIB=/usr/share/java
11843                 else
11844                     if test -f /usr/share/ant-core/lib/ant.jar; then
11845                         ANT_LIB=/usr/share/ant-core/lib
11846                     else
11847                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11848                             ANT_LIB="$ANT_HOME/lib/ant"
11849                         else
11850                             if test -f /usr/share/lib/ant/ant.jar; then
11851                                 ANT_LIB=/usr/share/lib/ant
11852                             else
11853                                 AC_MSG_ERROR([Ant libraries not found!])
11854                             fi
11855                         fi
11856                     fi
11857                 fi
11858             fi
11859         fi
11860         PathFormat "$ANT_LIB"
11861         ANT_LIB="$formatted_path"
11862         AC_MSG_RESULT([Ant lib directory found.])
11863     fi
11864     AC_SUBST(ANT_LIB)
11866     ant_minver=1.6.0
11867     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11869     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11870     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11871     ant_version_major=`echo $ant_version | cut -d. -f1`
11872     ant_version_minor=`echo $ant_version | cut -d. -f2`
11873     echo "configure: ant_version $ant_version " >&5
11874     echo "configure: ant_version_major $ant_version_major " >&5
11875     echo "configure: ant_version_minor $ant_version_minor " >&5
11876     if test "$ant_version_major" -ge "2"; then
11877         AC_MSG_RESULT([yes, $ant_version])
11878     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11879         AC_MSG_RESULT([yes, $ant_version])
11880     else
11881         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11882     fi
11884     rm -f conftest* core core.* *.core
11887 OOO_JUNIT_JAR=
11888 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11889     AC_MSG_CHECKING([for JUnit 4])
11890     if test "$with_junit" = "yes"; then
11891         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11892             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11893         elif test -e /usr/share/java/junit4.jar; then
11894             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11895         else
11896            if test -e /usr/share/lib/java/junit.jar; then
11897               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11898            else
11899               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11900            fi
11901         fi
11902     else
11903         OOO_JUNIT_JAR=$with_junit
11904     fi
11905     if test "$_os" = "WINNT"; then
11906         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11907     fi
11908     printf 'import org.junit.Before;' > conftest.java
11909     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11910         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11911     else
11912         AC_MSG_ERROR(
11913 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11914  specify its pathname via --with-junit=..., or disable it via --without-junit])
11915     fi
11916     rm -f conftest.class conftest.java
11917     if test $OOO_JUNIT_JAR != ""; then
11918     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11919     fi
11921 AC_SUBST(OOO_JUNIT_JAR)
11923 HAMCREST_JAR=
11924 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11925     AC_MSG_CHECKING([for included Hamcrest])
11926     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11927     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11928         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11929     else
11930         AC_MSG_RESULT([Not included])
11931         AC_MSG_CHECKING([for standalone hamcrest jar.])
11932         if test "$with_hamcrest" = "yes"; then
11933             if test -e /usr/share/lib/java/hamcrest.jar; then
11934                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11935             elif test -e /usr/share/java/hamcrest/core.jar; then
11936                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11937             else
11938                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11939             fi
11940         else
11941             HAMCREST_JAR=$with_hamcrest
11942         fi
11943         if test "$_os" = "WINNT"; then
11944             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11945         fi
11946         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11947             AC_MSG_RESULT([$HAMCREST_JAR])
11948         else
11949             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),
11950                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11951         fi
11952     fi
11953     rm -f conftest.class conftest.java
11955 AC_SUBST(HAMCREST_JAR)
11958 AC_SUBST(SCPDEFS)
11961 # check for wget and curl
11963 WGET=
11964 CURL=
11966 if test "$enable_fetch_external" != "no"; then
11968 CURL=`which curl 2>/dev/null`
11970 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11971     # wget new enough?
11972     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11973     if test $? -eq 0; then
11974         WGET=$i
11975         break
11976     fi
11977 done
11979 if test -z "$WGET" -a -z "$CURL"; then
11980     AC_MSG_ERROR([neither wget nor curl found!])
11985 AC_SUBST(WGET)
11986 AC_SUBST(CURL)
11989 # check for sha256sum
11991 SHA256SUM=
11993 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11994     eval "$i -a 256 --version" > /dev/null 2>&1
11995     ret=$?
11996     if test $ret -eq 0; then
11997         SHA256SUM="$i -a 256"
11998         break
11999     fi
12000 done
12002 if test -z "$SHA256SUM"; then
12003     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12004         eval "$i --version" > /dev/null 2>&1
12005         ret=$?
12006         if test $ret -eq 0; then
12007             SHA256SUM=$i
12008             break
12009         fi
12010     done
12013 if test -z "$SHA256SUM"; then
12014     AC_MSG_ERROR([no sha256sum found!])
12017 AC_SUBST(SHA256SUM)
12019 dnl ===================================================================
12020 dnl Dealing with l10n options
12021 dnl ===================================================================
12022 AC_MSG_CHECKING([which languages to be built])
12023 # get list of all languages
12024 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12025 # the sed command does the following:
12026 #   + if a line ends with a backslash, append the next line to it
12027 #   + adds " on the beginning of the value (after =)
12028 #   + adds " at the end of the value
12029 #   + removes en-US; we want to put it on the beginning
12030 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12031 [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)]
12032 ALL_LANGS="en-US $completelangiso"
12033 # check the configured localizations
12034 WITH_LANG="$with_lang"
12036 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12037 # (Norwegian is "nb" and "nn".)
12038 if test "$WITH_LANG" = "no"; then
12039     WITH_LANG=
12042 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12043     AC_MSG_RESULT([en-US])
12044 else
12045     AC_MSG_RESULT([$WITH_LANG])
12046     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12047     if test -z "$MSGFMT"; then
12048         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12049             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12050         elif test -x "/opt/lo/bin/msgfmt"; then
12051             MSGFMT="/opt/lo/bin/msgfmt"
12052         else
12053             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12054             if test -z "$MSGFMT"; then
12055                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12056             fi
12057         fi
12058     fi
12059     if test -z "$MSGUNIQ"; then
12060         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12061             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12062         elif test -x "/opt/lo/bin/msguniq"; then
12063             MSGUNIQ="/opt/lo/bin/msguniq"
12064         else
12065             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12066             if test -z "$MSGUNIQ"; then
12067                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12068             fi
12069         fi
12070     fi
12072 AC_SUBST(MSGFMT)
12073 AC_SUBST(MSGUNIQ)
12074 # check that the list is valid
12075 for lang in $WITH_LANG; do
12076     test "$lang" = "ALL" && continue
12077     # need to check for the exact string, so add space before and after the list of all languages
12078     for vl in $ALL_LANGS; do
12079         if test "$vl" = "$lang"; then
12080            break
12081         fi
12082     done
12083     if test "$vl" != "$lang"; then
12084         # if you're reading this - you prolly quoted your languages remove the quotes ...
12085         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12086     fi
12087 done
12088 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12089     echo $WITH_LANG | grep -q en-US
12090     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12092 # list with substituted ALL
12093 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12094 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12095 test "$WITH_LANG" = "en-US" && WITH_LANG=
12096 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12097     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12098     ALL_LANGS=`echo $ALL_LANGS qtz`
12100 AC_SUBST(ALL_LANGS)
12101 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12102 AC_SUBST(WITH_LANG)
12103 AC_SUBST(WITH_LANG_LIST)
12104 AC_SUBST(GIT_NEEDED_SUBMODULES)
12106 WITH_POOR_HELP_LOCALIZATIONS=
12107 if test -d "$SRC_ROOT/translations/source"; then
12108     for l in `ls -1 $SRC_ROOT/translations/source`; do
12109         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12110             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12111         fi
12112     done
12114 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12116 if test -n "$with_locales"; then
12117     WITH_LOCALES="$with_locales"
12119     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12120     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12121     # config_host/config_locales.h.in
12122     for locale in $WITH_LOCALES; do
12123         lang=${locale%_*}
12125         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12127         case $lang in
12128         hi|mr*ne)
12129             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12130             ;;
12131         bg|ru)
12132             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12133             ;;
12134         esac
12135     done
12136 else
12137     AC_DEFINE(WITH_LOCALE_ALL)
12139 AC_SUBST(WITH_LOCALES)
12141 dnl git submodule update --reference
12142 dnl ===================================================================
12143 if test -n "${GIT_REFERENCE_SRC}"; then
12144     for repo in ${GIT_NEEDED_SUBMODULES}; do
12145         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12146             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12147         fi
12148     done
12150 AC_SUBST(GIT_REFERENCE_SRC)
12152 dnl git submodules linked dirs
12153 dnl ===================================================================
12154 if test -n "${GIT_LINK_SRC}"; then
12155     for repo in ${GIT_NEEDED_SUBMODULES}; do
12156         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12157             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12158         fi
12159     done
12161 AC_SUBST(GIT_LINK_SRC)
12163 dnl branding
12164 dnl ===================================================================
12165 AC_MSG_CHECKING([for alternative branding images directory])
12166 # initialize mapped arrays
12167 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12168 brand_files="$BRAND_INTRO_IMAGES about.svg"
12170 if test -z "$with_branding" -o "$with_branding" = "no"; then
12171     AC_MSG_RESULT([none])
12172     DEFAULT_BRAND_IMAGES="$brand_files"
12173 else
12174     if ! test -d $with_branding ; then
12175         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12176     else
12177         AC_MSG_RESULT([$with_branding])
12178         CUSTOM_BRAND_DIR="$with_branding"
12179         for lfile in $brand_files
12180         do
12181             if ! test -f $with_branding/$lfile ; then
12182                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12183                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12184             else
12185                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12186             fi
12187         done
12188         check_for_progress="yes"
12189     fi
12191 AC_SUBST([BRAND_INTRO_IMAGES])
12192 AC_SUBST([CUSTOM_BRAND_DIR])
12193 AC_SUBST([CUSTOM_BRAND_IMAGES])
12194 AC_SUBST([DEFAULT_BRAND_IMAGES])
12197 AC_MSG_CHECKING([for 'intro' progress settings])
12198 PROGRESSBARCOLOR=
12199 PROGRESSSIZE=
12200 PROGRESSPOSITION=
12201 PROGRESSFRAMECOLOR=
12202 PROGRESSTEXTCOLOR=
12203 PROGRESSTEXTBASELINE=
12205 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12206     source "$with_branding/progress.conf"
12207     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12208 else
12209     AC_MSG_RESULT([none])
12212 AC_SUBST(PROGRESSBARCOLOR)
12213 AC_SUBST(PROGRESSSIZE)
12214 AC_SUBST(PROGRESSPOSITION)
12215 AC_SUBST(PROGRESSFRAMECOLOR)
12216 AC_SUBST(PROGRESSTEXTCOLOR)
12217 AC_SUBST(PROGRESSTEXTBASELINE)
12220 AC_MSG_CHECKING([for extra build ID])
12221 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12222     EXTRA_BUILDID="$with_extra_buildid"
12224 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12225 if test -n "$EXTRA_BUILDID" ; then
12226     AC_MSG_RESULT([$EXTRA_BUILDID])
12227 else
12228     AC_MSG_RESULT([not set])
12230 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12232 OOO_VENDOR=
12233 AC_MSG_CHECKING([for vendor])
12234 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12235     OOO_VENDOR="$USERNAME"
12237     if test -z "$OOO_VENDOR"; then
12238         OOO_VENDOR="$USER"
12239     fi
12241     if test -z "$OOO_VENDOR"; then
12242         OOO_VENDOR="`id -u -n`"
12243     fi
12245     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12246 else
12247     OOO_VENDOR="$with_vendor"
12248     AC_MSG_RESULT([$OOO_VENDOR])
12250 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12251 AC_SUBST(OOO_VENDOR)
12253 if test "$_os" = "Android" ; then
12254     ANDROID_PACKAGE_NAME=
12255     AC_MSG_CHECKING([for Android package name])
12256     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12257         if test -n "$ENABLE_DEBUG"; then
12258             # Default to the package name that makes ndk-gdb happy.
12259             ANDROID_PACKAGE_NAME="org.libreoffice"
12260         else
12261             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12262         fi
12264         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12265     else
12266         ANDROID_PACKAGE_NAME="$with_android_package_name"
12267         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12268     fi
12269     AC_SUBST(ANDROID_PACKAGE_NAME)
12272 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12273 if test "$with_compat_oowrappers" = "yes"; then
12274     WITH_COMPAT_OOWRAPPERS=TRUE
12275     AC_MSG_RESULT(yes)
12276 else
12277     WITH_COMPAT_OOWRAPPERS=
12278     AC_MSG_RESULT(no)
12280 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12282 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12283 AC_MSG_CHECKING([for install dirname])
12284 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12285     INSTALLDIRNAME="$with_install_dirname"
12287 AC_MSG_RESULT([$INSTALLDIRNAME])
12288 AC_SUBST(INSTALLDIRNAME)
12290 AC_MSG_CHECKING([for prefix])
12291 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12292 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12293 PREFIXDIR="$prefix"
12294 AC_MSG_RESULT([$PREFIXDIR])
12295 AC_SUBST(PREFIXDIR)
12297 LIBDIR=[$(eval echo $(eval echo $libdir))]
12298 AC_SUBST(LIBDIR)
12300 DATADIR=[$(eval echo $(eval echo $datadir))]
12301 AC_SUBST(DATADIR)
12303 MANDIR=[$(eval echo $(eval echo $mandir))]
12304 AC_SUBST(MANDIR)
12306 DOCDIR=[$(eval echo $(eval echo $docdir))]
12307 AC_SUBST(DOCDIR)
12309 BINDIR=[$(eval echo $(eval echo $bindir))]
12310 AC_SUBST(BINDIR)
12312 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12313 AC_SUBST(INSTALLDIR)
12315 TESTINSTALLDIR="${BUILDDIR}/test-install"
12316 AC_SUBST(TESTINSTALLDIR)
12319 # ===================================================================
12320 # OAuth2 id and secrets
12321 # ===================================================================
12323 AC_MSG_CHECKING([for Google Drive client id and secret])
12324 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12325     AC_MSG_RESULT([not set])
12326     GDRIVE_CLIENT_ID="\"\""
12327     GDRIVE_CLIENT_SECRET="\"\""
12328 else
12329     AC_MSG_RESULT([set])
12330     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12331     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12333 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12334 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12336 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12337 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12338     AC_MSG_RESULT([not set])
12339     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12340     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12341 else
12342     AC_MSG_RESULT([set])
12343     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12344     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12346 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12347 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12349 AC_MSG_CHECKING([for OneDrive client id and secret])
12350 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12351     AC_MSG_RESULT([not set])
12352     ONEDRIVE_CLIENT_ID="\"\""
12353     ONEDRIVE_CLIENT_SECRET="\"\""
12354 else
12355     AC_MSG_RESULT([set])
12356     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12357     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12359 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12360 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12363 dnl ===================================================================
12364 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12365 dnl --enable-dependency-tracking configure option
12366 dnl ===================================================================
12367 AC_MSG_CHECKING([whether to enable dependency tracking])
12368 if test "$enable_dependency_tracking" = "no"; then
12369     nodep=TRUE
12370     AC_MSG_RESULT([no])
12371 else
12372     AC_MSG_RESULT([yes])
12374 AC_SUBST(nodep)
12376 dnl ===================================================================
12377 dnl Number of CPUs to use during the build
12378 dnl ===================================================================
12379 AC_MSG_CHECKING([for number of processors to use])
12380 # plain --with-parallelism is just the default
12381 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12382     if test "$with_parallelism" = "no"; then
12383         PARALLELISM=0
12384     else
12385         PARALLELISM=$with_parallelism
12386     fi
12387 else
12388     if test "$enable_icecream" = "yes"; then
12389         PARALLELISM="10"
12390     else
12391         case `uname -s` in
12393         Darwin|FreeBSD|NetBSD|OpenBSD)
12394             PARALLELISM=`sysctl -n hw.ncpu`
12395             ;;
12397         Linux)
12398             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12399         ;;
12400         # what else than above does profit here *and* has /proc?
12401         *)
12402             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12403             ;;
12404         esac
12406         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12407         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12408     fi
12411 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12412     if test -z "$with_parallelism"; then
12413             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12414             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12415             PARALLELISM="1"
12416     else
12417         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."
12418     fi
12421 if test $PARALLELISM -eq 0; then
12422     AC_MSG_RESULT([explicit make -j option needed])
12423 else
12424     AC_MSG_RESULT([$PARALLELISM])
12426 AC_SUBST(PARALLELISM)
12428 IWYU_PATH="$with_iwyu"
12429 AC_SUBST(IWYU_PATH)
12430 if test ! -z "$IWYU_PATH"; then
12431     if test ! -f "$IWYU_PATH"; then
12432         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12433     fi
12437 # Set up ILIB for MSVC build
12439 ILIB1=
12440 if test "$build_os" = "cygwin"; then
12441     ILIB="."
12442     if test -n "$JAVA_HOME"; then
12443         ILIB="$ILIB;$JAVA_HOME/lib"
12444     fi
12445     ILIB1=-link
12446     if test "$BITNESS_OVERRIDE" = 64; then
12447         ILIB="$ILIB;$COMPATH/lib/x64"
12448         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12449         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12450         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12451         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12452             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12453             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12454         fi
12455         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12456         ucrtlibpath_formatted=$formatted_path
12457         ILIB="$ILIB;$ucrtlibpath_formatted"
12458         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12459     else
12460         ILIB="$ILIB;$COMPATH/lib/x86"
12461         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12462         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12463         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12464         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12465             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12466             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12467         fi
12468         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12469         ucrtlibpath_formatted=$formatted_path
12470         ILIB="$ILIB;$ucrtlibpath_formatted"
12471         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12472     fi
12473     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12474         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12475     else
12476         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12477     fi
12479     AC_SUBST(ILIB)
12482 AC_MSG_CHECKING([whether $CXX supports inline variables])
12483 AC_LANG_PUSH([C++])
12484 save_CXXFLAGS=$CXXFLAGS
12485 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12486 if test "$build_os" = cygwin; then
12487     save_LIB=$LIB
12488     export LIB=$ILIB
12490 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12491         #if !defined __cpp_inline_variables
12492         // This tests for one specific aspect of inline variables that is actually used by
12493         // ORegistry::ROOT (registry/source/regimpl.cxx):
12494         struct S { constexpr S() {} };
12495         struct T { static constexpr S s{}; };
12496         S const * f() { return &T::s; }
12497         #endif
12498     ]])], [
12499         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
12500         AC_MSG_RESULT([yes])
12501     ], [AC_MSG_RESULT([no])])
12502 CXXFLAGS=$save_CXXFLAGS
12503 if test "$build_os" = cygwin; then
12504     LIB=$save_LIB
12506 AC_LANG_POP([C++])
12508 dnl We should be able to drop the below check when bumping the GCC baseline to
12509 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12510 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12511 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12512 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12513 AC_MSG_CHECKING(
12514     [whether C++11 use of const_iterator in standard containers is broken])
12515 save_CXXFLAGS=$CXXFLAGS
12516 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12517 AC_LANG_PUSH([C++])
12518 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12519     #include <list>
12520     ]],[[
12521         std::list<int> l;
12522         l.erase(l.cbegin());
12523     ]])],
12524     [broken=no], [broken=yes])
12525 AC_LANG_POP([C++])
12526 CXXFLAGS=$save_CXXFLAGS
12527 AC_MSG_RESULT([$broken])
12528 if test "$broken" = yes; then
12529     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12533 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12534 save_CXXFLAGS=$CXXFLAGS
12535 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12536 save_LIBS=$LIBS
12537 if test -n "$ILIB1"; then
12538     LIBS="$LIBS $ILIB1"
12540 AC_LANG_PUSH([C++])
12541 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12542     // Exit with failure if the static initializer_list is stored on the
12543     // stack (as done by Clang < 3.4):
12544     #include <initializer_list>
12545     struct S {};
12546     bool g(void const * p1, void const * p2) {
12547         int n;
12548         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12549     }
12550     bool f(void const * p1) {
12551         static std::initializer_list<S> s { S() };
12552         return g(p1, s.begin());
12553     }
12554     ]],[[
12555         int n;
12556         return f(&n) ? 0 : 1;
12557     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12558 AC_LANG_POP([C++])
12559 LIBS=$save_LIBS
12560 CXXFLAGS=$save_CXXFLAGS
12561 AC_MSG_RESULT([$broken])
12562 if test "$broken" = yes -a "$_os" != "iOS"; then
12563     AC_MSG_ERROR([working support for static initializer_list needed])
12567 # ===================================================================
12568 # Creating bigger shared library to link against
12569 # ===================================================================
12570 AC_MSG_CHECKING([whether to create huge library])
12571 MERGELIBS=
12573 if test $_os = iOS -o $_os = Android; then
12574     # Never any point in mergelibs for these as we build just static
12575     # libraries anyway...
12576     enable_mergelibs=no
12579 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12580     if test $_os != Linux -a $_os != WINNT; then
12581         add_warning "--enable-mergelibs is not tested for this platform"
12582     fi
12583     MERGELIBS="TRUE"
12584     AC_MSG_RESULT([yes])
12585 else
12586     AC_MSG_RESULT([no])
12588 AC_SUBST([MERGELIBS])
12590 dnl ===================================================================
12591 dnl icerun is a wrapper that stops us spawning tens of processes
12592 dnl locally - for tools that can't be executed on the compile cluster
12593 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12594 dnl ===================================================================
12595 AC_MSG_CHECKING([whether to use icerun wrapper])
12596 ICECREAM_RUN=
12597 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12598     ICECREAM_RUN=icerun
12599     AC_MSG_RESULT([yes])
12600 else
12601     AC_MSG_RESULT([no])
12603 AC_SUBST(ICECREAM_RUN)
12605 dnl ===================================================================
12606 dnl Setup the ICECC_VERSION for the build the same way it was set for
12607 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12608 dnl ===================================================================
12609 x_ICECC_VERSION=[\#]
12610 if test -n "$ICECC_VERSION" ; then
12611     x_ICECC_VERSION=
12613 AC_SUBST(x_ICECC_VERSION)
12614 AC_SUBST(ICECC_VERSION)
12616 dnl ===================================================================
12618 AC_MSG_CHECKING([MPL subset])
12619 MPL_SUBSET=
12621 if test "$enable_mpl_subset" = "yes"; then
12622     warn_report=false
12623     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12624         warn_report=true
12625     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12626         warn_report=true
12627     fi
12628     if test "$warn_report" = "true"; then
12629         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12630     fi
12631     if test "x$enable_postgresql_sdbc" != "xno"; then
12632         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12633     fi
12634     if test "$enable_lotuswordpro" = "yes"; then
12635         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12636     fi
12637     if test "$WITH_WEBDAV" = "neon"; then
12638         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12639     fi
12640     if test -n "$ENABLE_PDFIMPORT"; then
12641         if test "x$SYSTEM_POPPLER" = "x"; then
12642             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12643         fi
12644     fi
12645     # cf. m4/libo_check_extension.m4
12646     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12647         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12648     fi
12649     for theme in $WITH_THEMES; do
12650         case $theme in
12651         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12652             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12653         *) : ;;
12654         esac
12655     done
12657     ENABLE_OPENGL_TRANSITIONS=
12659     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12660         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12661     fi
12663     MPL_SUBSET="TRUE"
12664     AC_DEFINE(MPL_HAVE_SUBSET)
12665     AC_MSG_RESULT([only])
12666 else
12667     AC_MSG_RESULT([no restrictions])
12669 AC_SUBST(MPL_SUBSET)
12671 dnl ===================================================================
12673 AC_MSG_CHECKING([formula logger])
12674 ENABLE_FORMULA_LOGGER=
12676 if test "x$enable_formula_logger" = "xyes"; then
12677     AC_MSG_RESULT([yes])
12678     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12679     ENABLE_FORMULA_LOGGER=TRUE
12680 elif test -n "$ENABLE_DBGUTIL" ; then
12681     AC_MSG_RESULT([yes])
12682     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12683     ENABLE_FORMULA_LOGGER=TRUE
12684 else
12685     AC_MSG_RESULT([no])
12688 AC_SUBST(ENABLE_FORMULA_LOGGER)
12690 dnl ===================================================================
12691 dnl Setting up the environment.
12692 dnl ===================================================================
12693 AC_MSG_NOTICE([setting up the build environment variables...])
12695 AC_SUBST(COMPATH)
12697 if test "$build_os" = "cygwin"; then
12698     if test -d "$COMPATH/atlmfc/lib"; then
12699         ATL_LIB="$COMPATH/atlmfc/lib"
12700         ATL_INCLUDE="$COMPATH/atlmfc/include"
12701     else
12702         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12703         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12704     fi
12705     if test "$BITNESS_OVERRIDE" = 64; then
12706         if test $VCVER = "150"; then
12707             ATL_LIB="$ATL_LIB/x64"
12708         else
12709             ATL_LIB="$ATL_LIB/amd64"
12710         fi
12711     else
12712         if test $VCVER = "150"; then
12713             ATL_LIB="$ATL_LIB/x86"
12714         fi
12715     fi
12716     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12717     PathFormat "/usr/bin/find.exe"
12718     FIND="$formatted_path"
12719     PathFormat "/usr/bin/sort.exe"
12720     SORT="$formatted_path"
12721     PathFormat "/usr/bin/grep.exe"
12722     WIN_GREP="$formatted_path"
12723     PathFormat "/usr/bin/ls.exe"
12724     WIN_LS="$formatted_path"
12725     PathFormat "/usr/bin/touch.exe"
12726     WIN_TOUCH="$formatted_path"
12727 else
12728     FIND=find
12729     SORT=sort
12732 AC_SUBST(ATL_INCLUDE)
12733 AC_SUBST(ATL_LIB)
12734 AC_SUBST(FIND)
12735 AC_SUBST(SORT)
12736 AC_SUBST(WIN_GREP)
12737 AC_SUBST(WIN_LS)
12738 AC_SUBST(WIN_TOUCH)
12740 AC_SUBST(BUILD_TYPE)
12742 AC_SUBST(SOLARINC)
12744 PathFormat "$PERL"
12745 PERL="$formatted_path"
12746 AC_SUBST(PERL)
12748 if test -n "$TMPDIR"; then
12749     TEMP_DIRECTORY="$TMPDIR"
12750 else
12751     TEMP_DIRECTORY="/tmp"
12753 if test "$build_os" = "cygwin"; then
12754     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12756 AC_SUBST(TEMP_DIRECTORY)
12758 # setup the PATH for the environment
12759 if test -n "$LO_PATH_FOR_BUILD"; then
12760     LO_PATH="$LO_PATH_FOR_BUILD"
12761 else
12762     LO_PATH="$PATH"
12764     case "$host_os" in
12766     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12767         if test "$ENABLE_JAVA" != ""; then
12768             pathmunge "$JAVA_HOME/bin" "after"
12769         fi
12770         ;;
12772     cygwin*)
12773         # Win32 make needs native paths
12774         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12775             LO_PATH=`cygpath -p -m "$PATH"`
12776         fi
12777         if test "$BITNESS_OVERRIDE" = 64; then
12778             # needed for msi packaging
12779             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12780         fi
12781         # .NET 4.6 and higher don't have bin directory
12782         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12783             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12784         fi
12785         pathmunge "$ASM_HOME" "before"
12786         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12787         pathmunge "$CSC_PATH" "before"
12788         pathmunge "$MIDL_PATH" "before"
12789         pathmunge "$AL_PATH" "before"
12790         pathmunge "$MSPDB_PATH" "before"
12791         if test -n "$MSBUILD_PATH" ; then
12792             pathmunge "$MSBUILD_PATH" "before"
12793         fi
12794         if test "$BITNESS_OVERRIDE" = 64; then
12795             pathmunge "$COMPATH/bin/amd64" "before"
12796             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12797         else
12798             pathmunge "$COMPATH/bin" "before"
12799             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12800         fi
12801         if test "$ENABLE_JAVA" != ""; then
12802             if test -d "$JAVA_HOME/jre/bin/client"; then
12803                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12804             fi
12805             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12806                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12807             fi
12808             pathmunge "$JAVA_HOME/bin" "before"
12809         fi
12810         ;;
12812     solaris*)
12813         pathmunge "/usr/css/bin" "before"
12814         if test "$ENABLE_JAVA" != ""; then
12815             pathmunge "$JAVA_HOME/bin" "after"
12816         fi
12817         ;;
12818     esac
12821 AC_SUBST(LO_PATH)
12823 libo_FUZZ_SUMMARY
12825 # Generate a configuration sha256 we can use for deps
12826 if test -f config_host.mk; then
12827     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12829 if test -f config_host_lang.mk; then
12830     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12833 CFLAGS=$my_original_CFLAGS
12834 CXXFLAGS=$my_original_CXXFLAGS
12835 CPPFLAGS=$my_original_CPPFLAGS
12837 AC_CONFIG_FILES([config_host.mk
12838                  config_host_lang.mk
12839                  Makefile
12840                  lo.xcent
12841                  bin/bffvalidator.sh
12842                  bin/odfvalidator.sh
12843                  bin/officeotron.sh
12844                  instsetoo_native/util/openoffice.lst
12845                  sysui/desktop/macosx/Info.plist])
12846 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12847 AC_CONFIG_HEADERS([config_host/config_clang.h])
12848 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12849 AC_CONFIG_HEADERS([config_host/config_eot.h])
12850 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12851 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12852 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12853 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12854 AC_CONFIG_HEADERS([config_host/config_features.h])
12855 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12856 AC_CONFIG_HEADERS([config_host/config_folders.h])
12857 AC_CONFIG_HEADERS([config_host/config_gio.h])
12858 AC_CONFIG_HEADERS([config_host/config_global.h])
12859 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12860 AC_CONFIG_HEADERS([config_host/config_java.h])
12861 AC_CONFIG_HEADERS([config_host/config_langs.h])
12862 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12863 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12864 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12865 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12866 AC_CONFIG_HEADERS([config_host/config_locales.h])
12867 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12868 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12869 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12870 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12871 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12872 AC_CONFIG_HEADERS([config_host/config_oox.h])
12873 AC_CONFIG_HEADERS([config_host/config_options.h])
12874 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12875 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12876 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12877 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12878 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12879 AC_CONFIG_HEADERS([config_host/config_version.h])
12880 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12881 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12882 AC_CONFIG_HEADERS([config_host/config_python.h])
12883 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12884 AC_OUTPUT
12886 if test "$CROSS_COMPILING" = TRUE; then
12887     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12890 # touch the config timestamp file
12891 if test ! -f config_host.mk.stamp; then
12892     echo > config_host.mk.stamp
12893 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12894     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12895 else
12896     echo > config_host.mk.stamp
12899 # touch the config lang timestamp file
12900 if test ! -f config_host_lang.mk.stamp; then
12901     echo > config_host_lang.mk.stamp
12902 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12903     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12904 else
12905     echo > config_host_lang.mk.stamp
12909 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12911 cat << _EOS
12912 ****************************************************************************
12913 WARNING:
12914 Your make version is known to be horribly slow, and hard to debug
12915 problems with. To get a reasonably functional make please do:
12917 to install a pre-compiled binary make for Win32
12919  mkdir -p /opt/lo/bin
12920  cd /opt/lo/bin
12921  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12922  cp make-85047eb-msvc.exe make
12923  chmod +x make
12925 to install from source:
12926 place yourself in a working directory of you choice.
12928  git clone git://git.savannah.gnu.org/make.git
12930  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12931  set PATH=%PATH%;C:\Cygwin\bin
12932  [or Cygwin64, if that is what you have]
12933  cd path-to-make-repo-you-cloned-above
12934  build_w32.bat --without-guile
12936 should result in a WinRel/gnumake.exe.
12937 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12939 Then re-run autogen.sh
12941 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12942 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12944 _EOS
12947 cat << _EOF
12948 ****************************************************************************
12950 To build, run:
12951 $GNUMAKE
12953 To view some help, run:
12954 $GNUMAKE help
12956 _EOF
12958 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12959     cat << _EOF
12960 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12961 _EOF
12963     if test $_os = Darwin; then
12964         echo open instdir/$PRODUCTNAME.app
12965     else
12966         echo instdir/program/soffice
12967     fi
12968     cat << _EOF
12970 If you want to run the smoketest, run:
12971 $GNUMAKE check
12973 _EOF
12976 if test -f warn; then
12977     cat warn
12978     rm warn
12981 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: