Bump version to 6.2-27
[LibreOffice.git] / configure.ac
blob8976456ebe5bac17a466d4a3676fa197f13c960a
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([Collabora Office],[6.2.10.27],[],[],[https://collaboraoffice.com/])
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 AC_ARG_WITH(android-api-level,
374     AS_HELP_STRING([--with-android-api-level],
375         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
378 ANDROID_NDK_HOME=
379 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
380     with_android_ndk="$SRC_ROOT/external/android-ndk"
382 if test -n "$with_android_ndk"; then
383     eval ANDROID_NDK_HOME=$with_android_ndk
385     # Set up a lot of pre-canned defaults
387     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
388         if test ! -f $ANDROID_NDK_HOME/source.properties; then
389             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
390         fi
391         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
392     else
393         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
394     fi
395     if test -z "$ANDROID_NDK_VERSION";  then
396         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
397     fi
398     case $ANDROID_NDK_VERSION in
399     r9*|r10*)
400         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
401         ;;
402     11.1.*|12.1.*|13.1.*|14.1.*)
403         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
404         ;;
405     16.*|17.*|18.*|19.*|20.*)
406         ;;
407     *)
408         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
409         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
410         ;;
411     esac
413     ANDROID_API_LEVEL=16
414     if test -n "$with_android_api_level" ; then
415         ANDROID_API_LEVEL="$with_android_api_level"
416     fi
418     android_cpu=$host_cpu
419     if test $host_cpu = arm; then
420         android_platform_prefix=arm-linux-androideabi
421         android_gnu_prefix=$android_platform_prefix
422         LLVM_TRIPLE=armv7a-linux-androideabi
423         ANDROID_APP_ABI=armeabi-v7a
424         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
425     elif test $host_cpu = aarch64; then
426         android_platform_prefix=aarch64-linux-android
427         android_gnu_prefix=$android_platform_prefix
428         LLVM_TRIPLE=$android_platform_prefix
429         # minimum android version that supports aarch64
430         if test "$ANDROID_API_LEVEL" -lt "21" ; then
431             ANDROID_API_LEVEL=21
432         fi
433         ANDROID_APP_ABI=arm64-v8a
434     elif test $host_cpu = x86_64; then
435         android_platform_prefix=x86_64-linux-android
436         android_gnu_prefix=$android_platform_prefix
437         LLVM_TRIPLE=$android_platform_prefix
438         # minimum android version that supports x86_64
439         ANDROID_API_LEVEL=21
440         ANDROID_APP_ABI=x86_64
441     else
442         # host_cpu is something like "i386" or "i686" I guess, NDK uses
443         # "x86" in some contexts
444         android_cpu=x86
445         android_platform_prefix=$android_cpu
446         android_gnu_prefix=i686-linux-android
447         LLVM_TRIPLE=$android_gnu_prefix
448         ANDROID_APP_ABI=x86
449     fi
451     case "$with_android_ndk_toolchain_version" in
452     clang5.0)
453         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
454         ;;
455     *)
456         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
457     esac
459     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
461     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
462     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
463     # manage to link the (app-specific) single huge .so that is built for the app in
464     # android/source/ if there is debug information in a significant part of the object files.
465     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
466     # all objects have been built with debug information.)
467     case $build_os in
468     linux-gnu*)
469         android_HOST_TAG=linux-x86_64
470         ;;
471     darwin*)
472         android_HOST_TAG=darwin-x86_64
473         ;;
474     *)
475         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
476         # ndk would also support windows and windows-x86_64
477         ;;
478     esac
479     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
480     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
481     dnl TODO: NSS build uses it...
482     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
483     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
485     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
486     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
487     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
488     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
489     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
493     if test "$ENABLE_LTO" = TRUE; then
494         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
495         # $CC and $CXX when building external libraries
496         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
497     fi
499     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
501     if test -z "$CC"; then
502         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
503     fi
504     if test -z "$CXX"; then
505         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
506     fi
508     # remember to download the ownCloud Android library later
509     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
511 AC_SUBST(ANDROID_NDK_HOME)
512 AC_SUBST(ANDROID_APP_ABI)
513 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
515 dnl ===================================================================
516 dnl --with-android-sdk
517 dnl ===================================================================
518 ANDROID_SDK_HOME=
519 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
520     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
522 if test -n "$with_android_sdk"; then
523     eval ANDROID_SDK_HOME=$with_android_sdk
524     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
526 AC_SUBST(ANDROID_SDK_HOME)
528 AC_ARG_ENABLE([android-lok],
529     AS_HELP_STRING([--enable-android-lok],
530         [The Android app from the android/ subdir needs several tweaks all
531          over the place that break the LOK when used in the Online-based
532          Android app.  This switch indicates that the intent of this build is
533          actually the Online-based, non-modified LOK.])
535 ENABLE_ANDROID_LOK=
536 if test -n "$ANDROID_NDK_HOME" ; then
537     if test "$enable_android_lok" = yes; then
538         ENABLE_ANDROID_LOK=TRUE
539         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
540         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
541     else
542         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
543     fi
545 AC_SUBST([ENABLE_ANDROID_LOK])
547 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
570 # Default values, as such probably valid just for Linux, set
571 # differently below just for Mac OSX,but at least better than
572 # hardcoding these as we used to do. Much of this is duplicated also
573 # in solenv for old build system and for gbuild, ideally we should
574 # perhaps define stuff like this only here in configure.ac?
576 LINKFLAGSSHL="-shared"
577 PICSWITCH="-fpic"
578 DLLPOST=".so"
580 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
582 INSTROOTBASESUFFIX=
583 INSTROOTCONTENTSUFFIX=
584 SDKDIRNAME=sdk
586 case "$host_os" in
588 solaris*)
589     test_gtk=yes
590     build_gstreamer_1_0=yes
591     build_gstreamer_0_10=yes
592     test_freetype=yes
593     _os=SunOS
595     dnl ===========================================================
596     dnl Check whether we're using Solaris 10 - SPARC or Intel.
597     dnl ===========================================================
598     AC_MSG_CHECKING([the Solaris operating system release])
599     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
600     if test "$_os_release" -lt "10"; then
601         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
602     else
603         AC_MSG_RESULT([ok ($_os_release)])
604     fi
606     dnl Check whether we're using a SPARC or i386 processor
607     AC_MSG_CHECKING([the processor type])
608     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
609         AC_MSG_RESULT([ok ($host_cpu)])
610     else
611         AC_MSG_ERROR([only SPARC and i386 processors are supported])
612     fi
613     ;;
615 linux-gnu*|k*bsd*-gnu*)
616     test_gtk=yes
617     build_gstreamer_1_0=yes
618     build_gstreamer_0_10=yes
619     test_kde4=yes
620     test_kde5=yes
621     test_gtk3_kde5=yes
622     if test "$enable_fuzzers" != yes; then
623         test_freetype=yes
624         test_fontconfig=yes
625     else
626         test_freetype=no
627         test_fontconfig=no
628         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
629     fi
630     _os=Linux
631     ;;
633 gnu)
634     test_randr=no
635     test_xrender=no
636     _os=GNU
637      ;;
639 cygwin*|interix*)
641     # When building on Windows normally with MSVC under Cygwin,
642     # configure thinks that the host platform (the platform the
643     # built code will run on) is Cygwin, even if it obviously is
644     # Windows, which in Autoconf terminology is called
645     # "mingw32". (Which is misleading as MinGW is the name of the
646     # tool-chain, not an operating system.)
648     # Somewhat confusing, yes. But this configure script doesn't
649     # look at $host etc that much, it mostly uses its own $_os
650     # variable, set here in this case statement.
652     test_cups=no
653     test_dbus=no
654     test_randr=no
655     test_xrender=no
656     test_freetype=no
657     test_fontconfig=no
658     _os=WINNT
660     DLLPOST=".dll"
661     LINKFLAGSNOUNDEFS=
662     ;;
664 darwin*) # Mac OS X or iOS
665     test_gtk=yes
666     test_randr=no
667     test_xrender=no
668     test_freetype=no
669     test_fontconfig=no
670     test_dbus=no
671     if test -n "$LODE_HOME" ; then
672         mac_sanitize_path
673         AC_MSG_NOTICE([sanitized the PATH to $PATH])
674     fi
675     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
676         build_for_ios=YES
677         _os=iOS
678         test_gtk=no
679         test_cups=no
680         enable_mpl_subset=yes
681         enable_lotuswordpro=no
682         enable_coinmp=no
683         enable_lpsolve=no
684         enable_postgresql_sdbc=no
685         enable_extension_integration=no
686         enable_report_builder=no
687         with_ppds=no
688         if test "$enable_ios_simulator" = "yes"; then
689             host=x86_64-apple-darwin
690         fi
691     else
692         _os=Darwin
693         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
694         INSTROOTCONTENTSUFFIX=/Contents
695         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
696     fi
697     # See comment above the case "$host_os"
698     LINKFLAGSSHL="-dynamiclib -single_module"
700     # -fPIC is default
701     PICSWITCH=""
703     DLLPOST=".dylib"
705     # -undefined error is the default
706     LINKFLAGSNOUNDEFS=""
709 freebsd*)
710     test_gtk=yes
711     build_gstreamer_1_0=yes
712     build_gstreamer_0_10=yes
713     test_kde4=yes
714     test_kde5=yes
715     test_gtk3_kde5=yes
716     test_freetype=yes
717     AC_MSG_CHECKING([the FreeBSD operating system release])
718     if test -n "$with_os_version"; then
719         OSVERSION="$with_os_version"
720     else
721         OSVERSION=`/sbin/sysctl -n kern.osreldate`
722     fi
723     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
724     AC_MSG_CHECKING([which thread library to use])
725     if test "$OSVERSION" -lt "500016"; then
726         PTHREAD_CFLAGS="-D_THREAD_SAFE"
727         PTHREAD_LIBS="-pthread"
728     elif test "$OSVERSION" -lt "502102"; then
729         PTHREAD_CFLAGS="-D_THREAD_SAFE"
730         PTHREAD_LIBS="-lc_r"
731     else
732         PTHREAD_CFLAGS=""
733         PTHREAD_LIBS="-pthread"
734     fi
735     AC_MSG_RESULT([$PTHREAD_LIBS])
736     _os=FreeBSD
737     ;;
739 *netbsd*)
740     test_gtk=yes
741     build_gstreamer_1_0=yes
742     build_gstreamer_0_10=yes
743     test_kde4=yes
744     test_kde5=yes
745     test_gtk3_kde5=yes
746     test_freetype=yes
747     PTHREAD_LIBS="-pthread -lpthread"
748     _os=NetBSD
749     ;;
751 aix*)
752     test_randr=no
753     test_freetype=yes
754     PTHREAD_LIBS=-pthread
755     _os=AIX
756     ;;
758 openbsd*)
759     test_gtk=yes
760     test_freetype=yes
761     PTHREAD_CFLAGS="-D_THREAD_SAFE"
762     PTHREAD_LIBS="-pthread"
763     _os=OpenBSD
764     ;;
766 dragonfly*)
767     test_gtk=yes
768     build_gstreamer_1_0=yes
769     build_gstreamer_0_10=yes
770     test_kde4=yes
771     test_kde5=yes
772     test_gtk3_kde5=yes
773     test_freetype=yes
774     PTHREAD_LIBS="-pthread"
775     _os=DragonFly
776     ;;
778 linux-android*)
779     build_gstreamer_1_0=no
780     build_gstreamer_0_10=no
781     enable_lotuswordpro=no
782     enable_mpl_subset=yes
783     enable_coinmp=yes
784     enable_lpsolve=no
785     enable_report_builder=no
786     enable_odk=no
787     enable_postgresql_sdbc=no
788     enable_python=no
789     test_cups=no
790     test_dbus=no
791     test_fontconfig=no
792     test_freetype=no
793     test_gtk=no
794     test_kde4=no
795     test_kde5=no
796     test_gtk3_kde5=no
797     test_randr=no
798     test_xrender=no
799     _os=Android
801     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
802     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
803     ;;
805 haiku*)
806     test_cups=no
807     test_dbus=no
808     test_randr=no
809     test_xrender=no
810     test_freetype=yes
811     enable_odk=no
812     enable_gstreamer_0_10=no
813     enable_gstreamer_1_0=no
814     enable_vlc=no
815     enable_coinmp=no
816     enable_pdfium=no
817     enable_sdremote=no
818     enable_postgresql_sdbc=no
819     enable_firebird_sdbc=no
820     _os=Haiku
821     ;;
824     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
825     ;;
826 esac
828 if test "$_os" = "Android" ; then
829     # Verify that the NDK and SDK options are proper
830     if test -z "$with_android_ndk"; then
831         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
832     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
833         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
834     fi
836     if test -z "$ANDROID_SDK_HOME"; then
837         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
838     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
839         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
840     fi
842     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
843     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
844         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
845                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
846                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
847         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
848         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
849         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
850     fi
851     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
852         AC_MSG_WARN([android support repository not found - install with
853                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
854                      to allow the build to download the specified version of the android support libraries])
855         add_warning "android support repository not found - install with"
856         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
857         add_warning "to allow the build to download the specified version of the android support libraries"
858     fi
861 if test "$_os" = "AIX"; then
862     AC_PATH_PROG(GAWK, gawk)
863     if test -z "$GAWK"; then
864         AC_MSG_ERROR([gawk not found in \$PATH])
865     fi
868 AC_SUBST(SDKDIRNAME)
870 AC_SUBST(PTHREAD_CFLAGS)
871 AC_SUBST(PTHREAD_LIBS)
873 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
874 # By default use the ones specified by our build system,
875 # but explicit override is possible.
876 AC_MSG_CHECKING(for explicit AFLAGS)
877 if test -n "$AFLAGS"; then
878     AC_MSG_RESULT([$AFLAGS])
879     x_AFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_AFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit CFLAGS)
885 if test -n "$CFLAGS"; then
886     AC_MSG_RESULT([$CFLAGS])
887     x_CFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_CFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit CXXFLAGS)
893 if test -n "$CXXFLAGS"; then
894     AC_MSG_RESULT([$CXXFLAGS])
895     x_CXXFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_CXXFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit OBJCFLAGS)
901 if test -n "$OBJCFLAGS"; then
902     AC_MSG_RESULT([$OBJCFLAGS])
903     x_OBJCFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_OBJCFLAGS=[\#]
908 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
909 if test -n "$OBJCXXFLAGS"; then
910     AC_MSG_RESULT([$OBJCXXFLAGS])
911     x_OBJCXXFLAGS=
912 else
913     AC_MSG_RESULT(no)
914     x_OBJCXXFLAGS=[\#]
916 AC_MSG_CHECKING(for explicit LDFLAGS)
917 if test -n "$LDFLAGS"; then
918     AC_MSG_RESULT([$LDFLAGS])
919     x_LDFLAGS=
920 else
921     AC_MSG_RESULT(no)
922     x_LDFLAGS=[\#]
924 AC_SUBST(AFLAGS)
925 AC_SUBST(CFLAGS)
926 AC_SUBST(CXXFLAGS)
927 AC_SUBST(OBJCFLAGS)
928 AC_SUBST(OBJCXXFLAGS)
929 AC_SUBST(LDFLAGS)
930 AC_SUBST(x_AFLAGS)
931 AC_SUBST(x_CFLAGS)
932 AC_SUBST(x_CXXFLAGS)
933 AC_SUBST(x_OBJCFLAGS)
934 AC_SUBST(x_OBJCXXFLAGS)
935 AC_SUBST(x_LDFLAGS)
937 dnl These are potentially set for MSVC, in the code checking for UCRT below:
938 my_original_CFLAGS=$CFLAGS
939 my_original_CXXFLAGS=$CXXFLAGS
940 my_original_CPPFLAGS=$CPPFLAGS
942 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
943 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
944 dnl AC_PROG_CC internally.
945 if test "$_os" != "WINNT"; then
946     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
947     save_CFLAGS=$CFLAGS
948     AC_PROG_CC
949     CFLAGS=$save_CFLAGS
952 if test "$_os" != "WINNT"; then
953 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
954 else
955 ENDIANNESS=little
957 AC_SUBST(ENDIANNESS)
959 if test $_os != "WINNT"; then
960     save_LIBS="$LIBS"
961     AC_SEARCH_LIBS([dlsym], [dl],
962         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
963         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
964     LIBS="$save_LIBS"
966 AC_SUBST(DLOPEN_LIBS)
968 AC_ARG_ENABLE(ios-simulator,
969     AS_HELP_STRING([--enable-ios-simulator],
970         [build i386 or x86_64 for ios simulator])
973 AC_ARG_ENABLE(ios-libreofficelight-app,
974     AS_HELP_STRING([--enable-ios-libreofficelight-app],
975         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
976          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
977          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
980 ENABLE_IOS_LIBREOFFICELIGHT_APP=
981 if test "$enable_ios_libreofficelight_app" = yes; then
982     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
984 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
986 ###############################################################################
987 # Extensions switches --enable/--disable
988 ###############################################################################
989 # By default these should be enabled unless having extra dependencies.
990 # If there is extra dependency over configure options then the enable should
991 # be automagic based on whether the requiring feature is enabled or not.
992 # All this options change anything only with --enable-extension-integration.
994 # The name of this option and its help string makes it sound as if
995 # extensions are built anyway, just not integrated in the installer,
996 # if you use --disable-extension-integration. Is that really the
997 # case?
999 libo_FUZZ_ARG_ENABLE(extension-integration,
1000     AS_HELP_STRING([--disable-extension-integration],
1001         [Disable integration of the built extensions in the installer of the
1002          product. Use this switch to disable the integration.])
1005 AC_ARG_ENABLE(avmedia,
1006     AS_HELP_STRING([--disable-avmedia],
1007         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1010 AC_ARG_ENABLE(database-connectivity,
1011     AS_HELP_STRING([--disable-database-connectivity],
1012         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1015 # This doesn't mean not building (or "integrating") extensions
1016 # (although it probably should; i.e. it should imply
1017 # --disable-extension-integration I guess), it means not supporting
1018 # any extension mechanism at all
1019 libo_FUZZ_ARG_ENABLE(extensions,
1020     AS_HELP_STRING([--disable-extensions],
1021         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1024 AC_ARG_ENABLE(scripting,
1025     AS_HELP_STRING([--disable-scripting],
1026         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1029 # This is mainly for Android and iOS, but could potentially be used in some
1030 # special case otherwise, too, so factored out as a separate setting
1032 AC_ARG_ENABLE(dynamic-loading,
1033     AS_HELP_STRING([--disable-dynamic-loading],
1034         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1037 libo_FUZZ_ARG_ENABLE(report-builder,
1038     AS_HELP_STRING([--disable-report-builder],
1039         [Disable the Report Builder.])
1042 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1043     AS_HELP_STRING([--enable-ext-wiki-publisher],
1044         [Enable the Wiki Publisher extension.])
1047 libo_FUZZ_ARG_ENABLE(lpsolve,
1048     AS_HELP_STRING([--disable-lpsolve],
1049         [Disable compilation of the lp solve solver ])
1051 libo_FUZZ_ARG_ENABLE(coinmp,
1052     AS_HELP_STRING([--disable-coinmp],
1053         [Disable compilation of the CoinMP solver ])
1056 libo_FUZZ_ARG_ENABLE(pdfimport,
1057     AS_HELP_STRING([--disable-pdfimport],
1058         [Disable building the PDF import feature.])
1061 libo_FUZZ_ARG_ENABLE(pdfium,
1062     AS_HELP_STRING([--disable-pdfium],
1063         [Disable building PDFium.])
1066 ###############################################################################
1068 dnl ---------- *** ----------
1070 libo_FUZZ_ARG_ENABLE(mergelibs,
1071     AS_HELP_STRING([--enable-mergelibs],
1072         [Merge several of the smaller libraries into one big, "merged", one.])
1075 libo_FUZZ_ARG_ENABLE(breakpad,
1076     AS_HELP_STRING([--enable-breakpad],
1077         [Enables breakpad for crash reporting.])
1080 AC_ARG_ENABLE(fetch-external,
1081     AS_HELP_STRING([--disable-fetch-external],
1082         [Disables fetching external tarballs from web sources.])
1085 AC_ARG_ENABLE(fuzzers,
1086     AS_HELP_STRING([--enable-fuzzers],
1087         [Enables building libfuzzer targets for fuzz testing.])
1090 libo_FUZZ_ARG_ENABLE(pch,
1091     AS_HELP_STRING([--enable-pch],
1092         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1095 libo_FUZZ_ARG_ENABLE(epm,
1096     AS_HELP_STRING([--enable-epm],
1097         [LibreOffice includes self-packaging code, that requires epm, however epm is
1098          useless for large scale package building.])
1101 libo_FUZZ_ARG_ENABLE(odk,
1102     AS_HELP_STRING([--disable-odk],
1103         [LibreOffice includes an ODK, office development kit which some packagers may
1104          wish to build without.])
1107 AC_ARG_ENABLE(mpl-subset,
1108     AS_HELP_STRING([--enable-mpl-subset],
1109         [Don't compile any pieces which are not MPL or more liberally licensed])
1112 libo_FUZZ_ARG_ENABLE(evolution2,
1113     AS_HELP_STRING([--enable-evolution2],
1114         [Allows the built-in evolution 2 addressbook connectivity build to be
1115          enabled.])
1118 AC_ARG_ENABLE(avahi,
1119     AS_HELP_STRING([--enable-avahi],
1120         [Determines whether to use Avahi to advertise Impress to remote controls.])
1123 libo_FUZZ_ARG_ENABLE(werror,
1124     AS_HELP_STRING([--enable-werror],
1125         [Turn warnings to errors. (Has no effect in modules where the treating
1126          of warnings as errors is disabled explicitly.)]),
1129 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1130     AS_HELP_STRING([--enable-assert-always-abort],
1131         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1134 libo_FUZZ_ARG_ENABLE(dbgutil,
1135     AS_HELP_STRING([--enable-dbgutil],
1136         [Provide debugging support from --enable-debug and include additional debugging
1137          utilities such as object counting or more expensive checks.
1138          This is the recommended option for developers.
1139          Note that this makes the build ABI incompatible, it is not possible to mix object
1140          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1142 libo_FUZZ_ARG_ENABLE(debug,
1143     AS_HELP_STRING([--enable-debug],
1144         [Include debugging information, disable compiler optimization and inlining plus
1145          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1147 libo_FUZZ_ARG_ENABLE(split-debug,
1148     AS_HELP_STRING([--enable-split-debug],
1149         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1150          but requires tools that support it (both build tools and debuggers).]))
1152 libo_FUZZ_ARG_ENABLE(gdb-index,
1153     AS_HELP_STRING([--enable-gdb-index],
1154         [Creates debug information in the gdb index format, which makes gdb start faster.
1155          Requires the gold or lld linker.]))
1157 libo_FUZZ_ARG_ENABLE(sal-log,
1158     AS_HELP_STRING([--enable-sal-log],
1159         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1161 AC_ARG_ENABLE(selective-debuginfo,
1162     AS_HELP_STRING([--enable-selective-debuginfo],
1163         [If --enable-debug or --enable-dbgutil is used, build debugging information
1164          (-g compiler flag) only for the specified gbuild build targets
1165          (where all means everything, - prepended means not to enable, / appended means
1166          everything in the directory; there is no ordering, more specific overrides
1167          more general, and disabling takes precedence).
1168          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1170 libo_FUZZ_ARG_ENABLE(symbols,
1171     AS_HELP_STRING([--enable-symbols],
1172         [Generate debug information.
1173          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1174          otherwise.]))
1176 libo_FUZZ_ARG_ENABLE(optimized,
1177     AS_HELP_STRING([--disable-optimized],
1178         [Whether to compile with optimization flags.
1179          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1180          otherwise.]))
1182 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1183     AS_HELP_STRING([--disable-runtime-optimizations],
1184         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1185          JVM JIT) that are known to interact badly with certain dynamic analysis
1186          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1187          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1188          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1190 AC_ARG_WITH(valgrind,
1191     AS_HELP_STRING([--with-valgrind],
1192         [Make availability of Valgrind headers a hard requirement.]))
1194 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1195     AS_HELP_STRING([--enable-compiler-plugins],
1196         [Enable compiler plugins that will perform additional checks during
1197          building. Enabled automatically by --enable-dbgutil.
1198          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1199 COMPILER_PLUGINS_DEBUG=
1200 if test "$enable_compiler_plugins" = debug; then
1201     enable_compiler_plugins=yes
1202     COMPILER_PLUGINS_DEBUG=TRUE
1205 libo_FUZZ_ARG_ENABLE(ooenv,
1206     AS_HELP_STRING([--disable-ooenv],
1207         [Disable ooenv for the instdir installation.]))
1209 libo_FUZZ_ARG_ENABLE(libnumbertext,
1210     AS_HELP_STRING([--disable-libnumbertext],
1211         [Disable use of numbertext external library.]))
1213 AC_ARG_ENABLE(lto,
1214     AS_HELP_STRING([--enable-lto],
1215         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1216          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1217          linker. For MSVC, this option is broken at the moment. This is experimental work
1218          in progress that shouldn't be used unless you are working on it.)]))
1220 AC_ARG_ENABLE(python,
1221     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1222         [Enables or disables Python support at run-time.
1223          Also specifies what Python to use. 'auto' is the default.
1224          'fully-internal' even forces the internal version for uses of Python
1225          during the build.]))
1227 libo_FUZZ_ARG_ENABLE(gtk,
1228     AS_HELP_STRING([--disable-gtk],
1229         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1230 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1232 libo_FUZZ_ARG_ENABLE(gtk3,
1233     AS_HELP_STRING([--disable-gtk3],
1234         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1235 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1237 AC_ARG_ENABLE(split-app-modules,
1238     AS_HELP_STRING([--enable-split-app-modules],
1239         [Split file lists for app modules, e.g. base, calc.
1240          Has effect only with make distro-pack-install]),
1243 AC_ARG_ENABLE(split-opt-features,
1244     AS_HELP_STRING([--enable-split-opt-features],
1245         [Split file lists for some optional features, e.g. pyuno, testtool.
1246          Has effect only with make distro-pack-install]),
1249 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1250     AS_HELP_STRING([--disable-cairo-canvas],
1251         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1254 libo_FUZZ_ARG_ENABLE(dbus,
1255     AS_HELP_STRING([--disable-dbus],
1256         [Determines whether to enable features that depend on dbus.
1257          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1258 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1260 libo_FUZZ_ARG_ENABLE(sdremote,
1261     AS_HELP_STRING([--disable-sdremote],
1262         [Determines whether to enable Impress remote control (i.e. the server component).]),
1263 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1265 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1266     AS_HELP_STRING([--disable-sdremote-bluetooth],
1267         [Determines whether to build sdremote with bluetooth support.
1268          Requires dbus on Linux.]))
1270 libo_FUZZ_ARG_ENABLE(gio,
1271     AS_HELP_STRING([--disable-gio],
1272         [Determines whether to use the GIO support.]),
1273 ,test "${enable_gio+set}" = set || enable_gio=yes)
1275 AC_ARG_ENABLE(kde4,
1276     AS_HELP_STRING([--enable-kde4],
1277         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1278          KDE4 are available.]),
1281 AC_ARG_ENABLE(qt5,
1282     AS_HELP_STRING([--enable-qt5],
1283         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1284          available.]),
1287 AC_ARG_ENABLE(kde5,
1288     AS_HELP_STRING([--enable-kde5],
1289         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1290          KF5 are available.]),
1293 AC_ARG_ENABLE(gtk3_kde5,
1294     AS_HELP_STRING([--enable-gtk3-kde5],
1295         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1296          platforms where Gtk3, Qt5 and Plasma is available.]),
1299 libo_FUZZ_ARG_ENABLE(gui,
1300     AS_HELP_STRING([--disable-gui],
1301         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1302          command-line option. Not related to LibreOffice Online functionality. Don't use
1303          unless you are certain you need to. Nobody will help you if you insist on trying
1304          this and run into problems.]),
1305 ,test "${enable_gui+set}" = set || enable_gui=yes)
1307 libo_FUZZ_ARG_ENABLE(randr,
1308     AS_HELP_STRING([--disable-randr],
1309         [Disable RandR support in the vcl project.]),
1310 ,test "${enable_randr+set}" = set || enable_randr=yes)
1312 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1313     AS_HELP_STRING([--disable-gstreamer-1-0],
1314         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1315 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1317 AC_ARG_ENABLE(gstreamer-0-10,
1318     AS_HELP_STRING([--enable-gstreamer-0-10],
1319         [Enable building with the gstreamer 0.10 avmedia backend.]),
1320 ,enable_gstreamer_0_10=no)
1322 libo_FUZZ_ARG_ENABLE(vlc,
1323     AS_HELP_STRING([--enable-vlc],
1324         [Enable building with the (experimental) VLC avmedia backend.]),
1325 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1327 libo_FUZZ_ARG_ENABLE(neon,
1328     AS_HELP_STRING([--disable-neon],
1329         [Disable neon and the compilation of webdav binding.]),
1332 libo_FUZZ_ARG_ENABLE([eot],
1333     [AS_HELP_STRING([--enable-eot],
1334         [Enable support for Embedded OpenType fonts.])],
1335 ,test "${enable_eot+set}" = set || enable_eot=no)
1337 libo_FUZZ_ARG_ENABLE(cve-tests,
1338     AS_HELP_STRING([--disable-cve-tests],
1339         [Prevent CVE tests to be executed]),
1342 libo_FUZZ_ARG_ENABLE(chart-tests,
1343     AS_HELP_STRING([--enable-chart-tests],
1344         [Executes chart XShape tests. In a perfect world these tests would be
1345          stable and everyone could run them, in reality it is best to run them
1346          only on a few machines that are known to work and maintained by people
1347          who can judge if a test failure is a regression or not.]),
1350 AC_ARG_ENABLE(build-unowinreg,
1351     AS_HELP_STRING([--enable-build-unowinreg],
1352         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1353          compiler is needed on Linux.]),
1356 AC_ARG_ENABLE(build-opensymbol,
1357     AS_HELP_STRING([--enable-build-opensymbol],
1358         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1359          fontforge installed.]),
1362 AC_ARG_ENABLE(dependency-tracking,
1363     AS_HELP_STRING([--enable-dependency-tracking],
1364         [Do not reject slow dependency extractors.])[
1365   --disable-dependency-tracking
1366                           Disables generation of dependency information.
1367                           Speed up one-time builds.],
1370 AC_ARG_ENABLE(icecream,
1371     AS_HELP_STRING([--enable-icecream],
1372         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1373          It defaults to /opt/icecream for the location of the icecream gcc/g++
1374          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1377 AC_ARG_ENABLE(ld,
1378     AS_HELP_STRING([--enable-ld=<linker>],
1379         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1382 libo_FUZZ_ARG_ENABLE(cups,
1383     AS_HELP_STRING([--disable-cups],
1384         [Do not build cups support.])
1387 AC_ARG_ENABLE(ccache,
1388     AS_HELP_STRING([--disable-ccache],
1389         [Do not try to use ccache automatically.
1390          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1391          CC/CXX are not yet set, and --enable-icecream is not given, we
1392          attempt to use ccache. --disable-ccache disables ccache completely.
1396 AC_ARG_ENABLE(64-bit,
1397     AS_HELP_STRING([--enable-64-bit],
1398         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1399          At the moment meaningful only for Windows.]), ,)
1401 libo_FUZZ_ARG_ENABLE(online-update,
1402     AS_HELP_STRING([--enable-online-update],
1403         [Enable the online update service that will check for new versions of
1404          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1405          If the value is "mar", the experimental Mozilla-like update will be
1406          enabled instead of the traditional update mechanism.]),
1409 AC_ARG_WITH(update-config,
1410     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1411                    [Path to the update config ini file]))
1413 libo_FUZZ_ARG_ENABLE(extension-update,
1414     AS_HELP_STRING([--disable-extension-update],
1415         [Disable possibility to update installed extensions.]),
1418 libo_FUZZ_ARG_ENABLE(release-build,
1419     AS_HELP_STRING([--enable-release-build],
1420         [Enable release build. Note that the "release build" choice is orthogonal to
1421          whether symbols are present, debug info is generated, or optimization
1422          is done.
1423          See http://wiki.documentfoundation.org/Development/DevBuild]),
1426 AC_ARG_ENABLE(windows-build-signing,
1427     AS_HELP_STRING([--enable-windows-build-signing],
1428         [Enable signing of windows binaries (*.exe, *.dll)]),
1431 AC_ARG_ENABLE(silent-msi,
1432     AS_HELP_STRING([--enable-silent-msi],
1433         [Enable MSI with LIMITUI=1 (silent install).]),
1436 AC_ARG_ENABLE(macosx-code-signing,
1437     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1438         [Sign executables, dylibs, frameworks and the app bundle. If you
1439          don't provide an identity the first suitable certificate
1440          in your keychain is used.]),
1443 AC_ARG_ENABLE(macosx-package-signing,
1444     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1445         [Create a .pkg suitable for uploading to the Mac App Store and sign
1446          it. If you don't provide an identity the first suitable certificate
1447          in your keychain is used.]),
1450 AC_ARG_ENABLE(macosx-sandbox,
1451     AS_HELP_STRING([--enable-macosx-sandbox],
1452         [Make the app bundle run in a sandbox. Requires code signing.
1453          Is required by apps distributed in the Mac App Store, and implies
1454          adherence to App Store rules.]),
1457 AC_ARG_WITH(macosx-bundle-identifier,
1458     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1459         [Define the OS X bundle identifier. Default is the somewhat weird
1460          org.libreoffice.script ("script", huh?).]),
1461 ,with_macosx_bundle_identifier=org.libreoffice.script)
1463 AC_ARG_WITH(product-name,
1464     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1465         [Define the product name. Default is AC_PACKAGE_NAME.]),
1466 ,with_product_name=$PRODUCTNAME)
1468 AC_ARG_WITH(package-version,
1469     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1470         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1473 libo_FUZZ_ARG_ENABLE(readonly-installset,
1474     AS_HELP_STRING([--enable-readonly-installset],
1475         [Prevents any attempts by LibreOffice to write into its installation. That means
1476          at least that no "system-wide" extensions can be added. Partly experimental work in
1477          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1480 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1481     AS_HELP_STRING([--disable-postgresql-sdbc],
1482         [Disable the build of the PostgreSQL-SDBC driver.])
1485 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1486     AS_HELP_STRING([--disable-lotuswordpro],
1487         [Disable the build of the Lotus Word Pro filter.]),
1488 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1490 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1491     AS_HELP_STRING([--disable-firebird-sdbc],
1492         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1493 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1495 AC_ARG_ENABLE(bogus-pkg-config,
1496     AS_HELP_STRING([--enable-bogus-pkg-config],
1497         [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.]),
1500 AC_ARG_ENABLE(openssl,
1501     AS_HELP_STRING([--disable-openssl],
1502         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1503          components will either use GNUTLS or NSS. Work in progress,
1504          use only if you are hacking on it.]),
1505 ,enable_openssl=yes)
1507 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1508     AS_HELP_STRING([--enable-cipher-openssl-backend],
1509         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1510          Requires --enable-openssl.]))
1512 AC_ARG_ENABLE(library-bin-tar,
1513     AS_HELP_STRING([--enable-library-bin-tar],
1514         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1515         Some libraries can save their build result in a tarball
1516         stored in TARFILE_LOCATION. That binary tarball is
1517         uniquely identified by the source tarball,
1518         the content of the config_host.mk file and the content
1519         of the top-level directory in core for that library
1520         If this option is enabled, then if such a tarfile exist, it will be untarred
1521         instead of the source tarfile, and the build step will be skipped for that
1522         library.
1523         If a proper tarfile does not exist, then the normal source-based
1524         build is done for that library and a proper binary tarfile is created
1525         for the next time.]),
1528 AC_ARG_ENABLE(dconf,
1529     AS_HELP_STRING([--disable-dconf],
1530         [Disable the dconf configuration backend (enabled by default where
1531          available).]))
1533 libo_FUZZ_ARG_ENABLE(formula-logger,
1534     AS_HELP_STRING(
1535         [--enable-formula-logger],
1536         [Enable formula logger for logging formula calculation flow in Calc.]
1537     )
1540 dnl ===================================================================
1541 dnl Optional Packages (--with/without-)
1542 dnl ===================================================================
1544 AC_ARG_WITH(gcc-home,
1545     AS_HELP_STRING([--with-gcc-home],
1546         [Specify the location of gcc/g++ manually. This can be used in conjunction
1547          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1548          non-default path.]),
1551 AC_ARG_WITH(gnu-patch,
1552     AS_HELP_STRING([--with-gnu-patch],
1553         [Specify location of GNU patch on Solaris or FreeBSD.]),
1556 AC_ARG_WITH(build-platform-configure-options,
1557     AS_HELP_STRING([--with-build-platform-configure-options],
1558         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1561 AC_ARG_WITH(gnu-cp,
1562     AS_HELP_STRING([--with-gnu-cp],
1563         [Specify location of GNU cp on Solaris or FreeBSD.]),
1566 AC_ARG_WITH(external-tar,
1567     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1568         [Specify an absolute path of where to find (and store) tarfiles.]),
1569     TARFILE_LOCATION=$withval ,
1572 AC_ARG_WITH(referenced-git,
1573     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1574         [Specify another checkout directory to reference. This makes use of
1575                  git submodule update --reference, and saves a lot of diskspace
1576                  when having multiple trees side-by-side.]),
1577     GIT_REFERENCE_SRC=$withval ,
1580 AC_ARG_WITH(linked-git,
1581     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1582         [Specify a directory where the repositories of submodules are located.
1583          This uses a method similar to git-new-workdir to get submodules.]),
1584     GIT_LINK_SRC=$withval ,
1587 AC_ARG_WITH(galleries,
1588     AS_HELP_STRING([--with-galleries],
1589         [Specify how galleries should be built. It is possible either to
1590          build these internally from source ("build"),
1591          or to disable them ("no")]),
1594 AC_ARG_WITH(theme,
1595     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1596         [Choose which themes to include. By default those themes with an '*' are included.
1597          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1598          *elementary_svg, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1601 libo_FUZZ_ARG_WITH(helppack-integration,
1602     AS_HELP_STRING([--without-helppack-integration],
1603         [It will not integrate the helppacks to the installer
1604          of the product. Please use this switch to use the online help
1605          or separate help packages.]),
1608 libo_FUZZ_ARG_WITH(fonts,
1609     AS_HELP_STRING([--without-fonts],
1610         [LibreOffice includes some third-party fonts to provide a reliable basis for
1611          help content, templates, samples, etc. When these fonts are already
1612          known to be available on the system then you should use this option.]),
1615 AC_ARG_ENABLE(noto-font,
1616     AS_HELP_STRING([--enable-noto-font],
1617         [Add more Google Noto fonts.]),
1620 AC_ARG_WITH(epm,
1621     AS_HELP_STRING([--with-epm],
1622         [Decides which epm to use. Default is to use the one from the system if
1623          one is built. When either this is not there or you say =internal epm
1624          will be built.]),
1627 AC_ARG_WITH(package-format,
1628     AS_HELP_STRING([--with-package-format],
1629         [Specify package format(s) for LibreOffice installation sets. The
1630          implicit --without-package-format leads to no installation sets being
1631          generated. Possible values: aix, archive, bsd, deb, dmg,
1632          installed, msi, pkg, and rpm.
1633          Example: --with-package-format='deb rpm']),
1636 AC_ARG_WITH(tls,
1637     AS_HELP_STRING([--with-tls],
1638         [Decides which TLS/SSL and cryptographic implementations to use for
1639          LibreOffice's code. Notice that this doesn't apply for depending
1640          libraries like "neon", for example. Default is to use OpenSSL
1641          although NSS is also possible. Notice that selecting NSS restricts
1642          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1643          restrict by now the usage of NSS in LO's code. Possible values:
1644          openssl, nss. Example: --with-tls="nss"]),
1647 AC_ARG_WITH(system-libs,
1648     AS_HELP_STRING([--with-system-libs],
1649         [Use libraries already on system -- enables all --with-system-* flags.]),
1652 AC_ARG_WITH(system-bzip2,
1653     AS_HELP_STRING([--with-system-bzip2],
1654         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1655     [with_system_bzip2="$with_system_libs"])
1657 AC_ARG_WITH(system-headers,
1658     AS_HELP_STRING([--with-system-headers],
1659         [Use headers already on system -- enables all --with-system-* flags for
1660          external packages whose headers are the only entities used i.e.
1661          boost/odbc/sane-header(s).]),,
1662     [with_system_headers="$with_system_libs"])
1664 AC_ARG_WITH(system-jars,
1665     AS_HELP_STRING([--without-system-jars],
1666         [When building with --with-system-libs, also the needed jars are expected
1667          on the system. Use this to disable that]),,
1668     [with_system_jars="$with_system_libs"])
1670 AC_ARG_WITH(system-cairo,
1671     AS_HELP_STRING([--with-system-cairo],
1672         [Use cairo libraries already on system.  Happens automatically for
1673          (implicit) --enable-gtk and for --enable-gtk3.]))
1675 AC_ARG_WITH(system-epoxy,
1676     AS_HELP_STRING([--with-system-epoxy],
1677         [Use epoxy libraries already on system.  Happens automatically for
1678          --enable-gtk3.]),,
1679        [with_system_epoxy="$with_system_libs"])
1681 AC_ARG_WITH(myspell-dicts,
1682     AS_HELP_STRING([--with-myspell-dicts],
1683         [Adds myspell dictionaries to the LibreOffice installation set]),
1686 AC_ARG_WITH(system-dicts,
1687     AS_HELP_STRING([--without-system-dicts],
1688         [Do not use dictionaries from system paths.]),
1691 AC_ARG_WITH(external-dict-dir,
1692     AS_HELP_STRING([--with-external-dict-dir],
1693         [Specify external dictionary dir.]),
1696 AC_ARG_WITH(external-hyph-dir,
1697     AS_HELP_STRING([--with-external-hyph-dir],
1698         [Specify external hyphenation pattern dir.]),
1701 AC_ARG_WITH(external-thes-dir,
1702     AS_HELP_STRING([--with-external-thes-dir],
1703         [Specify external thesaurus dir.]),
1706 AC_ARG_WITH(system-zlib,
1707     AS_HELP_STRING([--with-system-zlib],
1708         [Use zlib already on system.]),,
1709     [with_system_zlib=auto])
1711 AC_ARG_WITH(system-jpeg,
1712     AS_HELP_STRING([--with-system-jpeg],
1713         [Use jpeg already on system.]),,
1714     [with_system_jpeg="$with_system_libs"])
1716 AC_ARG_WITH(system-clucene,
1717     AS_HELP_STRING([--with-system-clucene],
1718         [Use clucene already on system.]),,
1719     [with_system_clucene="$with_system_libs"])
1721 AC_ARG_WITH(system-expat,
1722     AS_HELP_STRING([--with-system-expat],
1723         [Use expat already on system.]),,
1724     [with_system_expat="$with_system_libs"])
1726 AC_ARG_WITH(system-libxml,
1727     AS_HELP_STRING([--with-system-libxml],
1728         [Use libxml/libxslt already on system.]),,
1729     [with_system_libxml=auto])
1731 AC_ARG_WITH(system-icu,
1732     AS_HELP_STRING([--with-system-icu],
1733         [Use icu already on system.]),,
1734     [with_system_icu="$with_system_libs"])
1736 AC_ARG_WITH(system-ucpp,
1737     AS_HELP_STRING([--with-system-ucpp],
1738         [Use ucpp already on system.]),,
1739     [])
1741 AC_ARG_WITH(system-openldap,
1742     AS_HELP_STRING([--with-system-openldap],
1743         [Use the OpenLDAP LDAP SDK already on system.]),,
1744     [with_system_openldap="$with_system_libs"])
1746 libo_FUZZ_ARG_ENABLE(poppler,
1747     AS_HELP_STRING([--disable-poppler],
1748         [Disable building Poppler.])
1751 AC_ARG_WITH(system-poppler,
1752     AS_HELP_STRING([--with-system-poppler],
1753         [Use system poppler (only needed for PDF import).]),,
1754     [with_system_poppler="$with_system_libs"])
1756 AC_ARG_WITH(system-gpgmepp,
1757     AS_HELP_STRING([--with-system-gpgmepp],
1758         [Use gpgmepp already on system]),,
1759     [with_system_gpgmepp="$with_system_libs"])
1761 AC_ARG_WITH(system-apache-commons,
1762     AS_HELP_STRING([--with-system-apache-commons],
1763         [Use Apache commons libraries already on system.]),,
1764     [with_system_apache_commons="$with_system_jars"])
1766 AC_ARG_WITH(system-mariadb,
1767     AS_HELP_STRING([--with-system-mariadb],
1768         [Use MariaDB/MySQL libraries already on system.]),,
1769     [with_system_mariadb="$with_system_libs"])
1771 AC_ARG_ENABLE(bundle-mariadb,
1772     AS_HELP_STRING([--enable-bundle-mariadb],
1773         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1776 AC_ARG_WITH(system-postgresql,
1777     AS_HELP_STRING([--with-system-postgresql],
1778         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1779          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1780     [with_system_postgresql="$with_system_libs"])
1782 AC_ARG_WITH(libpq-path,
1783     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1784         [Use this PostgreSQL C interface (libpq) installation for building
1785          the PostgreSQL-SDBC extension.]),
1788 AC_ARG_WITH(system-firebird,
1789     AS_HELP_STRING([--with-system-firebird],
1790         [Use Firebird libraries already on system, for building the Firebird-SDBC
1791          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1792     [with_system_firebird="$with_system_libs"])
1794 AC_ARG_WITH(system-libtommath,
1795             AS_HELP_STRING([--with-system-libtommath],
1796                            [Use libtommath already on system]),,
1797             [with_system_libtommath="$with_system_libs"])
1799 AC_ARG_WITH(system-hsqldb,
1800     AS_HELP_STRING([--with-system-hsqldb],
1801         [Use hsqldb already on system.]))
1803 AC_ARG_WITH(hsqldb-jar,
1804     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     HSQLDB_JAR=$withval)
1808 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1809     AS_HELP_STRING([--disable-scripting-beanshell],
1810         [Disable support for scripts in BeanShell.]),
1814 AC_ARG_WITH(system-beanshell,
1815     AS_HELP_STRING([--with-system-beanshell],
1816         [Use beanshell already on system.]),,
1817     [with_system_beanshell="$with_system_jars"])
1819 AC_ARG_WITH(beanshell-jar,
1820     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1821         [Specify path to jarfile manually.]),
1822     BSH_JAR=$withval)
1824 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1825     AS_HELP_STRING([--disable-scripting-javascript],
1826         [Disable support for scripts in JavaScript.]),
1830 AC_ARG_WITH(system-rhino,
1831     AS_HELP_STRING([--with-system-rhino],
1832         [Use rhino already on system.]),,)
1833 #    [with_system_rhino="$with_system_jars"])
1834 # Above is not used as we have different debug interface
1835 # patched into internal rhino. This code needs to be fixed
1836 # before we can enable it by default.
1838 AC_ARG_WITH(rhino-jar,
1839     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     RHINO_JAR=$withval)
1843 AC_ARG_WITH(commons-logging-jar,
1844     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1845         [Specify path to jarfile manually.]),
1846     COMMONS_LOGGING_JAR=$withval)
1848 AC_ARG_WITH(system-jfreereport,
1849     AS_HELP_STRING([--with-system-jfreereport],
1850         [Use JFreeReport already on system.]),,
1851     [with_system_jfreereport="$with_system_jars"])
1853 AC_ARG_WITH(sac-jar,
1854     AS_HELP_STRING([--with-sac-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     SAC_JAR=$withval)
1858 AC_ARG_WITH(libxml-jar,
1859     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     LIBXML_JAR=$withval)
1863 AC_ARG_WITH(flute-jar,
1864     AS_HELP_STRING([--with-flute-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     FLUTE_JAR=$withval)
1868 AC_ARG_WITH(jfreereport-jar,
1869     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     JFREEREPORT_JAR=$withval)
1873 AC_ARG_WITH(liblayout-jar,
1874     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBLAYOUT_JAR=$withval)
1878 AC_ARG_WITH(libloader-jar,
1879     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBLOADER_JAR=$withval)
1883 AC_ARG_WITH(libformula-jar,
1884     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1885         [Specify path to jarfile manually.]),
1886     LIBFORMULA_JAR=$withval)
1888 AC_ARG_WITH(librepository-jar,
1889     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1890         [Specify path to jarfile manually.]),
1891     LIBREPOSITORY_JAR=$withval)
1893 AC_ARG_WITH(libfonts-jar,
1894     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1895         [Specify path to jarfile manually.]),
1896     LIBFONTS_JAR=$withval)
1898 AC_ARG_WITH(libserializer-jar,
1899     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1900         [Specify path to jarfile manually.]),
1901     LIBSERIALIZER_JAR=$withval)
1903 AC_ARG_WITH(libbase-jar,
1904     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1905         [Specify path to jarfile manually.]),
1906     LIBBASE_JAR=$withval)
1908 AC_ARG_WITH(system-odbc,
1909     AS_HELP_STRING([--with-system-odbc],
1910         [Use the odbc headers already on system.]),,
1911     [with_system_odbc="auto"])
1913 AC_ARG_WITH(system-sane,
1914     AS_HELP_STRING([--with-system-sane],
1915         [Use sane.h already on system.]),,
1916     [with_system_sane="$with_system_headers"])
1918 AC_ARG_WITH(system-bluez,
1919     AS_HELP_STRING([--with-system-bluez],
1920         [Use bluetooth.h already on system.]),,
1921     [with_system_bluez="$with_system_headers"])
1923 AC_ARG_WITH(system-curl,
1924     AS_HELP_STRING([--with-system-curl],
1925         [Use curl already on system.]),,
1926     [with_system_curl=auto])
1928 AC_ARG_WITH(system-boost,
1929     AS_HELP_STRING([--with-system-boost],
1930         [Use boost already on system.]),,
1931     [with_system_boost="$with_system_headers"])
1933 AC_ARG_WITH(system-glm,
1934     AS_HELP_STRING([--with-system-glm],
1935         [Use glm already on system.]),,
1936     [with_system_glm="$with_system_headers"])
1938 AC_ARG_WITH(system-hunspell,
1939     AS_HELP_STRING([--with-system-hunspell],
1940         [Use libhunspell already on system.]),,
1941     [with_system_hunspell="$with_system_libs"])
1943 AC_ARG_WITH(system-mythes,
1944     AS_HELP_STRING([--with-system-mythes],
1945         [Use mythes already on system.]),,
1946     [with_system_mythes="$with_system_libs"])
1948 AC_ARG_WITH(system-altlinuxhyph,
1949     AS_HELP_STRING([--with-system-altlinuxhyph],
1950         [Use ALTLinuxhyph already on system.]),,
1951     [with_system_altlinuxhyph="$with_system_libs"])
1953 AC_ARG_WITH(system-lpsolve,
1954     AS_HELP_STRING([--with-system-lpsolve],
1955         [Use lpsolve already on system.]),,
1956     [with_system_lpsolve="$with_system_libs"])
1958 AC_ARG_WITH(system-coinmp,
1959     AS_HELP_STRING([--with-system-coinmp],
1960         [Use CoinMP already on system.]),,
1961     [with_system_coinmp="$with_system_libs"])
1963 AC_ARG_WITH(system-liblangtag,
1964     AS_HELP_STRING([--with-system-liblangtag],
1965         [Use liblangtag library already on system.]),,
1966     [with_system_liblangtag="$with_system_libs"])
1968 AC_ARG_WITH(webdav,
1969     AS_HELP_STRING([--with-webdav],
1970         [Specify which library to use for webdav implementation.
1971          Possible values: "neon", "serf", "no". The default value is "neon".
1972          Example: --with-webdav="serf"]),
1973     WITH_WEBDAV=$withval,
1974     WITH_WEBDAV="neon")
1976 AC_ARG_WITH(linker-hash-style,
1977     AS_HELP_STRING([--with-linker-hash-style],
1978         [Use linker with --hash-style=<style> when linking shared objects.
1979          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1980          if supported on the build system, and "sysv" otherwise.]))
1982 AC_ARG_WITH(jdk-home,
1983     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1984         [If you have installed JDK 8 or later on your system please supply the
1985          path here. Note that this is not the location of the java command but the
1986          location of the entire distribution.]),
1989 AC_ARG_WITH(help,
1990     AS_HELP_STRING([--with-help],
1991         [Enable the build of help. There is a special parameter "common" that
1992          can be used to bundle only the common part, .e.g help-specific icons.
1993          This is useful when you build the helpcontent separately.])
1994     [
1995                           Usage:     --with-help    build the old local help
1996                                  --without-help     no local help (default)
1997                                  --with-help=html   build the new HTML local help
1998                                  --with-help=online build the new HTML online help
1999     ],
2002 libo_FUZZ_ARG_WITH(java,
2003     AS_HELP_STRING([--with-java=<java command>],
2004         [Specify the name of the Java interpreter command. Typically "java"
2005          which is the default.
2007          To build without support for Java components, applets, accessibility
2008          or the XML filters written in Java, use --without-java or --with-java=no.]),
2009     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2010     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2013 AC_ARG_WITH(jvm-path,
2014     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2015         [Use a specific JVM search path at runtime.
2016          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2019 AC_ARG_WITH(ant-home,
2020     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2021         [If you have installed Jakarta Ant on your system, please supply the path here.
2022          Note that this is not the location of the Ant binary but the location
2023          of the entire distribution.]),
2026 AC_ARG_WITH(symbol-config,
2027     AS_HELP_STRING([--with-symbol-config],
2028         [Configuration for the crashreport symbol upload]),
2029         [],
2030         [with_symbol_config=no])
2032 AC_ARG_WITH(export-validation,
2033     AS_HELP_STRING([--without-export-validation],
2034         [Disable validating OOXML and ODF files as exported from in-tree tests.
2035          Use this option e.g. if your system only provides Java 5.]),
2036 ,with_export_validation=auto)
2038 AC_ARG_WITH(bffvalidator,
2039     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2040         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2041          Requires installed Microsoft Office Binary File Format Validator.
2042          Note: export-validation (--with-export-validation) is required to be turned on.
2043          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2044 ,with_bffvalidator=no)
2046 libo_FUZZ_ARG_WITH(junit,
2047     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2048         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2049          --without-junit disables those tests. Not relevant in the --without-java case.]),
2050 ,with_junit=yes)
2052 AC_ARG_WITH(hamcrest,
2053     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2054         [Specifies the hamcrest jar file to use for JUnit-based tests.
2055          --without-junit disables those tests. Not relevant in the --without-java case.]),
2056 ,with_hamcrest=yes)
2058 AC_ARG_WITH(perl-home,
2059     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2060         [If you have installed Perl 5 Distribution, on your system, please
2061          supply the path here. Note that this is not the location of the Perl
2062          binary but the location of the entire distribution.]),
2065 libo_FUZZ_ARG_WITH(doxygen,
2066     AS_HELP_STRING(
2067         [--with-doxygen=<absolute path to doxygen executable>],
2068         [Specifies the doxygen executable to use when generating ODK C/C++
2069          documentation. --without-doxygen disables generation of ODK C/C++
2070          documentation. Not relevant in the --disable-odk case.]),
2071 ,with_doxygen=yes)
2073 AC_ARG_WITH(visual-studio,
2074     AS_HELP_STRING([--with-visual-studio=<2017>],
2075         [Specify which Visual Studio version to use in case several are
2076          installed. Currently only 2017 is supported.]),
2079 AC_ARG_WITH(windows-sdk,
2080     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2081         [Specify which Windows SDK, or "Windows Kit", version to use
2082          in case the one that came with the selected Visual Studio
2083          is not what you want for some reason. Note that not all compiler/SDK
2084          combinations are supported. The intent is that this option should not
2085          be needed.]),
2088 AC_ARG_WITH(lang,
2089     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2090         [Use this option to build LibreOffice with additional UI language support.
2091          English (US) is always included by default.
2092          Separate multiple languages with space.
2093          For all languages, use --with-lang=ALL.]),
2096 AC_ARG_WITH(locales,
2097     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2098         [Use this option to limit the locale information built in.
2099          Separate multiple locales with space.
2100          Very experimental and might well break stuff.
2101          Just a desperate measure to shrink code and data size.
2102          By default all the locales available is included.
2103          This option is completely unrelated to --with-lang.])
2104     [
2105                           Affects also our character encoding conversion
2106                           tables for encodings mainly targeted for a
2107                           particular locale, like EUC-CN and EUC-TW for
2108                           zh, ISO-2022-JP for ja.
2110                           Affects also our add-on break iterator data for
2111                           some languages.
2113                           For the default, all locales, don't use this switch at all.
2114                           Specifying just the language part of a locale means all matching
2115                           locales will be included.
2116     ],
2119 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2120 libo_FUZZ_ARG_WITH(krb5,
2121     AS_HELP_STRING([--with-krb5],
2122         [Enable MIT Kerberos 5 support in modules that support it.
2123          By default automatically enabled on platforms
2124          where a good system Kerberos 5 is available.]),
2127 libo_FUZZ_ARG_WITH(gssapi,
2128     AS_HELP_STRING([--with-gssapi],
2129         [Enable GSSAPI support in modules that support it.
2130          By default automatically enabled on platforms
2131          where a good system GSSAPI is available.]),
2134 AC_ARG_WITH(iwyu,
2135     AS_HELP_STRING([--with-iwyu],
2136         [Use given IWYU binary path to check unneeded includes instead of building.
2137          Use only if you are hacking on it.]),
2140 libo_FUZZ_ARG_WITH(lxml,
2141     AS_HELP_STRING([--without-lxml],
2142         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2143          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2144          report widget classes and ids.]),
2147 libo_FUZZ_ARG_WITH(latest-c++,
2148     AS_HELP_STRING([--with-latest-c++],
2149         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2150          published standard.]),,
2151         [with_latest_c__=no])
2153 dnl ===================================================================
2154 dnl Branding
2155 dnl ===================================================================
2157 AC_ARG_WITH(branding,
2158     AS_HELP_STRING([--with-branding=/path/to/images],
2159         [Use given path to retrieve branding images set.])
2160     [
2161                           Search for intro.png about.svg and flat_logo.svg.
2162                           If any is missing, default ones will be used instead.
2164                           Search also progress.conf for progress
2165                           settings on intro screen :
2167                           PROGRESSBARCOLOR="255,255,255" Set color of
2168                           progress bar. Comma separated RGB decimal values.
2169                           PROGRESSSIZE="407,6" Set size of progress bar.
2170                           Comma separated decimal values (width, height).
2171                           PROGRESSPOSITION="61,317" Set position of progress
2172                           bar from left,top. Comma separated decimal values.
2173                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2174                           bar frame. Comma separated RGB decimal values.
2175                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2176                           bar text. Comma separated RGB decimal values.
2177                           PROGRESSTEXTBASELINE="287" Set vertical position of
2178                           progress bar text from top. Decimal value.
2180                           Default values will be used if not found.
2181     ],
2185 AC_ARG_WITH(extra-buildid,
2186     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2187         [Show addition build identification in about dialog.]),
2191 AC_ARG_WITH(vendor,
2192     AS_HELP_STRING([--with-vendor="John the Builder"],
2193         [Set vendor of the build.]),
2196 AC_ARG_WITH(android-package-name,
2197     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2198         [Set Android package name of the build.]),
2201 AC_ARG_WITH(compat-oowrappers,
2202     AS_HELP_STRING([--with-compat-oowrappers],
2203         [Install oo* wrappers in parallel with
2204          lo* ones to keep backward compatibility.
2205          Has effect only with make distro-pack-install]),
2208 AC_ARG_WITH(os-version,
2209     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2210         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2213 AC_ARG_WITH(mingw-cross-compiler,
2214     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2215         [Specify the MinGW cross-compiler to use.
2216          When building on the ODK on Unix and building unowinreg.dll,
2217          specify the MinGW C++ cross-compiler.]),
2220 AC_ARG_WITH(idlc-cpp,
2221     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2222         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2225 AC_ARG_WITH(build-version,
2226     AS_HELP_STRING([--with-build-version="Built by Jim"],
2227         [Allows the builder to add a custom version tag that will appear in the
2228          Help/About box for QA purposes.]),
2229 with_build_version=$withval,
2232 AC_ARG_WITH(parallelism,
2233     AS_HELP_STRING([--with-parallelism],
2234         [Number of jobs to run simultaneously during build. Parallel builds can
2235         save a lot of time on multi-cpu machines. Defaults to the number of
2236         CPUs on the machine, unless you configure --enable-icecream - then to
2237         10.]),
2240 AC_ARG_WITH(all-tarballs,
2241     AS_HELP_STRING([--with-all-tarballs],
2242         [Download all external tarballs unconditionally]))
2244 AC_ARG_WITH(gdrive-client-id,
2245     AS_HELP_STRING([--with-gdrive-client-id],
2246         [Provides the client id of the application for OAuth2 authentication
2247         on Google Drive. If either this or --with-gdrive-client-secret is
2248         empty, the feature will be disabled]),
2251 AC_ARG_WITH(gdrive-client-secret,
2252     AS_HELP_STRING([--with-gdrive-client-secret],
2253         [Provides the client secret of the application for OAuth2
2254         authentication on Google Drive. If either this or
2255         --with-gdrive-client-id is empty, the feature will be disabled]),
2258 AC_ARG_WITH(alfresco-cloud-client-id,
2259     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2260         [Provides the client id of the application for OAuth2 authentication
2261         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2262         empty, the feature will be disabled]),
2265 AC_ARG_WITH(alfresco-cloud-client-secret,
2266     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2267         [Provides the client secret of the application for OAuth2
2268         authentication on Alfresco Cloud. If either this or
2269         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2272 AC_ARG_WITH(onedrive-client-id,
2273     AS_HELP_STRING([--with-onedrive-client-id],
2274         [Provides the client id of the application for OAuth2 authentication
2275         on OneDrive. If either this or --with-onedrive-client-secret is
2276         empty, the feature will be disabled]),
2279 AC_ARG_WITH(onedrive-client-secret,
2280     AS_HELP_STRING([--with-onedrive-client-secret],
2281         [Provides the client secret of the application for OAuth2
2282         authentication on OneDrive. If either this or
2283         --with-onedrive-client-id is empty, the feature will be disabled]),
2285 dnl ===================================================================
2286 dnl Do we want to use pre-build binary tarball for recompile
2287 dnl ===================================================================
2289 if test "$enable_library_bin_tar" = "yes" ; then
2290     USE_LIBRARY_BIN_TAR=TRUE
2291 else
2292     USE_LIBRARY_BIN_TAR=
2294 AC_SUBST(USE_LIBRARY_BIN_TAR)
2296 dnl ===================================================================
2297 dnl Test whether build target is Release Build
2298 dnl ===================================================================
2299 AC_MSG_CHECKING([whether build target is Release Build])
2300 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2301     AC_MSG_RESULT([no])
2302     ENABLE_RELEASE_BUILD=
2303 else
2304     AC_MSG_RESULT([yes])
2305     ENABLE_RELEASE_BUILD=TRUE
2307 AC_SUBST(ENABLE_RELEASE_BUILD)
2309 dnl ===================================================================
2310 dnl Test whether to sign Windows Build
2311 dnl ===================================================================
2312 AC_MSG_CHECKING([whether to sign windows build])
2313 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2314     AC_MSG_RESULT([yes])
2315     WINDOWS_BUILD_SIGNING="TRUE"
2316 else
2317     AC_MSG_RESULT([no])
2318     WINDOWS_BUILD_SIGNING="FALSE"
2320 AC_SUBST(WINDOWS_BUILD_SIGNING)
2322 dnl ===================================================================
2323 dnl MacOSX build and runtime environment options
2324 dnl ===================================================================
2326 AC_ARG_WITH(macosx-sdk,
2327     AS_HELP_STRING([--with-macosx-sdk=<version>],
2328         [Prefer a specific SDK for building.])
2329     [
2330                           If the requested SDK is not available, a search for the oldest one will be done.
2331                           With current Xcode versions, only the latest SDK is included, so this option is
2332                           not terribly useful. It works fine to build with a new SDK and run the result
2333                           on an older OS.
2335                           e. g.: --with-macosx-sdk=10.9
2337                           there are 3 options to control the MacOSX build:
2338                           --with-macosx-sdk (referred as 'sdk' below)
2339                           --with-macosx-version-min-required (referred as 'min' below)
2340                           --with-macosx-version-max-allowed (referred as 'max' below)
2342                           the connection between these value and the default they take is as follow:
2343                           ( ? means not specified on the command line, s means the SDK version found,
2344                           constraint: 8 <= x <= y <= z)
2346                           ==========================================
2347                            command line      || config result
2348                           ==========================================
2349                           min  | max  | sdk  || min  | max  | sdk  |
2350                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2351                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2352                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2353                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2354                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2355                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2356                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2357                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2360                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2361                           for a detailed technical explanation of these variables
2363                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2364     ],
2367 AC_ARG_WITH(macosx-version-min-required,
2368     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2369         [set the minimum OS version needed to run the built LibreOffice])
2370     [
2371                           e. g.: --with-macos-version-min-required=10.9
2372                           see --with-macosx-sdk for more info
2373     ],
2376 AC_ARG_WITH(macosx-version-max-allowed,
2377     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2378         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2379     [
2380                           e. g.: --with-macos-version-max-allowed=10.9
2381                           see --with-macosx-sdk for more info
2382     ],
2386 dnl ===================================================================
2387 dnl options for stuff used during cross-compilation build
2388 dnl Not quite superseded by --with-build-platform-configure-options.
2389 dnl TODO: check, if the "force" option is still needed anywhere.
2390 dnl ===================================================================
2392 AC_ARG_WITH(system-icu-for-build,
2393     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2394         [Use icu already on system for build tools (cross-compilation only).]))
2397 dnl ===================================================================
2398 dnl Check for incompatible options set by fuzzing, and reset those
2399 dnl automatically to working combinations
2400 dnl ===================================================================
2402 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2403         "$enable_dbus" != "$enable_avahi"; then
2404     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2405     enable_avahi=$enable_dbus
2408 dnl ===================================================================
2409 dnl check for required programs (grep, awk, sed, bash)
2410 dnl ===================================================================
2412 pathmunge ()
2414     if test -n "$1"; then
2415         if test "$build_os" = "cygwin"; then
2416             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2417                 PathFormat "$1"
2418                 new_path=`cygpath -sm "$formatted_path"`
2419             else
2420                 PathFormat "$1"
2421                 new_path=`cygpath -u "$formatted_path"`
2422             fi
2423         else
2424             new_path="$1"
2425         fi
2426         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2427             if test "$2" = "after"; then
2428                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2429             else
2430                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2431             fi
2432         fi
2433         unset new_path
2434     fi
2437 AC_PROG_AWK
2438 AC_PATH_PROG( AWK, $AWK)
2439 if test -z "$AWK"; then
2440     AC_MSG_ERROR([install awk to run this script])
2443 AC_PATH_PROG(BASH, bash)
2444 if test -z "$BASH"; then
2445     AC_MSG_ERROR([bash not found in \$PATH])
2447 AC_SUBST(BASH)
2449 AC_MSG_CHECKING([for GNU or BSD tar])
2450 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2451     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2452     if test $? -eq 0;  then
2453         GNUTAR=$a
2454         break
2455     fi
2456 done
2457 AC_MSG_RESULT($GNUTAR)
2458 if test -z "$GNUTAR"; then
2459     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2461 AC_SUBST(GNUTAR)
2463 AC_MSG_CHECKING([for tar's option to strip components])
2464 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2465 if test $? -eq 0; then
2466     STRIP_COMPONENTS="--strip-components"
2467 else
2468     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2469     if test $? -eq 0; then
2470         STRIP_COMPONENTS="--strip-path"
2471     else
2472         STRIP_COMPONENTS="unsupported"
2473     fi
2475 AC_MSG_RESULT($STRIP_COMPONENTS)
2476 if test x$STRIP_COMPONENTS = xunsupported; then
2477     AC_MSG_ERROR([you need a tar that is able to strip components.])
2479 AC_SUBST(STRIP_COMPONENTS)
2481 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2482 dnl desktop OSes from "mobile" ones.
2484 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2485 dnl In other words, that when building for an OS that is not a
2486 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2488 dnl Note the direction of the implication; there is no assumption that
2489 dnl cross-compiling would imply a non-desktop OS.
2491 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2492     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2493     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2494     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2497 # Whether to build "avmedia" functionality or not.
2499 if test -z "$enable_avmedia"; then
2500     enable_avmedia=yes
2503 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2504 if test "$enable_avmedia" = yes; then
2505     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2506 else
2507     USE_AVMEDIA_DUMMY='TRUE'
2509 AC_SUBST(USE_AVMEDIA_DUMMY)
2511 # Decide whether to build database connectivity stuff (including
2512 # Base) or not. We probably don't want to on non-desktop OSes.
2513 if test -z "$enable_database_connectivity"; then
2514     # --disable-database-connectivity is unfinished work in progress
2515     # and the iOS test app doesn't link if we actually try to use it.
2516     # if test $_os != iOS -a $_os != Android; then
2517     if test $_os != iOS; then
2518         enable_database_connectivity=yes
2519     fi
2522 if test "$enable_database_connectivity" = yes; then
2523     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2524     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2527 if test -z "$enable_extensions"; then
2528     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2529     if test $_os != iOS; then
2530         enable_extensions=yes
2531     fi
2534 if test "$enable_extensions" = yes; then
2535     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2536     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2539 if test -z "$enable_scripting"; then
2540     # Disable scripting for iOS unless specifically overridden
2541     # with --enable-scripting.
2542     if test $_os != iOS; then
2543         enable_scripting=yes
2544     fi
2547 DISABLE_SCRIPTING=''
2548 if test "$enable_scripting" = yes; then
2549     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2550     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2551 else
2552     DISABLE_SCRIPTING='TRUE'
2553     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2556 if test $_os = iOS -o $_os = Android; then
2557     # Disable dynamic_loading always for iOS and Android
2558     enable_dynamic_loading=no
2559 elif test -z "$enable_dynamic_loading"; then
2560     # Otherwise enable it unless speficically disabled
2561     enable_dynamic_loading=yes
2564 DISABLE_DYNLOADING=''
2565 if test "$enable_dynamic_loading" = yes; then
2566     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2567 else
2568     DISABLE_DYNLOADING='TRUE'
2570 AC_SUBST(DISABLE_DYNLOADING)
2572 # remenber SYSBASE value
2573 AC_SUBST(SYSBASE)
2575 dnl ===================================================================
2576 dnl  Sort out various gallery compilation options
2577 dnl ===================================================================
2578 AC_MSG_CHECKING([how to build and package galleries])
2579 if test -n "${with_galleries}"; then
2580     if test "$with_galleries" = "build"; then
2581         WITH_GALLERY_BUILD=TRUE
2582         AC_MSG_RESULT([build from source images internally])
2583     elif test "$with_galleries" = "no"; then
2584         WITH_GALLERY_BUILD=
2585         AC_MSG_RESULT([disable non-internal gallery build])
2586     else
2587         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2588     fi
2589 else
2590     if test $_os != iOS -a $_os != Android; then
2591         WITH_GALLERY_BUILD=TRUE
2592         AC_MSG_RESULT([internal src images for desktop])
2593     else
2594         WITH_GALLERY_BUILD=
2595         AC_MSG_RESULT([disable src image build])
2596     fi
2598 AC_SUBST(WITH_GALLERY_BUILD)
2600 dnl ===================================================================
2601 dnl  Checks if ccache is available
2602 dnl ===================================================================
2603 if test "$_os" = "WINNT"; then
2604     # on windows/VC build do not use ccache
2605     CCACHE=""
2606 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2607     case "%$CC%$CXX%" in
2608     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2609     # assume that's good then
2610     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2611         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2612         ;;
2613     *)
2614         AC_PATH_PROG([CCACHE],[ccache],[not found])
2615         if test "$CCACHE" = "not found"; then
2616             CCACHE=""
2617         else
2618             # Need to check for ccache version: otherwise prevents
2619             # caching of the results (like "-x objective-c++" for Mac)
2620             if test $_os = Darwin -o $_os = iOS; then
2621                 # Check ccache version
2622                 AC_MSG_CHECKING([whether version of ccache is suitable])
2623                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2624                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2625                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2626                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2627                 else
2628                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2629                     CCACHE=""
2630                 fi
2631             fi
2632         fi
2633         ;;
2634     esac
2635 else
2636     CCACHE=""
2639 if test "$CCACHE" != ""; then
2640     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2641     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2642     if test "$ccache_size" = ""; then
2643         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2644         if test "$ccache_size" = ""; then
2645             ccache_size=0
2646         fi
2647         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2648         if test $ccache_size -lt 1024; then
2649             CCACHE=""
2650             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2651             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2652         else
2653             # warn that ccache may be too small for debug build
2654             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2655             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2656         fi
2657     else
2658         if test $ccache_size -lt 5; then
2659             #warn that ccache may be too small for debug build
2660             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2661             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2662         fi
2663     fi
2666 dnl ===================================================================
2667 dnl  Checks for C compiler,
2668 dnl  The check for the C++ compiler is later on.
2669 dnl ===================================================================
2670 if test "$_os" != "WINNT"; then
2671     GCC_HOME_SET="true"
2672     AC_MSG_CHECKING([gcc home])
2673     if test -z "$with_gcc_home"; then
2674         if test "$enable_icecream" = "yes"; then
2675             if test -d "/usr/lib/icecc/bin"; then
2676                 GCC_HOME="/usr/lib/icecc/"
2677             elif test -d "/usr/libexec/icecc/bin"; then
2678                 GCC_HOME="/usr/libexec/icecc/"
2679             elif test -d "/opt/icecream/bin"; then
2680                 GCC_HOME="/opt/icecream/"
2681             else
2682                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2684             fi
2685         else
2686             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2687             GCC_HOME_SET="false"
2688         fi
2689     else
2690         GCC_HOME="$with_gcc_home"
2691     fi
2692     AC_MSG_RESULT($GCC_HOME)
2693     AC_SUBST(GCC_HOME)
2695     if test "$GCC_HOME_SET" = "true"; then
2696         if test -z "$CC"; then
2697             CC="$GCC_HOME/bin/gcc"
2698         fi
2699         if test -z "$CXX"; then
2700             CXX="$GCC_HOME/bin/g++"
2701         fi
2702     fi
2705 COMPATH=`dirname "$CC"`
2706 if test "$COMPATH" = "."; then
2707     AC_PATH_PROGS(COMPATH, $CC)
2708     dnl double square bracket to get single because of M4 quote...
2709     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2711 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2713 dnl ===================================================================
2714 dnl Java support
2715 dnl ===================================================================
2716 AC_MSG_CHECKING([whether to build with Java support])
2717 if test "$with_java" != "no"; then
2718     if test "$DISABLE_SCRIPTING" = TRUE; then
2719         AC_MSG_RESULT([no, overridden by --disable-scripting])
2720         ENABLE_JAVA=""
2721         with_java=no
2722     else
2723         AC_MSG_RESULT([yes])
2724         ENABLE_JAVA="TRUE"
2725         AC_DEFINE(HAVE_FEATURE_JAVA)
2726     fi
2727 else
2728     AC_MSG_RESULT([no])
2729     ENABLE_JAVA=""
2732 AC_SUBST(ENABLE_JAVA)
2734 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2736 dnl ENABLE_JAVA="" indicate no Java support at all
2738 dnl ===================================================================
2739 dnl Check OS X SDK and compiler
2740 dnl ===================================================================
2742 if test $_os = Darwin; then
2744     # If no --with-macosx-sdk option is given, look for one
2746     # The intent is that for "most" Mac-based developers, a suitable
2747     # SDK will be found automatically without any configure options.
2749     # For developers with a current Xcode, the lowest-numbered SDK
2750     # higher than or equal to the minimum required should be found.
2752     AC_MSG_CHECKING([what Mac OS X SDK to use])
2753     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2754         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2755         if test -d "$MACOSX_SDK_PATH"; then
2756             with_macosx_sdk="${_macosx_sdk}"
2757             break
2758         else
2759             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2760             if test -d "$MACOSX_SDK_PATH"; then
2761                 with_macosx_sdk="${_macosx_sdk}"
2762                 break
2763             fi
2764         fi
2765     done
2766     if test ! -d "$MACOSX_SDK_PATH"; then
2767         AC_MSG_ERROR([Could not find an appropriate Mac OS X SDK])
2768     fi
2770     if test $_os = iOS; then
2771         if test "$enable_ios_simulator" = "yes"; then
2772             useos=iphonesimulator
2773         else
2774             useos=iphoneos
2775         fi
2776         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2777     fi
2778     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2781     case $with_macosx_sdk in
2782     10.12)
2783         MACOSX_SDK_VERSION=101200
2784         ;;
2785     10.13)
2786         MACOSX_SDK_VERSION=101300
2787         ;;
2788     10.14)
2789         MACOSX_SDK_VERSION=101400
2790         ;;
2791     10.15)
2792         MACOSX_SDK_VERSION=101500
2793         ;;
2794     *)
2795         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2796         ;;
2797     esac
2799     if test "$with_macosx_version_min_required" = "" ; then
2800         with_macosx_version_min_required="10.9";
2801     fi
2803     if test "$with_macosx_version_max_allowed" = "" ; then
2804         with_macosx_version_max_allowed="$with_macosx_sdk"
2805     fi
2807     # export this so that "xcrun" invocations later return matching values
2808     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2809     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2810     export DEVELOPER_DIR
2811     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2812     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2814     case "$with_macosx_version_min_required" in
2815     10.9)
2816         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2817         ;;
2818     10.10)
2819         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2820         ;;
2821     10.11)
2822         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2823         ;;
2824     10.12)
2825         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2826         ;;
2827     10.13)
2828         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2829         ;;
2830     10.14)
2831         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2832         ;;
2833     10.15)
2834         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2835         ;;
2836     *)
2837         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--15])
2838         ;;
2839     esac
2840     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2842     LIBTOOL=/usr/bin/libtool
2843     INSTALL_NAME_TOOL=install_name_tool
2844     if test -z "$save_CC"; then
2845         AC_MSG_CHECKING([what compiler to use])
2846         stdlib=-stdlib=libc++
2847         if test "$ENABLE_LTO" = TRUE; then
2848             lto=-flto
2849         fi
2850         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2851         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2852         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2853         AR=`xcrun -find ar`
2854         NM=`xcrun -find nm`
2855         STRIP=`xcrun -find strip`
2856         LIBTOOL=`xcrun -find libtool`
2857         RANLIB=`xcrun -find ranlib`
2858         AC_MSG_RESULT([$CC and $CXX])
2859     fi
2861     case "$with_macosx_version_max_allowed" in
2862     10.9)
2863         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2864         ;;
2865     10.10)
2866         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2867         ;;
2868     10.11)
2869         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2870         ;;
2871     10.12)
2872         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2873         ;;
2874     10.13)
2875         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2876         ;;
2877     10.14)
2878         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2879         ;;
2880     10.15)
2881         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2882         ;;
2883     *)
2884         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--15])
2885         ;;
2886     esac
2888     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2889     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2890         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])
2891     else
2892         AC_MSG_RESULT([ok])
2893     fi
2895     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2896     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2897         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2898     else
2899         AC_MSG_RESULT([ok])
2900     fi
2901     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2902     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2904     AC_MSG_CHECKING([whether to do code signing])
2906     if test "$enable_macosx_code_signing" = yes; then
2907         # By default use the first suitable certificate (?).
2909         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2910         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2911         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2912         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2913         # "Developer ID Application" one.
2915         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2916         if test -n "$identity"; then
2917             MACOSX_CODESIGNING_IDENTITY=$identity
2918             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2919             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2920         else
2921             AC_MSG_ERROR([cannot determine identity to use])
2922         fi
2923     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2924         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2925         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2926         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2927     else
2928         AC_MSG_RESULT([no])
2929     fi
2931     AC_MSG_CHECKING([whether to create a Mac App Store package])
2933     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2934         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2935     elif test "$enable_macosx_package_signing" = yes; then
2936         # By default use the first suitable certificate.
2937         # It should be a "3rd Party Mac Developer Installer" one
2939         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2940         if test -n "$identity"; then
2941             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2942             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2943             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2944         else
2945             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2946         fi
2947     elif test -n "$enable_macosx_package_signing"; then
2948         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2949         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2950         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2951     else
2952         AC_MSG_RESULT([no])
2953     fi
2955     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2956         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2957     fi
2959     AC_MSG_CHECKING([whether to sandbox the application])
2961     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2962         AC_MSG_ERROR([OS X sandboxing requires code signing])
2963     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2964         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2965     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2966         ENABLE_MACOSX_SANDBOX=TRUE
2967         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2968         AC_MSG_RESULT([yes])
2969     else
2970         AC_MSG_RESULT([no])
2971     fi
2973     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2974     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2975     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2977 AC_SUBST(MACOSX_SDK_PATH)
2978 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2979 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2980 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2981 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2982 AC_SUBST(INSTALL_NAME_TOOL)
2983 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2984 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2985 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2986 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2987 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2989 dnl ===================================================================
2990 dnl Check iOS SDK and compiler
2991 dnl ===================================================================
2993 if test $_os = iOS; then
2994     AC_MSG_CHECKING([what iOS SDK to use])
2995     current_sdk_ver=14.0
2996     older_sdk_vers="13.7 13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
2997     if test "$enable_ios_simulator" = "yes"; then
2998         platform=iPhoneSimulator
2999         versionmin=-mios-simulator-version-min=12.2
3000     else
3001         platform=iPhoneOS
3002         versionmin=-miphoneos-version-min=12.2
3003     fi
3004     xcode_developer=`xcode-select -print-path`
3006     for sdkver in $current_sdk_ver $older_sdk_vers; do
3007         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3008         if test -d $t; then
3009             sysroot=$t
3010             break
3011         fi
3012     done
3014     if test -z "$sysroot"; then
3015         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3016     fi
3018     AC_MSG_RESULT($sysroot)
3020     # LTO is not really recommended for iOS builds,
3021     # the link time will be astronomical
3022     if test "$ENABLE_LTO" = TRUE; then
3023         lto=-flto
3024     fi
3026     stdlib="-stdlib=libc++"
3028     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3029     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3031     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3032     AR=`xcrun -find ar`
3033     NM=`xcrun -find nm`
3034     STRIP=`xcrun -find strip`
3035     LIBTOOL=`xcrun -find libtool`
3036     RANLIB=`xcrun -find ranlib`
3039 AC_MSG_CHECKING([whether to treat the installation as read-only])
3041 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3042         "$enable_extensions" != yes; then
3043     enable_readonly_installset=yes
3045 if test "$enable_readonly_installset" = yes; then
3046     AC_MSG_RESULT([yes])
3047     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3048 else
3049     AC_MSG_RESULT([no])
3052 dnl ===================================================================
3053 dnl Structure of install set
3054 dnl ===================================================================
3056 if test $_os = Darwin; then
3057     LIBO_BIN_FOLDER=MacOS
3058     LIBO_ETC_FOLDER=Resources
3059     LIBO_LIBEXEC_FOLDER=MacOS
3060     LIBO_LIB_FOLDER=Frameworks
3061     LIBO_LIB_PYUNO_FOLDER=Resources
3062     LIBO_SHARE_FOLDER=Resources
3063     LIBO_SHARE_HELP_FOLDER=Resources/help
3064     LIBO_SHARE_JAVA_FOLDER=Resources/java
3065     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3066     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3067     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3068     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3069     LIBO_URE_BIN_FOLDER=MacOS
3070     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3071     LIBO_URE_LIB_FOLDER=Frameworks
3072     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3073     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3074 elif test $_os = WINNT; then
3075     LIBO_BIN_FOLDER=program
3076     LIBO_ETC_FOLDER=program
3077     LIBO_LIBEXEC_FOLDER=program
3078     LIBO_LIB_FOLDER=program
3079     LIBO_LIB_PYUNO_FOLDER=program
3080     LIBO_SHARE_FOLDER=share
3081     LIBO_SHARE_HELP_FOLDER=help
3082     LIBO_SHARE_JAVA_FOLDER=program/classes
3083     LIBO_SHARE_PRESETS_FOLDER=presets
3084     LIBO_SHARE_READMES_FOLDER=readmes
3085     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3086     LIBO_SHARE_SHELL_FOLDER=program/shell
3087     LIBO_URE_BIN_FOLDER=program
3088     LIBO_URE_ETC_FOLDER=program
3089     LIBO_URE_LIB_FOLDER=program
3090     LIBO_URE_MISC_FOLDER=program
3091     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3092 else
3093     LIBO_BIN_FOLDER=program
3094     LIBO_ETC_FOLDER=program
3095     LIBO_LIBEXEC_FOLDER=program
3096     LIBO_LIB_FOLDER=program
3097     LIBO_LIB_PYUNO_FOLDER=program
3098     LIBO_SHARE_FOLDER=share
3099     LIBO_SHARE_HELP_FOLDER=help
3100     LIBO_SHARE_JAVA_FOLDER=program/classes
3101     LIBO_SHARE_PRESETS_FOLDER=presets
3102     LIBO_SHARE_READMES_FOLDER=readmes
3103     if test "$enable_fuzzers" != yes; then
3104         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3105     else
3106         LIBO_SHARE_RESOURCE_FOLDER=resource
3107     fi
3108     LIBO_SHARE_SHELL_FOLDER=program/shell
3109     LIBO_URE_BIN_FOLDER=program
3110     LIBO_URE_ETC_FOLDER=program
3111     LIBO_URE_LIB_FOLDER=program
3112     LIBO_URE_MISC_FOLDER=program
3113     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3115 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3118 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3119 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3120 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3121 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3122 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3123 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3124 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3125 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3126 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3127 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3128 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3129 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3130 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3132 # Not all of them needed in config_host.mk, add more if need arises
3133 AC_SUBST(LIBO_BIN_FOLDER)
3134 AC_SUBST(LIBO_ETC_FOLDER)
3135 AC_SUBST(LIBO_LIB_FOLDER)
3136 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3137 AC_SUBST(LIBO_SHARE_FOLDER)
3138 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3139 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3140 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3141 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3142 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3143 AC_SUBST(LIBO_URE_BIN_FOLDER)
3144 AC_SUBST(LIBO_URE_ETC_FOLDER)
3145 AC_SUBST(LIBO_URE_LIB_FOLDER)
3146 AC_SUBST(LIBO_URE_MISC_FOLDER)
3147 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3149 dnl ===================================================================
3150 dnl Windows specific tests and stuff
3151 dnl ===================================================================
3153 reg_get_value()
3155     # Return value: $regvalue
3156     unset regvalue
3158     local _regentry="/proc/registry${1}/${2}"
3159     if test -f "$_regentry"; then
3160         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3161         # Registry keys read via /proc/registry* are always \0 terminated!
3162         local _regvalue=$(tr -d '\0' < "$_regentry")
3163         if test $? -eq 0; then
3164             regvalue=$_regvalue
3165         fi
3166     fi
3169 # Get a value from the 32-bit side of the Registry
3170 reg_get_value_32()
3172     reg_get_value "32" "$1"
3175 # Get a value from the 64-bit side of the Registry
3176 reg_get_value_64()
3178     reg_get_value "64" "$1"
3181 if test "$_os" = "WINNT"; then
3182     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3183     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3184         AC_MSG_RESULT([no])
3185         WINDOWS_SDK_ARCH="x86"
3186     else
3187         AC_MSG_RESULT([yes])
3188         WINDOWS_SDK_ARCH="x64"
3189         BITNESS_OVERRIDE=64
3190     fi
3192 AC_SUBST(WINDOWS_SDK_ARCH)
3193 if test "$_os" = "iOS"; then
3194     cross_compiling="yes"
3197 if test "$cross_compiling" = "yes"; then
3198     export CROSS_COMPILING=TRUE
3199 else
3200     CROSS_COMPILING=
3201     BUILD_TYPE="$BUILD_TYPE NATIVE"
3203 AC_SUBST(CROSS_COMPILING)
3205 USE_LD=
3206 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3207     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3208     if test "$GCC" = "yes"; then
3209         ldflags_save=$LDFLAGS
3210         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3211         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3212 #include <stdio.h>
3213             ],[
3214 printf ("hello world\n");
3215             ])], USE_LD=$enable_ld, [])
3216         if test -n "$USE_LD"; then
3217             AC_MSG_RESULT( yes )
3218             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3219         else
3220             AC_MSG_ERROR( no )
3221         fi
3222     else
3223         AC_MSG_ERROR( not supported )
3224     fi
3226 AC_SUBST(USE_LD)
3228 ENABLE_GDB_INDEX=
3229 if test "$enable_gdb_index" = "yes"; then
3230     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3231     save_CFLAGS=$CFLAGS
3232     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3233     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3235     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3236     ldflags_save=$LDFLAGS
3237     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3238     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3239 #include <stdio.h>
3240         ],[
3241 printf ("hello world\n");
3242         ])], ENABLE_GDB_INDEX=TRUE, [])
3243     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3244         AC_MSG_RESULT( yes )
3245     else
3246         AC_MSG_ERROR( no )
3247     fi
3248     CFLAGS=$save_CFLAGS
3249     LDFLAGS=$ldflags_save
3251 AC_SUBST(ENABLE_GDB_INDEX)
3253 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3254 if test "$GCC" = "yes"; then
3255     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3256     bsymbolic_functions_ldflags_save=$LDFLAGS
3257     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3258     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3259 #include <stdio.h>
3260         ],[
3261 printf ("hello world\n");
3262         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3263     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3264         AC_MSG_RESULT( found )
3265     else
3266         AC_MSG_RESULT( not found )
3267     fi
3268     LDFLAGS=$bsymbolic_functions_ldflags_save
3270 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3272 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3273 # NOTE: must _not_ be used for bundled external libraries!
3274 ISYSTEM=
3275 if test "$GCC" = "yes"; then
3276     AC_MSG_CHECKING( for -isystem )
3277     save_CFLAGS=$CFLAGS
3278     CFLAGS="$CFLAGS -Werror"
3279     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3280     CFLAGS=$save_CFLAGS
3281     if test -n "$ISYSTEM"; then
3282         AC_MSG_RESULT(yes)
3283     else
3284         AC_MSG_RESULT(no)
3285     fi
3287 if test -z "$ISYSTEM"; then
3288     # fall back to using -I
3289     ISYSTEM=-I
3291 AC_SUBST(ISYSTEM)
3293 dnl ===================================================================
3294 dnl  Check which Visual Studio compiler is used
3295 dnl ===================================================================
3297 map_vs_year_to_version()
3299     # Return value: $vsversion
3301     unset vsversion
3303     case $1 in
3304     2017)
3305         vsversion=15.0;;
3306     *)
3307         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3308     esac
3311 vs_versions_to_check()
3313     # Args: $1 (optional) : versions to check, in the order of preference
3314     # Return value: $vsversions
3316     unset vsversions
3318     if test -n "$1"; then
3319         map_vs_year_to_version "$1"
3320         vsversions=$vsversion
3321     else
3322         # We accept only 2017
3323         vsversions="15.0"
3324     fi
3327 win_get_env_from_vsvars32bat()
3329     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3330     # Also seems to be located in another directory under the same name: vsvars32.bat
3331     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3332     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3333     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3334     chmod +x $WRAPPERBATCHFILEPATH
3335     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3336     rm -f $WRAPPERBATCHFILEPATH
3337     printf '%s' "$_win_get_env_from_vsvars32bat"
3340 find_ucrt()
3342     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3343     if test -n "$regvalue"; then
3344         PathFormat "$regvalue"
3345         UCRTSDKDIR=$formatted_path
3346         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3347         UCRTVERSION=$regvalue
3348         # Rest if not exist
3349         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3350           UCRTSDKDIR=
3351         fi
3352     fi
3353     if test -z "$UCRTSDKDIR"; then
3354         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3355         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3356         if test -f "$ide_env_file"; then
3357             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3358             UCRTSDKDIR=$formatted_path
3359             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3360             dnl Hack needed at least by tml:
3361             if test "$UCRTVERSION" = 10.0.15063.0 \
3362                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3363                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3364             then
3365                 UCRTVERSION=10.0.14393.0
3366             fi
3367         else
3368           AC_MSG_ERROR([No UCRT found])
3369         fi
3370     fi
3373 find_msvc()
3375     # Find Visual C++ 2017
3376     # Args: $1 (optional) : The VS version year
3377     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3379     unset vctest vcnum vcnumwithdot vcbuildnumber
3381     vs_versions_to_check "$1"
3383     for ver in $vsversions; do
3384         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3385         if test -n "$regvalue"; then
3386             vctest=$regvalue
3387             break
3388         fi
3389         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3390         if test -n "$regvalue"; then
3391             AC_MSG_RESULT([found: $regvalue])
3392             PathFormat "$regvalue"
3393             vctest=$formatted_path
3394             break
3395         fi
3396     done
3397     if test -n "$vctest"; then
3398         vcnumwithdot=$ver
3399         case "$vcnumwithdot" in
3400         15.0)
3401             vcyear=2017
3402             vcnum=150
3403             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3404             ;;
3405         esac
3406     fi
3409 SOLARINC=
3410 MSBUILD_PATH=
3411 DEVENV=
3412 if test "$_os" = "WINNT"; then
3413     AC_MSG_CHECKING([Visual C++])
3415     find_msvc "$with_visual_studio"
3416     if test -z "$vctest"; then
3417         if test -n "$with_visual_studio"; then
3418             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3419         else
3420             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3421         fi
3422     fi
3424     if test "$BITNESS_OVERRIDE" = ""; then
3425         if test -f "$vctest/bin/cl.exe"; then
3426             VC_PRODUCT_DIR=$vctest
3427         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3428             VC_PRODUCT_DIR=$vctest/VC
3429         else
3430             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3431         fi
3432     else
3433         if test -f "$vctest/bin/amd64/cl.exe"; then
3434             VC_PRODUCT_DIR=$vctest
3435         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3436             VC_PRODUCT_DIR=$vctest/VC
3437         else
3438             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])
3439         fi
3440     fi
3442     AC_MSG_CHECKING([for short pathname of VC product directory])
3443     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3444     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3446     UCRTSDKDIR=
3447     UCRTVERSION=
3449     AC_MSG_CHECKING([for UCRT location])
3450     find_ucrt
3451     # find_ucrt errors out if it doesn't find it
3452     AC_MSG_RESULT([found])
3453     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3454     ucrtincpath_formatted=$formatted_path
3455     # SOLARINC is used for external modules and must be set too.
3456     # And no, it's not sufficient to set SOLARINC only, as configure
3457     # itself doesn't honour it.
3458     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3459     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3460     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3461     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3463     AC_SUBST(UCRTSDKDIR)
3464     AC_SUBST(UCRTVERSION)
3466     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3467     # Find the proper version of MSBuild.exe to use based on the VS version
3468     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3469     if test -n "$regvalue" ; then
3470         AC_MSG_RESULT([found: $regvalue])
3471         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3472     else
3473         if test "$BITNESS_OVERRIDE" = ""; then
3474             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3475         else
3476             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3477         fi
3478         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3479         AC_MSG_RESULT([$regvalue])
3480     fi
3482     # Find the version of devenv.exe
3483     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3484     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3485     if test ! -e "$DEVENV"; then
3486         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3487     fi
3489     dnl ===========================================================
3490     dnl  Check for the corresponding mspdb*.dll
3491     dnl ===========================================================
3493     MSPDB_PATH=
3494     CL_DIR=
3495     CL_LIB=
3497     if test "$BITNESS_OVERRIDE" = ""; then
3498         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3499         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3500     else
3501         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3502         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3503     fi
3505     # MSVC 15.0 has libraries from 14.0?
3506     mspdbnum="140"
3508     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3509         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3510     fi
3512     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3513     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3515     dnl The path needs to be added before cl is called
3516     PATH="$MSPDB_PATH:$PATH"
3518     AC_MSG_CHECKING([cl.exe])
3520     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3521     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3522     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3523     # is not enough?
3525     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3526     dnl needed when building CLR code:
3527     if test -z "$MSVC_CXX"; then
3528         if test "$BITNESS_OVERRIDE" = ""; then
3529             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3530                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3531             fi
3532         else
3533             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3534                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3535             fi
3536         fi
3538         # This gives us a posix path with 8.3 filename restrictions
3539         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3540     fi
3542     if test -z "$CC"; then
3543         CC=$MSVC_CXX
3544     fi
3545     if test "$BITNESS_OVERRIDE" = ""; then
3546         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3547         MSVC_CXX="$MSVC_CXX -arch:SSE"
3548     fi
3550     if test -n "$CC"; then
3551         # Remove /cl.exe from CC case insensitive
3552         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3553         if test "$BITNESS_OVERRIDE" = ""; then
3554            COMPATH="$VC_PRODUCT_DIR"
3555         else
3556             if test -n "$VC_PRODUCT_DIR"; then
3557                 COMPATH=$VC_PRODUCT_DIR
3558             fi
3559         fi
3560         if test "$BITNESS_OVERRIDE" = ""; then
3561             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3562             CC="$CC -arch:SSE"
3563         fi
3565         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3567         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3569         PathFormat "$COMPATH"
3570         COMPATH="$formatted_path"
3572         VCVER=$vcnum
3573         MSVSVER=$vcyear
3575         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3576         # are always "better", we list them in reverse chronological order.
3578         case $vcnum in
3579         150)
3580             COMEX=19
3581             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3582             ;;
3583         esac
3585         # The expectation is that --with-windows-sdk should not need to be used
3586         if test -n "$with_windows_sdk"; then
3587             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3588             *" "$with_windows_sdk" "*)
3589                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3590                 ;;
3591             *)
3592                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3593                 ;;
3594             esac
3595         fi
3597         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3598         ac_objext=obj
3599         ac_exeext=exe
3601     else
3602         AC_MSG_ERROR([Visual C++ not found after all, huh])
3603     fi
3605     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3606     # version of the Explorer extension (and maybe other small
3607     # bits, too) needed when installing a 32-bit LibreOffice on a
3608     # 64-bit OS. The 64-bit Explorer extension is a feature that
3609     # has been present since long in OOo. Don't confuse it with
3610     # building LibreOffice itself as 64-bit code.
3612     BUILD_X64=
3613     CXX_X64_BINARY=
3615     if test "$BITNESS_OVERRIDE" = ""; then
3616         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3617         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3618             # Prefer native x64 compiler to cross-compiler, in case we are running
3619             # the build on a 64-bit OS.
3620             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3621                 BUILD_X64=TRUE
3622                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3623             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3624                 BUILD_X64=TRUE
3625                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3626             fi
3627         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3628             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3629             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3630                 BUILD_X64=TRUE
3631                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3632             fi
3633         fi
3634         if test "$BUILD_X64" = TRUE; then
3635             AC_MSG_RESULT([found])
3636         else
3637             AC_MSG_RESULT([not found])
3638             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3639         fi
3640     else
3641         CXX_X64_BINARY=$MSVC_CXX
3642     fi
3643     AC_SUBST(BUILD_X64)
3645     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3646     AC_SUBST(CXX_X64_BINARY)
3648     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3649     # needed to support TWAIN scan on both 32- and 64-bit systems
3651     BUILD_X86=
3652     CXX_X86_BINARY=
3654     if test "$BITNESS_OVERRIDE" = "64"; then
3655         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3656         if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3657             BUILD_X86=TRUE
3658             CXX_X86_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe -arch:SSE"
3659             AC_MSG_RESULT([found])
3660         else
3661             AC_MSG_RESULT([not found])
3662             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3663         fi
3664     else
3665         BUILD_X86=TRUE
3666         CXX_X86_BINARY=$MSVC_CXX
3667     fi
3668     AC_SUBST(BUILD_X86)
3669     AC_SUBST(CXX_X86_BINARY)
3671 AC_SUBST(VCVER)
3672 AC_SUBST(DEVENV)
3673 PathFormat "$MSPDB_PATH"
3674 MSPDB_PATH="$formatted_path"
3675 AC_SUBST(MSVC_CXX)
3678 # unowinreg.dll
3680 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3681 AC_SUBST(UNOWINREG_DLL)
3683 COM_IS_CLANG=
3684 AC_MSG_CHECKING([whether the compiler is actually Clang])
3685 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3686     #ifndef __clang__
3687     you lose
3688     #endif
3689     int foo=42;
3690     ]])],
3691     [AC_MSG_RESULT([yes])
3692      COM_IS_CLANG=TRUE],
3693     [AC_MSG_RESULT([no])])
3695 CC_PLAIN=$CC
3696 if test "$COM_IS_CLANG" = TRUE; then
3697     AC_MSG_CHECKING([the Clang version])
3698     if test "$_os" = WINNT; then
3699         dnl In which case, assume clang-cl:
3700         my_args="/EP /TC"
3701         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3702         dnl clang-cl:
3703         CC_PLAIN=
3704         for i in $CC; do
3705             case $i in
3706             -FIIntrin.h)
3707                 ;;
3708             *)
3709                 CC_PLAIN="$CC_PLAIN $i"
3710                 ;;
3711             esac
3712         done
3713     else
3714         my_args="-E -P"
3715     fi
3716     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3717     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3718     CLANGVER=`echo $clang_version \
3719         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3720     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3721     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3722     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3724 AC_SUBST(COM_IS_CLANG)
3725 AC_SUBST(CLANGVER)
3727 SHOWINCLUDES_PREFIX=
3728 if test "$_os" = WINNT; then
3729     dnl We need to guess the prefix of the -showIncludes output, it can be
3730     dnl localized
3731     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3732     echo "#include <stdlib.h>" > conftest.c
3733     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3734         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3735     rm -f conftest.c conftest.obj
3736     if test -z "$SHOWINCLUDES_PREFIX"; then
3737         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3738     else
3739         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3740     fi
3742 AC_SUBST(SHOWINCLUDES_PREFIX)
3745 # prefix C with ccache if needed
3747 if test "$CCACHE" != ""; then
3748     AC_MSG_CHECKING([whether $CC is already ccached])
3750     AC_LANG_PUSH([C])
3751     save_CFLAGS=$CFLAGS
3752     CFLAGS="$CFLAGS --ccache-skip -O2"
3753     dnl an empty program will do, we're checking the compiler flags
3754     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3755                       [use_ccache=yes], [use_ccache=no])
3756     if test $use_ccache = yes; then
3757         AC_MSG_RESULT([yes])
3758     else
3759         CC="$CCACHE $CC"
3760         AC_MSG_RESULT([no])
3761     fi
3762     CFLAGS=$save_CFLAGS
3763     AC_LANG_POP([C])
3766 # ===================================================================
3767 # check various GCC options that Clang does not support now but maybe
3768 # will somewhen in the future, check them even for GCC, so that the
3769 # flags are set
3770 # ===================================================================
3772 HAVE_GCC_GGDB2=
3773 HAVE_GCC_FINLINE_LIMIT=
3774 HAVE_GCC_FNO_INLINE=
3775 if test "$GCC" = "yes"; then
3776     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3777     save_CFLAGS=$CFLAGS
3778     CFLAGS="$CFLAGS -Werror -ggdb2"
3779     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3780     CFLAGS=$save_CFLAGS
3781     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3782         AC_MSG_RESULT([yes])
3783     else
3784         AC_MSG_RESULT([no])
3785     fi
3787     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3788     save_CFLAGS=$CFLAGS
3789     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3790     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3791     CFLAGS=$save_CFLAGS
3792     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3793         AC_MSG_RESULT([yes])
3794     else
3795         AC_MSG_RESULT([no])
3796     fi
3798     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3799     save_CFLAGS=$CFLAGS
3800     CFLAGS="$CFLAGS -Werror -fno-inline"
3801     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3802     CFLAGS=$save_CFLAGS
3803     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3804         AC_MSG_RESULT([yes])
3805     else
3806         AC_MSG_RESULT([no])
3807     fi
3809     if test "$host_cpu" = "m68k"; then
3810         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3811         save_CFLAGS=$CFLAGS
3812         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3813         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3814         CFLAGS=$save_CFLAGS
3815         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3816             AC_MSG_RESULT([yes])
3817         else
3818             AC_MSG_ERROR([no])
3819         fi
3820     fi
3822 AC_SUBST(HAVE_GCC_GGDB2)
3823 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3824 AC_SUBST(HAVE_GCC_FNO_INLINE)
3826 dnl ===================================================================
3827 dnl  Test the gcc version
3828 dnl ===================================================================
3829 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3830     AC_MSG_CHECKING([the GCC version])
3831     _gcc_version=`$CC -dumpversion`
3832     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3833         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3834     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3836     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3838     if test "$gcc_full_version" -lt 40801; then
3839         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3840     fi
3841 else
3842     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3843     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3844     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3845     # (which reports itself as GCC 4.2.1).
3846     GCC_VERSION=
3848 AC_SUBST(GCC_VERSION)
3850 dnl Set the ENABLE_DBGUTIL variable
3851 dnl ===================================================================
3852 AC_MSG_CHECKING([whether to build with additional debug utilities])
3853 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3854     ENABLE_DBGUTIL="TRUE"
3855     # this is an extra var so it can have different default on different MSVC
3856     # versions (in case there are version specific problems with it)
3857     MSVC_USE_DEBUG_RUNTIME="TRUE"
3859     AC_MSG_RESULT([yes])
3860     # cppunit and graphite expose STL in public headers
3861     if test "$with_system_cppunit" = "yes"; then
3862         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3863     else
3864         with_system_cppunit=no
3865     fi
3866     if test "$with_system_graphite" = "yes"; then
3867         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3868     else
3869         with_system_graphite=no
3870     fi
3871     if test "$with_system_orcus" = "yes"; then
3872         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3873     else
3874         with_system_orcus=no
3875     fi
3876     if test "$with_system_libcmis" = "yes"; then
3877         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3878     else
3879         with_system_libcmis=no
3880     fi
3881     if test "$with_system_hunspell" = "yes"; then
3882         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3883     else
3884         with_system_hunspell=no
3885     fi
3886     if test "$with_system_gpgmepp" = "yes"; then
3887         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3888     else
3889         with_system_gpgmepp=no
3890     fi
3891     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3892     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3893     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3894     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3895     # of those two is using the system variant:
3896     if test "$with_system_libnumbertext" = "yes"; then
3897         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3898     else
3899         with_system_libnumbertext=no
3900     fi
3901     if test "$with_system_libwps" = "yes"; then
3902         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3903     else
3904         with_system_libwps=no
3905     fi
3906 else
3907     ENABLE_DBGUTIL=""
3908     MSVC_USE_DEBUG_RUNTIME=""
3909     AC_MSG_RESULT([no])
3911 AC_SUBST(ENABLE_DBGUTIL)
3912 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3914 dnl Set the ENABLE_DEBUG variable.
3915 dnl ===================================================================
3916 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3917     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3919 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3920     if test -z "$libo_fuzzed_enable_debug"; then
3921         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3922     else
3923         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3924         enable_debug=yes
3925     fi
3928 AC_MSG_CHECKING([whether to do a debug build])
3929 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3930     ENABLE_DEBUG="TRUE"
3931     if test -n "$ENABLE_DBGUTIL" ; then
3932         AC_MSG_RESULT([yes (dbgutil)])
3933     else
3934         AC_MSG_RESULT([yes])
3935     fi
3936 else
3937     ENABLE_DEBUG=""
3938     AC_MSG_RESULT([no])
3940 AC_SUBST(ENABLE_DEBUG)
3942 if test "$enable_split_debug" = yes; then
3943     HAVE_GSPLIT_DWARF=
3944     if test "$GCC" = "yes"; then
3945         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3946         save_CFLAGS=$CFLAGS
3947         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3948         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3949         CFLAGS=$save_CFLAGS
3950         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3951             AC_MSG_RESULT([yes])
3952         else
3953             AC_MSG_RESULT([no])
3954         fi
3955     fi
3956     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3959 if test "$enable_sal_log" = yes; then
3960     ENABLE_SAL_LOG=TRUE
3962 AC_SUBST(ENABLE_SAL_LOG)
3964 dnl Selective debuginfo
3965 ENABLE_DEBUGINFO_FOR=
3966 if test -n "$ENABLE_DEBUG"; then
3967     AC_MSG_CHECKING([whether to use selective debuginfo])
3968     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3969         if test "$enable_selective_debuginfo" = "yes"; then
3970             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3971         fi
3972         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3973         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3974     else
3975         ENABLE_DEBUGINFO_FOR=all
3976         AC_MSG_RESULT([no, for all])
3977     fi
3978 else
3979     if test -n "$enable_selective_debuginfo"; then
3980         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3981     fi
3983 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3985 dnl Check for enable symbols option
3986 dnl ===================================================================
3987 AC_MSG_CHECKING([whether to generate debug information])
3988 if test -z "$enable_symbols"; then
3989     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3990         enable_symbols=yes
3991     else
3992         enable_symbols=no
3993     fi
3995 if test "$enable_symbols" != no; then
3996     ENABLE_SYMBOLS=TRUE
3997     AC_MSG_RESULT([yes])
3998 else
3999     ENABLE_SYMBOLS=
4000     AC_MSG_RESULT([no])
4002 AC_SUBST(ENABLE_SYMBOLS)
4004 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4005     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4006     AC_MSG_CHECKING([whether enough memory is available for linking])
4007     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4008     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4009     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4010         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4011     else
4012         AC_MSG_RESULT([yes])
4013     fi
4016 AC_MSG_CHECKING([whether to compile with optimization flags])
4017 if test -z "$enable_optimized"; then
4018     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4019         enable_optimized=no
4020     else
4021         enable_optimized=yes
4022     fi
4024 if test "$enable_optimized" != no; then
4025     ENABLE_OPTIMIZED=TRUE
4026     AC_MSG_RESULT([yes])
4027 else
4028     ENABLE_OPTIMIZED=
4029     AC_MSG_RESULT([no])
4031 AC_SUBST(ENABLE_OPTIMIZED)
4034 # determine CPUNAME, OS, ...
4035 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4037 case "$host_os" in
4039 aix*)
4040     COM=GCC
4041     CPUNAME=POWERPC
4042     USING_X11=TRUE
4043     OS=AIX
4044     RTL_OS=AIX
4045     RTL_ARCH=PowerPC
4046     PLATFORMID=aix_powerpc
4047     P_SEP=:
4048     ;;
4050 cygwin*)
4051     COM=MSC
4052     USING_X11=
4053     OS=WNT
4054     RTL_OS=Windows
4055     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4056         P_SEP=";"
4057     else
4058         P_SEP=:
4059     fi
4060     case "$host_cpu" in
4061     i*86|x86_64)
4062         if test "$BITNESS_OVERRIDE" = 64; then
4063             CPUNAME=X86_64
4064             RTL_ARCH=X86_64
4065             PLATFORMID=windows_x86_64
4066             WINDOWS_X64=1
4067             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4068         else
4069             CPUNAME=INTEL
4070             RTL_ARCH=x86
4071             PLATFORMID=windows_x86
4072         fi
4073         ;;
4074     *)
4075         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4076         ;;
4077     esac
4078     SCPDEFS="$SCPDEFS -D_MSC_VER"
4079     ;;
4081 darwin*)
4082     COM=GCC
4083     USING_X11=
4084     OS=MACOSX
4085     RTL_OS=MacOSX
4086     P_SEP=:
4088     case "$host_cpu" in
4089     arm)
4090         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4091         ;;
4092     arm64)
4093         OS=iOS
4094         RTL_OS=iOS
4095         if test "$enable_ios_simulator" = "yes"; then
4096             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4097         else
4098             CPUNAME=ARM64
4099             RTL_ARCH=ARM_EABI
4100             PLATFORMID=ios_arm64
4101         fi
4102         ;;
4103     i*86)
4104         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4105         ;;
4106     x86_64)
4107         if test "$enable_ios_simulator" = "yes"; then
4108             OS=iOS
4109         fi
4110         CPUNAME=X86_64
4111         RTL_ARCH=X86_64
4112         PLATFORMID=macosx_x86_64
4113         ;;
4114     *)
4115         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4116         ;;
4117     esac
4118     ;;
4120 dragonfly*)
4121     COM=GCC
4122     USING_X11=TRUE
4123     OS=DRAGONFLY
4124     RTL_OS=DragonFly
4125     P_SEP=:
4127     case "$host_cpu" in
4128     i*86)
4129         CPUNAME=INTEL
4130         RTL_ARCH=x86
4131         PLATFORMID=dragonfly_x86
4132         ;;
4133     x86_64)
4134         CPUNAME=X86_64
4135         RTL_ARCH=X86_64
4136         PLATFORMID=dragonfly_x86_64
4137         ;;
4138     *)
4139         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4140         ;;
4141     esac
4142     ;;
4144 freebsd*)
4145     COM=GCC
4146     USING_X11=TRUE
4147     RTL_OS=FreeBSD
4148     OS=FREEBSD
4149     P_SEP=:
4151     case "$host_cpu" in
4152     i*86)
4153         CPUNAME=INTEL
4154         RTL_ARCH=x86
4155         PLATFORMID=freebsd_x86
4156         ;;
4157     x86_64|amd64)
4158         CPUNAME=X86_64
4159         RTL_ARCH=X86_64
4160         PLATFORMID=freebsd_x86_64
4161         ;;
4162     *)
4163         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4164         ;;
4165     esac
4166     ;;
4168 haiku*)
4169     COM=GCC
4170     USING_X11=
4171     GUIBASE=haiku
4172     RTL_OS=Haiku
4173     OS=HAIKU
4174     P_SEP=:
4176     case "$host_cpu" in
4177     i*86)
4178         CPUNAME=INTEL
4179         RTL_ARCH=x86
4180         PLATFORMID=haiku_x86
4181         ;;
4182     x86_64|amd64)
4183         CPUNAME=X86_64
4184         RTL_ARCH=X86_64
4185         PLATFORMID=haiku_x86_64
4186         ;;
4187     *)
4188         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4189         ;;
4190     esac
4191     ;;
4193 kfreebsd*)
4194     COM=GCC
4195     USING_X11=TRUE
4196     OS=LINUX
4197     RTL_OS=kFreeBSD
4198     P_SEP=:
4200     case "$host_cpu" in
4202     i*86)
4203         CPUNAME=INTEL
4204         RTL_ARCH=x86
4205         PLATFORMID=kfreebsd_x86
4206         ;;
4207     x86_64)
4208         CPUNAME=X86_64
4209         RTL_ARCH=X86_64
4210         PLATFORMID=kfreebsd_x86_64
4211         ;;
4212     *)
4213         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4214         ;;
4215     esac
4216     ;;
4218 linux-gnu*)
4219     COM=GCC
4220     USING_X11=TRUE
4221     OS=LINUX
4222     RTL_OS=Linux
4223     P_SEP=:
4225     case "$host_cpu" in
4227     aarch64)
4228         CPUNAME=AARCH64
4229         PLATFORMID=linux_aarch64
4230         RTL_ARCH=AARCH64
4231         ;;
4232     alpha)
4233         CPUNAME=AXP
4234         RTL_ARCH=ALPHA
4235         PLATFORMID=linux_alpha
4236         ;;
4237     arm*)
4238         CPUNAME=ARM
4239         EPM_FLAGS="-a arm"
4240         RTL_ARCH=ARM_EABI
4241         PLATFORMID=linux_arm_eabi
4242         case "$host_cpu" in
4243         arm*-linux)
4244             RTL_ARCH=ARM_OABI
4245             PLATFORMID=linux_arm_oabi
4246             ;;
4247         esac
4248         ;;
4249     hppa)
4250         CPUNAME=HPPA
4251         RTL_ARCH=HPPA
4252         EPM_FLAGS="-a hppa"
4253         PLATFORMID=linux_hppa
4254         ;;
4255     i*86)
4256         CPUNAME=INTEL
4257         RTL_ARCH=x86
4258         PLATFORMID=linux_x86
4259         ;;
4260     ia64)
4261         CPUNAME=IA64
4262         RTL_ARCH=IA64
4263         PLATFORMID=linux_ia64
4264         ;;
4265     mips)
4266         CPUNAME=GODSON
4267         RTL_ARCH=MIPS_EB
4268         EPM_FLAGS="-a mips"
4269         PLATFORMID=linux_mips_eb
4270         ;;
4271     mips64)
4272         CPUNAME=GODSON64
4273         RTL_ARCH=MIPS64_EB
4274         EPM_FLAGS="-a mips64"
4275         PLATFORMID=linux_mips64_eb
4276         ;;
4277     mips64el)
4278         CPUNAME=GODSON64
4279         RTL_ARCH=MIPS64_EL
4280         EPM_FLAGS="-a mips64el"
4281         PLATFORMID=linux_mips64_el
4282         ;;
4283     mipsel)
4284         CPUNAME=GODSON
4285         RTL_ARCH=MIPS_EL
4286         EPM_FLAGS="-a mipsel"
4287         PLATFORMID=linux_mips_el
4288         ;;
4289     m68k)
4290         CPUNAME=M68K
4291         RTL_ARCH=M68K
4292         PLATFORMID=linux_m68k
4293         ;;
4294     powerpc)
4295         CPUNAME=POWERPC
4296         RTL_ARCH=PowerPC
4297         PLATFORMID=linux_powerpc
4298         ;;
4299     powerpc64)
4300         CPUNAME=POWERPC64
4301         RTL_ARCH=PowerPC_64
4302         PLATFORMID=linux_powerpc64
4303         ;;
4304     powerpc64le)
4305         CPUNAME=POWERPC64
4306         RTL_ARCH=PowerPC_64_LE
4307         PLATFORMID=linux_powerpc64_le
4308         ;;
4309     sparc)
4310         CPUNAME=SPARC
4311         RTL_ARCH=SPARC
4312         PLATFORMID=linux_sparc
4313         ;;
4314     sparc64)
4315         CPUNAME=SPARC64
4316         RTL_ARCH=SPARC64
4317         PLATFORMID=linux_sparc64
4318         ;;
4319     s390)
4320         CPUNAME=S390
4321         RTL_ARCH=S390
4322         PLATFORMID=linux_s390
4323         ;;
4324     s390x)
4325         CPUNAME=S390X
4326         RTL_ARCH=S390x
4327         PLATFORMID=linux_s390x
4328         ;;
4329     x86_64)
4330         CPUNAME=X86_64
4331         RTL_ARCH=X86_64
4332         PLATFORMID=linux_x86_64
4333         ;;
4334     *)
4335         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4336         ;;
4337     esac
4338     ;;
4340 linux-android*)
4341     COM=GCC
4342     USING_X11=
4343     OS=ANDROID
4344     RTL_OS=Android
4345     P_SEP=:
4347     case "$host_cpu" in
4349     arm|armel)
4350         CPUNAME=ARM
4351         RTL_ARCH=ARM_EABI
4352         PLATFORMID=android_arm_eabi
4353         ;;
4354     aarch64)
4355         CPUNAME=AARCH64
4356         RTL_ARCH=AARCH64
4357         PLATFORMID=android_aarch64
4358         ;;
4359     i*86)
4360         CPUNAME=INTEL
4361         RTL_ARCH=x86
4362         PLATFORMID=android_x86
4363         ;;
4364     x86_64)
4365         CPUNAME=X86_64
4366         RTL_ARCH=X86_64
4367         PLATFORMID=android_x86_64
4368         ;;
4369     *)
4370         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4371         ;;
4372     esac
4373     ;;
4375 *netbsd*)
4376     COM=GCC
4377     USING_X11=TRUE
4378     OS=NETBSD
4379     RTL_OS=NetBSD
4380     P_SEP=:
4382     case "$host_cpu" in
4383     i*86)
4384         CPUNAME=INTEL
4385         RTL_ARCH=x86
4386         PLATFORMID=netbsd_x86
4387         ;;
4388     powerpc)
4389         CPUNAME=POWERPC
4390         RTL_ARCH=PowerPC
4391         PLATFORMID=netbsd_powerpc
4392         ;;
4393     sparc)
4394         CPUNAME=SPARC
4395         RTL_ARCH=SPARC
4396         PLATFORMID=netbsd_sparc
4397         ;;
4398     x86_64)
4399         CPUNAME=X86_64
4400         RTL_ARCH=X86_64
4401         PLATFORMID=netbsd_x86_64
4402         ;;
4403     *)
4404         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4405         ;;
4406     esac
4407     ;;
4409 openbsd*)
4410     COM=GCC
4411     USING_X11=TRUE
4412     OS=OPENBSD
4413     RTL_OS=OpenBSD
4414     P_SEP=:
4416     case "$host_cpu" in
4417     i*86)
4418         CPUNAME=INTEL
4419         RTL_ARCH=x86
4420         PLATFORMID=openbsd_x86
4421         ;;
4422     x86_64)
4423         CPUNAME=X86_64
4424         RTL_ARCH=X86_64
4425         PLATFORMID=openbsd_x86_64
4426         ;;
4427     *)
4428         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4429         ;;
4430     esac
4431     SOLARINC="$SOLARINC -I/usr/local/include"
4432     ;;
4434 solaris*)
4435     COM=GCC
4436     USING_X11=TRUE
4437     OS=SOLARIS
4438     RTL_OS=Solaris
4439     P_SEP=:
4441     case "$host_cpu" in
4442     i*86)
4443         CPUNAME=INTEL
4444         RTL_ARCH=x86
4445         PLATFORMID=solaris_x86
4446         ;;
4447     sparc)
4448         CPUNAME=SPARC
4449         RTL_ARCH=SPARC
4450         PLATFORMID=solaris_sparc
4451         ;;
4452     sparc64)
4453         CPUNAME=SPARC64
4454         RTL_ARCH=SPARC64
4455         PLATFORMID=solaris_sparc64
4456         ;;
4457     *)
4458         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4459         ;;
4460     esac
4461     SOLARINC="$SOLARINC -I/usr/local/include"
4462     ;;
4465     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4466     ;;
4467 esac
4469 if test "$with_x" = "no"; then
4470     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4473 DISABLE_GUI=""
4474 if test "$enable_gui" = "no"; then
4475     if test "$USING_X11" != TRUE; then
4476         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4477     fi
4478     USING_X11=
4479     DISABLE_GUI=TRUE
4480     AC_DEFINE(HAVE_FEATURE_UI,0)
4481     test_cairo=yes
4483 AC_SUBST(DISABLE_GUI)
4485 WORKDIR="${BUILDDIR}/workdir"
4486 INSTDIR="${BUILDDIR}/instdir"
4487 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4488 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4489 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4490 AC_SUBST(COM)
4491 AC_SUBST(CPUNAME)
4492 AC_SUBST(RTL_OS)
4493 AC_SUBST(RTL_ARCH)
4494 AC_SUBST(EPM_FLAGS)
4495 AC_SUBST(USING_X11)
4496 AC_SUBST([INSTDIR])
4497 AC_SUBST([INSTROOT])
4498 AC_SUBST([INSTROOTBASE])
4499 AC_SUBST(OS)
4500 AC_SUBST(P_SEP)
4501 AC_SUBST(WORKDIR)
4502 AC_SUBST(PLATFORMID)
4503 AC_SUBST(WINDOWS_X64)
4504 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4506 dnl ===================================================================
4507 dnl Test which package format to use
4508 dnl ===================================================================
4509 AC_MSG_CHECKING([which package format to use])
4510 if test -n "$with_package_format" -a "$with_package_format" != no; then
4511     for i in $with_package_format; do
4512         case "$i" in
4513         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4514             ;;
4515         *)
4516             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4517 aix - AIX software distribution
4518 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4519 deb - Debian software distribution
4520 pkg - Solaris software distribution
4521 rpm - RedHat software distribution
4523 LibreOffice additionally supports:
4524 archive - .tar.gz or .zip
4525 dmg - Mac OS X .dmg
4526 installed - installation tree
4527 msi - Windows .msi
4528         ])
4529             ;;
4530         esac
4531     done
4532     # fakeroot is needed to ensure correct file ownerships/permissions
4533     # inside deb packages and tar archives created on Linux and Solaris.
4534     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4535         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4536         if test "$FAKEROOT" = "no"; then
4537             AC_MSG_ERROR(
4538                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4539         fi
4540     fi
4541     PKGFORMAT="$with_package_format"
4542     AC_MSG_RESULT([$PKGFORMAT])
4543 else
4544     PKGFORMAT=
4545     AC_MSG_RESULT([none])
4547 AC_SUBST(PKGFORMAT)
4549 dnl ===================================================================
4550 dnl Set up a different compiler to produce tools to run on the build
4551 dnl machine when doing cross-compilation
4552 dnl ===================================================================
4554 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4555 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4556 if test "$cross_compiling" = "yes"; then
4557     AC_MSG_CHECKING([for BUILD platform configuration])
4558     echo
4559     rm -rf CONF-FOR-BUILD config_build.mk
4560     mkdir CONF-FOR-BUILD
4561     # Here must be listed all files needed when running the configure script. In particular, also
4562     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4563     # keep them in the same order as there.
4564     (cd $SRC_ROOT && tar cf - \
4565         config.guess \
4566         bin/get_config_variables \
4567         solenv/bin/getcompver.awk \
4568         solenv/inc/langlist.mk \
4569         download.lst \
4570         config_host.mk.in \
4571         config_host_lang.mk.in \
4572         Makefile.in \
4573         lo.xcent.in \
4574         bin/bffvalidator.sh.in \
4575         bin/odfvalidator.sh.in \
4576         bin/officeotron.sh.in \
4577         instsetoo_native/util/openoffice.lst.in \
4578         setup_native/source/packinfo/finals_instsetoo.txt.in \
4579         config_host/*.in \
4580         sysui/desktop/macosx/Info.plist.in) \
4581     | (cd CONF-FOR-BUILD && tar xf -)
4582     cp configure CONF-FOR-BUILD
4583     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4584     (
4585     unset COM USING_X11 OS CPUNAME
4586     unset CC CXX SYSBASE CFLAGS
4587     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4588     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4589     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4590     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4591     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4592     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4593     cd CONF-FOR-BUILD
4594     sub_conf_opts=""
4595     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4596     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4597     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4598     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4599     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4600     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4601     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4602     # Don't bother having configure look for stuff not needed for the build platform anyway
4603     ./configure \
4604         --disable-cups \
4605         --disable-gtk \
4606         --disable-gtk3 \
4607         --disable-pdfimport \
4608         --disable-postgresql-sdbc \
4609         --enable-icecream="$enable_icecream" \
4610         --with-parallelism="$with_parallelism" \
4611         --without-doxygen \
4612         --without-java \
4613         $sub_conf_opts \
4614         --srcdir=$srcdir \
4615         2>&1 | sed -e 's/^/    /'
4616     test -f ./config_host.mk 2>/dev/null || exit
4617     cp config_host.mk ../config_build.mk
4618     cp config_host_lang.mk ../config_build_lang.mk
4619     mv config.log ../config.Build.log
4620     mkdir -p ../config_build
4621     mv config_host/*.h ../config_build
4622     . ./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
4624     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
4625         VV='$'$V
4626         VV=`eval "echo $VV"`
4627         if test -n "$VV"; then
4628             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4629             echo "$line" >>build-config
4630         fi
4631     done
4633     for V in INSTDIR INSTROOT WORKDIR; do
4634         VV='$'$V
4635         VV=`eval "echo $VV"`
4636         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4637         if test -n "$VV"; then
4638             line="${V}_FOR_BUILD='$VV'"
4639             echo "$line" >>build-config
4640         fi
4641     done
4643     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4644     echo "$line" >>build-config
4646     )
4647     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4648     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])
4649     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4650              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4652     eval `cat CONF-FOR-BUILD/build-config`
4654     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4656     rm -rf CONF-FOR-BUILD
4657 else
4658     OS_FOR_BUILD="$OS"
4659     CC_FOR_BUILD="$CC"
4660     CXX_FOR_BUILD="$CXX"
4661     INSTDIR_FOR_BUILD="$INSTDIR"
4662     INSTROOT_FOR_BUILD="$INSTROOT"
4663     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4664     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4665     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4666     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4667     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4668     WORKDIR_FOR_BUILD="$WORKDIR"
4670 AC_SUBST(OS_FOR_BUILD)
4671 AC_SUBST(INSTDIR_FOR_BUILD)
4672 AC_SUBST(INSTROOT_FOR_BUILD)
4673 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4674 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4675 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4676 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4677 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4678 AC_SUBST(WORKDIR_FOR_BUILD)
4680 dnl ===================================================================
4681 dnl Check for syslog header
4682 dnl ===================================================================
4683 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4685 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4686 dnl ===================================================================
4687 AC_MSG_CHECKING([whether to turn warnings to errors])
4688 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4689     ENABLE_WERROR="TRUE"
4690     AC_MSG_RESULT([yes])
4691 else
4692     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4693         ENABLE_WERROR="TRUE"
4694         AC_MSG_RESULT([yes])
4695     else
4696         AC_MSG_RESULT([no])
4697     fi
4699 AC_SUBST(ENABLE_WERROR)
4701 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4702 dnl ===================================================================
4703 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4704 if test -z "$enable_assert_always_abort"; then
4705    if test "$ENABLE_DEBUG" = TRUE; then
4706        enable_assert_always_abort=yes
4707    else
4708        enable_assert_always_abort=no
4709    fi
4711 if test "$enable_assert_always_abort" = "yes"; then
4712     ASSERT_ALWAYS_ABORT="TRUE"
4713     AC_MSG_RESULT([yes])
4714 else
4715     ASSERT_ALWAYS_ABORT="FALSE"
4716     AC_MSG_RESULT([no])
4718 AC_SUBST(ASSERT_ALWAYS_ABORT)
4720 # Determine whether to use ooenv for the instdir installation
4721 # ===================================================================
4722 if test $_os != "WINNT" -a $_os != "Darwin"; then
4723     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4724     if test "$enable_ooenv" = "no"; then
4725         AC_MSG_RESULT([no])
4726     else
4727         ENABLE_OOENV="TRUE"
4728         AC_MSG_RESULT([yes])
4729     fi
4731 AC_SUBST(ENABLE_OOENV)
4733 if test "$USING_X11" != TRUE; then
4734     # be sure to do not mess with unneeded stuff
4735     test_randr=no
4736     test_xrender=no
4737     test_cups=no
4738     test_dbus=no
4739     test_gtk=no
4740     build_gstreamer_1_0=no
4741     build_gstreamer_0_10=no
4742     test_kde4=no
4743     test_kde5=no
4744     test_qt5=no
4745     test_gtk3_kde5=no
4746     enable_cairo_canvas=no
4749 if test "$OS" = "HAIKU"; then
4750     enable_cairo_canvas=yes
4751     test_kde5=yes
4754 if test "$test_kde5" = "yes"; then
4755     test_qt5=yes
4758 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4759     if test "$enable_qt5" = "no"; then
4760         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4761     else
4762         enable_qt5=yes
4763     fi
4766 dnl ===================================================================
4767 dnl check for cups support
4768 dnl ===================================================================
4769 ENABLE_CUPS=""
4771 if test "$enable_cups" = "no"; then
4772     test_cups=no
4775 AC_MSG_CHECKING([whether to enable CUPS support])
4776 if test "$test_cups" = "yes"; then
4777     ENABLE_CUPS="TRUE"
4778     AC_MSG_RESULT([yes])
4780     AC_MSG_CHECKING([whether cups support is present])
4781     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4782     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4783     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4784         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4785     fi
4787 else
4788     AC_MSG_RESULT([no])
4791 AC_SUBST(ENABLE_CUPS)
4793 # fontconfig checks
4794 if test "$test_fontconfig" = "yes"; then
4795     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4796     SYSTEM_FONTCONFIG=TRUE
4797     FilterLibs "${FONTCONFIG_LIBS}"
4798     FONTCONFIG_LIBS="${filteredlibs}"
4800 AC_SUBST(FONTCONFIG_CFLAGS)
4801 AC_SUBST(FONTCONFIG_LIBS)
4802 AC_SUBST([SYSTEM_FONTCONFIG])
4804 dnl whether to find & fetch external tarballs?
4805 dnl ===================================================================
4806 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4807    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4808        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4809    else
4810        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4811    fi
4813 if test -z "$TARFILE_LOCATION"; then
4814     if test -d "$SRC_ROOT/src" ; then
4815         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4816         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4817     fi
4818     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4819 else
4820     AbsolutePath "$TARFILE_LOCATION"
4821     PathFormat "${absolute_path}"
4822     TARFILE_LOCATION="${formatted_path}"
4824 AC_SUBST(TARFILE_LOCATION)
4826 AC_MSG_CHECKING([whether we want to fetch tarballs])
4827 if test "$enable_fetch_external" != "no"; then
4828     if test "$with_all_tarballs" = "yes"; then
4829         AC_MSG_RESULT([yes, all of them])
4830         DO_FETCH_TARBALLS="ALL"
4831     else
4832         AC_MSG_RESULT([yes, if we use them])
4833         DO_FETCH_TARBALLS="TRUE"
4834     fi
4835 else
4836     AC_MSG_RESULT([no])
4837     DO_FETCH_TARBALLS=
4839 AC_SUBST(DO_FETCH_TARBALLS)
4841 AC_MSG_CHECKING([whether to build help])
4842 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4843     BUILD_TYPE="$BUILD_TYPE HELP"
4844     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4845     case "$with_help" in
4846     "html")
4847         ENABLE_HTMLHELP=TRUE
4848         SCPDEFS="$SCPDEFS -DWITH_HELP"
4849         AC_MSG_RESULT([HTML])
4850         ;;
4851     "online")
4852         ENABLE_HTMLHELP=TRUE
4853         HELP_ONLINE=TRUE
4854         AC_MSG_RESULT([HTML])
4855         ;;
4856     yes)
4857         SCPDEFS="$SCPDEFS -DWITH_HELP"
4858         AC_MSG_RESULT([yes])
4859         ;;
4860     *)
4861         AC_MSG_ERROR([Unknown --with-help=$with_help])
4862         ;;
4863     esac
4864 else
4865     AC_MSG_RESULT([no])
4867 AC_SUBST([ENABLE_HTMLHELP])
4868 AC_SUBST([HELP_ONLINE])
4870 dnl Test whether to include MySpell dictionaries
4871 dnl ===================================================================
4872 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4873 if test "$with_myspell_dicts" = "yes"; then
4874     AC_MSG_RESULT([yes])
4875     WITH_MYSPELL_DICTS=TRUE
4876     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4877     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4878 else
4879     AC_MSG_RESULT([no])
4880     WITH_MYSPELL_DICTS=
4882 AC_SUBST(WITH_MYSPELL_DICTS)
4884 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4885 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4886     if test "$with_system_dicts" = yes; then
4887         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4888     fi
4889     with_system_dicts=no
4892 AC_MSG_CHECKING([whether to use dicts from external paths])
4893 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4894     AC_MSG_RESULT([yes])
4895     SYSTEM_DICTS=TRUE
4896     AC_MSG_CHECKING([for spelling dictionary directory])
4897     if test -n "$with_external_dict_dir"; then
4898         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4899     else
4900         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4901         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4902             DICT_SYSTEM_DIR=file:///usr/share/myspell
4903         fi
4904     fi
4905     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4906     AC_MSG_CHECKING([for hyphenation patterns directory])
4907     if test -n "$with_external_hyph_dir"; then
4908         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4909     else
4910         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4911     fi
4912     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4913     AC_MSG_CHECKING([for thesaurus directory])
4914     if test -n "$with_external_thes_dir"; then
4915         THES_SYSTEM_DIR=file://$with_external_thes_dir
4916     else
4917         THES_SYSTEM_DIR=file:///usr/share/mythes
4918     fi
4919     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4920 else
4921     AC_MSG_RESULT([no])
4922     SYSTEM_DICTS=
4924 AC_SUBST(SYSTEM_DICTS)
4925 AC_SUBST(DICT_SYSTEM_DIR)
4926 AC_SUBST(HYPH_SYSTEM_DIR)
4927 AC_SUBST(THES_SYSTEM_DIR)
4929 dnl ===================================================================
4930 dnl enable pch by default on windows
4931 dnl enable it explicitly otherwise
4932 ENABLE_PCH=""
4933 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4934     if test -z "$libo_fuzzed_enable_pch"; then
4935         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4936     else
4937         AC_MSG_NOTICE([Resetting --enable-pch=no])
4938         enable_pch=no
4939     fi
4942 AC_MSG_CHECKING([whether to enable pch feature])
4943 if test "$enable_pch" != "no"; then
4944     if test "$_os" = "WINNT"; then
4945         ENABLE_PCH="TRUE"
4946         AC_MSG_RESULT([yes])
4947     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4948         ENABLE_PCH="TRUE"
4949         AC_MSG_RESULT([yes])
4950     elif test -n "$enable_pch"; then
4951         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4952     else
4953         AC_MSG_RESULT([no])
4954     fi
4955 else
4956     AC_MSG_RESULT([no])
4958 AC_SUBST(ENABLE_PCH)
4960 TAB=`printf '\t'`
4962 AC_MSG_CHECKING([the GNU Make version])
4963 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4964 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4965 if test "$_make_longver" -ge "038200"; then
4966     AC_MSG_RESULT([$GNUMAKE $_make_version])
4968 elif test "$_make_longver" -ge "038100"; then
4969     if test "$build_os" = "cygwin"; then
4970         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4971     fi
4972     AC_MSG_RESULT([$GNUMAKE $_make_version])
4974     dnl ===================================================================
4975     dnl Search all the common names for sha1sum
4976     dnl ===================================================================
4977     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4978     if test -z "$SHA1SUM"; then
4979         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4980     elif test "$SHA1SUM" = "openssl"; then
4981         SHA1SUM="openssl sha1"
4982     fi
4983     AC_MSG_CHECKING([for GNU Make bug 20033])
4984     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4985     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4986 A := \$(wildcard *.a)
4988 .PHONY: all
4989 all: \$(A:.a=.b)
4990 <TAB>@echo survived bug20033.
4992 .PHONY: setup
4993 setup:
4994 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4996 define d1
4997 @echo lala \$(1)
4998 @sleep 1
4999 endef
5001 define d2
5002 @echo tyty \$(1)
5003 @sleep 1
5004 endef
5006 %.b : %.a
5007 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5008 <TAB>\$(call d1,\$(CHECKSUM)),\
5009 <TAB>\$(call d2,\$(CHECKSUM)))
5011     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5012         no_parallelism_make="YES"
5013         AC_MSG_RESULT([yes, disable parallelism])
5014     else
5015         AC_MSG_RESULT([no, keep parallelism enabled])
5016     fi
5017     rm -rf $TESTGMAKEBUG20033
5018 else
5019     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5022 # find if gnumake support file function
5023 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5024 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5025 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5026     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5028 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5029 \$(file >test.txt,Success )
5031 .PHONY: all
5032 all:
5033 <TAB>@cat test.txt
5036 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5037 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5038     HAVE_GNUMAKE_FILE_FUNC=TRUE
5039     AC_MSG_RESULT([yes])
5040 else
5041     AC_MSG_RESULT([no])
5043 rm -rf $TESTGMAKEFILEFUNC
5044 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5045 AC_SUBST(GNUMAKE_WIN_NATIVE)
5047 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5048 STALE_MAKE=
5049 if test "$_make_ver_check" = ""; then
5050    STALE_MAKE=TRUE
5053 HAVE_LD_HASH_STYLE=FALSE
5054 WITH_LINKER_HASH_STYLE=
5055 AC_MSG_CHECKING([for --hash-style gcc linker support])
5056 if test "$GCC" = "yes"; then
5057     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5058         hash_styles="gnu sysv"
5059     elif test "$with_linker_hash_style" = "no"; then
5060         hash_styles=
5061     else
5062         hash_styles="$with_linker_hash_style"
5063     fi
5065     for hash_style in $hash_styles; do
5066         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5067         hash_style_ldflags_save=$LDFLAGS
5068         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5070         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5071             [
5072 #include <stdio.h>
5073             ],[
5074 printf ("");
5075             ])],
5076             [
5077                   HAVE_LD_HASH_STYLE=TRUE
5078                   WITH_LINKER_HASH_STYLE=$hash_style
5079             ],
5080             [HAVE_LD_HASH_STYLE=FALSE],
5081             [HAVE_LD_HASH_STYLE=FALSE])
5082         LDFLAGS=$hash_style_ldflags_save
5083     done
5085     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5086         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5087     else
5088         AC_MSG_RESULT( no )
5089     fi
5090     LDFLAGS=$hash_style_ldflags_save
5091 else
5092     AC_MSG_RESULT( no )
5094 AC_SUBST(HAVE_LD_HASH_STYLE)
5095 AC_SUBST(WITH_LINKER_HASH_STYLE)
5097 dnl ===================================================================
5098 dnl Check whether there's a Perl version available.
5099 dnl ===================================================================
5100 if test -z "$with_perl_home"; then
5101     AC_PATH_PROG(PERL, perl)
5102 else
5103     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5104     _perl_path="$with_perl_home/bin/perl"
5105     if test -x "$_perl_path"; then
5106         PERL=$_perl_path
5107     else
5108         AC_MSG_ERROR([$_perl_path not found])
5109     fi
5112 dnl ===================================================================
5113 dnl Testing for Perl version 5 or greater.
5114 dnl $] is the Perl version variable, it is returned as an integer
5115 dnl ===================================================================
5116 if test "$PERL"; then
5117     AC_MSG_CHECKING([the Perl version])
5118     ${PERL} -e "exit($]);"
5119     _perl_version=$?
5120     if test "$_perl_version" -lt 5; then
5121         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5122     fi
5123     AC_MSG_RESULT([Perl $_perl_version])
5124 else
5125     AC_MSG_ERROR([Perl not found, install Perl 5])
5128 dnl ===================================================================
5129 dnl Testing for required Perl modules
5130 dnl ===================================================================
5132 AC_MSG_CHECKING([for required Perl modules])
5133 perl_use_string="use Cwd ; use Digest::MD5"
5134 if test "$_os" = "WINNT"; then
5135     if test -n "$PKGFORMAT"; then
5136         for i in $PKGFORMAT; do
5137             case "$i" in
5138             msi)
5139                 # for getting fonts versions to use in MSI
5140                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5141                 ;;
5142             esac
5143         done
5144     fi
5146 if test "$with_system_hsqldb" = "yes"; then
5147         perl_use_string="$perl_use_string ; use Archive::Zip"
5149 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5150     AC_MSG_RESULT([all modules found])
5151 else
5152     AC_MSG_RESULT([failed to find some modules])
5153     # Find out which modules are missing.
5154     for i in $perl_use_string; do
5155         if test "$i" != "use" -a "$i" != ";"; then
5156             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5157                 missing_perl_modules="$missing_perl_modules $i"
5158             fi
5159         fi
5160     done
5161     AC_MSG_ERROR([
5162     The missing Perl modules are: $missing_perl_modules
5163     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5166 dnl ===================================================================
5167 dnl Check for pkg-config
5168 dnl ===================================================================
5169 if test "$_os" != "WINNT"; then
5170     PKG_PROG_PKG_CONFIG
5173 if test "$_os" != "WINNT"; then
5175     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5176     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5177     # explicitly. Or put /path/to/compiler in PATH yourself.
5179     # Use wrappers for LTO
5180     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5181         AC_CHECK_TOOL(AR,gcc-ar)
5182         AC_CHECK_TOOL(NM,gcc-nm)
5183         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5184     else
5185         AC_CHECK_TOOL(AR,ar)
5186         AC_CHECK_TOOL(NM,nm)
5187         AC_CHECK_TOOL(RANLIB,ranlib)
5188     fi
5189     AC_CHECK_TOOL(OBJDUMP,objdump)
5190     AC_CHECK_TOOL(READELF,readelf)
5191     AC_CHECK_TOOL(STRIP,strip)
5192     if test "$_os" = "WINNT"; then
5193         AC_CHECK_TOOL(DLLTOOL,dlltool)
5194         AC_CHECK_TOOL(WINDRES,windres)
5195     fi
5197 AC_SUBST(AR)
5198 AC_SUBST(DLLTOOL)
5199 AC_SUBST(NM)
5200 AC_SUBST(OBJDUMP)
5201 AC_SUBST(PKG_CONFIG)
5202 AC_SUBST(RANLIB)
5203 AC_SUBST(READELF)
5204 AC_SUBST(STRIP)
5205 AC_SUBST(WINDRES)
5207 dnl ===================================================================
5208 dnl pkg-config checks on Mac OS X
5209 dnl ===================================================================
5211 if test $_os = Darwin; then
5212     AC_MSG_CHECKING([for bogus pkg-config])
5213     if test -n "$PKG_CONFIG"; then
5214         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5215             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5216         else
5217             if test "$enable_bogus_pkg_config" = "yes"; then
5218                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5219             else
5220                 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.])
5221             fi
5222         fi
5223     else
5224         AC_MSG_RESULT([no, good])
5225     fi
5228 find_csc()
5230     # Return value: $csctest
5232     unset csctest
5234     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5235     if test -n "$regvalue"; then
5236         csctest=$regvalue
5237         return
5238     fi
5241 find_al()
5243     # Return value: $altest
5245     unset altest
5247     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5248         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5249         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5250             altest=$regvalue
5251             return
5252         fi
5253     done
5255     # We need this additional check to detect 4.6.1 or above.
5256     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5257         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5258         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5259             altest=$regvalue
5260             return
5261         fi
5263         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5264         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5265             altest=$regvalue
5266             return
5267         fi
5268     done
5271 find_dotnetsdk46()
5273     unset frametest
5275     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5276         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5277         if test -n "$regvalue"; then
5278             frametest=$regvalue
5279             return
5280         fi
5281         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5282         if test -n "$regvalue"; then
5283             frametest=$regvalue
5284             return
5285         fi
5286     done
5289 find_winsdk_version()
5291     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5292     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5294     unset winsdktest winsdkbinsubdir winsdklibsubdir
5296     case "$1" in
5297     7.*)
5298         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5299         if test -n "$regvalue"; then
5300             winsdktest=$regvalue
5301             winsdklibsubdir=.
5302             return
5303         fi
5304         ;;
5305     8.0|8.0A)
5306         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5307         if test -n "$regvalue"; then
5308             winsdktest=$regvalue
5309             winsdklibsubdir=win8
5310             return
5311         fi
5312         ;;
5313     8.1|8.1A)
5314         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5315         if test -n "$regvalue"; then
5316             winsdktest=$regvalue
5317             winsdklibsubdir=winv6.3
5318             return
5319         fi
5320         ;;
5321     10.0)
5322         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5323         if test -n "$regvalue"; then
5324             winsdktest=$regvalue
5325             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5326             if test -n "$regvalue"; then
5327                 winsdkbinsubdir="$regvalue".0
5328                 winsdklibsubdir=$winsdkbinsubdir
5329                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5330                 # test exist the SDK path
5331                 if test -d "$tmppath"; then
5332                    # when path is convertible to a short path then path is okay
5333                    if ! cygpath -d "$tmppath"; then
5334                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5335                    fi
5336                 else
5337                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5338                 fi
5339             fi
5340             return
5341         fi
5342         ;;
5343     esac
5346 find_winsdk()
5348     # Return value: From find_winsdk_version
5350     unset winsdktest
5352     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5353         find_winsdk_version $ver
5354         if test -n "$winsdktest"; then
5355             return
5356         fi
5357     done
5360 find_msms()
5362     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5363     if test $VCVER = 150; then
5364         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5365     fi
5366     AC_MSG_CHECKING([for ${my_msm_files}])
5367     msmdir=
5368     for ver in 14.0 15.0; do
5369         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5370         if test -n "$regvalue"; then
5371             for f in ${my_msm_files}; do
5372                 if test -e "$regvalue/${f}"; then
5373                     msmdir=$regvalue
5374                     break
5375                 fi
5376             done
5377         fi
5378     done
5379     dnl Is the following fallback really necessary, or was it added in response
5380     dnl to never having started Visual Studio on a given machine, so the
5381     dnl registry keys checked above had presumably not yet been created?
5382     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5383     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5384     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5385     dnl expanding to "C:\Program Files\Common Files"), which would need
5386     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5387     dnl obtain its value from cygwin:
5388     if test -z "$msmdir"; then
5389         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5390         for f in ${my_msm_files}; do
5391             if test -e "$my_msm_dir/${f}"; then
5392                 msmdir=$my_msm_dir
5393             fi
5394         done
5395     fi
5397     dnl Starting from MSVC 15.0, merge modules are located in different directory
5398     if test $VCVER = 150; then
5399         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5400             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5401             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5402             for f in ${my_msm_files}; do
5403                 if test -e "$my_msm_dir/${f}"; then
5404                     msmdir=$my_msm_dir
5405                     break
5406                 fi
5407             done
5408         done
5409     fi
5411     if test -n "$msmdir"; then
5412         msmdir=`cygpath -m "$msmdir"`
5413         AC_MSG_RESULT([$msmdir])
5414     else
5415         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5416             AC_MSG_ERROR([not found])
5417         else
5418             AC_MSG_WARN([not found])
5419             add_warning "MSM none of ${my_msm_files} found"
5420         fi
5421     fi
5424 find_msvc_x64_dlls()
5426     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5427     if test "$VCVER" = 150; then
5428         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5429             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5430             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5431                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5432                 break
5433             fi
5434             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5435                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5436                 break
5437             fi
5438         done
5439     fi
5440     msvcdlls="msvcp140.dll vcruntime140.dll"
5441     for dll in $msvcdlls; do
5442         if ! test -f "$msvcdllpath/$dll"; then
5443             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5444         fi
5445     done
5448 dnl =========================================
5449 dnl Check for the Windows  SDK.
5450 dnl =========================================
5451 if test "$_os" = "WINNT"; then
5452     AC_MSG_CHECKING([for Windows SDK])
5453     if test "$build_os" = "cygwin"; then
5454         find_winsdk
5455         WINDOWS_SDK_HOME=$winsdktest
5457         # normalize if found
5458         if test -n "$WINDOWS_SDK_HOME"; then
5459             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5460             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5461         fi
5463         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5464     fi
5466     if test -n "$WINDOWS_SDK_HOME"; then
5467         # Remove a possible trailing backslash
5468         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5470         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5471              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5472              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5473             have_windows_sdk_headers=yes
5474         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5475              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5476              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5477             have_windows_sdk_headers=yes
5478         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5479              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5480              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5481             have_windows_sdk_headers=yes
5482         else
5483             have_windows_sdk_headers=no
5484         fi
5486         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5487             have_windows_sdk_libs=yes
5488         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5489             have_windows_sdk_libs=yes
5490         else
5491             have_windows_sdk_libs=no
5492         fi
5494         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5495             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5496 the  Windows SDK are installed.])
5497         fi
5498     fi
5500     if test -z "$WINDOWS_SDK_HOME"; then
5501         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5502     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5503         WINDOWS_SDK_VERSION=70
5504         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5505     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5506         WINDOWS_SDK_VERSION=80
5507         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5508     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5509         WINDOWS_SDK_VERSION=81
5510         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5511     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5512         WINDOWS_SDK_VERSION=10
5513         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5514     else
5515         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5516     fi
5517     PathFormat "$WINDOWS_SDK_HOME"
5518     WINDOWS_SDK_HOME="$formatted_path"
5519     if test "$build_os" = "cygwin"; then
5520         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5521         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5522             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5523         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5524             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5525         fi
5526     fi
5528     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5529     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5530     dnl but not in v8.0), so allow this to be overridden with a
5531     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5532     dnl and configuration error if no WiLangId.vbs is found would arguably be
5533     dnl better, but I do not know under which conditions exactly it is needed by
5534     dnl msiglobal.pm:
5535     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5536         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5537         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5538             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5539         fi
5540         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5541             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5542         fi
5543         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5544             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5545         fi
5546     fi
5547     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5548         if test -n "$with_package_format" -a "$with_package_format" != no; then
5549             for i in "$with_package_format"; do
5550                 if test "$i" = "msi"; then
5551                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5552                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5553                     fi
5554                 fi
5555             done
5556         fi
5557     fi
5559 AC_SUBST(WINDOWS_SDK_HOME)
5560 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5561 AC_SUBST(WINDOWS_SDK_VERSION)
5562 AC_SUBST(WINDOWS_SDK_WILANGID)
5564 if test "$build_os" = "cygwin"; then
5565     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5566     dnl dir, it also determines that dir's path w/o an arch segment if any,
5567     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5568     AC_MSG_CHECKING([for midl.exe])
5570     find_winsdk
5571     if test -n "$winsdkbinsubdir" \
5572         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5573     then
5574         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5575         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5576     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5577         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5578         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5579     elif test -f "$winsdktest/Bin/midl.exe"; then
5580         MIDL_PATH=$winsdktest/Bin
5581         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5582     fi
5583     if test ! -f "$MIDL_PATH/midl.exe"; then
5584         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5585     else
5586         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5587     fi
5589     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5590     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5592     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5593          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5594          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5595          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5596     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5597          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5598          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5599          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5600     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5601          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5602          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5603          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5604     else
5605         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5606     fi
5608     dnl Check csc.exe
5609     AC_MSG_CHECKING([for csc.exe])
5610     find_csc
5611     if test -f "$csctest/csc.exe"; then
5612         CSC_PATH="$csctest"
5613     fi
5614     if test ! -f "$CSC_PATH/csc.exe"; then
5615         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5616     else
5617         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5618     fi
5620     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5622     dnl Check al.exe
5623     AC_MSG_CHECKING([for al.exe])
5624     find_winsdk
5625     if test -n "$winsdkbinsubdir" \
5626         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5627     then
5628         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5629     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5630         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5631     elif test -f "$winsdktest/Bin/al.exe"; then
5632         AL_PATH="$winsdktest/Bin"
5633     fi
5635     if test -z "$AL_PATH"; then
5636         find_al
5637         if test -f "$altest/bin/al.exe"; then
5638             AL_PATH="$altest/bin"
5639         elif test -f "$altest/al.exe"; then
5640             AL_PATH="$altest"
5641         fi
5642     fi
5643     if test ! -f "$AL_PATH/al.exe"; then
5644         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5645     else
5646         AC_MSG_RESULT([$AL_PATH/al.exe])
5647     fi
5649     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5651     dnl Check mscoree.lib / .NET Framework dir
5652     AC_MSG_CHECKING(.NET Framework)
5653     find_dotnetsdk46
5654     PathFormat "$frametest"
5655     frametest="$formatted_path"
5656     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5657         DOTNET_FRAMEWORK_HOME="$frametest"
5658     else
5659         find_winsdk
5660         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5661             DOTNET_FRAMEWORK_HOME="$winsdktest"
5662         fi
5663     fi
5664     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
5665         AC_MSG_ERROR([mscoree.lib not found])
5666     fi
5667     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5669     PathFormat "$MIDL_PATH"
5670     MIDL_PATH="$formatted_path"
5672     PathFormat "$AL_PATH"
5673     AL_PATH="$formatted_path"
5675     PathFormat "$DOTNET_FRAMEWORK_HOME"
5676     DOTNET_FRAMEWORK_HOME="$formatted_path"
5678     PathFormat "$CSC_PATH"
5679     CSC_PATH="$formatted_path"
5682 dnl ===================================================================
5683 dnl Check if stdc headers are available excluding MSVC.
5684 dnl ===================================================================
5685 if test "$_os" != "WINNT"; then
5686     AC_HEADER_STDC
5689 dnl ===================================================================
5690 dnl Testing for C++ compiler and version...
5691 dnl ===================================================================
5693 if test "$_os" != "WINNT"; then
5694     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5695     save_CXXFLAGS=$CXXFLAGS
5696     AC_PROG_CXX
5697     CXXFLAGS=$save_CXXFLAGS
5698 else
5699     if test -n "$CC" -a -z "$CXX"; then
5700         CXX="$CC"
5701     fi
5704 dnl check for GNU C++ compiler version
5705 if test "$GXX" = "yes"; then
5706     AC_MSG_CHECKING([the GNU C++ compiler version])
5708     _gpp_version=`$CXX -dumpversion`
5709     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5711     if test "$_gpp_majmin" -lt "401"; then
5712         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5713     else
5714         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5715     fi
5717     dnl see https://code.google.com/p/android/issues/detail?id=41770
5718     if test "$_gpp_majmin" -ge "401"; then
5719         glibcxx_threads=no
5720         AC_LANG_PUSH([C++])
5721         AC_REQUIRE_CPP
5722         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5723         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5724             #include <bits/c++config.h>]],[[
5725             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5726             && !defined(_GLIBCXX__PTHREADS) \
5727             && !defined(_GLIBCXX_HAS_GTHREADS)
5728             choke me
5729             #endif
5730         ]])],[AC_MSG_RESULT([yes])
5731         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5732         AC_LANG_POP([C++])
5733         if test $glibcxx_threads = yes; then
5734             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5735         fi
5736      fi
5738 AC_SUBST(BOOST_CXXFLAGS)
5741 # prefx CXX with ccache if needed
5743 if test "$CCACHE" != ""; then
5744     AC_MSG_CHECKING([whether $CXX is already ccached])
5745     AC_LANG_PUSH([C++])
5746     save_CXXFLAGS=$CXXFLAGS
5747     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5748     dnl an empty program will do, we're checking the compiler flags
5749     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5750                       [use_ccache=yes], [use_ccache=no])
5751     if test $use_ccache = yes; then
5752         AC_MSG_RESULT([yes])
5753     else
5754         CXX="$CCACHE $CXX"
5755         AC_MSG_RESULT([no])
5756     fi
5757     CXXFLAGS=$save_CXXFLAGS
5758     AC_LANG_POP([C++])
5761 dnl ===================================================================
5762 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5763 dnl ===================================================================
5765 if test "$_os" != "WINNT"; then
5766     AC_PROG_CXXCPP
5768     dnl Check whether there's a C pre-processor.
5769     AC_PROG_CPP
5773 dnl ===================================================================
5774 dnl Find integral type sizes and alignments
5775 dnl ===================================================================
5777 if test "$_os" != "WINNT"; then
5779 if test "$_os" == "iOS"; then
5780     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5781     ac_cv_sizeof_long=8
5782     ac_cv_sizeof_short=2
5783     ac_cv_sizeof_int=4
5784     ac_cv_sizeof_long_long=8
5785     ac_cv_sizeof_double=8
5786     ac_cv_sizeof_voidp=8
5787 else
5788     AC_CHECK_SIZEOF(long)
5789     AC_CHECK_SIZEOF(short)
5790     AC_CHECK_SIZEOF(int)
5791     AC_CHECK_SIZEOF(long long)
5792     AC_CHECK_SIZEOF(double)
5793     AC_CHECK_SIZEOF(void*)
5796     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5797     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5798     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5799     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5800     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5802     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5803     m4_pattern_allow([AC_CHECK_ALIGNOF])
5804     m4_ifdef([AC_CHECK_ALIGNOF],
5805         [
5806             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5807             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5808             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5809             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5810         ],
5811         [
5812             case "$_os-$host_cpu" in
5813             Linux-i686)
5814                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5815                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5816                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5817                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5818                 ;;
5819             Linux-x86_64)
5820                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5821                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5822                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5823                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5824                 ;;
5825             *)
5826                 if test -z "$ac_cv_alignof_short" -o \
5827                         -z "$ac_cv_alignof_int" -o \
5828                         -z "$ac_cv_alignof_long" -o \
5829                         -z "$ac_cv_alignof_double"; then
5830                    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.])
5831                 fi
5832                 ;;
5833             esac
5834         ])
5836     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5837     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5838     if test $ac_cv_sizeof_long -eq 8; then
5839         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5840     elif test $ac_cv_sizeof_double -eq 8; then
5841         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5842     else
5843         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5844     fi
5846     dnl Check for large file support
5847     AC_SYS_LARGEFILE
5848     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5849         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5850     fi
5851     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5852         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5853     fi
5854 else
5855     # Hardcode for MSVC
5856     SAL_TYPES_SIZEOFSHORT=2
5857     SAL_TYPES_SIZEOFINT=4
5858     SAL_TYPES_SIZEOFLONG=4
5859     SAL_TYPES_SIZEOFLONGLONG=8
5860     if test "$BITNESS_OVERRIDE" = ""; then
5861         SAL_TYPES_SIZEOFPOINTER=4
5862     else
5863         SAL_TYPES_SIZEOFPOINTER=8
5864     fi
5865     SAL_TYPES_ALIGNMENT2=2
5866     SAL_TYPES_ALIGNMENT4=4
5867     SAL_TYPES_ALIGNMENT8=8
5868     LFS_CFLAGS=''
5870 AC_SUBST(LFS_CFLAGS)
5872 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5873 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5874 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5875 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5876 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5877 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5878 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5879 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5881 dnl ===================================================================
5882 dnl Check whether to enable runtime optimizations
5883 dnl ===================================================================
5884 ENABLE_RUNTIME_OPTIMIZATIONS=
5885 AC_MSG_CHECKING([whether to enable runtime optimizations])
5886 if test -z "$enable_runtime_optimizations"; then
5887     for i in $CC; do
5888         case $i in
5889         -fsanitize=*)
5890             enable_runtime_optimizations=no
5891             break
5892             ;;
5893         esac
5894     done
5896 if test "$enable_runtime_optimizations" != no; then
5897     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5898     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5899     AC_MSG_RESULT([yes])
5900 else
5901     AC_MSG_RESULT([no])
5903 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5905 dnl ===================================================================
5906 dnl Check if valgrind headers are available
5907 dnl ===================================================================
5908 ENABLE_VALGRIND=
5909 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5910     prev_cppflags=$CPPFLAGS
5911     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5912     # or where does it come from?
5913     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5914     AC_CHECK_HEADER([valgrind/valgrind.h],
5915         [ENABLE_VALGRIND=TRUE])
5916     CPPFLAGS=$prev_cppflags
5918 AC_SUBST([ENABLE_VALGRIND])
5919 if test -z "$ENABLE_VALGRIND"; then
5920     if test "$with_valgrind" = yes; then
5921         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5922     fi
5923     VALGRIND_CFLAGS=
5925 AC_SUBST([VALGRIND_CFLAGS])
5928 dnl ===================================================================
5929 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5930 dnl ===================================================================
5932 # We need at least the sys/sdt.h include header.
5933 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5934 if test "$SDT_H_FOUND" = "TRUE"; then
5935     # Found sys/sdt.h header, now make sure the c++ compiler works.
5936     # Old g++ versions had problems with probes in constructors/destructors.
5937     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5938     AC_LANG_PUSH([C++])
5939     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5940     #include <sys/sdt.h>
5941     class ProbeClass
5942     {
5943     private:
5944       int& ref;
5945       const char *name;
5947     public:
5948       ProbeClass(int& v, const char *n) : ref(v), name(n)
5949       {
5950         DTRACE_PROBE2(_test_, cons, name, ref);
5951       }
5953       void method(int min)
5954       {
5955         DTRACE_PROBE3(_test_, meth, name, ref, min);
5956         ref -= min;
5957       }
5959       ~ProbeClass()
5960       {
5961         DTRACE_PROBE2(_test_, dest, name, ref);
5962       }
5963     };
5964     ]],[[
5965     int i = 64;
5966     DTRACE_PROBE1(_test_, call, i);
5967     ProbeClass inst = ProbeClass(i, "call");
5968     inst.method(24);
5969     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5970           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5971     AC_LANG_POP([C++])
5973 AC_CONFIG_HEADERS([config_host/config_probes.h])
5975 dnl ===================================================================
5976 dnl GCC features
5977 dnl ===================================================================
5978 HAVE_GCC_STACK_CLASH_PROTECTION=
5979 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5980     AC_MSG_CHECKING([whether $CC supports -fstack-clash-protection])
5981     save_CFLAGS=$CFLAGS
5982     CFLAGS="$CFLAGS -fstack-clash-protection"
5983     AC_LINK_IFELSE(
5984         [AC_LANG_PROGRAM(, [[return 0;]])],
5985         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
5986         [AC_MSG_RESULT([no])])
5987     CFLAGS=$save_CFLAGS
5989     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5990     save_CFLAGS=$CFLAGS
5991     CFLAGS="$CFLAGS -Werror -mno-avx"
5992     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5993     CFLAGS=$save_CFLAGS
5994     if test "$HAVE_GCC_AVX" = "TRUE"; then
5995         AC_MSG_RESULT([yes])
5996     else
5997         AC_MSG_RESULT([no])
5998     fi
6000     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
6001     save_CFLAGS=$CFLAGS
6002     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6003     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6004     CFLAGS=$save_CFLAGS
6005     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6006         AC_MSG_RESULT([yes])
6007     else
6008         AC_MSG_RESULT([no])
6009     fi
6011     AC_MSG_CHECKING([whether $CC supports atomic functions])
6012     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6013     int v = 0;
6014     if (__sync_add_and_fetch(&v, 1) != 1 ||
6015         __sync_sub_and_fetch(&v, 1) != 0)
6016         return 1;
6017     __sync_synchronize();
6018     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6019         v != 1)
6020         return 1;
6021     return 0;
6022 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6023     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6024         AC_MSG_RESULT([yes])
6025         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6026     else
6027         AC_MSG_RESULT([no])
6028     fi
6030     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
6031     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6032     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6033         AC_MSG_RESULT([yes])
6034         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6035     else
6036         AC_MSG_RESULT([no])
6037     fi
6039     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6040     save_CFLAGS=$CFLAGS
6041     CFLAGS="$CFLAGS -Werror"
6042     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6043             __attribute__((deprecated("test"))) void f();
6044         ])], [
6045             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6046             AC_MSG_RESULT([yes])
6047         ], [AC_MSG_RESULT([no])])
6048     CFLAGS=$save_CFLAGS
6050     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6051     AC_LANG_PUSH([C++])
6052     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6053             #include <cstddef>
6054             #include <cxxabi.h>
6055             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6056         ])], [
6057             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6058             AC_MSG_RESULT([yes])
6059         ], [AC_MSG_RESULT([no])])
6060     AC_LANG_POP([C++])
6062     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6063     AC_LANG_PUSH([C++])
6064     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6065             #include <cstddef>
6066             #include <cxxabi.h>
6067             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6068         ])], [
6069             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6070             AC_MSG_RESULT([yes])
6071         ], [AC_MSG_RESULT([no])])
6072     AC_LANG_POP([C++])
6074     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6075     AC_LANG_PUSH([C++])
6076     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6077             #include <cxxabi.h>
6078             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6079         ])], [
6080             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6081             AC_MSG_RESULT([yes])
6082         ], [AC_MSG_RESULT([no])])
6083     AC_LANG_POP([C++])
6085     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6086     AC_LANG_PUSH([C++])
6087     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6088             #include <cstddef>
6089             #include <cxxabi.h>
6090             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6091         ])], [
6092             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6093             AC_MSG_RESULT([yes])
6094         ], [AC_MSG_RESULT([no])])
6095     AC_LANG_POP([C++])
6097     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6098     AC_LANG_PUSH([C++])
6099     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6100             #include <cstddef>
6101             #include <cxxabi.h>
6102             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6103         ])], [
6104             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6105             AC_MSG_RESULT([yes])
6106         ], [AC_MSG_RESULT([no])])
6107     AC_LANG_POP([C++])
6109     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6110     AC_LANG_PUSH([C++])
6111     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6112             #include <cxxabi.h>
6113             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6114         ])], [
6115             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6116             AC_MSG_RESULT([yes])
6117         ], [AC_MSG_RESULT([no])])
6118     AC_LANG_POP([C++])
6120     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6121     AC_LANG_PUSH([C++])
6122     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6123             #include <cxxabi.h>
6124             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6125         ])], [
6126             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6127             AC_MSG_RESULT([yes])
6128         ], [AC_MSG_RESULT([no])])
6129     AC_LANG_POP([C++])
6131     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6132     AC_LANG_PUSH([C++])
6133     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6134             #include <cxxabi.h>
6135             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6136         ])], [
6137             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6138             AC_MSG_RESULT([yes])
6139         ], [AC_MSG_RESULT([no])])
6140     AC_LANG_POP([C++])
6142     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6143     AC_LANG_PUSH([C++])
6144     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6145             #include <cstddef>
6146             #include <cxxabi.h>
6147             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6148         ])], [
6149             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6150             AC_MSG_RESULT([yes])
6151         ], [AC_MSG_RESULT([no])])
6152     AC_LANG_POP([C++])
6154     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6155     AC_LANG_PUSH([C++])
6156     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6157             #include <cstddef>
6158             #include <cxxabi.h>
6159             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6160         ])], [
6161             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6162             AC_MSG_RESULT([yes])
6163         ], [AC_MSG_RESULT([no])])
6164     AC_LANG_POP([C++])
6166     dnl Available in GCC 4.9 and at least since Clang 3.4:
6167     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6168     AC_LANG_PUSH([C++])
6169     save_CXXFLAGS=$CXXFLAGS
6170     CXXFLAGS="$CXXFLAGS -Werror"
6171     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6172             struct __attribute__((warn_unused)) dummy {};
6173         ])], [
6174             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6175             AC_MSG_RESULT([yes])
6176         ], [AC_MSG_RESULT([no])])
6177     CXXFLAGS=$save_CXXFLAGS
6178 AC_LANG_POP([C++])
6181 AC_SUBST(HAVE_GCC_AVX)
6182 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6183 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6184 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6185 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6187 dnl ===================================================================
6188 dnl Identify the C++ library
6189 dnl ===================================================================
6191 AC_MSG_CHECKING([what the C++ library is])
6192 AC_LANG_PUSH([C++])
6193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6194 #include <utility>
6195 #ifndef __GLIBCXX__
6196 foo bar
6197 #endif
6198 ]])],
6199     [CPP_LIBRARY=GLIBCXX
6200      cpp_library_name="GNU libstdc++"
6201     ],
6202     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6203 #include <utility>
6204 #ifndef _LIBCPP_VERSION
6205 foo bar
6206 #endif
6207 ]])],
6208     [CPP_LIBRARY=LIBCPP
6209      cpp_library_name="LLVM libc++"
6210      AC_DEFINE([HAVE_LIBCXX])
6211     ],
6212     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6213 #include <utility>
6214 #ifndef _MSC_VER
6215 foo bar
6216 #endif
6217 ]])],
6218     [CPP_LIBRARY=MSVCRT
6219      cpp_library_name="Microsoft"
6220     ],
6221     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6222 AC_MSG_RESULT([$cpp_library_name])
6223 AC_LANG_POP([C++])
6225 dnl ===================================================================
6226 dnl Check for gperf
6227 dnl ===================================================================
6228 AC_PATH_PROG(GPERF, gperf)
6229 if test -z "$GPERF"; then
6230     AC_MSG_ERROR([gperf not found but needed. Install it.])
6232 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6233     GPERF=`cygpath -m $GPERF`
6235 AC_MSG_CHECKING([gperf version])
6236 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6237     AC_MSG_RESULT([OK])
6238 else
6239     AC_MSG_ERROR([too old, you need at least 3.0.0])
6241 AC_SUBST(GPERF)
6243 dnl ===================================================================
6244 dnl Check for system libcmis
6245 dnl ===================================================================
6246 # libcmis requires curl and we can't build curl for iOS
6247 if test $_os != iOS; then
6248     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6249     ENABLE_LIBCMIS=TRUE
6250 else
6251     ENABLE_LIBCMIS=
6253 AC_SUBST(ENABLE_LIBCMIS)
6255 dnl ===================================================================
6256 dnl C++11
6257 dnl ===================================================================
6259 my_cxx17switches=
6260 libo_FUZZ_ARG_ENABLE(c++17,
6261     AS_HELP_STRING([--disable-c++17],
6262         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6265 AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6266 CXXFLAGS_CXX11=
6267 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6268     if test "$with_latest_c__" = yes; then
6269         CXXFLAGS_CXX11=-std:c++latest
6270     else
6271         CXXFLAGS_CXX11=-std:c++17
6272     fi
6273 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6274     dnl But only use C++17 if the gperf that is being used knows not to emit
6275     dnl "register" in C++ output:
6276     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6277     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'
6278     if test "$enable_c__17" != no; then
6279         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6280         if test "$with_latest_c__" = yes; then
6281             my_flags="-std=gnu++2a -std=c++2a $my_flags"
6282         fi
6283     fi
6284     for flag in $my_flags; do
6285         if test "$COM" = MSC; then
6286             flag="-Xclang $flag"
6287         fi
6288         save_CXXFLAGS=$CXXFLAGS
6289         CXXFLAGS="$CXXFLAGS $flag -Werror"
6290         if test "$SYSTEM_LIBCMIS" = TRUE; then
6291             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6292         fi
6293         AC_LANG_PUSH([C++])
6294         dnl Clang 3.9 supports __float128 since
6295         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6296         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6297         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6298         dnl $flag is supported below, so check this first):
6299         my_float128hack=
6300         my_float128hack_impl=-D__float128=void
6301         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6302             #include <vector>
6303             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6304             // (__float128)
6305             ]])
6306         ],,[
6307             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6308             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6309             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6310             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6311             dnl place where __float128 is used is in a template specialization, -D__float128=void
6312             dnl will avoid the problem there while still causing a problem if somebody actually uses
6313             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6314             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6315             dnl "fixed" with this hack):
6316             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6317             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6318                 #include <vector>
6319                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6320                 // (__float128)
6321                 ]])
6322             ],[my_float128hack=$my_float128hack_impl])
6323         ])
6324         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6325             #include <algorithm>
6326             #include <functional>
6327             #include <vector>
6329             #include <string.h>
6330             #pragma GCC diagnostic push
6331             #pragma GCC diagnostic ignored "-Wpragmas"
6332                 // make GCC not warn about next pragma
6333             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6334                 // make Clang with -std < C++17 not even warn about register
6335             #include "conftest.inc"
6336             #pragma GCC diagnostic pop
6338             #if defined SYSTEM_LIBCMIS
6339             // See ucb/source/ucp/cmis/auth_provider.hxx:
6340             #if __GNUC__ >= 7
6341             #pragma GCC diagnostic push
6342             #pragma GCC diagnostic ignored "-Wdeprecated"
6343             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6344             #endif
6345             #include <libcmis/libcmis.hxx>
6346             #if __GNUC__ >= 7
6347             #pragma GCC diagnostic pop
6348             #endif
6349             #endif
6351             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6352                 std::sort(v.begin(), v.end(), fn);
6353             }
6354             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6355         AC_LANG_POP([C++])
6356         CXXFLAGS=$save_CXXFLAGS
6357         if test -n "$CXXFLAGS_CXX11"; then
6358             break
6359         fi
6360     done
6361     rm conftest.inc
6363 if test -n "$CXXFLAGS_CXX11"; then
6364     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6365 else
6366     AC_MSG_ERROR(no)
6368 AC_SUBST(CXXFLAGS_CXX11)
6370 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6371 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6372 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6373 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6374 dnl again towards 4.7.2:
6375 if test $CPP_LIBRARY = GLIBCXX; then
6376     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6377     AC_LANG_PUSH([C++])
6378     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6379 #include <list>
6380 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6381     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6382     //   GCC 4.7.0: 20120322
6383     //   GCC 4.7.1: 20120614
6384     // and using a range check is not possible as the mapping between
6385     // __GLIBCXX__ values and GCC versions is not monotonic
6386 /* ok */
6387 #else
6388 abi broken
6389 #endif
6390         ]])], [AC_MSG_RESULT(no, ok)],
6391         [AC_MSG_ERROR(yes)])
6392     AC_LANG_POP([C++])
6395 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6396 save_CXXFLAGS=$CXXFLAGS
6397 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6398 AC_LANG_PUSH([C++])
6400 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6401 #include <stddef.h>
6403 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6405 namespace
6407         struct b
6408         {
6409                 int i;
6410                 int j;
6411         };
6413 ]], [[
6414 struct a
6416         int i;
6417         int j;
6419 a thinga[]={{0,0}, {1,1}};
6420 b thingb[]={{0,0}, {1,1}};
6421 size_t i = sizeof(sal_n_array_size(thinga));
6422 size_t j = sizeof(sal_n_array_size(thingb));
6423 return !(i != 0 && j != 0);
6425     ], [ AC_MSG_RESULT(yes) ],
6426     [ AC_MSG_ERROR(no)])
6427 AC_LANG_POP([C++])
6428 CXXFLAGS=$save_CXXFLAGS
6430 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6431 save_CXXFLAGS=$CXXFLAGS
6432 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6433 AC_LANG_PUSH([C++])
6434 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6435     // A somewhat over-complicated way of checking for
6436     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6437     // in constexpr function":
6438     #include <cassert>
6439     template<typename T> inline constexpr T f(T x) { return x; }
6440     template<typename T> inline constexpr T g(T x) {
6441         assert(f(static_cast<int>(x)));
6442         return x;
6443     }
6444     enum E { e };
6445     auto v = g(E::e);
6447     struct S {
6448         int n_;
6449         constexpr bool f() {
6450             int n = n_;
6451             int i = 0;
6452             while (n > 0) { --n; ++i; }
6453             assert(i >= 0);
6454             return i == 0;
6455         }
6456     };
6457     constexpr auto v2 = S{10}.f();
6458     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6459 AC_LANG_POP([C++])
6460 CXXFLAGS=$save_CXXFLAGS
6461 AC_MSG_RESULT([$cxx14_constexpr])
6462 if test "$cxx14_constexpr" = yes; then
6463     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6466 dnl _Pragma support (may require C++11)
6467 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6468     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6469     AC_LANG_PUSH([C++])
6470     save_CXXFLAGS=$CXXFLAGS
6471     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6472     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6473             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6474         ])], [
6475             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6476             AC_MSG_RESULT([yes])
6477         ], [AC_MSG_RESULT([no])])
6478     AC_LANG_POP([C++])
6479     CXXFLAGS=$save_CXXFLAGS
6482 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6483 if test "$GCC" = yes; then
6484     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6485     AC_LANG_PUSH([C++])
6486     save_CXXFLAGS=$CXXFLAGS
6487     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6488     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6489     CXXFLAGS=$save_CXXFLAGS
6490     AC_LANG_POP([C++])
6491     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6492         AC_MSG_RESULT([yes])
6493     else
6494         AC_MSG_RESULT([no])
6495     fi
6497 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6499 AC_MSG_CHECKING([[whether $CXX supports [[fallthrough]]]])
6500 AC_LANG_PUSH([C++])
6501 save_CXXFLAGS=$CXXFLAGS
6502 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6503 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6504 if test "$COM" = MSC; then
6505     CXXFLAGS="$CXXFLAGS /we5030"
6506 else
6507     CXXFLAGS="$CXXFLAGS -Werror"
6509 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6510         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6511         // by checking for __cplusplus:
6512         #if __cplusplus > 201703L
6513         #if !__has_cpp_attribute(fallthrough)
6514         #error
6515         #endif
6516         #else
6517         void f(int & x) {
6518             switch (x) {
6519             case 0:
6520                 ++x;
6521                 [[fallthrough]];
6522             default:
6523                 ++x;
6524             }
6525         }
6526         #endif
6527     ]])], [
6528         AC_DEFINE([HAVE_CPP_ATTRIBUTE_FALLTHROUGH],[1])
6529         AC_MSG_RESULT([yes])
6530     ], [AC_MSG_RESULT([no])])
6531 CXXFLAGS=$save_CXXFLAGS
6532 AC_LANG_POP([C++])
6534 AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
6535 AC_LANG_PUSH([C++])
6536 save_CXXFLAGS=$CXXFLAGS
6537 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6538 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6539 if test "$COM" = MSC; then
6540     CXXFLAGS="$CXXFLAGS /we5030"
6541 else
6542     CXXFLAGS="$CXXFLAGS -Werror"
6544 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6545         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6546         // by checking for __cplusplus:
6547         #if __cplusplus > 201703L
6548         #if !__has_cpp_attribute(nodiscard)
6549         #error
6550         #endif
6551         #else
6552         [[nodiscard]] int f();
6553         #endif
6554     ]])], [
6555         AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
6556         AC_MSG_RESULT([yes])
6557     ], [AC_MSG_RESULT([no])])
6558 CXXFLAGS=$save_CXXFLAGS
6559 AC_LANG_POP([C++])
6561 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6562 AC_LANG_PUSH([C++])
6563 save_CXXFLAGS=$CXXFLAGS
6564 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6565 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6566         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6567         // supporting it:
6568         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6569         struct S {
6570         private:
6571             S(S const &);
6572         public:
6573             S();
6574             ~S();
6575         };
6576         S copy();
6577         void f() { S c(copy()); }
6578         #endif
6579     ])], [
6580         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6581         AC_MSG_RESULT([yes])
6582     ], [AC_MSG_RESULT([no])])
6583 CXXFLAGS=$save_CXXFLAGS
6584 AC_LANG_POP([C++])
6586 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6587 AC_LANG_PUSH([C++])
6588 save_CXXFLAGS=$CXXFLAGS
6589 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6590 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6591         #include <memory>
6592         struct S1 {};
6593         struct S2: S1 {};
6594         std::unique_ptr<S1> f() {
6595             std::unique_ptr<S2> s2(new S2);
6596             return s2;
6597         }
6598     ])], [
6599         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6600         AC_MSG_RESULT([yes])
6601     ], [AC_MSG_RESULT([no])])
6602 CXXFLAGS=$save_CXXFLAGS
6603 AC_LANG_POP([C++])
6605 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6606 AC_LANG_PUSH([C++])
6607 save_CXXFLAGS=$CXXFLAGS
6608 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6609 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6610         struct S1 { S1(S1 &&); };
6611         struct S2: S1 {};
6612         S1 f(S2 s) { return s; }
6613     ])], [
6614         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6615         AC_MSG_RESULT([yes])
6616     ], [AC_MSG_RESULT([no])])
6617 CXXFLAGS=$save_CXXFLAGS
6618 AC_LANG_POP([C++])
6620 dnl ===================================================================
6621 dnl system stl sanity tests
6622 dnl ===================================================================
6623 if test "$_os" != "WINNT"; then
6625     AC_LANG_PUSH([C++])
6627     save_CPPFLAGS="$CPPFLAGS"
6628     if test -n "$MACOSX_SDK_PATH"; then
6629         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6630     fi
6632     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6633     # only.
6634     if test "$CPP_LIBRARY" = GLIBCXX; then
6635         dnl gcc#19664, gcc#22482, rhbz#162935
6636         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6637         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6638         AC_MSG_RESULT([$stlvisok])
6639         if test "$stlvisok" = "no"; then
6640             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6641         fi
6642     fi
6644     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6645     # when we don't make any dynamic libraries?
6646     if test "$DISABLE_DYNLOADING" = ""; then
6647         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6648         cat > conftestlib1.cc <<_ACEOF
6649 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6650 struct S2: S1<int> { virtual ~S2(); };
6651 S2::~S2() {}
6652 _ACEOF
6653         cat > conftestlib2.cc <<_ACEOF
6654 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6655 struct S2: S1<int> { virtual ~S2(); };
6656 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6657 _ACEOF
6658         gccvisinlineshiddenok=yes
6659         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6660             gccvisinlineshiddenok=no
6661         else
6662             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6663             dnl known to not work with -z defs (unsetting which makes the test
6664             dnl moot, though):
6665             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6666             if test "$COM_IS_CLANG" = TRUE; then
6667                 for i in $CXX $CXXFLAGS; do
6668                     case $i in
6669                     -fsanitize=*)
6670                         my_linkflagsnoundefs=
6671                         break
6672                         ;;
6673                     esac
6674                 done
6675             fi
6676             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6677                 gccvisinlineshiddenok=no
6678             fi
6679         fi
6681         rm -fr libconftest*
6682         AC_MSG_RESULT([$gccvisinlineshiddenok])
6683         if test "$gccvisinlineshiddenok" = "no"; then
6684             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6685         fi
6686     fi
6688    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6689     cat >visibility.cxx <<_ACEOF
6690 #pragma GCC visibility push(hidden)
6691 struct __attribute__ ((visibility ("default"))) TestStruct {
6692   static void Init();
6694 __attribute__ ((visibility ("default"))) void TestFunc() {
6695   TestStruct::Init();
6697 _ACEOF
6698     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6699         gccvisbroken=yes
6700     else
6701         case "$host_cpu" in
6702         i?86|x86_64)
6703             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6704                 gccvisbroken=no
6705             else
6706                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6707                     gccvisbroken=no
6708                 else
6709                     gccvisbroken=yes
6710                 fi
6711             fi
6712             ;;
6713         *)
6714             gccvisbroken=no
6715             ;;
6716         esac
6717     fi
6718     rm -f visibility.s visibility.cxx
6720     AC_MSG_RESULT([$gccvisbroken])
6721     if test "$gccvisbroken" = "yes"; then
6722         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6723     fi
6725     CPPFLAGS="$save_CPPFLAGS"
6727     AC_LANG_POP([C++])
6730 dnl ===================================================================
6731 dnl  Clang++ tests
6732 dnl ===================================================================
6734 HAVE_GCC_FNO_DEFAULT_INLINE=
6735 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6736 if test "$GCC" = "yes"; then
6737     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6738     AC_LANG_PUSH([C++])
6739     save_CXXFLAGS=$CXXFLAGS
6740     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6741     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6742     CXXFLAGS=$save_CXXFLAGS
6743     AC_LANG_POP([C++])
6744     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6745         AC_MSG_RESULT([yes])
6746     else
6747         AC_MSG_RESULT([no])
6748     fi
6750     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6751     AC_LANG_PUSH([C++])
6752     save_CXXFLAGS=$CXXFLAGS
6753     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6754     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6755     CXXFLAGS=$save_CXXFLAGS
6756     AC_LANG_POP([C++])
6757     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6758         AC_MSG_RESULT([yes])
6759     else
6760         AC_MSG_RESULT([no])
6761     fi
6763 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6764 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6766 dnl ===================================================================
6767 dnl Compiler plugins
6768 dnl ===================================================================
6770 COMPILER_PLUGINS=
6771 # currently only Clang
6773 if test "$COM_IS_CLANG" != "TRUE"; then
6774     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6775         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6776         enable_compiler_plugins=no
6777     fi
6780 if test "$COM_IS_CLANG" = "TRUE"; then
6781     if test -n "$enable_compiler_plugins"; then
6782         compiler_plugins="$enable_compiler_plugins"
6783     elif test -n "$ENABLE_DBGUTIL"; then
6784         compiler_plugins=test
6785     else
6786         compiler_plugins=no
6787     fi
6788     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6789         if test "$compiler_plugins" = yes; then
6790             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6791         else
6792             compiler_plugins=no
6793         fi
6794     fi
6795     if test "$compiler_plugins" != "no"; then
6796         dnl The prefix where Clang resides, override to where Clang resides if
6797         dnl using a source build:
6798         if test -z "$CLANGDIR"; then
6799             CLANGDIR=/usr
6800         fi
6801         AC_LANG_PUSH([C++])
6802         save_CPPFLAGS=$CPPFLAGS
6803         save_CXX=$CXX
6804         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6805         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6806         CXX=$COMPILER_PLUGINS_CXX
6807         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6808         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6809             [COMPILER_PLUGINS=TRUE],
6810             [
6811             if test "$compiler_plugins" = "yes"; then
6812                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6813             else
6814                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6815                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6816             fi
6817             ])
6818         CXX=$save_CXX
6819         CPPFLAGS=$save_CPPFLAGS
6820         AC_LANG_POP([C++])
6821     fi
6822 else
6823     if test "$enable_compiler_plugins" = "yes"; then
6824         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6825     fi
6827 AC_SUBST(COMPILER_PLUGINS)
6828 AC_SUBST(COMPILER_PLUGINS_CXX)
6829 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6830 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6831 AC_SUBST(CLANGDIR)
6832 AC_SUBST(CLANGLIBDIR)
6834 # Plugin to help linker.
6835 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6836 # This makes --enable-lto build with clang work.
6837 AC_SUBST(LD_PLUGIN)
6839 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6840 AC_SUBST(HAVE_POSIX_FALLOCATE)
6842 dnl ===================================================================
6843 dnl Custom build version
6844 dnl ===================================================================
6846 AC_MSG_CHECKING([whether to add custom build version])
6847 if test "$with_build_version" != ""; then
6848     BUILD_VER_STRING=$with_build_version
6849     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6850 else
6851     BUILD_VER_STRING=
6852     AC_MSG_RESULT([no])
6854 AC_SUBST(BUILD_VER_STRING)
6856 JITC_PROCESSOR_TYPE=""
6857 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6858     # IBMs JDK needs this...
6859     JITC_PROCESSOR_TYPE=6
6860     export JITC_PROCESSOR_TYPE
6862 AC_SUBST([JITC_PROCESSOR_TYPE])
6864 # Misc Windows Stuff
6865 AC_ARG_WITH(ucrt-dir,
6866     AS_HELP_STRING([--with-ucrt-dir],
6867         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6868         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6869         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6870             Windows6.1-KB2999226-x64.msu
6871             Windows6.1-KB2999226-x86.msu
6872             Windows8.1-KB2999226-x64.msu
6873             Windows8.1-KB2999226-x86.msu
6874             Windows8-RT-KB2999226-x64.msu
6875             Windows8-RT-KB2999226-x86.msu
6876         A zip archive including those files is available from Microsoft site:
6877         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6879 UCRT_REDISTDIR="$with_ucrt_dir"
6880 if test $_os = "WINNT"; then
6881     find_msvc_x64_dlls
6882     find_msms
6883     MSVC_DLL_PATH="$msvcdllpath"
6884     MSVC_DLLS="$msvcdlls"
6885     MSM_PATH="$msmdir"
6886     # MSVC 15.3 changed it to VC141
6887     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6888         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6889     else
6890         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6891     fi
6892     if test "$UCRT_REDISTDIR" = "no"; then
6893         dnl explicitly disabled
6894         UCRT_REDISTDIR=""
6895     else
6896         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6897                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6898                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6899                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6900                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6901                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6902             UCRT_REDISTDIR=""
6903             if test -n "$PKGFORMAT"; then
6904                for i in $PKGFORMAT; do
6905                    case "$i" in
6906                    msi)
6907                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6908                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6909                        ;;
6910                    esac
6911                done
6912             fi
6913         fi
6914     fi
6917 AC_SUBST(UCRT_REDISTDIR)
6918 AC_SUBST(MSVC_DLL_PATH)
6919 AC_SUBST(MSVC_DLLS)
6920 AC_SUBST(MSM_PATH)
6922 dnl ===================================================================
6923 dnl Checks for Java
6924 dnl ===================================================================
6925 if test "$ENABLE_JAVA" != ""; then
6927     # Windows-specific tests
6928     if test "$build_os" = "cygwin"; then
6929         if test "$BITNESS_OVERRIDE" = 64; then
6930             bitness=64
6931         else
6932             bitness=32
6933         fi
6935         if test -z "$with_jdk_home"; then
6936             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6937             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6938             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6939             if test -n "$regvalue"; then
6940                 ver=$regvalue
6941                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6942                 _jdk_home=$regvalue
6943             fi
6944             if test -z "$with_jdk_home"; then
6945                 for ver in 1.8; do
6946                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6947                     if test -n "$regvalue"; then
6948                         _jdk_home=$regvalue
6949                         break
6950                     fi
6951                 done
6952             fi
6953             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6954                 with_jdk_home="$_jdk_home"
6955                 howfound="found automatically"
6956             else
6957                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6958             fi
6959         else
6960             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6961             howfound="you passed"
6962         fi
6963     fi
6965     # 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.
6966     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6967     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6968         with_jdk_home=`/usr/libexec/java_home`
6969     fi
6971     JAVA_HOME=; export JAVA_HOME
6972     if test -z "$with_jdk_home"; then
6973         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6974     else
6975         _java_path="$with_jdk_home/bin/$with_java"
6976         dnl Check if there is a Java interpreter at all.
6977         if test -x "$_java_path"; then
6978             JAVAINTERPRETER=$_java_path
6979         else
6980             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6981         fi
6982     fi
6984     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6985     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6986     dnl loaded by java to run JunitTests:
6987     if test "$build_os" = "cygwin"; then
6988         shortjdkhome=`cygpath -d "$with_jdk_home"`
6989         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
6990             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6991             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6992         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
6993             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6994             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6995         fi
6997         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6998             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6999         fi
7000         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7001     elif test "$cross_compiling" != "yes"; then
7002         case $CPUNAME in
7003             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7004                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7005                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7006                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7007                 fi
7008                 ;;
7009             *) # assumption: everything else 32-bit
7010                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7011                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7012                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7013                 fi
7014                 ;;
7015         esac
7016     fi
7019 dnl ===================================================================
7020 dnl Checks for JDK.
7021 dnl ===================================================================
7023 # Note that JAVA_HOME as for now always means the *build* platform's
7024 # JAVA_HOME. Whether all the complexity here actually is needed any
7025 # more or not, no idea.
7027 if test "$ENABLE_JAVA" != ""; then
7028     _gij_longver=0
7029     AC_MSG_CHECKING([the installed JDK])
7030     if test -n "$JAVAINTERPRETER"; then
7031         dnl java -version sends output to stderr!
7032         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7033             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7034         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7035             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7036         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7037             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7038         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7039             JDK=ibm
7041             dnl IBM JDK specific tests
7042             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7043             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7045             if test "$_jdk_ver" -lt 10800; then
7046                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7047             fi
7049             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
7051             if test "$with_jdk_home" = ""; then
7052                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7053 you must use the "--with-jdk-home" configure option explicitly])
7054             fi
7056             JAVA_HOME=$with_jdk_home
7057         else
7058             JDK=sun
7060             dnl Sun JDK specific tests
7061             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7062             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7064             if test "$_jdk_ver" -lt 10800; then
7065                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7066             fi
7067             if test "$_jdk_ver" -gt 10800; then
7068                 JAVA_CLASSPATH_NOT_SET=TRUE
7069             fi
7071             AC_MSG_RESULT([checked (JDK $_jdk)])
7072             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7073             if test "$_os" = "WINNT"; then
7074                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7075             fi
7077             # set to limit VM usage for JunitTests
7078             JAVAIFLAGS=-Xmx64M
7079             # set to limit VM usage for javac
7080             JAVAFLAGS=-J-Xmx128M
7081         fi
7082     else
7083         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7084     fi
7085 else
7086     dnl Java disabled
7087     JAVA_HOME=
7088     export JAVA_HOME
7091 dnl ===================================================================
7092 dnl Checks for javac
7093 dnl ===================================================================
7094 if test "$ENABLE_JAVA" != ""; then
7095     javacompiler="javac"
7096     : ${JAVA_SOURCE_VER=8}
7097     : ${JAVA_TARGET_VER=8}
7098     if test -z "$with_jdk_home"; then
7099         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7100     else
7101         _javac_path="$with_jdk_home/bin/$javacompiler"
7102         dnl Check if there is a Java compiler at all.
7103         if test -x "$_javac_path"; then
7104             JAVACOMPILER=$_javac_path
7105         fi
7106     fi
7107     if test -z "$JAVACOMPILER"; then
7108         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7109     fi
7110     if test "$build_os" = "cygwin"; then
7111         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7112             JAVACOMPILER="${JAVACOMPILER}.exe"
7113         fi
7114         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7115     fi
7118 dnl ===================================================================
7119 dnl Checks for javadoc
7120 dnl ===================================================================
7121 if test "$ENABLE_JAVA" != ""; then
7122     if test -z "$with_jdk_home"; then
7123         AC_PATH_PROG(JAVADOC, javadoc)
7124     else
7125         _javadoc_path="$with_jdk_home/bin/javadoc"
7126         dnl Check if there is a javadoc at all.
7127         if test -x "$_javadoc_path"; then
7128             JAVADOC=$_javadoc_path
7129         else
7130             AC_PATH_PROG(JAVADOC, javadoc)
7131         fi
7132     fi
7133     if test -z "$JAVADOC"; then
7134         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7135     fi
7136     if test "$build_os" = "cygwin"; then
7137         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7138             JAVADOC="${JAVADOC}.exe"
7139         fi
7140         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7141     fi
7143     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7144     JAVADOCISGJDOC="yes"
7145     fi
7147 AC_SUBST(JAVADOCISGJDOC)
7149 if test "$ENABLE_JAVA" != ""; then
7150     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7151     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7152         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7153            # try to recover first by looking whether we have a alternatives
7154            # system as in Debian or newer SuSEs where following /usr/bin/javac
7155            # over /etc/alternatives/javac leads to the right bindir where we
7156            # just need to strip a bit away to get a valid JAVA_HOME
7157            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7158         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7159             # maybe only one level of symlink (e.g. on Mac)
7160             JAVA_HOME=$(readlink $JAVACOMPILER)
7161             if test "$(dirname $JAVA_HOME)" = "."; then
7162                 # we've got no path to trim back
7163                 JAVA_HOME=""
7164             fi
7165         else
7166             # else warn
7167             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7168             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7169             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7170             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7171         fi
7172         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7173         if test "$JAVA_HOME" != "/usr"; then
7174             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7175                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7176                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7177                 dnl Tiger already returns a JDK path..
7178                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7179             else
7180                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7181                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7182                 dnl that checks which version to run
7183                 if test -f "$JAVA_HOME"; then
7184                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7185                 fi
7186             fi
7187         fi
7188     fi
7189     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7191     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7192     if test -z "$JAVA_HOME"; then
7193         if test "x$with_jdk_home" = "x"; then
7194             cat > findhome.java <<_ACEOF
7195 [import java.io.File;
7197 class findhome
7199     public static void main(String args[])
7200     {
7201         String jrelocation = System.getProperty("java.home");
7202         File jre = new File(jrelocation);
7203         System.out.println(jre.getParent());
7204     }
7206 _ACEOF
7207             AC_MSG_CHECKING([if javac works])
7208             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7209             AC_TRY_EVAL(javac_cmd)
7210             if test $? = 0 -a -f ./findhome.class; then
7211                 AC_MSG_RESULT([javac works])
7212             else
7213                 echo "configure: javac test failed" >&5
7214                 cat findhome.java >&5
7215                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7216             fi
7217             AC_MSG_CHECKING([if gij knows its java.home])
7218             JAVA_HOME=`$JAVAINTERPRETER findhome`
7219             if test $? = 0 -a "$JAVA_HOME" != ""; then
7220                 AC_MSG_RESULT([$JAVA_HOME])
7221             else
7222                 echo "configure: java test failed" >&5
7223                 cat findhome.java >&5
7224                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7225             fi
7226             # clean-up after ourselves
7227             rm -f ./findhome.java ./findhome.class
7228         else
7229             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7230         fi
7231     fi
7233     # now check if $JAVA_HOME is really valid
7234     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7235         case "${JAVA_HOME}" in
7236             /Library/Java/JavaVirtualMachines/*)
7237                 ;;
7238             *)
7239                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7240                 ;;
7241         esac
7242         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7243             JAVA_HOME_OK="NO"
7244         fi
7245     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7246         JAVA_HOME_OK="NO"
7247     fi
7248     if test "$JAVA_HOME_OK" = "NO"; then
7249         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7250         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7251         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7252         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7253         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7254         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7255     fi
7256     PathFormat "$JAVA_HOME"
7257     JAVA_HOME="$formatted_path"
7260 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7261     "$_os" != Darwin
7262 then
7263     AC_MSG_CHECKING([for JAWT lib])
7264     if test "$_os" = WINNT; then
7265         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7266         JAWTLIB=jawt.lib
7267     else
7268         case "$host_cpu" in
7269         arm*)
7270             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7271             JAVA_ARCH=$my_java_arch
7272             ;;
7273         i*86)
7274             my_java_arch=i386
7275             ;;
7276         m68k)
7277             my_java_arch=m68k
7278             ;;
7279         powerpc)
7280             my_java_arch=ppc
7281             ;;
7282         powerpc64)
7283             my_java_arch=ppc64
7284             ;;
7285         powerpc64le)
7286             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7287             JAVA_ARCH=$my_java_arch
7288             ;;
7289         sparc64)
7290             my_java_arch=sparcv9
7291             ;;
7292         x86_64)
7293             my_java_arch=amd64
7294             ;;
7295         *)
7296             my_java_arch=$host_cpu
7297             ;;
7298         esac
7299         # This is where JDK9 puts the library
7300         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7301             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7302         else
7303             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7304         fi
7305         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7306     fi
7307     AC_MSG_RESULT([$JAWTLIB])
7309 AC_SUBST(JAWTLIB)
7311 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7312     case "$host_os" in
7314     aix*)
7315         JAVAINC="-I$JAVA_HOME/include"
7316         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7317         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7318         ;;
7320     cygwin*)
7321         JAVAINC="-I$JAVA_HOME/include/win32"
7322         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7323         ;;
7325     darwin*)
7326         if test -d "$JAVA_HOME/include/darwin"; then
7327             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7328         else
7329             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7330         fi
7331         ;;
7333     dragonfly*)
7334         JAVAINC="-I$JAVA_HOME/include"
7335         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7336         ;;
7338     freebsd*)
7339         JAVAINC="-I$JAVA_HOME/include"
7340         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7341         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7342         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7343         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7344         ;;
7346     k*bsd*-gnu*)
7347         JAVAINC="-I$JAVA_HOME/include"
7348         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7349         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7350         ;;
7352     linux-gnu*)
7353         JAVAINC="-I$JAVA_HOME/include"
7354         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7355         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7356         ;;
7358     *netbsd*)
7359         JAVAINC="-I$JAVA_HOME/include"
7360         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7361         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7362        ;;
7364     openbsd*)
7365         JAVAINC="-I$JAVA_HOME/include"
7366         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7367         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7368         ;;
7370     solaris*)
7371         JAVAINC="-I$JAVA_HOME/include"
7372         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7373         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7374         ;;
7375     esac
7377 SOLARINC="$SOLARINC $JAVAINC"
7379 AC_SUBST(JAVACOMPILER)
7380 AC_SUBST(JAVADOC)
7381 AC_SUBST(JAVAINTERPRETER)
7382 AC_SUBST(JAVAIFLAGS)
7383 AC_SUBST(JAVAFLAGS)
7384 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7385 AC_SUBST(JAVA_HOME)
7386 AC_SUBST(JAVA_SOURCE_VER)
7387 AC_SUBST(JAVA_TARGET_VER)
7388 AC_SUBST(JDK)
7391 dnl ===================================================================
7392 dnl Export file validation
7393 dnl ===================================================================
7394 AC_MSG_CHECKING([whether to enable export file validation])
7395 if test "$with_export_validation" != "no"; then
7396     if test -z "$ENABLE_JAVA"; then
7397         if test "$with_export_validation" = "yes"; then
7398             AC_MSG_ERROR([requested, but Java is disabled])
7399         else
7400             AC_MSG_RESULT([no, as Java is disabled])
7401         fi
7402     elif test "$_jdk_ver" -lt 10800; then
7403         if test "$with_export_validation" = "yes"; then
7404             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7405         else
7406             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7407         fi
7408     elif ! test -d "${SRC_ROOT}/schema"; then
7409         if test "$with_export_validation" = "yes"; then
7410             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7411         else
7412             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7413         fi
7414     else
7415         AC_MSG_RESULT([yes])
7416         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7418         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7419         if test -z "$ODFVALIDATOR"; then
7420             # remember to download the ODF toolkit with validator later
7421             AC_MSG_NOTICE([no odfvalidator found, will download it])
7422             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7423             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7425             # and fetch name of odfvalidator jar name from download.lst
7426             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7427             AC_SUBST(ODFVALIDATOR_JAR)
7429             if test -z "$ODFVALIDATOR_JAR"; then
7430                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7431             fi
7432         fi
7433         if test "$build_os" = "cygwin"; then
7434             # In case of Cygwin it will be executed from Windows,
7435             # so we need to run bash and absolute path to validator
7436             # so instead of "odfvalidator" it will be
7437             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7438             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7439         else
7440             ODFVALIDATOR="sh $ODFVALIDATOR"
7441         fi
7442         AC_SUBST(ODFVALIDATOR)
7445         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7446         if test -z "$OFFICEOTRON"; then
7447             # remember to download the officeotron with validator later
7448             AC_MSG_NOTICE([no officeotron found, will download it])
7449             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7450             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7452             # and fetch name of officeotron jar name from download.lst
7453             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7454             AC_SUBST(OFFICEOTRON_JAR)
7456             if test -z "$OFFICEOTRON_JAR"; then
7457                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7458             fi
7459         else
7460             # check version of existing officeotron
7461             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7462             if test 0"$OFFICEOTRON_VER" -lt 704; then
7463                 AC_MSG_ERROR([officeotron too old])
7464             fi
7465         fi
7466         if test "$build_os" = "cygwin"; then
7467             # In case of Cygwin it will be executed from Windows,
7468             # so we need to run bash and absolute path to validator
7469             # so instead of "odfvalidator" it will be
7470             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7471             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7472         else
7473             OFFICEOTRON="sh $OFFICEOTRON"
7474         fi
7475     fi
7476     AC_SUBST(OFFICEOTRON)
7477 else
7478     AC_MSG_RESULT([no])
7481 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7482 if test "$with_bffvalidator" != "no"; then
7483     AC_DEFINE(HAVE_BFFVALIDATOR)
7485     if test "$with_export_validation" = "no"; then
7486         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7487     fi
7489     if test "$with_bffvalidator" = "yes"; then
7490         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7491     else
7492         BFFVALIDATOR="$with_bffvalidator"
7493     fi
7495     if test "$build_os" = "cygwin"; then
7496         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7497             AC_MSG_RESULT($BFFVALIDATOR)
7498         else
7499             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7500         fi
7501     elif test -n "$BFFVALIDATOR"; then
7502         # We are not in Cygwin but need to run Windows binary with wine
7503         AC_PATH_PROGS(WINE, wine)
7505         # so swap in a shell wrapper that converts paths transparently
7506         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7507         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7508         AC_SUBST(BFFVALIDATOR_EXE)
7509         AC_MSG_RESULT($BFFVALIDATOR)
7510     else
7511         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7512     fi
7513     AC_SUBST(BFFVALIDATOR)
7514 else
7515     AC_MSG_RESULT([no])
7518 dnl ===================================================================
7519 dnl Check for C preprocessor to use
7520 dnl ===================================================================
7521 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7522 if test -n "$with_idlc_cpp"; then
7523     AC_MSG_RESULT([$with_idlc_cpp])
7524     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7525 else
7526     AC_MSG_RESULT([ucpp])
7527     AC_MSG_CHECKING([which ucpp tp use])
7528     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7529         AC_MSG_RESULT([external])
7530         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7531     else
7532         AC_MSG_RESULT([internal])
7533         BUILD_TYPE="$BUILD_TYPE UCPP"
7534     fi
7536 AC_SUBST(SYSTEM_UCPP)
7538 dnl ===================================================================
7539 dnl Check for epm (not needed for Windows)
7540 dnl ===================================================================
7541 AC_MSG_CHECKING([whether to enable EPM for packing])
7542 if test "$enable_epm" = "yes"; then
7543     AC_MSG_RESULT([yes])
7544     if test "$_os" != "WINNT"; then
7545         if test $_os = Darwin; then
7546             EPM=internal
7547         elif test -n "$with_epm"; then
7548             EPM=$with_epm
7549         else
7550             AC_PATH_PROG(EPM, epm, no)
7551         fi
7552         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7553             AC_MSG_NOTICE([EPM will be built.])
7554             BUILD_TYPE="$BUILD_TYPE EPM"
7555             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7556         else
7557             # Gentoo has some epm which is something different...
7558             AC_MSG_CHECKING([whether the found epm is the right epm])
7559             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7560                 AC_MSG_RESULT([yes])
7561             else
7562                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7563             fi
7564             AC_MSG_CHECKING([epm version])
7565             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7566             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7567                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7568                 AC_MSG_RESULT([OK, >= 3.7])
7569             else
7570                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7571                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7572             fi
7573         fi
7574     fi
7576     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7577         AC_MSG_CHECKING([for rpm])
7578         for a in "$RPM" rpmbuild rpm; do
7579             $a --usage >/dev/null 2> /dev/null
7580             if test $? -eq 0; then
7581                 RPM=$a
7582                 break
7583             else
7584                 $a --version >/dev/null 2> /dev/null
7585                 if test $? -eq 0; then
7586                     RPM=$a
7587                     break
7588                 fi
7589             fi
7590         done
7591         if test -z "$RPM"; then
7592             AC_MSG_ERROR([not found])
7593         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7594             RPM_PATH=`which $RPM`
7595             AC_MSG_RESULT([$RPM_PATH])
7596             SCPDEFS="$SCPDEFS -DWITH_RPM"
7597         else
7598             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7599         fi
7600     fi
7601     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7602         AC_PATH_PROG(DPKG, dpkg, no)
7603         if test "$DPKG" = "no"; then
7604             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7605         fi
7606     fi
7607     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7608        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7609         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7610             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7611                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7612                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7613                     AC_MSG_RESULT([yes])
7614                 else
7615                     AC_MSG_RESULT([no])
7616                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7617                         _pt="rpm"
7618                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7619                         add_warning "the rpms will need to be installed with --nodeps"
7620                     else
7621                         _pt="pkg"
7622                     fi
7623                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7624                     add_warning "the ${_pt}s will not be relocatable"
7625                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7626                                  relocation will work, you need to patch your epm with the
7627                                  patch in epm/epm-3.7.patch or build with
7628                                  --with-epm=internal which will build a suitable epm])
7629                 fi
7630             fi
7631         fi
7632     fi
7633     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7634         AC_PATH_PROG(PKGMK, pkgmk, no)
7635         if test "$PKGMK" = "no"; then
7636             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7637         fi
7638     fi
7639     AC_SUBST(RPM)
7640     AC_SUBST(DPKG)
7641     AC_SUBST(PKGMK)
7642 else
7643     for i in $PKGFORMAT; do
7644         case "$i" in
7645         aix | bsd | deb | pkg | rpm | native | portable)
7646             AC_MSG_ERROR(
7647                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7648             ;;
7649         esac
7650     done
7651     AC_MSG_RESULT([no])
7652     EPM=NO
7654 AC_SUBST(EPM)
7656 ENABLE_LWP=
7657 if test "$enable_lotuswordpro" = "yes"; then
7658     ENABLE_LWP="TRUE"
7660 AC_SUBST(ENABLE_LWP)
7662 dnl ===================================================================
7663 dnl Check for building ODK
7664 dnl ===================================================================
7665 if test "$enable_odk" = no; then
7666     unset DOXYGEN
7667 else
7668     if test "$with_doxygen" = no; then
7669         AC_MSG_CHECKING([for doxygen])
7670         unset DOXYGEN
7671         AC_MSG_RESULT([no])
7672     else
7673         if test "$with_doxygen" = yes; then
7674             AC_PATH_PROG([DOXYGEN], [doxygen])
7675             if test -z "$DOXYGEN"; then
7676                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7677             fi
7678             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7679                 if ! dot -V 2>/dev/null; then
7680                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7681                 fi
7682             fi
7683         else
7684             AC_MSG_CHECKING([for doxygen])
7685             DOXYGEN=$with_doxygen
7686             AC_MSG_RESULT([$DOXYGEN])
7687         fi
7688         if test -n "$DOXYGEN"; then
7689             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7690             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7691             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7692                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7693             fi
7694         fi
7695     fi
7697 AC_SUBST([DOXYGEN])
7699 AC_MSG_CHECKING([whether to build the ODK])
7700 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7701     AC_MSG_RESULT([yes])
7703     if test "$with_java" != "no"; then
7704         AC_MSG_CHECKING([whether to build unowinreg.dll])
7705         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7706             # build on Win by default
7707             enable_build_unowinreg=yes
7708         fi
7709         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7710             AC_MSG_RESULT([no])
7711             BUILD_UNOWINREG=
7712         else
7713             AC_MSG_RESULT([yes])
7714             BUILD_UNOWINREG=TRUE
7715         fi
7716         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7717             if test -z "$with_mingw_cross_compiler"; then
7718                 dnl Guess...
7719                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7720             elif test -x "$with_mingw_cross_compiler"; then
7721                  MINGWCXX="$with_mingw_cross_compiler"
7722             else
7723                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7724             fi
7726             if test "$MINGWCXX" = "false"; then
7727                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7728             fi
7730             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7731             if test -x "$mingwstrip_test"; then
7732                 MINGWSTRIP="$mingwstrip_test"
7733             else
7734                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7735             fi
7737             if test "$MINGWSTRIP" = "false"; then
7738                 AC_MSG_ERROR(MinGW32 binutils not found.)
7739             fi
7740         fi
7741     fi
7742     BUILD_TYPE="$BUILD_TYPE ODK"
7743 else
7744     AC_MSG_RESULT([no])
7745     BUILD_UNOWINREG=
7747 AC_SUBST(BUILD_UNOWINREG)
7748 AC_SUBST(MINGWCXX)
7749 AC_SUBST(MINGWSTRIP)
7751 dnl ===================================================================
7752 dnl Check for system zlib
7753 dnl ===================================================================
7754 if test "$with_system_zlib" = "auto"; then
7755     case "$_os" in
7756     WINNT)
7757         with_system_zlib="$with_system_libs"
7758         ;;
7759     *)
7760         if test "$enable_fuzzers" != "yes"; then
7761             with_system_zlib=yes
7762         else
7763             with_system_zlib=no
7764         fi
7765         ;;
7766     esac
7769 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7770 dnl and has no pkg-config for it at least on some tinderboxes,
7771 dnl so leaving that out for now
7772 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7773 AC_MSG_CHECKING([which zlib to use])
7774 if test "$with_system_zlib" = "yes"; then
7775     AC_MSG_RESULT([external])
7776     SYSTEM_ZLIB=TRUE
7777     AC_CHECK_HEADER(zlib.h, [],
7778         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7779     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7780         [AC_MSG_ERROR(zlib not found or functional)], [])
7781 else
7782     AC_MSG_RESULT([internal])
7783     SYSTEM_ZLIB=
7784     BUILD_TYPE="$BUILD_TYPE ZLIB"
7785     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7786     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7788 AC_SUBST(ZLIB_CFLAGS)
7789 AC_SUBST(ZLIB_LIBS)
7790 AC_SUBST(SYSTEM_ZLIB)
7792 dnl ===================================================================
7793 dnl Check for system jpeg
7794 dnl ===================================================================
7795 AC_MSG_CHECKING([which libjpeg to use])
7796 if test "$with_system_jpeg" = "yes"; then
7797     AC_MSG_RESULT([external])
7798     SYSTEM_LIBJPEG=TRUE
7799     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7800         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7801     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7802         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7803 else
7804     SYSTEM_LIBJPEG=
7805     AC_MSG_RESULT([internal, libjpeg-turbo])
7806     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7807     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7808     if test "$COM" = "MSC"; then
7809         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7810     else
7811         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7812     fi
7814     case "$host_cpu" in
7815     x86_64 | amd64 | i*86 | x86 | ia32)
7816         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7817         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7818             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7819                 NASM="$LODE_HOME/opt/bin/nasm"
7820             elif test -x "/opt/lo/bin/nasm"; then
7821                 NASM="/opt/lo/bin/nasm"
7822             fi
7823         fi
7825         if test -n "$NASM"; then
7826             AC_MSG_CHECKING([for object file format of host system])
7827             case "$host_os" in
7828               cygwin* | mingw* | pw32* | interix*)
7829                 case "$host_cpu" in
7830                   x86_64)
7831                     objfmt='Win64-COFF'
7832                     ;;
7833                   *)
7834                     objfmt='Win32-COFF'
7835                     ;;
7836                 esac
7837               ;;
7838               msdosdjgpp* | go32*)
7839                 objfmt='COFF'
7840               ;;
7841               os2-emx*)                 # not tested
7842                 objfmt='MSOMF'          # obj
7843               ;;
7844               linux*coff* | linux*oldld*)
7845                 objfmt='COFF'           # ???
7846               ;;
7847               linux*aout*)
7848                 objfmt='a.out'
7849               ;;
7850               linux*)
7851                 case "$host_cpu" in
7852                   x86_64)
7853                     objfmt='ELF64'
7854                     ;;
7855                   *)
7856                     objfmt='ELF'
7857                     ;;
7858                 esac
7859               ;;
7860               kfreebsd* | freebsd* | netbsd* | openbsd*)
7861                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7862                   objfmt='BSD-a.out'
7863                 else
7864                   case "$host_cpu" in
7865                     x86_64 | amd64)
7866                       objfmt='ELF64'
7867                       ;;
7868                     *)
7869                       objfmt='ELF'
7870                       ;;
7871                   esac
7872                 fi
7873               ;;
7874               solaris* | sunos* | sysv* | sco*)
7875                 case "$host_cpu" in
7876                   x86_64)
7877                     objfmt='ELF64'
7878                     ;;
7879                   *)
7880                     objfmt='ELF'
7881                     ;;
7882                 esac
7883               ;;
7884               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7885                 case "$host_cpu" in
7886                   x86_64)
7887                     objfmt='Mach-O64'
7888                     ;;
7889                   *)
7890                     objfmt='Mach-O'
7891                     ;;
7892                 esac
7893               ;;
7894               *)
7895                 objfmt='ELF ?'
7896               ;;
7897             esac
7899             AC_MSG_RESULT([$objfmt])
7900             if test "$objfmt" = 'ELF ?'; then
7901               objfmt='ELF'
7902               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7903             fi
7905             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7906             case "$objfmt" in
7907               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7908               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7909               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7910               COFF)       NAFLAGS='-fcoff -DCOFF';;
7911               a.out)      NAFLAGS='-faout -DAOUT';;
7912               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7913               ELF)        NAFLAGS='-felf -DELF';;
7914               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7915               RDF)        NAFLAGS='-frdf -DRDF';;
7916               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7917               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7918             esac
7919             AC_MSG_RESULT([$NAFLAGS])
7921             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7922             cat > conftest.asm << EOF
7923             [%line __oline__ "configure"
7924                     section .text
7925                     global  _main,main
7926             _main:
7927             main:   xor     eax,eax
7928                     ret
7929             ]
7931             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7932             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7933               AC_MSG_RESULT(yes)
7934             else
7935               echo "configure: failed program was:" >&AC_FD_CC
7936               cat conftest.asm >&AC_FD_CC
7937               rm -rf conftest*
7938               AC_MSG_RESULT(no)
7939               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7940               NASM=""
7941             fi
7943         fi
7945         if test -z "$NASM"; then
7946 cat << _EOS
7947 ****************************************************************************
7948 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7949 To get one please:
7951 _EOS
7952             if test "$build_os" = "cygwin"; then
7953 cat << _EOS
7954 install a pre-compiled binary for Win32
7956 mkdir -p /opt/lo/bin
7957 cd /opt/lo/bin
7958 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7959 chmod +x nasm
7961 or get and install one from http://www.nasm.us/
7963 Then re-run autogen.sh
7965 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7966 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7968 _EOS
7969             else
7970 cat << _EOS
7971 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7973 _EOS
7974             fi
7975             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7976             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7977         fi
7978       ;;
7979     esac
7982 AC_SUBST(NASM)
7983 AC_SUBST(LIBJPEG_CFLAGS)
7984 AC_SUBST(LIBJPEG_LIBS)
7985 AC_SUBST(SYSTEM_LIBJPEG)
7987 dnl ===================================================================
7988 dnl Check for system clucene
7989 dnl ===================================================================
7990 dnl we should rather be using
7991 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7992 dnl but the contribs-lib check seems tricky
7993 AC_MSG_CHECKING([which clucene to use])
7994 if test "$with_system_clucene" = "yes"; then
7995     AC_MSG_RESULT([external])
7996     SYSTEM_CLUCENE=TRUE
7997     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7998     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7999     FilterLibs "${CLUCENE_LIBS}"
8000     CLUCENE_LIBS="${filteredlibs}"
8001     AC_LANG_PUSH([C++])
8002     save_CXXFLAGS=$CXXFLAGS
8003     save_CPPFLAGS=$CPPFLAGS
8004     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8005     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8006     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8007     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8008     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8009                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8010     CXXFLAGS=$save_CXXFLAGS
8011     CPPFLAGS=$save_CPPFLAGS
8012     AC_LANG_POP([C++])
8014     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8015 else
8016     AC_MSG_RESULT([internal])
8017     SYSTEM_CLUCENE=
8018     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8020 AC_SUBST(SYSTEM_CLUCENE)
8021 AC_SUBST(CLUCENE_CFLAGS)
8022 AC_SUBST(CLUCENE_LIBS)
8024 dnl ===================================================================
8025 dnl Check for system expat
8026 dnl ===================================================================
8027 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8029 dnl ===================================================================
8030 dnl Check for system xmlsec
8031 dnl ===================================================================
8032 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8034 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8035 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8036     ENABLE_EOT="TRUE"
8037     AC_DEFINE([ENABLE_EOT])
8038     AC_MSG_RESULT([yes])
8040     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8041 else
8042     ENABLE_EOT=
8043     AC_MSG_RESULT([no])
8045 AC_SUBST([ENABLE_EOT])
8047 dnl ===================================================================
8048 dnl Check for DLP libs
8049 dnl ===================================================================
8050 AS_IF([test "$COM" = "MSC"],
8051       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8052       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8054 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8056 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8058 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8060 AS_IF([test "$COM" = "MSC"],
8061       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8062       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8064 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8066 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8068 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8069 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8071 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8073 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8075 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8077 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8078 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8080 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8081 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8083 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8085 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8086 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8088 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8090 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8092 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8094 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8096 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8097 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8099 dnl ===================================================================
8100 dnl Check for system lcms2
8101 dnl ===================================================================
8102 if test "$with_system_lcms2" != "yes"; then
8103     SYSTEM_LCMS2=
8105 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8106 if test "$GCC" = "yes"; then
8107     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8109 if test "$COM" = "MSC"; then # override the above
8110     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8113 dnl ===================================================================
8114 dnl Check for system cppunit
8115 dnl ===================================================================
8116 if test "$_os" != "Android" ; then
8117     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8120 dnl ===================================================================
8121 dnl Check whether freetype is available
8122 dnl ===================================================================
8123 if test  "$test_freetype" = "yes"; then
8124     AC_MSG_CHECKING([whether freetype is available])
8125     # FreeType has 3 different kinds of versions
8126     # * release, like 2.4.10
8127     # * libtool, like 13.0.7 (this what pkg-config returns)
8128     # * soname
8129     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8130     #
8131     # 9.9.3 is 2.2.0
8132     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8133     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8134     FilterLibs "${FREETYPE_LIBS}"
8135     FREETYPE_LIBS="${filteredlibs}"
8136     SYSTEM_FREETYPE=TRUE
8137 else
8138     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8139     if test "x$ac_config_site_64bit_host" = xYES; then
8140         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8141     else
8142         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8143     fi
8145 AC_SUBST(FREETYPE_CFLAGS)
8146 AC_SUBST(FREETYPE_LIBS)
8147 AC_SUBST([SYSTEM_FREETYPE])
8149 # ===================================================================
8150 # Check for system libxslt
8151 # to prevent incompatibilities between internal libxml2 and external libxslt,
8152 # or vice versa, use with_system_libxml here
8153 # ===================================================================
8154 if test "$with_system_libxml" = "auto"; then
8155     case "$_os" in
8156     WINNT|iOS|Android)
8157         with_system_libxml="$with_system_libs"
8158         ;;
8159     *)
8160         if test "$enable_fuzzers" != "yes"; then
8161             with_system_libxml=yes
8162         else
8163             with_system_libxml=no
8164         fi
8165         ;;
8166     esac
8169 AC_MSG_CHECKING([which libxslt to use])
8170 if test "$with_system_libxml" = "yes"; then
8171     AC_MSG_RESULT([external])
8172     SYSTEM_LIBXSLT=TRUE
8173     if test "$_os" = "Darwin"; then
8174         dnl make sure to use SDK path
8175         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8176         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8177         dnl omit -L/usr/lib
8178         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8179         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8180     else
8181         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8182         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8183         FilterLibs "${LIBXSLT_LIBS}"
8184         LIBXSLT_LIBS="${filteredlibs}"
8185         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8186         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8187         FilterLibs "${LIBEXSLT_LIBS}"
8188         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8189     fi
8191     dnl Check for xsltproc
8192     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8193     if test "$XSLTPROC" = "no"; then
8194         AC_MSG_ERROR([xsltproc is required])
8195     fi
8196 else
8197     AC_MSG_RESULT([internal])
8198     SYSTEM_LIBXSLT=
8199     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8201     if test "$cross_compiling" = "yes"; then
8202         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8203         if test "$XSLTPROC" = "no"; then
8204             AC_MSG_ERROR([xsltproc is required])
8205         fi
8206     fi
8208 AC_SUBST(SYSTEM_LIBXSLT)
8209 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8210     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8212 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8214 AC_SUBST(LIBEXSLT_CFLAGS)
8215 AC_SUBST(LIBEXSLT_LIBS)
8216 AC_SUBST(LIBXSLT_CFLAGS)
8217 AC_SUBST(LIBXSLT_LIBS)
8218 AC_SUBST(XSLTPROC)
8220 # ===================================================================
8221 # Check for system libxml
8222 # ===================================================================
8223 AC_MSG_CHECKING([which libxml to use])
8224 if test "$with_system_libxml" = "yes"; then
8225     AC_MSG_RESULT([external])
8226     SYSTEM_LIBXML=TRUE
8227     if test "$_os" = "Darwin"; then
8228         dnl make sure to use SDK path
8229         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8230         dnl omit -L/usr/lib
8231         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8232     elif test $_os = iOS; then
8233         dnl make sure to use SDK path
8234         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8235         LIBXML_CFLAGS="-I$usr/include/libxml2"
8236         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8237     else
8238         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8239         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8240         FilterLibs "${LIBXML_LIBS}"
8241         LIBXML_LIBS="${filteredlibs}"
8242     fi
8244     dnl Check for xmllint
8245     AC_PATH_PROG(XMLLINT, xmllint, no)
8246     if test "$XMLLINT" = "no"; then
8247         AC_MSG_ERROR([xmllint is required])
8248     fi
8249 else
8250     AC_MSG_RESULT([internal])
8251     SYSTEM_LIBXML=
8252     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8253     if test "$COM" = "MSC"; then
8254         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8255     fi
8256     if test "$COM" = "MSC"; then
8257         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8258     else
8259         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8260     fi
8261     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8263 AC_SUBST(SYSTEM_LIBXML)
8264 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8265     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8267 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8268 AC_SUBST(LIBXML_CFLAGS)
8269 AC_SUBST(LIBXML_LIBS)
8270 AC_SUBST(XMLLINT)
8272 # =====================================================================
8273 # Checking for a Python interpreter with version >= 2.7.
8274 # Build and runtime requires Python 3 compatible version (>= 2.7).
8275 # Optionally user can pass an option to configure, i. e.
8276 # ./configure PYTHON=/usr/bin/python
8277 # =====================================================================
8278 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8279     # This allows a lack of system python with no error, we use internal one in that case.
8280     AM_PATH_PYTHON([2.7],, [:])
8281     # Clean PYTHON_VERSION checked below if cross-compiling
8282     PYTHON_VERSION=""
8283     if test "$PYTHON" != ":"; then
8284         PYTHON_FOR_BUILD=$PYTHON
8285     fi
8287 AC_SUBST(PYTHON_FOR_BUILD)
8289 # Checks for Python to use for Pyuno
8290 AC_MSG_CHECKING([which Python to use for Pyuno])
8291 case "$enable_python" in
8292 no|disable)
8293     if test -z $PYTHON_FOR_BUILD; then
8294         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8295         # requirement from the choice whether to include Python stuff in the installer, but why
8296         # bother?
8297         AC_MSG_ERROR([Python is required at build time.])
8298     fi
8299     enable_python=no
8300     AC_MSG_RESULT([none])
8301     ;;
8302 ""|yes|auto)
8303     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8304         AC_MSG_RESULT([no, overridden by --disable-scripting])
8305         enable_python=no
8306     elif test $build_os = cygwin; then
8307         dnl When building on Windows we don't attempt to use any installed
8308         dnl "system"  Python.
8309         AC_MSG_RESULT([fully internal])
8310         enable_python=internal
8311     elif test "$cross_compiling" = yes; then
8312         AC_MSG_RESULT([system])
8313         enable_python=system
8314     else
8315         # Unset variables set by the above AM_PATH_PYTHON so that
8316         # we actually do check anew.
8317         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
8318         AM_PATH_PYTHON([3.3],, [:])
8319         if test "$PYTHON" = ":"; then
8320             if test -z "$PYTHON_FOR_BUILD"; then
8321                 AC_MSG_RESULT([fully internal])
8322             else
8323                 AC_MSG_RESULT([internal])
8324             fi
8325             enable_python=internal
8326         else
8327             AC_MSG_RESULT([system])
8328             enable_python=system
8329         fi
8330     fi
8331     ;;
8332 internal)
8333     AC_MSG_RESULT([internal])
8334     ;;
8335 fully-internal)
8336     AC_MSG_RESULT([fully internal])
8337     enable_python=internal
8338     ;;
8339 system)
8340     AC_MSG_RESULT([system])
8341     ;;
8343     AC_MSG_ERROR([Incorrect --enable-python option])
8344     ;;
8345 esac
8347 if test $enable_python != no; then
8348     BUILD_TYPE="$BUILD_TYPE PYUNO"
8351 if test $enable_python = system; then
8352     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8353         python_version=2.7
8354         PYTHON=python$python_version
8355         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8356             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8357             PYTHON_LIBS="-framework Python"
8358         else
8359             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8360             PYTHON_LIBS="`$PYTHON-config --libs`"
8361         fi
8362     fi
8363     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8364         # Fallback: Accept these in the environment, or as set above
8365         # for MacOSX.
8366         :
8367     elif test "$cross_compiling" != yes; then
8368         # Unset variables set by the above AM_PATH_PYTHON so that
8369         # we actually do check anew.
8370         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
8371         # This causes an error if no python command is found
8372         AM_PATH_PYTHON([3.3])
8373         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8374         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8375         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8376         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8377         if test -z "$PKG_CONFIG"; then
8378             PYTHON_CFLAGS="-I$python_include"
8379             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8380         elif $PKG_CONFIG --exists python-$python_version; then
8381             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8382             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8383         else
8384             PYTHON_CFLAGS="-I$python_include"
8385             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8386         fi
8387         FilterLibs "${PYTHON_LIBS}"
8388         PYTHON_LIBS="${filteredlibs}"
8389     else
8390         dnl How to find out the cross-compilation Python installation path?
8391         AC_MSG_CHECKING([for python version])
8392         AS_IF([test -n "$PYTHON_VERSION"],
8393               [AC_MSG_RESULT([$PYTHON_VERSION])],
8394               [AC_MSG_RESULT([not found])
8395                AC_MSG_ERROR([no usable python found])])
8396         test -n "$PYTHON_CFLAGS" && break
8397     fi
8399     dnl Check if the headers really work
8400     save_CPPFLAGS="$CPPFLAGS"
8401     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8402     AC_CHECK_HEADER(Python.h)
8403     CPPFLAGS="$save_CPPFLAGS"
8405     # let the PYTHON_FOR_BUILD match the same python installation that
8406     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8407     # better for PythonTests.
8408     PYTHON_FOR_BUILD=$PYTHON
8411 if test "$with_lxml" != no; then
8412     if test -z "$PYTHON_FOR_BUILD"; then
8413         case $build_os in
8414             cygwin)
8415                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8416                 ;;
8417             *)
8418                 if test "$cross_compiling" != yes ; then
8419                     BUILD_TYPE="$BUILD_TYPE LXML"
8420                 fi
8421                 ;;
8422         esac
8423     else
8424         AC_MSG_CHECKING([for python lxml])
8425         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8426             AC_MSG_RESULT([yes])
8427         else
8428             case $build_os in
8429                 cygwin)
8430                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8431                     ;;
8432                 *)
8433                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8434                         BUILD_TYPE="$BUILD_TYPE LXML"
8435                         AC_MSG_RESULT([no, using internal lxml])
8436                     else
8437                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8438                     fi
8439                     ;;
8440             esac
8441         fi
8442     fi
8445 dnl By now enable_python should be "system", "internal" or "no"
8446 case $enable_python in
8447 system)
8448     SYSTEM_PYTHON=TRUE
8450     if test "x$ac_cv_header_Python_h" != "xyes"; then
8451        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8452     fi
8454     AC_LANG_PUSH(C)
8455     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8456     AC_MSG_CHECKING([for correct python library version])
8457        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8458 #include <Python.h>
8460 int main(int argc, char **argv) {
8461    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8462        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8463    else return 1;
8465        ]])],[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])])
8466     CFLAGS=$save_CFLAGS
8467     AC_LANG_POP(C)
8469     dnl FIXME Check if the Python library can be linked with, too?
8470     ;;
8472 internal)
8473     SYSTEM_PYTHON=
8474     PYTHON_VERSION_MAJOR=3
8475     PYTHON_VERSION_MINOR=5
8476     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8477     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8478         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8479     fi
8480     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8481     BUILD_TYPE="$BUILD_TYPE PYTHON"
8482     # Embedded Python dies without Home set
8483     if test "$HOME" = ""; then
8484         export HOME=""
8485     fi
8486     ;;
8488     DISABLE_PYTHON=TRUE
8489     SYSTEM_PYTHON=
8490     ;;
8492     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8493     ;;
8494 esac
8496 AC_SUBST(DISABLE_PYTHON)
8497 AC_SUBST(SYSTEM_PYTHON)
8498 AC_SUBST(PYTHON_CFLAGS)
8499 AC_SUBST(PYTHON_LIBS)
8500 AC_SUBST(PYTHON_VERSION)
8501 AC_SUBST(PYTHON_VERSION_MAJOR)
8502 AC_SUBST(PYTHON_VERSION_MINOR)
8504 ENABLE_MARIADBC=TRUE
8505 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8506     ENABLE_MARIADBC=
8508 MARIADBC_MAJOR=1
8509 MARIADBC_MINOR=0
8510 MARIADBC_MICRO=2
8511 if test "$ENABLE_MARIADBC" = "TRUE"; then
8512     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8515 AC_SUBST(ENABLE_MARIADBC)
8516 AC_SUBST(MARIADBC_MAJOR)
8517 AC_SUBST(MARIADBC_MINOR)
8518 AC_SUBST(MARIADBC_MICRO)
8520 if test "$ENABLE_MARIADBC" = "TRUE"; then
8521     dnl ===================================================================
8522     dnl Check for system MariaDB
8523     dnl ===================================================================
8524     AC_MSG_CHECKING([which MariaDB to use])
8525     if test "$with_system_mariadb" = "yes"; then
8526         AC_MSG_RESULT([external])
8527         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8528         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8529         if test -z "$MARIADBCONFIG"; then
8530             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8531             if test -z "$MARIADBCONFIG"; then
8532                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8533                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8534             fi
8535         fi
8536         AC_MSG_CHECKING([MariaDB version])
8537         MARIADB_VERSION=`$MARIADBCONFIG --version`
8538         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8539         if test "$MARIADB_MAJOR" -ge "5"; then
8540             AC_MSG_RESULT([OK])
8541         else
8542             AC_MSG_ERROR([too old, use 5.0.x or later])
8543         fi
8544         AC_MSG_CHECKING([for MariaDB Client library])
8545         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8546         if test "$COM_IS_CLANG" = TRUE; then
8547             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8548         fi
8549         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8550         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8551         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8552         dnl linux32:
8553         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8554             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8555             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8556                 | sed -e 's|/lib64/|/lib/|')
8557         fi
8558         FilterLibs "${MARIADB_LIBS}"
8559         MARIADB_LIBS="${filteredlibs}"
8560         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8561         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8562         if test "$enable_bundle_mariadb" = "yes"; then
8563             AC_MSG_RESULT([yes])
8564             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8565             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8567 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8569 /g' | grep -E '(mysqlclient|mariadb)')
8570             if test "$_os" = "Darwin"; then
8571                 LIBMARIADB=${LIBMARIADB}.dylib
8572             elif test "$_os" = "WINNT"; then
8573                 LIBMARIADB=${LIBMARIADB}.dll
8574             else
8575                 LIBMARIADB=${LIBMARIADB}.so
8576             fi
8577             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8578             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8579             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8580                 AC_MSG_RESULT([found.])
8581                 PathFormat "$LIBMARIADB_PATH"
8582                 LIBMARIADB_PATH="$formatted_path"
8583             else
8584                 AC_MSG_ERROR([not found.])
8585             fi
8586         else
8587             AC_MSG_RESULT([no])
8588             BUNDLE_MARIADB_CONNECTOR_C=
8589         fi
8590     else
8591         AC_MSG_RESULT([internal])
8592         SYSTEM_MARIADB_CONNECTOR_C=
8593         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8594         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8595         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8596     fi
8598     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8599     AC_SUBST(MARIADB_CFLAGS)
8600     AC_SUBST(MARIADB_LIBS)
8601     AC_SUBST(LIBMARIADB)
8602     AC_SUBST(LIBMARIADB_PATH)
8603     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8606 dnl ===================================================================
8607 dnl Check for system hsqldb
8608 dnl ===================================================================
8609 if test "$with_java" != "no"; then
8610     HSQLDB_USE_JDBC_4_1=
8611     AC_MSG_CHECKING([which hsqldb to use])
8612     if test "$with_system_hsqldb" = "yes"; then
8613         AC_MSG_RESULT([external])
8614         SYSTEM_HSQLDB=TRUE
8615         if test -z $HSQLDB_JAR; then
8616             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8617         fi
8618         if ! test -f $HSQLDB_JAR; then
8619                AC_MSG_ERROR(hsqldb.jar not found.)
8620         fi
8621         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8622         export HSQLDB_JAR
8623         if $PERL -e \
8624            'use Archive::Zip;
8625             my $file = "$ENV{'HSQLDB_JAR'}";
8626             my $zip = Archive::Zip->new( $file );
8627             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8628             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8629             {
8630                 push @l, split(/\n/, $mf);
8631                 foreach my $line (@l)
8632                 {
8633                     if ($line =~ m/Specification-Version:/)
8634                     {
8635                         ($t, $version) = split (/:/,$line);
8636                         $version =~ s/^\s//;
8637                         ($a, $b, $c, $d) = split (/\./,$version);
8638                         if ($c == "0" && $d > "8")
8639                         {
8640                             exit 0;
8641                         }
8642                         else
8643                         {
8644                             exit 1;
8645                         }
8646                     }
8647                 }
8648             }
8649             else
8650             {
8651                 exit 1;
8652             }'; then
8653             AC_MSG_RESULT([yes])
8654         else
8655             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8656         fi
8657     else
8658         AC_MSG_RESULT([internal])
8659         SYSTEM_HSQLDB=
8660         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8661         NEED_ANT=TRUE
8662         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8663         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8664         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8665             AC_MSG_RESULT([yes])
8666             HSQLDB_USE_JDBC_4_1=TRUE
8667         else
8668             AC_MSG_RESULT([no])
8669         fi
8670     fi
8671     AC_SUBST(SYSTEM_HSQLDB)
8672     AC_SUBST(HSQLDB_JAR)
8673     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8676 dnl ===================================================================
8677 dnl Check for PostgreSQL stuff
8678 dnl ===================================================================
8679 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8680 if test "x$enable_postgresql_sdbc" != "xno"; then
8681     AC_MSG_RESULT([yes])
8682     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8684     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8685         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8686     fi
8687     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8688         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8689     fi
8691     postgres_interface=""
8692     if test "$with_system_postgresql" = "yes"; then
8693         postgres_interface="external PostgreSQL"
8694         SYSTEM_POSTGRESQL=TRUE
8695         if test "$_os" = Darwin; then
8696             supp_path=''
8697             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8698                 pg_supp_path="$P_SEP$d$pg_supp_path"
8699             done
8700         fi
8701         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8702         if test -n "$PGCONFIG"; then
8703             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8704             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8705         else
8706             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8707               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8708               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8709             ],[
8710               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8711             ])
8712         fi
8713         FilterLibs "${POSTGRESQL_LIB}"
8714         POSTGRESQL_LIB="${filteredlibs}"
8715     else
8716         # if/when anything else than PostgreSQL uses Kerberos,
8717         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8718         WITH_KRB5=
8719         WITH_GSSAPI=
8720         case "$_os" in
8721         Darwin)
8722             # MacOS X has system MIT Kerberos 5 since 10.4
8723             if test "$with_krb5" != "no"; then
8724                 WITH_KRB5=TRUE
8725                 save_LIBS=$LIBS
8726                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8727                 # that the libraries where these functions are located on macOS will change, is it?
8728                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8729                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8730                 KRB5_LIBS=$LIBS
8731                 LIBS=$save_LIBS
8732                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8733                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8734                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8735                 LIBS=$save_LIBS
8736             fi
8737             if test "$with_gssapi" != "no"; then
8738                 WITH_GSSAPI=TRUE
8739                 save_LIBS=$LIBS
8740                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8741                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8742                 GSSAPI_LIBS=$LIBS
8743                 LIBS=$save_LIBS
8744             fi
8745             ;;
8746         WINNT)
8747             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8748                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8749             fi
8750             ;;
8751         Linux|GNU|*BSD|DragonFly)
8752             if test "$with_krb5" != "no"; then
8753                 WITH_KRB5=TRUE
8754                 save_LIBS=$LIBS
8755                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8756                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8757                 KRB5_LIBS=$LIBS
8758                 LIBS=$save_LIBS
8759                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8760                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8761                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8762                 LIBS=$save_LIBS
8763             fi
8764             if test "$with_gssapi" != "no"; then
8765                 WITH_GSSAPI=TRUE
8766                 save_LIBS=$LIBS
8767                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8768                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8769                 GSSAPI_LIBS=$LIBS
8770                 LIBS=$save_LIBS
8771             fi
8772             ;;
8773         *)
8774             if test "$with_krb5" = "yes"; then
8775                 WITH_KRB5=TRUE
8776                 save_LIBS=$LIBS
8777                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8778                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8779                 KRB5_LIBS=$LIBS
8780                 LIBS=$save_LIBS
8781                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8782                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8783                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8784                 LIBS=$save_LIBS
8785             fi
8786             if test "$with_gssapi" = "yes"; then
8787                 WITH_GSSAPI=TRUE
8788                 save_LIBS=$LIBS
8789                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8790                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8791                 LIBS=$save_LIBS
8792                 GSSAPI_LIBS=$LIBS
8793             fi
8794         esac
8796         if test -n "$with_libpq_path"; then
8797             SYSTEM_POSTGRESQL=TRUE
8798             postgres_interface="external libpq"
8799             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8800             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8801         else
8802             SYSTEM_POSTGRESQL=
8803             postgres_interface="internal"
8804             POSTGRESQL_LIB=""
8805             POSTGRESQL_INC="%OVERRIDE_ME%"
8806             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8807         fi
8808     fi
8810     AC_MSG_CHECKING([PostgreSQL C interface])
8811     AC_MSG_RESULT([$postgres_interface])
8813     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8814         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8815         save_CFLAGS=$CFLAGS
8816         save_CPPFLAGS=$CPPFLAGS
8817         save_LIBS=$LIBS
8818         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8819         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8820         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8821         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8822             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8823         CFLAGS=$save_CFLAGS
8824         CPPFLAGS=$save_CPPFLAGS
8825         LIBS=$save_LIBS
8826     fi
8827     BUILD_POSTGRESQL_SDBC=TRUE
8828 else
8829     AC_MSG_RESULT([no])
8831 AC_SUBST(WITH_KRB5)
8832 AC_SUBST(WITH_GSSAPI)
8833 AC_SUBST(GSSAPI_LIBS)
8834 AC_SUBST(KRB5_LIBS)
8835 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8836 AC_SUBST(SYSTEM_POSTGRESQL)
8837 AC_SUBST(POSTGRESQL_INC)
8838 AC_SUBST(POSTGRESQL_LIB)
8840 dnl ===================================================================
8841 dnl Check for Firebird stuff
8842 dnl ===================================================================
8843 ENABLE_FIREBIRD_SDBC=
8844 if test "$enable_firebird_sdbc" = "yes" ; then
8845     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8847     dnl ===================================================================
8848     dnl Check for system Firebird
8849     dnl ===================================================================
8850     AC_MSG_CHECKING([which Firebird to use])
8851     if test "$with_system_firebird" = "yes"; then
8852         AC_MSG_RESULT([external])
8853         SYSTEM_FIREBIRD=TRUE
8854         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8855         if test -z "$FIREBIRDCONFIG"; then
8856             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8857             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8858                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8859             ])
8860             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8861         else
8862             AC_MSG_NOTICE([fb_config found])
8863             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8864             AC_MSG_CHECKING([for Firebird Client library])
8865             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8866             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8867             FilterLibs "${FIREBIRD_LIBS}"
8868             FIREBIRD_LIBS="${filteredlibs}"
8869         fi
8870         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8871         AC_MSG_CHECKING([Firebird version])
8872         if test -n "${FIREBIRD_VERSION}"; then
8873             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8874             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8875             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8876                 AC_MSG_RESULT([OK])
8877             else
8878                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8879             fi
8880         else
8881             __save_CFLAGS="${CFLAGS}"
8882             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8883             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8884 #if defined(FB_API_VER) && FB_API_VER == 30
8885 int fb_api_is_30(void) { return 0; }
8886 #else
8887 #error "Wrong Firebird API version"
8888 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8889             CFLAGS="${__save_CFLAGS}"
8890         fi
8891         ENABLE_FIREBIRD_SDBC=TRUE
8892         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8893     elif test "$enable_database_connectivity" != yes; then
8894         AC_MSG_RESULT([none])
8895     elif test "$cross_compiling" = "yes"; then
8896         AC_MSG_RESULT([none])
8897     else
8898         dnl Embedded Firebird has version 3.0
8899         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8900         dnl We need libatomic-ops for any non X86/X64 system
8901         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8902             dnl ===================================================================
8903             dnl Check for system libatomic-ops
8904             dnl ===================================================================
8905             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8906             if test "$with_system_libatomic_ops" = "yes"; then
8907                 SYSTEM_LIBATOMIC_OPS=TRUE
8908                 AC_CHECK_HEADERS(atomic_ops.h, [],
8909                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8910             else
8911                 SYSTEM_LIBATOMIC_OPS=
8912                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8913                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8914                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8915             fi
8916         fi
8918         AC_MSG_RESULT([internal])
8919         SYSTEM_FIREBIRD=
8920         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8921         FIREBIRD_LIBS="-lfbclient"
8923         if test "$with_system_libtommath" = "yes"; then
8924             SYSTEM_LIBTOMMATH=TRUE
8925             dnl check for tommath presence
8926             save_LIBS=$LIBS
8927             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8928             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8929             LIBS=$save_LIBS
8930         else
8931             SYSTEM_LIBTOMMATH=
8932             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8933             LIBTOMMATH_LIBS="-ltommath"
8934             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8935         fi
8937         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8938         ENABLE_FIREBIRD_SDBC=TRUE
8939         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8940     fi
8942 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8943 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8944 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8945 AC_SUBST(LIBATOMIC_OPS_LIBS)
8946 AC_SUBST(SYSTEM_FIREBIRD)
8947 AC_SUBST(FIREBIRD_CFLAGS)
8948 AC_SUBST(FIREBIRD_LIBS)
8949 AC_SUBST([TOMMATH_CFLAGS])
8950 AC_SUBST([TOMMATH_LIBS])
8952 dnl ===================================================================
8953 dnl Check for system curl
8954 dnl ===================================================================
8955 AC_MSG_CHECKING([which libcurl to use])
8956 if test "$with_system_curl" = "auto"; then
8957     with_system_curl="$with_system_libs"
8960 if test "$with_system_curl" = "yes"; then
8961     AC_MSG_RESULT([external])
8962     SYSTEM_CURL=TRUE
8964     # First try PKGCONFIG and then fall back
8965     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8967     if test -n "$CURL_PKG_ERRORS"; then
8968         AC_PATH_PROG(CURLCONFIG, curl-config)
8969         if test -z "$CURLCONFIG"; then
8970             AC_MSG_ERROR([curl development files not found])
8971         fi
8972         CURL_LIBS=`$CURLCONFIG --libs`
8973         FilterLibs "${CURL_LIBS}"
8974         CURL_LIBS="${filteredlibs}"
8975         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8976         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8978         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8979         case $curl_version in
8980         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8981         dnl so they need to be doubled to end up in the configure script
8982         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8983             AC_MSG_RESULT([yes])
8984             ;;
8985         *)
8986             AC_MSG_ERROR([no, you have $curl_version])
8987             ;;
8988         esac
8989     fi
8991     ENABLE_CURL=TRUE
8992 else
8993     AC_MSG_RESULT([internal])
8994     SYSTEM_CURL=
8995     BUILD_TYPE="$BUILD_TYPE CURL"
8996     ENABLE_CURL=TRUE
8998 AC_SUBST(SYSTEM_CURL)
8999 AC_SUBST(CURL_CFLAGS)
9000 AC_SUBST(CURL_LIBS)
9001 AC_SUBST(ENABLE_CURL)
9003 dnl ===================================================================
9004 dnl Check for system boost
9005 dnl ===================================================================
9006 AC_MSG_CHECKING([which boost to use])
9007 if test "$with_system_boost" = "yes"; then
9008     AC_MSG_RESULT([external])
9009     SYSTEM_BOOST=TRUE
9010     AX_BOOST_BASE(1.47)
9011     AX_BOOST_DATE_TIME
9012     AX_BOOST_FILESYSTEM
9013     AX_BOOST_IOSTREAMS
9014     AX_BOOST_LOCALE
9015     AC_LANG_PUSH([C++])
9016     save_CXXFLAGS=$CXXFLAGS
9017     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9018     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9019        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9020     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9021        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9022     CXXFLAGS=$save_CXXFLAGS
9023     AC_LANG_POP([C++])
9024     # this is in m4/ax_boost_base.m4
9025     FilterLibs "${BOOST_LDFLAGS}"
9026     BOOST_LDFLAGS="${filteredlibs}"
9027 else
9028     AC_MSG_RESULT([internal])
9029     BUILD_TYPE="$BUILD_TYPE BOOST"
9030     SYSTEM_BOOST=
9031     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9032         # use warning-suppressing wrapper headers
9033         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9034     else
9035         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9036     fi
9038 AC_SUBST(SYSTEM_BOOST)
9040 dnl ===================================================================
9041 dnl Check for system mdds
9042 dnl ===================================================================
9043 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9045 dnl ===================================================================
9046 dnl Check for system glm
9047 dnl ===================================================================
9048 AC_MSG_CHECKING([which glm to use])
9049 if test "$with_system_glm" = "yes"; then
9050     AC_MSG_RESULT([external])
9051     SYSTEM_GLM=TRUE
9052     AC_LANG_PUSH([C++])
9053     AC_CHECK_HEADER([glm/glm.hpp], [],
9054        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9055     AC_LANG_POP([C++])
9056 else
9057     AC_MSG_RESULT([internal])
9058     BUILD_TYPE="$BUILD_TYPE GLM"
9059     SYSTEM_GLM=
9060     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9062 AC_SUBST([GLM_CFLAGS])
9063 AC_SUBST([SYSTEM_GLM])
9065 dnl ===================================================================
9066 dnl Check for system odbc
9067 dnl ===================================================================
9068 AC_MSG_CHECKING([which odbc headers to use])
9069 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
9070     AC_MSG_RESULT([external])
9071     SYSTEM_ODBC_HEADERS=TRUE
9073     if test "$build_os" = "cygwin"; then
9074         save_CPPFLAGS=$CPPFLAGS
9075         find_winsdk
9076         PathFormat "$winsdktest"
9077         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"
9078         AC_CHECK_HEADER(sqlext.h, [],
9079             [AC_MSG_ERROR(odbc not found. install odbc)],
9080             [#include <windows.h>])
9081         CPPFLAGS=$save_CPPFLAGS
9082     else
9083         AC_CHECK_HEADER(sqlext.h, [],
9084             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9085     fi
9086 elif test "$enable_database_connectivity" != yes; then
9087     AC_MSG_RESULT([none])
9088 else
9089     AC_MSG_RESULT([internal])
9090     SYSTEM_ODBC_HEADERS=
9092 AC_SUBST(SYSTEM_ODBC_HEADERS)
9095 dnl ===================================================================
9096 dnl Check for system openldap
9097 dnl ===================================================================
9099 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9100 AC_MSG_CHECKING([which openldap library to use])
9101 if test "$with_system_openldap" = "yes"; then
9102     AC_MSG_RESULT([external])
9103     SYSTEM_OPENLDAP=TRUE
9104     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9105     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9106     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9107 else
9108     AC_MSG_RESULT([internal])
9109     SYSTEM_OPENLDAP=
9110     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9113 AC_SUBST(SYSTEM_OPENLDAP)
9115 dnl ===================================================================
9116 dnl Check for system NSS
9117 dnl ===================================================================
9118 if test "$enable_fuzzers" != "yes"; then
9119     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9120     AC_DEFINE(HAVE_FEATURE_NSS)
9121     ENABLE_NSS="TRUE"
9122     AC_DEFINE(ENABLE_NSS)
9123 elif test $_os != iOS ; then
9124     with_tls=openssl
9126 AC_SUBST(ENABLE_NSS)
9128 dnl ===================================================================
9129 dnl Check for TLS/SSL and cryptographic implementation to use
9130 dnl ===================================================================
9131 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9132 if test -n "$with_tls"; then
9133     case $with_tls in
9134     openssl)
9135         AC_DEFINE(USE_TLS_OPENSSL)
9136         TLS=OPENSSL
9138         if test "$enable_openssl" != "yes"; then
9139             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9140         fi
9142         # warn that OpenSSL has been selected but not all TLS code has this option
9143         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9144         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9145         ;;
9146     nss)
9147         AC_DEFINE(USE_TLS_NSS)
9148         TLS=NSS
9149         ;;
9150     no)
9151         AC_MSG_WARN([Skipping TLS/SSL])
9152         ;;
9153     *)
9154         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9155 openssl - OpenSSL
9156 nss - Mozilla's Network Security Services (NSS)
9157     ])
9158         ;;
9159     esac
9160 else
9161     # default to using NSS, it results in smaller oox lib
9162     AC_DEFINE(USE_TLS_NSS)
9163     TLS=NSS
9165 AC_MSG_RESULT([$TLS])
9166 AC_SUBST(TLS)
9168 dnl ===================================================================
9169 dnl Check for system sane
9170 dnl ===================================================================
9171 AC_MSG_CHECKING([which sane header to use])
9172 if test "$with_system_sane" = "yes"; then
9173     AC_MSG_RESULT([external])
9174     AC_CHECK_HEADER(sane/sane.h, [],
9175       [AC_MSG_ERROR(sane not found. install sane)], [])
9176 else
9177     AC_MSG_RESULT([internal])
9178     BUILD_TYPE="$BUILD_TYPE SANE"
9181 dnl ===================================================================
9182 dnl Check for system icu
9183 dnl ===================================================================
9184 SYSTEM_GENBRK=
9185 SYSTEM_GENCCODE=
9186 SYSTEM_GENCMN=
9188 ICU_MAJOR=63
9189 ICU_MINOR=1
9190 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9191 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9192 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9193 AC_MSG_CHECKING([which icu to use])
9194 if test "$with_system_icu" = "yes"; then
9195     AC_MSG_RESULT([external])
9196     SYSTEM_ICU=TRUE
9197     AC_LANG_PUSH([C++])
9198     AC_MSG_CHECKING([for unicode/rbbi.h])
9199     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9200     AC_LANG_POP([C++])
9202     if test "$cross_compiling" != "yes"; then
9203         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9204         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9205         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9206         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9207     fi
9209     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9210         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9211         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9212         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9213         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9214         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9215             AC_MSG_RESULT([yes])
9216         else
9217             AC_MSG_RESULT([no])
9218             if test "$with_system_icu_for_build" != "force"; then
9219                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9220 You can use --with-system-icu-for-build=force to use it anyway.])
9221             fi
9222         fi
9223     fi
9225     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9226         # using the system icu tools can lead to version confusion, use the
9227         # ones from the build environment when cross-compiling
9228         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9229         if test -z "$SYSTEM_GENBRK"; then
9230             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9231         fi
9232         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9233         if test -z "$SYSTEM_GENCCODE"; then
9234             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9235         fi
9236         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9237         if test -z "$SYSTEM_GENCMN"; then
9238             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9239         fi
9240         if test "$ICU_MAJOR" -ge "49"; then
9241             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9242             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9243             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9244         else
9245             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9246             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9247             ICU_RECLASSIFIED_HEBREW_LETTER=
9248         fi
9249     fi
9251     if test "$cross_compiling" = "yes"; then
9252         if test "$ICU_MAJOR" -ge "50"; then
9253             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9254             ICU_MINOR=""
9255         fi
9256     fi
9257 else
9258     AC_MSG_RESULT([internal])
9259     SYSTEM_ICU=
9260     BUILD_TYPE="$BUILD_TYPE ICU"
9261     # surprisingly set these only for "internal" (to be used by various other
9262     # external libs): the system icu-config is quite unhelpful and spits out
9263     # dozens of weird flags and also default path -I/usr/include
9264     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9265     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9267 if test "$ICU_MAJOR" -ge "59"; then
9268     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9269     # with -std=c++11 but not all external libraries can be built with that,
9270     # for those use a bit-compatible typedef uint16_t UChar; see
9271     # icu/source/common/unicode/umachine.h
9272     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9273 else
9274     ICU_UCHAR_TYPE=""
9276 AC_SUBST(SYSTEM_ICU)
9277 AC_SUBST(SYSTEM_GENBRK)
9278 AC_SUBST(SYSTEM_GENCCODE)
9279 AC_SUBST(SYSTEM_GENCMN)
9280 AC_SUBST(ICU_MAJOR)
9281 AC_SUBST(ICU_MINOR)
9282 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9283 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9284 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9285 AC_SUBST(ICU_CFLAGS)
9286 AC_SUBST(ICU_LIBS)
9287 AC_SUBST(ICU_UCHAR_TYPE)
9289 dnl ==================================================================
9290 dnl Breakpad
9291 dnl ==================================================================
9292 AC_MSG_CHECKING([whether to enable breakpad])
9293 if test "$enable_breakpad" != yes; then
9294     AC_MSG_RESULT([no])
9295 else
9296     AC_MSG_RESULT([yes])
9297     ENABLE_BREAKPAD="TRUE"
9298     AC_DEFINE(ENABLE_BREAKPAD)
9299     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9300     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9302     AC_MSG_CHECKING([for crashreport config])
9303     if test "$with_symbol_config" = "no"; then
9304         BREAKPAD_SYMBOL_CONFIG="invalid"
9305         AC_MSG_RESULT([no])
9306     else
9307         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9308         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9309         AC_MSG_RESULT([yes])
9310     fi
9311     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9313 AC_SUBST(ENABLE_BREAKPAD)
9315 dnl ==================================================================
9316 dnl libfuzzer
9317 dnl ==================================================================
9318 AC_MSG_CHECKING([whether to enable fuzzers])
9319 if test "$enable_fuzzers" != yes; then
9320     AC_MSG_RESULT([no])
9321 else
9322     AC_MSG_RESULT([yes])
9323     ENABLE_FUZZERS="TRUE"
9324     AC_DEFINE([ENABLE_FUZZERS],1)
9325     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9327 AC_SUBST(ENABLE_FUZZERS)
9329 dnl ===================================================================
9330 dnl Orcus
9331 dnl ===================================================================
9332 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9333 if test "$with_system_orcus" != "yes"; then
9334     if test "$SYSTEM_BOOST" = "TRUE"; then
9335         # ===========================================================
9336         # Determine if we are going to need to link with Boost.System
9337         # ===========================================================
9338         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9339         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9340         dnl in documentation has no effect.
9341         AC_MSG_CHECKING([if we need to link with Boost.System])
9342         AC_LANG_PUSH([C++])
9343         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9344                 @%:@include <boost/version.hpp>
9345             ]],[[
9346                 #if BOOST_VERSION >= 105000
9347                 #   error yes, we need to link with Boost.System
9348                 #endif
9349             ]])],[
9350                 AC_MSG_RESULT([no])
9351             ],[
9352                 AC_MSG_RESULT([yes])
9353                 AX_BOOST_SYSTEM
9354         ])
9355         AC_LANG_POP([C++])
9356     fi
9358 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9359 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9360 AC_SUBST([BOOST_SYSTEM_LIB])
9361 AC_SUBST(SYSTEM_LIBORCUS)
9363 dnl ===================================================================
9364 dnl HarfBuzz
9365 dnl ===================================================================
9366 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9367                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9368                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9370 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9371                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9372                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9374 if test "$COM" = "MSC"; then # override the above
9375     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9376     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9379 if test "$with_system_harfbuzz" = "yes"; then
9380     if test "$with_system_graphite" = "no"; then
9381         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9382     fi
9383     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9384     _save_libs="$LIBS"
9385     _save_cflags="$CFLAGS"
9386     LIBS="$LIBS $HARFBUZZ_LIBS"
9387     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9388     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9389     LIBS="$_save_libs"
9390     CFLAGS="$_save_cflags"
9391 else
9392     if test "$with_system_graphite" = "yes"; then
9393         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9394     fi
9397 AC_MSG_CHECKING([whether to use X11])
9398 dnl ***************************************
9399 dnl testing for X libraries and includes...
9400 dnl ***************************************
9401 if test "$USING_X11" = TRUE; then
9402     AC_DEFINE(HAVE_FEATURE_X11)
9404 AC_MSG_RESULT([$USING_X11])
9406 if test "$USING_X11" = TRUE; then
9407     AC_PATH_X
9408     AC_PATH_XTRA
9409     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9411     if test -z "$x_includes"; then
9412         x_includes="default_x_includes"
9413     fi
9414     if test -z "$x_libraries"; then
9415         x_libraries="default_x_libraries"
9416     fi
9417     CFLAGS="$CFLAGS $X_CFLAGS"
9418     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9419     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9420 else
9421     x_includes="no_x_includes"
9422     x_libraries="no_x_libraries"
9425 if test "$USING_X11" = TRUE; then
9426     dnl ===================================================================
9427     dnl Check for extension headers
9428     dnl ===================================================================
9429     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9430      [#include <X11/extensions/shape.h>])
9432     # vcl needs ICE and SM
9433     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9434     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9435         [AC_MSG_ERROR(ICE library not found)])
9436     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9437     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9438         [AC_MSG_ERROR(SM library not found)])
9441 dnl ===================================================================
9442 dnl Check for system Xrender
9443 dnl ===================================================================
9444 AC_MSG_CHECKING([whether to use Xrender])
9445 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9446     AC_MSG_RESULT([yes])
9447     PKG_CHECK_MODULES(XRENDER, xrender)
9448     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9449     FilterLibs "${XRENDER_LIBS}"
9450     XRENDER_LIBS="${filteredlibs}"
9451     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9452       [AC_MSG_ERROR(libXrender not found or functional)], [])
9453     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9454       [AC_MSG_ERROR(Xrender not found. install X)], [])
9455 else
9456     AC_MSG_RESULT([no])
9458 AC_SUBST(XRENDER_CFLAGS)
9459 AC_SUBST(XRENDER_LIBS)
9461 dnl ===================================================================
9462 dnl Check for XRandr
9463 dnl ===================================================================
9464 AC_MSG_CHECKING([whether to enable RandR support])
9465 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9466     AC_MSG_RESULT([yes])
9467     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9468     if test "$ENABLE_RANDR" != "TRUE"; then
9469         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9470                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9471         XRANDR_CFLAGS=" "
9472         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9473           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9474         XRANDR_LIBS="-lXrandr "
9475         ENABLE_RANDR="TRUE"
9476     fi
9477     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9478     FilterLibs "${XRANDR_LIBS}"
9479     XRANDR_LIBS="${filteredlibs}"
9480 else
9481     ENABLE_RANDR=""
9482     AC_MSG_RESULT([no])
9484 AC_SUBST(XRANDR_CFLAGS)
9485 AC_SUBST(XRANDR_LIBS)
9486 AC_SUBST(ENABLE_RANDR)
9488 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9489     WITH_WEBDAV="serf"
9491 if test $_os = iOS -o $_os = Android; then
9492     WITH_WEBDAV="no"
9494 AC_MSG_CHECKING([for webdav library])
9495 case "$WITH_WEBDAV" in
9496 serf)
9497     AC_MSG_RESULT([serf])
9498     # Check for system apr-util
9499     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9500                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9501                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9502     if test "$COM" = "MSC"; then
9503         APR_LIB_DIR="LibR"
9504         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9505         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9506     fi
9508     # Check for system serf
9509     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9510                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9511     if test "$COM" = "MSC"; then
9512         SERF_LIB_DIR="Release"
9513         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9514         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9515     fi
9516     ;;
9517 neon)
9518     AC_MSG_RESULT([neon])
9519     # Check for system neon
9520     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9521     if test "$with_system_neon" = "yes"; then
9522         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9523     else
9524         NEON_VERSION=0295
9525     fi
9526     AC_SUBST(NEON_VERSION)
9527     ;;
9529     AC_MSG_RESULT([none, disabled])
9530     WITH_WEBDAV=""
9531     ;;
9532 esac
9533 AC_SUBST(WITH_WEBDAV)
9535 dnl ===================================================================
9536 dnl Check for disabling cve_tests
9537 dnl ===================================================================
9538 AC_MSG_CHECKING([whether to execute CVE tests])
9539 # If not explicitly enabled or disabled, default
9540 if test -z "$enable_cve_tests"; then
9541     case "$OS" in
9542     WNT)
9543         # Default cves off for windows with its wild and wonderful
9544         # varienty of AV software kicking in and panicking
9545         enable_cve_tests=no
9546         ;;
9547     *)
9548         # otherwise yes
9549         enable_cve_tests=yes
9550         ;;
9551     esac
9553 if test "$enable_cve_tests" = "no"; then
9554     AC_MSG_RESULT([no])
9555     DISABLE_CVE_TESTS=TRUE
9556     AC_SUBST(DISABLE_CVE_TESTS)
9557 else
9558     AC_MSG_RESULT([yes])
9561 dnl ===================================================================
9562 dnl Check for enabling chart XShape tests
9563 dnl ===================================================================
9564 AC_MSG_CHECKING([whether to execute chart XShape tests])
9565 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9566     AC_MSG_RESULT([yes])
9567     ENABLE_CHART_TESTS=TRUE
9568     AC_SUBST(ENABLE_CHART_TESTS)
9569 else
9570     AC_MSG_RESULT([no])
9573 dnl ===================================================================
9574 dnl Check for system openssl
9575 dnl ===================================================================
9576 DISABLE_OPENSSL=
9577 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9578 if test "$enable_openssl" = "yes"; then
9579     AC_MSG_RESULT([no])
9580     if test "$_os" = Darwin ; then
9581         # OpenSSL is deprecated when building for 10.7 or later.
9582         #
9583         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9584         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9586         with_system_openssl=no
9587         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9588     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9589             && test "$with_system_openssl" != "no"; then
9590         with_system_openssl=yes
9591         SYSTEM_OPENSSL=TRUE
9592         OPENSSL_CFLAGS=
9593         OPENSSL_LIBS="-lssl -lcrypto"
9594     else
9595         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9596     fi
9597     if test "$with_system_openssl" = "yes"; then
9598         AC_MSG_CHECKING([whether openssl supports SHA512])
9599         AC_LANG_PUSH([C])
9600         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9601             SHA512_CTX context;
9602 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9603         AC_LANG_POP(C)
9604     fi
9605 else
9606     AC_MSG_RESULT([yes])
9607     DISABLE_OPENSSL=TRUE
9609     # warn that although OpenSSL is disabled, system libraries may depend on it
9610     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9611     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9614 AC_SUBST([DISABLE_OPENSSL])
9616 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9617     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9618         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9619         enable_cipher_openssl_backend=no
9620     else
9621         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9622     fi
9624 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9625 ENABLE_CIPHER_OPENSSL_BACKEND=
9626 if test "$enable_cipher_openssl_backend" = yes; then
9627     AC_MSG_RESULT([yes])
9628     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9629 else
9630     AC_MSG_RESULT([no])
9632 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9634 dnl ===================================================================
9635 dnl Check for building gnutls
9636 dnl ===================================================================
9637 AC_MSG_CHECKING([whether to use gnutls])
9638 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9639     AC_MSG_RESULT([yes])
9640     AM_PATH_LIBGCRYPT()
9641     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9642         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9643                       available in the system to use as replacement.]]))
9644     FilterLibs "${LIBGCRYPT_LIBS}"
9645     LIBGCRYPT_LIBS="${filteredlibs}"
9646 else
9647     AC_MSG_RESULT([no])
9650 AC_SUBST([LIBGCRYPT_CFLAGS])
9651 AC_SUBST([LIBGCRYPT_LIBS])
9653 dnl ===================================================================
9654 dnl Check for system redland
9655 dnl ===================================================================
9656 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9657 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9658 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9659 if test "$with_system_redland" = "yes"; then
9660     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9661             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9662 else
9663     RAPTOR_MAJOR="0"
9664     RASQAL_MAJOR="3"
9665     REDLAND_MAJOR="0"
9667 AC_SUBST(RAPTOR_MAJOR)
9668 AC_SUBST(RASQAL_MAJOR)
9669 AC_SUBST(REDLAND_MAJOR)
9671 dnl ===================================================================
9672 dnl Check for system hunspell
9673 dnl ===================================================================
9674 AC_MSG_CHECKING([which libhunspell to use])
9675 if test "$_os" = iOS; then
9676    AC_MSG_RESULT([none])
9677 elif test "$with_system_hunspell" = "yes"; then
9678     AC_MSG_RESULT([external])
9679     SYSTEM_HUNSPELL=TRUE
9680     AC_LANG_PUSH([C++])
9681     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9682     if test "$HUNSPELL_PC" != "TRUE"; then
9683         AC_CHECK_HEADER(hunspell.hxx, [],
9684             [
9685             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9686             [AC_MSG_ERROR(hunspell headers not found.)], [])
9687             ], [])
9688         AC_CHECK_LIB([hunspell], [main], [:],
9689            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9690         HUNSPELL_LIBS=-lhunspell
9691     fi
9692     AC_LANG_POP([C++])
9693     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9694     FilterLibs "${HUNSPELL_LIBS}"
9695     HUNSPELL_LIBS="${filteredlibs}"
9696 else
9697     AC_MSG_RESULT([internal])
9698     SYSTEM_HUNSPELL=
9699     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9700     if test "$COM" = "MSC"; then
9701         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9702     else
9703         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9704     fi
9705     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9707 AC_SUBST(SYSTEM_HUNSPELL)
9708 AC_SUBST(HUNSPELL_CFLAGS)
9709 AC_SUBST(HUNSPELL_LIBS)
9711 dnl ===================================================================
9712 dnl Checking for altlinuxhyph
9713 dnl ===================================================================
9714 AC_MSG_CHECKING([which altlinuxhyph to use])
9715 if test "$with_system_altlinuxhyph" = "yes"; then
9716     AC_MSG_RESULT([external])
9717     SYSTEM_HYPH=TRUE
9718     AC_CHECK_HEADER(hyphen.h, [],
9719        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9720     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9721        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9722        [#include <hyphen.h>])
9723     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9724         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9725     if test -z "$HYPHEN_LIB"; then
9726         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9727            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9728     fi
9729     if test -z "$HYPHEN_LIB"; then
9730         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9731            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9732     fi
9733 else
9734     AC_MSG_RESULT([internal])
9735     SYSTEM_HYPH=
9736     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9737     if test "$COM" = "MSC"; then
9738         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9739     else
9740         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9741     fi
9743 AC_SUBST(SYSTEM_HYPH)
9744 AC_SUBST(HYPHEN_LIB)
9746 dnl ===================================================================
9747 dnl Checking for mythes
9748 dnl ===================================================================
9749 AC_MSG_CHECKING([which mythes to use])
9750 if test "$_os" = iOS; then
9751    AC_MSG_RESULT([none])
9752 elif test "$with_system_mythes" = "yes"; then
9753     AC_MSG_RESULT([external])
9754     SYSTEM_MYTHES=TRUE
9755     AC_LANG_PUSH([C++])
9756     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9757     if test "$MYTHES_PKGCONFIG" = "no"; then
9758         AC_CHECK_HEADER(mythes.hxx, [],
9759             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9760         AC_CHECK_LIB([mythes-1.2], [main], [:],
9761             [ MYTHES_FOUND=no], [])
9762     if test "$MYTHES_FOUND" = "no"; then
9763         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9764                 [ MYTHES_FOUND=no], [])
9765     fi
9766     if test "$MYTHES_FOUND" = "no"; then
9767         AC_MSG_ERROR([mythes library not found!.])
9768     fi
9769     fi
9770     AC_LANG_POP([C++])
9771     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9772     FilterLibs "${MYTHES_LIBS}"
9773     MYTHES_LIBS="${filteredlibs}"
9774 else
9775     AC_MSG_RESULT([internal])
9776     SYSTEM_MYTHES=
9777     BUILD_TYPE="$BUILD_TYPE MYTHES"
9778     if test "$COM" = "MSC"; then
9779         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9780     else
9781         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9782     fi
9784 AC_SUBST(SYSTEM_MYTHES)
9785 AC_SUBST(MYTHES_CFLAGS)
9786 AC_SUBST(MYTHES_LIBS)
9788 dnl ===================================================================
9789 dnl How should we build the linear programming solver ?
9790 dnl ===================================================================
9792 ENABLE_COINMP=
9793 AC_MSG_CHECKING([whether to build with CoinMP])
9794 if test "$enable_coinmp" != "no"; then
9795     ENABLE_COINMP=TRUE
9796     AC_MSG_RESULT([yes])
9797     if test "$with_system_coinmp" = "yes"; then
9798         SYSTEM_COINMP=TRUE
9799         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9800         FilterLibs "${COINMP_LIBS}"
9801         COINMP_LIBS="${filteredlibs}"
9802     else
9803         BUILD_TYPE="$BUILD_TYPE COINMP"
9804     fi
9805 else
9806     AC_MSG_RESULT([no])
9808 AC_SUBST(ENABLE_COINMP)
9809 AC_SUBST(SYSTEM_COINMP)
9810 AC_SUBST(COINMP_CFLAGS)
9811 AC_SUBST(COINMP_LIBS)
9813 ENABLE_LPSOLVE=
9814 AC_MSG_CHECKING([whether to build with lpsolve])
9815 if test "$enable_lpsolve" != "no"; then
9816     ENABLE_LPSOLVE=TRUE
9817     AC_MSG_RESULT([yes])
9818 else
9819     AC_MSG_RESULT([no])
9821 AC_SUBST(ENABLE_LPSOLVE)
9823 if test "$ENABLE_LPSOLVE" = TRUE; then
9824     AC_MSG_CHECKING([which lpsolve to use])
9825     if test "$with_system_lpsolve" = "yes"; then
9826         AC_MSG_RESULT([external])
9827         SYSTEM_LPSOLVE=TRUE
9828         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9829            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9830         save_LIBS=$LIBS
9831         # some systems need this. Like Ubuntu....
9832         AC_CHECK_LIB(m, floor)
9833         AC_CHECK_LIB(dl, dlopen)
9834         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9835             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9836         LIBS=$save_LIBS
9837     else
9838         AC_MSG_RESULT([internal])
9839         SYSTEM_LPSOLVE=
9840         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9841     fi
9843 AC_SUBST(SYSTEM_LPSOLVE)
9845 dnl ===================================================================
9846 dnl Checking for libexttextcat
9847 dnl ===================================================================
9848 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9849 if test "$with_system_libexttextcat" = "yes"; then
9850     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9852 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9854 dnl ===================================================================
9855 dnl Checking for libnumbertext
9856 dnl ===================================================================
9857 AC_MSG_CHECKING([whether to use libnumbertext])
9858 if test "$enable_libnumbertext" = "no"; then
9859     AC_MSG_RESULT([no])
9860     ENABLE_LIBNUMBERTEXT=
9861     SYSTEM_LIBNUMBERTEXT=
9862 else
9863     AC_MSG_RESULT([yes])
9864     ENABLE_LIBNUMBERTEXT=TRUE
9865     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9866     if test "$with_system_libnumbertext" = "yes"; then
9867         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9868         SYSTEM_LIBNUMBERTEXT=YES
9869     else
9870         SYSTEM_LIBNUMBERTEXT=
9871         AC_LANG_PUSH([C++])
9872         save_CPPFLAGS=$CPPFLAGS
9873         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9874         AC_CHECK_HEADERS([codecvt regex])
9875         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9876                 [ ENABLE_LIBNUMBERTEXT=''
9877                   LIBNUMBERTEXT_CFLAGS=''
9878                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9879                                Enable libnumbertext fallback (missing number to number name conversion).])
9880                 ])
9881         CPPFLAGS=$save_CPPFLAGS
9882         AC_LANG_POP([C++])
9883     fi
9884     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9885         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9886     fi
9888 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9889 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9890 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9891 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9893 dnl ***************************************
9894 dnl testing libc version for Linux...
9895 dnl ***************************************
9896 if test "$_os" = "Linux"; then
9897     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9898     exec 6>/dev/null # no output
9899     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9900     exec 6>&1 # output on again
9901     if test "$HAVE_LIBC"; then
9902         AC_MSG_RESULT([yes])
9903     else
9904         AC_MSG_ERROR([no, upgrade libc])
9905     fi
9908 dnl =========================================
9909 dnl Check for uuidgen
9910 dnl =========================================
9911 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9912     # presence is already tested above in the WINDOWS_SDK_HOME check
9913     UUIDGEN=uuidgen.exe
9914     AC_SUBST(UUIDGEN)
9915 else
9916     AC_PATH_PROG([UUIDGEN], [uuidgen])
9917     if test -z "$UUIDGEN"; then
9918         AC_MSG_WARN([uuid is needed for building installation sets])
9919     fi
9922 dnl ***************************************
9923 dnl Checking for bison and flex
9924 dnl ***************************************
9925 AC_PATH_PROG(BISON, bison)
9926 if test -z "$BISON"; then
9927     AC_MSG_ERROR([no bison found in \$PATH, install it])
9928 else
9929     AC_MSG_CHECKING([the bison version])
9930     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9931     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9932     # Accept newer than 2.0
9933     if test "$_bison_longver" -lt 2000; then
9934         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9935     fi
9938 AC_PATH_PROG(FLEX, flex)
9939 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9940     FLEX=`cygpath -m $FLEX`
9942 if test -z "$FLEX"; then
9943     AC_MSG_ERROR([no flex found in \$PATH, install it])
9944 else
9945     AC_MSG_CHECKING([the flex version])
9946     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9947     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9948         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9949     fi
9951 AC_SUBST([FLEX])
9952 dnl ***************************************
9953 dnl Checking for patch
9954 dnl ***************************************
9955 AC_PATH_PROG(PATCH, patch)
9956 if test -z "$PATCH"; then
9957     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9960 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9961 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9962     if test -z "$with_gnu_patch"; then
9963         GNUPATCH=$PATCH
9964     else
9965         if test -x "$with_gnu_patch"; then
9966             GNUPATCH=$with_gnu_patch
9967         else
9968             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9969         fi
9970     fi
9972     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9973     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9974         AC_MSG_RESULT([yes])
9975     else
9976         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9977     fi
9978 else
9979     GNUPATCH=$PATCH
9982 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9983     GNUPATCH=`cygpath -m $GNUPATCH`
9986 dnl We also need to check for --with-gnu-cp
9988 if test -z "$with_gnu_cp"; then
9989     # check the place where the good stuff is hidden on Solaris...
9990     if test -x /usr/gnu/bin/cp; then
9991         GNUCP=/usr/gnu/bin/cp
9992     else
9993         AC_PATH_PROGS(GNUCP, gnucp cp)
9994     fi
9995     if test -z $GNUCP; then
9996         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9997     fi
9998 else
9999     if test -x "$with_gnu_cp"; then
10000         GNUCP=$with_gnu_cp
10001     else
10002         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10003     fi
10006 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10007     GNUCP=`cygpath -m $GNUCP`
10010 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10011 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10012     AC_MSG_RESULT([yes])
10013 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10014     AC_MSG_RESULT([yes])
10015 else
10016     case "$build_os" in
10017     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10018         x_GNUCP=[\#]
10019         GNUCP=''
10020         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10021         ;;
10022     *)
10023         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10024         ;;
10025     esac
10028 AC_SUBST(GNUPATCH)
10029 AC_SUBST(GNUCP)
10030 AC_SUBST(x_GNUCP)
10032 dnl ***************************************
10033 dnl testing assembler path
10034 dnl ***************************************
10035 ML_EXE=""
10036 if test "$_os" = "WINNT"; then
10037     if test "$BITNESS_OVERRIDE" = ""; then
10038         assembler=ml.exe
10039         assembler_bin=$CL_DIR
10040     else
10041         assembler=ml64.exe
10042         assembler_bin=$CL_DIR
10043     fi
10045     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10046     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10047         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10048         AC_MSG_RESULT([found])
10049         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10050     else
10051         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10052     fi
10054     PathFormat "$ASM_HOME"
10055     ASM_HOME="$formatted_path"
10056 else
10057     ASM_HOME=""
10060 AC_SUBST(ML_EXE)
10062 dnl ===================================================================
10063 dnl We need zip and unzip
10064 dnl ===================================================================
10065 AC_PATH_PROG(ZIP, zip)
10066 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10067 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10068     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],,)
10071 AC_PATH_PROG(UNZIP, unzip)
10072 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10074 dnl ===================================================================
10075 dnl Zip must be a specific type for different build types.
10076 dnl ===================================================================
10077 if test $build_os = cygwin; then
10078     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10079         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10080     fi
10083 dnl ===================================================================
10084 dnl We need touch with -h option support.
10085 dnl ===================================================================
10086 AC_PATH_PROG(TOUCH, touch)
10087 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10088 touch warn
10089 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10090     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],,)
10093 dnl ===================================================================
10094 dnl Check for system epoxy
10095 dnl ===================================================================
10096 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10098 dnl ===================================================================
10099 dnl Set vcl option: coordinate device in double or sal_Int32
10100 dnl ===================================================================
10102 dnl disabled for now, we don't want subtle differences between OSs
10103 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10104 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10105 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10106 dnl     AC_MSG_RESULT([double])
10107 dnl else
10108 dnl     AC_MSG_RESULT([sal_Int32])
10109 dnl fi
10111 dnl ===================================================================
10112 dnl Test which vclplugs have to be built.
10113 dnl ===================================================================
10114 R=""
10115 if test "$USING_X11" != TRUE; then
10116     enable_gtk=no
10117     enable_gtk3=no
10119 GTK3_CFLAGS=""
10120 GTK3_LIBS=""
10121 ENABLE_GTK3=""
10122 if test "x$enable_gtk3" = "xyes"; then
10123     if test "$with_system_cairo" = no; then
10124         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10125     fi
10126     : ${with_system_cairo:=yes}
10127     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="")
10128     if test "x$ENABLE_GTK3" = "xTRUE"; then
10129         R="gtk3"
10130         dnl Avoid installed by unpackaged files for now.
10131         if test -z "$PKGFORMAT"; then
10132             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10133         fi
10134     else
10135         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10136     fi
10137     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10138     FilterLibs "${GTK3_LIBS}"
10139     GTK3_LIBS="${filteredlibs}"
10141     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10142     if test "$with_system_epoxy" != "yes"; then
10143         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10144         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10145                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10146     fi
10148 AC_SUBST(GTK3_LIBS)
10149 AC_SUBST(GTK3_CFLAGS)
10150 AC_SUBST(ENABLE_GTK3)
10152 ENABLE_GTK=""
10153 if test "x$enable_gtk" = "xyes"; then
10154     if test "$with_system_cairo" = no; then
10155         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10156     fi
10157     : ${with_system_cairo:=yes}
10158     ENABLE_GTK="TRUE"
10159     AC_DEFINE(ENABLE_GTK)
10160     R="gtk $R"
10162 AC_SUBST(ENABLE_GTK)
10164 ENABLE_KDE4=""
10165 if test "x$enable_kde4" = "xyes"; then
10166     ENABLE_KDE4="TRUE"
10167     AC_DEFINE(ENABLE_KDE4)
10168     R="$R kde4"
10170 AC_SUBST(ENABLE_KDE4)
10172 ENABLE_QT5=""
10173 if test "x$enable_qt5" = "xyes"; then
10174     ENABLE_QT5="TRUE"
10175     AC_DEFINE(ENABLE_QT5)
10176     R="$R qt5"
10178 AC_SUBST(ENABLE_QT5)
10180 ENABLE_KDE5=""
10181 if test "x$enable_kde5" = "xyes"; then
10182     ENABLE_KDE5="TRUE"
10183     AC_DEFINE(ENABLE_KDE5)
10184     R="$R kde5"
10186 AC_SUBST(ENABLE_KDE5)
10188 ENABLE_GTK3_KDE5=""
10189 if test "x$enable_gtk3_kde5" = "xyes"; then
10190     ENABLE_GTK3_KDE5="TRUE"
10191     AC_DEFINE(ENABLE_GTK3_KDE5)
10192     R="$R gtk3_kde5"
10194 AC_SUBST(ENABLE_GTK3_KDE5)
10196 build_vcl_plugins="$R"
10197 if test -z "$build_vcl_plugins"; then
10198     build_vcl_plugins="none"
10200 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10202 dnl ===================================================================
10203 dnl check for dbus support
10204 dnl ===================================================================
10205 ENABLE_DBUS=""
10206 DBUS_CFLAGS=""
10207 DBUS_LIBS=""
10208 DBUS_GLIB_CFLAGS=""
10209 DBUS_GLIB_LIBS=""
10210 DBUS_HAVE_GLIB=""
10212 if test "$enable_dbus" = "no"; then
10213     test_dbus=no
10216 AC_MSG_CHECKING([whether to enable DBUS support])
10217 if test "$test_dbus" = "yes"; then
10218     ENABLE_DBUS="TRUE"
10219     AC_MSG_RESULT([yes])
10220     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10221     AC_DEFINE(ENABLE_DBUS)
10222     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10223     FilterLibs "${DBUS_LIBS}"
10224     DBUS_LIBS="${filteredlibs}"
10226     # Glib is needed for BluetoothServer
10227     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10228     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10229         [
10230             DBUS_HAVE_GLIB="TRUE"
10231             AC_DEFINE(DBUS_HAVE_GLIB,1)
10232         ],
10233         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10234     )
10235 else
10236     AC_MSG_RESULT([no])
10239 AC_SUBST(ENABLE_DBUS)
10240 AC_SUBST(DBUS_CFLAGS)
10241 AC_SUBST(DBUS_LIBS)
10242 AC_SUBST(DBUS_GLIB_CFLAGS)
10243 AC_SUBST(DBUS_GLIB_LIBS)
10244 AC_SUBST(DBUS_HAVE_GLIB)
10246 AC_MSG_CHECKING([whether to enable Impress remote control])
10247 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10248     AC_MSG_RESULT([yes])
10249     ENABLE_SDREMOTE=TRUE
10250     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10252     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10253         # The Bluetooth code doesn't compile with macOS SDK 10.15
10254         enable_sdremote_bluetooth=no
10255     fi
10256     # If not explicitly enabled or disabled, default
10257     if test -z "$enable_sdremote_bluetooth"; then
10258         case "$OS" in
10259         LINUX|MACOSX|WNT)
10260             # Default to yes for these
10261             enable_sdremote_bluetooth=yes
10262             ;;
10263         *)
10264             # otherwise no
10265             enable_sdremote_bluetooth=no
10266             ;;
10267         esac
10268     fi
10269     # $enable_sdremote_bluetooth is guaranteed non-empty now
10271     if test "$enable_sdremote_bluetooth" != "no"; then
10272         if test "$OS" = "LINUX"; then
10273             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10274                 AC_MSG_RESULT([yes])
10275                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10276                 dnl ===================================================================
10277                 dnl Check for system bluez
10278                 dnl ===================================================================
10279                 AC_MSG_CHECKING([which Bluetooth header to use])
10280                 if test "$with_system_bluez" = "yes"; then
10281                     AC_MSG_RESULT([external])
10282                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10283                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10284                     SYSTEM_BLUEZ=TRUE
10285                 else
10286                     AC_MSG_RESULT([internal])
10287                     SYSTEM_BLUEZ=
10288                 fi
10289             else
10290                 AC_MSG_RESULT([no, dbus disabled])
10291                 ENABLE_SDREMOTE_BLUETOOTH=
10292                 SYSTEM_BLUEZ=
10293             fi
10294         else
10295             AC_MSG_RESULT([yes])
10296             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10297             SYSTEM_BLUEZ=
10298         fi
10299     else
10300         AC_MSG_RESULT([no])
10301         ENABLE_SDREMOTE_BLUETOOTH=
10302         SYSTEM_BLUEZ=
10303     fi
10304 else
10305     ENABLE_SDREMOTE=
10306     SYSTEM_BLUEZ=
10307     AC_MSG_RESULT([no])
10309 AC_SUBST(ENABLE_SDREMOTE)
10310 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10311 AC_SUBST(SYSTEM_BLUEZ)
10313 dnl ===================================================================
10314 dnl Check whether the gtk 2.0 libraries are available.
10315 dnl ===================================================================
10317 GTK_CFLAGS=""
10318 GTK_LIBS=""
10319 if test  "$test_gtk" = "yes"; then
10321     if test "$ENABLE_GTK" = "TRUE"; then
10322         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]))
10323         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10324         FilterLibs "${GTK_LIBS}"
10325         GTK_LIBS="${filteredlibs}"
10326         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]))
10327         BUILD_TYPE="$BUILD_TYPE GTK"
10328         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10329         FilterLibs "${GTHREAD_LIBS}"
10330         GTHREAD_LIBS="${filteredlibs}"
10332         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10333         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10334                           [ENABLE_GTK_PRINT="TRUE"],
10335                           [ENABLE_GTK_PRINT=""])
10336         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10337         FilterLibs "${GTK_PRINT_LIBS}"
10338         GTK_PRINT_LIBS="${filteredlibs}"
10339     fi
10341     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10342         AC_MSG_CHECKING([whether to enable GIO support])
10343         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10344             dnl Need at least 2.26 for the dbus support.
10345             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10346                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10347             if test "$ENABLE_GIO" = "TRUE"; then
10348                 AC_DEFINE(ENABLE_GIO)
10349                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10350                 FilterLibs "${GIO_LIBS}"
10351                 GIO_LIBS="${filteredlibs}"
10352             fi
10353         else
10354             AC_MSG_RESULT([no])
10355         fi
10356     fi
10358 AC_SUBST(ENABLE_GIO)
10359 AC_SUBST(GIO_CFLAGS)
10360 AC_SUBST(GIO_LIBS)
10361 AC_SUBST(GTK_CFLAGS)
10362 AC_SUBST(GTK_LIBS)
10363 AC_SUBST(GTHREAD_CFLAGS)
10364 AC_SUBST(GTHREAD_LIBS)
10365 AC_SUBST([ENABLE_GTK_PRINT])
10366 AC_SUBST([GTK_PRINT_CFLAGS])
10367 AC_SUBST([GTK_PRINT_LIBS])
10370 dnl ===================================================================
10372 SPLIT_APP_MODULES=""
10373 if test "$enable_split_app_modules" = "yes"; then
10374     SPLIT_APP_MODULES="TRUE"
10376 AC_SUBST(SPLIT_APP_MODULES)
10378 SPLIT_OPT_FEATURES=""
10379 if test "$enable_split_opt_features" = "yes"; then
10380     SPLIT_OPT_FEATURES="TRUE"
10382 AC_SUBST(SPLIT_OPT_FEATURES)
10384 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10385     if test "$enable_cairo_canvas" = yes; then
10386         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10387     fi
10388     enable_cairo_canvas=no
10389 elif test -z "$enable_cairo_canvas"; then
10390     enable_cairo_canvas=yes
10393 ENABLE_CAIRO_CANVAS=""
10394 if test "$enable_cairo_canvas" = "yes"; then
10395     test_cairo=yes
10396     ENABLE_CAIRO_CANVAS="TRUE"
10397     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10399 AC_SUBST(ENABLE_CAIRO_CANVAS)
10401 dnl ===================================================================
10402 dnl Check whether the GStreamer libraries are available.
10403 dnl It's possible to build avmedia with both GStreamer backends!
10404 dnl ===================================================================
10406 ENABLE_GSTREAMER_1_0=""
10408 if test "$build_gstreamer_1_0" = "yes"; then
10410     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10411     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10412         ENABLE_GSTREAMER_1_0="TRUE"
10413         AC_MSG_RESULT([yes])
10414         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10415         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10416         FilterLibs "${GSTREAMER_1_0_LIBS}"
10417         GSTREAMER_1_0_LIBS="${filteredlibs}"
10418     else
10419         AC_MSG_RESULT([no])
10420     fi
10422 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10423 AC_SUBST(GSTREAMER_1_0_LIBS)
10424 AC_SUBST(ENABLE_GSTREAMER_1_0)
10427 ENABLE_GSTREAMER_0_10=""
10428 if test "$build_gstreamer_0_10" = "yes"; then
10430     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10431     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10432         ENABLE_GSTREAMER_0_10="TRUE"
10433         AC_MSG_RESULT([yes])
10434         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10435             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10436         ])
10437         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10438         FilterLibs "${GSTREAMER_0_10_LIBS}"
10439         GSTREAMER_0_10_LIBS="${filteredlibs}"
10440     else
10441         AC_MSG_RESULT([no])
10442     fi
10445 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10446 AC_SUBST(GSTREAMER_0_10_LIBS)
10447 AC_SUBST(ENABLE_GSTREAMER_0_10)
10449 dnl ===================================================================
10450 dnl Check whether to build the VLC avmedia backend
10451 dnl ===================================================================
10453 ENABLE_VLC=""
10455 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10456 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10457     ENABLE_VLC="TRUE"
10458     AC_MSG_RESULT([yes])
10459 else
10460     AC_MSG_RESULT([no])
10462 AC_SUBST(ENABLE_VLC)
10464 ENABLE_OPENGL_TRANSITIONS=
10465 ENABLE_OPENGL_CANVAS=
10466 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10467    : # disable
10468 elif test "$_os" = "Darwin"; then
10469     # We use frameworks on Mac OS X, no need for detail checks
10470     ENABLE_OPENGL_TRANSITIONS=TRUE
10471     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10472     ENABLE_OPENGL_CANVAS=TRUE
10473 elif test $_os = WINNT; then
10474     ENABLE_OPENGL_TRANSITIONS=TRUE
10475     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10476     ENABLE_OPENGL_CANVAS=TRUE
10477 else
10478     if test "$USING_X11" = TRUE; then
10479         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10480         ENABLE_OPENGL_TRANSITIONS=TRUE
10481         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10482         ENABLE_OPENGL_CANVAS=TRUE
10483     fi
10486 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10487 AC_SUBST(ENABLE_OPENGL_CANVAS)
10489 dnl =================================================
10490 dnl Check whether to build with OpenCL support.
10491 dnl =================================================
10493 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10494     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10495     # platform (optional at run-time, used through clew).
10496     BUILD_TYPE="$BUILD_TYPE OPENCL"
10497     AC_DEFINE(HAVE_FEATURE_OPENCL)
10500 dnl =================================================
10501 dnl Check whether to build with dconf support.
10502 dnl =================================================
10504 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10505     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10506         if test "$enable_dconf" = yes; then
10507             AC_MSG_ERROR([dconf not found])
10508         else
10509             enable_dconf=no
10510         fi])
10512 AC_MSG_CHECKING([whether to enable dconf])
10513 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10514     DCONF_CFLAGS=
10515     DCONF_LIBS=
10516     ENABLE_DCONF=
10517     AC_MSG_RESULT([no])
10518 else
10519     ENABLE_DCONF=TRUE
10520     AC_DEFINE(ENABLE_DCONF)
10521     AC_MSG_RESULT([yes])
10523 AC_SUBST([DCONF_CFLAGS])
10524 AC_SUBST([DCONF_LIBS])
10525 AC_SUBST([ENABLE_DCONF])
10527 # pdf import?
10528 AC_MSG_CHECKING([whether to build the PDF import feature])
10529 ENABLE_PDFIMPORT=
10530 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10531     AC_MSG_RESULT([yes])
10532     ENABLE_PDFIMPORT=TRUE
10533     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10534 else
10535     AC_MSG_RESULT([no])
10538 # Pdfium?
10539 AC_MSG_CHECKING([whether to build PDFium])
10540 ENABLE_PDFIUM=
10541 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10542     AC_MSG_RESULT([yes])
10543     ENABLE_PDFIUM=TRUE
10544     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10545     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10546 else
10547     AC_MSG_RESULT([no])
10549 AC_SUBST(ENABLE_PDFIUM)
10551 dnl ===================================================================
10552 dnl Check for poppler
10553 dnl ===================================================================
10554 ENABLE_POPPLER=
10555 AC_MSG_CHECKING([whether to build Poppler])
10556 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10557     AC_MSG_RESULT([yes])
10558     ENABLE_POPPLER=TRUE
10559     AC_DEFINE(HAVE_FEATURE_POPPLER)
10560 else
10561     AC_MSG_RESULT([no])
10563 AC_SUBST(ENABLE_POPPLER)
10565 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10566     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10569 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10570     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10573 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10574     dnl ===================================================================
10575     dnl Check for system poppler
10576     dnl ===================================================================
10577     AC_MSG_CHECKING([which PDF import poppler to use])
10578     if test "$with_system_poppler" = "yes"; then
10579         AC_MSG_RESULT([external])
10580         SYSTEM_POPPLER=TRUE
10581         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10582         AC_LANG_PUSH([C++])
10583         save_CXXFLAGS=$CXXFLAGS
10584         save_CPPFLAGS=$CPPFLAGS
10585         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10586         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10587         AC_CHECK_HEADER([cpp/poppler-version.h],
10588             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10589             [])
10590         CXXFLAGS=$save_CXXFLAGS
10591         CPPFLAGS=$save_CPPFLAGS
10592         AC_LANG_POP([C++])
10593         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10595         FilterLibs "${POPPLER_LIBS}"
10596         POPPLER_LIBS="${filteredlibs}"
10597     else
10598         AC_MSG_RESULT([internal])
10599         SYSTEM_POPPLER=
10600         BUILD_TYPE="$BUILD_TYPE POPPLER"
10601         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10602     fi
10603     AC_DEFINE([ENABLE_PDFIMPORT],1)
10605 AC_SUBST(ENABLE_PDFIMPORT)
10606 AC_SUBST(SYSTEM_POPPLER)
10607 AC_SUBST(POPPLER_CFLAGS)
10608 AC_SUBST(POPPLER_LIBS)
10610 SYSTEM_GPGMEPP=
10612 if test "$build_for_ios" = "YES"; then
10613     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10614     AC_MSG_RESULT([yes])
10615 elif test "$enable_mpl_subset" = "yes"; then
10616     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10617     AC_MSG_RESULT([yes])
10618 elif test "$enable_fuzzers" = "yes"; then
10619     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10620     AC_MSG_RESULT([yes])
10621 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10622     dnl ===================================================================
10623     dnl Check for system gpgme
10624     dnl ===================================================================
10625     AC_MSG_CHECKING([which gpgmepp to use])
10626     if test "$with_system_gpgmepp" = "yes"; then
10627         AC_MSG_RESULT([external])
10628         SYSTEM_GPGMEPP=TRUE
10630         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10631         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10632             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10633         # progress_callback is the only func with plain C linkage
10634         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10635         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10636             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10637         AC_CHECK_HEADER(gpgme.h, [],
10638             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10639     else
10640         AC_MSG_RESULT([internal])
10641         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10642         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10644         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10645         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10646         if test "$_os" != "WINNT"; then
10647             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10648             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10649         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10650             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10651         fi
10652     fi
10653     ENABLE_GPGMEPP=TRUE
10654     AC_DEFINE([HAVE_FEATURE_GPGME])
10655     AC_PATH_PROG(GPG, gpg)
10656     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10657     # so let's exclude that manually for the moment
10658     if test -n "$GPG" -a "$_os" != "WINNT"; then
10659         # make sure we not only have a working gpgme, but a full working
10660         # gpg installation to run OpenPGP signature verification
10661         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10662     fi
10663     if test "$_os" = "Linux"; then
10664       uid=`id -u`
10665       AC_MSG_CHECKING([for /run/user/$uid])
10666       if test -d /run/user/$uid; then
10667         AC_MSG_RESULT([yes])
10668         AC_PATH_PROG(GPGCONF, gpgconf)
10670         # Older versions of gpgconf are not working as expected, since
10671         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10672         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10673         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10674         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10675         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10676         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10677         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10678           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10679           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10680           if $GPGCONF --dump-options > /dev/null ; then
10681             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10682               AC_MSG_RESULT([yes])
10683               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10684               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10685             else
10686               AC_MSG_RESULT([no])
10687             fi
10688           else
10689             AC_MSG_RESULT([no. missing or broken gpgconf?])
10690           fi
10691         else
10692           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10693         fi
10694       else
10695         AC_MSG_RESULT([no])
10696      fi
10697    fi
10699 AC_SUBST(ENABLE_GPGMEPP)
10700 AC_SUBST(SYSTEM_GPGMEPP)
10701 AC_SUBST(GPG_ERROR_CFLAGS)
10702 AC_SUBST(GPG_ERROR_LIBS)
10703 AC_SUBST(LIBASSUAN_CFLAGS)
10704 AC_SUBST(LIBASSUAN_LIBS)
10705 AC_SUBST(GPGMEPP_CFLAGS)
10706 AC_SUBST(GPGMEPP_LIBS)
10708 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10709 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10710     AC_MSG_RESULT([yes])
10711     ENABLE_MEDIAWIKI=TRUE
10712     BUILD_TYPE="$BUILD_TYPE XSLTML"
10713     if test  "x$with_java" = "xno"; then
10714         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10715     fi
10716 else
10717     AC_MSG_RESULT([no])
10718     ENABLE_MEDIAWIKI=
10719     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10721 AC_SUBST(ENABLE_MEDIAWIKI)
10723 AC_MSG_CHECKING([whether to build the Report Builder])
10724 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10725     AC_MSG_RESULT([yes])
10726     ENABLE_REPORTBUILDER=TRUE
10727     AC_MSG_CHECKING([which jfreereport libs to use])
10728     if test "$with_system_jfreereport" = "yes"; then
10729         SYSTEM_JFREEREPORT=TRUE
10730         AC_MSG_RESULT([external])
10731         if test -z $SAC_JAR; then
10732             SAC_JAR=/usr/share/java/sac.jar
10733         fi
10734         if ! test -f $SAC_JAR; then
10735              AC_MSG_ERROR(sac.jar not found.)
10736         fi
10738         if test -z $LIBXML_JAR; then
10739             if test -f /usr/share/java/libxml-1.0.0.jar; then
10740                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10741             elif test -f /usr/share/java/libxml.jar; then
10742                 LIBXML_JAR=/usr/share/java/libxml.jar
10743             else
10744                 AC_MSG_ERROR(libxml.jar replacement not found.)
10745             fi
10746         elif ! test -f $LIBXML_JAR; then
10747             AC_MSG_ERROR(libxml.jar not found.)
10748         fi
10750         if test -z $FLUTE_JAR; then
10751             if test -f/usr/share/java/flute-1.3.0.jar; then
10752                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10753             elif test -f /usr/share/java/flute.jar; then
10754                 FLUTE_JAR=/usr/share/java/flute.jar
10755             else
10756                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10757             fi
10758         elif ! test -f $FLUTE_JAR; then
10759             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10760         fi
10762         if test -z $JFREEREPORT_JAR; then
10763             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10764                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10765             elif test -f /usr/share/java/flow-engine.jar; then
10766                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10767             else
10768                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10769             fi
10770         elif ! test -f  $JFREEREPORT_JAR; then
10771                 AC_MSG_ERROR(jfreereport.jar not found.)
10772         fi
10774         if test -z $LIBLAYOUT_JAR; then
10775             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10776                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10777             elif test -f /usr/share/java/liblayout.jar; then
10778                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10779             else
10780                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10781             fi
10782         elif ! test -f $LIBLAYOUT_JAR; then
10783                 AC_MSG_ERROR(liblayout.jar not found.)
10784         fi
10786         if test -z $LIBLOADER_JAR; then
10787             if test -f /usr/share/java/libloader-1.0.0.jar; then
10788                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10789             elif test -f /usr/share/java/libloader.jar; then
10790                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10791             else
10792                 AC_MSG_ERROR(libloader.jar replacement not found.)
10793             fi
10794         elif ! test -f  $LIBLOADER_JAR; then
10795             AC_MSG_ERROR(libloader.jar not found.)
10796         fi
10798         if test -z $LIBFORMULA_JAR; then
10799             if test -f /usr/share/java/libformula-0.2.0.jar; then
10800                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10801             elif test -f /usr/share/java/libformula.jar; then
10802                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10803             else
10804                 AC_MSG_ERROR(libformula.jar replacement not found.)
10805             fi
10806         elif ! test -f $LIBFORMULA_JAR; then
10807                 AC_MSG_ERROR(libformula.jar not found.)
10808         fi
10810         if test -z $LIBREPOSITORY_JAR; then
10811             if test -f /usr/share/java/librepository-1.0.0.jar; then
10812                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10813             elif test -f /usr/share/java/librepository.jar; then
10814                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10815             else
10816                 AC_MSG_ERROR(librepository.jar replacement not found.)
10817             fi
10818         elif ! test -f $LIBREPOSITORY_JAR; then
10819             AC_MSG_ERROR(librepository.jar not found.)
10820         fi
10822         if test -z $LIBFONTS_JAR; then
10823             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10824                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10825             elif test -f /usr/share/java/libfonts.jar; then
10826                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10827             else
10828                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10829             fi
10830         elif ! test -f $LIBFONTS_JAR; then
10831                 AC_MSG_ERROR(libfonts.jar not found.)
10832         fi
10834         if test -z $LIBSERIALIZER_JAR; then
10835             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10836                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10837             elif test -f /usr/share/java/libserializer.jar; then
10838                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10839             else
10840                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10841             fi
10842         elif ! test -f $LIBSERIALIZER_JAR; then
10843                 AC_MSG_ERROR(libserializer.jar not found.)
10844         fi
10846         if test -z $LIBBASE_JAR; then
10847             if test -f /usr/share/java/libbase-1.0.0.jar; then
10848                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10849             elif test -f /usr/share/java/libbase.jar; then
10850                 LIBBASE_JAR=/usr/share/java/libbase.jar
10851             else
10852                 AC_MSG_ERROR(libbase.jar replacement not found.)
10853             fi
10854         elif ! test -f $LIBBASE_JAR; then
10855             AC_MSG_ERROR(libbase.jar not found.)
10856         fi
10858     else
10859         AC_MSG_RESULT([internal])
10860         SYSTEM_JFREEREPORT=
10861         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10862         NEED_ANT=TRUE
10863     fi
10864 else
10865     AC_MSG_RESULT([no])
10866     ENABLE_REPORTBUILDER=
10867     SYSTEM_JFREEREPORT=
10869 AC_SUBST(ENABLE_REPORTBUILDER)
10870 AC_SUBST(SYSTEM_JFREEREPORT)
10871 AC_SUBST(SAC_JAR)
10872 AC_SUBST(LIBXML_JAR)
10873 AC_SUBST(FLUTE_JAR)
10874 AC_SUBST(JFREEREPORT_JAR)
10875 AC_SUBST(LIBBASE_JAR)
10876 AC_SUBST(LIBLAYOUT_JAR)
10877 AC_SUBST(LIBLOADER_JAR)
10878 AC_SUBST(LIBFORMULA_JAR)
10879 AC_SUBST(LIBREPOSITORY_JAR)
10880 AC_SUBST(LIBFONTS_JAR)
10881 AC_SUBST(LIBSERIALIZER_JAR)
10883 # this has to be here because both the Wiki Publisher and the SRB use
10884 # commons-logging
10885 COMMONS_LOGGING_VERSION=1.2
10886 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10887     AC_MSG_CHECKING([which Apache commons-* libs to use])
10888     if test "$with_system_apache_commons" = "yes"; then
10889         SYSTEM_APACHE_COMMONS=TRUE
10890         AC_MSG_RESULT([external])
10891         if test -z $COMMONS_LOGGING_JAR; then
10892             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10893                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10894            elif test -f /usr/share/java/commons-logging.jar; then
10895                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10896             else
10897                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10898             fi
10899         elif ! test -f $COMMONS_LOGGING_JAR; then
10900             AC_MSG_ERROR(commons-logging.jar not found.)
10901         fi
10902     else
10903         AC_MSG_RESULT([internal])
10904         SYSTEM_APACHE_COMMONS=
10905         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10906         NEED_ANT=TRUE
10907     fi
10909 AC_SUBST(SYSTEM_APACHE_COMMONS)
10910 AC_SUBST(COMMONS_LOGGING_JAR)
10911 AC_SUBST(COMMONS_LOGGING_VERSION)
10913 # scripting provider for BeanShell?
10914 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10915 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10916     AC_MSG_RESULT([yes])
10917     ENABLE_SCRIPTING_BEANSHELL=TRUE
10919     dnl ===================================================================
10920     dnl Check for system beanshell
10921     dnl ===================================================================
10922     AC_MSG_CHECKING([which beanshell to use])
10923     if test "$with_system_beanshell" = "yes"; then
10924         AC_MSG_RESULT([external])
10925         SYSTEM_BSH=TRUE
10926         if test -z $BSH_JAR; then
10927             BSH_JAR=/usr/share/java/bsh.jar
10928         fi
10929         if ! test -f $BSH_JAR; then
10930             AC_MSG_ERROR(bsh.jar not found.)
10931         fi
10932     else
10933         AC_MSG_RESULT([internal])
10934         SYSTEM_BSH=
10935         BUILD_TYPE="$BUILD_TYPE BSH"
10936     fi
10937 else
10938     AC_MSG_RESULT([no])
10939     ENABLE_SCRIPTING_BEANSHELL=
10940     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10942 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10943 AC_SUBST(SYSTEM_BSH)
10944 AC_SUBST(BSH_JAR)
10946 # scripting provider for JavaScript?
10947 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10948 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10949     AC_MSG_RESULT([yes])
10950     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10952     dnl ===================================================================
10953     dnl Check for system rhino
10954     dnl ===================================================================
10955     AC_MSG_CHECKING([which rhino to use])
10956     if test "$with_system_rhino" = "yes"; then
10957         AC_MSG_RESULT([external])
10958         SYSTEM_RHINO=TRUE
10959         if test -z $RHINO_JAR; then
10960             RHINO_JAR=/usr/share/java/js.jar
10961         fi
10962         if ! test -f $RHINO_JAR; then
10963             AC_MSG_ERROR(js.jar not found.)
10964         fi
10965     else
10966         AC_MSG_RESULT([internal])
10967         SYSTEM_RHINO=
10968         BUILD_TYPE="$BUILD_TYPE RHINO"
10969         NEED_ANT=TRUE
10970     fi
10971 else
10972     AC_MSG_RESULT([no])
10973     ENABLE_SCRIPTING_JAVASCRIPT=
10974     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10976 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10977 AC_SUBST(SYSTEM_RHINO)
10978 AC_SUBST(RHINO_JAR)
10980 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10981 # paths should be added to library search path. So lets put all 64-bit
10982 # platforms there.
10983 supports_multilib=
10984 case "$host_cpu" in
10985 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10986     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10987         supports_multilib="yes"
10988     fi
10989     ;;
10991     ;;
10992 esac
10994 dnl ===================================================================
10995 dnl KDE4 Integration
10996 dnl ===================================================================
10998 KDE4_CFLAGS=""
10999 KDE4_LIBS=""
11000 QMAKE4="qmake"
11001 MOC4="moc"
11002 KDE4_GLIB_CFLAGS=""
11003 KDE4_GLIB_LIBS=""
11004 KDE4_HAVE_GLIB=""
11005 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11006     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11007     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11009     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
11010     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11012     if test -n "$supports_multilib"; then
11013         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11014         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11015     fi
11017     if test -n "$QTDIR"; then
11018         qt4_incdirs="$QTDIR/include $qt4_incdirs"
11019         if test -z "$supports_multilib"; then
11020             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
11021         else
11022             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
11023         fi
11024     fi
11025     if test -n "$QT4DIR"; then
11026         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
11027         if test -z "$supports_multilib"; then
11028             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
11029         else
11030             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
11031         fi
11032     fi
11034     if test -n "$KDEDIR"; then
11035         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
11036         if test -z "$supports_multilib"; then
11037             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
11038         else
11039             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
11040         fi
11041     fi
11042     if test -n "$KDE4DIR"; then
11043         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
11044         if test -z "$supports_multilib"; then
11045             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
11046         else
11047             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
11048         fi
11049     fi
11051     qt4_test_include="Qt/qobject.h"
11052     qt4_test_library="libQtNetwork.so"
11053     kde4_test_include="kwindowsystem.h"
11054     kde4_test_library="libsolid.so"
11056     AC_MSG_CHECKING([for Qt4 headers])
11057     qt4_header_dir="no"
11058     for inc_dir in $qt4_incdirs; do
11059         if test -r "$inc_dir/$qt4_test_include"; then
11060             qt4_header_dir="$inc_dir"
11061             break
11062         fi
11063     done
11065     AC_MSG_RESULT([$qt4_header_dir])
11066     if test "x$qt4_header_dir" = "xno"; then
11067         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11068     fi
11070     dnl Check for qmake
11071     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11072     if test "$QMAKE4" = "no"; then
11073         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11074     else
11075         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
11076         if test -z "$qmake4_test_ver"; then
11077             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
11078         fi
11079     fi
11081     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
11082     AC_MSG_CHECKING([for Qt4 libraries])
11083     qt4_lib_dir="no"
11084     for lib_dir in $qt4_libdirs; do
11085         if test -r "$lib_dir/$qt4_test_library"; then
11086             qt4_lib_dir="$lib_dir"
11087             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11088             break
11089         fi
11090     done
11092     AC_MSG_RESULT([$qt4_lib_dir])
11094     if test "x$qt4_lib_dir" = "xno"; then
11095         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11096     fi
11098     dnl Check for Meta Object Compiler
11100     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11101     MOC4="$MOCQT4"
11102     if test "$MOC4" = "no"; then
11103         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11104         if test "$MOC4" = "no"; then
11105             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11106 the root of your Qt installation by exporting QT4DIR before running "configure".])
11107         fi
11108     fi
11110     dnl Check for KDE4 headers
11111     AC_MSG_CHECKING([for KDE4 headers])
11112     kde4_incdir="no"
11113     for kde4_check in $kde4_incdirs; do
11114         if test -r "$kde4_check/$kde4_test_include"; then
11115             kde4_incdir="$kde4_check"
11116             break
11117         fi
11118     done
11119     AC_MSG_RESULT([$kde4_incdir])
11120     if test "x$kde4_incdir" = "xno"; then
11121         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11122     fi
11123     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11125     dnl Check for KDE4 libraries
11126     AC_MSG_CHECKING([for KDE4 libraries])
11127     kde4_libdir="no"
11128     for kde4_check in $kde4_libdirs; do
11129         if test -r "$kde4_check/$kde4_test_library"; then
11130             kde4_libdir="$kde4_check"
11131             break
11132         fi
11133     done
11135     AC_MSG_RESULT([$kde4_libdir])
11136     if test "x$kde4_libdir" = "xno"; then
11137         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11138     fi
11140     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11141     if ! test -z "$kde4_incdir"; then
11142         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11143     else
11144         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11145     fi
11147     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11148     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11149     FilterLibs "$KDE4_LIBS"
11150     KDE4_LIBS="$filteredlibs"
11152     AC_LANG_PUSH([C++])
11153     save_CXXFLAGS=$CXXFLAGS
11154     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11155     AC_MSG_CHECKING([whether KDE is >= 4.2])
11156        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11157 #include <kdeversion.h>
11159 int main(int argc, char **argv) {
11160        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11161        else return 1;
11163 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11164     CXXFLAGS=$save_CXXFLAGS
11165     AC_LANG_POP([C++])
11167     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11168     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11169     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11170         [
11171             KDE4_HAVE_GLIB=TRUE
11172             AC_DEFINE(KDE4_HAVE_GLIB,1)
11173             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11174             FilterLibs "${KDE4_GLIB_LIBS}"
11175             KDE4_GLIB_LIBS="${filteredlibs}"
11177             qt4_fix_warning=
11179             AC_LANG_PUSH([C++])
11180             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11181             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11182             #  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
11183             #               ^~~~~~~~~~~~~~~~~~~~~~~
11184             #               vptr for 'QObjectPrivate'
11185             # so temporarily ignore here whichever way would be used to make such errors fatal
11186             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11187             save_CXX=$CXX
11188             CXX=$(printf %s "$CXX" \
11189                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11190             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11191             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11192             save_CXXFLAGS=$CXXFLAGS
11193             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11194             save_LIBS=$LIBS
11195             LIBS="$LIBS $KDE4_LIBS"
11196             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11198             # Prepare meta object data
11199             TSTBASE="tst_exclude_socket_notifiers"
11200             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11201             ln -fs "${TSTMOC}.hxx"
11202             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11204             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11205 #include <cstdlib>
11206 #include "tst_exclude_socket_notifiers.moc"
11208 int main(int argc, char *argv[])
11210     QCoreApplication app(argc, argv);
11211     exit(tst_processEventsExcludeSocket());
11212     return 0;
11214             ]])],[
11215                 AC_MSG_RESULT([yes])
11216             ],[
11217                 AC_MSG_RESULT([no])
11218                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11219                 if test -z "$qt4_fix_warning"; then
11220                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11221                 fi
11222                 qt4_fix_warning=1
11223                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11224                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11226             # Remove meta object data
11227             rm -f "${TSTBASE}."*
11229             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11231             # Prepare meta object data
11232             TSTBASE="tst_exclude_posted_events"
11233             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11234             ln -fs "${TSTMOC}.hxx"
11235             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11237             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11238 #include <cstdlib>
11239 #include "tst_exclude_posted_events.moc"
11241 int main(int argc, char *argv[])
11243     QCoreApplication app(argc, argv);
11244     exit(tst_excludePostedEvents());
11245     return 0;
11247             ]])],[
11248                 AC_MSG_RESULT([yes])
11249             ],[
11250                 AC_MSG_RESULT([no])
11251                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11252                 if test -z "$qt4_fix_warning"; then
11253                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11254                 fi
11255                 qt4_fix_warning=1
11256                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11257             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11259             # Remove meta object data
11260             rm -f "${TSTBASE}."*
11262             if test -n "$qt4_fix_warning"; then
11263                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11264             fi
11266             LIBS=$save_LIBS
11267             CXXFLAGS=$save_CXXFLAGS
11268             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11269             CXX=$save_CXX
11270             AC_LANG_POP([C++])
11271         ],
11272         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11274 AC_SUBST(KDE4_CFLAGS)
11275 AC_SUBST(KDE4_LIBS)
11276 AC_SUBST(MOC4)
11277 AC_SUBST(KDE4_GLIB_CFLAGS)
11278 AC_SUBST(KDE4_GLIB_LIBS)
11279 AC_SUBST(KDE4_HAVE_GLIB)
11281 dnl ===================================================================
11282 dnl QT5 Integration
11283 dnl ===================================================================
11285 QT5_CFLAGS=""
11286 QT5_LIBS=""
11287 QMAKE5="qmake"
11288 MOC5="moc"
11289 QT5_GLIB_CFLAGS=""
11290 QT5_GLIB_LIBS=""
11291 QT5_HAVE_GLIB=""
11292 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11293         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11294         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11295 then
11296     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11297     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11299     if test -n "$supports_multilib"; then
11300         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11301     fi
11303     qt5_test_include="QtWidgets/qapplication.h"
11304     qt5_test_library="libQt5Widgets.so"
11306     dnl Check for qmake5
11307     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11308     if test "$QMAKE5" = "no"; then
11309         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11310     else
11311         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11312         if test -z "$qmake5_test_ver"; then
11313             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11314         fi
11315         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11316         qt5_minimal_minor="6"
11317         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11318             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11319         else
11320             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11321         fi
11322     fi
11324     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11325     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11327     AC_MSG_CHECKING([for Qt5 headers])
11328     qt5_incdir="no"
11329     for inc_dir in $qt5_incdirs; do
11330         if test -r "$inc_dir/$qt5_test_include"; then
11331             qt5_incdir="$inc_dir"
11332             break
11333         fi
11334     done
11335     AC_MSG_RESULT([$qt5_incdir])
11336     if test "x$qt5_incdir" = "xno"; then
11337         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11338     fi
11340     AC_MSG_CHECKING([for Qt5 libraries])
11341     qt5_libdir="no"
11342     for lib_dir in $qt5_libdirs; do
11343         if test -r "$lib_dir/$qt5_test_library"; then
11344             qt5_libdir="$lib_dir"
11345             break
11346         fi
11347     done
11348     AC_MSG_RESULT([$qt5_libdir])
11349     if test "x$qt5_libdir" = "xno"; then
11350         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11351     fi
11353     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11354     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11355     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11357     if test "$USING_X11" = TRUE; then
11358         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11359         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11360         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11361         QT5_USING_X11=1
11362         AC_DEFINE(QT5_USING_X11)
11363     fi
11365     dnl Check for Meta Object Compiler
11367     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11368     if test "$MOC5" = "no"; then
11369         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11370 the root of your Qt installation by exporting QT5DIR before running "configure".])
11371     fi
11373     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11374     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11375     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11376         [
11377             QT5_HAVE_GLIB=1
11378             AC_DEFINE(QT5_HAVE_GLIB,1)
11379         ],
11380         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11381     )
11383 AC_SUBST(QT5_CFLAGS)
11384 AC_SUBST(QT5_LIBS)
11385 AC_SUBST(MOC5)
11386 AC_SUBST(QT5_GLIB_CFLAGS)
11387 AC_SUBST(QT5_GLIB_LIBS)
11388 AC_SUBST(QT5_HAVE_GLIB)
11390 dnl ===================================================================
11391 dnl KDE5 Integration
11392 dnl ===================================================================
11394 KF5_CFLAGS=""
11395 KF5_LIBS=""
11396 KF5_CONFIG="kf5-config"
11397 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11398         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11399         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11400 then
11401     if test "$OS" = "HAIKU"; then
11402         haiku_arch="`echo $RTL_ARCH | tr X x`"
11403         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11404         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11405     fi
11407     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11408     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11409     if test -n "$supports_multilib"; then
11410         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11411     fi
11413     kf5_test_include="KF5/kcoreaddons_version.h"
11414     kf5_test_library="libKF5CoreAddons.so"
11415     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11417     dnl kf5 KDE4 support compatibility installed
11418     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11419     if test "$KF5_CONFIG" != "no"; then
11420         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11421         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11422     fi
11424     dnl Check for KF5 headers
11425     AC_MSG_CHECKING([for KF5 headers])
11426     kf5_incdir="no"
11427     for kf5_check in $kf5_incdirs; do
11428         if test -r "$kf5_check/$kf5_test_include"; then
11429             kf5_incdir="$kf5_check/KF5"
11430             break
11431         fi
11432     done
11433     AC_MSG_RESULT([$kf5_incdir])
11434     if test "x$kf5_incdir" = "xno"; then
11435         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11436     fi
11438     dnl Check for KF5 libraries
11439     AC_MSG_CHECKING([for KF5 libraries])
11440     kf5_libdir="no"
11441     for kf5_check in $kf5_libdirs; do
11442         if test -r "$kf5_check/$kf5_test_library"; then
11443             kf5_libdir="$kf5_check"
11444             break
11445         fi
11446     done
11448     AC_MSG_RESULT([$kf5_libdir])
11449     if test "x$kf5_libdir" = "xno"; then
11450         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11451     fi
11453     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 -DQT_NO_VERSION_TAGGING"
11454     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11455     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11457     if test "$USING_X11" = TRUE; then
11458         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11459     fi
11461     AC_LANG_PUSH([C++])
11462     save_CXXFLAGS=$CXXFLAGS
11463     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11464     AC_MSG_CHECKING([whether KDE is >= 5.0])
11465        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11466 #include <kcoreaddons_version.h>
11468 int main(int argc, char **argv) {
11469        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11470        else return 1;
11472        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11473     CXXFLAGS=$save_CXXFLAGS
11474     AC_LANG_POP([C++])
11476 AC_SUBST(KF5_CFLAGS)
11477 AC_SUBST(KF5_LIBS)
11479 dnl ===================================================================
11480 dnl Test whether to include Evolution 2 support
11481 dnl ===================================================================
11482 AC_MSG_CHECKING([whether to enable evolution 2 support])
11483 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11484     AC_MSG_RESULT([yes])
11485     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11486     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11487     FilterLibs "${GOBJECT_LIBS}"
11488     GOBJECT_LIBS="${filteredlibs}"
11489     ENABLE_EVOAB2="TRUE"
11490 else
11491     ENABLE_EVOAB2=""
11492     AC_MSG_RESULT([no])
11494 AC_SUBST(ENABLE_EVOAB2)
11495 AC_SUBST(GOBJECT_CFLAGS)
11496 AC_SUBST(GOBJECT_LIBS)
11498 dnl ===================================================================
11499 dnl Test which themes to include
11500 dnl ===================================================================
11501 AC_MSG_CHECKING([which themes to include])
11502 # if none given use default subset of available themes
11503 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11504     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_dark tango"
11507 WITH_THEMES=""
11508 if test "x$with_theme" != "xno"; then
11509     for theme in $with_theme; do
11510         case $theme in
11511         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11512         default) real_theme=colibre ;;
11513         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11514         esac
11515         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11516     done
11518 AC_MSG_RESULT([$WITH_THEMES])
11519 AC_SUBST([WITH_THEMES])
11520 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11521 for theme in $with_theme; do
11522     case $theme in
11523     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11524     *) ;;
11525     esac
11526 done
11528 dnl ===================================================================
11529 dnl Test whether to integrate helppacks into the product's installer
11530 dnl ===================================================================
11531 AC_MSG_CHECKING([for helppack integration])
11532 if test "$with_helppack_integration" = "no"; then
11533     AC_MSG_RESULT([no integration])
11534 else
11535     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11536     AC_MSG_RESULT([integration])
11539 ###############################################################################
11540 # Extensions checking
11541 ###############################################################################
11542 AC_MSG_CHECKING([for extensions integration])
11543 if test "x$enable_extension_integration" != "xno"; then
11544     WITH_EXTENSION_INTEGRATION=TRUE
11545     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11546     AC_MSG_RESULT([yes, use integration])
11547 else
11548     WITH_EXTENSION_INTEGRATION=
11549     AC_MSG_RESULT([no, do not integrate])
11551 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11553 dnl Should any extra extensions be included?
11554 dnl There are standalone tests for each of these below.
11555 WITH_EXTRA_EXTENSIONS=
11556 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11558 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11559 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11560 if test "x$with_java" != "xno"; then
11561     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11562     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11565 AC_MSG_CHECKING([whether to build opens___.ttf])
11566 if test "$enable_build_opensymbol" = "yes"; then
11567     AC_MSG_RESULT([yes])
11568     AC_PATH_PROG(FONTFORGE, fontforge)
11569     if test -z "$FONTFORGE"; then
11570         AC_MSG_ERROR([fontforge not installed])
11571     fi
11572 else
11573     AC_MSG_RESULT([no])
11574     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11575     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11577 AC_SUBST(OPENSYMBOL_TTF)
11578 AC_SUBST(FONTFORGE)
11580 dnl ===================================================================
11581 dnl Test whether to include fonts
11582 dnl ===================================================================
11583 AC_MSG_CHECKING([whether to include third-party fonts])
11584 if test "$with_fonts" != "no"; then
11585     AC_MSG_RESULT([yes])
11586     WITH_FONTS=TRUE
11587     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11588     AC_DEFINE(HAVE_MORE_FONTS)
11589 else
11590     AC_MSG_RESULT([no])
11591     WITH_FONTS=
11592     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11594 AC_SUBST(WITH_FONTS)
11596 dnl Test whether to include more Google Noto fonts
11597 dnl ===================================================================
11598 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11599 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11600     AC_MSG_RESULT([no])
11601     WITH_NOTO_FONT=
11602 else
11603     AC_MSG_RESULT([yes])
11604     WITH_NOTO_FONT=TRUE
11605     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11606     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11608 AC_SUBST(WITH_NOTO_FONT)
11610 dnl ===================================================================
11611 dnl Test whether to enable online update service
11612 dnl ===================================================================
11613 AC_MSG_CHECKING([whether to enable online update])
11614 ENABLE_ONLINE_UPDATE=
11615 ENABLE_ONLINE_UPDATE_MAR=
11616 UPDATE_CONFIG=
11617 if test "$enable_online_update" = ""; then
11618     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11619         AC_MSG_RESULT([yes])
11620         ENABLE_ONLINE_UPDATE="TRUE"
11621     else
11622         AC_MSG_RESULT([no])
11623     fi
11624 else
11625     if test "$enable_online_update" = "mar"; then
11626         AC_MSG_RESULT([yes - MAR-based online update])
11627         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11628         if test "$with_update_config" = ""; then
11629             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11630         fi
11631         UPDATE_CONFIG="$with_update_config"
11632         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11633     elif test "$enable_online_update" = "yes"; then
11634         AC_MSG_RESULT([yes])
11635         ENABLE_ONLINE_UPDATE="TRUE"
11636     else
11637         AC_MSG_RESULT([no])
11638     fi
11640 AC_SUBST(ENABLE_ONLINE_UPDATE)
11641 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11642 AC_SUBST(UPDATE_CONFIG)
11644 dnl ===================================================================
11645 dnl Test whether we need bzip2
11646 dnl ===================================================================
11647 SYSTEM_BZIP2=
11648 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11649     AC_MSG_CHECKING([whether to use system bzip2])
11650     if test "$with_system_bzip2" = yes; then
11651         SYSTEM_BZIP2=TRUE
11652         AC_MSG_RESULT([yes])
11653         PKG_CHECK_MODULES(BZIP2, bzip2)
11654         FilterLibs "${BZIP2_LIBS}"
11655         BZIP2_LIBS="${filteredlibs}"
11656     else
11657         AC_MSG_RESULT([no])
11658         BUILD_TYPE="$BUILD_TYPE BZIP2"
11659     fi
11661 AC_SUBST(SYSTEM_BZIP2)
11662 AC_SUBST(BZIP2_CFLAGS)
11663 AC_SUBST(BZIP2_LIBS)
11665 dnl ===================================================================
11666 dnl Test whether to enable extension update
11667 dnl ===================================================================
11668 AC_MSG_CHECKING([whether to enable extension update])
11669 ENABLE_EXTENSION_UPDATE=
11670 if test "x$enable_extension_update" = "xno"; then
11671     AC_MSG_RESULT([no])
11672 else
11673     AC_MSG_RESULT([yes])
11674     ENABLE_EXTENSION_UPDATE="TRUE"
11675     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11676     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11678 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11681 dnl ===================================================================
11682 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11683 dnl ===================================================================
11684 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11685 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11686     AC_MSG_RESULT([no])
11687     ENABLE_SILENT_MSI=
11688 else
11689     AC_MSG_RESULT([yes])
11690     ENABLE_SILENT_MSI=TRUE
11691     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11693 AC_SUBST(ENABLE_SILENT_MSI)
11695 AC_MSG_CHECKING([whether and how to use Xinerama])
11696 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11697     if test "$x_libraries" = "default_x_libraries"; then
11698         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11699         if test "x$XINERAMALIB" = x; then
11700            XINERAMALIB="/usr/lib"
11701         fi
11702     else
11703         XINERAMALIB="$x_libraries"
11704     fi
11705     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11706         # we have both versions, let the user decide but use the dynamic one
11707         # per default
11708         USE_XINERAMA=TRUE
11709         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11710             XINERAMA_LINK=dynamic
11711         else
11712             XINERAMA_LINK=static
11713         fi
11714     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11715         # we have only the dynamic version
11716         USE_XINERAMA=TRUE
11717         XINERAMA_LINK=dynamic
11718     elif test -e "$XINERAMALIB/libXinerama.a"; then
11719         # static version
11720         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11721             USE_XINERAMA=TRUE
11722             XINERAMA_LINK=static
11723         else
11724             USE_XINERAMA=
11725             XINERAMA_LINK=none
11726         fi
11727     else
11728         # no Xinerama
11729         USE_XINERAMA=
11730         XINERAMA_LINK=none
11731     fi
11732     if test "$USE_XINERAMA" = "TRUE"; then
11733         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11734         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11735             [AC_MSG_ERROR(Xinerama header not found.)], [])
11736         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11737         if test "x$XEXTLIB" = x; then
11738            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11739         fi
11740         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11741         if test "$_os" = "FreeBSD"; then
11742             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11743         fi
11744         if test "$_os" = "Linux"; then
11745             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11746         fi
11747         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11748             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11749     else
11750         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11751     fi
11752 else
11753     USE_XINERAMA=
11754     XINERAMA_LINK=none
11755     AC_MSG_RESULT([no])
11757 AC_SUBST(USE_XINERAMA)
11758 AC_SUBST(XINERAMA_LINK)
11760 dnl ===================================================================
11761 dnl Test whether to build cairo or rely on the system version
11762 dnl ===================================================================
11764 if test "$USING_X11" = TRUE; then
11765     # Used in vcl/Library_vclplug_gen.mk
11766     test_cairo=yes
11769 if test "$test_cairo" = "yes"; then
11770     AC_MSG_CHECKING([whether to use the system cairo])
11772     : ${with_system_cairo:=$with_system_libs}
11773     if test "$with_system_cairo" = "yes"; then
11774         SYSTEM_CAIRO=TRUE
11775         AC_MSG_RESULT([yes])
11777         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11778         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11779         FilterLibs "${CAIRO_LIBS}"
11780         CAIRO_LIBS="${filteredlibs}"
11782         if test "$test_xrender" = "yes"; then
11783             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11784             AC_LANG_PUSH([C])
11785             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11786 #ifdef PictStandardA8
11787 #else
11788       return fail;
11789 #endif
11790 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11792             AC_LANG_POP([C])
11793         fi
11794     else
11795         SYSTEM_CAIRO=
11796         AC_MSG_RESULT([no])
11798         BUILD_TYPE="$BUILD_TYPE CAIRO"
11799     fi
11802 AC_SUBST(SYSTEM_CAIRO)
11803 AC_SUBST(CAIRO_CFLAGS)
11804 AC_SUBST(CAIRO_LIBS)
11806 dnl ===================================================================
11807 dnl Test whether to use avahi
11808 dnl ===================================================================
11809 if test "$_os" = "WINNT"; then
11810     # Windows uses bundled mDNSResponder
11811     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11812 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11813     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11814                       [ENABLE_AVAHI="TRUE"])
11815     AC_DEFINE(HAVE_FEATURE_AVAHI)
11816     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11817     FilterLibs "${AVAHI_LIBS}"
11818     AVAHI_LIBS="${filteredlibs}"
11821 AC_SUBST(ENABLE_AVAHI)
11822 AC_SUBST(AVAHI_CFLAGS)
11823 AC_SUBST(AVAHI_LIBS)
11825 dnl ===================================================================
11826 dnl Test whether to use liblangtag
11827 dnl ===================================================================
11828 SYSTEM_LIBLANGTAG=
11829 AC_MSG_CHECKING([whether to use system liblangtag])
11830 if test "$with_system_liblangtag" = yes; then
11831     SYSTEM_LIBLANGTAG=TRUE
11832     AC_MSG_RESULT([yes])
11833     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11834     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11835     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11836     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11837     FilterLibs "${LIBLANGTAG_LIBS}"
11838     LIBLANGTAG_LIBS="${filteredlibs}"
11839 else
11840     SYSTEM_LIBLANGTAG=
11841     AC_MSG_RESULT([no])
11842     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11843     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11844     if test "$COM" = "MSC"; then
11845         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11846     else
11847         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11848     fi
11850 AC_SUBST(SYSTEM_LIBLANGTAG)
11851 AC_SUBST(LIBLANGTAG_CFLAGS)
11852 AC_SUBST(LIBLANGTAG_LIBS)
11854 dnl ===================================================================
11855 dnl Test whether to build libpng or rely on the system version
11856 dnl ===================================================================
11858 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11860 dnl ===================================================================
11861 dnl Check for runtime JVM search path
11862 dnl ===================================================================
11863 if test "$ENABLE_JAVA" != ""; then
11864     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11865     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11866         AC_MSG_RESULT([yes])
11867         if ! test -d "$with_jvm_path"; then
11868             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11869         fi
11870         if ! test -d "$with_jvm_path"jvm; then
11871             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11872         fi
11873         JVM_ONE_PATH_CHECK="$with_jvm_path"
11874         AC_SUBST(JVM_ONE_PATH_CHECK)
11875     else
11876         AC_MSG_RESULT([no])
11877     fi
11880 dnl ===================================================================
11881 dnl Test for the presence of Ant and that it works
11882 dnl ===================================================================
11884 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11885     ANT_HOME=; export ANT_HOME
11886     WITH_ANT_HOME=; export WITH_ANT_HOME
11887     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11888         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11889             if test "$_os" = "WINNT"; then
11890                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11891             else
11892                 with_ant_home="$LODE_HOME/opt/ant"
11893             fi
11894         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11895             with_ant_home="$LODE_HOME/opt/ant"
11896         fi
11897     fi
11898     if test -z "$with_ant_home"; then
11899         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11900     else
11901         if test "$_os" = "WINNT"; then
11902             # AC_PATH_PROGS needs unix path
11903             with_ant_home=`cygpath -u "$with_ant_home"`
11904         fi
11905         AbsolutePath "$with_ant_home"
11906         with_ant_home=$absolute_path
11907         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11908         WITH_ANT_HOME=$with_ant_home
11909         ANT_HOME=$with_ant_home
11910     fi
11912     if test -z "$ANT"; then
11913         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11914     else
11915         # resolve relative or absolute symlink
11916         while test -h "$ANT"; do
11917             a_cwd=`pwd`
11918             a_basename=`basename "$ANT"`
11919             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11920             cd "`dirname "$ANT"`"
11921             cd "`dirname "$a_script"`"
11922             ANT="`pwd`"/"`basename "$a_script"`"
11923             cd "$a_cwd"
11924         done
11926         AC_MSG_CHECKING([if $ANT works])
11927         mkdir -p conftest.dir
11928         a_cwd=$(pwd)
11929         cd conftest.dir
11930         cat > conftest.java << EOF
11931         public class conftest {
11932             int testmethod(int a, int b) {
11933                     return a + b;
11934             }
11935         }
11938         cat > conftest.xml << EOF
11939         <project name="conftest" default="conftest">
11940         <target name="conftest">
11941             <javac srcdir="." includes="conftest.java">
11942             </javac>
11943         </target>
11944         </project>
11947         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11948         if test $? = 0 -a -f ./conftest.class; then
11949             AC_MSG_RESULT([Ant works])
11950             if test -z "$WITH_ANT_HOME"; then
11951                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11952                 if test -z "$ANT_HOME"; then
11953                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11954                 fi
11955             else
11956                 ANT_HOME="$WITH_ANT_HOME"
11957             fi
11958         else
11959             echo "configure: Ant test failed" >&5
11960             cat conftest.java >&5
11961             cat conftest.xml >&5
11962             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11963         fi
11964         cd "$a_cwd"
11965         rm -fr conftest.dir
11966     fi
11967     if test -z "$ANT_HOME"; then
11968         ANT_HOME="NO_ANT_HOME"
11969     else
11970         PathFormat "$ANT_HOME"
11971         ANT_HOME="$formatted_path"
11972         PathFormat "$ANT"
11973         ANT="$formatted_path"
11974     fi
11975     AC_SUBST(ANT_HOME)
11976     AC_SUBST(ANT)
11978     dnl Checking for ant.jar
11979     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11980         AC_MSG_CHECKING([Ant lib directory])
11981         if test -f $ANT_HOME/lib/ant.jar; then
11982             ANT_LIB="$ANT_HOME/lib"
11983         else
11984             if test -f $ANT_HOME/ant.jar; then
11985                 ANT_LIB="$ANT_HOME"
11986             else
11987                 if test -f /usr/share/java/ant.jar; then
11988                     ANT_LIB=/usr/share/java
11989                 else
11990                     if test -f /usr/share/ant-core/lib/ant.jar; then
11991                         ANT_LIB=/usr/share/ant-core/lib
11992                     else
11993                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11994                             ANT_LIB="$ANT_HOME/lib/ant"
11995                         else
11996                             if test -f /usr/share/lib/ant/ant.jar; then
11997                                 ANT_LIB=/usr/share/lib/ant
11998                             else
11999                                 AC_MSG_ERROR([Ant libraries not found!])
12000                             fi
12001                         fi
12002                     fi
12003                 fi
12004             fi
12005         fi
12006         PathFormat "$ANT_LIB"
12007         ANT_LIB="$formatted_path"
12008         AC_MSG_RESULT([Ant lib directory found.])
12009     fi
12010     AC_SUBST(ANT_LIB)
12012     ant_minver=1.6.0
12013     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12015     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12016     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12017     ant_version_major=`echo $ant_version | cut -d. -f1`
12018     ant_version_minor=`echo $ant_version | cut -d. -f2`
12019     echo "configure: ant_version $ant_version " >&5
12020     echo "configure: ant_version_major $ant_version_major " >&5
12021     echo "configure: ant_version_minor $ant_version_minor " >&5
12022     if test "$ant_version_major" -ge "2"; then
12023         AC_MSG_RESULT([yes, $ant_version])
12024     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12025         AC_MSG_RESULT([yes, $ant_version])
12026     else
12027         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12028     fi
12030     rm -f conftest* core core.* *.core
12033 OOO_JUNIT_JAR=
12034 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12035     AC_MSG_CHECKING([for JUnit 4])
12036     if test "$with_junit" = "yes"; then
12037         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12038             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12039         elif test -e /usr/share/java/junit4.jar; then
12040             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12041         else
12042            if test -e /usr/share/lib/java/junit.jar; then
12043               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12044            else
12045               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12046            fi
12047         fi
12048     else
12049         OOO_JUNIT_JAR=$with_junit
12050     fi
12051     if test "$_os" = "WINNT"; then
12052         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12053     fi
12054     printf 'import org.junit.Before;' > conftest.java
12055     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12056         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12057     else
12058         AC_MSG_ERROR(
12059 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12060  specify its pathname via --with-junit=..., or disable it via --without-junit])
12061     fi
12062     rm -f conftest.class conftest.java
12063     if test $OOO_JUNIT_JAR != ""; then
12064     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12065     fi
12067 AC_SUBST(OOO_JUNIT_JAR)
12069 HAMCREST_JAR=
12070 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12071     AC_MSG_CHECKING([for included Hamcrest])
12072     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12073     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12074         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12075     else
12076         AC_MSG_RESULT([Not included])
12077         AC_MSG_CHECKING([for standalone hamcrest jar.])
12078         if test "$with_hamcrest" = "yes"; then
12079             if test -e /usr/share/lib/java/hamcrest.jar; then
12080                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12081             elif test -e /usr/share/java/hamcrest/core.jar; then
12082                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12083             else
12084                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12085             fi
12086         else
12087             HAMCREST_JAR=$with_hamcrest
12088         fi
12089         if test "$_os" = "WINNT"; then
12090             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12091         fi
12092         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12093             AC_MSG_RESULT([$HAMCREST_JAR])
12094         else
12095             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),
12096                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12097         fi
12098     fi
12099     rm -f conftest.class conftest.java
12101 AC_SUBST(HAMCREST_JAR)
12104 AC_SUBST(SCPDEFS)
12107 # check for wget and curl
12109 WGET=
12110 CURL=
12112 if test "$enable_fetch_external" != "no"; then
12114 CURL=`which curl 2>/dev/null`
12116 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12117     # wget new enough?
12118     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12119     if test $? -eq 0; then
12120         WGET=$i
12121         break
12122     fi
12123 done
12125 if test -z "$WGET" -a -z "$CURL"; then
12126     AC_MSG_ERROR([neither wget nor curl found!])
12131 AC_SUBST(WGET)
12132 AC_SUBST(CURL)
12135 # check for sha256sum
12137 SHA256SUM=
12139 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12140     eval "$i -a 256 --version" > /dev/null 2>&1
12141     ret=$?
12142     if test $ret -eq 0; then
12143         SHA256SUM="$i -a 256"
12144         break
12145     fi
12146 done
12148 if test -z "$SHA256SUM"; then
12149     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12150         eval "$i --version" > /dev/null 2>&1
12151         ret=$?
12152         if test $ret -eq 0; then
12153             SHA256SUM=$i
12154             break
12155         fi
12156     done
12159 if test -z "$SHA256SUM"; then
12160     AC_MSG_ERROR([no sha256sum found!])
12163 AC_SUBST(SHA256SUM)
12165 dnl ===================================================================
12166 dnl Dealing with l10n options
12167 dnl ===================================================================
12168 AC_MSG_CHECKING([which languages to be built])
12169 # get list of all languages
12170 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12171 # the sed command does the following:
12172 #   + if a line ends with a backslash, append the next line to it
12173 #   + adds " on the beginning of the value (after =)
12174 #   + adds " at the end of the value
12175 #   + removes en-US; we want to put it on the beginning
12176 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12177 [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)]
12178 ALL_LANGS="en-US $completelangiso"
12179 # check the configured localizations
12180 WITH_LANG="$with_lang"
12182 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12183 # (Norwegian is "nb" and "nn".)
12184 if test "$WITH_LANG" = "no"; then
12185     WITH_LANG=
12188 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12189     AC_MSG_RESULT([en-US])
12190 else
12191     AC_MSG_RESULT([$WITH_LANG])
12192     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12193     if test -z "$MSGFMT"; then
12194         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12195             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12196         elif test -x "/opt/lo/bin/msgfmt"; then
12197             MSGFMT="/opt/lo/bin/msgfmt"
12198         else
12199             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12200             if test -z "$MSGFMT"; then
12201                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12202             fi
12203         fi
12204     fi
12205     if test -z "$MSGUNIQ"; then
12206         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12207             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12208         elif test -x "/opt/lo/bin/msguniq"; then
12209             MSGUNIQ="/opt/lo/bin/msguniq"
12210         else
12211             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12212             if test -z "$MSGUNIQ"; then
12213                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12214             fi
12215         fi
12216     fi
12218 AC_SUBST(MSGFMT)
12219 AC_SUBST(MSGUNIQ)
12220 # check that the list is valid
12221 for lang in $WITH_LANG; do
12222     test "$lang" = "ALL" && continue
12223     # need to check for the exact string, so add space before and after the list of all languages
12224     for vl in $ALL_LANGS; do
12225         if test "$vl" = "$lang"; then
12226            break
12227         fi
12228     done
12229     if test "$vl" != "$lang"; then
12230         # if you're reading this - you prolly quoted your languages remove the quotes ...
12231         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12232     fi
12233 done
12234 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12235     echo $WITH_LANG | grep -q en-US
12236     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12238 # list with substituted ALL
12239 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12240 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12241 test "$WITH_LANG" = "en-US" && WITH_LANG=
12242 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12243     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12244     ALL_LANGS=`echo $ALL_LANGS qtz`
12246 AC_SUBST(ALL_LANGS)
12247 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12248 AC_SUBST(WITH_LANG)
12249 AC_SUBST(WITH_LANG_LIST)
12250 AC_SUBST(GIT_NEEDED_SUBMODULES)
12252 WITH_POOR_HELP_LOCALIZATIONS=
12253 if test -d "$SRC_ROOT/translations/source"; then
12254     for l in `ls -1 $SRC_ROOT/translations/source`; do
12255         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12256             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12257         fi
12258     done
12260 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12262 if test -n "$with_locales"; then
12263     WITH_LOCALES="$with_locales"
12265     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12266     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12267     # config_host/config_locales.h.in
12268     for locale in $WITH_LOCALES; do
12269         lang=${locale%_*}
12271         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12273         case $lang in
12274         hi|mr*ne)
12275             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12276             ;;
12277         bg|ru)
12278             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12279             ;;
12280         esac
12281     done
12282 else
12283     AC_DEFINE(WITH_LOCALE_ALL)
12285 AC_SUBST(WITH_LOCALES)
12287 dnl git submodule update --reference
12288 dnl ===================================================================
12289 if test -n "${GIT_REFERENCE_SRC}"; then
12290     for repo in ${GIT_NEEDED_SUBMODULES}; do
12291         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12292             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12293         fi
12294     done
12296 AC_SUBST(GIT_REFERENCE_SRC)
12298 dnl git submodules linked dirs
12299 dnl ===================================================================
12300 if test -n "${GIT_LINK_SRC}"; then
12301     for repo in ${GIT_NEEDED_SUBMODULES}; do
12302         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12303             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12304         fi
12305     done
12307 AC_SUBST(GIT_LINK_SRC)
12309 dnl branding
12310 dnl ===================================================================
12311 AC_MSG_CHECKING([for alternative branding images directory])
12312 # initialize mapped arrays
12313 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12314 brand_files="$BRAND_INTRO_IMAGES about.svg"
12316 if test -z "$with_branding" -o "$with_branding" = "no"; then
12317     AC_MSG_RESULT([none])
12318     DEFAULT_BRAND_IMAGES="$brand_files"
12319 else
12320     if ! test -d $with_branding ; then
12321         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12322     else
12323         AC_MSG_RESULT([$with_branding])
12324         CUSTOM_BRAND_DIR="$with_branding"
12325         for lfile in $brand_files
12326         do
12327             if ! test -f $with_branding/$lfile ; then
12328                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12329                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12330             else
12331                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12332             fi
12333         done
12334         check_for_progress="yes"
12335     fi
12337 AC_SUBST([BRAND_INTRO_IMAGES])
12338 AC_SUBST([CUSTOM_BRAND_DIR])
12339 AC_SUBST([CUSTOM_BRAND_IMAGES])
12340 AC_SUBST([DEFAULT_BRAND_IMAGES])
12343 AC_MSG_CHECKING([for 'intro' progress settings])
12344 PROGRESSBARCOLOR=
12345 PROGRESSSIZE=
12346 PROGRESSPOSITION=
12347 PROGRESSFRAMECOLOR=
12348 PROGRESSTEXTCOLOR=
12349 PROGRESSTEXTBASELINE=
12351 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12352     source "$with_branding/progress.conf"
12353     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12354 else
12355     AC_MSG_RESULT([none])
12358 AC_SUBST(PROGRESSBARCOLOR)
12359 AC_SUBST(PROGRESSSIZE)
12360 AC_SUBST(PROGRESSPOSITION)
12361 AC_SUBST(PROGRESSFRAMECOLOR)
12362 AC_SUBST(PROGRESSTEXTCOLOR)
12363 AC_SUBST(PROGRESSTEXTBASELINE)
12366 AC_MSG_CHECKING([for extra build ID])
12367 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12368     EXTRA_BUILDID="$with_extra_buildid"
12370 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12371 if test -n "$EXTRA_BUILDID" ; then
12372     AC_MSG_RESULT([$EXTRA_BUILDID])
12373 else
12374     AC_MSG_RESULT([not set])
12376 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12378 OOO_VENDOR=
12379 AC_MSG_CHECKING([for vendor])
12380 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12381     OOO_VENDOR="$USERNAME"
12383     if test -z "$OOO_VENDOR"; then
12384         OOO_VENDOR="$USER"
12385     fi
12387     if test -z "$OOO_VENDOR"; then
12388         OOO_VENDOR="`id -u -n`"
12389     fi
12391     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12392 else
12393     OOO_VENDOR="$with_vendor"
12394     AC_MSG_RESULT([$OOO_VENDOR])
12396 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12397 AC_SUBST(OOO_VENDOR)
12399 if test "$_os" = "Android" ; then
12400     ANDROID_PACKAGE_NAME=
12401     AC_MSG_CHECKING([for Android package name])
12402     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12403         if test -n "$ENABLE_DEBUG"; then
12404             # Default to the package name that makes ndk-gdb happy.
12405             ANDROID_PACKAGE_NAME="org.libreoffice"
12406         else
12407             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12408         fi
12410         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12411     else
12412         ANDROID_PACKAGE_NAME="$with_android_package_name"
12413         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12414     fi
12415     AC_SUBST(ANDROID_PACKAGE_NAME)
12418 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12419 if test "$with_compat_oowrappers" = "yes"; then
12420     WITH_COMPAT_OOWRAPPERS=TRUE
12421     AC_MSG_RESULT(yes)
12422 else
12423     WITH_COMPAT_OOWRAPPERS=
12424     AC_MSG_RESULT(no)
12426 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12428 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12429 AC_MSG_CHECKING([for install dirname])
12430 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12431     INSTALLDIRNAME="$with_install_dirname"
12433 AC_MSG_RESULT([$INSTALLDIRNAME])
12434 AC_SUBST(INSTALLDIRNAME)
12436 AC_MSG_CHECKING([for prefix])
12437 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12438 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12439 PREFIXDIR="$prefix"
12440 AC_MSG_RESULT([$PREFIXDIR])
12441 AC_SUBST(PREFIXDIR)
12443 LIBDIR=[$(eval echo $(eval echo $libdir))]
12444 AC_SUBST(LIBDIR)
12446 DATADIR=[$(eval echo $(eval echo $datadir))]
12447 AC_SUBST(DATADIR)
12449 MANDIR=[$(eval echo $(eval echo $mandir))]
12450 AC_SUBST(MANDIR)
12452 DOCDIR=[$(eval echo $(eval echo $docdir))]
12453 AC_SUBST(DOCDIR)
12455 BINDIR=[$(eval echo $(eval echo $bindir))]
12456 AC_SUBST(BINDIR)
12458 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12459 AC_SUBST(INSTALLDIR)
12461 TESTINSTALLDIR="${BUILDDIR}/test-install"
12462 AC_SUBST(TESTINSTALLDIR)
12465 # ===================================================================
12466 # OAuth2 id and secrets
12467 # ===================================================================
12469 AC_MSG_CHECKING([for Google Drive client id and secret])
12470 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12471     AC_MSG_RESULT([not set])
12472     GDRIVE_CLIENT_ID="\"\""
12473     GDRIVE_CLIENT_SECRET="\"\""
12474 else
12475     AC_MSG_RESULT([set])
12476     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12477     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12479 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12480 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12482 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12483 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12484     AC_MSG_RESULT([not set])
12485     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12486     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12487 else
12488     AC_MSG_RESULT([set])
12489     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12490     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12492 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12493 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12495 AC_MSG_CHECKING([for OneDrive client id and secret])
12496 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12497     AC_MSG_RESULT([not set])
12498     ONEDRIVE_CLIENT_ID="\"\""
12499     ONEDRIVE_CLIENT_SECRET="\"\""
12500 else
12501     AC_MSG_RESULT([set])
12502     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12503     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12505 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12506 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12509 dnl ===================================================================
12510 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12511 dnl --enable-dependency-tracking configure option
12512 dnl ===================================================================
12513 AC_MSG_CHECKING([whether to enable dependency tracking])
12514 if test "$enable_dependency_tracking" = "no"; then
12515     nodep=TRUE
12516     AC_MSG_RESULT([no])
12517 else
12518     AC_MSG_RESULT([yes])
12520 AC_SUBST(nodep)
12522 dnl ===================================================================
12523 dnl Number of CPUs to use during the build
12524 dnl ===================================================================
12525 AC_MSG_CHECKING([for number of processors to use])
12526 # plain --with-parallelism is just the default
12527 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12528     if test "$with_parallelism" = "no"; then
12529         PARALLELISM=0
12530     else
12531         PARALLELISM=$with_parallelism
12532     fi
12533 else
12534     if test "$enable_icecream" = "yes"; then
12535         PARALLELISM="10"
12536     else
12537         case `uname -s` in
12539         Darwin|FreeBSD|NetBSD|OpenBSD)
12540             PARALLELISM=`sysctl -n hw.ncpu`
12541             ;;
12543         Linux)
12544             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12545         ;;
12546         # what else than above does profit here *and* has /proc?
12547         *)
12548             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12549             ;;
12550         esac
12552         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12553         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12554     fi
12557 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12558     if test -z "$with_parallelism"; then
12559             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12560             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12561             PARALLELISM="1"
12562     else
12563         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."
12564     fi
12567 if test $PARALLELISM -eq 0; then
12568     AC_MSG_RESULT([explicit make -j option needed])
12569 else
12570     AC_MSG_RESULT([$PARALLELISM])
12572 AC_SUBST(PARALLELISM)
12574 IWYU_PATH="$with_iwyu"
12575 AC_SUBST(IWYU_PATH)
12576 if test ! -z "$IWYU_PATH"; then
12577     if test ! -f "$IWYU_PATH"; then
12578         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12579     fi
12583 # Set up ILIB for MSVC build
12585 ILIB1=
12586 if test "$build_os" = "cygwin"; then
12587     ILIB="."
12588     if test -n "$JAVA_HOME"; then
12589         ILIB="$ILIB;$JAVA_HOME/lib"
12590     fi
12591     ILIB1=-link
12592     if test "$BITNESS_OVERRIDE" = 64; then
12593         ILIB="$ILIB;$COMPATH/lib/x64"
12594         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12595         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12596         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12597         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12598             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12599             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12600         fi
12601         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12602         ucrtlibpath_formatted=$formatted_path
12603         ILIB="$ILIB;$ucrtlibpath_formatted"
12604         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12605     else
12606         ILIB="$ILIB;$COMPATH/lib/x86"
12607         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12608         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12609         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12610         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12611             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12612             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12613         fi
12614         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12615         ucrtlibpath_formatted=$formatted_path
12616         ILIB="$ILIB;$ucrtlibpath_formatted"
12617         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12618     fi
12619     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12620         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12621     else
12622         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12623     fi
12625     AC_SUBST(ILIB)
12628 AC_MSG_CHECKING([whether $CXX supports inline variables])
12629 AC_LANG_PUSH([C++])
12630 save_CXXFLAGS=$CXXFLAGS
12631 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12632 if test "$build_os" = cygwin; then
12633     save_LIB=$LIB
12634     export LIB=$ILIB
12636 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12637         #if !defined __cpp_inline_variables
12638         // This tests for one specific aspect of inline variables that is actually used by
12639         // ORegistry::ROOT (registry/source/regimpl.cxx):
12640         struct S { constexpr S() {} };
12641         struct T { static constexpr S s{}; };
12642         S const * f() { return &T::s; }
12643         #endif
12644     ]])], [
12645         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
12646         AC_MSG_RESULT([yes])
12647     ], [AC_MSG_RESULT([no])])
12648 CXXFLAGS=$save_CXXFLAGS
12649 if test "$build_os" = cygwin; then
12650     LIB=$save_LIB
12652 AC_LANG_POP([C++])
12654 dnl We should be able to drop the below check when bumping the GCC baseline to
12655 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12656 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12657 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12658 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12659 AC_MSG_CHECKING(
12660     [whether C++11 use of const_iterator in standard containers is broken])
12661 save_CXXFLAGS=$CXXFLAGS
12662 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12663 AC_LANG_PUSH([C++])
12664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12665     #include <list>
12666     ]],[[
12667         std::list<int> l;
12668         l.erase(l.cbegin());
12669     ]])],
12670     [broken=no], [broken=yes])
12671 AC_LANG_POP([C++])
12672 CXXFLAGS=$save_CXXFLAGS
12673 AC_MSG_RESULT([$broken])
12674 if test "$broken" = yes; then
12675     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12679 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12680 save_CXXFLAGS=$CXXFLAGS
12681 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12682 save_LIBS=$LIBS
12683 if test -n "$ILIB1"; then
12684     LIBS="$LIBS $ILIB1"
12686 AC_LANG_PUSH([C++])
12687 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12688     // Exit with failure if the static initializer_list is stored on the
12689     // stack (as done by Clang < 3.4):
12690     #include <initializer_list>
12691     struct S {};
12692     bool g(void const * p1, void const * p2) {
12693         int n;
12694         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12695     }
12696     bool f(void const * p1) {
12697         static std::initializer_list<S> s { S() };
12698         return g(p1, s.begin());
12699     }
12700     ]],[[
12701         int n;
12702         return f(&n) ? 0 : 1;
12703     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12704 AC_LANG_POP([C++])
12705 LIBS=$save_LIBS
12706 CXXFLAGS=$save_CXXFLAGS
12707 AC_MSG_RESULT([$broken])
12708 if test "$broken" = yes -a "$_os" != "iOS"; then
12709     AC_MSG_ERROR([working support for static initializer_list needed])
12713 # ===================================================================
12714 # Creating bigger shared library to link against
12715 # ===================================================================
12716 AC_MSG_CHECKING([whether to create huge library])
12717 MERGELIBS=
12719 if test $_os = iOS -o $_os = Android; then
12720     # Never any point in mergelibs for these as we build just static
12721     # libraries anyway...
12722     enable_mergelibs=no
12725 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12726     if test $_os != Linux -a $_os != WINNT; then
12727         add_warning "--enable-mergelibs is not tested for this platform"
12728     fi
12729     MERGELIBS="TRUE"
12730     AC_MSG_RESULT([yes])
12731 else
12732     AC_MSG_RESULT([no])
12734 AC_SUBST([MERGELIBS])
12736 dnl ===================================================================
12737 dnl icerun is a wrapper that stops us spawning tens of processes
12738 dnl locally - for tools that can't be executed on the compile cluster
12739 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12740 dnl ===================================================================
12741 AC_MSG_CHECKING([whether to use icerun wrapper])
12742 ICECREAM_RUN=
12743 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12744     ICECREAM_RUN=icerun
12745     AC_MSG_RESULT([yes])
12746 else
12747     AC_MSG_RESULT([no])
12749 AC_SUBST(ICECREAM_RUN)
12751 dnl ===================================================================
12752 dnl Setup the ICECC_VERSION for the build the same way it was set for
12753 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12754 dnl ===================================================================
12755 x_ICECC_VERSION=[\#]
12756 if test -n "$ICECC_VERSION" ; then
12757     x_ICECC_VERSION=
12759 AC_SUBST(x_ICECC_VERSION)
12760 AC_SUBST(ICECC_VERSION)
12762 dnl ===================================================================
12764 AC_MSG_CHECKING([MPL subset])
12765 MPL_SUBSET=
12767 if test "$enable_mpl_subset" = "yes"; then
12768     warn_report=false
12769     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12770         warn_report=true
12771     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12772         warn_report=true
12773     fi
12774     if test "$warn_report" = "true"; then
12775         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12776     fi
12777     if test "x$enable_postgresql_sdbc" != "xno"; then
12778         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12779     fi
12780     if test "$enable_lotuswordpro" = "yes"; then
12781         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12782     fi
12783     if test "$WITH_WEBDAV" = "neon"; then
12784         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12785     fi
12786     if test -n "$ENABLE_POPPLER"; then
12787         if test "x$SYSTEM_POPPLER" = "x"; then
12788             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12789         fi
12790     fi
12791     # cf. m4/libo_check_extension.m4
12792     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12793         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12794     fi
12795     for theme in $WITH_THEMES; do
12796         case $theme in
12797         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12798             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12799         *) : ;;
12800         esac
12801     done
12803     ENABLE_OPENGL_TRANSITIONS=
12805     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12806         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12807     fi
12809     MPL_SUBSET="TRUE"
12810     AC_DEFINE(MPL_HAVE_SUBSET)
12811     AC_MSG_RESULT([only])
12812 else
12813     AC_MSG_RESULT([no restrictions])
12815 AC_SUBST(MPL_SUBSET)
12817 dnl ===================================================================
12819 AC_MSG_CHECKING([formula logger])
12820 ENABLE_FORMULA_LOGGER=
12822 if test "x$enable_formula_logger" = "xyes"; then
12823     AC_MSG_RESULT([yes])
12824     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12825     ENABLE_FORMULA_LOGGER=TRUE
12826 elif test -n "$ENABLE_DBGUTIL" ; then
12827     AC_MSG_RESULT([yes])
12828     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12829     ENABLE_FORMULA_LOGGER=TRUE
12830 else
12831     AC_MSG_RESULT([no])
12834 AC_SUBST(ENABLE_FORMULA_LOGGER)
12836 dnl ===================================================================
12837 dnl Setting up the environment.
12838 dnl ===================================================================
12839 AC_MSG_NOTICE([setting up the build environment variables...])
12841 AC_SUBST(COMPATH)
12843 if test "$build_os" = "cygwin"; then
12844     if test -d "$COMPATH/atlmfc/lib"; then
12845         ATL_LIB="$COMPATH/atlmfc/lib"
12846         ATL_INCLUDE="$COMPATH/atlmfc/include"
12847     else
12848         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12849         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12850     fi
12851     if test "$BITNESS_OVERRIDE" = 64; then
12852         if test $VCVER = "150"; then
12853             ATL_LIB="$ATL_LIB/x64"
12854         else
12855             ATL_LIB="$ATL_LIB/amd64"
12856         fi
12857     else
12858         if test $VCVER = "150"; then
12859             ATL_LIB="$ATL_LIB/x86"
12860         fi
12861     fi
12862     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12863     PathFormat "/usr/bin/find.exe"
12864     FIND="$formatted_path"
12865     PathFormat "/usr/bin/sort.exe"
12866     SORT="$formatted_path"
12867     PathFormat "/usr/bin/grep.exe"
12868     WIN_GREP="$formatted_path"
12869     PathFormat "/usr/bin/ls.exe"
12870     WIN_LS="$formatted_path"
12871     PathFormat "/usr/bin/touch.exe"
12872     WIN_TOUCH="$formatted_path"
12873 else
12874     FIND=find
12875     SORT=sort
12878 AC_SUBST(ATL_INCLUDE)
12879 AC_SUBST(ATL_LIB)
12880 AC_SUBST(FIND)
12881 AC_SUBST(SORT)
12882 AC_SUBST(WIN_GREP)
12883 AC_SUBST(WIN_LS)
12884 AC_SUBST(WIN_TOUCH)
12886 AC_SUBST(BUILD_TYPE)
12888 AC_SUBST(SOLARINC)
12890 PathFormat "$PERL"
12891 PERL="$formatted_path"
12892 AC_SUBST(PERL)
12894 if test -n "$TMPDIR"; then
12895     TEMP_DIRECTORY="$TMPDIR"
12896 else
12897     TEMP_DIRECTORY="/tmp"
12899 if test "$build_os" = "cygwin"; then
12900     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12902 AC_SUBST(TEMP_DIRECTORY)
12904 # setup the PATH for the environment
12905 if test -n "$LO_PATH_FOR_BUILD"; then
12906     LO_PATH="$LO_PATH_FOR_BUILD"
12907 else
12908     LO_PATH="$PATH"
12910     case "$host_os" in
12912     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12913         if test "$ENABLE_JAVA" != ""; then
12914             pathmunge "$JAVA_HOME/bin" "after"
12915         fi
12916         ;;
12918     cygwin*)
12919         # Win32 make needs native paths
12920         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12921             LO_PATH=`cygpath -p -m "$PATH"`
12922         fi
12923         if test "$BITNESS_OVERRIDE" = 64; then
12924             # needed for msi packaging
12925             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12926         fi
12927         # .NET 4.6 and higher don't have bin directory
12928         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12929             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12930         fi
12931         pathmunge "$ASM_HOME" "before"
12932         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12933         pathmunge "$CSC_PATH" "before"
12934         pathmunge "$MIDL_PATH" "before"
12935         pathmunge "$AL_PATH" "before"
12936         pathmunge "$MSPDB_PATH" "before"
12937         if test -n "$MSBUILD_PATH" ; then
12938             pathmunge "$MSBUILD_PATH" "before"
12939         fi
12940         if test "$BITNESS_OVERRIDE" = 64; then
12941             pathmunge "$COMPATH/bin/amd64" "before"
12942             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12943         else
12944             pathmunge "$COMPATH/bin" "before"
12945             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12946         fi
12947         if test "$ENABLE_JAVA" != ""; then
12948             if test -d "$JAVA_HOME/jre/bin/client"; then
12949                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12950             fi
12951             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12952                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12953             fi
12954             pathmunge "$JAVA_HOME/bin" "before"
12955         fi
12956         ;;
12958     solaris*)
12959         pathmunge "/usr/css/bin" "before"
12960         if test "$ENABLE_JAVA" != ""; then
12961             pathmunge "$JAVA_HOME/bin" "after"
12962         fi
12963         ;;
12964     esac
12967 AC_SUBST(LO_PATH)
12969 libo_FUZZ_SUMMARY
12971 # Generate a configuration sha256 we can use for deps
12972 if test -f config_host.mk; then
12973     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12975 if test -f config_host_lang.mk; then
12976     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12979 CFLAGS=$my_original_CFLAGS
12980 CXXFLAGS=$my_original_CXXFLAGS
12981 CPPFLAGS=$my_original_CPPFLAGS
12983 AC_CONFIG_LINKS([include:include])
12984 AC_CONFIG_FILES([config_host.mk
12985                  config_host_lang.mk
12986                  Makefile
12987                  lo.xcent
12988                  bin/bffvalidator.sh
12989                  bin/odfvalidator.sh
12990                  bin/officeotron.sh
12991                  instsetoo_native/util/openoffice.lst
12992                  setup_native/source/packinfo/finals_instsetoo.txt
12993                  sysui/desktop/macosx/Info.plist])
12994 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12995 AC_CONFIG_HEADERS([config_host/config_clang.h])
12996 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12997 AC_CONFIG_HEADERS([config_host/config_eot.h])
12998 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12999 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13000 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13001 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13002 AC_CONFIG_HEADERS([config_host/config_features.h])
13003 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13004 AC_CONFIG_HEADERS([config_host/config_folders.h])
13005 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13006 AC_CONFIG_HEADERS([config_host/config_gio.h])
13007 AC_CONFIG_HEADERS([config_host/config_global.h])
13008 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13009 AC_CONFIG_HEADERS([config_host/config_java.h])
13010 AC_CONFIG_HEADERS([config_host/config_langs.h])
13011 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13012 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13013 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13014 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13015 AC_CONFIG_HEADERS([config_host/config_locales.h])
13016 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13017 AC_CONFIG_HEADERS([config_host/config_kde4.h])
13018 AC_CONFIG_HEADERS([config_host/config_qt5.h])
13019 AC_CONFIG_HEADERS([config_host/config_kde5.h])
13020 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
13021 AC_CONFIG_HEADERS([config_host/config_oox.h])
13022 AC_CONFIG_HEADERS([config_host/config_options.h])
13023 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13024 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13025 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13026 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13027 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13028 AC_CONFIG_HEADERS([config_host/config_version.h])
13029 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13030 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13031 AC_CONFIG_HEADERS([config_host/config_python.h])
13032 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13033 AC_OUTPUT
13035 if test "$CROSS_COMPILING" = TRUE; then
13036     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13039 # touch the config timestamp file
13040 if test ! -f config_host.mk.stamp; then
13041     echo > config_host.mk.stamp
13042 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13043     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13044 else
13045     echo > config_host.mk.stamp
13048 # touch the config lang timestamp file
13049 if test ! -f config_host_lang.mk.stamp; then
13050     echo > config_host_lang.mk.stamp
13051 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13052     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13053 else
13054     echo > config_host_lang.mk.stamp
13058 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13060 cat << _EOS
13061 ****************************************************************************
13062 WARNING:
13063 Your make version is known to be horribly slow, and hard to debug
13064 problems with. To get a reasonably functional make please do:
13066 to install a pre-compiled binary make for Win32
13068  mkdir -p /opt/lo/bin
13069  cd /opt/lo/bin
13070  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
13071  cp make-85047eb-msvc.exe make
13072  chmod +x make
13074 to install from source:
13075 place yourself in a working directory of you choice.
13077  git clone git://git.savannah.gnu.org/make.git
13079  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13080  set PATH=%PATH%;C:\Cygwin\bin
13081  [or Cygwin64, if that is what you have]
13082  cd path-to-make-repo-you-cloned-above
13083  build_w32.bat --without-guile
13085 should result in a WinRel/gnumake.exe.
13086 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13088 Then re-run autogen.sh
13090 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13091 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13093 _EOS
13096 cat << _EOF
13097 ****************************************************************************
13099 To build, run:
13100 $GNUMAKE
13102 To view some help, run:
13103 $GNUMAKE help
13105 _EOF
13107 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13108     cat << _EOF
13109 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13110 _EOF
13112     if test $_os = Darwin; then
13113         echo open instdir/$PRODUCTNAME.app
13114     else
13115         echo instdir/program/soffice
13116     fi
13117     cat << _EOF
13119 If you want to run the smoketest, run:
13120 $GNUMAKE check
13122 _EOF
13125 if test -f warn; then
13126     cat warn
13127     rm warn
13130 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: