loplugin:sequenceloop in sc
[LibreOffice.git] / configure.ac
blobd0e6759b1f5294b99c45c3ed3ac1a3fd4daf9576
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
337 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
338     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
341 # need sed in os checks...
342 AC_PATH_PROGS(SED, sed)
343 if test -z "$SED"; then
344     AC_MSG_ERROR([install sed to run this script])
347 # Set the ENABLE_LTO variable
348 # ===================================================================
349 AC_MSG_CHECKING([whether to use link-time optimization])
350 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
351     ENABLE_LTO="TRUE"
352     AC_MSG_RESULT([yes])
353     AC_DEFINE(STATIC_LINKING)
354 else
355     ENABLE_LTO=""
356     AC_MSG_RESULT([no])
358 AC_SUBST(ENABLE_LTO)
360 AC_ARG_ENABLE(fuzz-options,
361     AS_HELP_STRING([--enable-fuzz-options],
362         [Randomly enable or disable each of those configurable options
363          that are supposed to be freely selectable without interdependencies,
364          or where bad interaction from interdependencies is automatically avoided.])
367 dnl ===================================================================
368 dnl When building for Android, --with-android-ndk,
369 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
370 dnl mandatory
371 dnl ===================================================================
373 AC_ARG_WITH(android-ndk,
374     AS_HELP_STRING([--with-android-ndk],
375         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
378 AC_ARG_WITH(android-ndk-toolchain-version,
379     AS_HELP_STRING([--with-android-ndk-toolchain-version],
380         [Specify which toolchain version to use, of those present in the
381         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
382         with_android_ndk_toolchain_version=clang5.0)
384 AC_ARG_WITH(android-sdk,
385     AS_HELP_STRING([--with-android-sdk],
386         [Specify location of the Android SDK. Mandatory when building for Android.]),
389 ANDROID_NDK_HOME=
390 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
391     with_android_ndk="$SRC_ROOT/external/android-ndk"
393 if test -n "$with_android_ndk"; then
394     ANDROID_NDK_HOME=$with_android_ndk
396     # Set up a lot of pre-canned defaults
398     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
399         if test ! -f $ANDROID_NDK_HOME/source.properties; then
400             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
401         fi
402         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
403     else
404         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
405     fi
406     if test -z "$ANDROID_NDK_VERSION";  then
407         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
408     fi
409     case $ANDROID_NDK_VERSION in
410     r9*|r10*)
411         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
412         ;;
413     11.1.*|12.1.*|13.1.*|14.1.*)
414         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
415         ;;
416     16.*|17.*|18.*|19.*|20.*)
417         ;;
418     *)
419         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
420         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
421         ;;
422     esac
424     ANDROID_API_LEVEL=16
425     android_cpu=$host_cpu
426     if test $host_cpu = arm; then
427         android_platform_prefix=arm-linux-androideabi
428         android_gnu_prefix=$android_platform_prefix
429         LLVM_TRIPLE=armv7a-linux-androideabi
430         ANDROID_APP_ABI=armeabi-v7a
431         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
432     elif test $host_cpu = aarch64; then
433         android_platform_prefix=aarch64-linux-android
434         android_gnu_prefix=$android_platform_prefix
435         LLVM_TRIPLE=$android_platform_prefix
436         # minimum android version that supports aarch64
437         ANDROID_API_LEVEL=21
438         ANDROID_APP_ABI=arm64-v8a
439     else
440         # host_cpu is something like "i386" or "i686" I guess, NDK uses
441         # "x86" in some contexts
442         android_cpu=x86
443         android_platform_prefix=$android_cpu
444         android_gnu_prefix=i686-linux-android
445         LLVM_TRIPLE=$android_gnu_prefix
446         ANDROID_APP_ABI=x86
447     fi
449     case "$with_android_ndk_toolchain_version" in
450     clang5.0)
451         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
452         ;;
453     *)
454         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
455     esac
457     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
458     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
459     # manage to link the (app-specific) single huge .so that is built for the app in
460     # android/source/ if there is debug information in a significant part of the object files.
461     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
462     # all objects have been built with debug information.)
463     case $build_os in
464     linux-gnu*)
465         android_HOST_TAG=linux-x86_64
466         ;;
467     darwin*)
468         android_HOST_TAG=darwin-x86_64
469         ;;
470     *)
471         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
472         # ndk would also support windows and windows-x86_64
473         ;;
474     esac
475     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
476     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
477     dnl TODO: NSS build uses it...
478     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
479     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
481     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
482     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
483     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
484     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
485     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ENABLE_LTO" = TRUE; then
490         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
491         # $CC and $CXX when building external libraries
492         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
493     fi
495     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
497     if test -z "$CC"; then
498         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
499         CC_BASE="clang"
500     fi
501     if test -z "$CXX"; then
502         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
503         CXX_BASE="clang++"
504     fi
506     # remember to download the ownCloud Android library later
507     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
509 AC_SUBST(ANDROID_NDK_HOME)
510 AC_SUBST(ANDROID_APP_ABI)
511 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
513 dnl ===================================================================
514 dnl --with-android-sdk
515 dnl ===================================================================
516 ANDROID_SDK_HOME=
517 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
518     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
520 if test -n "$with_android_sdk"; then
521     ANDROID_SDK_HOME=$with_android_sdk
522     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
524 AC_SUBST(ANDROID_SDK_HOME)
526 libo_FUZZ_ARG_ENABLE([android-editing],
527     AS_HELP_STRING([--enable-android-editing],
528         [Enable the experimental editing feature on Android.])
530 ENABLE_ANDROID_EDITING=
531 if test "$enable_android_editing" = yes; then
532     ENABLE_ANDROID_EDITING=TRUE
534 AC_SUBST([ENABLE_ANDROID_EDITING])
536 dnl ===================================================================
537 dnl The following is a list of supported systems.
538 dnl Sequential to keep the logic very simple
539 dnl These values may be checked and reset later.
540 dnl ===================================================================
541 #defaults unless the os test overrides this:
542 test_randr=yes
543 test_xrender=yes
544 test_cups=yes
545 test_dbus=yes
546 test_fontconfig=yes
547 test_cairo=no
548 test_gdb_index=no
549 test_split_debug=no
551 # Default values, as such probably valid just for Linux, set
552 # differently below just for Mac OSX, but at least better than
553 # hardcoding these as we used to do. Much of this is duplicated also
554 # in solenv for old build system and for gbuild, ideally we should
555 # perhaps define stuff like this only here in configure.ac?
557 LINKFLAGSSHL="-shared"
558 PICSWITCH="-fpic"
559 DLLPOST=".so"
561 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
563 INSTROOTBASESUFFIX=
564 INSTROOTCONTENTSUFFIX=
565 SDKDIRNAME=sdk
567 case "$host_os" in
569 solaris*)
570     test_gtk=yes
571     build_gstreamer_1_0=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     test_kf5=yes
599     test_gtk3_kde5=yes
600     test_gdb_index=yes
601     test_split_debug=yes
602     if test "$enable_fuzzers" != yes; then
603         test_freetype=yes
604         test_fontconfig=yes
605     else
606         test_freetype=no
607         test_fontconfig=no
608         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     fi
610     _os=Linux
611     ;;
613 gnu)
614     test_randr=no
615     test_xrender=no
616     _os=GNU
617      ;;
619 cygwin*|interix*)
621     # When building on Windows normally with MSVC under Cygwin,
622     # configure thinks that the host platform (the platform the
623     # built code will run on) is Cygwin, even if it obviously is
624     # Windows, which in Autoconf terminology is called
625     # "mingw32". (Which is misleading as MinGW is the name of the
626     # tool-chain, not an operating system.)
628     # Somewhat confusing, yes. But this configure script doesn't
629     # look at $host etc that much, it mostly uses its own $_os
630     # variable, set here in this case statement.
632     test_cups=no
633     test_dbus=no
634     test_randr=no
635     test_xrender=no
636     test_freetype=no
637     test_fontconfig=no
638     _os=WINNT
640     DLLPOST=".dll"
641     LINKFLAGSNOUNDEFS=
642     ;;
644 darwin*) # macOS or iOS
645     test_gtk=yes
646     test_randr=no
647     test_xrender=no
648     test_freetype=no
649     test_fontconfig=no
650     test_dbus=no
651     if test -n "$LODE_HOME" ; then
652         mac_sanitize_path
653         AC_MSG_NOTICE([sanitized the PATH to $PATH])
654     fi
655     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
656         build_for_ios=YES
657         _os=iOS
658         test_gtk=no
659         test_cups=no
660         enable_mpl_subset=yes
661         enable_lotuswordpro=no
662         enable_coinmp=no
663         enable_lpsolve=no
664         enable_postgresql_sdbc=no
665         enable_extension_integration=no
666         enable_report_builder=no
667         with_ppds=no
668         if test "$enable_ios_simulator" = "yes"; then
669             host=x86_64-apple-darwin
670         fi
671     else
672         _os=Darwin
673         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
674         INSTROOTCONTENTSUFFIX=/Contents
675         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
676     fi
677     # See comment above the case "$host_os"
678     LINKFLAGSSHL="-dynamiclib -single_module"
680     # -fPIC is default
681     PICSWITCH=""
683     DLLPOST=".dylib"
685     # -undefined error is the default
686     LINKFLAGSNOUNDEFS=""
689 freebsd*)
690     test_gtk=yes
691     build_gstreamer_1_0=yes
692     test_kf5=yes
693     test_gtk3_kde5=yes
694     test_freetype=yes
695     AC_MSG_CHECKING([the FreeBSD operating system release])
696     if test -n "$with_os_version"; then
697         OSVERSION="$with_os_version"
698     else
699         OSVERSION=`/sbin/sysctl -n kern.osreldate`
700     fi
701     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
702     AC_MSG_CHECKING([which thread library to use])
703     if test "$OSVERSION" -lt "500016"; then
704         PTHREAD_CFLAGS="-D_THREAD_SAFE"
705         PTHREAD_LIBS="-pthread"
706     elif test "$OSVERSION" -lt "502102"; then
707         PTHREAD_CFLAGS="-D_THREAD_SAFE"
708         PTHREAD_LIBS="-lc_r"
709     else
710         PTHREAD_CFLAGS=""
711         PTHREAD_LIBS="-pthread"
712     fi
713     AC_MSG_RESULT([$PTHREAD_LIBS])
714     _os=FreeBSD
715     ;;
717 *netbsd*)
718     test_gtk=yes
719     build_gstreamer_1_0=yes
720     test_kf5=yes
721     test_gtk3_kde5=yes
722     test_freetype=yes
723     PTHREAD_LIBS="-pthread -lpthread"
724     _os=NetBSD
725     ;;
727 aix*)
728     test_randr=no
729     test_freetype=yes
730     PTHREAD_LIBS=-pthread
731     _os=AIX
732     ;;
734 openbsd*)
735     test_gtk=yes
736     test_freetype=yes
737     PTHREAD_CFLAGS="-D_THREAD_SAFE"
738     PTHREAD_LIBS="-pthread"
739     _os=OpenBSD
740     ;;
742 dragonfly*)
743     test_gtk=yes
744     build_gstreamer_1_0=yes
745     test_kf5=yes
746     test_gtk3_kde5=yes
747     test_freetype=yes
748     PTHREAD_LIBS="-pthread"
749     _os=DragonFly
750     ;;
752 linux-android*)
753     build_gstreamer_1_0=no
754     enable_lotuswordpro=no
755     enable_mpl_subset=yes
756     enable_coinmp=yes
757     enable_lpsolve=no
758     enable_report_builder=no
759     enable_odk=no
760     enable_postgresql_sdbc=no
761     enable_python=no
762     test_cups=no
763     test_dbus=no
764     test_fontconfig=no
765     test_freetype=no
766     test_gtk=no
767     test_kf5=no
768     test_qt5=no
769     test_gtk3_kde5=no
770     test_randr=no
771     test_xrender=no
772     _os=Android
774     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
775     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
776     ;;
778 haiku*)
779     test_cups=no
780     test_dbus=no
781     test_randr=no
782     test_xrender=no
783     test_freetype=yes
784     enable_odk=no
785     enable_gstreamer_1_0=no
786     enable_vlc=no
787     enable_coinmp=no
788     enable_pdfium=no
789     enable_sdremote=no
790     enable_postgresql_sdbc=no
791     enable_firebird_sdbc=no
792     _os=Haiku
793     ;;
796     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
797     ;;
798 esac
800 if test "$_os" = "Android" ; then
801     # Verify that the NDK and SDK options are proper
802     if test -z "$with_android_ndk"; then
803         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
804     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
805         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
806     fi
808     if test -z "$ANDROID_SDK_HOME"; then
809         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
810     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
811         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
812     fi
814     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
815     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
816         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
817                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
818                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
819         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
820         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
821         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
822     fi
823     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
824         AC_MSG_WARN([android support repository not found - install with
825                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
826                      to allow the build to download the specified version of the android support libraries])
827         add_warning "android support repository not found - install with"
828         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
829         add_warning "to allow the build to download the specified version of the android support libraries"
830     fi
833 if test "$_os" = "AIX"; then
834     AC_PATH_PROG(GAWK, gawk)
835     if test -z "$GAWK"; then
836         AC_MSG_ERROR([gawk not found in \$PATH])
837     fi
840 AC_SUBST(SDKDIRNAME)
842 AC_SUBST(PTHREAD_CFLAGS)
843 AC_SUBST(PTHREAD_LIBS)
845 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
846 # By default use the ones specified by our build system,
847 # but explicit override is possible.
848 AC_MSG_CHECKING(for explicit AFLAGS)
849 if test -n "$AFLAGS"; then
850     AC_MSG_RESULT([$AFLAGS])
851     x_AFLAGS=
852 else
853     AC_MSG_RESULT(no)
854     x_AFLAGS=[\#]
856 AC_MSG_CHECKING(for explicit CFLAGS)
857 if test -n "$CFLAGS"; then
858     AC_MSG_RESULT([$CFLAGS])
859     x_CFLAGS=
860 else
861     AC_MSG_RESULT(no)
862     x_CFLAGS=[\#]
864 AC_MSG_CHECKING(for explicit CXXFLAGS)
865 if test -n "$CXXFLAGS"; then
866     AC_MSG_RESULT([$CXXFLAGS])
867     x_CXXFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_CXXFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit OBJCFLAGS)
873 if test -n "$OBJCFLAGS"; then
874     AC_MSG_RESULT([$OBJCFLAGS])
875     x_OBJCFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_OBJCFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
881 if test -n "$OBJCXXFLAGS"; then
882     AC_MSG_RESULT([$OBJCXXFLAGS])
883     x_OBJCXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_OBJCXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit LDFLAGS)
889 if test -n "$LDFLAGS"; then
890     AC_MSG_RESULT([$LDFLAGS])
891     x_LDFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_LDFLAGS=[\#]
896 AC_SUBST(AFLAGS)
897 AC_SUBST(CFLAGS)
898 AC_SUBST(CXXFLAGS)
899 AC_SUBST(OBJCFLAGS)
900 AC_SUBST(OBJCXXFLAGS)
901 AC_SUBST(LDFLAGS)
902 AC_SUBST(x_AFLAGS)
903 AC_SUBST(x_CFLAGS)
904 AC_SUBST(x_CXXFLAGS)
905 AC_SUBST(x_OBJCFLAGS)
906 AC_SUBST(x_OBJCXXFLAGS)
907 AC_SUBST(x_LDFLAGS)
909 dnl These are potentially set for MSVC, in the code checking for UCRT below:
910 my_original_CFLAGS=$CFLAGS
911 my_original_CXXFLAGS=$CXXFLAGS
912 my_original_CPPFLAGS=$CPPFLAGS
914 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
915 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
916 dnl AC_PROG_CC internally.
917 if test "$_os" != "WINNT"; then
918     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
919     save_CFLAGS=$CFLAGS
920     AC_PROG_CC
921     CFLAGS=$save_CFLAGS
922     if test -z "$CC_BASE"; then
923         CC_BASE=`first_arg_basename "$CC"`
924     fi
927 if test "$_os" != "WINNT"; then
928     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
929 else
930     ENDIANNESS=little
932 AC_SUBST(ENDIANNESS)
934 if test $_os != "WINNT"; then
935     save_LIBS="$LIBS"
936     AC_SEARCH_LIBS([dlsym], [dl],
937         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
938         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
939     LIBS="$save_LIBS"
941 AC_SUBST(DLOPEN_LIBS)
943 AC_ARG_ENABLE(ios-simulator,
944     AS_HELP_STRING([--enable-ios-simulator],
945         [build i386 or x86_64 for ios simulator])
948 AC_ARG_ENABLE(ios-libreofficelight-app,
949     AS_HELP_STRING([--enable-ios-libreofficelight-app],
950         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
951          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
952          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
955 ENABLE_IOS_LIBREOFFICELIGHT_APP=
956 if test "$enable_ios_libreofficelight_app" = yes; then
957     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
959 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
961 ###############################################################################
962 # Extensions switches --enable/--disable
963 ###############################################################################
964 # By default these should be enabled unless having extra dependencies.
965 # If there is extra dependency over configure options then the enable should
966 # be automagic based on whether the requiring feature is enabled or not.
967 # All this options change anything only with --enable-extension-integration.
969 # The name of this option and its help string makes it sound as if
970 # extensions are built anyway, just not integrated in the installer,
971 # if you use --disable-extension-integration. Is that really the
972 # case?
974 libo_FUZZ_ARG_ENABLE(extension-integration,
975     AS_HELP_STRING([--disable-extension-integration],
976         [Disable integration of the built extensions in the installer of the
977          product. Use this switch to disable the integration.])
980 AC_ARG_ENABLE(avmedia,
981     AS_HELP_STRING([--disable-avmedia],
982         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
985 AC_ARG_ENABLE(database-connectivity,
986     AS_HELP_STRING([--disable-database-connectivity],
987         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
990 # This doesn't mean not building (or "integrating") extensions
991 # (although it probably should; i.e. it should imply
992 # --disable-extension-integration I guess), it means not supporting
993 # any extension mechanism at all
994 libo_FUZZ_ARG_ENABLE(extensions,
995     AS_HELP_STRING([--disable-extensions],
996         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
999 AC_ARG_ENABLE(scripting,
1000     AS_HELP_STRING([--disable-scripting],
1001         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1004 # This is mainly for Android and iOS, but could potentially be used in some
1005 # special case otherwise, too, so factored out as a separate setting
1007 AC_ARG_ENABLE(dynamic-loading,
1008     AS_HELP_STRING([--disable-dynamic-loading],
1009         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1012 libo_FUZZ_ARG_ENABLE(report-builder,
1013     AS_HELP_STRING([--disable-report-builder],
1014         [Disable the Report Builder.])
1017 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1018     AS_HELP_STRING([--enable-ext-wiki-publisher],
1019         [Enable the Wiki Publisher extension.])
1022 libo_FUZZ_ARG_ENABLE(lpsolve,
1023     AS_HELP_STRING([--disable-lpsolve],
1024         [Disable compilation of the lp solve solver ])
1026 libo_FUZZ_ARG_ENABLE(coinmp,
1027     AS_HELP_STRING([--disable-coinmp],
1028         [Disable compilation of the CoinMP solver ])
1031 libo_FUZZ_ARG_ENABLE(pdfimport,
1032     AS_HELP_STRING([--disable-pdfimport],
1033         [Disable building the PDF import feature.])
1036 libo_FUZZ_ARG_ENABLE(pdfium,
1037     AS_HELP_STRING([--disable-pdfium],
1038         [Disable building PDFium.])
1041 ###############################################################################
1043 dnl ---------- *** ----------
1045 libo_FUZZ_ARG_ENABLE(mergelibs,
1046     AS_HELP_STRING([--enable-mergelibs],
1047         [Merge several of the smaller libraries into one big, "merged", one.])
1050 libo_FUZZ_ARG_ENABLE(breakpad,
1051     AS_HELP_STRING([--enable-breakpad],
1052         [Enables breakpad for crash reporting.])
1055 AC_ARG_ENABLE(fetch-external,
1056     AS_HELP_STRING([--disable-fetch-external],
1057         [Disables fetching external tarballs from web sources.])
1060 AC_ARG_ENABLE(fuzzers,
1061     AS_HELP_STRING([--enable-fuzzers],
1062         [Enables building libfuzzer targets for fuzz testing.])
1065 libo_FUZZ_ARG_ENABLE(pch,
1066     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1067         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1068          Using 'system' will include only external headers, 'base' will add also headers
1069          from base modules, 'normal' will also add all headers except from the module built,
1070          'full' will use all suitable headers even from a module itself.])
1073 libo_FUZZ_ARG_ENABLE(epm,
1074     AS_HELP_STRING([--enable-epm],
1075         [LibreOffice includes self-packaging code, that requires epm, however epm is
1076          useless for large scale package building.])
1079 libo_FUZZ_ARG_ENABLE(odk,
1080     AS_HELP_STRING([--disable-odk],
1081         [LibreOffice includes an ODK, office development kit which some packagers may
1082          wish to build without.])
1085 AC_ARG_ENABLE(mpl-subset,
1086     AS_HELP_STRING([--enable-mpl-subset],
1087         [Don't compile any pieces which are not MPL or more liberally licensed])
1090 libo_FUZZ_ARG_ENABLE(evolution2,
1091     AS_HELP_STRING([--enable-evolution2],
1092         [Allows the built-in evolution 2 addressbook connectivity build to be
1093          enabled.])
1096 AC_ARG_ENABLE(avahi,
1097     AS_HELP_STRING([--enable-avahi],
1098         [Determines whether to use Avahi to advertise Impress to remote controls.])
1101 libo_FUZZ_ARG_ENABLE(werror,
1102     AS_HELP_STRING([--enable-werror],
1103         [Turn warnings to errors. (Has no effect in modules where the treating
1104          of warnings as errors is disabled explicitly.)]),
1107 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1108     AS_HELP_STRING([--enable-assert-always-abort],
1109         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1112 libo_FUZZ_ARG_ENABLE(dbgutil,
1113     AS_HELP_STRING([--enable-dbgutil],
1114         [Provide debugging support from --enable-debug and include additional debugging
1115          utilities such as object counting or more expensive checks.
1116          This is the recommended option for developers.
1117          Note that this makes the build ABI incompatible, it is not possible to mix object
1118          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1120 libo_FUZZ_ARG_ENABLE(debug,
1121     AS_HELP_STRING([--enable-debug],
1122         [Include debugging information, disable compiler optimization and inlining plus
1123          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1125 libo_FUZZ_ARG_ENABLE(split-debug,
1126     AS_HELP_STRING([--disable-split-debug],
1127         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1128          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1130 libo_FUZZ_ARG_ENABLE(gdb-index,
1131     AS_HELP_STRING([--disable-gdb-index],
1132         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1133          The feature requires the gold or lld linker.]))
1135 libo_FUZZ_ARG_ENABLE(sal-log,
1136     AS_HELP_STRING([--enable-sal-log],
1137         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1139 libo_FUZZ_ARG_ENABLE(symbols,
1140     AS_HELP_STRING([--enable-symbols],
1141         [Generate debug information.
1142          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1143          otherwise. It is possible to explicitly specify gbuild build targets
1144          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1145          everything in the directory; there is no ordering, more specific overrides
1146          more general, and disabling takes precedence).
1147          Example: --enable-symbols="all -sw/ -Library_sc".]))
1149 libo_FUZZ_ARG_ENABLE(optimized,
1150     AS_HELP_STRING([--disable-optimized],
1151         [Whether to compile with optimization flags.
1152          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1153          otherwise.]))
1155 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1156     AS_HELP_STRING([--disable-runtime-optimizations],
1157         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1158          JVM JIT) that are known to interact badly with certain dynamic analysis
1159          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1160          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1161          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1163 AC_ARG_WITH(valgrind,
1164     AS_HELP_STRING([--with-valgrind],
1165         [Make availability of Valgrind headers a hard requirement.]))
1167 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1168     AS_HELP_STRING([--enable-compiler-plugins],
1169         [Enable compiler plugins that will perform additional checks during
1170          building. Enabled automatically by --enable-dbgutil.
1171          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1172 COMPILER_PLUGINS_DEBUG=
1173 if test "$enable_compiler_plugins" = debug; then
1174     enable_compiler_plugins=yes
1175     COMPILER_PLUGINS_DEBUG=TRUE
1178 libo_FUZZ_ARG_ENABLE(ooenv,
1179     AS_HELP_STRING([--disable-ooenv],
1180         [Disable ooenv for the instdir installation.]))
1182 libo_FUZZ_ARG_ENABLE(libnumbertext,
1183     AS_HELP_STRING([--disable-libnumbertext],
1184         [Disable use of numbertext external library.]))
1186 AC_ARG_ENABLE(lto,
1187     AS_HELP_STRING([--enable-lto],
1188         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1189          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1190          linker. For MSVC, this option is broken at the moment. This is experimental work
1191          in progress that shouldn't be used unless you are working on it.)]))
1193 AC_ARG_ENABLE(python,
1194     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1195         [Enables or disables Python support at run-time.
1196          Also specifies what Python to use. 'auto' is the default.
1197          'fully-internal' even forces the internal version for uses of Python
1198          during the build.]))
1200 libo_FUZZ_ARG_ENABLE(gtk,
1201     AS_HELP_STRING([--disable-gtk],
1202         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1203 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1205 libo_FUZZ_ARG_ENABLE(gtk3,
1206     AS_HELP_STRING([--disable-gtk3],
1207         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1208 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1210 AC_ARG_ENABLE(introspection,
1211     AS_HELP_STRING([--enable-introspection],
1212         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1213          Linux distributions.)]))
1215 AC_ARG_ENABLE(split-app-modules,
1216     AS_HELP_STRING([--enable-split-app-modules],
1217         [Split file lists for app modules, e.g. base, calc.
1218          Has effect only with make distro-pack-install]),
1221 AC_ARG_ENABLE(split-opt-features,
1222     AS_HELP_STRING([--enable-split-opt-features],
1223         [Split file lists for some optional features, e.g. pyuno, testtool.
1224          Has effect only with make distro-pack-install]),
1227 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1228     AS_HELP_STRING([--disable-cairo-canvas],
1229         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1232 libo_FUZZ_ARG_ENABLE(dbus,
1233     AS_HELP_STRING([--disable-dbus],
1234         [Determines whether to enable features that depend on dbus.
1235          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1236 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1238 libo_FUZZ_ARG_ENABLE(sdremote,
1239     AS_HELP_STRING([--disable-sdremote],
1240         [Determines whether to enable Impress remote control (i.e. the server component).]),
1241 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1243 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1244     AS_HELP_STRING([--disable-sdremote-bluetooth],
1245         [Determines whether to build sdremote with bluetooth support.
1246          Requires dbus on Linux.]))
1248 libo_FUZZ_ARG_ENABLE(gio,
1249     AS_HELP_STRING([--disable-gio],
1250         [Determines whether to use the GIO support.]),
1251 ,test "${enable_gio+set}" = set || enable_gio=yes)
1253 AC_ARG_ENABLE(qt5,
1254     AS_HELP_STRING([--enable-qt5],
1255         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1256          available.]),
1259 AC_ARG_ENABLE(kf5,
1260     AS_HELP_STRING([--enable-kf5],
1261         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1262          KF5 are available.]),
1265 AC_ARG_ENABLE(kde5,
1266     AS_HELP_STRING([--enable-kde5],
1267         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1270 AC_ARG_ENABLE(gtk3_kde5,
1271     AS_HELP_STRING([--enable-gtk3-kde5],
1272         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1273          platforms where Gtk3, Qt5 and Plasma is available.]),
1276 AC_ARG_ENABLE(gui,
1277     AS_HELP_STRING([--disable-gui],
1278         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1279          command-line option. Not related to LibreOffice Online functionality. Don't use
1280          unless you are certain you need to. Nobody will help you if you insist on trying
1281          this and run into problems.]),
1282 ,enable_gui=yes)
1284 libo_FUZZ_ARG_ENABLE(randr,
1285     AS_HELP_STRING([--disable-randr],
1286         [Disable RandR support in the vcl project.]),
1287 ,test "${enable_randr+set}" = set || enable_randr=yes)
1289 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1290     AS_HELP_STRING([--disable-gstreamer-1-0],
1291         [Disable building with the gstreamer 1.0 avmedia backend.]),
1292 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1294 libo_FUZZ_ARG_ENABLE(vlc,
1295     AS_HELP_STRING([--enable-vlc],
1296         [Enable building with the (experimental) VLC avmedia backend.]),
1297 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1299 libo_FUZZ_ARG_ENABLE(neon,
1300     AS_HELP_STRING([--disable-neon],
1301         [Disable neon and the compilation of webdav binding.]),
1304 libo_FUZZ_ARG_ENABLE([eot],
1305     [AS_HELP_STRING([--enable-eot],
1306         [Enable support for Embedded OpenType fonts.])],
1307 ,test "${enable_eot+set}" = set || enable_eot=no)
1309 libo_FUZZ_ARG_ENABLE(cve-tests,
1310     AS_HELP_STRING([--disable-cve-tests],
1311         [Prevent CVE tests to be executed]),
1314 libo_FUZZ_ARG_ENABLE(chart-tests,
1315     AS_HELP_STRING([--enable-chart-tests],
1316         [Executes chart XShape tests. In a perfect world these tests would be
1317          stable and everyone could run them, in reality it is best to run them
1318          only on a few machines that are known to work and maintained by people
1319          who can judge if a test failure is a regression or not.]),
1322 AC_ARG_ENABLE(build-unowinreg,
1323     AS_HELP_STRING([--enable-build-unowinreg],
1324         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1325          compiler is needed on Linux.]),
1328 AC_ARG_ENABLE(build-opensymbol,
1329     AS_HELP_STRING([--enable-build-opensymbol],
1330         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1331          fontforge installed.]),
1334 AC_ARG_ENABLE(dependency-tracking,
1335     AS_HELP_STRING([--enable-dependency-tracking],
1336         [Do not reject slow dependency extractors.])[
1337   --disable-dependency-tracking
1338                           Disables generation of dependency information.
1339                           Speed up one-time builds.],
1342 AC_ARG_ENABLE(icecream,
1343     AS_HELP_STRING([--enable-icecream],
1344         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1345          It defaults to /opt/icecream for the location of the icecream gcc/g++
1346          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1349 AC_ARG_ENABLE(ld,
1350     AS_HELP_STRING([--enable-ld=<linker>],
1351         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1352          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1355 libo_FUZZ_ARG_ENABLE(cups,
1356     AS_HELP_STRING([--disable-cups],
1357         [Do not build cups support.])
1360 AC_ARG_ENABLE(ccache,
1361     AS_HELP_STRING([--disable-ccache],
1362         [Do not try to use ccache automatically.
1363          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1364          CC/CXX are not yet set, and --enable-icecream is not given, we
1365          attempt to use ccache. --disable-ccache disables ccache completely.
1366          Additionally ccache's depend mode is enabled if possible,
1367          use --enable-ccache=nodepend to enable ccache without depend mode.
1371 AC_ARG_ENABLE(64-bit,
1372     AS_HELP_STRING([--enable-64-bit],
1373         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1374          At the moment meaningful only for Windows.]), ,)
1376 libo_FUZZ_ARG_ENABLE(online-update,
1377     AS_HELP_STRING([--enable-online-update],
1378         [Enable the online update service that will check for new versions of
1379          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1380          If the value is "mar", the experimental Mozilla-like update will be
1381          enabled instead of the traditional update mechanism.]),
1384 AC_ARG_WITH(update-config,
1385     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1386                    [Path to the update config ini file]))
1388 libo_FUZZ_ARG_ENABLE(extension-update,
1389     AS_HELP_STRING([--disable-extension-update],
1390         [Disable possibility to update installed extensions.]),
1393 libo_FUZZ_ARG_ENABLE(release-build,
1394     AS_HELP_STRING([--enable-release-build],
1395         [Enable release build. Note that the "release build" choice is orthogonal to
1396          whether symbols are present, debug info is generated, or optimization
1397          is done.
1398          See http://wiki.documentfoundation.org/Development/DevBuild]),
1401 AC_ARG_ENABLE(windows-build-signing,
1402     AS_HELP_STRING([--enable-windows-build-signing],
1403         [Enable signing of windows binaries (*.exe, *.dll)]),
1406 AC_ARG_ENABLE(silent-msi,
1407     AS_HELP_STRING([--enable-silent-msi],
1408         [Enable MSI with LIMITUI=1 (silent install).]),
1411 AC_ARG_ENABLE(macosx-code-signing,
1412     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1413         [Sign executables, dylibs, frameworks and the app bundle. If you
1414          don't provide an identity the first suitable certificate
1415          in your keychain is used.]),
1418 AC_ARG_ENABLE(macosx-package-signing,
1419     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1420         [Create a .pkg suitable for uploading to the Mac App Store and sign
1421          it. If you don't provide an identity the first suitable certificate
1422          in your keychain is used.]),
1425 AC_ARG_ENABLE(macosx-sandbox,
1426     AS_HELP_STRING([--enable-macosx-sandbox],
1427         [Make the app bundle run in a sandbox. Requires code signing.
1428          Is required by apps distributed in the Mac App Store, and implies
1429          adherence to App Store rules.]),
1432 AC_ARG_WITH(macosx-bundle-identifier,
1433     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1434         [Define the macOS bundle identifier. Default is the somewhat weird
1435          org.libreoffice.script ("script", huh?).]),
1436 ,with_macosx_bundle_identifier=org.libreoffice.script)
1438 AC_ARG_WITH(product-name,
1439     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1440         [Define the product name. Default is AC_PACKAGE_NAME.]),
1441 ,with_product_name=$PRODUCTNAME)
1443 AC_ARG_WITH(package-version,
1444     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1445         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1448 libo_FUZZ_ARG_ENABLE(readonly-installset,
1449     AS_HELP_STRING([--enable-readonly-installset],
1450         [Prevents any attempts by LibreOffice to write into its installation. That means
1451          at least that no "system-wide" extensions can be added. Partly experimental work in
1452          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1455 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1456     AS_HELP_STRING([--disable-postgresql-sdbc],
1457         [Disable the build of the PostgreSQL-SDBC driver.])
1460 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1461     AS_HELP_STRING([--disable-lotuswordpro],
1462         [Disable the build of the Lotus Word Pro filter.]),
1463 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1465 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1466     AS_HELP_STRING([--disable-firebird-sdbc],
1467         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1468 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1470 AC_ARG_ENABLE(bogus-pkg-config,
1471     AS_HELP_STRING([--enable-bogus-pkg-config],
1472         [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.]),
1475 AC_ARG_ENABLE(openssl,
1476     AS_HELP_STRING([--disable-openssl],
1477         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1478          components will either use GNUTLS or NSS. Work in progress,
1479          use only if you are hacking on it.]),
1480 ,enable_openssl=yes)
1482 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1483     AS_HELP_STRING([--enable-cipher-openssl-backend],
1484         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1485          Requires --enable-openssl.]))
1487 AC_ARG_ENABLE(library-bin-tar,
1488     AS_HELP_STRING([--enable-library-bin-tar],
1489         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1490         Some libraries can save their build result in a tarball
1491         stored in TARFILE_LOCATION. That binary tarball is
1492         uniquely identified by the source tarball,
1493         the content of the config_host.mk file and the content
1494         of the top-level directory in core for that library
1495         If this option is enabled, then if such a tarfile exist, it will be untarred
1496         instead of the source tarfile, and the build step will be skipped for that
1497         library.
1498         If a proper tarfile does not exist, then the normal source-based
1499         build is done for that library and a proper binary tarfile is created
1500         for the next time.]),
1503 AC_ARG_ENABLE(dconf,
1504     AS_HELP_STRING([--disable-dconf],
1505         [Disable the dconf configuration backend (enabled by default where
1506          available).]))
1508 libo_FUZZ_ARG_ENABLE(formula-logger,
1509     AS_HELP_STRING(
1510         [--enable-formula-logger],
1511         [Enable formula logger for logging formula calculation flow in Calc.]
1512     )
1515 AC_ARG_ENABLE(ldap,
1516     AS_HELP_STRING([--disable-ldap],
1517         [Disable LDAP support.]),
1518 ,enable_ldap=yes)
1520 dnl ===================================================================
1521 dnl Optional Packages (--with/without-)
1522 dnl ===================================================================
1524 AC_ARG_WITH(gcc-home,
1525     AS_HELP_STRING([--with-gcc-home],
1526         [Specify the location of gcc/g++ manually. This can be used in conjunction
1527          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1528          non-default path.]),
1531 AC_ARG_WITH(gnu-patch,
1532     AS_HELP_STRING([--with-gnu-patch],
1533         [Specify location of GNU patch on Solaris or FreeBSD.]),
1536 AC_ARG_WITH(build-platform-configure-options,
1537     AS_HELP_STRING([--with-build-platform-configure-options],
1538         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1541 AC_ARG_WITH(gnu-cp,
1542     AS_HELP_STRING([--with-gnu-cp],
1543         [Specify location of GNU cp on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(external-tar,
1547     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1548         [Specify an absolute path of where to find (and store) tarfiles.]),
1549     TARFILE_LOCATION=$withval ,
1552 AC_ARG_WITH(referenced-git,
1553     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1554         [Specify another checkout directory to reference. This makes use of
1555                  git submodule update --reference, and saves a lot of diskspace
1556                  when having multiple trees side-by-side.]),
1557     GIT_REFERENCE_SRC=$withval ,
1560 AC_ARG_WITH(linked-git,
1561     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1562         [Specify a directory where the repositories of submodules are located.
1563          This uses a method similar to git-new-workdir to get submodules.]),
1564     GIT_LINK_SRC=$withval ,
1567 AC_ARG_WITH(galleries,
1568     AS_HELP_STRING([--with-galleries],
1569         [Specify how galleries should be built. It is possible either to
1570          build these internally from source ("build"),
1571          or to disable them ("no")]),
1574 AC_ARG_WITH(theme,
1575     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1576         [Choose which themes to include. By default those themes with an '*' are included.
1577          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1578          *elementary_svg, *karasa_jaga, *sifr, *sif_svg, *sifr_dark, *tango.]),
1581 libo_FUZZ_ARG_WITH(helppack-integration,
1582     AS_HELP_STRING([--without-helppack-integration],
1583         [It will not integrate the helppacks to the installer
1584          of the product. Please use this switch to use the online help
1585          or separate help packages.]),
1588 libo_FUZZ_ARG_WITH(fonts,
1589     AS_HELP_STRING([--without-fonts],
1590         [LibreOffice includes some third-party fonts to provide a reliable basis for
1591          help content, templates, samples, etc. When these fonts are already
1592          known to be available on the system then you should use this option.]),
1595 AC_ARG_WITH(epm,
1596     AS_HELP_STRING([--with-epm],
1597         [Decides which epm to use. Default is to use the one from the system if
1598          one is built. When either this is not there or you say =internal epm
1599          will be built.]),
1602 AC_ARG_WITH(package-format,
1603     AS_HELP_STRING([--with-package-format],
1604         [Specify package format(s) for LibreOffice installation sets. The
1605          implicit --without-package-format leads to no installation sets being
1606          generated. Possible values: aix, archive, bsd, deb, dmg,
1607          installed, msi, pkg, and rpm.
1608          Example: --with-package-format='deb rpm']),
1611 AC_ARG_WITH(tls,
1612     AS_HELP_STRING([--with-tls],
1613         [Decides which TLS/SSL and cryptographic implementations to use for
1614          LibreOffice's code. Notice that this doesn't apply for depending
1615          libraries like "neon", for example. Default is to use OpenSSL
1616          although NSS is also possible. Notice that selecting NSS restricts
1617          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1618          restrict by now the usage of NSS in LO's code. Possible values:
1619          openssl, nss. Example: --with-tls="nss"]),
1622 AC_ARG_WITH(system-libs,
1623     AS_HELP_STRING([--with-system-libs],
1624         [Use libraries already on system -- enables all --with-system-* flags.]),
1627 AC_ARG_WITH(system-bzip2,
1628     AS_HELP_STRING([--with-system-bzip2],
1629         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1630     [with_system_bzip2="$with_system_libs"])
1632 AC_ARG_WITH(system-headers,
1633     AS_HELP_STRING([--with-system-headers],
1634         [Use headers already on system -- enables all --with-system-* flags for
1635          external packages whose headers are the only entities used i.e.
1636          boost/odbc/sane-header(s).]),,
1637     [with_system_headers="$with_system_libs"])
1639 AC_ARG_WITH(system-jars,
1640     AS_HELP_STRING([--without-system-jars],
1641         [When building with --with-system-libs, also the needed jars are expected
1642          on the system. Use this to disable that]),,
1643     [with_system_jars="$with_system_libs"])
1645 AC_ARG_WITH(system-cairo,
1646     AS_HELP_STRING([--with-system-cairo],
1647         [Use cairo libraries already on system.  Happens automatically for
1648          (implicit) --enable-gtk and for --enable-gtk3.]))
1650 AC_ARG_WITH(system-epoxy,
1651     AS_HELP_STRING([--with-system-epoxy],
1652         [Use epoxy libraries already on system.  Happens automatically for
1653          --enable-gtk3.]),,
1654        [with_system_epoxy="$with_system_libs"])
1656 AC_ARG_WITH(myspell-dicts,
1657     AS_HELP_STRING([--with-myspell-dicts],
1658         [Adds myspell dictionaries to the LibreOffice installation set]),
1661 AC_ARG_WITH(system-dicts,
1662     AS_HELP_STRING([--without-system-dicts],
1663         [Do not use dictionaries from system paths.]),
1666 AC_ARG_WITH(external-dict-dir,
1667     AS_HELP_STRING([--with-external-dict-dir],
1668         [Specify external dictionary dir.]),
1671 AC_ARG_WITH(external-hyph-dir,
1672     AS_HELP_STRING([--with-external-hyph-dir],
1673         [Specify external hyphenation pattern dir.]),
1676 AC_ARG_WITH(external-thes-dir,
1677     AS_HELP_STRING([--with-external-thes-dir],
1678         [Specify external thesaurus dir.]),
1681 AC_ARG_WITH(system-zlib,
1682     AS_HELP_STRING([--with-system-zlib],
1683         [Use zlib already on system.]),,
1684     [with_system_zlib=auto])
1686 AC_ARG_WITH(system-jpeg,
1687     AS_HELP_STRING([--with-system-jpeg],
1688         [Use jpeg already on system.]),,
1689     [with_system_jpeg="$with_system_libs"])
1691 AC_ARG_WITH(system-clucene,
1692     AS_HELP_STRING([--with-system-clucene],
1693         [Use clucene already on system.]),,
1694     [with_system_clucene="$with_system_libs"])
1696 AC_ARG_WITH(system-expat,
1697     AS_HELP_STRING([--with-system-expat],
1698         [Use expat already on system.]),,
1699     [with_system_expat="$with_system_libs"])
1701 AC_ARG_WITH(system-libxml,
1702     AS_HELP_STRING([--with-system-libxml],
1703         [Use libxml/libxslt already on system.]),,
1704     [with_system_libxml=auto])
1706 AC_ARG_WITH(system-icu,
1707     AS_HELP_STRING([--with-system-icu],
1708         [Use icu already on system.]),,
1709     [with_system_icu="$with_system_libs"])
1711 AC_ARG_WITH(system-ucpp,
1712     AS_HELP_STRING([--with-system-ucpp],
1713         [Use ucpp already on system.]),,
1714     [])
1716 AC_ARG_WITH(system-openldap,
1717     AS_HELP_STRING([--with-system-openldap],
1718         [Use the OpenLDAP LDAP SDK already on system.]),,
1719     [with_system_openldap="$with_system_libs"])
1721 libo_FUZZ_ARG_ENABLE(poppler,
1722     AS_HELP_STRING([--disable-poppler],
1723         [Disable building Poppler.])
1726 AC_ARG_WITH(system-poppler,
1727     AS_HELP_STRING([--with-system-poppler],
1728         [Use system poppler (only needed for PDF import).]),,
1729     [with_system_poppler="$with_system_libs"])
1731 AC_ARG_WITH(system-gpgmepp,
1732     AS_HELP_STRING([--with-system-gpgmepp],
1733         [Use gpgmepp already on system]),,
1734     [with_system_gpgmepp="$with_system_libs"])
1736 AC_ARG_WITH(system-apache-commons,
1737     AS_HELP_STRING([--with-system-apache-commons],
1738         [Use Apache commons libraries already on system.]),,
1739     [with_system_apache_commons="$with_system_jars"])
1741 AC_ARG_WITH(system-mariadb,
1742     AS_HELP_STRING([--with-system-mariadb],
1743         [Use MariaDB/MySQL libraries already on system.]),,
1744     [with_system_mariadb="$with_system_libs"])
1746 AC_ARG_ENABLE(bundle-mariadb,
1747     AS_HELP_STRING([--enable-bundle-mariadb],
1748         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1751 AC_ARG_WITH(system-postgresql,
1752     AS_HELP_STRING([--with-system-postgresql],
1753         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1754          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1755     [with_system_postgresql="$with_system_libs"])
1757 AC_ARG_WITH(libpq-path,
1758     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1759         [Use this PostgreSQL C interface (libpq) installation for building
1760          the PostgreSQL-SDBC extension.]),
1763 AC_ARG_WITH(system-firebird,
1764     AS_HELP_STRING([--with-system-firebird],
1765         [Use Firebird libraries already on system, for building the Firebird-SDBC
1766          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1767     [with_system_firebird="$with_system_libs"])
1769 AC_ARG_WITH(system-libtommath,
1770             AS_HELP_STRING([--with-system-libtommath],
1771                            [Use libtommath already on system]),,
1772             [with_system_libtommath="$with_system_libs"])
1774 AC_ARG_WITH(system-hsqldb,
1775     AS_HELP_STRING([--with-system-hsqldb],
1776         [Use hsqldb already on system.]))
1778 AC_ARG_WITH(hsqldb-jar,
1779     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1780         [Specify path to jarfile manually.]),
1781     HSQLDB_JAR=$withval)
1783 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1784     AS_HELP_STRING([--disable-scripting-beanshell],
1785         [Disable support for scripts in BeanShell.]),
1789 AC_ARG_WITH(system-beanshell,
1790     AS_HELP_STRING([--with-system-beanshell],
1791         [Use beanshell already on system.]),,
1792     [with_system_beanshell="$with_system_jars"])
1794 AC_ARG_WITH(beanshell-jar,
1795     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     BSH_JAR=$withval)
1799 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1800     AS_HELP_STRING([--disable-scripting-javascript],
1801         [Disable support for scripts in JavaScript.]),
1805 AC_ARG_WITH(system-rhino,
1806     AS_HELP_STRING([--with-system-rhino],
1807         [Use rhino already on system.]),,)
1808 #    [with_system_rhino="$with_system_jars"])
1809 # Above is not used as we have different debug interface
1810 # patched into internal rhino. This code needs to be fixed
1811 # before we can enable it by default.
1813 AC_ARG_WITH(rhino-jar,
1814     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1815         [Specify path to jarfile manually.]),
1816     RHINO_JAR=$withval)
1818 AC_ARG_WITH(commons-logging-jar,
1819     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1820         [Specify path to jarfile manually.]),
1821     COMMONS_LOGGING_JAR=$withval)
1823 AC_ARG_WITH(system-jfreereport,
1824     AS_HELP_STRING([--with-system-jfreereport],
1825         [Use JFreeReport already on system.]),,
1826     [with_system_jfreereport="$with_system_jars"])
1828 AC_ARG_WITH(sac-jar,
1829     AS_HELP_STRING([--with-sac-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     SAC_JAR=$withval)
1833 AC_ARG_WITH(libxml-jar,
1834     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     LIBXML_JAR=$withval)
1838 AC_ARG_WITH(flute-jar,
1839     AS_HELP_STRING([--with-flute-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     FLUTE_JAR=$withval)
1843 AC_ARG_WITH(jfreereport-jar,
1844     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1845         [Specify path to jarfile manually.]),
1846     JFREEREPORT_JAR=$withval)
1848 AC_ARG_WITH(liblayout-jar,
1849     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1850         [Specify path to jarfile manually.]),
1851     LIBLAYOUT_JAR=$withval)
1853 AC_ARG_WITH(libloader-jar,
1854     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     LIBLOADER_JAR=$withval)
1858 AC_ARG_WITH(libformula-jar,
1859     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     LIBFORMULA_JAR=$withval)
1863 AC_ARG_WITH(librepository-jar,
1864     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     LIBREPOSITORY_JAR=$withval)
1868 AC_ARG_WITH(libfonts-jar,
1869     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     LIBFONTS_JAR=$withval)
1873 AC_ARG_WITH(libserializer-jar,
1874     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBSERIALIZER_JAR=$withval)
1878 AC_ARG_WITH(libbase-jar,
1879     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBBASE_JAR=$withval)
1883 AC_ARG_WITH(system-odbc,
1884     AS_HELP_STRING([--with-system-odbc],
1885         [Use the odbc headers already on system.]),,
1886     [with_system_odbc="auto"])
1888 AC_ARG_WITH(system-sane,
1889     AS_HELP_STRING([--with-system-sane],
1890         [Use sane.h already on system.]),,
1891     [with_system_sane="$with_system_headers"])
1893 AC_ARG_WITH(system-bluez,
1894     AS_HELP_STRING([--with-system-bluez],
1895         [Use bluetooth.h already on system.]),,
1896     [with_system_bluez="$with_system_headers"])
1898 AC_ARG_WITH(system-curl,
1899     AS_HELP_STRING([--with-system-curl],
1900         [Use curl already on system.]),,
1901     [with_system_curl=auto])
1903 AC_ARG_WITH(system-boost,
1904     AS_HELP_STRING([--with-system-boost],
1905         [Use boost already on system.]),,
1906     [with_system_boost="$with_system_headers"])
1908 AC_ARG_WITH(system-glm,
1909     AS_HELP_STRING([--with-system-glm],
1910         [Use glm already on system.]),,
1911     [with_system_glm="$with_system_headers"])
1913 AC_ARG_WITH(system-hunspell,
1914     AS_HELP_STRING([--with-system-hunspell],
1915         [Use libhunspell already on system.]),,
1916     [with_system_hunspell="$with_system_libs"])
1918 AC_ARG_WITH(system-qrcodegen,
1919     AS_HELP_STRING([--with-system-qrcodegen],
1920         [Use libqrcodegen already on system.]),,
1921     [with_system_qrcodegen="$with_system_libs"])
1923 AC_ARG_WITH(system-mythes,
1924     AS_HELP_STRING([--with-system-mythes],
1925         [Use mythes already on system.]),,
1926     [with_system_mythes="$with_system_libs"])
1928 AC_ARG_WITH(system-altlinuxhyph,
1929     AS_HELP_STRING([--with-system-altlinuxhyph],
1930         [Use ALTLinuxhyph already on system.]),,
1931     [with_system_altlinuxhyph="$with_system_libs"])
1933 AC_ARG_WITH(system-lpsolve,
1934     AS_HELP_STRING([--with-system-lpsolve],
1935         [Use lpsolve already on system.]),,
1936     [with_system_lpsolve="$with_system_libs"])
1938 AC_ARG_WITH(system-coinmp,
1939     AS_HELP_STRING([--with-system-coinmp],
1940         [Use CoinMP already on system.]),,
1941     [with_system_coinmp="$with_system_libs"])
1943 AC_ARG_WITH(system-liblangtag,
1944     AS_HELP_STRING([--with-system-liblangtag],
1945         [Use liblangtag library already on system.]),,
1946     [with_system_liblangtag="$with_system_libs"])
1948 AC_ARG_WITH(webdav,
1949     AS_HELP_STRING([--with-webdav],
1950         [Specify which library to use for webdav implementation.
1951          Possible values: "neon", "serf", "no". The default value is "neon".
1952          Example: --with-webdav="serf"]),
1953     WITH_WEBDAV=$withval,
1954     WITH_WEBDAV="neon")
1956 AC_ARG_WITH(linker-hash-style,
1957     AS_HELP_STRING([--with-linker-hash-style],
1958         [Use linker with --hash-style=<style> when linking shared objects.
1959          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1960          if supported on the build system, and "sysv" otherwise.]))
1962 AC_ARG_WITH(jdk-home,
1963     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1964         [If you have installed JDK 8 or later on your system please supply the
1965          path here. Note that this is not the location of the java command but the
1966          location of the entire distribution.]),
1969 AC_ARG_WITH(help,
1970     AS_HELP_STRING([--with-help],
1971         [Enable the build of help. There is a special parameter "common" that
1972          can be used to bundle only the common part, .e.g help-specific icons.
1973          This is useful when you build the helpcontent separately.])
1974     [
1975                           Usage:     --with-help    build the old local help
1976                                  --without-help     no local help (default)
1977                                  --with-help=html   build the new HTML local help
1978                                  --with-help=online build the new HTML online help
1979     ],
1982 libo_FUZZ_ARG_WITH(java,
1983     AS_HELP_STRING([--with-java=<java command>],
1984         [Specify the name of the Java interpreter command. Typically "java"
1985          which is the default.
1987          To build without support for Java components, applets, accessibility
1988          or the XML filters written in Java, use --without-java or --with-java=no.]),
1989     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1990     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1993 AC_ARG_WITH(jvm-path,
1994     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1995         [Use a specific JVM search path at runtime.
1996          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1999 AC_ARG_WITH(ant-home,
2000     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2001         [If you have installed Apache Ant on your system, please supply the path here.
2002          Note that this is not the location of the Ant binary but the location
2003          of the entire distribution.]),
2006 AC_ARG_WITH(symbol-config,
2007     AS_HELP_STRING([--with-symbol-config],
2008         [Configuration for the crashreport symbol upload]),
2009         [],
2010         [with_symbol_config=no])
2012 AC_ARG_WITH(export-validation,
2013     AS_HELP_STRING([--without-export-validation],
2014         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2015 ,with_export_validation=auto)
2017 AC_ARG_WITH(bffvalidator,
2018     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2019         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2020          Requires installed Microsoft Office Binary File Format Validator.
2021          Note: export-validation (--with-export-validation) is required to be turned on.
2022          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2023 ,with_bffvalidator=no)
2025 libo_FUZZ_ARG_WITH(junit,
2026     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2027         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2028          --without-junit disables those tests. Not relevant in the --without-java case.]),
2029 ,with_junit=yes)
2031 AC_ARG_WITH(hamcrest,
2032     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2033         [Specifies the hamcrest jar file to use for JUnit-based tests.
2034          --without-junit disables those tests. Not relevant in the --without-java case.]),
2035 ,with_hamcrest=yes)
2037 AC_ARG_WITH(perl-home,
2038     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2039         [If you have installed Perl 5 Distribution, on your system, please
2040          supply the path here. Note that this is not the location of the Perl
2041          binary but the location of the entire distribution.]),
2044 libo_FUZZ_ARG_WITH(doxygen,
2045     AS_HELP_STRING(
2046         [--with-doxygen=<absolute path to doxygen executable>],
2047         [Specifies the doxygen executable to use when generating ODK C/C++
2048          documentation. --without-doxygen disables generation of ODK C/C++
2049          documentation. Not relevant in the --disable-odk case.]),
2050 ,with_doxygen=yes)
2052 AC_ARG_WITH(visual-studio,
2053     AS_HELP_STRING([--with-visual-studio=<2017>],
2054         [Specify which Visual Studio version to use in case several are
2055          installed. Currently only 2017 is supported.]),
2058 AC_ARG_WITH(windows-sdk,
2059     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2060         [Specify which Windows SDK, or "Windows Kit", version to use
2061          in case the one that came with the selected Visual Studio
2062          is not what you want for some reason. Note that not all compiler/SDK
2063          combinations are supported. The intent is that this option should not
2064          be needed.]),
2067 AC_ARG_WITH(lang,
2068     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2069         [Use this option to build LibreOffice with additional UI language support.
2070          English (US) is always included by default.
2071          Separate multiple languages with space.
2072          For all languages, use --with-lang=ALL.]),
2075 AC_ARG_WITH(locales,
2076     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2077         [Use this option to limit the locale information built in.
2078          Separate multiple locales with space.
2079          Very experimental and might well break stuff.
2080          Just a desperate measure to shrink code and data size.
2081          By default all the locales available is included.
2082          This option is completely unrelated to --with-lang.])
2083     [
2084                           Affects also our character encoding conversion
2085                           tables for encodings mainly targeted for a
2086                           particular locale, like EUC-CN and EUC-TW for
2087                           zh, ISO-2022-JP for ja.
2089                           Affects also our add-on break iterator data for
2090                           some languages.
2092                           For the default, all locales, don't use this switch at all.
2093                           Specifying just the language part of a locale means all matching
2094                           locales will be included.
2095     ],
2098 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2099 libo_FUZZ_ARG_WITH(krb5,
2100     AS_HELP_STRING([--with-krb5],
2101         [Enable MIT Kerberos 5 support in modules that support it.
2102          By default automatically enabled on platforms
2103          where a good system Kerberos 5 is available.]),
2106 libo_FUZZ_ARG_WITH(gssapi,
2107     AS_HELP_STRING([--with-gssapi],
2108         [Enable GSSAPI support in modules that support it.
2109          By default automatically enabled on platforms
2110          where a good system GSSAPI is available.]),
2113 AC_ARG_WITH(iwyu,
2114     AS_HELP_STRING([--with-iwyu],
2115         [Use given IWYU binary path to check unneeded includes instead of building.
2116          Use only if you are hacking on it.]),
2119 libo_FUZZ_ARG_WITH(lxml,
2120     AS_HELP_STRING([--without-lxml],
2121         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2122          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2123          report widget classes and ids.]),
2126 dnl ===================================================================
2127 dnl Branding
2128 dnl ===================================================================
2130 AC_ARG_WITH(branding,
2131     AS_HELP_STRING([--with-branding=/path/to/images],
2132         [Use given path to retrieve branding images set.])
2133     [
2134                           Search for intro.png about.svg and flat_logo.svg.
2135                           If any is missing, default ones will be used instead.
2137                           Search also progress.conf for progress
2138                           settings on intro screen :
2140                           PROGRESSBARCOLOR="255,255,255" Set color of
2141                           progress bar. Comma separated RGB decimal values.
2142                           PROGRESSSIZE="407,6" Set size of progress bar.
2143                           Comma separated decimal values (width, height).
2144                           PROGRESSPOSITION="61,317" Set position of progress
2145                           bar from left,top. Comma separated decimal values.
2146                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2147                           bar frame. Comma separated RGB decimal values.
2148                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2149                           bar text. Comma separated RGB decimal values.
2150                           PROGRESSTEXTBASELINE="287" Set vertical position of
2151                           progress bar text from top. Decimal value.
2153                           Default values will be used if not found.
2154     ],
2158 AC_ARG_WITH(extra-buildid,
2159     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2160         [Show addition build identification in about dialog.]),
2164 AC_ARG_WITH(vendor,
2165     AS_HELP_STRING([--with-vendor="John the Builder"],
2166         [Set vendor of the build.]),
2169 AC_ARG_WITH(android-package-name,
2170     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2171         [Set Android package name of the build.]),
2174 AC_ARG_WITH(compat-oowrappers,
2175     AS_HELP_STRING([--with-compat-oowrappers],
2176         [Install oo* wrappers in parallel with
2177          lo* ones to keep backward compatibility.
2178          Has effect only with make distro-pack-install]),
2181 AC_ARG_WITH(os-version,
2182     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2183         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2186 AC_ARG_WITH(mingw-cross-compiler,
2187     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2188         [Specify the MinGW cross-compiler to use.
2189          When building on the ODK on Unix and building unowinreg.dll,
2190          specify the MinGW C++ cross-compiler.]),
2193 AC_ARG_WITH(idlc-cpp,
2194     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2195         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2198 AC_ARG_WITH(build-version,
2199     AS_HELP_STRING([--with-build-version="Built by Jim"],
2200         [Allows the builder to add a custom version tag that will appear in the
2201          Help/About box for QA purposes.]),
2202 with_build_version=$withval,
2205 AC_ARG_WITH(parallelism,
2206     AS_HELP_STRING([--with-parallelism],
2207         [Number of jobs to run simultaneously during build. Parallel builds can
2208         save a lot of time on multi-cpu machines. Defaults to the number of
2209         CPUs on the machine, unless you configure --enable-icecream - then to
2210         40.]),
2213 AC_ARG_WITH(all-tarballs,
2214     AS_HELP_STRING([--with-all-tarballs],
2215         [Download all external tarballs unconditionally]))
2217 AC_ARG_WITH(gdrive-client-id,
2218     AS_HELP_STRING([--with-gdrive-client-id],
2219         [Provides the client id of the application for OAuth2 authentication
2220         on Google Drive. If either this or --with-gdrive-client-secret is
2221         empty, the feature will be disabled]),
2224 AC_ARG_WITH(gdrive-client-secret,
2225     AS_HELP_STRING([--with-gdrive-client-secret],
2226         [Provides the client secret of the application for OAuth2
2227         authentication on Google Drive. If either this or
2228         --with-gdrive-client-id is empty, the feature will be disabled]),
2231 AC_ARG_WITH(alfresco-cloud-client-id,
2232     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2233         [Provides the client id of the application for OAuth2 authentication
2234         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2235         empty, the feature will be disabled]),
2238 AC_ARG_WITH(alfresco-cloud-client-secret,
2239     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2240         [Provides the client secret of the application for OAuth2
2241         authentication on Alfresco Cloud. If either this or
2242         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2245 AC_ARG_WITH(onedrive-client-id,
2246     AS_HELP_STRING([--with-onedrive-client-id],
2247         [Provides the client id of the application for OAuth2 authentication
2248         on OneDrive. If either this or --with-onedrive-client-secret is
2249         empty, the feature will be disabled]),
2252 AC_ARG_WITH(onedrive-client-secret,
2253     AS_HELP_STRING([--with-onedrive-client-secret],
2254         [Provides the client secret of the application for OAuth2
2255         authentication on OneDrive. If either this or
2256         --with-onedrive-client-id is empty, the feature will be disabled]),
2258 dnl ===================================================================
2259 dnl Do we want to use pre-build binary tarball for recompile
2260 dnl ===================================================================
2262 if test "$enable_library_bin_tar" = "yes" ; then
2263     USE_LIBRARY_BIN_TAR=TRUE
2264 else
2265     USE_LIBRARY_BIN_TAR=
2267 AC_SUBST(USE_LIBRARY_BIN_TAR)
2269 dnl ===================================================================
2270 dnl Test whether build target is Release Build
2271 dnl ===================================================================
2272 AC_MSG_CHECKING([whether build target is Release Build])
2273 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2274     AC_MSG_RESULT([no])
2275     ENABLE_RELEASE_BUILD=
2276 else
2277     AC_MSG_RESULT([yes])
2278     ENABLE_RELEASE_BUILD=TRUE
2280 AC_SUBST(ENABLE_RELEASE_BUILD)
2282 dnl ===================================================================
2283 dnl Test whether to sign Windows Build
2284 dnl ===================================================================
2285 AC_MSG_CHECKING([whether to sign windows build])
2286 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2287     AC_MSG_RESULT([yes])
2288     WINDOWS_BUILD_SIGNING="TRUE"
2289 else
2290     AC_MSG_RESULT([no])
2291     WINDOWS_BUILD_SIGNING="FALSE"
2293 AC_SUBST(WINDOWS_BUILD_SIGNING)
2295 dnl ===================================================================
2296 dnl MacOSX build and runtime environment options
2297 dnl ===================================================================
2299 AC_ARG_WITH(macosx-sdk,
2300     AS_HELP_STRING([--with-macosx-sdk=<version>],
2301         [Prefer a specific SDK for building.])
2302     [
2303                           If the requested SDK is not available, a search for the oldest one will be done.
2304                           With current Xcode versions, only the latest SDK is included, so this option is
2305                           not terribly useful. It works fine to build with a new SDK and run the result
2306                           on an older OS.
2308                           e. g.: --with-macosx-sdk=10.10
2310                           there are 3 options to control the MacOSX build:
2311                           --with-macosx-sdk (referred as 'sdk' below)
2312                           --with-macosx-version-min-required (referred as 'min' below)
2313                           --with-macosx-version-max-allowed (referred as 'max' below)
2315                           the connection between these value and the default they take is as follow:
2316                           ( ? means not specified on the command line, s means the SDK version found,
2317                           constraint: 8 <= x <= y <= z)
2319                           ==========================================
2320                            command line      || config result
2321                           ==========================================
2322                           min  | max  | sdk  || min   | max  | sdk  |
2323                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2324                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2325                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2326                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2327                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2328                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2329                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2330                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2333                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2334                           for a detailed technical explanation of these variables
2336                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2337     ],
2340 AC_ARG_WITH(macosx-version-min-required,
2341     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2342         [set the minimum OS version needed to run the built LibreOffice])
2343     [
2344                           e. g.: --with-macos-version-min-required=10.10
2345                           see --with-macosx-sdk for more info
2346     ],
2349 AC_ARG_WITH(macosx-version-max-allowed,
2350     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2351         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2352     [
2353                           e. g.: --with-macos-version-max-allowed=10.10
2354                           see --with-macosx-sdk for more info
2355     ],
2359 dnl ===================================================================
2360 dnl options for stuff used during cross-compilation build
2361 dnl Not quite superseded by --with-build-platform-configure-options.
2362 dnl TODO: check, if the "force" option is still needed anywhere.
2363 dnl ===================================================================
2365 AC_ARG_WITH(system-icu-for-build,
2366     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2367         [Use icu already on system for build tools (cross-compilation only).]))
2370 dnl ===================================================================
2371 dnl Check for incompatible options set by fuzzing, and reset those
2372 dnl automatically to working combinations
2373 dnl ===================================================================
2375 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2376         "$enable_dbus" != "$enable_avahi"; then
2377     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2378     enable_avahi=$enable_dbus
2381 add_lopath_after ()
2383     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2384         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2385     fi
2388 add_lopath_before ()
2390     local IFS=${P_SEP}
2391     local path_cleanup
2392     local dir
2393     for dir in $LO_PATH ; do
2394         if test "$dir" != "$1" ; then
2395             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2396         fi
2397     done
2398     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2401 dnl ===================================================================
2402 dnl check for required programs (grep, awk, sed, bash)
2403 dnl ===================================================================
2405 pathmunge ()
2407     if test -n "$1"; then
2408         if test "$build_os" = "cygwin"; then
2409             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2410                 PathFormat "$1"
2411                 new_path=`cygpath -sm "$formatted_path"`
2412             else
2413                 PathFormat "$1"
2414                 new_path=`cygpath -u "$formatted_path"`
2415             fi
2416         else
2417             new_path="$1"
2418         fi
2419         if test "$2" = "after"; then
2420             add_lopath_after "$new_path"
2421         else
2422             add_lopath_before "$new_path"
2423         fi
2424         unset new_path
2425     fi
2428 AC_PROG_AWK
2429 AC_PATH_PROG( AWK, $AWK)
2430 if test -z "$AWK"; then
2431     AC_MSG_ERROR([install awk to run this script])
2434 AC_PATH_PROG(BASH, bash)
2435 if test -z "$BASH"; then
2436     AC_MSG_ERROR([bash not found in \$PATH])
2438 AC_SUBST(BASH)
2440 AC_MSG_CHECKING([for GNU or BSD tar])
2441 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2442     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2443     if test $? -eq 0;  then
2444         GNUTAR=$a
2445         break
2446     fi
2447 done
2448 AC_MSG_RESULT($GNUTAR)
2449 if test -z "$GNUTAR"; then
2450     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2452 AC_SUBST(GNUTAR)
2454 AC_MSG_CHECKING([for tar's option to strip components])
2455 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2456 if test $? -eq 0; then
2457     STRIP_COMPONENTS="--strip-components"
2458 else
2459     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2460     if test $? -eq 0; then
2461         STRIP_COMPONENTS="--strip-path"
2462     else
2463         STRIP_COMPONENTS="unsupported"
2464     fi
2466 AC_MSG_RESULT($STRIP_COMPONENTS)
2467 if test x$STRIP_COMPONENTS = xunsupported; then
2468     AC_MSG_ERROR([you need a tar that is able to strip components.])
2470 AC_SUBST(STRIP_COMPONENTS)
2472 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2473 dnl desktop OSes from "mobile" ones.
2475 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2476 dnl In other words, that when building for an OS that is not a
2477 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2479 dnl Note the direction of the implication; there is no assumption that
2480 dnl cross-compiling would imply a non-desktop OS.
2482 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2483     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2484     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2485     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2488 # Whether to build "avmedia" functionality or not.
2490 if test -z "$enable_avmedia"; then
2491     enable_avmedia=yes
2494 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2495 if test "$enable_avmedia" = yes; then
2496     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2497 else
2498     USE_AVMEDIA_DUMMY='TRUE'
2500 AC_SUBST(USE_AVMEDIA_DUMMY)
2502 # Decide whether to build database connectivity stuff (including
2503 # Base) or not. We probably don't want to on non-desktop OSes.
2504 if test -z "$enable_database_connectivity"; then
2505     # --disable-database-connectivity is unfinished work in progress
2506     # and the iOS test app doesn't link if we actually try to use it.
2507     # if test $_os != iOS -a $_os != Android; then
2508     if test $_os != iOS; then
2509         enable_database_connectivity=yes
2510     fi
2513 if test "$enable_database_connectivity" = yes; then
2514     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2515     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2518 if test -z "$enable_extensions"; then
2519     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2520     if test $_os != iOS -a $_os != Android; then
2521         enable_extensions=yes
2522     fi
2525 if test "$enable_extensions" = yes; then
2526     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2527     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2530 if test -z "$enable_scripting"; then
2531     # Disable scripting for iOS unless specifically overridden
2532     # with --enable-scripting.
2533     if test $_os != iOS; then
2534         enable_scripting=yes
2535     fi
2538 DISABLE_SCRIPTING=''
2539 if test "$enable_scripting" = yes; then
2540     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2541     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2542 else
2543     DISABLE_SCRIPTING='TRUE'
2544     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2547 if test $_os = iOS -o $_os = Android; then
2548     # Disable dynamic_loading always for iOS and Android
2549     enable_dynamic_loading=no
2550 elif test -z "$enable_dynamic_loading"; then
2551     # Otherwise enable it unless specifically disabled
2552     enable_dynamic_loading=yes
2555 DISABLE_DYNLOADING=''
2556 if test "$enable_dynamic_loading" = yes; then
2557     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2558 else
2559     DISABLE_DYNLOADING='TRUE'
2561 AC_SUBST(DISABLE_DYNLOADING)
2563 # remember SYSBASE value
2564 AC_SUBST(SYSBASE)
2566 dnl ===================================================================
2567 dnl  Sort out various gallery compilation options
2568 dnl ===================================================================
2569 AC_MSG_CHECKING([how to build and package galleries])
2570 if test -n "${with_galleries}"; then
2571     if test "$with_galleries" = "build"; then
2572         WITH_GALLERY_BUILD=TRUE
2573         AC_MSG_RESULT([build from source images internally])
2574     elif test "$with_galleries" = "no"; then
2575         WITH_GALLERY_BUILD=
2576         AC_MSG_RESULT([disable non-internal gallery build])
2577     else
2578         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2579     fi
2580 else
2581     if test $_os != iOS -a $_os != Android; then
2582         WITH_GALLERY_BUILD=TRUE
2583         AC_MSG_RESULT([internal src images for desktop])
2584     else
2585         WITH_GALLERY_BUILD=
2586         AC_MSG_RESULT([disable src image build])
2587     fi
2589 AC_SUBST(WITH_GALLERY_BUILD)
2591 dnl ===================================================================
2592 dnl  Checks if ccache is available
2593 dnl ===================================================================
2594 CCACHE_DEPEND_MODE=
2595 if test "$_os" = "WINNT"; then
2596     # on windows/VC build do not use ccache
2597     CCACHE=""
2598 elif test "$enable_ccache" = "no"; then
2599     CCACHE=""
2600 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2601     case "%$CC%$CXX%" in
2602     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2603     # assume that's good then
2604     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2605         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2606         CCACHE_DEPEND_MODE=1
2607         ;;
2608     *)
2609         AC_PATH_PROG([CCACHE],[ccache],[not found])
2610         if test "$CCACHE" = "not found"; then
2611             CCACHE=""
2612         else
2613             CCACHE_DEPEND_MODE=1
2614             # Need to check for ccache version: otherwise prevents
2615             # caching of the results (like "-x objective-c++" for Mac)
2616             if test $_os = Darwin -o $_os = iOS; then
2617                 # Check ccache version
2618                 AC_MSG_CHECKING([whether version of ccache is suitable])
2619                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2620                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2621                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2622                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2623                 else
2624                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2625                     CCACHE=""
2626                     CCACHE_DEPEND_MODE=
2627                 fi
2628             fi
2629         fi
2630         ;;
2631     esac
2632 else
2633     CCACHE=""
2635 if test "$enable_ccache" = "nodepend"; then
2636     CCACHE_DEPEND_MODE=""
2638 AC_SUBST(CCACHE_DEPEND_MODE)
2640 if test "$CCACHE" != ""; then
2641     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2642     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2643     if test "$ccache_size" = ""; then
2644         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2645         if test "$ccache_size" = ""; then
2646             ccache_size=0
2647         fi
2648         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2649         if test $ccache_size -lt 1024; then
2650             CCACHE=""
2651             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2652             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2653         else
2654             # warn that ccache may be too small for debug build
2655             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2656             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2657         fi
2658     else
2659         if test $ccache_size -lt 5; then
2660             #warn that ccache may be too small for debug build
2661             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2662             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2663         fi
2664     fi
2667 dnl ===================================================================
2668 dnl  Checks for C compiler,
2669 dnl  The check for the C++ compiler is later on.
2670 dnl ===================================================================
2671 if test "$_os" != "WINNT"; then
2672     GCC_HOME_SET="true"
2673     AC_MSG_CHECKING([gcc home])
2674     if test -z "$with_gcc_home"; then
2675         if test "$enable_icecream" = "yes"; then
2676             if test -d "/usr/lib/icecc/bin"; then
2677                 GCC_HOME="/usr/lib/icecc/"
2678             elif test -d "/usr/libexec/icecc/bin"; then
2679                 GCC_HOME="/usr/libexec/icecc/"
2680             elif test -d "/opt/icecream/bin"; then
2681                 GCC_HOME="/opt/icecream/"
2682             else
2683                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2685             fi
2686         else
2687             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2688             GCC_HOME_SET="false"
2689         fi
2690     else
2691         GCC_HOME="$with_gcc_home"
2692     fi
2693     AC_MSG_RESULT($GCC_HOME)
2694     AC_SUBST(GCC_HOME)
2696     if test "$GCC_HOME_SET" = "true"; then
2697         if test -z "$CC"; then
2698             CC="$GCC_HOME/bin/gcc"
2699             CC_BASE="gcc"
2700         fi
2701         if test -z "$CXX"; then
2702             CXX="$GCC_HOME/bin/g++"
2703             CXX_BASE="g++"
2704         fi
2705     fi
2708 COMPATH=`dirname "$CC"`
2709 if test "$COMPATH" = "."; then
2710     AC_PATH_PROGS(COMPATH, $CC)
2711     dnl double square bracket to get single because of M4 quote...
2712     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2714 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2716 dnl ===================================================================
2717 dnl Java support
2718 dnl ===================================================================
2719 AC_MSG_CHECKING([whether to build with Java support])
2720 if test "$with_java" != "no"; then
2721     if test "$DISABLE_SCRIPTING" = TRUE; then
2722         AC_MSG_RESULT([no, overridden by --disable-scripting])
2723         ENABLE_JAVA=""
2724         with_java=no
2725     else
2726         AC_MSG_RESULT([yes])
2727         ENABLE_JAVA="TRUE"
2728         AC_DEFINE(HAVE_FEATURE_JAVA)
2729     fi
2730 else
2731     AC_MSG_RESULT([no])
2732     ENABLE_JAVA=""
2735 AC_SUBST(ENABLE_JAVA)
2737 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2739 dnl ENABLE_JAVA="" indicate no Java support at all
2741 dnl ===================================================================
2742 dnl Check macOS SDK and compiler
2743 dnl ===================================================================
2745 if test $_os = Darwin -o $_os = iOS; then
2747     # If no --with-macosx-sdk option is given, look for one
2749     # The intent is that for "most" Mac-based developers, a suitable
2750     # SDK will be found automatically without any configure options.
2752     # For developers with a current Xcode, the lowest-numbered SDK
2753     # higher than or equal to the minimum required should be found.
2755     AC_MSG_CHECKING([what macOS SDK to use])
2756     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2757         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2758         if test -d "$MACOSX_SDK_PATH"; then
2759             with_macosx_sdk="${_macosx_sdk}"
2760             break
2761         else
2762             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2763             if test -d "$MACOSX_SDK_PATH"; then
2764                 with_macosx_sdk="${_macosx_sdk}"
2765                 break
2766             fi
2767         fi
2768     done
2769     if test ! -d "$MACOSX_SDK_PATH"; then
2770         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2771     fi
2773     if test $_os = iOS; then
2774         if test "$enable_ios_simulator" = "yes"; then
2775             useos=iphonesimulator
2776         else
2777             useos=iphoneos
2778         fi
2779         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2780     fi
2781     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2784     case $with_macosx_sdk in
2785     10.12)
2786         MACOSX_SDK_VERSION=101200
2787         ;;
2788     10.13)
2789         MACOSX_SDK_VERSION=101300
2790         ;;
2791     10.14)
2792         MACOSX_SDK_VERSION=101400
2793         ;;
2794     10.15)
2795         MACOSX_SDK_VERSION=101500
2796         ;;
2797     *)
2798         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2799         ;;
2800     esac
2802     if test "$with_macosx_version_min_required" = "" ; then
2803         with_macosx_version_min_required="10.10";
2804     fi
2806     if test "$with_macosx_version_max_allowed" = "" ; then
2807         with_macosx_version_max_allowed="$with_macosx_sdk"
2808     fi
2810     # export this so that "xcrun" invocations later return matching values
2811     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2812     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2813     export DEVELOPER_DIR
2814     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2815     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2817     AC_MSG_CHECKING([whether Xcode is new enough])
2818     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2819     my_xcode_ver2=${my_xcode_ver1#Xcode }
2820     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2821     if test "$my_xcode_ver3" -ge 903; then
2822         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2823     else
2824         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2825     fi
2827     case "$with_macosx_version_min_required" in
2828     10.10)
2829         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2830         ;;
2831     10.11)
2832         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2833         ;;
2834     10.12)
2835         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2836         ;;
2837     10.13)
2838         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2839         ;;
2840     10.14)
2841         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2842         ;;
2843     10.15)
2844         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2845         ;;
2846     *)
2847         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2848         ;;
2849     esac
2850     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2852     LIBTOOL=/usr/bin/libtool
2853     INSTALL_NAME_TOOL=install_name_tool
2854     if test -z "$save_CC"; then
2855         stdlib=-stdlib=libc++
2856         if test "$ENABLE_LTO" = TRUE; then
2857             lto=-flto
2858         fi
2860         AC_MSG_CHECKING([what C compiler to use])
2861         CC="`xcrun -find clang`"
2862         CC_BASE=`first_arg_basename "$CC"`
2863         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2864         AC_MSG_RESULT([$CC])
2866         AC_MSG_CHECKING([what C++ compiler to use])
2867         CXX="`xcrun -find clang++`"
2868         CXX_BASE=`first_arg_basename "$CXX"`
2869         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2870         AC_MSG_RESULT([$CXX])
2872         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2873         AR=`xcrun -find ar`
2874         NM=`xcrun -find nm`
2875         STRIP=`xcrun -find strip`
2876         LIBTOOL=`xcrun -find libtool`
2877         RANLIB=`xcrun -find ranlib`
2878     fi
2880     case "$with_macosx_version_max_allowed" in
2881     10.10)
2882         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2883         ;;
2884     10.11)
2885         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2886         ;;
2887     10.12)
2888         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2889         ;;
2890     10.13)
2891         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2892         ;;
2893     10.14)
2894         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2895         ;;
2896     10.15)
2897         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2898         ;;
2899     *)
2900         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2901         ;;
2902     esac
2904     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2905     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2906         AC_MSG_ERROR([the version minimum required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
2907     else
2908         AC_MSG_RESULT([ok])
2909     fi
2911     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2912     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2913         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2914     else
2915         AC_MSG_RESULT([ok])
2916     fi
2917     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2918     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2920     AC_MSG_CHECKING([whether to do code signing])
2922     if test "$enable_macosx_code_signing" = yes; then
2923         # By default use the first suitable certificate (?).
2925         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2926         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2927         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2928         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2929         # "Developer ID Application" one.
2931         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2932         if test -n "$identity"; then
2933             MACOSX_CODESIGNING_IDENTITY=$identity
2934             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2935             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2936         else
2937             AC_MSG_ERROR([cannot determine identity to use])
2938         fi
2939     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2940         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2941         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2942         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2943     else
2944         AC_MSG_RESULT([no])
2945     fi
2947     AC_MSG_CHECKING([whether to create a Mac App Store package])
2949     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2950         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2951     elif test "$enable_macosx_package_signing" = yes; then
2952         # By default use the first suitable certificate.
2953         # It should be a "3rd Party Mac Developer Installer" one
2955         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2956         if test -n "$identity"; then
2957             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2958             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2959             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2960         else
2961             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2962         fi
2963     elif test -n "$enable_macosx_package_signing"; then
2964         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2965         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2966         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2967     else
2968         AC_MSG_RESULT([no])
2969     fi
2971     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2972         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2973     fi
2975     AC_MSG_CHECKING([whether to sandbox the application])
2977     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2978         AC_MSG_ERROR([macOS sandboxing requires code signing])
2979     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2980         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2981     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2982         ENABLE_MACOSX_SANDBOX=TRUE
2983         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2984         AC_MSG_RESULT([yes])
2985     else
2986         AC_MSG_RESULT([no])
2987     fi
2989     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2990     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2991     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2993 AC_SUBST(MACOSX_SDK_PATH)
2994 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2995 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2996 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2997 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2998 AC_SUBST(INSTALL_NAME_TOOL)
2999 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3000 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3001 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3002 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3003 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3005 dnl ===================================================================
3006 dnl Check iOS SDK and compiler
3007 dnl ===================================================================
3009 if test $_os = iOS; then
3010     AC_MSG_CHECKING([what iOS SDK to use])
3011     current_sdk_ver=12.4
3012     older_sdk_vers="13.0 12.2 12.1 12.0 11.4"
3013     if test "$enable_ios_simulator" = "yes"; then
3014         platform=iPhoneSimulator
3015         versionmin=-mios-simulator-version-min=11.0
3016     else
3017         platform=iPhoneOS
3018         versionmin=-miphoneos-version-min=11.0
3019     fi
3020     xcode_developer=`xcode-select -print-path`
3022     for sdkver in $current_sdk_ver $older_sdk_vers; do
3023         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3024         if test -d $t; then
3025             sysroot=$t
3026             break
3027         fi
3028     done
3030     if test -z "$sysroot"; then
3031         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3032     fi
3034     AC_MSG_RESULT($sysroot)
3036     # LTO is not really recommended for iOS builds,
3037     # the link time will be astronomical
3038     if test "$ENABLE_LTO" = TRUE; then
3039         lto=-flto
3040     fi
3042     stdlib="-stdlib=libc++"
3044     AC_MSG_CHECKING([what C compiler to use])
3045     CC="`xcrun -find clang`"
3046     CC_BASE=`first_arg_basename "$CC"`
3047     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3048     AC_MSG_RESULT([$CC])
3050     AC_MSG_CHECKING([what C++ compiler to use])
3051     CXX="`xcrun -find clang++`"
3052     CXX_BASE=`first_arg_basename "$CXX"`
3053     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3054     AC_MSG_RESULT([$CXX])
3056     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3057     AR=`xcrun -find ar`
3058     NM=`xcrun -find nm`
3059     STRIP=`xcrun -find strip`
3060     LIBTOOL=`xcrun -find libtool`
3061     RANLIB=`xcrun -find ranlib`
3064 AC_MSG_CHECKING([whether to treat the installation as read-only])
3066 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3067         "$enable_extensions" != yes; then
3068     enable_readonly_installset=yes
3070 if test "$enable_readonly_installset" = yes; then
3071     AC_MSG_RESULT([yes])
3072     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3073 else
3074     AC_MSG_RESULT([no])
3077 dnl ===================================================================
3078 dnl Structure of install set
3079 dnl ===================================================================
3081 if test $_os = Darwin; then
3082     LIBO_BIN_FOLDER=MacOS
3083     LIBO_ETC_FOLDER=Resources
3084     LIBO_LIBEXEC_FOLDER=MacOS
3085     LIBO_LIB_FOLDER=Frameworks
3086     LIBO_LIB_PYUNO_FOLDER=Resources
3087     LIBO_SHARE_FOLDER=Resources
3088     LIBO_SHARE_HELP_FOLDER=Resources/help
3089     LIBO_SHARE_JAVA_FOLDER=Resources/java
3090     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3091     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3092     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3093     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3094     LIBO_URE_BIN_FOLDER=MacOS
3095     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3096     LIBO_URE_LIB_FOLDER=Frameworks
3097     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3098     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3099 elif test $_os = WINNT; then
3100     LIBO_BIN_FOLDER=program
3101     LIBO_ETC_FOLDER=program
3102     LIBO_LIBEXEC_FOLDER=program
3103     LIBO_LIB_FOLDER=program
3104     LIBO_LIB_PYUNO_FOLDER=program
3105     LIBO_SHARE_FOLDER=share
3106     LIBO_SHARE_HELP_FOLDER=help
3107     LIBO_SHARE_JAVA_FOLDER=program/classes
3108     LIBO_SHARE_PRESETS_FOLDER=presets
3109     LIBO_SHARE_READMES_FOLDER=readmes
3110     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3111     LIBO_SHARE_SHELL_FOLDER=program/shell
3112     LIBO_URE_BIN_FOLDER=program
3113     LIBO_URE_ETC_FOLDER=program
3114     LIBO_URE_LIB_FOLDER=program
3115     LIBO_URE_MISC_FOLDER=program
3116     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3117 else
3118     LIBO_BIN_FOLDER=program
3119     LIBO_ETC_FOLDER=program
3120     LIBO_LIBEXEC_FOLDER=program
3121     LIBO_LIB_FOLDER=program
3122     LIBO_LIB_PYUNO_FOLDER=program
3123     LIBO_SHARE_FOLDER=share
3124     LIBO_SHARE_HELP_FOLDER=help
3125     LIBO_SHARE_JAVA_FOLDER=program/classes
3126     LIBO_SHARE_PRESETS_FOLDER=presets
3127     LIBO_SHARE_READMES_FOLDER=readmes
3128     if test "$enable_fuzzers" != yes; then
3129         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3130     else
3131         LIBO_SHARE_RESOURCE_FOLDER=resource
3132     fi
3133     LIBO_SHARE_SHELL_FOLDER=program/shell
3134     LIBO_URE_BIN_FOLDER=program
3135     LIBO_URE_ETC_FOLDER=program
3136     LIBO_URE_LIB_FOLDER=program
3137     LIBO_URE_MISC_FOLDER=program
3138     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3140 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3141 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3142 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3143 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3144 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3145 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3146 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3147 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3148 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3149 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3150 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3151 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3154 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3155 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3157 # Not all of them needed in config_host.mk, add more if need arises
3158 AC_SUBST(LIBO_BIN_FOLDER)
3159 AC_SUBST(LIBO_ETC_FOLDER)
3160 AC_SUBST(LIBO_LIB_FOLDER)
3161 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3162 AC_SUBST(LIBO_SHARE_FOLDER)
3163 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3164 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3165 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3166 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3167 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3168 AC_SUBST(LIBO_URE_BIN_FOLDER)
3169 AC_SUBST(LIBO_URE_ETC_FOLDER)
3170 AC_SUBST(LIBO_URE_LIB_FOLDER)
3171 AC_SUBST(LIBO_URE_MISC_FOLDER)
3172 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3174 dnl ===================================================================
3175 dnl Windows specific tests and stuff
3176 dnl ===================================================================
3178 reg_get_value()
3180     # Return value: $regvalue
3181     unset regvalue
3183     local _regentry="/proc/registry${1}/${2}"
3184     if test -f "$_regentry"; then
3185         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3186         # Registry keys read via /proc/registry* are always \0 terminated!
3187         local _regvalue=$(tr -d '\0' < "$_regentry")
3188         if test $? -eq 0; then
3189             regvalue=$_regvalue
3190         fi
3191     fi
3194 # Get a value from the 32-bit side of the Registry
3195 reg_get_value_32()
3197     reg_get_value "32" "$1"
3200 # Get a value from the 64-bit side of the Registry
3201 reg_get_value_64()
3203     reg_get_value "64" "$1"
3206 if test "$_os" = "WINNT"; then
3207     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3208     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3209         AC_MSG_RESULT([no])
3210         WINDOWS_SDK_ARCH="x86"
3211     else
3212         AC_MSG_RESULT([yes])
3213         WINDOWS_SDK_ARCH="x64"
3214         BITNESS_OVERRIDE=64
3215     fi
3217 if test "$_os" = "iOS"; then
3218     cross_compiling="yes"
3221 if test "$cross_compiling" = "yes"; then
3222     export CROSS_COMPILING=TRUE
3223 else
3224     CROSS_COMPILING=
3225     BUILD_TYPE="$BUILD_TYPE NATIVE"
3227 AC_SUBST(CROSS_COMPILING)
3229 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3230 # NOTE: must _not_ be used for bundled external libraries!
3231 ISYSTEM=
3232 if test "$GCC" = "yes"; then
3233     AC_MSG_CHECKING( for -isystem )
3234     save_CFLAGS=$CFLAGS
3235     CFLAGS="$CFLAGS -Werror"
3236     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3237     CFLAGS=$save_CFLAGS
3238     if test -n "$ISYSTEM"; then
3239         AC_MSG_RESULT(yes)
3240     else
3241         AC_MSG_RESULT(no)
3242     fi
3244 if test -z "$ISYSTEM"; then
3245     # fall back to using -I
3246     ISYSTEM=-I
3248 AC_SUBST(ISYSTEM)
3250 dnl ===================================================================
3251 dnl  Check which Visual Studio compiler is used
3252 dnl ===================================================================
3254 map_vs_year_to_version()
3256     # Return value: $vsversion
3258     unset vsversion
3260     case $1 in
3261     2017)
3262         vsversion=15;;
3263     2019)
3264         vsversion=16;;
3265     *)
3266         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3267     esac
3270 vs_versions_to_check()
3272     # Args: $1 (optional) : versions to check, in the order of preference
3273     # Return value: $vsversions
3275     unset vsversions
3277     if test -n "$1"; then
3278         map_vs_year_to_version "$1"
3279         vsversions=$vsversion
3280     else
3281         # We accept only 2017
3282         vsversions="15"
3283     fi
3286 win_get_env_from_vsvars32bat()
3288     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3289     # Also seems to be located in another directory under the same name: vsvars32.bat
3290     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3291     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3292     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3293     chmod +x $WRAPPERBATCHFILEPATH
3294     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3295     rm -f $WRAPPERBATCHFILEPATH
3296     printf '%s' "$_win_get_env_from_vsvars32bat"
3299 find_ucrt()
3301     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3302     if test -n "$regvalue"; then
3303         PathFormat "$regvalue"
3304         UCRTSDKDIR=$formatted_path
3305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3306         UCRTVERSION=$regvalue
3307         # Rest if not exist
3308         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3309           UCRTSDKDIR=
3310         fi
3311     fi
3312     if test -z "$UCRTSDKDIR"; then
3313         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3314         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3315         if test -f "$ide_env_file"; then
3316             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3317             UCRTSDKDIR=$formatted_path
3318             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3319             dnl Hack needed at least by tml:
3320             if test "$UCRTVERSION" = 10.0.15063.0 \
3321                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3322                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3323             then
3324                 UCRTVERSION=10.0.14393.0
3325             fi
3326         else
3327           AC_MSG_ERROR([No UCRT found])
3328         fi
3329     fi
3332 find_msvc()
3334     # Find Visual C++ 2017/2019
3335     # Args: $1 (optional) : The VS version year
3336     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3338     unset vctest vcnum vcnumwithdot vcbuildnumber
3340     vs_versions_to_check "$1"
3341     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3342     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3343     PathFormat "$vswhere"
3344     vswhere=$formatted_path
3345     for ver in $vsversions; do
3346         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3347         if test -n "$vswhereoutput"; then
3348             PathFormat "$vswhereoutput"
3349             vctest=$formatted_path
3350             break
3351         fi
3352     done
3354     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3355     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3356     # should be removed when upgrading baseline.
3357     if ! test -n "$vctest"; then
3358         for ver in $vsversions; do
3359             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3360             if test -n "$regvalue"; then
3361                 vctest=$regvalue
3362                 break
3363             fi
3364             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3365             if test -n "$regvalue"; then
3366                 AC_MSG_RESULT([found: $regvalue])
3367                 PathFormat "$regvalue"
3368                 vctest=$formatted_path
3369                 break
3370             fi
3371         done
3372     fi
3374     if test -n "$vctest"; then
3375         vcnumwithdot="$ver.0"
3376         case "$vcnumwithdot" in
3377         15.0)
3378             vcyear=2017
3379             vcnum=150
3380             ;;
3381         16.0)
3382             vcyear=2019
3383             vcnum=160
3384             ;;
3385         esac
3386         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3388     fi
3391 SOLARINC=
3392 MSBUILD_PATH=
3393 DEVENV=
3394 if test "$_os" = "WINNT"; then
3395     AC_MSG_CHECKING([Visual C++])
3396     find_msvc "$with_visual_studio"
3397     if test -z "$vctest"; then
3398         if test -n "$with_visual_studio"; then
3399             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3400         else
3401             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3402         fi
3403     fi
3405     if test "$BITNESS_OVERRIDE" = ""; then
3406         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3407             VC_PRODUCT_DIR=$vctest/VC
3408         else
3409             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3410         fi
3411     else
3412         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3413             VC_PRODUCT_DIR=$vctest/VC
3414         else
3415             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3416         fi
3417     fi
3418     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3420     AC_MSG_CHECKING([for short pathname of VC product directory])
3421     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3422     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3424     UCRTSDKDIR=
3425     UCRTVERSION=
3427     AC_MSG_CHECKING([for UCRT location])
3428     find_ucrt
3429     # find_ucrt errors out if it doesn't find it
3430     AC_MSG_RESULT([found])
3431     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3432     ucrtincpath_formatted=$formatted_path
3433     # SOLARINC is used for external modules and must be set too.
3434     # And no, it's not sufficient to set SOLARINC only, as configure
3435     # itself doesn't honour it.
3436     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3437     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3438     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3439     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3441     AC_SUBST(UCRTSDKDIR)
3442     AC_SUBST(UCRTVERSION)
3444     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3445     # Find the proper version of MSBuild.exe to use based on the VS version
3446     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3447     if test -n "$regvalue" ; then
3448         AC_MSG_RESULT([found: $regvalue])
3449         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3450     else
3451         if test "$vcnumwithdot" = "16.0"; then
3452             if test "$BITNESS_OVERRIDE" = ""; then
3453                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3454             else
3455                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3456             fi
3457         else
3458             if test "$BITNESS_OVERRIDE" = ""; then
3459                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3460             else
3461                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3462             fi
3463         fi
3464         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3465         AC_MSG_RESULT([$regvalue])
3466     fi
3468     # Find the version of devenv.exe
3469     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3470     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3471     if test ! -e "$DEVENV"; then
3472         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3473     fi
3475     dnl ===========================================================
3476     dnl  Check for the corresponding mspdb*.dll
3477     dnl ===========================================================
3479     VC_HOST_DIR=
3480     MSPDB_PATH=
3481     CL_PATH=
3483     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3484         VC_HOST_DIR="HostX64"
3485         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3486     else
3487         VC_HOST_DIR="HostX86"
3488         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3489     fi
3491     if test "$BITNESS_OVERRIDE" = ""; then
3492         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3493     else
3494         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3495     fi
3497     # MSVC 15.0 has libraries from 14.0?
3498     mspdbnum="140"
3500     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3501         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3502     fi
3504     dnl The path needs to be added before cl is called
3505     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3506     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3508     AC_MSG_CHECKING([cl.exe])
3510     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3511     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3512     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3513     # is not enough?
3515     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3516     dnl needed when building CLR code:
3517     if test -z "$MSVC_CXX"; then
3518         if test -f "$CL_PATH/cl.exe"; then
3519             MSVC_CXX="$CL_PATH/cl.exe"
3520         fi
3522         # This gives us a posix path with 8.3 filename restrictions
3523         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3524         CXX_BASE=`first_arg_basename "$MSVC_CXX"`
3525     fi
3527     if test -z "$CC"; then
3528         CC=$MSVC_CXX
3529         CC_BASE=`first_arg_basename "$CC"`
3530     fi
3531     if test "$BITNESS_OVERRIDE" = ""; then
3532         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3533         MSVC_CXX="$MSVC_CXX -arch:SSE"
3534     fi
3536     if test -n "$CC"; then
3537         # Remove /cl.exe from CC case insensitive
3538         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3539         if test "$BITNESS_OVERRIDE" = ""; then
3540            COMPATH="$VC_PRODUCT_DIR"
3541         else
3542             if test -n "$VC_PRODUCT_DIR"; then
3543                 COMPATH=$VC_PRODUCT_DIR
3544             fi
3545         fi
3546         if test "$BITNESS_OVERRIDE" = ""; then
3547             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3548             CC="$CC -arch:SSE"
3549         fi
3551         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3553         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3555         PathFormat "$COMPATH"
3556         COMPATH=`win_short_path_for_make "$formatted_path"`
3558         VCVER=$vcnum
3559         MSVSVER=$vcyear
3561         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3562         # are always "better", we list them in reverse chronological order.
3564         case "$vcnum" in
3565         150|160)
3566             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3567             ;;
3568         esac
3570         # The expectation is that --with-windows-sdk should not need to be used
3571         if test -n "$with_windows_sdk"; then
3572             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3573             *" "$with_windows_sdk" "*)
3574                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3575                 ;;
3576             *)
3577                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3578                 ;;
3579             esac
3580         fi
3582         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3583         ac_objext=obj
3584         ac_exeext=exe
3586     else
3587         AC_MSG_ERROR([Visual C++ not found after all, huh])
3588     fi
3590     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3591     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3592         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3593         // between Visual Studio versions and _MSC_VER:
3594         #if _MSC_VER < 1914
3595         #error
3596         #endif
3597     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3599     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3600     # version of the Explorer extension (and maybe other small
3601     # bits, too) needed when installing a 32-bit LibreOffice on a
3602     # 64-bit OS. The 64-bit Explorer extension is a feature that
3603     # has been present since long in OOo. Don't confuse it with
3604     # building LibreOffice itself as 64-bit code.
3606     BUILD_X64=
3607     CXX_X64_BINARY=
3609     if test "$BITNESS_OVERRIDE" = ""; then
3610         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3611         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3612              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3613             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3614                 BUILD_X64=TRUE
3615                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3616             fi
3617         fi
3618         if test "$BUILD_X64" = TRUE; then
3619             AC_MSG_RESULT([found])
3620         else
3621             AC_MSG_RESULT([not found])
3622             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3623         fi
3624     else
3625         CXX_X64_BINARY=$MSVC_CXX
3626     fi
3627     AC_SUBST(BUILD_X64)
3629     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3630     AC_SUBST(CXX_X64_BINARY)
3632     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3633     # needed to support TWAIN scan on both 32- and 64-bit systems
3635     BUILD_X86=
3637     if test "$BITNESS_OVERRIDE" = "64"; then
3638         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3639         if test -n "$CXX_X86_BINARY"; then
3640             BUILD_X86=TRUE
3641             AC_MSG_RESULT([preset])
3642         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3643             BUILD_X86=TRUE
3644             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3645             CXX_X86_BINARY+=" /arch:SSE"
3646             AC_MSG_RESULT([found])
3647         else
3648             CXX_X86_BINARY=
3649             AC_MSG_RESULT([not found])
3650             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3651         fi
3652     else
3653         BUILD_X86=TRUE
3654         CXX_X86_BINARY=$MSVC_CXX
3655     fi
3656     AC_SUBST(BUILD_X86)
3657     AC_SUBST(CXX_X86_BINARY)
3659 AC_SUBST(VCVER)
3660 AC_SUBST(DEVENV)
3661 AC_SUBST(MSVC_CXX)
3664 # unowinreg.dll
3666 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3667 AC_SUBST(UNOWINREG_DLL)
3669 COM_IS_CLANG=
3670 AC_MSG_CHECKING([whether the compiler is actually Clang])
3671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3672     #ifndef __clang__
3673     you lose
3674     #endif
3675     int foo=42;
3676     ]])],
3677     [AC_MSG_RESULT([yes])
3678      COM_IS_CLANG=TRUE],
3679     [AC_MSG_RESULT([no])])
3680 AC_SUBST(COM_IS_CLANG)
3682 CC_PLAIN=$CC
3683 CLANGVER=
3684 if test "$COM_IS_CLANG" = TRUE; then
3685     AC_MSG_CHECKING([whether Clang is new enough])
3686     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3687         #if !defined __apple_build_version__
3688         #error
3689         #endif
3690         ]])],
3691         [my_apple_clang=yes],[my_apple_clang=])
3692     if test "$my_apple_clang" = yes; then
3693         AC_MSG_RESULT([assumed yes (Apple Clang)])
3694     else
3695         if test "$_os" = WINNT; then
3696             dnl In which case, assume clang-cl:
3697             my_args="/EP /TC"
3698             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3699             dnl clang-cl:
3700             CC_PLAIN=
3701             for i in $CC; do
3702                 case $i in
3703                 -FIIntrin.h)
3704                     ;;
3705                 *)
3706                     CC_PLAIN="$CC_PLAIN $i"
3707                     ;;
3708                 esac
3709             done
3710         else
3711             my_args="-E -P"
3712         fi
3713         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3714         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3715         CLANGVER=`echo $clang_version \
3716             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3717         if test "$CLANGVER" -ge 50002; then
3718             AC_MSG_RESULT([yes ($clang_version)])
3719         else
3720             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3721         fi
3722         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3723         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3724     fi
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_BASE 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         CC_BASE="ccache $CC_BASE"
3761         AC_MSG_RESULT([no])
3762     fi
3763     CFLAGS=$save_CFLAGS
3764     AC_LANG_POP([C])
3767 # ===================================================================
3768 # check various GCC options that Clang does not support now but maybe
3769 # will somewhen in the future, check them even for GCC, so that the
3770 # flags are set
3771 # ===================================================================
3773 HAVE_GCC_GGDB2=
3774 if test "$GCC" = "yes"; then
3775     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3776     save_CFLAGS=$CFLAGS
3777     CFLAGS="$CFLAGS -Werror -ggdb2"
3778     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3779     CFLAGS=$save_CFLAGS
3780     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3781         AC_MSG_RESULT([yes])
3782     else
3783         AC_MSG_RESULT([no])
3784     fi
3786     if test "$host_cpu" = "m68k"; then
3787         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3788         save_CFLAGS=$CFLAGS
3789         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3790         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3791         CFLAGS=$save_CFLAGS
3792         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3793             AC_MSG_RESULT([yes])
3794         else
3795             AC_MSG_ERROR([no])
3796         fi
3797     fi
3799 AC_SUBST(HAVE_GCC_GGDB2)
3801 dnl ===================================================================
3802 dnl  Test the gcc version
3803 dnl ===================================================================
3804 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3805     AC_MSG_CHECKING([the GCC version])
3806     _gcc_version=`$CC -dumpversion`
3807     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3808         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3809     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3811     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3813     if test "$gcc_full_version" -lt 70000; then
3814         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3815     fi
3816 else
3817     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3818     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3819     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3820     # (which reports itself as GCC 4.2.1).
3821     GCC_VERSION=
3823 AC_SUBST(GCC_VERSION)
3825 dnl Set the ENABLE_DBGUTIL variable
3826 dnl ===================================================================
3827 AC_MSG_CHECKING([whether to build with additional debug utilities])
3828 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3829     ENABLE_DBGUTIL="TRUE"
3830     # this is an extra var so it can have different default on different MSVC
3831     # versions (in case there are version specific problems with it)
3832     MSVC_USE_DEBUG_RUNTIME="TRUE"
3834     AC_MSG_RESULT([yes])
3835     # cppunit and graphite expose STL in public headers
3836     if test "$with_system_cppunit" = "yes"; then
3837         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3838     else
3839         with_system_cppunit=no
3840     fi
3841     if test "$with_system_graphite" = "yes"; then
3842         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3843     else
3844         with_system_graphite=no
3845     fi
3846     if test "$with_system_orcus" = "yes"; then
3847         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3848     else
3849         with_system_orcus=no
3850     fi
3851     if test "$with_system_libcmis" = "yes"; then
3852         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3853     else
3854         with_system_libcmis=no
3855     fi
3856     if test "$with_system_hunspell" = "yes"; then
3857         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3858     else
3859         with_system_hunspell=no
3860     fi
3861     if test "$with_system_gpgmepp" = "yes"; then
3862         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3863     else
3864         with_system_gpgmepp=no
3865     fi
3866     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3867     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3868     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3869     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3870     # of those two is using the system variant:
3871     if test "$with_system_libnumbertext" = "yes"; then
3872         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3873     else
3874         with_system_libnumbertext=no
3875     fi
3876     if test "$with_system_libwps" = "yes"; then
3877         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3878     else
3879         with_system_libwps=no
3880     fi
3881 else
3882     ENABLE_DBGUTIL=""
3883     MSVC_USE_DEBUG_RUNTIME=""
3884     AC_MSG_RESULT([no])
3886 AC_SUBST(ENABLE_DBGUTIL)
3887 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3889 dnl Set the ENABLE_DEBUG variable.
3890 dnl ===================================================================
3891 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3892     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3894 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3895     if test -z "$libo_fuzzed_enable_debug"; then
3896         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3897     else
3898         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3899         enable_debug=yes
3900     fi
3903 AC_MSG_CHECKING([whether to do a debug build])
3904 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3905     ENABLE_DEBUG="TRUE"
3906     if test -n "$ENABLE_DBGUTIL" ; then
3907         AC_MSG_RESULT([yes (dbgutil)])
3908     else
3909         AC_MSG_RESULT([yes])
3910     fi
3911 else
3912     ENABLE_DEBUG=""
3913     AC_MSG_RESULT([no])
3915 AC_SUBST(ENABLE_DEBUG)
3917 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3918 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3919 dnl Clang 9 is known fixed since
3920 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3921 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3922 if test "$COM_IS_CLANG" = TRUE -a "$_os" = Linux; then
3923     if test "$CLANGVER" -lt 90000; then
3924         for i in $CC; do
3925             case $i in
3926             -fsanitize=*)
3927                 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3928                 break
3929                 ;;
3930             esac
3931         done
3932     fi
3934 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3935     AC_MSG_RESULT([yes])
3936 else
3937     AC_MSG_RESULT([no])
3939 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3941 dnl ===================================================================
3942 dnl Select the linker to use (gold/lld/ld.bfd).
3943 dnl This is done only after compiler checks (need to know if Clang is
3944 dnl used, for different defaults) and after checking if a debug build
3945 dnl is wanted (non-debug builds get the default linker if not explicitly
3946 dnl specified otherwise).
3947 dnl All checks for linker features/options should come after this.
3948 dnl ===================================================================
3949 check_use_ld()
3951     use_ld=$1
3952     use_ld_fail_if_error=$2
3953     use_ld_ok=
3954     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3955     use_ld_ldflags_save="$LDFLAGS"
3956     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3957     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3958 #include <stdio.h>
3959         ],[
3960 printf ("hello world\n");
3961         ])], USE_LD=$use_ld, [])
3962     if test -n "$USE_LD"; then
3963         AC_MSG_RESULT( yes )
3964         use_ld_ok=yes
3965         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3966         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3967         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3968             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3969             use_ld_ldflags_save_2="$LDFLAGS"
3970             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3971             use_ld_has_cpp_typeinfo=
3972             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3973 #include <stdio.h>
3974                 ],[
3975 printf ("hello world\n");
3976                 ])], use_ld_has_cpp_typeinfo=yes, [])
3977             LDFLAGS="$use_ld_ldflags_save_2"
3978             if test -n "$use_ld_has_cpp_typeinfo"; then
3979                 AC_MSG_RESULT( yes )
3980             else
3981                 if test -n "$use_ld_fail_if_error"; then
3982                     AC_MSG_ERROR( no )
3983                 else
3984                     AC_MSG_RESULT( no )
3985                 fi
3986                 use_ld_ok=
3987             fi
3988         fi
3989     else
3990         if test -n "$use_ld_fail_if_error"; then
3991             AC_MSG_ERROR( no )
3992         else
3993             AC_MSG_RESULT( no )
3994         fi
3995     fi
3996     if test -n "$use_ld_ok"; then
3997         dnl keep the value of LDFLAGS
3998         return 0
3999     fi
4000     LDFLAGS="$use_ld_ldflags_save"
4001     return 1
4003 USE_LD=
4004 if test "$enable_ld" != "no"; then
4005     if test "$GCC" = "yes"; then
4006         if test -n "$enable_ld"; then
4007             check_use_ld "$enable_ld" fail_if_error
4008         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4009             dnl non-debug builds default to the default linker
4010             true
4011         elif test -n "$COM_IS_CLANG"; then
4012             check_use_ld lld
4013             if test $? -ne 0; then
4014                 check_use_ld gold
4015             fi
4016         else
4017             # For gcc first try gold, new versions also support lld.
4018             check_use_ld gold
4019             if test $? -ne 0; then
4020                 check_use_ld lld
4021             fi
4022         fi
4023         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4024         rm conftest.out
4025         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4026         if test -z "$ld_used"; then
4027             ld_used="unknown"
4028         fi
4029         AC_MSG_CHECKING([for linker that is used])
4030         AC_MSG_RESULT([$ld_used])
4031         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4032             if echo "$ld_used" | grep -q "^GNU ld"; then
4033                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4034                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4035             fi
4036         fi
4037     else
4038         if test "$enable_ld" = "yes"; then
4039             AC_MSG_ERROR([--enable-ld not supported])
4040         fi
4041     fi
4043 AC_SUBST(USE_LD)
4045 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4046 if test "$GCC" = "yes"; then
4047     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4048     bsymbolic_functions_ldflags_save=$LDFLAGS
4049     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4050     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4051 #include <stdio.h>
4052         ],[
4053 printf ("hello world\n");
4054         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4055     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4056         AC_MSG_RESULT( found )
4057     else
4058         AC_MSG_RESULT( not found )
4059     fi
4060     LDFLAGS=$bsymbolic_functions_ldflags_save
4062 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4065 HAVE_GSPLIT_DWARF=
4066 if test "$enable_split_debug" != no; then
4067     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4068     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4069         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4070         save_CFLAGS=$CFLAGS
4071         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4072         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4073         CFLAGS=$save_CFLAGS
4074         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4075             AC_MSG_RESULT([yes])
4076         else
4077             if test "$enable_split_debug" = yes; then
4078                 AC_MSG_ERROR([no])
4079             else
4080                 AC_MSG_RESULT([no])
4081             fi
4082         fi
4083     fi
4084     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4085         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4086         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4087     fi
4089 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4091 ENABLE_GDB_INDEX=
4092 if test "$enable_gdb_index" != "no"; then
4093     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4094     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4095         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4096         save_CFLAGS=$CFLAGS
4097         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4098         have_ggnu_pubnames=
4099         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4100         if test "$have_ggnu_pubnames" != "TRUE"; then
4101             if test "$enable_gdb_index" = "yes"; then
4102                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4103             else
4104                 AC_MSG_RESULT( no )
4105             fi
4106         else
4107             AC_MSG_RESULT( yes )
4108             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4109             ldflags_save=$LDFLAGS
4110             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4111             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4112 #include <stdio.h>
4113                 ],[
4114 printf ("hello world\n");
4115                 ])], ENABLE_GDB_INDEX=TRUE, [])
4116             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4117                 AC_MSG_RESULT( yes )
4118             else
4119                 if test "$enable_gdb_index" = "yes"; then
4120                     AC_MSG_ERROR( no )
4121                 else
4122                     AC_MSG_RESULT( no )
4123                 fi
4124             fi
4125             LDFLAGS=$ldflags_save
4126         fi
4127         CFLAGS=$save_CFLAGS
4128         fi
4129     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4130         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4131         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4132     fi
4134 AC_SUBST(ENABLE_GDB_INDEX)
4136 if test "$enable_sal_log" = yes; then
4137     ENABLE_SAL_LOG=TRUE
4139 AC_SUBST(ENABLE_SAL_LOG)
4141 dnl Check for enable symbols option
4142 dnl ===================================================================
4143 AC_MSG_CHECKING([whether to generate debug information])
4144 if test -z "$enable_symbols"; then
4145     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4146         enable_symbols=yes
4147     else
4148         enable_symbols=no
4149     fi
4151 if test "$enable_symbols" = yes; then
4152     ENABLE_SYMBOLS_FOR=all
4153     AC_MSG_RESULT([yes])
4154 elif test "$enable_symbols" = no; then
4155     ENABLE_SYMBOLS_FOR=
4156     AC_MSG_RESULT([no])
4157 else
4158     # Selective debuginfo.
4159     ENABLE_SYMBOLS_FOR="$enable_symbols"
4160     AC_MSG_RESULT([for "$enable_symbols"])
4162 AC_SUBST(ENABLE_SYMBOLS_FOR)
4164 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4165     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4166     AC_MSG_CHECKING([whether enough memory is available for linking])
4167     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4168     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4169     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4170         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4171     else
4172         AC_MSG_RESULT([yes])
4173     fi
4176 AC_MSG_CHECKING([whether to compile with optimization flags])
4177 if test -z "$enable_optimized"; then
4178     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4179         enable_optimized=no
4180     else
4181         enable_optimized=yes
4182     fi
4184 if test "$enable_optimized" != no; then
4185     ENABLE_OPTIMIZED=TRUE
4186     AC_MSG_RESULT([yes])
4187 else
4188     ENABLE_OPTIMIZED=
4189     AC_MSG_RESULT([no])
4191 AC_SUBST(ENABLE_OPTIMIZED)
4194 # determine CPUNAME, OS, ...
4195 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4197 case "$host_os" in
4199 aix*)
4200     COM=GCC
4201     CPUNAME=POWERPC
4202     USING_X11=TRUE
4203     OS=AIX
4204     RTL_OS=AIX
4205     RTL_ARCH=PowerPC
4206     PLATFORMID=aix_powerpc
4207     P_SEP=:
4208     ;;
4210 cygwin*)
4211     COM=MSC
4212     USING_X11=
4213     OS=WNT
4214     RTL_OS=Windows
4215     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4216         P_SEP=";"
4217     else
4218         P_SEP=:
4219     fi
4220     case "$host_cpu" in
4221     i*86|x86_64)
4222         if test "$BITNESS_OVERRIDE" = 64; then
4223             CPUNAME=X86_64
4224             RTL_ARCH=X86_64
4225             PLATFORMID=windows_x86_64
4226             WINDOWS_X64=1
4227             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4228         else
4229             CPUNAME=INTEL
4230             RTL_ARCH=x86
4231             PLATFORMID=windows_x86
4232         fi
4233         ;;
4234     *)
4235         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4236         ;;
4237     esac
4238     SCPDEFS="$SCPDEFS -D_MSC_VER"
4239     ;;
4241 darwin*)
4242     COM=GCC
4243     USING_X11=
4244     OS=MACOSX
4245     RTL_OS=MacOSX
4246     P_SEP=:
4248     case "$host_cpu" in
4249     arm)
4250         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4251         ;;
4252     arm64)
4253         OS=iOS
4254         if test "$enable_ios_simulator" = "yes"; then
4255             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4256         else
4257             CPUNAME=ARM64
4258             RTL_ARCH=ARM_EABI
4259             PLATFORMID=ios_arm64
4260         fi
4261         ;;
4262     i*86)
4263         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4264         ;;
4265     x86_64)
4266         if test "$enable_ios_simulator" = "yes"; then
4267             OS=iOS
4268         fi
4269         CPUNAME=X86_64
4270         RTL_ARCH=X86_64
4271         PLATFORMID=macosx_x86_64
4272         ;;
4273     *)
4274         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4275         ;;
4276     esac
4277     ;;
4279 dragonfly*)
4280     COM=GCC
4281     USING_X11=TRUE
4282     OS=DRAGONFLY
4283     RTL_OS=DragonFly
4284     P_SEP=:
4286     case "$host_cpu" in
4287     i*86)
4288         CPUNAME=INTEL
4289         RTL_ARCH=x86
4290         PLATFORMID=dragonfly_x86
4291         ;;
4292     x86_64)
4293         CPUNAME=X86_64
4294         RTL_ARCH=X86_64
4295         PLATFORMID=dragonfly_x86_64
4296         ;;
4297     *)
4298         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4299         ;;
4300     esac
4301     ;;
4303 freebsd*)
4304     COM=GCC
4305     USING_X11=TRUE
4306     RTL_OS=FreeBSD
4307     OS=FREEBSD
4308     P_SEP=:
4310     case "$host_cpu" in
4311     i*86)
4312         CPUNAME=INTEL
4313         RTL_ARCH=x86
4314         PLATFORMID=freebsd_x86
4315         ;;
4316     x86_64|amd64)
4317         CPUNAME=X86_64
4318         RTL_ARCH=X86_64
4319         PLATFORMID=freebsd_x86_64
4320         ;;
4321     *)
4322         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4323         ;;
4324     esac
4325     ;;
4327 haiku*)
4328     COM=GCC
4329     USING_X11=
4330     GUIBASE=haiku
4331     RTL_OS=Haiku
4332     OS=HAIKU
4333     P_SEP=:
4335     case "$host_cpu" in
4336     i*86)
4337         CPUNAME=INTEL
4338         RTL_ARCH=x86
4339         PLATFORMID=haiku_x86
4340         ;;
4341     x86_64|amd64)
4342         CPUNAME=X86_64
4343         RTL_ARCH=X86_64
4344         PLATFORMID=haiku_x86_64
4345         ;;
4346     *)
4347         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4348         ;;
4349     esac
4350     ;;
4352 kfreebsd*)
4353     COM=GCC
4354     USING_X11=TRUE
4355     OS=LINUX
4356     RTL_OS=kFreeBSD
4357     P_SEP=:
4359     case "$host_cpu" in
4361     i*86)
4362         CPUNAME=INTEL
4363         RTL_ARCH=x86
4364         PLATFORMID=kfreebsd_x86
4365         ;;
4366     x86_64)
4367         CPUNAME=X86_64
4368         RTL_ARCH=X86_64
4369         PLATFORMID=kfreebsd_x86_64
4370         ;;
4371     *)
4372         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4373         ;;
4374     esac
4375     ;;
4377 linux-gnu*)
4378     COM=GCC
4379     USING_X11=TRUE
4380     OS=LINUX
4381     RTL_OS=Linux
4382     P_SEP=:
4384     case "$host_cpu" in
4386     aarch64)
4387         CPUNAME=AARCH64
4388         PLATFORMID=linux_aarch64
4389         RTL_ARCH=AARCH64
4390         ;;
4391     alpha)
4392         CPUNAME=AXP
4393         RTL_ARCH=ALPHA
4394         PLATFORMID=linux_alpha
4395         ;;
4396     arm*)
4397         CPUNAME=ARM
4398         EPM_FLAGS="-a arm"
4399         RTL_ARCH=ARM_EABI
4400         PLATFORMID=linux_arm_eabi
4401         case "$host_cpu" in
4402         arm*-linux)
4403             RTL_ARCH=ARM_OABI
4404             PLATFORMID=linux_arm_oabi
4405             ;;
4406         esac
4407         ;;
4408     hppa)
4409         CPUNAME=HPPA
4410         RTL_ARCH=HPPA
4411         EPM_FLAGS="-a hppa"
4412         PLATFORMID=linux_hppa
4413         ;;
4414     i*86)
4415         CPUNAME=INTEL
4416         RTL_ARCH=x86
4417         PLATFORMID=linux_x86
4418         ;;
4419     ia64)
4420         CPUNAME=IA64
4421         RTL_ARCH=IA64
4422         PLATFORMID=linux_ia64
4423         ;;
4424     mips)
4425         CPUNAME=GODSON
4426         RTL_ARCH=MIPS_EB
4427         EPM_FLAGS="-a mips"
4428         PLATFORMID=linux_mips_eb
4429         ;;
4430     mips64)
4431         CPUNAME=GODSON64
4432         RTL_ARCH=MIPS64_EB
4433         EPM_FLAGS="-a mips64"
4434         PLATFORMID=linux_mips64_eb
4435         ;;
4436     mips64el)
4437         CPUNAME=GODSON64
4438         RTL_ARCH=MIPS64_EL
4439         EPM_FLAGS="-a mips64el"
4440         PLATFORMID=linux_mips64_el
4441         ;;
4442     mipsel)
4443         CPUNAME=GODSON
4444         RTL_ARCH=MIPS_EL
4445         EPM_FLAGS="-a mipsel"
4446         PLATFORMID=linux_mips_el
4447         ;;
4448     m68k)
4449         CPUNAME=M68K
4450         RTL_ARCH=M68K
4451         PLATFORMID=linux_m68k
4452         ;;
4453     powerpc)
4454         CPUNAME=POWERPC
4455         RTL_ARCH=PowerPC
4456         PLATFORMID=linux_powerpc
4457         ;;
4458     powerpc64)
4459         CPUNAME=POWERPC64
4460         RTL_ARCH=PowerPC_64
4461         PLATFORMID=linux_powerpc64
4462         ;;
4463     powerpc64le)
4464         CPUNAME=POWERPC64
4465         RTL_ARCH=PowerPC_64_LE
4466         PLATFORMID=linux_powerpc64_le
4467         ;;
4468     sparc)
4469         CPUNAME=SPARC
4470         RTL_ARCH=SPARC
4471         PLATFORMID=linux_sparc
4472         ;;
4473     sparc64)
4474         CPUNAME=SPARC64
4475         RTL_ARCH=SPARC64
4476         PLATFORMID=linux_sparc64
4477         ;;
4478     s390)
4479         CPUNAME=S390
4480         RTL_ARCH=S390
4481         PLATFORMID=linux_s390
4482         ;;
4483     s390x)
4484         CPUNAME=S390X
4485         RTL_ARCH=S390x
4486         PLATFORMID=linux_s390x
4487         ;;
4488     x86_64)
4489         CPUNAME=X86_64
4490         RTL_ARCH=X86_64
4491         PLATFORMID=linux_x86_64
4492         ;;
4493     *)
4494         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4495         ;;
4496     esac
4497     ;;
4499 linux-android*)
4500     COM=GCC
4501     USING_X11=
4502     OS=ANDROID
4503     RTL_OS=Android
4504     P_SEP=:
4506     case "$host_cpu" in
4508     arm|armel)
4509         CPUNAME=ARM
4510         RTL_ARCH=ARM_EABI
4511         PLATFORMID=android_arm_eabi
4512         ;;
4513     aarch64)
4514         CPUNAME=AARCH64
4515         RTL_ARCH=AARCH64
4516         PLATFORMID=android_aarch64
4517         ;;
4518     i*86)
4519         CPUNAME=INTEL
4520         RTL_ARCH=x86
4521         PLATFORMID=android_x86
4522         ;;
4523     *)
4524         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4525         ;;
4526     esac
4527     ;;
4529 *netbsd*)
4530     COM=GCC
4531     USING_X11=TRUE
4532     OS=NETBSD
4533     RTL_OS=NetBSD
4534     P_SEP=:
4536     case "$host_cpu" in
4537     i*86)
4538         CPUNAME=INTEL
4539         RTL_ARCH=x86
4540         PLATFORMID=netbsd_x86
4541         ;;
4542     powerpc)
4543         CPUNAME=POWERPC
4544         RTL_ARCH=PowerPC
4545         PLATFORMID=netbsd_powerpc
4546         ;;
4547     sparc)
4548         CPUNAME=SPARC
4549         RTL_ARCH=SPARC
4550         PLATFORMID=netbsd_sparc
4551         ;;
4552     x86_64)
4553         CPUNAME=X86_64
4554         RTL_ARCH=X86_64
4555         PLATFORMID=netbsd_x86_64
4556         ;;
4557     *)
4558         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4559         ;;
4560     esac
4561     ;;
4563 openbsd*)
4564     COM=GCC
4565     USING_X11=TRUE
4566     OS=OPENBSD
4567     RTL_OS=OpenBSD
4568     P_SEP=:
4570     case "$host_cpu" in
4571     i*86)
4572         CPUNAME=INTEL
4573         RTL_ARCH=x86
4574         PLATFORMID=openbsd_x86
4575         ;;
4576     x86_64)
4577         CPUNAME=X86_64
4578         RTL_ARCH=X86_64
4579         PLATFORMID=openbsd_x86_64
4580         ;;
4581     *)
4582         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4583         ;;
4584     esac
4585     SOLARINC="$SOLARINC -I/usr/local/include"
4586     ;;
4588 solaris*)
4589     COM=GCC
4590     USING_X11=TRUE
4591     OS=SOLARIS
4592     RTL_OS=Solaris
4593     P_SEP=:
4595     case "$host_cpu" in
4596     i*86)
4597         CPUNAME=INTEL
4598         RTL_ARCH=x86
4599         PLATFORMID=solaris_x86
4600         ;;
4601     sparc)
4602         CPUNAME=SPARC
4603         RTL_ARCH=SPARC
4604         PLATFORMID=solaris_sparc
4605         ;;
4606     sparc64)
4607         CPUNAME=SPARC64
4608         RTL_ARCH=SPARC64
4609         PLATFORMID=solaris_sparc64
4610         ;;
4611     *)
4612         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4613         ;;
4614     esac
4615     SOLARINC="$SOLARINC -I/usr/local/include"
4616     ;;
4619     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4620     ;;
4621 esac
4623 if test "$with_x" = "no"; then
4624     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4627 DISABLE_GUI=""
4628 if test "$enable_gui" = "no"; then
4629     if test "$USING_X11" != TRUE; then
4630         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4631     fi
4632     USING_X11=
4633     DISABLE_GUI=TRUE
4634     AC_DEFINE(HAVE_FEATURE_UI,0)
4635     test_cairo=yes
4637 AC_SUBST(DISABLE_GUI)
4639 WORKDIR="${BUILDDIR}/workdir"
4640 INSTDIR="${BUILDDIR}/instdir"
4641 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4642 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4643 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4644 AC_SUBST(COM)
4645 AC_SUBST(CPUNAME)
4646 AC_SUBST(RTL_OS)
4647 AC_SUBST(RTL_ARCH)
4648 AC_SUBST(EPM_FLAGS)
4649 AC_SUBST(USING_X11)
4650 AC_SUBST([INSTDIR])
4651 AC_SUBST([INSTROOT])
4652 AC_SUBST([INSTROOTBASE])
4653 AC_SUBST(OS)
4654 AC_SUBST(P_SEP)
4655 AC_SUBST(WORKDIR)
4656 AC_SUBST(PLATFORMID)
4657 AC_SUBST(WINDOWS_X64)
4658 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4660 dnl ===================================================================
4661 dnl Test which package format to use
4662 dnl ===================================================================
4663 AC_MSG_CHECKING([which package format to use])
4664 if test -n "$with_package_format" -a "$with_package_format" != no; then
4665     for i in $with_package_format; do
4666         case "$i" in
4667         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4668             ;;
4669         *)
4670             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4671 aix - AIX software distribution
4672 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4673 deb - Debian software distribution
4674 pkg - Solaris software distribution
4675 rpm - RedHat software distribution
4677 LibreOffice additionally supports:
4678 archive - .tar.gz or .zip
4679 dmg - macOS .dmg
4680 installed - installation tree
4681 msi - Windows .msi
4682         ])
4683             ;;
4684         esac
4685     done
4686     # fakeroot is needed to ensure correct file ownerships/permissions
4687     # inside deb packages and tar archives created on Linux and Solaris.
4688     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4689         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4690         if test "$FAKEROOT" = "no"; then
4691             AC_MSG_ERROR(
4692                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4693         fi
4694     fi
4695     PKGFORMAT="$with_package_format"
4696     AC_MSG_RESULT([$PKGFORMAT])
4697 else
4698     PKGFORMAT=
4699     AC_MSG_RESULT([none])
4701 AC_SUBST(PKGFORMAT)
4703 dnl ===================================================================
4704 dnl Set up a different compiler to produce tools to run on the build
4705 dnl machine when doing cross-compilation
4706 dnl ===================================================================
4708 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4709 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4710 if test "$cross_compiling" = "yes"; then
4711     AC_MSG_CHECKING([for BUILD platform configuration])
4712     echo
4713     rm -rf CONF-FOR-BUILD config_build.mk
4714     mkdir CONF-FOR-BUILD
4715     # Here must be listed all files needed when running the configure script. In particular, also
4716     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4717     # keep them in the same order as there.
4718     (cd $SRC_ROOT && tar cf - \
4719         config.guess \
4720         bin/get_config_variables \
4721         solenv/bin/getcompver.awk \
4722         solenv/inc/langlist.mk \
4723         download.lst \
4724         config_host.mk.in \
4725         config_host_lang.mk.in \
4726         Makefile.in \
4727         bin/bffvalidator.sh.in \
4728         bin/odfvalidator.sh.in \
4729         bin/officeotron.sh.in \
4730         instsetoo_native/util/openoffice.lst.in \
4731         config_host/*.in \
4732         sysui/desktop/macosx/Info.plist.in) \
4733     | (cd CONF-FOR-BUILD && tar xf -)
4734     cp configure CONF-FOR-BUILD
4735     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4736     (
4737     unset COM USING_X11 OS CPUNAME
4738     unset CC CXX SYSBASE CFLAGS
4739     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4740     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4741     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4742     if test -n "$CC_FOR_BUILD"; then
4743         export CC="$CC_FOR_BUILD"
4744         CC_BASE=`first_arg_basename "$CC"`
4745     fi
4746     if test -n "$CXX_FOR_BUILD"; then
4747         export CXX="$CXX_FOR_BUILD"
4748         CXX_BASE=`first_arg_basename "$CXX"`
4749     fi
4750     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4751     cd CONF-FOR-BUILD
4752     sub_conf_opts=""
4753     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4754     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4755     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4756     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4757     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4758     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4759     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4760     # Don't bother having configure look for stuff not needed for the build platform anyway
4761     ./configure \
4762         --disable-cups \
4763         --disable-gstreamer-1-0 \
4764         --disable-gtk \
4765         --disable-gtk3 \
4766         --disable-pdfimport \
4767         --disable-postgresql-sdbc \
4768         --with-parallelism="$with_parallelism" \
4769         --without-doxygen \
4770         --without-java \
4771         $sub_conf_opts \
4772         --srcdir=$srcdir \
4773         2>&1 | sed -e 's/^/    /'
4774     test -f ./config_host.mk 2>/dev/null || exit
4775     cp config_host.mk ../config_build.mk
4776     cp config_host_lang.mk ../config_build_lang.mk
4777     mv config.log ../config.Build.log
4778     mkdir -p ../config_build
4779     mv config_host/*.h ../config_build
4780     . ./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
4782     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
4783         VV='$'$V
4784         VV=`eval "echo $VV"`
4785         if test -n "$VV"; then
4786             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4787             echo "$line" >>build-config
4788         fi
4789     done
4791     for V in INSTDIR INSTROOT WORKDIR; do
4792         VV='$'$V
4793         VV=`eval "echo $VV"`
4794         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4795         if test -n "$VV"; then
4796             line="${V}_FOR_BUILD='$VV'"
4797             echo "$line" >>build-config
4798         fi
4799     done
4801     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4802     echo "$line" >>build-config
4804     )
4805     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4806     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])
4807     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4808              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4810     eval `cat CONF-FOR-BUILD/build-config`
4812     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4814     rm -rf CONF-FOR-BUILD
4815 else
4816     OS_FOR_BUILD="$OS"
4817     CC_FOR_BUILD="$CC"
4818     CXX_FOR_BUILD="$CXX"
4819     INSTDIR_FOR_BUILD="$INSTDIR"
4820     INSTROOT_FOR_BUILD="$INSTROOT"
4821     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4822     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4823     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4824     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4825     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4826     WORKDIR_FOR_BUILD="$WORKDIR"
4828 AC_SUBST(OS_FOR_BUILD)
4829 AC_SUBST(INSTDIR_FOR_BUILD)
4830 AC_SUBST(INSTROOT_FOR_BUILD)
4831 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4832 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4833 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4834 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4835 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4836 AC_SUBST(WORKDIR_FOR_BUILD)
4838 dnl ===================================================================
4839 dnl Check for syslog header
4840 dnl ===================================================================
4841 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4843 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4844 dnl ===================================================================
4845 AC_MSG_CHECKING([whether to turn warnings to errors])
4846 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4847     ENABLE_WERROR="TRUE"
4848     AC_MSG_RESULT([yes])
4849 else
4850     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4851         ENABLE_WERROR="TRUE"
4852         AC_MSG_RESULT([yes])
4853     else
4854         AC_MSG_RESULT([no])
4855     fi
4857 AC_SUBST(ENABLE_WERROR)
4859 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4860 dnl ===================================================================
4861 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4862 if test -z "$enable_assert_always_abort"; then
4863    if test "$ENABLE_DEBUG" = TRUE; then
4864        enable_assert_always_abort=yes
4865    else
4866        enable_assert_always_abort=no
4867    fi
4869 if test "$enable_assert_always_abort" = "yes"; then
4870     ASSERT_ALWAYS_ABORT="TRUE"
4871     AC_MSG_RESULT([yes])
4872 else
4873     ASSERT_ALWAYS_ABORT="FALSE"
4874     AC_MSG_RESULT([no])
4876 AC_SUBST(ASSERT_ALWAYS_ABORT)
4878 # Determine whether to use ooenv for the instdir installation
4879 # ===================================================================
4880 if test $_os != "WINNT" -a $_os != "Darwin"; then
4881     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4882     if test "$enable_ooenv" = "no"; then
4883         AC_MSG_RESULT([no])
4884     else
4885         ENABLE_OOENV="TRUE"
4886         AC_MSG_RESULT([yes])
4887     fi
4889 AC_SUBST(ENABLE_OOENV)
4891 if test "$USING_X11" != TRUE; then
4892     # be sure to do not mess with unneeded stuff
4893     test_randr=no
4894     test_xrender=no
4895     test_cups=no
4896     test_dbus=no
4897     test_gtk=no
4898     build_gstreamer_1_0=no
4899     test_kf5=no
4900     test_qt5=no
4901     test_gtk3_kde5=no
4902     enable_cairo_canvas=no
4905 if test "$OS" = "HAIKU"; then
4906     enable_cairo_canvas=yes
4907     test_kf5=yes
4910 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4911     AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!])
4912     add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!"
4913     test_kf5=yes
4916 if test "$test_kf5" = "yes"; then
4917     test_qt5=yes
4920 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4921     if test "$enable_qt5" = "no"; then
4922         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4923     else
4924         enable_qt5=yes
4925     fi
4928 dnl ===================================================================
4929 dnl check for cups support
4930 dnl ===================================================================
4931 ENABLE_CUPS=""
4933 if test "$enable_cups" = "no"; then
4934     test_cups=no
4937 AC_MSG_CHECKING([whether to enable CUPS support])
4938 if test "$test_cups" = "yes"; then
4939     ENABLE_CUPS="TRUE"
4940     AC_MSG_RESULT([yes])
4942     AC_MSG_CHECKING([whether cups support is present])
4943     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4944     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4945     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4946         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4947     fi
4949 else
4950     AC_MSG_RESULT([no])
4953 AC_SUBST(ENABLE_CUPS)
4955 # fontconfig checks
4956 if test "$test_fontconfig" = "yes"; then
4957     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4958     SYSTEM_FONTCONFIG=TRUE
4959     FilterLibs "${FONTCONFIG_LIBS}"
4960     FONTCONFIG_LIBS="${filteredlibs}"
4962 AC_SUBST(FONTCONFIG_CFLAGS)
4963 AC_SUBST(FONTCONFIG_LIBS)
4964 AC_SUBST([SYSTEM_FONTCONFIG])
4966 dnl whether to find & fetch external tarballs?
4967 dnl ===================================================================
4968 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4969    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4970        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4971    else
4972        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4973    fi
4975 if test -z "$TARFILE_LOCATION"; then
4976     if test -d "$SRC_ROOT/src" ; then
4977         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4978         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4979     fi
4980     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4981 else
4982     AbsolutePath "$TARFILE_LOCATION"
4983     PathFormat "${absolute_path}"
4984     TARFILE_LOCATION="${formatted_path}"
4986 AC_SUBST(TARFILE_LOCATION)
4988 AC_MSG_CHECKING([whether we want to fetch tarballs])
4989 if test "$enable_fetch_external" != "no"; then
4990     if test "$with_all_tarballs" = "yes"; then
4991         AC_MSG_RESULT([yes, all of them])
4992         DO_FETCH_TARBALLS="ALL"
4993     else
4994         AC_MSG_RESULT([yes, if we use them])
4995         DO_FETCH_TARBALLS="TRUE"
4996     fi
4997 else
4998     AC_MSG_RESULT([no])
4999     DO_FETCH_TARBALLS=
5001 AC_SUBST(DO_FETCH_TARBALLS)
5003 AC_MSG_CHECKING([whether to build help])
5004 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5005     BUILD_TYPE="$BUILD_TYPE HELP"
5006     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5007     case "$with_help" in
5008     "html")
5009         ENABLE_HTMLHELP=TRUE
5010         SCPDEFS="$SCPDEFS -DWITH_HELP"
5011         AC_MSG_RESULT([HTML])
5012         ;;
5013     "online")
5014         ENABLE_HTMLHELP=TRUE
5015         HELP_ONLINE=TRUE
5016         AC_MSG_RESULT([HTML])
5017         ;;
5018     yes)
5019         SCPDEFS="$SCPDEFS -DWITH_HELP"
5020         AC_MSG_RESULT([yes])
5021         ;;
5022     *)
5023         AC_MSG_ERROR([Unknown --with-help=$with_help])
5024         ;;
5025     esac
5026 else
5027     AC_MSG_RESULT([no])
5029 AC_SUBST([ENABLE_HTMLHELP])
5030 AC_SUBST([HELP_ONLINE])
5032 dnl Test whether to include MySpell dictionaries
5033 dnl ===================================================================
5034 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5035 if test "$with_myspell_dicts" = "yes"; then
5036     AC_MSG_RESULT([yes])
5037     WITH_MYSPELL_DICTS=TRUE
5038     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5039     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5040 else
5041     AC_MSG_RESULT([no])
5042     WITH_MYSPELL_DICTS=
5044 AC_SUBST(WITH_MYSPELL_DICTS)
5046 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5047 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5048     if test "$with_system_dicts" = yes; then
5049         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5050     fi
5051     with_system_dicts=no
5054 AC_MSG_CHECKING([whether to use dicts from external paths])
5055 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5056     AC_MSG_RESULT([yes])
5057     SYSTEM_DICTS=TRUE
5058     AC_MSG_CHECKING([for spelling dictionary directory])
5059     if test -n "$with_external_dict_dir"; then
5060         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5061     else
5062         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5063         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5064             DICT_SYSTEM_DIR=file:///usr/share/myspell
5065         fi
5066     fi
5067     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5068     AC_MSG_CHECKING([for hyphenation patterns directory])
5069     if test -n "$with_external_hyph_dir"; then
5070         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5071     else
5072         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5073     fi
5074     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5075     AC_MSG_CHECKING([for thesaurus directory])
5076     if test -n "$with_external_thes_dir"; then
5077         THES_SYSTEM_DIR=file://$with_external_thes_dir
5078     else
5079         THES_SYSTEM_DIR=file:///usr/share/mythes
5080     fi
5081     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5082 else
5083     AC_MSG_RESULT([no])
5084     SYSTEM_DICTS=
5086 AC_SUBST(SYSTEM_DICTS)
5087 AC_SUBST(DICT_SYSTEM_DIR)
5088 AC_SUBST(HYPH_SYSTEM_DIR)
5089 AC_SUBST(THES_SYSTEM_DIR)
5091 dnl ===================================================================
5092 dnl Precompiled headers.
5093 ENABLE_PCH=""
5094 AC_MSG_CHECKING([whether to enable pch feature])
5095 if test -z "$enable_pch"; then
5096     if test "$_os" = "WINNT"; then
5097         # Enabled by default on Windows.
5098         enable_pch=yes
5099     else
5100         enable_pch=no
5101     fi
5103 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5104     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5106 if test "$enable_pch" = "system"; then
5107     ENABLE_PCH="1"
5108     AC_MSG_RESULT([yes (system headers)])
5109 elif test "$enable_pch" = "base"; then
5110     ENABLE_PCH="2"
5111     AC_MSG_RESULT([yes (system and base headers)])
5112 elif test "$enable_pch" = "normal"; then
5113     ENABLE_PCH="3"
5114     AC_MSG_RESULT([yes (normal)])
5115 elif test "$enable_pch" = "full"; then
5116     ENABLE_PCH="4"
5117     AC_MSG_RESULT([yes (full)])
5118 elif test "$enable_pch" = "yes"; then
5119     # Pick a suitable default.
5120     if test "$GCC" = "yes"; then
5121         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5122         # while making the PCHs larger and rebuilds more likely.
5123         ENABLE_PCH="2"
5124         AC_MSG_RESULT([yes (system and base headers)])
5125     else
5126         # With MSVC the highest level makes a significant difference,
5127         # and it was the default when there used to be no PCH levels.
5128         ENABLE_PCH="4"
5129         AC_MSG_RESULT([yes (full)])
5130     fi
5131 elif test "$enable_pch" = "no"; then
5132     AC_MSG_RESULT([no])
5133 else
5134     AC_MSG_ERROR([Unknown value for --enable-pch])
5136 AC_SUBST(ENABLE_PCH)
5137 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5138 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5139     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5140     if test "$CCACHE_BIN" != "not found"; then
5141         AC_MSG_CHECKING([ccache version])
5142         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5143         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5144         AC_MSG_RESULT([$CCACHE_VERSION])
5145         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5146         if test "$CCACHE_NUMVER" -gt "030701"; then
5147             AC_MSG_RESULT([yes])
5148         else
5149             AC_MSG_RESULT([no (not newer than 3.7.1)])
5150             CCACHE_DEPEND_MODE=
5151         fi
5152     fi
5155 TAB=`printf '\t'`
5157 AC_MSG_CHECKING([the GNU Make version])
5158 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5159 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5160 if test "$_make_longver" -ge "038200"; then
5161     AC_MSG_RESULT([$GNUMAKE $_make_version])
5163 elif test "$_make_longver" -ge "038100"; then
5164     if test "$build_os" = "cygwin"; then
5165         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5166     fi
5167     AC_MSG_RESULT([$GNUMAKE $_make_version])
5169     dnl ===================================================================
5170     dnl Search all the common names for sha1sum
5171     dnl ===================================================================
5172     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5173     if test -z "$SHA1SUM"; then
5174         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5175     elif test "$SHA1SUM" = "openssl"; then
5176         SHA1SUM="openssl sha1"
5177     fi
5178     AC_MSG_CHECKING([for GNU Make bug 20033])
5179     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5180     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5181 A := \$(wildcard *.a)
5183 .PHONY: all
5184 all: \$(A:.a=.b)
5185 <TAB>@echo survived bug20033.
5187 .PHONY: setup
5188 setup:
5189 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5191 define d1
5192 @echo lala \$(1)
5193 @sleep 1
5194 endef
5196 define d2
5197 @echo tyty \$(1)
5198 @sleep 1
5199 endef
5201 %.b : %.a
5202 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5203 <TAB>\$(call d1,\$(CHECKSUM)),\
5204 <TAB>\$(call d2,\$(CHECKSUM)))
5206     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5207         no_parallelism_make="YES"
5208         AC_MSG_RESULT([yes, disable parallelism])
5209     else
5210         AC_MSG_RESULT([no, keep parallelism enabled])
5211     fi
5212     rm -rf $TESTGMAKEBUG20033
5213 else
5214     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5217 # find if gnumake support file function
5218 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5219 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5220 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5221     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5223 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5224 \$(file >test.txt,Success )
5226 .PHONY: all
5227 all:
5228 <TAB>@cat test.txt
5231 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5232 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5233     HAVE_GNUMAKE_FILE_FUNC=TRUE
5234     AC_MSG_RESULT([yes])
5235 else
5236     AC_MSG_RESULT([no])
5238 rm -rf $TESTGMAKEFILEFUNC
5239 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5240 AC_SUBST(GNUMAKE_WIN_NATIVE)
5242 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5243 STALE_MAKE=
5244 if test "$_make_ver_check" = ""; then
5245    STALE_MAKE=TRUE
5248 HAVE_LD_HASH_STYLE=FALSE
5249 WITH_LINKER_HASH_STYLE=
5250 AC_MSG_CHECKING([for --hash-style gcc linker support])
5251 if test "$GCC" = "yes"; then
5252     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5253         hash_styles="gnu sysv"
5254     elif test "$with_linker_hash_style" = "no"; then
5255         hash_styles=
5256     else
5257         hash_styles="$with_linker_hash_style"
5258     fi
5260     for hash_style in $hash_styles; do
5261         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5262         hash_style_ldflags_save=$LDFLAGS
5263         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5265         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5266             [
5267 #include <stdio.h>
5268             ],[
5269 printf ("");
5270             ])],
5271             [
5272                   HAVE_LD_HASH_STYLE=TRUE
5273                   WITH_LINKER_HASH_STYLE=$hash_style
5274             ],
5275             [HAVE_LD_HASH_STYLE=FALSE],
5276             [HAVE_LD_HASH_STYLE=FALSE])
5277         LDFLAGS=$hash_style_ldflags_save
5278     done
5280     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5281         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5282     else
5283         AC_MSG_RESULT( no )
5284     fi
5285     LDFLAGS=$hash_style_ldflags_save
5286 else
5287     AC_MSG_RESULT( no )
5289 AC_SUBST(HAVE_LD_HASH_STYLE)
5290 AC_SUBST(WITH_LINKER_HASH_STYLE)
5292 dnl ===================================================================
5293 dnl Check whether there's a Perl version available.
5294 dnl ===================================================================
5295 if test -z "$with_perl_home"; then
5296     AC_PATH_PROG(PERL, perl)
5297 else
5298     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5299     _perl_path="$with_perl_home/bin/perl"
5300     if test -x "$_perl_path"; then
5301         PERL=$_perl_path
5302     else
5303         AC_MSG_ERROR([$_perl_path not found])
5304     fi
5307 dnl ===================================================================
5308 dnl Testing for Perl version 5 or greater.
5309 dnl $] is the Perl version variable, it is returned as an integer
5310 dnl ===================================================================
5311 if test "$PERL"; then
5312     AC_MSG_CHECKING([the Perl version])
5313     ${PERL} -e "exit($]);"
5314     _perl_version=$?
5315     if test "$_perl_version" -lt 5; then
5316         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5317     fi
5318     AC_MSG_RESULT([Perl $_perl_version])
5319 else
5320     AC_MSG_ERROR([Perl not found, install Perl 5])
5323 dnl ===================================================================
5324 dnl Testing for required Perl modules
5325 dnl ===================================================================
5327 AC_MSG_CHECKING([for required Perl modules])
5328 perl_use_string="use Cwd ; use Digest::MD5"
5329 if test "$_os" = "WINNT"; then
5330     if test -n "$PKGFORMAT"; then
5331         for i in $PKGFORMAT; do
5332             case "$i" in
5333             msi)
5334                 # for getting fonts versions to use in MSI
5335                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5336                 ;;
5337             esac
5338         done
5339     fi
5341 if test "$with_system_hsqldb" = "yes"; then
5342     perl_use_string="$perl_use_string ; use Archive::Zip"
5344 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5345     AC_MSG_RESULT([all modules found])
5346 else
5347     AC_MSG_RESULT([failed to find some modules])
5348     # Find out which modules are missing.
5349     for i in $perl_use_string; do
5350         if test "$i" != "use" -a "$i" != ";"; then
5351             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5352                 missing_perl_modules="$missing_perl_modules $i"
5353             fi
5354         fi
5355     done
5356     AC_MSG_ERROR([
5357     The missing Perl modules are: $missing_perl_modules
5358     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5361 dnl ===================================================================
5362 dnl Check for pkg-config
5363 dnl ===================================================================
5364 if test "$_os" != "WINNT"; then
5365     PKG_PROG_PKG_CONFIG
5368 if test "$_os" != "WINNT"; then
5370     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5371     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5372     # explicitly. Or put /path/to/compiler in PATH yourself.
5374     # Use wrappers for LTO
5375     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5376         AC_CHECK_TOOL(AR,gcc-ar)
5377         AC_CHECK_TOOL(NM,gcc-nm)
5378         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5379     else
5380         AC_CHECK_TOOL(AR,ar)
5381         AC_CHECK_TOOL(NM,nm)
5382         AC_CHECK_TOOL(RANLIB,ranlib)
5383     fi
5384     AC_CHECK_TOOL(OBJDUMP,objdump)
5385     AC_CHECK_TOOL(READELF,readelf)
5386     AC_CHECK_TOOL(STRIP,strip)
5387     if test "$_os" = "WINNT"; then
5388         AC_CHECK_TOOL(DLLTOOL,dlltool)
5389         AC_CHECK_TOOL(WINDRES,windres)
5390     fi
5392 AC_SUBST(AR)
5393 AC_SUBST(DLLTOOL)
5394 AC_SUBST(NM)
5395 AC_SUBST(OBJDUMP)
5396 AC_SUBST(PKG_CONFIG)
5397 AC_SUBST(RANLIB)
5398 AC_SUBST(READELF)
5399 AC_SUBST(STRIP)
5400 AC_SUBST(WINDRES)
5402 dnl ===================================================================
5403 dnl pkg-config checks on macOS
5404 dnl ===================================================================
5406 if test $_os = Darwin; then
5407     AC_MSG_CHECKING([for bogus pkg-config])
5408     if test -n "$PKG_CONFIG"; then
5409         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5410             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5411         else
5412             if test "$enable_bogus_pkg_config" = "yes"; then
5413                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5414             else
5415                 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.])
5416             fi
5417         fi
5418     else
5419         AC_MSG_RESULT([no, good])
5420     fi
5423 find_csc()
5425     # Return value: $csctest
5427     unset csctest
5429     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5430     if test -n "$regvalue"; then
5431         csctest=$regvalue
5432         return
5433     fi
5436 find_al()
5438     # Return value: $altest
5440     unset altest
5442     # We need this check to detect 4.6.1 or above.
5443     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5444         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5445         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5446             altest=$regvalue
5447             return
5448         fi
5449     done
5451     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5452         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5453         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5454             altest=$regvalue
5455             return
5456         fi
5457     done
5462 find_dotnetsdk46()
5464     unset frametest
5466     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5467         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5468         if test -n "$regvalue"; then
5469             frametest=$regvalue
5470             return
5471         fi
5472     done
5475 find_winsdk_version()
5477     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5478     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5480     unset winsdktest winsdkbinsubdir winsdklibsubdir
5482     case "$1" in
5483     8.0|8.0A)
5484         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5485         if test -n "$regvalue"; then
5486             winsdktest=$regvalue
5487             winsdklibsubdir=win8
5488             return
5489         fi
5490         ;;
5491     8.1|8.1A)
5492         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5493         if test -n "$regvalue"; then
5494             winsdktest=$regvalue
5495             winsdklibsubdir=winv6.3
5496             return
5497         fi
5498         ;;
5499     10.0)
5500         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5501         if test -n "$regvalue"; then
5502             winsdktest=$regvalue
5503             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5504             if test -n "$regvalue"; then
5505                 winsdkbinsubdir="$regvalue".0
5506                 winsdklibsubdir=$winsdkbinsubdir
5507                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5508                 # test exist the SDK path
5509                 if test -d "$tmppath"; then
5510                    # when path is convertible to a short path then path is okay
5511                    cygpath -d "$tmppath" >/dev/null 2>&1
5512                    if test $? -ne 0; then
5513                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5514                    fi
5515                 else
5516                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5517                 fi
5518             fi
5519             return
5520         fi
5521         ;;
5522     esac
5525 find_winsdk()
5527     # Return value: From find_winsdk_version
5529     unset winsdktest
5531     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5532         find_winsdk_version $ver
5533         if test -n "$winsdktest"; then
5534             return
5535         fi
5536     done
5539 find_msms()
5541     AC_MSG_CHECKING([for MSVC merge modules directory])
5542     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5543     case "$VCVER" in
5544         150|160)
5545         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5546         ;;
5547     esac
5548     for f in $my_msm_files; do
5549         echo "$as_me:$LINENO: searching for $f" >&5
5550     done
5552     msmdir=
5553     for ver in 14.0 15.0; do
5554         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5555         if test -n "$regvalue"; then
5556             for f in ${my_msm_files}; do
5557                 if test -e "$regvalue/${f}"; then
5558                     msmdir=$regvalue
5559                     break
5560                 fi
5561             done
5562         fi
5563     done
5564     dnl Is the following fallback really necessary, or was it added in response
5565     dnl to never having started Visual Studio on a given machine, so the
5566     dnl registry keys checked above had presumably not yet been created?
5567     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5568     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5569     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5570     dnl expanding to "C:\Program Files\Common Files"), which would need
5571     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5572     dnl obtain its value from cygwin:
5573     if test -z "$msmdir"; then
5574         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5575         for f in ${my_msm_files}; do
5576             if test -e "$my_msm_dir/${f}"; then
5577                 msmdir=$my_msm_dir
5578             fi
5579         done
5580     fi
5582     dnl Starting from MSVC 15.0, merge modules are located in different directory
5583     case "$VCVER" in
5584     150|160)
5585         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5586             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5587             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5588             for f in ${my_msm_files}; do
5589                 if test -e "$my_msm_dir/${f}"; then
5590                     msmdir=$my_msm_dir
5591                     break
5592                 fi
5593             done
5594         done
5595         ;;
5596     esac
5598     if test -n "$msmdir"; then
5599         msmdir=`cygpath -m "$msmdir"`
5600         AC_MSG_RESULT([$msmdir])
5601     else
5602         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5603             AC_MSG_FAILURE([not found])
5604         else
5605             AC_MSG_WARN([not found (check config.log)])
5606             add_warning "MSM none of ${my_msm_files} found"
5607         fi
5608     fi
5611 find_msvc_x64_dlls()
5613     AC_MSG_CHECKING([for MSVC x64 DLL path])
5614     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5615     case "$VCVER" in
5616     150|160)
5617         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5618             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5619             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5620                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5621                 break
5622             fi
5623             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5624             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5625                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5626                 break
5627             fi
5628             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5629             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5630                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5631                 break
5632             fi
5633         done
5634         ;;
5635     esac
5636     AC_MSG_RESULT([$msvcdllpath])
5637     AC_MSG_CHECKING([for MSVC x64 DLLs])
5638     msvcdlls="msvcp140.dll vcruntime140.dll"
5639     for dll in $msvcdlls; do
5640         if ! test -f "$msvcdllpath/$dll"; then
5641             AC_MSG_FAILURE([missing $dll])
5642         fi
5643     done
5644     AC_MSG_RESULT([found all ($msvcdlls)])
5647 dnl =========================================
5648 dnl Check for the Windows  SDK.
5649 dnl =========================================
5650 if test "$_os" = "WINNT"; then
5651     AC_MSG_CHECKING([for Windows SDK])
5652     if test "$build_os" = "cygwin"; then
5653         find_winsdk
5654         WINDOWS_SDK_HOME=$winsdktest
5656         # normalize if found
5657         if test -n "$WINDOWS_SDK_HOME"; then
5658             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5659             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5660         fi
5662         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5663     fi
5665     if test -n "$WINDOWS_SDK_HOME"; then
5666         # Remove a possible trailing backslash
5667         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5669         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5670              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5671              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5672             have_windows_sdk_headers=yes
5673         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5674              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5675              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5676             have_windows_sdk_headers=yes
5677         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5678              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5679              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5680             have_windows_sdk_headers=yes
5681         else
5682             have_windows_sdk_headers=no
5683         fi
5685         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5686             have_windows_sdk_libs=yes
5687         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5688             have_windows_sdk_libs=yes
5689         else
5690             have_windows_sdk_libs=no
5691         fi
5693         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5694             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5695 the  Windows SDK are installed.])
5696         fi
5697     fi
5699     if test -z "$WINDOWS_SDK_HOME"; then
5700         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5701     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5702         WINDOWS_SDK_VERSION=80
5703         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5704     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5705         WINDOWS_SDK_VERSION=81
5706         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5707     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5708         WINDOWS_SDK_VERSION=10
5709         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5710     else
5711         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5712     fi
5713     PathFormat "$WINDOWS_SDK_HOME"
5714     WINDOWS_SDK_HOME="$formatted_path"
5715     if test "$build_os" = "cygwin"; then
5716         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5717         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5718             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5719         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5720             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5721         fi
5722     fi
5724     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5725     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5726     dnl but not in v8.0), so allow this to be overridden with a
5727     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5728     dnl and configuration error if no WiLangId.vbs is found would arguably be
5729     dnl better, but I do not know under which conditions exactly it is needed by
5730     dnl msiglobal.pm:
5731     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5732         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5733         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5734             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5735         fi
5736         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5737             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5738         fi
5739         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5740             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5741         fi
5742     fi
5743     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5744         if test -n "$with_package_format" -a "$with_package_format" != no; then
5745             for i in "$with_package_format"; do
5746                 if test "$i" = "msi"; then
5747                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5748                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5749                     fi
5750                 fi
5751             done
5752         fi
5753     fi
5755 AC_SUBST(WINDOWS_SDK_HOME)
5756 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5757 AC_SUBST(WINDOWS_SDK_VERSION)
5758 AC_SUBST(WINDOWS_SDK_WILANGID)
5760 if test "$build_os" = "cygwin"; then
5761     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5762     dnl dir, it also determines that dir's path w/o an arch segment if any,
5763     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5764     AC_MSG_CHECKING([for midl.exe])
5766     find_winsdk
5767     if test -n "$winsdkbinsubdir" \
5768         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5769     then
5770         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5771         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5772     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5773         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5774         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5775     elif test -f "$winsdktest/Bin/midl.exe"; then
5776         MIDL_PATH=$winsdktest/Bin
5777         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5778     fi
5779     if test ! -f "$MIDL_PATH/midl.exe"; then
5780         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5781     else
5782         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5783     fi
5785     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5786     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5788     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5789          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5790          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5791          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5792     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5793          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5794          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5795          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5796     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5797          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5798          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5799          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5800     else
5801         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5802     fi
5804     dnl Check csc.exe
5805     AC_MSG_CHECKING([for csc.exe])
5806     find_csc
5807     if test -f "$csctest/csc.exe"; then
5808         CSC_PATH="$csctest"
5809     fi
5810     if test ! -f "$CSC_PATH/csc.exe"; then
5811         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5812     else
5813         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5814     fi
5816     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5818     dnl Check al.exe
5819     AC_MSG_CHECKING([for al.exe])
5820     find_winsdk
5821     if test -n "$winsdkbinsubdir" \
5822         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5823     then
5824         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5825     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5826         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5827     elif test -f "$winsdktest/Bin/al.exe"; then
5828         AL_PATH="$winsdktest/Bin"
5829     fi
5831     if test -z "$AL_PATH"; then
5832         find_al
5833         if test -f "$altest/bin/al.exe"; then
5834             AL_PATH="$altest/bin"
5835         elif test -f "$altest/al.exe"; then
5836             AL_PATH="$altest"
5837         fi
5838     fi
5839     if test ! -f "$AL_PATH/al.exe"; then
5840         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5841     else
5842         AC_MSG_RESULT([$AL_PATH/al.exe])
5843     fi
5845     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5847     dnl Check mscoree.lib / .NET Framework dir
5848     AC_MSG_CHECKING(.NET Framework)
5849     find_dotnetsdk46
5850     PathFormat "$frametest"
5851     frametest="$formatted_path"
5852     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5853         DOTNET_FRAMEWORK_HOME="$frametest"
5854     else
5855         find_winsdk
5856         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5857             DOTNET_FRAMEWORK_HOME="$winsdktest"
5858         fi
5859     fi
5860     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
5861         AC_MSG_ERROR([mscoree.lib not found])
5862     fi
5863     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5865     PathFormat "$MIDL_PATH"
5866     MIDL_PATH="$formatted_path"
5868     PathFormat "$AL_PATH"
5869     AL_PATH="$formatted_path"
5871     PathFormat "$DOTNET_FRAMEWORK_HOME"
5872     DOTNET_FRAMEWORK_HOME="$formatted_path"
5874     PathFormat "$CSC_PATH"
5875     CSC_PATH="$formatted_path"
5878 dnl ===================================================================
5879 dnl Check if stdc headers are available excluding MSVC.
5880 dnl ===================================================================
5881 if test "$_os" != "WINNT"; then
5882     AC_HEADER_STDC
5885 dnl ===================================================================
5886 dnl Testing for C++ compiler and version...
5887 dnl ===================================================================
5889 if test "$_os" != "WINNT"; then
5890     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5891     save_CXXFLAGS=$CXXFLAGS
5892     AC_PROG_CXX
5893     CXXFLAGS=$save_CXXFLAGS
5894     if test -z "$CXX_BASE"; then
5895         CXX_BASE=`first_arg_basename "$CXX"`
5896     fi
5897 else
5898     if test -n "$CC" -a -z "$CXX"; then
5899         CXX="$CC"
5900         CXX_BASE="$CC_BASE"
5901     fi
5904 dnl check for GNU C++ compiler version
5905 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5906     AC_MSG_CHECKING([the GNU C++ compiler version])
5908     _gpp_version=`$CXX -dumpversion`
5909     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5911     if test "$_gpp_majmin" -lt "700"; then
5912         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5913     else
5914         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5915     fi
5917     dnl see https://code.google.com/p/android/issues/detail?id=41770
5918         glibcxx_threads=no
5919         AC_LANG_PUSH([C++])
5920         AC_REQUIRE_CPP
5921         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5922         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5923             #include <bits/c++config.h>]],[[
5924             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5925             && !defined(_GLIBCXX__PTHREADS) \
5926             && !defined(_GLIBCXX_HAS_GTHREADS)
5927             choke me
5928             #endif
5929         ]])],[AC_MSG_RESULT([yes])
5930         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5931         AC_LANG_POP([C++])
5932         if test $glibcxx_threads = yes; then
5933             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5934         fi
5936 AC_SUBST(BOOST_CXXFLAGS)
5939 # prefx CXX with ccache if needed
5941 if test "$CCACHE" != ""; then
5942     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5943     AC_LANG_PUSH([C++])
5944     save_CXXFLAGS=$CXXFLAGS
5945     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5946     dnl an empty program will do, we're checking the compiler flags
5947     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5948                       [use_ccache=yes], [use_ccache=no])
5949     if test $use_ccache = yes; then
5950         AC_MSG_RESULT([yes])
5951     else
5952         CXX="$CCACHE $CXX"
5953         CXX_BASE="ccache $CXX_BASE"
5954         AC_MSG_RESULT([no])
5955     fi
5956     CXXFLAGS=$save_CXXFLAGS
5957     AC_LANG_POP([C++])
5960 dnl ===================================================================
5961 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5962 dnl ===================================================================
5964 if test "$_os" != "WINNT"; then
5965     AC_PROG_CXXCPP
5967     dnl Check whether there's a C pre-processor.
5968     AC_PROG_CPP
5972 dnl ===================================================================
5973 dnl Find integral type sizes and alignments
5974 dnl ===================================================================
5976 if test "$_os" != "WINNT"; then
5978 if test "$_os" == "iOS"; then
5979     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5980     ac_cv_sizeof_long=8
5981     ac_cv_sizeof_short=2
5982     ac_cv_sizeof_int=4
5983     ac_cv_sizeof_long_long=8
5984     ac_cv_sizeof_double=8
5985     ac_cv_sizeof_voidp=8
5986 else
5987     AC_CHECK_SIZEOF(long)
5988     AC_CHECK_SIZEOF(short)
5989     AC_CHECK_SIZEOF(int)
5990     AC_CHECK_SIZEOF(long long)
5991     AC_CHECK_SIZEOF(double)
5992     AC_CHECK_SIZEOF(void*)
5995     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5996     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5997     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5998     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5999     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6001     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6002     m4_pattern_allow([AC_CHECK_ALIGNOF])
6003     m4_ifdef([AC_CHECK_ALIGNOF],
6004         [
6005             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6006             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6007             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6008             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6009         ],
6010         [
6011             case "$_os-$host_cpu" in
6012             Linux-i686)
6013                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6014                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6015                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6016                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6017                 ;;
6018             Linux-x86_64)
6019                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6020                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6021                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6022                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6023                 ;;
6024             *)
6025                 if test -z "$ac_cv_alignof_short" -o \
6026                         -z "$ac_cv_alignof_int" -o \
6027                         -z "$ac_cv_alignof_long" -o \
6028                         -z "$ac_cv_alignof_double"; then
6029                    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.])
6030                 fi
6031                 ;;
6032             esac
6033         ])
6035     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6036     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6037     if test $ac_cv_sizeof_long -eq 8; then
6038         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6039     elif test $ac_cv_sizeof_double -eq 8; then
6040         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6041     else
6042         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6043     fi
6045     dnl Check for large file support
6046     AC_SYS_LARGEFILE
6047     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6048         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6049     fi
6050     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6051         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6052     fi
6053 else
6054     # Hardcode for MSVC
6055     SAL_TYPES_SIZEOFSHORT=2
6056     SAL_TYPES_SIZEOFINT=4
6057     SAL_TYPES_SIZEOFLONG=4
6058     SAL_TYPES_SIZEOFLONGLONG=8
6059     if test "$BITNESS_OVERRIDE" = ""; then
6060         SAL_TYPES_SIZEOFPOINTER=4
6061     else
6062         SAL_TYPES_SIZEOFPOINTER=8
6063     fi
6064     SAL_TYPES_ALIGNMENT2=2
6065     SAL_TYPES_ALIGNMENT4=4
6066     SAL_TYPES_ALIGNMENT8=8
6067     LFS_CFLAGS=''
6069 AC_SUBST(LFS_CFLAGS)
6071 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6072 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6073 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6074 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6075 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6076 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6077 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6078 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6080 dnl ===================================================================
6081 dnl Check whether to enable runtime optimizations
6082 dnl ===================================================================
6083 ENABLE_RUNTIME_OPTIMIZATIONS=
6084 AC_MSG_CHECKING([whether to enable runtime optimizations])
6085 if test -z "$enable_runtime_optimizations"; then
6086     for i in $CC; do
6087         case $i in
6088         -fsanitize=*)
6089             enable_runtime_optimizations=no
6090             break
6091             ;;
6092         esac
6093     done
6095 if test "$enable_runtime_optimizations" != no; then
6096     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6097     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6098     AC_MSG_RESULT([yes])
6099 else
6100     AC_MSG_RESULT([no])
6102 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6104 dnl ===================================================================
6105 dnl Check if valgrind headers are available
6106 dnl ===================================================================
6107 ENABLE_VALGRIND=
6108 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6109     prev_cppflags=$CPPFLAGS
6110     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6111     # or where does it come from?
6112     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6113     AC_CHECK_HEADER([valgrind/valgrind.h],
6114         [ENABLE_VALGRIND=TRUE])
6115     CPPFLAGS=$prev_cppflags
6117 AC_SUBST([ENABLE_VALGRIND])
6118 if test -z "$ENABLE_VALGRIND"; then
6119     if test "$with_valgrind" = yes; then
6120         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6121     fi
6122     VALGRIND_CFLAGS=
6124 AC_SUBST([VALGRIND_CFLAGS])
6127 dnl ===================================================================
6128 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6129 dnl ===================================================================
6131 # We need at least the sys/sdt.h include header.
6132 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6133 if test "$SDT_H_FOUND" = "TRUE"; then
6134     # Found sys/sdt.h header, now make sure the c++ compiler works.
6135     # Old g++ versions had problems with probes in constructors/destructors.
6136     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6137     AC_LANG_PUSH([C++])
6138     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6139     #include <sys/sdt.h>
6140     class ProbeClass
6141     {
6142     private:
6143       int& ref;
6144       const char *name;
6146     public:
6147       ProbeClass(int& v, const char *n) : ref(v), name(n)
6148       {
6149         DTRACE_PROBE2(_test_, cons, name, ref);
6150       }
6152       void method(int min)
6153       {
6154         DTRACE_PROBE3(_test_, meth, name, ref, min);
6155         ref -= min;
6156       }
6158       ~ProbeClass()
6159       {
6160         DTRACE_PROBE2(_test_, dest, name, ref);
6161       }
6162     };
6163     ]],[[
6164     int i = 64;
6165     DTRACE_PROBE1(_test_, call, i);
6166     ProbeClass inst = ProbeClass(i, "call");
6167     inst.method(24);
6168     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6169           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6170     AC_LANG_POP([C++])
6172 AC_CONFIG_HEADERS([config_host/config_probes.h])
6174 dnl ===================================================================
6175 dnl GCC features
6176 dnl ===================================================================
6177 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6178     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6179     save_CFLAGS=$CFLAGS
6180     CFLAGS="$CFLAGS -Werror -mno-avx"
6181     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6182     CFLAGS=$save_CFLAGS
6183     if test "$HAVE_GCC_AVX" = "TRUE"; then
6184         AC_MSG_RESULT([yes])
6185     else
6186         AC_MSG_RESULT([no])
6187     fi
6189     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-protector-strong])
6190     save_CFLAGS=$CFLAGS
6191     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6192     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6193     CFLAGS=$save_CFLAGS
6194     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6195         AC_MSG_RESULT([yes])
6196     else
6197         AC_MSG_RESULT([no])
6198     fi
6200     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6201     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6202     int v = 0;
6203     if (__sync_add_and_fetch(&v, 1) != 1 ||
6204         __sync_sub_and_fetch(&v, 1) != 0)
6205         return 1;
6206     __sync_synchronize();
6207     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6208         v != 1)
6209         return 1;
6210     return 0;
6211 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6212     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6213         AC_MSG_RESULT([yes])
6214         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6215     else
6216         AC_MSG_RESULT([no])
6217     fi
6219     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6220     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6221     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6222         AC_MSG_RESULT([yes])
6223         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6224     else
6225         AC_MSG_RESULT([no])
6226     fi
6228     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6229     save_CFLAGS=$CFLAGS
6230     CFLAGS="$CFLAGS -Werror"
6231     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6232             __attribute__((deprecated("test"))) void f();
6233         ])], [
6234             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6235             AC_MSG_RESULT([yes])
6236         ], [AC_MSG_RESULT([no])])
6237     CFLAGS=$save_CFLAGS
6239     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6240     AC_LANG_PUSH([C++])
6241     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6242             #include <cstddef>
6243             #include <cxxabi.h>
6244             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6245         ])], [
6246             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6247             AC_MSG_RESULT([yes])
6248         ], [AC_MSG_RESULT([no])])
6249     AC_LANG_POP([C++])
6251     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6252     AC_LANG_PUSH([C++])
6253     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6254             #include <cstddef>
6255             #include <cxxabi.h>
6256             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6257         ])], [
6258             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6259             AC_MSG_RESULT([yes])
6260         ], [AC_MSG_RESULT([no])])
6261     AC_LANG_POP([C++])
6263     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6264     AC_LANG_PUSH([C++])
6265     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6266             #include <cxxabi.h>
6267             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6268         ])], [
6269             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6270             AC_MSG_RESULT([yes])
6271         ], [AC_MSG_RESULT([no])])
6272     AC_LANG_POP([C++])
6274     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6275     AC_LANG_PUSH([C++])
6276     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6277             #include <cstddef>
6278             #include <cxxabi.h>
6279             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6280         ])], [
6281             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6282             AC_MSG_RESULT([yes])
6283         ], [AC_MSG_RESULT([no])])
6284     AC_LANG_POP([C++])
6286     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6287     AC_LANG_PUSH([C++])
6288     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6289             #include <cstddef>
6290             #include <cxxabi.h>
6291             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6292         ])], [
6293             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6294             AC_MSG_RESULT([yes])
6295         ], [AC_MSG_RESULT([no])])
6296     AC_LANG_POP([C++])
6298     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6299     AC_LANG_PUSH([C++])
6300     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6301             #include <cxxabi.h>
6302             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6303         ])], [
6304             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6305             AC_MSG_RESULT([yes])
6306         ], [AC_MSG_RESULT([no])])
6307     AC_LANG_POP([C++])
6309     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6310     AC_LANG_PUSH([C++])
6311     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6312             #include <cxxabi.h>
6313             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6314         ])], [
6315             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6316             AC_MSG_RESULT([yes])
6317         ], [AC_MSG_RESULT([no])])
6318     AC_LANG_POP([C++])
6320     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6321     AC_LANG_PUSH([C++])
6322     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6323             #include <cxxabi.h>
6324             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6325         ])], [
6326             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6327             AC_MSG_RESULT([yes])
6328         ], [AC_MSG_RESULT([no])])
6329     AC_LANG_POP([C++])
6331     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6332     AC_LANG_PUSH([C++])
6333     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6334             #include <cstddef>
6335             #include <cxxabi.h>
6336             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6337         ])], [
6338             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6339             AC_MSG_RESULT([yes])
6340         ], [AC_MSG_RESULT([no])])
6341     AC_LANG_POP([C++])
6343     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6344     AC_LANG_PUSH([C++])
6345     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6346             #include <cstddef>
6347             #include <cxxabi.h>
6348             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6349         ])], [
6350             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6351             AC_MSG_RESULT([yes])
6352         ], [AC_MSG_RESULT([no])])
6353     AC_LANG_POP([C++])
6355     dnl Available in GCC 4.9 and at least since Clang 3.4:
6356     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6357     AC_LANG_PUSH([C++])
6358     save_CXXFLAGS=$CXXFLAGS
6359     CXXFLAGS="$CXXFLAGS -Werror"
6360     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6361             struct __attribute__((warn_unused)) dummy {};
6362         ])], [
6363             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6364             AC_MSG_RESULT([yes])
6365         ], [AC_MSG_RESULT([no])])
6366     CXXFLAGS=$save_CXXFLAGS
6367 AC_LANG_POP([C++])
6370 AC_SUBST(HAVE_GCC_AVX)
6371 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6372 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6373 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6375 dnl ===================================================================
6376 dnl Identify the C++ library
6377 dnl ===================================================================
6379 AC_MSG_CHECKING([what the C++ library is])
6380 AC_LANG_PUSH([C++])
6381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6382 #include <utility>
6383 #ifndef __GLIBCXX__
6384 foo bar
6385 #endif
6386 ]])],
6387     [CPP_LIBRARY=GLIBCXX
6388      cpp_library_name="GNU libstdc++"
6389     ],
6390     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6391 #include <utility>
6392 #ifndef _LIBCPP_VERSION
6393 foo bar
6394 #endif
6395 ]])],
6396     [CPP_LIBRARY=LIBCPP
6397      cpp_library_name="LLVM libc++"
6398      AC_DEFINE([HAVE_LIBCXX])
6399     ],
6400     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6401 #include <utility>
6402 #ifndef _MSC_VER
6403 foo bar
6404 #endif
6405 ]])],
6406     [CPP_LIBRARY=MSVCRT
6407      cpp_library_name="Microsoft"
6408     ],
6409     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6410 AC_MSG_RESULT([$cpp_library_name])
6411 AC_LANG_POP([C++])
6413 dnl ===================================================================
6414 dnl Check for gperf
6415 dnl ===================================================================
6416 AC_PATH_PROG(GPERF, gperf)
6417 if test -z "$GPERF"; then
6418     AC_MSG_ERROR([gperf not found but needed. Install it.])
6420 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6421     GPERF=`cygpath -m $GPERF`
6423 AC_MSG_CHECKING([whether gperf is new enough])
6424 my_gperf_ver1=$($GPERF --version | head -n 1)
6425 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6426 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6427 if test "$my_gperf_ver3" -ge 301; then
6428     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6429 else
6430     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6432 AC_SUBST(GPERF)
6434 dnl ===================================================================
6435 dnl Check for system libcmis
6436 dnl ===================================================================
6437 # libcmis requires curl and we can't build curl for iOS
6438 if test $_os != iOS; then
6439     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6440     ENABLE_LIBCMIS=TRUE
6441 else
6442     ENABLE_LIBCMIS=
6444 AC_SUBST(ENABLE_LIBCMIS)
6446 dnl ===================================================================
6447 dnl C++11
6448 dnl ===================================================================
6450 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6451 CXXFLAGS_CXX11=
6452 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6453     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6454 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6455     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6456     for flag in $my_flags; do
6457         if test "$COM" = MSC; then
6458             flag="-Xclang $flag"
6459         fi
6460         save_CXXFLAGS=$CXXFLAGS
6461         CXXFLAGS="$CXXFLAGS $flag -Werror"
6462         if test "$SYSTEM_LIBCMIS" = TRUE; then
6463             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6464         fi
6465         AC_LANG_PUSH([C++])
6466         dnl Clang 3.9 supports __float128 since
6467         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6468         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6469         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6470         dnl $flag is supported below, so check this first):
6471         my_float128hack=
6472         my_float128hack_impl=-D__float128=void
6473         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6474             #include <vector>
6475             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6476             // (__float128)
6477             ]])
6478         ],,[
6479             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6480             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6481             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6482             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6483             dnl place where __float128 is used is in a template specialization, -D__float128=void
6484             dnl will avoid the problem there while still causing a problem if somebody actually uses
6485             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6486             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6487             dnl "fixed" with this hack):
6488             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6489             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6490                 #include <vector>
6491                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6492                 // (__float128)
6493                 ]])
6494             ],[my_float128hack=$my_float128hack_impl])
6495         ])
6496         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6497             #include <algorithm>
6498             #include <cmath>
6499             #include <functional>
6500             #include <vector>
6502             #if defined SYSTEM_LIBCMIS
6503             // See ucb/source/ucp/cmis/auth_provider.hxx:
6504             #if !defined __clang__
6505             #pragma GCC diagnostic push
6506             #pragma GCC diagnostic ignored "-Wdeprecated"
6507             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6508             #endif
6509             #include <libcmis/libcmis.hxx>
6510             #if !defined __clang__
6511             #pragma GCC diagnostic pop
6512             #endif
6513             #endif
6515             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6516                 std::sort(v.begin(), v.end(), fn);
6517             }
6519             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6520             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6521             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6522             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6523             // needed by sc/source/core/tool/math.cxx):
6524             int g() { return math_errhandling; }
6525             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6526         AC_LANG_POP([C++])
6527         CXXFLAGS=$save_CXXFLAGS
6528         if test -n "$CXXFLAGS_CXX11"; then
6529             break
6530         fi
6531     done
6533 if test -n "$CXXFLAGS_CXX11"; then
6534     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6535 else
6536     AC_MSG_ERROR(no)
6538 AC_SUBST(CXXFLAGS_CXX11)
6540 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6541 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6542 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6543 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6544 dnl again towards 4.7.2:
6545 if test $CPP_LIBRARY = GLIBCXX; then
6546     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6547     AC_LANG_PUSH([C++])
6548     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6549 #include <list>
6550 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6551     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6552     //   GCC 4.7.0: 20120322
6553     //   GCC 4.7.1: 20120614
6554     // and using a range check is not possible as the mapping between
6555     // __GLIBCXX__ values and GCC versions is not monotonic
6556 /* ok */
6557 #else
6558 abi broken
6559 #endif
6560         ]])], [AC_MSG_RESULT(no, ok)],
6561         [AC_MSG_ERROR(yes)])
6562     AC_LANG_POP([C++])
6565 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6566 save_CXXFLAGS=$CXXFLAGS
6567 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6568 AC_LANG_PUSH([C++])
6570 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6571 #include <stddef.h>
6573 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6575 namespace
6577         struct b
6578         {
6579                 int i;
6580                 int j;
6581         };
6583 ]], [[
6584 struct a
6586         int i;
6587         int j;
6589 a thinga[]={{0,0}, {1,1}};
6590 b thingb[]={{0,0}, {1,1}};
6591 size_t i = sizeof(sal_n_array_size(thinga));
6592 size_t j = sizeof(sal_n_array_size(thingb));
6593 return !(i != 0 && j != 0);
6595     ], [ AC_MSG_RESULT(yes) ],
6596     [ AC_MSG_ERROR(no)])
6597 AC_LANG_POP([C++])
6598 CXXFLAGS=$save_CXXFLAGS
6600 dnl _Pragma support (may require C++11)
6601 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6602     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6603     AC_LANG_PUSH([C++])
6604     save_CXXFLAGS=$CXXFLAGS
6605     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6606     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6607             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6608         ])], [
6609             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6610             AC_MSG_RESULT([yes])
6611         ], [AC_MSG_RESULT([no])])
6612     AC_LANG_POP([C++])
6613     CXXFLAGS=$save_CXXFLAGS
6616 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6617 if test "$GCC" = yes; then
6618     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6619     AC_LANG_PUSH([C++])
6620     save_CXXFLAGS=$CXXFLAGS
6621     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6622     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6623     CXXFLAGS=$save_CXXFLAGS
6624     AC_LANG_POP([C++])
6625     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6626         AC_MSG_RESULT([yes])
6627     else
6628         AC_MSG_RESULT([no])
6629     fi
6631 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6633 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6634 AC_LANG_PUSH([C++])
6635 save_CXXFLAGS=$CXXFLAGS
6636 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6637 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6638         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6639         // supporting it:
6640         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6641         struct S {
6642         private:
6643             S(S const &);
6644         public:
6645             S();
6646             ~S();
6647         };
6648         S copy();
6649         void f() { S c(copy()); }
6650         #endif
6651     ])], [
6652         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6653         AC_MSG_RESULT([yes])
6654     ], [AC_MSG_RESULT([no])])
6655 CXXFLAGS=$save_CXXFLAGS
6656 AC_LANG_POP([C++])
6658 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6659 AC_LANG_PUSH([C++])
6660 save_CXXFLAGS=$CXXFLAGS
6661 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6662 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6663         struct S1 { S1(S1 &&); };
6664         struct S2: S1 {};
6665         S1 f(S2 s) { return s; }
6666     ])], [
6667         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6668         AC_MSG_RESULT([yes])
6669     ], [AC_MSG_RESULT([no])])
6670 CXXFLAGS=$save_CXXFLAGS
6671 AC_LANG_POP([C++])
6673 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6674 dnl uninitialized warning for code like
6676 dnl   OString f();
6677 dnl   boost::optional<OString> * g(bool b) {
6678 dnl       boost::optional<OString> o;
6679 dnl       if (b) o = f();
6680 dnl       return new boost::optional<OString>(o);
6681 dnl   }
6683 dnl (as is e.g. present, in a slightly more elaborate form, in
6684 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6685 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6686 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6687 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6688     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6689     AC_LANG_PUSH([C++])
6690     save_CXXFLAGS=$CXXFLAGS
6691     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6692     if test "$ENABLE_OPTIMIZED" = TRUE; then
6693         CXXFLAGS="$CXXFLAGS -O2"
6694     else
6695         CXXFLAGS="$CXXFLAGS -O0"
6696     fi
6697     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6698             #include <new>
6699             void f1(int);
6700             struct S1 {
6701                 ~S1() { f1(n); }
6702                 int n = 0;
6703             };
6704             struct S2 {
6705                 S2() {}
6706                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6707                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6708                 void set(S1 s) {
6709                     new (stg) S1(s);
6710                     init = true;
6711                 }
6712                 bool init = false;
6713                 char stg[sizeof (S1)];
6714             } ;
6715             S1 f2();
6716             S2 * f3(bool b) {
6717                 S2 o;
6718                 if (b) o.set(f2());
6719                 return new S2(o);
6720             }
6721         ]])], [AC_MSG_RESULT([no])], [
6722             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6723             AC_MSG_RESULT([yes])
6724         ])
6725     CXXFLAGS=$save_CXXFLAGS
6726     AC_LANG_POP([C++])
6728 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6730 dnl ===================================================================
6731 dnl CPU Intrinsics support - SSE, AVX
6732 dnl ===================================================================
6734 INTRINSICS_CXXFLAGS=""
6736 if test "$GCC" = "yes"; then
6737     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6738     AC_LANG_PUSH([C++])
6739     save_CXXFLAGS=$CXXFLAGS
6740     CXXFLAGS="$CXXFLAGS -msse2"
6741     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6742         #include <emmintrin.h>
6743         int main () {
6744             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6745             c = _mm_xor_si128 (a, b);
6746             return 0;
6747         }
6748         ])],
6749         [can_compile_sse2=yes],
6750         [can_compile_sse2=no])
6751     AC_LANG_POP([C++])
6752     CXXFLAGS=$save_CXXFLAGS
6753     AC_MSG_RESULT([${can_compile_sse2}])
6754     if test "${can_compile_sse2}" = "yes" ; then
6755         INTRINSICS_CXXFLAGS="-msse2"
6756     else
6757         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6758     fi
6760     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6761     AC_LANG_PUSH([C++])
6762     save_CXXFLAGS=$CXXFLAGS
6763     CXXFLAGS="$CXXFLAGS -mssse3"
6764     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6765         #include <tmmintrin.h>
6766         int main () {
6767             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6768             c = _mm_maddubs_epi16 (a, b);
6769             return 0;
6770         }
6771         ])],
6772         [can_compile_ssse3=yes],
6773         [can_compile_ssse3=no])
6774     AC_LANG_POP([C++])
6775     CXXFLAGS=$save_CXXFLAGS
6776     AC_MSG_RESULT([${can_compile_ssse3}])
6777     if test "${can_compile_ssse3}" = "yes" ; then
6778         INTRINSICS_CXXFLAGS="-mssse3"
6779     else
6780         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6781     fi
6783     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6784     AC_LANG_PUSH([C++])
6785     save_CXXFLAGS=$CXXFLAGS
6786     CXXFLAGS="$CXXFLAGS -mavx"
6787     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6788         #include <immintrin.h>
6789         int main () {
6790             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6791             c = _mm256_xor_ps(a, b);
6792             return 0;
6793         }
6794         ])],
6795         [can_compile_avx=yes],
6796         [can_compile_avx=no])
6797     AC_LANG_POP([C++])
6798     CXXFLAGS=$save_CXXFLAGS
6799     AC_MSG_RESULT([${can_compile_avx}])
6800     if test "${can_compile_avx}" = "yes" ; then
6801         INTRINSICS_CXXFLAGS="-mavx"
6802     else
6803         AC_MSG_WARN([cannot compile AVX intrinsics])
6804     fi
6806     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6807     AC_LANG_PUSH([C++])
6808     save_CXXFLAGS=$CXXFLAGS
6809     CXXFLAGS="$CXXFLAGS -mavx2"
6810     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6811         #include <immintrin.h>
6812         int main () {
6813             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6814             c = _mm256_maddubs_epi16(a, b);
6815             return 0;
6816         }
6817         ])],
6818         [can_compile_avx2=yes],
6819         [can_compile_avx2=no])
6820     AC_LANG_POP([C++])
6821     CXXFLAGS=$save_CXXFLAGS
6822     AC_MSG_RESULT([${can_compile_avx2}])
6823     if test "${can_compile_avx2}" = "yes" ; then
6824         INTRINSICS_CXXFLAGS="-mavx2"
6825     else
6826         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6827     fi
6830 AC_SUBST([INTRINSICS_CXXFLAGS])
6832 dnl ===================================================================
6833 dnl system stl sanity tests
6834 dnl ===================================================================
6835 if test "$_os" != "WINNT"; then
6837     AC_LANG_PUSH([C++])
6839     save_CPPFLAGS="$CPPFLAGS"
6840     if test -n "$MACOSX_SDK_PATH"; then
6841         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6842     fi
6844     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6845     # only.
6846     if test "$CPP_LIBRARY" = GLIBCXX; then
6847         dnl gcc#19664, gcc#22482, rhbz#162935
6848         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6849         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6850         AC_MSG_RESULT([$stlvisok])
6851         if test "$stlvisok" = "no"; then
6852             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6853         fi
6854     fi
6856     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6857     # when we don't make any dynamic libraries?
6858     if test "$DISABLE_DYNLOADING" = ""; then
6859         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6860         cat > conftestlib1.cc <<_ACEOF
6861 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6862 struct S2: S1<int> { virtual ~S2(); };
6863 S2::~S2() {}
6864 _ACEOF
6865         cat > conftestlib2.cc <<_ACEOF
6866 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6867 struct S2: S1<int> { virtual ~S2(); };
6868 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6869 _ACEOF
6870         gccvisinlineshiddenok=yes
6871         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6872             gccvisinlineshiddenok=no
6873         else
6874             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6875             dnl known to not work with -z defs (unsetting which makes the test
6876             dnl moot, though):
6877             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6878             if test "$COM_IS_CLANG" = TRUE; then
6879                 for i in $CXX $CXXFLAGS; do
6880                     case $i in
6881                     -fsanitize=*)
6882                         my_linkflagsnoundefs=
6883                         break
6884                         ;;
6885                     esac
6886                 done
6887             fi
6888             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6889                 gccvisinlineshiddenok=no
6890             fi
6891         fi
6893         rm -fr libconftest*
6894         AC_MSG_RESULT([$gccvisinlineshiddenok])
6895         if test "$gccvisinlineshiddenok" = "no"; then
6896             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6897         fi
6898     fi
6900    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6901     cat >visibility.cxx <<_ACEOF
6902 #pragma GCC visibility push(hidden)
6903 struct __attribute__ ((visibility ("default"))) TestStruct {
6904   static void Init();
6906 __attribute__ ((visibility ("default"))) void TestFunc() {
6907   TestStruct::Init();
6909 _ACEOF
6910     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6911         gccvisbroken=yes
6912     else
6913         case "$host_cpu" in
6914         i?86|x86_64)
6915             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6916                 gccvisbroken=no
6917             else
6918                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6919                     gccvisbroken=no
6920                 else
6921                     gccvisbroken=yes
6922                 fi
6923             fi
6924             ;;
6925         *)
6926             gccvisbroken=no
6927             ;;
6928         esac
6929     fi
6930     rm -f visibility.s visibility.cxx
6932     AC_MSG_RESULT([$gccvisbroken])
6933     if test "$gccvisbroken" = "yes"; then
6934         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6935     fi
6937     CPPFLAGS="$save_CPPFLAGS"
6939     AC_LANG_POP([C++])
6942 dnl ===================================================================
6943 dnl  Clang++ tests
6944 dnl ===================================================================
6946 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6947 if test "$GCC" = "yes"; then
6948     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6949     AC_LANG_PUSH([C++])
6950     save_CXXFLAGS=$CXXFLAGS
6951     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6952     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6953     CXXFLAGS=$save_CXXFLAGS
6954     AC_LANG_POP([C++])
6955     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6956         AC_MSG_RESULT([yes])
6957     else
6958         AC_MSG_RESULT([no])
6959     fi
6961 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6963 dnl ===================================================================
6964 dnl Compiler plugins
6965 dnl ===================================================================
6967 COMPILER_PLUGINS=
6968 # currently only Clang
6970 if test "$COM_IS_CLANG" != "TRUE"; then
6971     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6972         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6973         enable_compiler_plugins=no
6974     fi
6977 if test "$COM_IS_CLANG" = "TRUE"; then
6978     if test -n "$enable_compiler_plugins"; then
6979         compiler_plugins="$enable_compiler_plugins"
6980     elif test -n "$ENABLE_DBGUTIL"; then
6981         compiler_plugins=test
6982     else
6983         compiler_plugins=no
6984     fi
6985     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
6986         if test "$CLANGVER" -lt 50002; then
6987             if test "$compiler_plugins" = yes; then
6988                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6989             else
6990                 compiler_plugins=no
6991             fi
6992         fi
6993     fi
6994     if test "$compiler_plugins" != "no"; then
6995         dnl The prefix where Clang resides, override to where Clang resides if
6996         dnl using a source build:
6997         if test -z "$CLANGDIR"; then
6998             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
6999         fi
7000         AC_LANG_PUSH([C++])
7001         save_CPPFLAGS=$CPPFLAGS
7002         save_CXX=$CXX
7003         save_CXXCPP=$CXXCPP
7004         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
7005         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
7006         CXX=$COMPILER_PLUGINS_CXX
7007         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7008         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
7009         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
7010             [COMPILER_PLUGINS=TRUE],
7011             [
7012             if test "$compiler_plugins" = "yes"; then
7013                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7014             else
7015                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7016                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7017             fi
7018             ])
7019         CXX=$save_CXX
7020         CXXCPP=$save_CXXCPP
7021         CPPFLAGS=$save_CPPFLAGS
7022         AC_LANG_POP([C++])
7023     fi
7024 else
7025     if test "$enable_compiler_plugins" = "yes"; then
7026         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7027     fi
7029 AC_SUBST(COMPILER_PLUGINS)
7030 AC_SUBST(COMPILER_PLUGINS_CXX)
7031 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7032 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7033 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7034 AC_SUBST(CLANGDIR)
7035 AC_SUBST(CLANGLIBDIR)
7037 # Plugin to help linker.
7038 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7039 # This makes --enable-lto build with clang work.
7040 AC_SUBST(LD_PLUGIN)
7042 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7043 AC_SUBST(HAVE_POSIX_FALLOCATE)
7045 dnl ===================================================================
7046 dnl Custom build version
7047 dnl ===================================================================
7049 AC_MSG_CHECKING([whether to add custom build version])
7050 if test "$with_build_version" != ""; then
7051     BUILD_VER_STRING=$with_build_version
7052     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7053 else
7054     BUILD_VER_STRING=
7055     AC_MSG_RESULT([no])
7057 AC_SUBST(BUILD_VER_STRING)
7059 JITC_PROCESSOR_TYPE=""
7060 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7061     # IBMs JDK needs this...
7062     JITC_PROCESSOR_TYPE=6
7063     export JITC_PROCESSOR_TYPE
7065 AC_SUBST([JITC_PROCESSOR_TYPE])
7067 # Misc Windows Stuff
7068 AC_ARG_WITH(ucrt-dir,
7069     AS_HELP_STRING([--with-ucrt-dir],
7070         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7071         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7072         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7073             Windows6.1-KB2999226-x64.msu
7074             Windows6.1-KB2999226-x86.msu
7075             Windows8.1-KB2999226-x64.msu
7076             Windows8.1-KB2999226-x86.msu
7077             Windows8-RT-KB2999226-x64.msu
7078             Windows8-RT-KB2999226-x86.msu
7079         A zip archive including those files is available from Microsoft site:
7080         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7082 UCRT_REDISTDIR="$with_ucrt_dir"
7083 if test $_os = "WINNT"; then
7084     find_msvc_x64_dlls
7085     find_msms
7086     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7087     MSVC_DLLS="$msvcdlls"
7088     MSM_PATH=`win_short_path_for_make "$msmdir"`
7089     # MSVC 15.3 changed it to VC141
7090     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7091         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7092     else
7093         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7094     fi
7096     if test "$UCRT_REDISTDIR" = "no"; then
7097         dnl explicitly disabled
7098         UCRT_REDISTDIR=""
7099     else
7100         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7101                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7102                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7103                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7104                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7105                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7106             UCRT_REDISTDIR=""
7107             if test -n "$PKGFORMAT"; then
7108                for i in $PKGFORMAT; do
7109                    case "$i" in
7110                    msi)
7111                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7112                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7113                        ;;
7114                    esac
7115                done
7116             fi
7117         fi
7118     fi
7121 AC_SUBST(UCRT_REDISTDIR)
7122 AC_SUBST(MSVC_DLL_PATH)
7123 AC_SUBST(MSVC_DLLS)
7124 AC_SUBST(MSM_PATH)
7126 dnl ===================================================================
7127 dnl Checks for Java
7128 dnl ===================================================================
7129 if test "$ENABLE_JAVA" != ""; then
7131     # Windows-specific tests
7132     if test "$build_os" = "cygwin"; then
7133         if test "$BITNESS_OVERRIDE" = 64; then
7134             bitness=64
7135         else
7136             bitness=32
7137         fi
7139         if test -z "$with_jdk_home"; then
7140             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7141             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7142             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7143             if test -n "$regvalue"; then
7144                 ver=$regvalue
7145                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7146                 _jdk_home=$regvalue
7147             fi
7148             if test -z "$with_jdk_home"; then
7149                 for ver in 1.8; do
7150                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7151                     if test -n "$regvalue"; then
7152                         _jdk_home=$regvalue
7153                         break
7154                     fi
7155                 done
7156             fi
7157             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7158                 with_jdk_home="$_jdk_home"
7159                 howfound="found automatically"
7160             else
7161                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7162             fi
7163         else
7164             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7165             howfound="you passed"
7166         fi
7167     fi
7169     # macOS: /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.
7170     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7171     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7172         with_jdk_home=`/usr/libexec/java_home`
7173     fi
7175     JAVA_HOME=; export JAVA_HOME
7176     if test -z "$with_jdk_home"; then
7177         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7178     else
7179         _java_path="$with_jdk_home/bin/$with_java"
7180         dnl Check if there is a Java interpreter at all.
7181         if test -x "$_java_path"; then
7182             JAVAINTERPRETER=$_java_path
7183         else
7184             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7185         fi
7186     fi
7188     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7189     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7190     dnl loaded by java to run JunitTests:
7191     if test "$build_os" = "cygwin"; then
7192         shortjdkhome=`cygpath -d "$with_jdk_home"`
7193         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
7194             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7195             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7196         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
7197             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7198             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7199         fi
7201         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7202             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7203         fi
7204         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7205     elif test "$cross_compiling" != "yes"; then
7206         case $CPUNAME in
7207             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7208                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7209                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7210                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7211                 fi
7212                 ;;
7213             *) # assumption: everything else 32-bit
7214                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7215                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7216                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7217                 fi
7218                 ;;
7219         esac
7220     fi
7223 dnl ===================================================================
7224 dnl Checks for JDK.
7225 dnl ===================================================================
7227 # Note that JAVA_HOME as for now always means the *build* platform's
7228 # JAVA_HOME. Whether all the complexity here actually is needed any
7229 # more or not, no idea.
7231 if test "$ENABLE_JAVA" != ""; then
7232     _gij_longver=0
7233     AC_MSG_CHECKING([the installed JDK])
7234     if test -n "$JAVAINTERPRETER"; then
7235         dnl java -version sends output to stderr!
7236         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7237             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7238         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7239             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7240         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7241             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7242         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7243             JDK=ibm
7245             dnl IBM JDK specific tests
7246             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7247             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7249             if test "$_jdk_ver" -lt 10800; then
7250                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7251             fi
7253             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7255             if test "$with_jdk_home" = ""; then
7256                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7257 you must use the "--with-jdk-home" configure option explicitly])
7258             fi
7260             JAVA_HOME=$with_jdk_home
7261         else
7262             JDK=sun
7264             dnl Sun JDK specific tests
7265             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7266             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7268             if test "$_jdk_ver" -lt 10800; then
7269                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7270             fi
7271             if test "$_jdk_ver" -gt 10800; then
7272                 JAVA_CLASSPATH_NOT_SET=TRUE
7273             fi
7275             AC_MSG_RESULT([found (JDK $_jdk)])
7276             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7277             if test "$_os" = "WINNT"; then
7278                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7279             fi
7281             # set to limit VM usage for JunitTests
7282             JAVAIFLAGS=-Xmx64M
7283             # set to limit VM usage for javac
7284             JAVAFLAGS=-J-Xmx128M
7285         fi
7286     else
7287         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7288     fi
7289 else
7290     dnl Java disabled
7291     JAVA_HOME=
7292     export JAVA_HOME
7295 dnl ===================================================================
7296 dnl Checks for javac
7297 dnl ===================================================================
7298 if test "$ENABLE_JAVA" != ""; then
7299     javacompiler="javac"
7300     : ${JAVA_SOURCE_VER=8}
7301     : ${JAVA_TARGET_VER=8}
7302     if test -z "$with_jdk_home"; then
7303         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7304     else
7305         _javac_path="$with_jdk_home/bin/$javacompiler"
7306         dnl Check if there is a Java compiler at all.
7307         if test -x "$_javac_path"; then
7308             JAVACOMPILER=$_javac_path
7309         fi
7310     fi
7311     if test -z "$JAVACOMPILER"; then
7312         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7313     fi
7314     if test "$build_os" = "cygwin"; then
7315         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7316             JAVACOMPILER="${JAVACOMPILER}.exe"
7317         fi
7318         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7319     fi
7322 dnl ===================================================================
7323 dnl Checks for javadoc
7324 dnl ===================================================================
7325 if test "$ENABLE_JAVA" != ""; then
7326     if test -z "$with_jdk_home"; then
7327         AC_PATH_PROG(JAVADOC, javadoc)
7328     else
7329         _javadoc_path="$with_jdk_home/bin/javadoc"
7330         dnl Check if there is a javadoc at all.
7331         if test -x "$_javadoc_path"; then
7332             JAVADOC=$_javadoc_path
7333         else
7334             AC_PATH_PROG(JAVADOC, javadoc)
7335         fi
7336     fi
7337     if test -z "$JAVADOC"; then
7338         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7339     fi
7340     if test "$build_os" = "cygwin"; then
7341         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7342             JAVADOC="${JAVADOC}.exe"
7343         fi
7344         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7345     fi
7347     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7348     JAVADOCISGJDOC="yes"
7349     fi
7351 AC_SUBST(JAVADOCISGJDOC)
7353 if test "$ENABLE_JAVA" != ""; then
7354     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7355     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7356         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7357            # try to recover first by looking whether we have an alternative
7358            # system as in Debian or newer SuSEs where following /usr/bin/javac
7359            # over /etc/alternatives/javac leads to the right bindir where we
7360            # just need to strip a bit away to get a valid JAVA_HOME
7361            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7362         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7363             # maybe only one level of symlink (e.g. on Mac)
7364             JAVA_HOME=$(readlink $JAVACOMPILER)
7365             if test "$(dirname $JAVA_HOME)" = "."; then
7366                 # we've got no path to trim back
7367                 JAVA_HOME=""
7368             fi
7369         else
7370             # else warn
7371             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7372             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7373             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7374             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7375         fi
7376         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7377         if test "$JAVA_HOME" != "/usr"; then
7378             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7379                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7380                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7381                 dnl Tiger already returns a JDK path..
7382                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7383             else
7384                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7385                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7386                 dnl that checks which version to run
7387                 if test -f "$JAVA_HOME"; then
7388                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7389                 fi
7390             fi
7391         fi
7392     fi
7393     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7395     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7396     if test -z "$JAVA_HOME"; then
7397         if test "x$with_jdk_home" = "x"; then
7398             cat > findhome.java <<_ACEOF
7399 [import java.io.File;
7401 class findhome
7403     public static void main(String args[])
7404     {
7405         String jrelocation = System.getProperty("java.home");
7406         File jre = new File(jrelocation);
7407         System.out.println(jre.getParent());
7408     }
7410 _ACEOF
7411             AC_MSG_CHECKING([if javac works])
7412             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7413             AC_TRY_EVAL(javac_cmd)
7414             if test $? = 0 -a -f ./findhome.class; then
7415                 AC_MSG_RESULT([javac works])
7416             else
7417                 echo "configure: javac test failed" >&5
7418                 cat findhome.java >&5
7419                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7420             fi
7421             AC_MSG_CHECKING([if gij knows its java.home])
7422             JAVA_HOME=`$JAVAINTERPRETER findhome`
7423             if test $? = 0 -a "$JAVA_HOME" != ""; then
7424                 AC_MSG_RESULT([$JAVA_HOME])
7425             else
7426                 echo "configure: java test failed" >&5
7427                 cat findhome.java >&5
7428                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7429             fi
7430             # clean-up after ourselves
7431             rm -f ./findhome.java ./findhome.class
7432         else
7433             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7434         fi
7435     fi
7437     # now check if $JAVA_HOME is really valid
7438     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7439         case "${JAVA_HOME}" in
7440             /Library/Java/JavaVirtualMachines/*)
7441                 ;;
7442             *)
7443                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7444                 ;;
7445         esac
7446         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7447             JAVA_HOME_OK="NO"
7448         fi
7449     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7450         JAVA_HOME_OK="NO"
7451     fi
7452     if test "$JAVA_HOME_OK" = "NO"; then
7453         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7454         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7455         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7456         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7457         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7458         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7459     fi
7460     PathFormat "$JAVA_HOME"
7461     JAVA_HOME="$formatted_path"
7464 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7465     "$_os" != Darwin
7466 then
7467     AC_MSG_CHECKING([for JAWT lib])
7468     if test "$_os" = WINNT; then
7469         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7470         JAWTLIB=jawt.lib
7471     else
7472         case "$host_cpu" in
7473         arm*)
7474             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7475             JAVA_ARCH=$my_java_arch
7476             ;;
7477         i*86)
7478             my_java_arch=i386
7479             ;;
7480         m68k)
7481             my_java_arch=m68k
7482             ;;
7483         powerpc)
7484             my_java_arch=ppc
7485             ;;
7486         powerpc64)
7487             my_java_arch=ppc64
7488             ;;
7489         powerpc64le)
7490             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7491             JAVA_ARCH=$my_java_arch
7492             ;;
7493         sparc64)
7494             my_java_arch=sparcv9
7495             ;;
7496         x86_64)
7497             my_java_arch=amd64
7498             ;;
7499         *)
7500             my_java_arch=$host_cpu
7501             ;;
7502         esac
7503         # This is where JDK9 puts the library
7504         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7505             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7506         else
7507             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7508         fi
7509         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7510     fi
7511     AC_MSG_RESULT([$JAWTLIB])
7513 AC_SUBST(JAWTLIB)
7515 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7516     case "$host_os" in
7518     aix*)
7519         JAVAINC="-I$JAVA_HOME/include"
7520         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7521         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7522         ;;
7524     cygwin*)
7525         JAVAINC="-I$JAVA_HOME/include/win32"
7526         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7527         ;;
7529     darwin*)
7530         if test -d "$JAVA_HOME/include/darwin"; then
7531             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7532         else
7533             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7534         fi
7535         ;;
7537     dragonfly*)
7538         JAVAINC="-I$JAVA_HOME/include"
7539         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7540         ;;
7542     freebsd*)
7543         JAVAINC="-I$JAVA_HOME/include"
7544         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7545         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7546         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7547         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7548         ;;
7550     k*bsd*-gnu*)
7551         JAVAINC="-I$JAVA_HOME/include"
7552         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7553         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7554         ;;
7556     linux-gnu*)
7557         JAVAINC="-I$JAVA_HOME/include"
7558         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7559         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7560         ;;
7562     *netbsd*)
7563         JAVAINC="-I$JAVA_HOME/include"
7564         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7565         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7566        ;;
7568     openbsd*)
7569         JAVAINC="-I$JAVA_HOME/include"
7570         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7571         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7572         ;;
7574     solaris*)
7575         JAVAINC="-I$JAVA_HOME/include"
7576         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7577         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7578         ;;
7579     esac
7581 SOLARINC="$SOLARINC $JAVAINC"
7583 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7584     url_check_unknown=0
7585     java_base="testurlcheck"
7586     java_src="${java_base}.java"
7587     java_cls="${java_base}.class"
7588     cat > "${java_src}" <<_ACEOF
7589 [import jdk.internal.loader.URLClassPath;
7590 import java.lang.reflect.Field;
7591 import java.net.URL;
7593 class ${java_base}
7595     public static void main(String args[])
7596     {
7597         try {
7598             URLClassPath cp = new URLClassPath(new URL[0], null);
7599             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7600             field.setAccessible(true);
7601             System.out.println(field.get(cp).toString());
7602         } catch(Exception e) {
7603             System.out.println("unknown");
7604         }
7605     }
7607 _ACEOF
7608     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7609     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7610     AC_TRY_EVAL(java_cmd)
7611     if test $? = 0 -a -f "./${java_cls}"; then
7612         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7613         if test $? = 0; then
7614             case "${java_res}" in
7615             true) AC_MSG_RESULT([yes]) ;;
7616             false)
7617                 rm -f "./${java_src}" "./${java_cls}"
7618                 AC_MSG_ERROR([no - Java unit tests will break!])
7619                 ;;
7620             *) url_check_unknown=1 ;;
7621             esac
7622         else
7623             url_check_unknown=1
7624         fi
7625     else
7626         url_check_unknown=1
7627     fi
7628     if test $url_check_unknown -eq 1; then
7629         AC_MSG_RESULT([unknown - assuming yes])
7630         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7631     fi
7632     rm -f "./${java_src}" "./${java_cls}"
7635 AC_SUBST(JAVACOMPILER)
7636 AC_SUBST(JAVADOC)
7637 AC_SUBST(JAVAINTERPRETER)
7638 AC_SUBST(JAVAIFLAGS)
7639 AC_SUBST(JAVAFLAGS)
7640 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7641 AC_SUBST(JAVA_HOME)
7642 AC_SUBST(JAVA_SOURCE_VER)
7643 AC_SUBST(JAVA_TARGET_VER)
7644 AC_SUBST(JDK)
7647 dnl ===================================================================
7648 dnl Export file validation
7649 dnl ===================================================================
7650 AC_MSG_CHECKING([whether to enable export file validation])
7651 if test "$with_export_validation" != "no"; then
7652     if test -z "$ENABLE_JAVA"; then
7653         if test "$with_export_validation" = "yes"; then
7654             AC_MSG_ERROR([requested, but Java is disabled])
7655         else
7656             AC_MSG_RESULT([no, as Java is disabled])
7657         fi
7658     elif ! test -d "${SRC_ROOT}/schema"; then
7659         if test "$with_export_validation" = "yes"; then
7660             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7661         else
7662             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7663         fi
7664     else
7665         AC_MSG_RESULT([yes])
7666         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7668         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7669         if test -z "$ODFVALIDATOR"; then
7670             # remember to download the ODF toolkit with validator later
7671             AC_MSG_NOTICE([no odfvalidator found, will download it])
7672             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7673             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7675             # and fetch name of odfvalidator jar name from download.lst
7676             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7677             AC_SUBST(ODFVALIDATOR_JAR)
7679             if test -z "$ODFVALIDATOR_JAR"; then
7680                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7681             fi
7682         fi
7683         if test "$build_os" = "cygwin"; then
7684             # In case of Cygwin it will be executed from Windows,
7685             # so we need to run bash and absolute path to validator
7686             # so instead of "odfvalidator" it will be
7687             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7688             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7689         else
7690             ODFVALIDATOR="sh $ODFVALIDATOR"
7691         fi
7692         AC_SUBST(ODFVALIDATOR)
7695         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7696         if test -z "$OFFICEOTRON"; then
7697             # remember to download the officeotron with validator later
7698             AC_MSG_NOTICE([no officeotron found, will download it])
7699             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7700             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7702             # and fetch name of officeotron jar name from download.lst
7703             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7704             AC_SUBST(OFFICEOTRON_JAR)
7706             if test -z "$OFFICEOTRON_JAR"; then
7707                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7708             fi
7709         else
7710             # check version of existing officeotron
7711             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7712             if test 0"$OFFICEOTRON_VER" -lt 704; then
7713                 AC_MSG_ERROR([officeotron too old])
7714             fi
7715         fi
7716         if test "$build_os" = "cygwin"; then
7717             # In case of Cygwin it will be executed from Windows,
7718             # so we need to run bash and absolute path to validator
7719             # so instead of "odfvalidator" it will be
7720             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7721             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7722         else
7723             OFFICEOTRON="sh $OFFICEOTRON"
7724         fi
7725     fi
7726     AC_SUBST(OFFICEOTRON)
7727 else
7728     AC_MSG_RESULT([no])
7731 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7732 if test "$with_bffvalidator" != "no"; then
7733     AC_DEFINE(HAVE_BFFVALIDATOR)
7735     if test "$with_export_validation" = "no"; then
7736         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7737     fi
7739     if test "$with_bffvalidator" = "yes"; then
7740         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7741     else
7742         BFFVALIDATOR="$with_bffvalidator"
7743     fi
7745     if test "$build_os" = "cygwin"; then
7746         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7747             AC_MSG_RESULT($BFFVALIDATOR)
7748         else
7749             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7750         fi
7751     elif test -n "$BFFVALIDATOR"; then
7752         # We are not in Cygwin but need to run Windows binary with wine
7753         AC_PATH_PROGS(WINE, wine)
7755         # so swap in a shell wrapper that converts paths transparently
7756         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7757         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7758         AC_SUBST(BFFVALIDATOR_EXE)
7759         AC_MSG_RESULT($BFFVALIDATOR)
7760     else
7761         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7762     fi
7763     AC_SUBST(BFFVALIDATOR)
7764 else
7765     AC_MSG_RESULT([no])
7768 dnl ===================================================================
7769 dnl Check for C preprocessor to use
7770 dnl ===================================================================
7771 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7772 if test -n "$with_idlc_cpp"; then
7773     AC_MSG_RESULT([$with_idlc_cpp])
7774     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7775 else
7776     AC_MSG_RESULT([ucpp])
7777     AC_MSG_CHECKING([which ucpp tp use])
7778     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7779         AC_MSG_RESULT([external])
7780         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7781     else
7782         AC_MSG_RESULT([internal])
7783         BUILD_TYPE="$BUILD_TYPE UCPP"
7784     fi
7786 AC_SUBST(SYSTEM_UCPP)
7788 dnl ===================================================================
7789 dnl Check for epm (not needed for Windows)
7790 dnl ===================================================================
7791 AC_MSG_CHECKING([whether to enable EPM for packing])
7792 if test "$enable_epm" = "yes"; then
7793     AC_MSG_RESULT([yes])
7794     if test "$_os" != "WINNT"; then
7795         if test $_os = Darwin; then
7796             EPM=internal
7797         elif test -n "$with_epm"; then
7798             EPM=$with_epm
7799         else
7800             AC_PATH_PROG(EPM, epm, no)
7801         fi
7802         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7803             AC_MSG_NOTICE([EPM will be built.])
7804             BUILD_TYPE="$BUILD_TYPE EPM"
7805             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7806         else
7807             # Gentoo has some epm which is something different...
7808             AC_MSG_CHECKING([whether the found epm is the right epm])
7809             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7810                 AC_MSG_RESULT([yes])
7811             else
7812                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7813             fi
7814             AC_MSG_CHECKING([epm version])
7815             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7816             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7817                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7818                 AC_MSG_RESULT([OK, >= 3.7])
7819             else
7820                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7821                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7822             fi
7823         fi
7824     fi
7826     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7827         AC_MSG_CHECKING([for rpm])
7828         for a in "$RPM" rpmbuild rpm; do
7829             $a --usage >/dev/null 2> /dev/null
7830             if test $? -eq 0; then
7831                 RPM=$a
7832                 break
7833             else
7834                 $a --version >/dev/null 2> /dev/null
7835                 if test $? -eq 0; then
7836                     RPM=$a
7837                     break
7838                 fi
7839             fi
7840         done
7841         if test -z "$RPM"; then
7842             AC_MSG_ERROR([not found])
7843         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7844             RPM_PATH=`which $RPM`
7845             AC_MSG_RESULT([$RPM_PATH])
7846             SCPDEFS="$SCPDEFS -DWITH_RPM"
7847         else
7848             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7849         fi
7850     fi
7851     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7852         AC_PATH_PROG(DPKG, dpkg, no)
7853         if test "$DPKG" = "no"; then
7854             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7855         fi
7856     fi
7857     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7858        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7859         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7860             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7861                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7862                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7863                     AC_MSG_RESULT([yes])
7864                 else
7865                     AC_MSG_RESULT([no])
7866                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7867                         _pt="rpm"
7868                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7869                         add_warning "the rpms will need to be installed with --nodeps"
7870                     else
7871                         _pt="pkg"
7872                     fi
7873                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7874                     add_warning "the ${_pt}s will not be relocatable"
7875                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7876                                  relocation will work, you need to patch your epm with the
7877                                  patch in epm/epm-3.7.patch or build with
7878                                  --with-epm=internal which will build a suitable epm])
7879                 fi
7880             fi
7881         fi
7882     fi
7883     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7884         AC_PATH_PROG(PKGMK, pkgmk, no)
7885         if test "$PKGMK" = "no"; then
7886             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7887         fi
7888     fi
7889     AC_SUBST(RPM)
7890     AC_SUBST(DPKG)
7891     AC_SUBST(PKGMK)
7892 else
7893     for i in $PKGFORMAT; do
7894         case "$i" in
7895         aix | bsd | deb | pkg | rpm | native | portable)
7896             AC_MSG_ERROR(
7897                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7898             ;;
7899         esac
7900     done
7901     AC_MSG_RESULT([no])
7902     EPM=NO
7904 AC_SUBST(EPM)
7906 ENABLE_LWP=
7907 if test "$enable_lotuswordpro" = "yes"; then
7908     ENABLE_LWP="TRUE"
7910 AC_SUBST(ENABLE_LWP)
7912 dnl ===================================================================
7913 dnl Check for building ODK
7914 dnl ===================================================================
7915 if test "$enable_odk" = no; then
7916     unset DOXYGEN
7917 else
7918     if test "$with_doxygen" = no; then
7919         AC_MSG_CHECKING([for doxygen])
7920         unset DOXYGEN
7921         AC_MSG_RESULT([no])
7922     else
7923         if test "$with_doxygen" = yes; then
7924             AC_PATH_PROG([DOXYGEN], [doxygen])
7925             if test -z "$DOXYGEN"; then
7926                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7927             fi
7928             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7929                 if ! dot -V 2>/dev/null; then
7930                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7931                 fi
7932             fi
7933         else
7934             AC_MSG_CHECKING([for doxygen])
7935             DOXYGEN=$with_doxygen
7936             AC_MSG_RESULT([$DOXYGEN])
7937         fi
7938         if test -n "$DOXYGEN"; then
7939             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7940             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7941             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7942                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7943             fi
7944         fi
7945     fi
7947 AC_SUBST([DOXYGEN])
7949 AC_MSG_CHECKING([whether to build the ODK])
7950 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7951     AC_MSG_RESULT([yes])
7953     if test "$with_java" != "no"; then
7954         AC_MSG_CHECKING([whether to build unowinreg.dll])
7955         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7956             # build on Win by default
7957             enable_build_unowinreg=yes
7958         fi
7959         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7960             AC_MSG_RESULT([no])
7961             BUILD_UNOWINREG=
7962         else
7963             AC_MSG_RESULT([yes])
7964             BUILD_UNOWINREG=TRUE
7965         fi
7966         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7967             if test -z "$with_mingw_cross_compiler"; then
7968                 dnl Guess...
7969                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7970             elif test -x "$with_mingw_cross_compiler"; then
7971                  MINGWCXX="$with_mingw_cross_compiler"
7972             else
7973                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7974             fi
7976             if test "$MINGWCXX" = "false"; then
7977                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7978             fi
7980             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7981             if test -x "$mingwstrip_test"; then
7982                 MINGWSTRIP="$mingwstrip_test"
7983             else
7984                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7985             fi
7987             if test "$MINGWSTRIP" = "false"; then
7988                 AC_MSG_ERROR(MinGW32 binutils not found.)
7989             fi
7990         fi
7991     fi
7992     BUILD_TYPE="$BUILD_TYPE ODK"
7993 else
7994     AC_MSG_RESULT([no])
7995     BUILD_UNOWINREG=
7997 AC_SUBST(BUILD_UNOWINREG)
7998 AC_SUBST(MINGWCXX)
7999 AC_SUBST(MINGWSTRIP)
8001 dnl ===================================================================
8002 dnl Check for system zlib
8003 dnl ===================================================================
8004 if test "$with_system_zlib" = "auto"; then
8005     case "$_os" in
8006     WINNT)
8007         with_system_zlib="$with_system_libs"
8008         ;;
8009     *)
8010         if test "$enable_fuzzers" != "yes"; then
8011             with_system_zlib=yes
8012         else
8013             with_system_zlib=no
8014         fi
8015         ;;
8016     esac
8019 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8020 dnl and has no pkg-config for it at least on some tinderboxes,
8021 dnl so leaving that out for now
8022 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8023 AC_MSG_CHECKING([which zlib to use])
8024 if test "$with_system_zlib" = "yes"; then
8025     AC_MSG_RESULT([external])
8026     SYSTEM_ZLIB=TRUE
8027     AC_CHECK_HEADER(zlib.h, [],
8028         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8029     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8030         [AC_MSG_ERROR(zlib not found or functional)], [])
8031 else
8032     AC_MSG_RESULT([internal])
8033     SYSTEM_ZLIB=
8034     BUILD_TYPE="$BUILD_TYPE ZLIB"
8035     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8036     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8038 AC_SUBST(ZLIB_CFLAGS)
8039 AC_SUBST(ZLIB_LIBS)
8040 AC_SUBST(SYSTEM_ZLIB)
8042 dnl ===================================================================
8043 dnl Check for system jpeg
8044 dnl ===================================================================
8045 AC_MSG_CHECKING([which libjpeg to use])
8046 if test "$with_system_jpeg" = "yes"; then
8047     AC_MSG_RESULT([external])
8048     SYSTEM_LIBJPEG=TRUE
8049     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8050         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8051     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8052         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8053 else
8054     SYSTEM_LIBJPEG=
8055     AC_MSG_RESULT([internal, libjpeg-turbo])
8056     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8057     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8058     if test "$COM" = "MSC"; then
8059         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8060     else
8061         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8062     fi
8064     case "$host_cpu" in
8065     x86_64 | amd64 | i*86 | x86 | ia32)
8066         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8067         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8068             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8069                 NASM="$LODE_HOME/opt/bin/nasm"
8070             elif test -x "/opt/lo/bin/nasm"; then
8071                 NASM="/opt/lo/bin/nasm"
8072             fi
8073         fi
8075         if test -n "$NASM"; then
8076             AC_MSG_CHECKING([for object file format of host system])
8077             case "$host_os" in
8078               cygwin* | mingw* | pw32* | interix*)
8079                 case "$host_cpu" in
8080                   x86_64)
8081                     objfmt='Win64-COFF'
8082                     ;;
8083                   *)
8084                     objfmt='Win32-COFF'
8085                     ;;
8086                 esac
8087               ;;
8088               msdosdjgpp* | go32*)
8089                 objfmt='COFF'
8090               ;;
8091               os2-emx*) # not tested
8092                 objfmt='MSOMF' # obj
8093               ;;
8094               linux*coff* | linux*oldld*)
8095                 objfmt='COFF' # ???
8096               ;;
8097               linux*aout*)
8098                 objfmt='a.out'
8099               ;;
8100               linux*)
8101                 case "$host_cpu" in
8102                   x86_64)
8103                     objfmt='ELF64'
8104                     ;;
8105                   *)
8106                     objfmt='ELF'
8107                     ;;
8108                 esac
8109               ;;
8110               kfreebsd* | freebsd* | netbsd* | openbsd*)
8111                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8112                   objfmt='BSD-a.out'
8113                 else
8114                   case "$host_cpu" in
8115                     x86_64 | amd64)
8116                       objfmt='ELF64'
8117                       ;;
8118                     *)
8119                       objfmt='ELF'
8120                       ;;
8121                   esac
8122                 fi
8123               ;;
8124               solaris* | sunos* | sysv* | sco*)
8125                 case "$host_cpu" in
8126                   x86_64)
8127                     objfmt='ELF64'
8128                     ;;
8129                   *)
8130                     objfmt='ELF'
8131                     ;;
8132                 esac
8133               ;;
8134               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8135                 case "$host_cpu" in
8136                   x86_64)
8137                     objfmt='Mach-O64'
8138                     ;;
8139                   *)
8140                     objfmt='Mach-O'
8141                     ;;
8142                 esac
8143               ;;
8144               *)
8145                 objfmt='ELF ?'
8146               ;;
8147             esac
8149             AC_MSG_RESULT([$objfmt])
8150             if test "$objfmt" = 'ELF ?'; then
8151               objfmt='ELF'
8152               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8153             fi
8155             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8156             case "$objfmt" in
8157               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8158               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8159               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8160               COFF)       NAFLAGS='-fcoff -DCOFF';;
8161               a.out)      NAFLAGS='-faout -DAOUT';;
8162               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8163               ELF)        NAFLAGS='-felf -DELF';;
8164               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8165               RDF)        NAFLAGS='-frdf -DRDF';;
8166               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8167               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8168             esac
8169             AC_MSG_RESULT([$NAFLAGS])
8171             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8172             cat > conftest.asm << EOF
8173             [%line __oline__ "configure"
8174                     section .text
8175                     global  _main,main
8176             _main:
8177             main:   xor     eax,eax
8178                     ret
8179             ]
8181             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8182             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8183               AC_MSG_RESULT(yes)
8184             else
8185               echo "configure: failed program was:" >&AC_FD_CC
8186               cat conftest.asm >&AC_FD_CC
8187               rm -rf conftest*
8188               AC_MSG_RESULT(no)
8189               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8190               NASM=""
8191             fi
8193         fi
8195         if test -z "$NASM"; then
8196 cat << _EOS
8197 ****************************************************************************
8198 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8199 To get one please:
8201 _EOS
8202             if test "$build_os" = "cygwin"; then
8203 cat << _EOS
8204 install a pre-compiled binary for Win32
8206 mkdir -p /opt/lo/bin
8207 cd /opt/lo/bin
8208 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8209 chmod +x nasm
8211 or get and install one from http://www.nasm.us/
8213 Then re-run autogen.sh
8215 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8216 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8218 _EOS
8219             else
8220 cat << _EOS
8221 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8223 _EOS
8224             fi
8225             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8226             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8227         fi
8228       ;;
8229     esac
8232 AC_SUBST(NASM)
8233 AC_SUBST(LIBJPEG_CFLAGS)
8234 AC_SUBST(LIBJPEG_LIBS)
8235 AC_SUBST(SYSTEM_LIBJPEG)
8237 dnl ===================================================================
8238 dnl Check for system clucene
8239 dnl ===================================================================
8240 dnl we should rather be using
8241 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8242 dnl but the contribs-lib check seems tricky
8243 AC_MSG_CHECKING([which clucene to use])
8244 if test "$with_system_clucene" = "yes"; then
8245     AC_MSG_RESULT([external])
8246     SYSTEM_CLUCENE=TRUE
8247     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8248     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8249     FilterLibs "${CLUCENE_LIBS}"
8250     CLUCENE_LIBS="${filteredlibs}"
8251     AC_LANG_PUSH([C++])
8252     save_CXXFLAGS=$CXXFLAGS
8253     save_CPPFLAGS=$CPPFLAGS
8254     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8255     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8256     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8257     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8258     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8259                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8260     CXXFLAGS=$save_CXXFLAGS
8261     CPPFLAGS=$save_CPPFLAGS
8262     AC_LANG_POP([C++])
8264     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8265 else
8266     AC_MSG_RESULT([internal])
8267     SYSTEM_CLUCENE=
8268     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8270 AC_SUBST(SYSTEM_CLUCENE)
8271 AC_SUBST(CLUCENE_CFLAGS)
8272 AC_SUBST(CLUCENE_LIBS)
8274 dnl ===================================================================
8275 dnl Check for system expat
8276 dnl ===================================================================
8277 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8279 dnl ===================================================================
8280 dnl Check for system xmlsec
8281 dnl ===================================================================
8282 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8284 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8285 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8286     ENABLE_EOT="TRUE"
8287     AC_DEFINE([ENABLE_EOT])
8288     AC_MSG_RESULT([yes])
8290     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8291 else
8292     ENABLE_EOT=
8293     AC_MSG_RESULT([no])
8295 AC_SUBST([ENABLE_EOT])
8297 dnl ===================================================================
8298 dnl Check for DLP libs
8299 dnl ===================================================================
8300 AS_IF([test "$COM" = "MSC"],
8301       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8302       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8304 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8306 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8308 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8310 AS_IF([test "$COM" = "MSC"],
8311       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8312       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8314 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8316 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8318 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8319 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8321 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8323 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8325 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8327 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8328 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8330 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8331 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8333 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8335 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8336 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8338 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8340 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8342 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8344 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8346 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8347 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8349 dnl ===================================================================
8350 dnl Check for system lcms2
8351 dnl ===================================================================
8352 if test "$with_system_lcms2" != "yes"; then
8353     SYSTEM_LCMS2=
8355 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8356 if test "$GCC" = "yes"; then
8357     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8359 if test "$COM" = "MSC"; then # override the above
8360     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8363 dnl ===================================================================
8364 dnl Check for system cppunit
8365 dnl ===================================================================
8366 if test "$_os" != "Android" ; then
8367     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8370 dnl ===================================================================
8371 dnl Check whether freetype is available
8372 dnl ===================================================================
8373 if test  "$test_freetype" = "yes"; then
8374     AC_MSG_CHECKING([whether freetype is available])
8375     # FreeType has 3 different kinds of versions
8376     # * release, like 2.4.10
8377     # * libtool, like 13.0.7 (this what pkg-config returns)
8378     # * soname
8379     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8380     #
8381     # 9.9.3 is 2.2.0
8382     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8383     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8384     FilterLibs "${FREETYPE_LIBS}"
8385     FREETYPE_LIBS="${filteredlibs}"
8386     SYSTEM_FREETYPE=TRUE
8387 else
8388     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8389     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8391 AC_SUBST(FREETYPE_CFLAGS)
8392 AC_SUBST(FREETYPE_LIBS)
8393 AC_SUBST([SYSTEM_FREETYPE])
8395 # ===================================================================
8396 # Check for system libxslt
8397 # to prevent incompatibilities between internal libxml2 and external libxslt,
8398 # or vice versa, use with_system_libxml here
8399 # ===================================================================
8400 if test "$with_system_libxml" = "auto"; then
8401     case "$_os" in
8402     WINNT|iOS|Android)
8403         with_system_libxml="$with_system_libs"
8404         ;;
8405     *)
8406         if test "$enable_fuzzers" != "yes"; then
8407             with_system_libxml=yes
8408         else
8409             with_system_libxml=no
8410         fi
8411         ;;
8412     esac
8415 AC_MSG_CHECKING([which libxslt to use])
8416 if test "$with_system_libxml" = "yes"; then
8417     AC_MSG_RESULT([external])
8418     SYSTEM_LIBXSLT=TRUE
8419     if test "$_os" = "Darwin"; then
8420         dnl make sure to use SDK path
8421         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8422         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8423         dnl omit -L/usr/lib
8424         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8425         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8426     else
8427         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8428         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8429         FilterLibs "${LIBXSLT_LIBS}"
8430         LIBXSLT_LIBS="${filteredlibs}"
8431         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8432         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8433         FilterLibs "${LIBEXSLT_LIBS}"
8434         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8435     fi
8437     dnl Check for xsltproc
8438     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8439     if test "$XSLTPROC" = "no"; then
8440         AC_MSG_ERROR([xsltproc is required])
8441     fi
8442 else
8443     AC_MSG_RESULT([internal])
8444     SYSTEM_LIBXSLT=
8445     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8447     if test "$cross_compiling" = "yes"; then
8448         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8449         if test "$XSLTPROC" = "no"; then
8450             AC_MSG_ERROR([xsltproc is required])
8451         fi
8452     fi
8454 AC_SUBST(SYSTEM_LIBXSLT)
8455 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8456     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8458 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8460 AC_SUBST(LIBEXSLT_CFLAGS)
8461 AC_SUBST(LIBEXSLT_LIBS)
8462 AC_SUBST(LIBXSLT_CFLAGS)
8463 AC_SUBST(LIBXSLT_LIBS)
8464 AC_SUBST(XSLTPROC)
8466 # ===================================================================
8467 # Check for system libxml
8468 # ===================================================================
8469 AC_MSG_CHECKING([which libxml to use])
8470 if test "$with_system_libxml" = "yes"; then
8471     AC_MSG_RESULT([external])
8472     SYSTEM_LIBXML=TRUE
8473     if test "$_os" = "Darwin"; then
8474         dnl make sure to use SDK path
8475         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8476         dnl omit -L/usr/lib
8477         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8478     elif test $_os = iOS; then
8479         dnl make sure to use SDK path
8480         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8481         LIBXML_CFLAGS="-I$usr/include/libxml2"
8482         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8483     else
8484         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8485         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8486         FilterLibs "${LIBXML_LIBS}"
8487         LIBXML_LIBS="${filteredlibs}"
8488     fi
8490     dnl Check for xmllint
8491     AC_PATH_PROG(XMLLINT, xmllint, no)
8492     if test "$XMLLINT" = "no"; then
8493         AC_MSG_ERROR([xmllint is required])
8494     fi
8495 else
8496     AC_MSG_RESULT([internal])
8497     SYSTEM_LIBXML=
8498     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8499     if test "$COM" = "MSC"; then
8500         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8501     fi
8502     if test "$COM" = "MSC"; then
8503         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8504     else
8505         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8506     fi
8507     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8509 AC_SUBST(SYSTEM_LIBXML)
8510 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8511     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8513 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8514 AC_SUBST(LIBXML_CFLAGS)
8515 AC_SUBST(LIBXML_LIBS)
8516 AC_SUBST(XMLLINT)
8518 # =====================================================================
8519 # Checking for a Python interpreter with version >= 2.7.
8520 # Build and runtime requires Python 3 compatible version (>= 2.7).
8521 # Optionally user can pass an option to configure, i. e.
8522 # ./configure PYTHON=/usr/bin/python
8523 # =====================================================================
8524 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8525     if test -n "$PYTHON"; then
8526         PYTHON_FOR_BUILD=$PYTHON
8527     else
8528         # This allows a lack of system python with no error, we use internal one in that case.
8529         AM_PATH_PYTHON([2.7],, [:])
8530         # Clean PYTHON_VERSION checked below if cross-compiling
8531         PYTHON_VERSION=""
8532         if test "$PYTHON" != ":"; then
8533             PYTHON_FOR_BUILD=$PYTHON
8534         fi
8535     fi
8537 AC_SUBST(PYTHON_FOR_BUILD)
8539 # Checks for Python to use for Pyuno
8540 AC_MSG_CHECKING([which Python to use for Pyuno])
8541 case "$enable_python" in
8542 no|disable)
8543     if test -z $PYTHON_FOR_BUILD; then
8544         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8545         # requirement from the choice whether to include Python stuff in the installer, but why
8546         # bother?
8547         AC_MSG_ERROR([Python is required at build time.])
8548     fi
8549     enable_python=no
8550     AC_MSG_RESULT([none])
8551     ;;
8552 ""|yes|auto)
8553     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8554         AC_MSG_RESULT([no, overridden by --disable-scripting])
8555         enable_python=no
8556     elif test $build_os = cygwin; then
8557         dnl When building on Windows we don't attempt to use any installed
8558         dnl "system"  Python.
8559         AC_MSG_RESULT([fully internal])
8560         enable_python=internal
8561     elif test "$cross_compiling" = yes; then
8562         AC_MSG_RESULT([system])
8563         enable_python=system
8564     else
8565         # Unset variables set by the above AM_PATH_PYTHON so that
8566         # we actually do check anew.
8567         AC_MSG_RESULT([])
8568         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
8569         AM_PATH_PYTHON([3.3],, [:])
8570         AC_MSG_CHECKING([which Python to use for Pyuno])
8571         if test "$PYTHON" = ":"; then
8572             if test -z "$PYTHON_FOR_BUILD"; then
8573                 AC_MSG_RESULT([fully internal])
8574             else
8575                 AC_MSG_RESULT([internal])
8576             fi
8577             enable_python=internal
8578         else
8579             AC_MSG_RESULT([system])
8580             enable_python=system
8581         fi
8582     fi
8583     ;;
8584 internal)
8585     AC_MSG_RESULT([internal])
8586     ;;
8587 fully-internal)
8588     AC_MSG_RESULT([fully internal])
8589     enable_python=internal
8590     ;;
8591 system)
8592     AC_MSG_RESULT([system])
8593     if test "$_os" = Darwin; then
8594         AC_MSG_ERROR([--enable-python=system doesn't work on macOS: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h is known to contain uses of "register", which is removed from C++17])
8595     fi
8596     ;;
8598     AC_MSG_ERROR([Incorrect --enable-python option])
8599     ;;
8600 esac
8602 if test $enable_python != no; then
8603     BUILD_TYPE="$BUILD_TYPE PYUNO"
8606 if test $enable_python = system; then
8607     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8608         # Fallback: Accept these in the environment, or as set above
8609         # for MacOSX.
8610         :
8611     elif test "$cross_compiling" != yes; then
8612         # Unset variables set by the above AM_PATH_PYTHON so that
8613         # we actually do check anew.
8614         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
8615         # This causes an error if no python command is found
8616         AM_PATH_PYTHON([3.3])
8617         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8618         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8619         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8620         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8621         if test -z "$PKG_CONFIG"; then
8622             PYTHON_CFLAGS="-I$python_include"
8623             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8624         elif $PKG_CONFIG --exists python-$python_version-embed; then
8625             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8626             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8627         elif $PKG_CONFIG --exists python-$python_version; then
8628             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8629             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8630         else
8631             PYTHON_CFLAGS="-I$python_include"
8632             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8633         fi
8634         FilterLibs "${PYTHON_LIBS}"
8635         PYTHON_LIBS="${filteredlibs}"
8636     else
8637         dnl How to find out the cross-compilation Python installation path?
8638         AC_MSG_CHECKING([for python version])
8639         AS_IF([test -n "$PYTHON_VERSION"],
8640               [AC_MSG_RESULT([$PYTHON_VERSION])],
8641               [AC_MSG_RESULT([not found])
8642                AC_MSG_ERROR([no usable python found])])
8643         test -n "$PYTHON_CFLAGS" && break
8644     fi
8646     dnl Check if the headers really work
8647     save_CPPFLAGS="$CPPFLAGS"
8648     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8649     AC_CHECK_HEADER(Python.h)
8650     CPPFLAGS="$save_CPPFLAGS"
8652     # let the PYTHON_FOR_BUILD match the same python installation that
8653     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8654     # better for PythonTests.
8655     PYTHON_FOR_BUILD=$PYTHON
8658 if test "$with_lxml" != no; then
8659     if test -z "$PYTHON_FOR_BUILD"; then
8660         case $build_os in
8661             cygwin)
8662                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8663                 ;;
8664             *)
8665                 if test "$cross_compiling" != yes ; then
8666                     BUILD_TYPE="$BUILD_TYPE LXML"
8667                 fi
8668                 ;;
8669         esac
8670     else
8671         AC_MSG_CHECKING([for python lxml])
8672         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8673             AC_MSG_RESULT([yes])
8674         else
8675             case $build_os in
8676                 cygwin)
8677                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8678                     ;;
8679                 *)
8680                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8681                         BUILD_TYPE="$BUILD_TYPE LXML"
8682                         AC_MSG_RESULT([no, using internal lxml])
8683                     else
8684                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8685                     fi
8686                     ;;
8687             esac
8688         fi
8689     fi
8692 dnl By now enable_python should be "system", "internal" or "no"
8693 case $enable_python in
8694 system)
8695     SYSTEM_PYTHON=TRUE
8697     if test "x$ac_cv_header_Python_h" != "xyes"; then
8698        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8699     fi
8701     AC_LANG_PUSH(C)
8702     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8703     AC_MSG_CHECKING([for correct python library version])
8704        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8705 #include <Python.h>
8707 int main(int argc, char **argv) {
8708    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8709        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8710    else return 1;
8712        ]])],[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])])
8713     CFLAGS=$save_CFLAGS
8714     AC_LANG_POP(C)
8716     dnl FIXME Check if the Python library can be linked with, too?
8717     ;;
8719 internal)
8720     SYSTEM_PYTHON=
8721     PYTHON_VERSION_MAJOR=3
8722     PYTHON_VERSION_MINOR=5
8723     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8724     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8725         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8726     fi
8727     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8728     BUILD_TYPE="$BUILD_TYPE PYTHON"
8729     # Embedded Python dies without Home set
8730     if test "$HOME" = ""; then
8731         export HOME=""
8732     fi
8733     ;;
8735     DISABLE_PYTHON=TRUE
8736     SYSTEM_PYTHON=
8737     ;;
8739     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8740     ;;
8741 esac
8743 AC_SUBST(DISABLE_PYTHON)
8744 AC_SUBST(SYSTEM_PYTHON)
8745 AC_SUBST(PYTHON_CFLAGS)
8746 AC_SUBST(PYTHON_LIBS)
8747 AC_SUBST(PYTHON_VERSION)
8748 AC_SUBST(PYTHON_VERSION_MAJOR)
8749 AC_SUBST(PYTHON_VERSION_MINOR)
8751 ENABLE_MARIADBC=TRUE
8752 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8753     ENABLE_MARIADBC=
8755 MARIADBC_MAJOR=1
8756 MARIADBC_MINOR=0
8757 MARIADBC_MICRO=2
8758 if test "$ENABLE_MARIADBC" = "TRUE"; then
8759     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8762 AC_SUBST(ENABLE_MARIADBC)
8763 AC_SUBST(MARIADBC_MAJOR)
8764 AC_SUBST(MARIADBC_MINOR)
8765 AC_SUBST(MARIADBC_MICRO)
8767 if test "$ENABLE_MARIADBC" = "TRUE"; then
8768     dnl ===================================================================
8769     dnl Check for system MariaDB
8770     dnl ===================================================================
8771     AC_MSG_CHECKING([which MariaDB to use])
8772     if test "$with_system_mariadb" = "yes"; then
8773         AC_MSG_RESULT([external])
8774         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8775         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8776         if test -z "$MARIADBCONFIG"; then
8777             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8778             if test -z "$MARIADBCONFIG"; then
8779                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8780                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8781             fi
8782         fi
8783         AC_MSG_CHECKING([MariaDB version])
8784         MARIADB_VERSION=`$MARIADBCONFIG --version`
8785         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8786         if test "$MARIADB_MAJOR" -ge "5"; then
8787             AC_MSG_RESULT([OK])
8788         else
8789             AC_MSG_ERROR([too old, use 5.0.x or later])
8790         fi
8791         AC_MSG_CHECKING([for MariaDB Client library])
8792         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8793         if test "$COM_IS_CLANG" = TRUE; then
8794             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8795         fi
8796         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8797         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8798         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8799         dnl linux32:
8800         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8801             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8802             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8803                 | sed -e 's|/lib64/|/lib/|')
8804         fi
8805         FilterLibs "${MARIADB_LIBS}"
8806         MARIADB_LIBS="${filteredlibs}"
8807         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8808         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8809         if test "$enable_bundle_mariadb" = "yes"; then
8810             AC_MSG_RESULT([yes])
8811             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8812             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8814 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8816 /g' | grep -E '(mysqlclient|mariadb)')
8817             if test "$_os" = "Darwin"; then
8818                 LIBMARIADB=${LIBMARIADB}.dylib
8819             elif test "$_os" = "WINNT"; then
8820                 LIBMARIADB=${LIBMARIADB}.dll
8821             else
8822                 LIBMARIADB=${LIBMARIADB}.so
8823             fi
8824             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8825             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8826             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8827                 AC_MSG_RESULT([found.])
8828                 PathFormat "$LIBMARIADB_PATH"
8829                 LIBMARIADB_PATH="$formatted_path"
8830             else
8831                 AC_MSG_ERROR([not found.])
8832             fi
8833         else
8834             AC_MSG_RESULT([no])
8835             BUNDLE_MARIADB_CONNECTOR_C=
8836         fi
8837     else
8838         AC_MSG_RESULT([internal])
8839         SYSTEM_MARIADB_CONNECTOR_C=
8840         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8841         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8842         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8843     fi
8845     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8846     AC_SUBST(MARIADB_CFLAGS)
8847     AC_SUBST(MARIADB_LIBS)
8848     AC_SUBST(LIBMARIADB)
8849     AC_SUBST(LIBMARIADB_PATH)
8850     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8853 dnl ===================================================================
8854 dnl Check for system hsqldb
8855 dnl ===================================================================
8856 if test "$with_java" != "no"; then
8857     HSQLDB_USE_JDBC_4_1=
8858     AC_MSG_CHECKING([which hsqldb to use])
8859     if test "$with_system_hsqldb" = "yes"; then
8860         AC_MSG_RESULT([external])
8861         SYSTEM_HSQLDB=TRUE
8862         if test -z $HSQLDB_JAR; then
8863             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8864         fi
8865         if ! test -f $HSQLDB_JAR; then
8866                AC_MSG_ERROR(hsqldb.jar not found.)
8867         fi
8868         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8869         export HSQLDB_JAR
8870         if $PERL -e \
8871            'use Archive::Zip;
8872             my $file = "$ENV{'HSQLDB_JAR'}";
8873             my $zip = Archive::Zip->new( $file );
8874             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8875             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8876             {
8877                 push @l, split(/\n/, $mf);
8878                 foreach my $line (@l)
8879                 {
8880                     if ($line =~ m/Specification-Version:/)
8881                     {
8882                         ($t, $version) = split (/:/,$line);
8883                         $version =~ s/^\s//;
8884                         ($a, $b, $c, $d) = split (/\./,$version);
8885                         if ($c == "0" && $d > "8")
8886                         {
8887                             exit 0;
8888                         }
8889                         else
8890                         {
8891                             exit 1;
8892                         }
8893                     }
8894                 }
8895             }
8896             else
8897             {
8898                 exit 1;
8899             }'; then
8900             AC_MSG_RESULT([yes])
8901         else
8902             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8903         fi
8904     else
8905         AC_MSG_RESULT([internal])
8906         SYSTEM_HSQLDB=
8907         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8908         NEED_ANT=TRUE
8909         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8910         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8911         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8912             AC_MSG_RESULT([yes])
8913             HSQLDB_USE_JDBC_4_1=TRUE
8914         else
8915             AC_MSG_RESULT([no])
8916         fi
8917     fi
8918     AC_SUBST(SYSTEM_HSQLDB)
8919     AC_SUBST(HSQLDB_JAR)
8920     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8923 dnl ===================================================================
8924 dnl Check for PostgreSQL stuff
8925 dnl ===================================================================
8926 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8927 if test "x$enable_postgresql_sdbc" != "xno"; then
8928     AC_MSG_RESULT([yes])
8929     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8931     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8932         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8933     fi
8934     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8935         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8936     fi
8938     postgres_interface=""
8939     if test "$with_system_postgresql" = "yes"; then
8940         postgres_interface="external PostgreSQL"
8941         SYSTEM_POSTGRESQL=TRUE
8942         if test "$_os" = Darwin; then
8943             supp_path=''
8944             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8945                 pg_supp_path="$P_SEP$d$pg_supp_path"
8946             done
8947         fi
8948         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8949         if test -n "$PGCONFIG"; then
8950             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8951             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8952         else
8953             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8954               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8955               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8956             ],[
8957               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8958             ])
8959         fi
8960         FilterLibs "${POSTGRESQL_LIB}"
8961         POSTGRESQL_LIB="${filteredlibs}"
8962     else
8963         # if/when anything else than PostgreSQL uses Kerberos,
8964         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8965         WITH_KRB5=
8966         WITH_GSSAPI=
8967         case "$_os" in
8968         Darwin)
8969             # macOS has system MIT Kerberos 5 since 10.4
8970             if test "$with_krb5" != "no"; then
8971                 WITH_KRB5=TRUE
8972                 save_LIBS=$LIBS
8973                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8974                 # that the libraries where these functions are located on macOS will change, is it?
8975                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8976                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8977                 KRB5_LIBS=$LIBS
8978                 LIBS=$save_LIBS
8979                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8980                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8981                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8982                 LIBS=$save_LIBS
8983             fi
8984             if test "$with_gssapi" != "no"; then
8985                 WITH_GSSAPI=TRUE
8986                 save_LIBS=$LIBS
8987                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8988                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8989                 GSSAPI_LIBS=$LIBS
8990                 LIBS=$save_LIBS
8991             fi
8992             ;;
8993         WINNT)
8994             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8995                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8996             fi
8997             ;;
8998         Linux|GNU|*BSD|DragonFly)
8999             if test "$with_krb5" != "no"; then
9000                 WITH_KRB5=TRUE
9001                 save_LIBS=$LIBS
9002                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9003                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9004                 KRB5_LIBS=$LIBS
9005                 LIBS=$save_LIBS
9006                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9007                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9008                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9009                 LIBS=$save_LIBS
9010             fi
9011             if test "$with_gssapi" != "no"; then
9012                 WITH_GSSAPI=TRUE
9013                 save_LIBS=$LIBS
9014                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9015                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9016                 GSSAPI_LIBS=$LIBS
9017                 LIBS=$save_LIBS
9018             fi
9019             ;;
9020         *)
9021             if test "$with_krb5" = "yes"; then
9022                 WITH_KRB5=TRUE
9023                 save_LIBS=$LIBS
9024                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9025                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9026                 KRB5_LIBS=$LIBS
9027                 LIBS=$save_LIBS
9028                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9029                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9030                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9031                 LIBS=$save_LIBS
9032             fi
9033             if test "$with_gssapi" = "yes"; then
9034                 WITH_GSSAPI=TRUE
9035                 save_LIBS=$LIBS
9036                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9037                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9038                 LIBS=$save_LIBS
9039                 GSSAPI_LIBS=$LIBS
9040             fi
9041         esac
9043         if test -n "$with_libpq_path"; then
9044             SYSTEM_POSTGRESQL=TRUE
9045             postgres_interface="external libpq"
9046             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9047             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9048         else
9049             SYSTEM_POSTGRESQL=
9050             postgres_interface="internal"
9051             POSTGRESQL_LIB=""
9052             POSTGRESQL_INC="%OVERRIDE_ME%"
9053             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9054         fi
9055     fi
9057     AC_MSG_CHECKING([PostgreSQL C interface])
9058     AC_MSG_RESULT([$postgres_interface])
9060     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9061         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9062         save_CFLAGS=$CFLAGS
9063         save_CPPFLAGS=$CPPFLAGS
9064         save_LIBS=$LIBS
9065         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9066         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9067         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9068         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9069             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9070         CFLAGS=$save_CFLAGS
9071         CPPFLAGS=$save_CPPFLAGS
9072         LIBS=$save_LIBS
9073     fi
9074     BUILD_POSTGRESQL_SDBC=TRUE
9075 else
9076     AC_MSG_RESULT([no])
9078 AC_SUBST(WITH_KRB5)
9079 AC_SUBST(WITH_GSSAPI)
9080 AC_SUBST(GSSAPI_LIBS)
9081 AC_SUBST(KRB5_LIBS)
9082 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9083 AC_SUBST(SYSTEM_POSTGRESQL)
9084 AC_SUBST(POSTGRESQL_INC)
9085 AC_SUBST(POSTGRESQL_LIB)
9087 dnl ===================================================================
9088 dnl Check for Firebird stuff
9089 dnl ===================================================================
9090 ENABLE_FIREBIRD_SDBC=
9091 if test "$enable_firebird_sdbc" = "yes" ; then
9092     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9094     dnl ===================================================================
9095     dnl Check for system Firebird
9096     dnl ===================================================================
9097     AC_MSG_CHECKING([which Firebird to use])
9098     if test "$with_system_firebird" = "yes"; then
9099         AC_MSG_RESULT([external])
9100         SYSTEM_FIREBIRD=TRUE
9101         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9102         if test -z "$FIREBIRDCONFIG"; then
9103             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9104             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9105                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9106             ])
9107             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9108         else
9109             AC_MSG_NOTICE([fb_config found])
9110             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9111             AC_MSG_CHECKING([for Firebird Client library])
9112             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9113             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9114             FilterLibs "${FIREBIRD_LIBS}"
9115             FIREBIRD_LIBS="${filteredlibs}"
9116         fi
9117         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9118         AC_MSG_CHECKING([Firebird version])
9119         if test -n "${FIREBIRD_VERSION}"; then
9120             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9121             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9122             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9123                 AC_MSG_RESULT([OK])
9124             else
9125                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9126             fi
9127         else
9128             __save_CFLAGS="${CFLAGS}"
9129             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9130             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9131 #if defined(FB_API_VER) && FB_API_VER == 30
9132 int fb_api_is_30(void) { return 0; }
9133 #else
9134 #error "Wrong Firebird API version"
9135 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9136             CFLAGS="${__save_CFLAGS}"
9137         fi
9138         ENABLE_FIREBIRD_SDBC=TRUE
9139         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9140     elif test "$enable_database_connectivity" != yes; then
9141         AC_MSG_RESULT([none])
9142     elif test "$cross_compiling" = "yes"; then
9143         AC_MSG_RESULT([none])
9144     else
9145         dnl Embedded Firebird has version 3.0
9146         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9147         dnl We need libatomic_ops for any non X86/X64 system
9148         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9149             dnl ===================================================================
9150             dnl Check for system libatomic_ops
9151             dnl ===================================================================
9152             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9153             if test "$with_system_libatomic_ops" = "yes"; then
9154                 SYSTEM_LIBATOMIC_OPS=TRUE
9155                 AC_CHECK_HEADERS(atomic_ops.h, [],
9156                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9157             else
9158                 SYSTEM_LIBATOMIC_OPS=
9159                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9160                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9161                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9162             fi
9163         fi
9165         AC_MSG_RESULT([internal])
9166         SYSTEM_FIREBIRD=
9167         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9168         FIREBIRD_LIBS="-lfbclient"
9170         if test "$with_system_libtommath" = "yes"; then
9171             SYSTEM_LIBTOMMATH=TRUE
9172             dnl check for tommath presence
9173             save_LIBS=$LIBS
9174             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9175             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9176             LIBS=$save_LIBS
9177         else
9178             SYSTEM_LIBTOMMATH=
9179             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9180             LIBTOMMATH_LIBS="-ltommath"
9181             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9182         fi
9184         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9185         ENABLE_FIREBIRD_SDBC=TRUE
9186         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9187     fi
9189 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9190 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9191 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9192 AC_SUBST(LIBATOMIC_OPS_LIBS)
9193 AC_SUBST(SYSTEM_FIREBIRD)
9194 AC_SUBST(FIREBIRD_CFLAGS)
9195 AC_SUBST(FIREBIRD_LIBS)
9196 AC_SUBST([TOMMATH_CFLAGS])
9197 AC_SUBST([TOMMATH_LIBS])
9199 dnl ===================================================================
9200 dnl Check for system curl
9201 dnl ===================================================================
9202 AC_MSG_CHECKING([which libcurl to use])
9203 if test "$with_system_curl" = "auto"; then
9204     with_system_curl="$with_system_libs"
9207 if test "$with_system_curl" = "yes"; then
9208     AC_MSG_RESULT([external])
9209     SYSTEM_CURL=TRUE
9211     # First try PKGCONFIG and then fall back
9212     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9214     if test -n "$CURL_PKG_ERRORS"; then
9215         AC_PATH_PROG(CURLCONFIG, curl-config)
9216         if test -z "$CURLCONFIG"; then
9217             AC_MSG_ERROR([curl development files not found])
9218         fi
9219         CURL_LIBS=`$CURLCONFIG --libs`
9220         FilterLibs "${CURL_LIBS}"
9221         CURL_LIBS="${filteredlibs}"
9222         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9223         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9225         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9226         case $curl_version in
9227         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9228         dnl so they need to be doubled to end up in the configure script
9229         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9230             AC_MSG_RESULT([yes])
9231             ;;
9232         *)
9233             AC_MSG_ERROR([no, you have $curl_version])
9234             ;;
9235         esac
9236     fi
9238     ENABLE_CURL=TRUE
9239 elif test $_os = iOS; then
9240     # Let's see if we need curl, I think not?
9241     AC_MSG_RESULT([none])
9242     ENABLE_CURL=
9243 else
9244     AC_MSG_RESULT([internal])
9245     SYSTEM_CURL=
9246     BUILD_TYPE="$BUILD_TYPE CURL"
9247     ENABLE_CURL=TRUE
9249 AC_SUBST(SYSTEM_CURL)
9250 AC_SUBST(CURL_CFLAGS)
9251 AC_SUBST(CURL_LIBS)
9252 AC_SUBST(ENABLE_CURL)
9254 dnl ===================================================================
9255 dnl Check for system boost
9256 dnl ===================================================================
9257 AC_MSG_CHECKING([which boost to use])
9258 if test "$with_system_boost" = "yes"; then
9259     AC_MSG_RESULT([external])
9260     SYSTEM_BOOST=TRUE
9261     AX_BOOST_BASE(1.47)
9262     AX_BOOST_DATE_TIME
9263     AX_BOOST_FILESYSTEM
9264     AX_BOOST_IOSTREAMS
9265     AX_BOOST_LOCALE
9266     AC_LANG_PUSH([C++])
9267     save_CXXFLAGS=$CXXFLAGS
9268     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9269     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9270        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9271     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9272        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9273     CXXFLAGS=$save_CXXFLAGS
9274     AC_LANG_POP([C++])
9275     # this is in m4/ax_boost_base.m4
9276     FilterLibs "${BOOST_LDFLAGS}"
9277     BOOST_LDFLAGS="${filteredlibs}"
9278 else
9279     AC_MSG_RESULT([internal])
9280     BUILD_TYPE="$BUILD_TYPE BOOST"
9281     SYSTEM_BOOST=
9282     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9283         # use warning-suppressing wrapper headers
9284         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9285     else
9286         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9287     fi
9289 AC_SUBST(SYSTEM_BOOST)
9291 dnl ===================================================================
9292 dnl Check for system mdds
9293 dnl ===================================================================
9294 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9296 dnl ===================================================================
9297 dnl Check for system glm
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([which glm to use])
9300 if test "$with_system_glm" = "yes"; then
9301     AC_MSG_RESULT([external])
9302     SYSTEM_GLM=TRUE
9303     AC_LANG_PUSH([C++])
9304     AC_CHECK_HEADER([glm/glm.hpp], [],
9305        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9306     AC_LANG_POP([C++])
9307 else
9308     AC_MSG_RESULT([internal])
9309     BUILD_TYPE="$BUILD_TYPE GLM"
9310     SYSTEM_GLM=
9311     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9313 AC_SUBST([GLM_CFLAGS])
9314 AC_SUBST([SYSTEM_GLM])
9316 dnl ===================================================================
9317 dnl Check for system odbc
9318 dnl ===================================================================
9319 AC_MSG_CHECKING([which odbc headers to use])
9320 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
9321     AC_MSG_RESULT([external])
9322     SYSTEM_ODBC_HEADERS=TRUE
9324     if test "$build_os" = "cygwin"; then
9325         save_CPPFLAGS=$CPPFLAGS
9326         find_winsdk
9327         PathFormat "$winsdktest"
9328         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"
9329         AC_CHECK_HEADER(sqlext.h, [],
9330             [AC_MSG_ERROR(odbc not found. install odbc)],
9331             [#include <windows.h>])
9332         CPPFLAGS=$save_CPPFLAGS
9333     else
9334         AC_CHECK_HEADER(sqlext.h, [],
9335             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9336     fi
9337 elif test "$enable_database_connectivity" != yes; then
9338     AC_MSG_RESULT([none])
9339 else
9340     AC_MSG_RESULT([internal])
9341     SYSTEM_ODBC_HEADERS=
9343 AC_SUBST(SYSTEM_ODBC_HEADERS)
9345 dnl ===================================================================
9346 dnl Enable LDAP support
9347 dnl ===================================================================
9349 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9350 AC_MSG_CHECKING([whether to enable LDAP support])
9351     if test "$enable_ldap" != "yes"; then
9352         AC_MSG_RESULT([no])
9353         ENABLE_LDAP=""
9354         enable_ldap=no
9355     else
9356         AC_MSG_RESULT([yes])
9357         ENABLE_LDAP="TRUE"
9358         AC_DEFINE(HAVE_FEATURE_LDAP)
9359     fi
9361 AC_SUBST(ENABLE_LDAP)
9363 dnl ===================================================================
9364 dnl Check for system openldap
9365 dnl ===================================================================
9367 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9368 AC_MSG_CHECKING([which openldap library to use])
9369 if test "$with_system_openldap" = "yes"; then
9370     AC_MSG_RESULT([external])
9371     SYSTEM_OPENLDAP=TRUE
9372     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9373     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9374     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9375 else
9376     AC_MSG_RESULT([internal])
9377     SYSTEM_OPENLDAP=
9378     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9381 AC_SUBST(SYSTEM_OPENLDAP)
9383 dnl ===================================================================
9384 dnl Check for system NSS
9385 dnl ===================================================================
9386 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9387     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9388     AC_DEFINE(HAVE_FEATURE_NSS)
9389     ENABLE_NSS="TRUE"
9390     AC_DEFINE(ENABLE_NSS)
9391 elif test $_os != iOS ; then
9392     with_tls=openssl
9394 AC_SUBST(ENABLE_NSS)
9396 dnl ===================================================================
9397 dnl Check for TLS/SSL and cryptographic implementation to use
9398 dnl ===================================================================
9399 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9400 if test -n "$with_tls"; then
9401     case $with_tls in
9402     openssl)
9403         AC_DEFINE(USE_TLS_OPENSSL)
9404         TLS=OPENSSL
9406         if test "$enable_openssl" != "yes"; then
9407             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9408         fi
9410         # warn that OpenSSL has been selected but not all TLS code has this option
9411         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9412         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9413         ;;
9414     nss)
9415         AC_DEFINE(USE_TLS_NSS)
9416         TLS=NSS
9417         ;;
9418     no)
9419         AC_MSG_WARN([Skipping TLS/SSL])
9420         ;;
9421     *)
9422         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9423 openssl - OpenSSL
9424 nss - Mozilla's Network Security Services (NSS)
9425     ])
9426         ;;
9427     esac
9428 else
9429     # default to using NSS, it results in smaller oox lib
9430     AC_DEFINE(USE_TLS_NSS)
9431     TLS=NSS
9433 AC_MSG_RESULT([$TLS])
9434 AC_SUBST(TLS)
9436 dnl ===================================================================
9437 dnl Check for system sane
9438 dnl ===================================================================
9439 AC_MSG_CHECKING([which sane header to use])
9440 if test "$with_system_sane" = "yes"; then
9441     AC_MSG_RESULT([external])
9442     AC_CHECK_HEADER(sane/sane.h, [],
9443       [AC_MSG_ERROR(sane not found. install sane)], [])
9444 else
9445     AC_MSG_RESULT([internal])
9446     BUILD_TYPE="$BUILD_TYPE SANE"
9449 dnl ===================================================================
9450 dnl Check for system icu
9451 dnl ===================================================================
9452 SYSTEM_GENBRK=
9453 SYSTEM_GENCCODE=
9454 SYSTEM_GENCMN=
9456 ICU_MAJOR=63
9457 ICU_MINOR=1
9458 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9459 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9460 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9461 AC_MSG_CHECKING([which icu to use])
9462 if test "$with_system_icu" = "yes"; then
9463     AC_MSG_RESULT([external])
9464     SYSTEM_ICU=TRUE
9465     AC_LANG_PUSH([C++])
9466     AC_MSG_CHECKING([for unicode/rbbi.h])
9467     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9468     AC_LANG_POP([C++])
9470     if test "$cross_compiling" != "yes"; then
9471         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9472         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9473         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9474         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9475     fi
9477     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9478         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9479         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9480         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9481         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9482         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9483             AC_MSG_RESULT([yes])
9484         else
9485             AC_MSG_RESULT([no])
9486             if test "$with_system_icu_for_build" != "force"; then
9487                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9488 You can use --with-system-icu-for-build=force to use it anyway.])
9489             fi
9490         fi
9491     fi
9493     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9494         # using the system icu tools can lead to version confusion, use the
9495         # ones from the build environment when cross-compiling
9496         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9497         if test -z "$SYSTEM_GENBRK"; then
9498             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9499         fi
9500         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9501         if test -z "$SYSTEM_GENCCODE"; then
9502             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9503         fi
9504         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9505         if test -z "$SYSTEM_GENCMN"; then
9506             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9507         fi
9508         if test "$ICU_MAJOR" -ge "49"; then
9509             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9510             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9511             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9512         else
9513             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9514             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9515             ICU_RECLASSIFIED_HEBREW_LETTER=
9516         fi
9517     fi
9519     if test "$cross_compiling" = "yes"; then
9520         if test "$ICU_MAJOR" -ge "50"; then
9521             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9522             ICU_MINOR=""
9523         fi
9524     fi
9525 else
9526     AC_MSG_RESULT([internal])
9527     SYSTEM_ICU=
9528     BUILD_TYPE="$BUILD_TYPE ICU"
9529     # surprisingly set these only for "internal" (to be used by various other
9530     # external libs): the system icu-config is quite unhelpful and spits out
9531     # dozens of weird flags and also default path -I/usr/include
9532     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9533     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9535 if test "$ICU_MAJOR" -ge "59"; then
9536     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9537     # with -std=c++11 but not all external libraries can be built with that,
9538     # for those use a bit-compatible typedef uint16_t UChar; see
9539     # icu/source/common/unicode/umachine.h
9540     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9541 else
9542     ICU_UCHAR_TYPE=""
9544 AC_SUBST(SYSTEM_ICU)
9545 AC_SUBST(SYSTEM_GENBRK)
9546 AC_SUBST(SYSTEM_GENCCODE)
9547 AC_SUBST(SYSTEM_GENCMN)
9548 AC_SUBST(ICU_MAJOR)
9549 AC_SUBST(ICU_MINOR)
9550 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9551 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9552 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9553 AC_SUBST(ICU_CFLAGS)
9554 AC_SUBST(ICU_LIBS)
9555 AC_SUBST(ICU_UCHAR_TYPE)
9557 dnl ==================================================================
9558 dnl Breakpad
9559 dnl ==================================================================
9560 AC_MSG_CHECKING([whether to enable breakpad])
9561 if test "$enable_breakpad" != yes; then
9562     AC_MSG_RESULT([no])
9563 else
9564     AC_MSG_RESULT([yes])
9565     ENABLE_BREAKPAD="TRUE"
9566     AC_DEFINE(ENABLE_BREAKPAD)
9567     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9568     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9570     AC_MSG_CHECKING([for crashreport config])
9571     if test "$with_symbol_config" = "no"; then
9572         BREAKPAD_SYMBOL_CONFIG="invalid"
9573         AC_MSG_RESULT([no])
9574     else
9575         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9576         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9577         AC_MSG_RESULT([yes])
9578     fi
9579     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9581 AC_SUBST(ENABLE_BREAKPAD)
9583 dnl ==================================================================
9584 dnl libfuzzer
9585 dnl ==================================================================
9586 AC_MSG_CHECKING([whether to enable fuzzers])
9587 if test "$enable_fuzzers" != yes; then
9588     AC_MSG_RESULT([no])
9589 else
9590     AC_MSG_RESULT([yes])
9591     ENABLE_FUZZERS="TRUE"
9592     AC_DEFINE([ENABLE_FUZZERS],1)
9593     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9595 AC_SUBST(ENABLE_FUZZERS)
9597 dnl ===================================================================
9598 dnl Orcus
9599 dnl ===================================================================
9600 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9601 if test "$with_system_orcus" != "yes"; then
9602     if test "$SYSTEM_BOOST" = "TRUE"; then
9603         # ===========================================================
9604         # Determine if we are going to need to link with Boost.System
9605         # ===========================================================
9606         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9607         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9608         dnl in documentation has no effect.
9609         AC_MSG_CHECKING([if we need to link with Boost.System])
9610         AC_LANG_PUSH([C++])
9611         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9612                 @%:@include <boost/version.hpp>
9613             ]],[[
9614                 #if BOOST_VERSION >= 105000
9615                 #   error yes, we need to link with Boost.System
9616                 #endif
9617             ]])],[
9618                 AC_MSG_RESULT([no])
9619             ],[
9620                 AC_MSG_RESULT([yes])
9621                 AX_BOOST_SYSTEM
9622         ])
9623         AC_LANG_POP([C++])
9624     fi
9626 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9627 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9628 AC_SUBST([BOOST_SYSTEM_LIB])
9629 AC_SUBST(SYSTEM_LIBORCUS)
9631 dnl ===================================================================
9632 dnl HarfBuzz
9633 dnl ===================================================================
9634 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9635                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9636                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9638 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9639                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9640                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9642 if test "$COM" = "MSC"; then # override the above
9643     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9644     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9647 if test "$with_system_harfbuzz" = "yes"; then
9648     if test "$with_system_graphite" = "no"; then
9649         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9650     fi
9651     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9652     _save_libs="$LIBS"
9653     _save_cflags="$CFLAGS"
9654     LIBS="$LIBS $HARFBUZZ_LIBS"
9655     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9656     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9657     LIBS="$_save_libs"
9658     CFLAGS="$_save_cflags"
9659 else
9660     if test "$with_system_graphite" = "yes"; then
9661         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9662     fi
9665 AC_MSG_CHECKING([whether to use X11])
9666 dnl ***************************************
9667 dnl testing for X libraries and includes...
9668 dnl ***************************************
9669 if test "$USING_X11" = TRUE; then
9670     AC_DEFINE(HAVE_FEATURE_X11)
9672 AC_MSG_RESULT([$USING_X11])
9674 if test "$USING_X11" = TRUE; then
9675     AC_PATH_X
9676     AC_PATH_XTRA
9677     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9679     if test -z "$x_includes"; then
9680         x_includes="default_x_includes"
9681     fi
9682     if test -z "$x_libraries"; then
9683         x_libraries="default_x_libraries"
9684     fi
9685     CFLAGS="$CFLAGS $X_CFLAGS"
9686     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9687     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9688 else
9689     x_includes="no_x_includes"
9690     x_libraries="no_x_libraries"
9693 if test "$USING_X11" = TRUE; then
9694     dnl ===================================================================
9695     dnl Check for extension headers
9696     dnl ===================================================================
9697     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9698      [#include <X11/extensions/shape.h>])
9700     # vcl needs ICE and SM
9701     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9702     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9703         [AC_MSG_ERROR(ICE library not found)])
9704     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9705     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9706         [AC_MSG_ERROR(SM library not found)])
9709 dnl ===================================================================
9710 dnl Check for system Xrender
9711 dnl ===================================================================
9712 AC_MSG_CHECKING([whether to use Xrender])
9713 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9714     AC_MSG_RESULT([yes])
9715     PKG_CHECK_MODULES(XRENDER, xrender)
9716     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9717     FilterLibs "${XRENDER_LIBS}"
9718     XRENDER_LIBS="${filteredlibs}"
9719     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9720       [AC_MSG_ERROR(libXrender not found or functional)], [])
9721     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9722       [AC_MSG_ERROR(Xrender not found. install X)], [])
9723 else
9724     AC_MSG_RESULT([no])
9726 AC_SUBST(XRENDER_CFLAGS)
9727 AC_SUBST(XRENDER_LIBS)
9729 dnl ===================================================================
9730 dnl Check for XRandr
9731 dnl ===================================================================
9732 AC_MSG_CHECKING([whether to enable RandR support])
9733 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9734     AC_MSG_RESULT([yes])
9735     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9736     if test "$ENABLE_RANDR" != "TRUE"; then
9737         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9738                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9739         XRANDR_CFLAGS=" "
9740         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9741           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9742         XRANDR_LIBS="-lXrandr "
9743         ENABLE_RANDR="TRUE"
9744     fi
9745     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9746     FilterLibs "${XRANDR_LIBS}"
9747     XRANDR_LIBS="${filteredlibs}"
9748 else
9749     ENABLE_RANDR=""
9750     AC_MSG_RESULT([no])
9752 AC_SUBST(XRANDR_CFLAGS)
9753 AC_SUBST(XRANDR_LIBS)
9754 AC_SUBST(ENABLE_RANDR)
9756 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9757     WITH_WEBDAV="serf"
9759 if test $_os = iOS -o $_os = Android; then
9760     WITH_WEBDAV="no"
9762 AC_MSG_CHECKING([for webdav library])
9763 case "$WITH_WEBDAV" in
9764 serf)
9765     AC_MSG_RESULT([serf])
9766     # Check for system apr-util
9767     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9768                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9769                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9770     if test "$COM" = "MSC"; then
9771         APR_LIB_DIR="LibR"
9772         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9773         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9774     fi
9776     # Check for system serf
9777     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9778                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9779     if test "$COM" = "MSC"; then
9780         SERF_LIB_DIR="Release"
9781         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9782         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9783     fi
9784     ;;
9785 neon)
9786     AC_MSG_RESULT([neon])
9787     # Check for system neon
9788     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9789     if test "$with_system_neon" = "yes"; then
9790         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9791     else
9792         NEON_VERSION=0295
9793     fi
9794     AC_SUBST(NEON_VERSION)
9795     ;;
9797     AC_MSG_RESULT([none, disabled])
9798     WITH_WEBDAV=""
9799     ;;
9800 esac
9801 AC_SUBST(WITH_WEBDAV)
9803 dnl ===================================================================
9804 dnl Check for disabling cve_tests
9805 dnl ===================================================================
9806 AC_MSG_CHECKING([whether to execute CVE tests])
9807 # If not explicitly enabled or disabled, default
9808 if test -z "$enable_cve_tests"; then
9809     case "$OS" in
9810     WNT)
9811         # Default cves off for Windows with its wild and wonderful
9812         # variety of AV software kicking in and panicking
9813         enable_cve_tests=no
9814         ;;
9815     *)
9816         # otherwise yes
9817         enable_cve_tests=yes
9818         ;;
9819     esac
9821 if test "$enable_cve_tests" = "no"; then
9822     AC_MSG_RESULT([no])
9823     DISABLE_CVE_TESTS=TRUE
9824     AC_SUBST(DISABLE_CVE_TESTS)
9825 else
9826     AC_MSG_RESULT([yes])
9829 dnl ===================================================================
9830 dnl Check for enabling chart XShape tests
9831 dnl ===================================================================
9832 AC_MSG_CHECKING([whether to execute chart XShape tests])
9833 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9834     AC_MSG_RESULT([yes])
9835     ENABLE_CHART_TESTS=TRUE
9836     AC_SUBST(ENABLE_CHART_TESTS)
9837 else
9838     AC_MSG_RESULT([no])
9841 dnl ===================================================================
9842 dnl Check for system openssl
9843 dnl ===================================================================
9844 DISABLE_OPENSSL=
9845 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9846 if test "$enable_openssl" = "yes"; then
9847     AC_MSG_RESULT([no])
9848     if test "$_os" = Darwin ; then
9849         # OpenSSL is deprecated when building for 10.7 or later.
9850         #
9851         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9852         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9854         with_system_openssl=no
9855         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9856     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9857             && test "$with_system_openssl" != "no"; then
9858         with_system_openssl=yes
9859         SYSTEM_OPENSSL=TRUE
9860         OPENSSL_CFLAGS=
9861         OPENSSL_LIBS="-lssl -lcrypto"
9862     else
9863         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9864     fi
9865     if test "$with_system_openssl" = "yes"; then
9866         AC_MSG_CHECKING([whether openssl supports SHA512])
9867         AC_LANG_PUSH([C])
9868         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9869             SHA512_CTX context;
9870 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9871         AC_LANG_POP(C)
9872     fi
9873 else
9874     AC_MSG_RESULT([yes])
9875     DISABLE_OPENSSL=TRUE
9877     # warn that although OpenSSL is disabled, system libraries may depend on it
9878     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9879     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9882 AC_SUBST([DISABLE_OPENSSL])
9884 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9885     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9886         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9887         enable_cipher_openssl_backend=no
9888     else
9889         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9890     fi
9892 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9893 ENABLE_CIPHER_OPENSSL_BACKEND=
9894 if test "$enable_cipher_openssl_backend" = yes; then
9895     AC_MSG_RESULT([yes])
9896     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9897 else
9898     AC_MSG_RESULT([no])
9900 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9902 dnl ===================================================================
9903 dnl Check for building gnutls
9904 dnl ===================================================================
9905 AC_MSG_CHECKING([whether to use gnutls])
9906 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9907     AC_MSG_RESULT([yes])
9908     AM_PATH_LIBGCRYPT()
9909     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9910         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9911                       available in the system to use as replacement.]]))
9912     FilterLibs "${LIBGCRYPT_LIBS}"
9913     LIBGCRYPT_LIBS="${filteredlibs}"
9914 else
9915     AC_MSG_RESULT([no])
9918 AC_SUBST([LIBGCRYPT_CFLAGS])
9919 AC_SUBST([LIBGCRYPT_LIBS])
9921 dnl ===================================================================
9922 dnl Check for system redland
9923 dnl ===================================================================
9924 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9925 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9926 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9927 if test "$with_system_redland" = "yes"; then
9928     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9929             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9930 else
9931     RAPTOR_MAJOR="0"
9932     RASQAL_MAJOR="3"
9933     REDLAND_MAJOR="0"
9935 AC_SUBST(RAPTOR_MAJOR)
9936 AC_SUBST(RASQAL_MAJOR)
9937 AC_SUBST(REDLAND_MAJOR)
9939 dnl ===================================================================
9940 dnl Check for system hunspell
9941 dnl ===================================================================
9942 AC_MSG_CHECKING([which libhunspell to use])
9943 if test "$with_system_hunspell" = "yes"; then
9944     AC_MSG_RESULT([external])
9945     SYSTEM_HUNSPELL=TRUE
9946     AC_LANG_PUSH([C++])
9947     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9948     if test "$HUNSPELL_PC" != "TRUE"; then
9949         AC_CHECK_HEADER(hunspell.hxx, [],
9950             [
9951             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9952             [AC_MSG_ERROR(hunspell headers not found.)], [])
9953             ], [])
9954         AC_CHECK_LIB([hunspell], [main], [:],
9955            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9956         HUNSPELL_LIBS=-lhunspell
9957     fi
9958     AC_LANG_POP([C++])
9959     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9960     FilterLibs "${HUNSPELL_LIBS}"
9961     HUNSPELL_LIBS="${filteredlibs}"
9962 else
9963     AC_MSG_RESULT([internal])
9964     SYSTEM_HUNSPELL=
9965     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9966     if test "$COM" = "MSC"; then
9967         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9968     else
9969         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9970     fi
9971     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9973 AC_SUBST(SYSTEM_HUNSPELL)
9974 AC_SUBST(HUNSPELL_CFLAGS)
9975 AC_SUBST(HUNSPELL_LIBS)
9977 dnl ===================================================================
9978 dnl Check for system qrcodegen
9979 dnl ===================================================================
9980 AC_MSG_CHECKING([which libqrcodegen to use])
9981 if test "$with_system_qrcodegen" = "yes"; then
9982     AC_MSG_RESULT([external])
9983     SYSTEM_QRCODEGEN=TRUE
9984     AC_LANG_PUSH([C++])
9985     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
9986         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
9987     AC_CHECK_LIB([qrcodegencpp], [main], [:],
9988         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
9989     QRCODEGEN_LIBS=-lqrcodegencpp
9990     AC_LANG_POP([C++])
9991     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9992     FilterLibs "${QRCODEGEN_LIBS}"
9993     QRCODEGEN_LIBS="${filteredlibs}"
9994 else
9995     AC_MSG_RESULT([internal])
9996     SYSTEM_QRCODEGEN=
9997     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
9999 AC_SUBST(SYSTEM_QRCODEGEN)
10000 AC_SUBST(QRCODEGEN_CFLAGS)
10001 AC_SUBST(QRCODEGEN_LIBS)
10003 dnl ===================================================================
10004 dnl Checking for altlinuxhyph
10005 dnl ===================================================================
10006 AC_MSG_CHECKING([which altlinuxhyph to use])
10007 if test "$with_system_altlinuxhyph" = "yes"; then
10008     AC_MSG_RESULT([external])
10009     SYSTEM_HYPH=TRUE
10010     AC_CHECK_HEADER(hyphen.h, [],
10011        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10012     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10013        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10014        [#include <hyphen.h>])
10015     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10016         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10017     if test -z "$HYPHEN_LIB"; then
10018         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10019            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10020     fi
10021     if test -z "$HYPHEN_LIB"; then
10022         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10023            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10024     fi
10025 else
10026     AC_MSG_RESULT([internal])
10027     SYSTEM_HYPH=
10028     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10029     if test "$COM" = "MSC"; then
10030         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10031     else
10032         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10033     fi
10035 AC_SUBST(SYSTEM_HYPH)
10036 AC_SUBST(HYPHEN_LIB)
10038 dnl ===================================================================
10039 dnl Checking for mythes
10040 dnl ===================================================================
10041 AC_MSG_CHECKING([which mythes to use])
10042 if test "$with_system_mythes" = "yes"; then
10043     AC_MSG_RESULT([external])
10044     SYSTEM_MYTHES=TRUE
10045     AC_LANG_PUSH([C++])
10046     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10047     if test "$MYTHES_PKGCONFIG" = "no"; then
10048         AC_CHECK_HEADER(mythes.hxx, [],
10049             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10050         AC_CHECK_LIB([mythes-1.2], [main], [:],
10051             [ MYTHES_FOUND=no], [])
10052     if test "$MYTHES_FOUND" = "no"; then
10053         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10054                 [ MYTHES_FOUND=no], [])
10055     fi
10056     if test "$MYTHES_FOUND" = "no"; then
10057         AC_MSG_ERROR([mythes library not found!.])
10058     fi
10059     fi
10060     AC_LANG_POP([C++])
10061     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10062     FilterLibs "${MYTHES_LIBS}"
10063     MYTHES_LIBS="${filteredlibs}"
10064 else
10065     AC_MSG_RESULT([internal])
10066     SYSTEM_MYTHES=
10067     BUILD_TYPE="$BUILD_TYPE MYTHES"
10068     if test "$COM" = "MSC"; then
10069         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10070     else
10071         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10072     fi
10074 AC_SUBST(SYSTEM_MYTHES)
10075 AC_SUBST(MYTHES_CFLAGS)
10076 AC_SUBST(MYTHES_LIBS)
10078 dnl ===================================================================
10079 dnl How should we build the linear programming solver ?
10080 dnl ===================================================================
10082 ENABLE_COINMP=
10083 AC_MSG_CHECKING([whether to build with CoinMP])
10084 if test "$enable_coinmp" != "no"; then
10085     ENABLE_COINMP=TRUE
10086     AC_MSG_RESULT([yes])
10087     if test "$with_system_coinmp" = "yes"; then
10088         SYSTEM_COINMP=TRUE
10089         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10090         FilterLibs "${COINMP_LIBS}"
10091         COINMP_LIBS="${filteredlibs}"
10092     else
10093         BUILD_TYPE="$BUILD_TYPE COINMP"
10094     fi
10095 else
10096     AC_MSG_RESULT([no])
10098 AC_SUBST(ENABLE_COINMP)
10099 AC_SUBST(SYSTEM_COINMP)
10100 AC_SUBST(COINMP_CFLAGS)
10101 AC_SUBST(COINMP_LIBS)
10103 ENABLE_LPSOLVE=
10104 AC_MSG_CHECKING([whether to build with lpsolve])
10105 if test "$enable_lpsolve" != "no"; then
10106     ENABLE_LPSOLVE=TRUE
10107     AC_MSG_RESULT([yes])
10108 else
10109     AC_MSG_RESULT([no])
10111 AC_SUBST(ENABLE_LPSOLVE)
10113 if test "$ENABLE_LPSOLVE" = TRUE; then
10114     AC_MSG_CHECKING([which lpsolve to use])
10115     if test "$with_system_lpsolve" = "yes"; then
10116         AC_MSG_RESULT([external])
10117         SYSTEM_LPSOLVE=TRUE
10118         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10119            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10120         save_LIBS=$LIBS
10121         # some systems need this. Like Ubuntu....
10122         AC_CHECK_LIB(m, floor)
10123         AC_CHECK_LIB(dl, dlopen)
10124         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10125             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10126         LIBS=$save_LIBS
10127     else
10128         AC_MSG_RESULT([internal])
10129         SYSTEM_LPSOLVE=
10130         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10131     fi
10133 AC_SUBST(SYSTEM_LPSOLVE)
10135 dnl ===================================================================
10136 dnl Checking for libexttextcat
10137 dnl ===================================================================
10138 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10139 if test "$with_system_libexttextcat" = "yes"; then
10140     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10142 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10144 dnl ===================================================================
10145 dnl Checking for libnumbertext
10146 dnl ===================================================================
10147 AC_MSG_CHECKING([whether to use libnumbertext])
10148 if test "$enable_libnumbertext" = "no"; then
10149     AC_MSG_RESULT([no])
10150     ENABLE_LIBNUMBERTEXT=
10151     SYSTEM_LIBNUMBERTEXT=
10152 else
10153     AC_MSG_RESULT([yes])
10154     ENABLE_LIBNUMBERTEXT=TRUE
10155     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10156     if test "$with_system_libnumbertext" = "yes"; then
10157         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10158         SYSTEM_LIBNUMBERTEXT=YES
10159     else
10160         SYSTEM_LIBNUMBERTEXT=
10161         AC_LANG_PUSH([C++])
10162         save_CPPFLAGS=$CPPFLAGS
10163         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10164         AC_CHECK_HEADERS([codecvt regex])
10165         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10166                 [ ENABLE_LIBNUMBERTEXT=''
10167                   LIBNUMBERTEXT_CFLAGS=''
10168                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10169                                Enable libnumbertext fallback (missing number to number name conversion).])
10170                 ])
10171         CPPFLAGS=$save_CPPFLAGS
10172         AC_LANG_POP([C++])
10173     fi
10174     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10175         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10176     fi
10178 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10179 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10180 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10181 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10183 dnl ***************************************
10184 dnl testing libc version for Linux...
10185 dnl ***************************************
10186 if test "$_os" = "Linux"; then
10187     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10188     exec 6>/dev/null # no output
10189     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10190     exec 6>&1 # output on again
10191     if test "$HAVE_LIBC"; then
10192         AC_MSG_RESULT([yes])
10193     else
10194         AC_MSG_ERROR([no, upgrade libc])
10195     fi
10198 dnl =========================================
10199 dnl Check for uuidgen
10200 dnl =========================================
10201 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10202     # presence is already tested above in the WINDOWS_SDK_HOME check
10203     UUIDGEN=uuidgen.exe
10204     AC_SUBST(UUIDGEN)
10205 else
10206     AC_PATH_PROG([UUIDGEN], [uuidgen])
10207     if test -z "$UUIDGEN"; then
10208         AC_MSG_WARN([uuid is needed for building installation sets])
10209     fi
10212 dnl ***************************************
10213 dnl Checking for bison and flex
10214 dnl ***************************************
10215 AC_PATH_PROG(BISON, bison)
10216 if test -z "$BISON"; then
10217     AC_MSG_ERROR([no bison found in \$PATH, install it])
10218 else
10219     AC_MSG_CHECKING([the bison version])
10220     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10221     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10222     # Accept newer than 2.0
10223     if test "$_bison_longver" -lt 2000; then
10224         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10225     fi
10228 AC_PATH_PROG(FLEX, flex)
10229 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10230     FLEX=`cygpath -m $FLEX`
10232 if test -z "$FLEX"; then
10233     AC_MSG_ERROR([no flex found in \$PATH, install it])
10234 else
10235     AC_MSG_CHECKING([the flex version])
10236     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10237     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10238         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10239     fi
10241 AC_SUBST([FLEX])
10242 dnl ***************************************
10243 dnl Checking for patch
10244 dnl ***************************************
10245 AC_PATH_PROG(PATCH, patch)
10246 if test -z "$PATCH"; then
10247     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10250 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10251 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10252     if test -z "$with_gnu_patch"; then
10253         GNUPATCH=$PATCH
10254     else
10255         if test -x "$with_gnu_patch"; then
10256             GNUPATCH=$with_gnu_patch
10257         else
10258             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10259         fi
10260     fi
10262     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10263     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10264         AC_MSG_RESULT([yes])
10265     else
10266         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10267     fi
10268 else
10269     GNUPATCH=$PATCH
10272 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10273     GNUPATCH=`cygpath -m $GNUPATCH`
10276 dnl We also need to check for --with-gnu-cp
10278 if test -z "$with_gnu_cp"; then
10279     # check the place where the good stuff is hidden on Solaris...
10280     if test -x /usr/gnu/bin/cp; then
10281         GNUCP=/usr/gnu/bin/cp
10282     else
10283         AC_PATH_PROGS(GNUCP, gnucp cp)
10284     fi
10285     if test -z $GNUCP; then
10286         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10287     fi
10288 else
10289     if test -x "$with_gnu_cp"; then
10290         GNUCP=$with_gnu_cp
10291     else
10292         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10293     fi
10296 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10297     GNUCP=`cygpath -m $GNUCP`
10300 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10301 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10302     AC_MSG_RESULT([yes])
10303 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10304     AC_MSG_RESULT([yes])
10305 else
10306     case "$build_os" in
10307     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10308         x_GNUCP=[\#]
10309         GNUCP=''
10310         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10311         ;;
10312     *)
10313         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10314         ;;
10315     esac
10318 AC_SUBST(GNUPATCH)
10319 AC_SUBST(GNUCP)
10320 AC_SUBST(x_GNUCP)
10322 dnl ***************************************
10323 dnl testing assembler path
10324 dnl ***************************************
10325 ML_EXE=""
10326 if test "$_os" = "WINNT"; then
10327     if test "$BITNESS_OVERRIDE" = ""; then
10328         assembler=ml.exe
10329     else
10330         assembler=ml64.exe
10331     fi
10333     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10334     if test -f "$CL_PATH/$assembler"; then
10335         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10336         AC_MSG_RESULT([$ML_EXE])
10337     else
10338         AC_MSG_ERROR([not found])
10339     fi
10342 AC_SUBST(ML_EXE)
10344 dnl ===================================================================
10345 dnl We need zip and unzip
10346 dnl ===================================================================
10347 AC_PATH_PROG(ZIP, zip)
10348 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10349 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10350     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],,)
10353 AC_PATH_PROG(UNZIP, unzip)
10354 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10356 dnl ===================================================================
10357 dnl Zip must be a specific type for different build types.
10358 dnl ===================================================================
10359 if test $build_os = cygwin; then
10360     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10361         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10362     fi
10365 dnl ===================================================================
10366 dnl We need touch with -h option support.
10367 dnl ===================================================================
10368 AC_PATH_PROG(TOUCH, touch)
10369 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10370 touch warn
10371 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10372     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],,)
10375 dnl ===================================================================
10376 dnl Check for system epoxy
10377 dnl ===================================================================
10378 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10380 dnl ===================================================================
10381 dnl Set vcl option: coordinate device in double or sal_Int32
10382 dnl ===================================================================
10384 dnl disabled for now, we don't want subtle differences between OSs
10385 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10386 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10387 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10388 dnl     AC_MSG_RESULT([double])
10389 dnl else
10390 dnl     AC_MSG_RESULT([sal_Int32])
10391 dnl fi
10393 dnl ===================================================================
10394 dnl Test which vclplugs have to be built.
10395 dnl ===================================================================
10396 R=""
10397 if test "$USING_X11" != TRUE; then
10398     enable_gtk=no
10399     enable_gtk3=no
10401 GTK3_CFLAGS=""
10402 GTK3_LIBS=""
10403 ENABLE_GTK3=""
10404 if test "x$enable_gtk3" = "xyes"; then
10405     if test "$with_system_cairo" = no; then
10406         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10407     fi
10408     : ${with_system_cairo:=yes}
10409     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="")
10410     if test "x$ENABLE_GTK3" = "xTRUE"; then
10411         AC_DEFINE(ENABLE_GTK3)
10412         R="gtk3"
10413     else
10414         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10415     fi
10416     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10417     FilterLibs "${GTK3_LIBS}"
10418     GTK3_LIBS="${filteredlibs}"
10420     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10421     if test "$with_system_epoxy" != "yes"; then
10422         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10423         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10424                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10425     fi
10427 AC_SUBST(GTK3_LIBS)
10428 AC_SUBST(GTK3_CFLAGS)
10429 AC_SUBST(ENABLE_GTK3)
10431 if test "$enable_introspection" = yes; then
10432     if test "$ENABLE_GTK3" = TRUE; then
10433         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10434     else
10435         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10436     fi
10439 ENABLE_GTK=""
10440 if test "x$enable_gtk" = "xyes"; then
10441     if test "$with_system_cairo" = no; then
10442         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10443     fi
10444     : ${with_system_cairo:=yes}
10445     ENABLE_GTK="TRUE"
10446     AC_DEFINE(ENABLE_GTK)
10447     R="gtk $R"
10449 AC_SUBST(ENABLE_GTK)
10451 ENABLE_QT5=""
10452 if test "x$enable_qt5" = "xyes"; then
10453     ENABLE_QT5="TRUE"
10454     AC_DEFINE(ENABLE_QT5)
10455     R="$R qt5"
10457 AC_SUBST(ENABLE_QT5)
10459 ENABLE_KF5=""
10460 if test "x$enable_kf5" = "xyes"; then
10461     ENABLE_KF5="TRUE"
10462     AC_DEFINE(ENABLE_KF5)
10463     R="$R kf5"
10465 AC_SUBST(ENABLE_KF5)
10467 ENABLE_GTK3_KDE5=""
10468 if test "x$enable_gtk3_kde5" = "xyes"; then
10469     ENABLE_GTK3_KDE5="TRUE"
10470     AC_DEFINE(ENABLE_GTK3_KDE5)
10471     R="$R gtk3_kde5"
10473 AC_SUBST(ENABLE_GTK3_KDE5)
10475 if test "$_os" = "WINNT"; then
10476     R="$R win"
10477 elif test "$_os" = "Darwin"; then
10478     R="$R osx"
10479 elif test "$_os" = "iOS"; then
10480     R="ios (builtin)"
10483 build_vcl_plugins="$R"
10484 if test -z "$build_vcl_plugins"; then
10485     build_vcl_plugins="none"
10487 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10489 dnl ===================================================================
10490 dnl check for dbus support
10491 dnl ===================================================================
10492 ENABLE_DBUS=""
10493 DBUS_CFLAGS=""
10494 DBUS_LIBS=""
10495 DBUS_GLIB_CFLAGS=""
10496 DBUS_GLIB_LIBS=""
10497 DBUS_HAVE_GLIB=""
10499 if test "$enable_dbus" = "no"; then
10500     test_dbus=no
10503 AC_MSG_CHECKING([whether to enable DBUS support])
10504 if test "$test_dbus" = "yes"; then
10505     ENABLE_DBUS="TRUE"
10506     AC_MSG_RESULT([yes])
10507     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10508     AC_DEFINE(ENABLE_DBUS)
10509     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10510     FilterLibs "${DBUS_LIBS}"
10511     DBUS_LIBS="${filteredlibs}"
10513     # Glib is needed for BluetoothServer
10514     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10515     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10516         [
10517             DBUS_HAVE_GLIB="TRUE"
10518             AC_DEFINE(DBUS_HAVE_GLIB,1)
10519         ],
10520         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10521     )
10522 else
10523     AC_MSG_RESULT([no])
10526 AC_SUBST(ENABLE_DBUS)
10527 AC_SUBST(DBUS_CFLAGS)
10528 AC_SUBST(DBUS_LIBS)
10529 AC_SUBST(DBUS_GLIB_CFLAGS)
10530 AC_SUBST(DBUS_GLIB_LIBS)
10531 AC_SUBST(DBUS_HAVE_GLIB)
10533 AC_MSG_CHECKING([whether to enable Impress remote control])
10534 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10535     AC_MSG_RESULT([yes])
10536     ENABLE_SDREMOTE=TRUE
10537     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10539     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10540         # The Bluetooth code doesn't compile with macOS SDK 10.15
10541         enable_sdremote_bluetooth=no
10542     fi
10543     # If not explicitly enabled or disabled, default
10544     if test -z "$enable_sdremote_bluetooth"; then
10545         case "$OS" in
10546         LINUX|MACOSX|WNT)
10547             # Default to yes for these
10548             enable_sdremote_bluetooth=yes
10549             ;;
10550         *)
10551             # otherwise no
10552             enable_sdremote_bluetooth=no
10553             ;;
10554         esac
10555     fi
10556     # $enable_sdremote_bluetooth is guaranteed non-empty now
10558     if test "$enable_sdremote_bluetooth" != "no"; then
10559         if test "$OS" = "LINUX"; then
10560             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10561                 AC_MSG_RESULT([yes])
10562                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10563                 dnl ===================================================================
10564                 dnl Check for system bluez
10565                 dnl ===================================================================
10566                 AC_MSG_CHECKING([which Bluetooth header to use])
10567                 if test "$with_system_bluez" = "yes"; then
10568                     AC_MSG_RESULT([external])
10569                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10570                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10571                     SYSTEM_BLUEZ=TRUE
10572                 else
10573                     AC_MSG_RESULT([internal])
10574                     SYSTEM_BLUEZ=
10575                 fi
10576             else
10577                 AC_MSG_RESULT([no, dbus disabled])
10578                 ENABLE_SDREMOTE_BLUETOOTH=
10579                 SYSTEM_BLUEZ=
10580             fi
10581         else
10582             AC_MSG_RESULT([yes])
10583             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10584             SYSTEM_BLUEZ=
10585         fi
10586     else
10587         AC_MSG_RESULT([no])
10588         ENABLE_SDREMOTE_BLUETOOTH=
10589         SYSTEM_BLUEZ=
10590     fi
10591 else
10592     ENABLE_SDREMOTE=
10593     SYSTEM_BLUEZ=
10594     AC_MSG_RESULT([no])
10596 AC_SUBST(ENABLE_SDREMOTE)
10597 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10598 AC_SUBST(SYSTEM_BLUEZ)
10600 dnl ===================================================================
10601 dnl Check whether the gtk 2.0 libraries are available.
10602 dnl ===================================================================
10604 GTK_CFLAGS=""
10605 GTK_LIBS=""
10606 if test  "$test_gtk" = "yes"; then
10608     if test "$ENABLE_GTK" = "TRUE"; then
10609         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gtk+-2.0 >= 2.18.0). Use --disable-gtk or install the missing packages]))
10610         PKG_CHECK_MODULES(GTK, gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gdk-pixbuf-2.0 >= 2.2). Use --disable-gtk or install the missing packages]))
10611         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10612         FilterLibs "${GTK_LIBS}"
10613         GTK_LIBS="${filteredlibs}"
10614         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gthread-2.0). Use --disable-gtk or install the missing packages]))
10615         BUILD_TYPE="$BUILD_TYPE GTK"
10616         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10617         FilterLibs "${GTHREAD_LIBS}"
10618         GTHREAD_LIBS="${filteredlibs}"
10620         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10621         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10622                           [ENABLE_GTK_PRINT="TRUE"],
10623                           [ENABLE_GTK_PRINT=""])
10624         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10625         FilterLibs "${GTK_PRINT_LIBS}"
10626         GTK_PRINT_LIBS="${filteredlibs}"
10627     fi
10629     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10630         AC_MSG_CHECKING([whether to enable GIO support])
10631         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10632             dnl Need at least 2.26 for the dbus support.
10633             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10634                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10635             if test "$ENABLE_GIO" = "TRUE"; then
10636                 AC_DEFINE(ENABLE_GIO)
10637                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10638                 FilterLibs "${GIO_LIBS}"
10639                 GIO_LIBS="${filteredlibs}"
10640             fi
10641         else
10642             AC_MSG_RESULT([no])
10643         fi
10644     fi
10646 AC_SUBST(ENABLE_GIO)
10647 AC_SUBST(GIO_CFLAGS)
10648 AC_SUBST(GIO_LIBS)
10649 AC_SUBST(GTK_CFLAGS)
10650 AC_SUBST(GTK_LIBS)
10651 AC_SUBST(GTHREAD_CFLAGS)
10652 AC_SUBST(GTHREAD_LIBS)
10653 AC_SUBST([ENABLE_GTK_PRINT])
10654 AC_SUBST([GTK_PRINT_CFLAGS])
10655 AC_SUBST([GTK_PRINT_LIBS])
10658 dnl ===================================================================
10660 SPLIT_APP_MODULES=""
10661 if test "$enable_split_app_modules" = "yes"; then
10662     SPLIT_APP_MODULES="TRUE"
10664 AC_SUBST(SPLIT_APP_MODULES)
10666 SPLIT_OPT_FEATURES=""
10667 if test "$enable_split_opt_features" = "yes"; then
10668     SPLIT_OPT_FEATURES="TRUE"
10670 AC_SUBST(SPLIT_OPT_FEATURES)
10672 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10673     if test "$enable_cairo_canvas" = yes; then
10674         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10675     fi
10676     enable_cairo_canvas=no
10677 elif test -z "$enable_cairo_canvas"; then
10678     enable_cairo_canvas=yes
10681 ENABLE_CAIRO_CANVAS=""
10682 if test "$enable_cairo_canvas" = "yes"; then
10683     test_cairo=yes
10684     ENABLE_CAIRO_CANVAS="TRUE"
10685     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10687 AC_SUBST(ENABLE_CAIRO_CANVAS)
10689 dnl ===================================================================
10690 dnl Check whether the GStreamer libraries are available.
10691 dnl ===================================================================
10693 ENABLE_GSTREAMER_1_0=""
10695 if test "$build_gstreamer_1_0" = "yes"; then
10697     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10698     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10699         ENABLE_GSTREAMER_1_0="TRUE"
10700         AC_MSG_RESULT([yes])
10701         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10702         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10703         FilterLibs "${GSTREAMER_1_0_LIBS}"
10704         GSTREAMER_1_0_LIBS="${filteredlibs}"
10705         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10706     else
10707         AC_MSG_RESULT([no])
10708     fi
10710 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10711 AC_SUBST(GSTREAMER_1_0_LIBS)
10712 AC_SUBST(ENABLE_GSTREAMER_1_0)
10714 dnl ===================================================================
10715 dnl Check whether to build the VLC avmedia backend
10716 dnl ===================================================================
10718 ENABLE_VLC=""
10720 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10721 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10722     ENABLE_VLC="TRUE"
10723     AC_MSG_RESULT([yes])
10724 else
10725     AC_MSG_RESULT([no])
10727 AC_SUBST(ENABLE_VLC)
10729 ENABLE_OPENGL_TRANSITIONS=
10730 ENABLE_OPENGL_CANVAS=
10731 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10732    : # disable
10733 elif test "$_os" = "Darwin"; then
10734     # We use frameworks on macOS, no need for detail checks
10735     ENABLE_OPENGL_TRANSITIONS=TRUE
10736     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10737     ENABLE_OPENGL_CANVAS=TRUE
10738 elif test $_os = WINNT; then
10739     ENABLE_OPENGL_TRANSITIONS=TRUE
10740     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10741     ENABLE_OPENGL_CANVAS=TRUE
10742 else
10743     if test "$USING_X11" = TRUE; then
10744         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10745         ENABLE_OPENGL_TRANSITIONS=TRUE
10746         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10747         ENABLE_OPENGL_CANVAS=TRUE
10748     fi
10751 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10752 AC_SUBST(ENABLE_OPENGL_CANVAS)
10754 dnl =================================================
10755 dnl Check whether to build with OpenCL support.
10756 dnl =================================================
10758 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10759     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10760     # platform (optional at run-time, used through clew).
10761     BUILD_TYPE="$BUILD_TYPE OPENCL"
10762     AC_DEFINE(HAVE_FEATURE_OPENCL)
10765 dnl =================================================
10766 dnl Check whether to build with dconf support.
10767 dnl =================================================
10769 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10770     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10771         if test "$enable_dconf" = yes; then
10772             AC_MSG_ERROR([dconf not found])
10773         else
10774             enable_dconf=no
10775         fi])
10777 AC_MSG_CHECKING([whether to enable dconf])
10778 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10779     DCONF_CFLAGS=
10780     DCONF_LIBS=
10781     ENABLE_DCONF=
10782     AC_MSG_RESULT([no])
10783 else
10784     ENABLE_DCONF=TRUE
10785     AC_DEFINE(ENABLE_DCONF)
10786     AC_MSG_RESULT([yes])
10788 AC_SUBST([DCONF_CFLAGS])
10789 AC_SUBST([DCONF_LIBS])
10790 AC_SUBST([ENABLE_DCONF])
10792 # pdf import?
10793 AC_MSG_CHECKING([whether to build the PDF import feature])
10794 ENABLE_PDFIMPORT=
10795 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10796     AC_MSG_RESULT([yes])
10797     ENABLE_PDFIMPORT=TRUE
10798     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10799 else
10800     AC_MSG_RESULT([no])
10803 # Pdfium?
10804 AC_MSG_CHECKING([whether to build PDFium])
10805 ENABLE_PDFIUM=
10806 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10807     AC_MSG_RESULT([yes])
10808     ENABLE_PDFIUM=TRUE
10809     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10810     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10811 else
10812     AC_MSG_RESULT([no])
10814 AC_SUBST(ENABLE_PDFIUM)
10816 dnl ===================================================================
10817 dnl Check for poppler
10818 dnl ===================================================================
10819 ENABLE_POPPLER=
10820 AC_MSG_CHECKING([whether to build Poppler])
10821 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10822     AC_MSG_RESULT([yes])
10823     ENABLE_POPPLER=TRUE
10824     AC_DEFINE(HAVE_FEATURE_POPPLER)
10825 else
10826     AC_MSG_RESULT([no])
10828 AC_SUBST(ENABLE_POPPLER)
10830 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10831     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10834 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10835     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10838 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10839     dnl ===================================================================
10840     dnl Check for system poppler
10841     dnl ===================================================================
10842     AC_MSG_CHECKING([which PDF import poppler to use])
10843     if test "$with_system_poppler" = "yes"; then
10844         AC_MSG_RESULT([external])
10845         SYSTEM_POPPLER=TRUE
10846         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10847         AC_LANG_PUSH([C++])
10848         save_CXXFLAGS=$CXXFLAGS
10849         save_CPPFLAGS=$CPPFLAGS
10850         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10851         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10852         AC_CHECK_HEADER([cpp/poppler-version.h],
10853             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10854             [])
10855         CXXFLAGS=$save_CXXFLAGS
10856         CPPFLAGS=$save_CPPFLAGS
10857         AC_LANG_POP([C++])
10858         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10860         FilterLibs "${POPPLER_LIBS}"
10861         POPPLER_LIBS="${filteredlibs}"
10862     else
10863         AC_MSG_RESULT([internal])
10864         SYSTEM_POPPLER=
10865         BUILD_TYPE="$BUILD_TYPE POPPLER"
10866         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10867     fi
10868     AC_DEFINE([ENABLE_PDFIMPORT],1)
10870 AC_SUBST(ENABLE_PDFIMPORT)
10871 AC_SUBST(SYSTEM_POPPLER)
10872 AC_SUBST(POPPLER_CFLAGS)
10873 AC_SUBST(POPPLER_LIBS)
10875 SYSTEM_GPGMEPP=
10877 if test "$build_for_ios" = "YES"; then
10878     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10879     AC_MSG_RESULT([yes])
10880 elif test "$enable_mpl_subset" = "yes"; then
10881     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10882     AC_MSG_RESULT([yes])
10883 elif test "$enable_fuzzers" = "yes"; then
10884     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10885     AC_MSG_RESULT([yes])
10886 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10887     dnl ===================================================================
10888     dnl Check for system gpgme
10889     dnl ===================================================================
10890     AC_MSG_CHECKING([which gpgmepp to use])
10891     if test "$with_system_gpgmepp" = "yes"; then
10892         AC_MSG_RESULT([external])
10893         SYSTEM_GPGMEPP=TRUE
10895         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10896         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10897             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10898         # progress_callback is the only func with plain C linkage
10899         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10900         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10901             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10902         AC_CHECK_HEADER(gpgme.h, [],
10903             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10904     else
10905         AC_MSG_RESULT([internal])
10906         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10907         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10909         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10910         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10911         if test "$_os" != "WINNT"; then
10912             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10913             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10914         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10915             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10916         fi
10917     fi
10918     ENABLE_GPGMEPP=TRUE
10919     AC_DEFINE([HAVE_FEATURE_GPGME])
10920     AC_PATH_PROG(GPG, gpg)
10921     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10922     # so let's exclude that manually for the moment
10923     if test -n "$GPG" -a "$_os" != "WINNT"; then
10924         # make sure we not only have a working gpgme, but a full working
10925         # gpg installation to run OpenPGP signature verification
10926         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10927     fi
10928     if test "$_os" = "Linux"; then
10929       uid=`id -u`
10930       AC_MSG_CHECKING([for /run/user/$uid])
10931       if test -d /run/user/$uid; then
10932         AC_MSG_RESULT([yes])
10933         AC_PATH_PROG(GPGCONF, gpgconf)
10935         # Older versions of gpgconf are not working as expected, since
10936         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10937         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10938         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10939         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10940         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10941         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10942         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10943           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10944           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10945           if $GPGCONF --dump-options > /dev/null ; then
10946             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10947               AC_MSG_RESULT([yes])
10948               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10949               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10950             else
10951               AC_MSG_RESULT([no])
10952             fi
10953           else
10954             AC_MSG_RESULT([no. missing or broken gpgconf?])
10955           fi
10956         else
10957           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10958         fi
10959       else
10960         AC_MSG_RESULT([no])
10961      fi
10962    fi
10964 AC_SUBST(ENABLE_GPGMEPP)
10965 AC_SUBST(SYSTEM_GPGMEPP)
10966 AC_SUBST(GPG_ERROR_CFLAGS)
10967 AC_SUBST(GPG_ERROR_LIBS)
10968 AC_SUBST(LIBASSUAN_CFLAGS)
10969 AC_SUBST(LIBASSUAN_LIBS)
10970 AC_SUBST(GPGMEPP_CFLAGS)
10971 AC_SUBST(GPGMEPP_LIBS)
10973 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10974 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10975     AC_MSG_RESULT([yes])
10976     ENABLE_MEDIAWIKI=TRUE
10977     BUILD_TYPE="$BUILD_TYPE XSLTML"
10978     if test  "x$with_java" = "xno"; then
10979         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10980     fi
10981 else
10982     AC_MSG_RESULT([no])
10983     ENABLE_MEDIAWIKI=
10984     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10986 AC_SUBST(ENABLE_MEDIAWIKI)
10988 AC_MSG_CHECKING([whether to build the Report Builder])
10989 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10990     AC_MSG_RESULT([yes])
10991     ENABLE_REPORTBUILDER=TRUE
10992     AC_MSG_CHECKING([which jfreereport libs to use])
10993     if test "$with_system_jfreereport" = "yes"; then
10994         SYSTEM_JFREEREPORT=TRUE
10995         AC_MSG_RESULT([external])
10996         if test -z $SAC_JAR; then
10997             SAC_JAR=/usr/share/java/sac.jar
10998         fi
10999         if ! test -f $SAC_JAR; then
11000              AC_MSG_ERROR(sac.jar not found.)
11001         fi
11003         if test -z $LIBXML_JAR; then
11004             if test -f /usr/share/java/libxml-1.0.0.jar; then
11005                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11006             elif test -f /usr/share/java/libxml.jar; then
11007                 LIBXML_JAR=/usr/share/java/libxml.jar
11008             else
11009                 AC_MSG_ERROR(libxml.jar replacement not found.)
11010             fi
11011         elif ! test -f $LIBXML_JAR; then
11012             AC_MSG_ERROR(libxml.jar not found.)
11013         fi
11015         if test -z $FLUTE_JAR; then
11016             if test -f/usr/share/java/flute-1.3.0.jar; then
11017                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11018             elif test -f /usr/share/java/flute.jar; then
11019                 FLUTE_JAR=/usr/share/java/flute.jar
11020             else
11021                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11022             fi
11023         elif ! test -f $FLUTE_JAR; then
11024             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11025         fi
11027         if test -z $JFREEREPORT_JAR; then
11028             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11029                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11030             elif test -f /usr/share/java/flow-engine.jar; then
11031                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11032             else
11033                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11034             fi
11035         elif ! test -f  $JFREEREPORT_JAR; then
11036                 AC_MSG_ERROR(jfreereport.jar not found.)
11037         fi
11039         if test -z $LIBLAYOUT_JAR; then
11040             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11041                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11042             elif test -f /usr/share/java/liblayout.jar; then
11043                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11044             else
11045                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11046             fi
11047         elif ! test -f $LIBLAYOUT_JAR; then
11048                 AC_MSG_ERROR(liblayout.jar not found.)
11049         fi
11051         if test -z $LIBLOADER_JAR; then
11052             if test -f /usr/share/java/libloader-1.0.0.jar; then
11053                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11054             elif test -f /usr/share/java/libloader.jar; then
11055                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11056             else
11057                 AC_MSG_ERROR(libloader.jar replacement not found.)
11058             fi
11059         elif ! test -f  $LIBLOADER_JAR; then
11060             AC_MSG_ERROR(libloader.jar not found.)
11061         fi
11063         if test -z $LIBFORMULA_JAR; then
11064             if test -f /usr/share/java/libformula-0.2.0.jar; then
11065                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11066             elif test -f /usr/share/java/libformula.jar; then
11067                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11068             else
11069                 AC_MSG_ERROR(libformula.jar replacement not found.)
11070             fi
11071         elif ! test -f $LIBFORMULA_JAR; then
11072                 AC_MSG_ERROR(libformula.jar not found.)
11073         fi
11075         if test -z $LIBREPOSITORY_JAR; then
11076             if test -f /usr/share/java/librepository-1.0.0.jar; then
11077                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11078             elif test -f /usr/share/java/librepository.jar; then
11079                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11080             else
11081                 AC_MSG_ERROR(librepository.jar replacement not found.)
11082             fi
11083         elif ! test -f $LIBREPOSITORY_JAR; then
11084             AC_MSG_ERROR(librepository.jar not found.)
11085         fi
11087         if test -z $LIBFONTS_JAR; then
11088             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11089                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11090             elif test -f /usr/share/java/libfonts.jar; then
11091                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11092             else
11093                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11094             fi
11095         elif ! test -f $LIBFONTS_JAR; then
11096                 AC_MSG_ERROR(libfonts.jar not found.)
11097         fi
11099         if test -z $LIBSERIALIZER_JAR; then
11100             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11101                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11102             elif test -f /usr/share/java/libserializer.jar; then
11103                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11104             else
11105                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11106             fi
11107         elif ! test -f $LIBSERIALIZER_JAR; then
11108                 AC_MSG_ERROR(libserializer.jar not found.)
11109         fi
11111         if test -z $LIBBASE_JAR; then
11112             if test -f /usr/share/java/libbase-1.0.0.jar; then
11113                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11114             elif test -f /usr/share/java/libbase.jar; then
11115                 LIBBASE_JAR=/usr/share/java/libbase.jar
11116             else
11117                 AC_MSG_ERROR(libbase.jar replacement not found.)
11118             fi
11119         elif ! test -f $LIBBASE_JAR; then
11120             AC_MSG_ERROR(libbase.jar not found.)
11121         fi
11123     else
11124         AC_MSG_RESULT([internal])
11125         SYSTEM_JFREEREPORT=
11126         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11127         NEED_ANT=TRUE
11128     fi
11129 else
11130     AC_MSG_RESULT([no])
11131     ENABLE_REPORTBUILDER=
11132     SYSTEM_JFREEREPORT=
11134 AC_SUBST(ENABLE_REPORTBUILDER)
11135 AC_SUBST(SYSTEM_JFREEREPORT)
11136 AC_SUBST(SAC_JAR)
11137 AC_SUBST(LIBXML_JAR)
11138 AC_SUBST(FLUTE_JAR)
11139 AC_SUBST(JFREEREPORT_JAR)
11140 AC_SUBST(LIBBASE_JAR)
11141 AC_SUBST(LIBLAYOUT_JAR)
11142 AC_SUBST(LIBLOADER_JAR)
11143 AC_SUBST(LIBFORMULA_JAR)
11144 AC_SUBST(LIBREPOSITORY_JAR)
11145 AC_SUBST(LIBFONTS_JAR)
11146 AC_SUBST(LIBSERIALIZER_JAR)
11148 # this has to be here because both the Wiki Publisher and the SRB use
11149 # commons-logging
11150 COMMONS_LOGGING_VERSION=1.2
11151 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11152     AC_MSG_CHECKING([which Apache commons-* libs to use])
11153     if test "$with_system_apache_commons" = "yes"; then
11154         SYSTEM_APACHE_COMMONS=TRUE
11155         AC_MSG_RESULT([external])
11156         if test -z $COMMONS_LOGGING_JAR; then
11157             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11158                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11159            elif test -f /usr/share/java/commons-logging.jar; then
11160                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11161             else
11162                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11163             fi
11164         elif ! test -f $COMMONS_LOGGING_JAR; then
11165             AC_MSG_ERROR(commons-logging.jar not found.)
11166         fi
11167     else
11168         AC_MSG_RESULT([internal])
11169         SYSTEM_APACHE_COMMONS=
11170         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11171         NEED_ANT=TRUE
11172     fi
11174 AC_SUBST(SYSTEM_APACHE_COMMONS)
11175 AC_SUBST(COMMONS_LOGGING_JAR)
11176 AC_SUBST(COMMONS_LOGGING_VERSION)
11178 # scripting provider for BeanShell?
11179 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11180 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11181     AC_MSG_RESULT([yes])
11182     ENABLE_SCRIPTING_BEANSHELL=TRUE
11184     dnl ===================================================================
11185     dnl Check for system beanshell
11186     dnl ===================================================================
11187     AC_MSG_CHECKING([which beanshell to use])
11188     if test "$with_system_beanshell" = "yes"; then
11189         AC_MSG_RESULT([external])
11190         SYSTEM_BSH=TRUE
11191         if test -z $BSH_JAR; then
11192             BSH_JAR=/usr/share/java/bsh.jar
11193         fi
11194         if ! test -f $BSH_JAR; then
11195             AC_MSG_ERROR(bsh.jar not found.)
11196         fi
11197     else
11198         AC_MSG_RESULT([internal])
11199         SYSTEM_BSH=
11200         BUILD_TYPE="$BUILD_TYPE BSH"
11201     fi
11202 else
11203     AC_MSG_RESULT([no])
11204     ENABLE_SCRIPTING_BEANSHELL=
11205     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11207 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11208 AC_SUBST(SYSTEM_BSH)
11209 AC_SUBST(BSH_JAR)
11211 # scripting provider for JavaScript?
11212 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11213 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11214     AC_MSG_RESULT([yes])
11215     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11217     dnl ===================================================================
11218     dnl Check for system rhino
11219     dnl ===================================================================
11220     AC_MSG_CHECKING([which rhino to use])
11221     if test "$with_system_rhino" = "yes"; then
11222         AC_MSG_RESULT([external])
11223         SYSTEM_RHINO=TRUE
11224         if test -z $RHINO_JAR; then
11225             RHINO_JAR=/usr/share/java/js.jar
11226         fi
11227         if ! test -f $RHINO_JAR; then
11228             AC_MSG_ERROR(js.jar not found.)
11229         fi
11230     else
11231         AC_MSG_RESULT([internal])
11232         SYSTEM_RHINO=
11233         BUILD_TYPE="$BUILD_TYPE RHINO"
11234         NEED_ANT=TRUE
11235     fi
11236 else
11237     AC_MSG_RESULT([no])
11238     ENABLE_SCRIPTING_JAVASCRIPT=
11239     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11241 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11242 AC_SUBST(SYSTEM_RHINO)
11243 AC_SUBST(RHINO_JAR)
11245 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11246 # paths should be added to library search path. So lets put all 64-bit
11247 # platforms there.
11248 supports_multilib=
11249 case "$host_cpu" in
11250 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11251     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11252         supports_multilib="yes"
11253     fi
11254     ;;
11256     ;;
11257 esac
11259 dnl ===================================================================
11260 dnl QT5 Integration
11261 dnl ===================================================================
11263 QT5_CFLAGS=""
11264 QT5_LIBS=""
11265 QMAKE5="qmake"
11266 MOC5="moc"
11267 QT5_GOBJECT_CFLAGS=""
11268 QT5_GOBJECT_LIBS=""
11269 QT5_HAVE_GOBJECT=""
11270 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11271         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11272         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11273 then
11274     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11275     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11277     if test -n "$supports_multilib"; then
11278         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11279     fi
11281     qt5_test_include="QtWidgets/qapplication.h"
11282     qt5_test_library="libQt5Widgets.so"
11284     dnl Check for qmake5
11285     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11286     if test "$QMAKE5" = "no"; then
11287         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11288     else
11289         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11290         if test -z "$qmake5_test_ver"; then
11291             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11292         fi
11293         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11294         qt5_minimal_minor="6"
11295         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11296             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11297         else
11298             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11299         fi
11300     fi
11302     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11303     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11305     AC_MSG_CHECKING([for Qt5 headers])
11306     qt5_incdir="no"
11307     for inc_dir in $qt5_incdirs; do
11308         if test -r "$inc_dir/$qt5_test_include"; then
11309             qt5_incdir="$inc_dir"
11310             break
11311         fi
11312     done
11313     AC_MSG_RESULT([$qt5_incdir])
11314     if test "x$qt5_incdir" = "xno"; then
11315         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11316     fi
11318     AC_MSG_CHECKING([for Qt5 libraries])
11319     qt5_libdir="no"
11320     for lib_dir in $qt5_libdirs; do
11321         if test -r "$lib_dir/$qt5_test_library"; then
11322             qt5_libdir="$lib_dir"
11323             break
11324         fi
11325     done
11326     AC_MSG_RESULT([$qt5_libdir])
11327     if test "x$qt5_libdir" = "xno"; then
11328         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11329     fi
11331     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11332     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11333     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11335     if test "$USING_X11" = TRUE; then
11336         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11337         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11338         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11339         QT5_USING_X11=1
11340         AC_DEFINE(QT5_USING_X11)
11341     fi
11343     dnl Check for Meta Object Compiler
11345     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11346     if test "$MOC5" = "no"; then
11347         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11348 the root of your Qt installation by exporting QT5DIR before running "configure".])
11349     fi
11351     if test "$build_gstreamer_1_0" = "yes"; then
11352         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11353                 QT5_HAVE_GOBJECT=1
11354                 AC_DEFINE(QT5_HAVE_GOBJECT)
11355             ],
11356             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11357         )
11358     fi
11360 AC_SUBST(QT5_CFLAGS)
11361 AC_SUBST(QT5_LIBS)
11362 AC_SUBST(MOC5)
11363 AC_SUBST(QT5_GOBJECT_CFLAGS)
11364 AC_SUBST(QT5_GOBJECT_LIBS)
11365 AC_SUBST(QT5_HAVE_GOBJECT)
11367 dnl ===================================================================
11368 dnl KF5 Integration
11369 dnl ===================================================================
11371 KF5_CFLAGS=""
11372 KF5_LIBS=""
11373 KF5_CONFIG="kf5-config"
11374 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11375         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11376 then
11377     if test "$OS" = "HAIKU"; then
11378         haiku_arch="`echo $RTL_ARCH | tr X x`"
11379         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11380         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11381     fi
11383     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11384     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11385     if test -n "$supports_multilib"; then
11386         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11387     fi
11389     kf5_test_include="KF5/kcoreaddons_version.h"
11390     kf5_test_library="libKF5CoreAddons.so"
11391     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11393     dnl kf5 KDE4 support compatibility installed
11394     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11395     if test "$KF5_CONFIG" != "no"; then
11396         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11397         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11398     fi
11400     dnl Check for KF5 headers
11401     AC_MSG_CHECKING([for KF5 headers])
11402     kf5_incdir="no"
11403     for kf5_check in $kf5_incdirs; do
11404         if test -r "$kf5_check/$kf5_test_include"; then
11405             kf5_incdir="$kf5_check/KF5"
11406             break
11407         fi
11408     done
11409     AC_MSG_RESULT([$kf5_incdir])
11410     if test "x$kf5_incdir" = "xno"; then
11411         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11412     fi
11414     dnl Check for KF5 libraries
11415     AC_MSG_CHECKING([for KF5 libraries])
11416     kf5_libdir="no"
11417     for kf5_check in $kf5_libdirs; do
11418         if test -r "$kf5_check/$kf5_test_library"; then
11419             kf5_libdir="$kf5_check"
11420             break
11421         fi
11422     done
11424     AC_MSG_RESULT([$kf5_libdir])
11425     if test "x$kf5_libdir" = "xno"; then
11426         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11427     fi
11429     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"
11430     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11431     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11433     if test "$USING_X11" = TRUE; then
11434         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11435     fi
11437     AC_LANG_PUSH([C++])
11438     save_CXXFLAGS=$CXXFLAGS
11439     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11440     AC_MSG_CHECKING([whether KDE is >= 5.0])
11441        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11442 #include <kcoreaddons_version.h>
11444 int main(int argc, char **argv) {
11445        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11446        else return 1;
11448        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11449     CXXFLAGS=$save_CXXFLAGS
11450     AC_LANG_POP([C++])
11452 AC_SUBST(KF5_CFLAGS)
11453 AC_SUBST(KF5_LIBS)
11455 dnl ===================================================================
11456 dnl Test whether to include Evolution 2 support
11457 dnl ===================================================================
11458 AC_MSG_CHECKING([whether to enable evolution 2 support])
11459 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11460     AC_MSG_RESULT([yes])
11461     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11462     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11463     FilterLibs "${GOBJECT_LIBS}"
11464     GOBJECT_LIBS="${filteredlibs}"
11465     ENABLE_EVOAB2="TRUE"
11466 else
11467     ENABLE_EVOAB2=""
11468     AC_MSG_RESULT([no])
11470 AC_SUBST(ENABLE_EVOAB2)
11471 AC_SUBST(GOBJECT_CFLAGS)
11472 AC_SUBST(GOBJECT_LIBS)
11474 dnl ===================================================================
11475 dnl Test which themes to include
11476 dnl ===================================================================
11477 AC_MSG_CHECKING([which themes to include])
11478 # if none given use default subset of available themes
11479 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11480     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_svg sifr_dark tango"
11483 WITH_THEMES=""
11484 if test "x$with_theme" != "xno"; then
11485     for theme in $with_theme; do
11486         case $theme in
11487         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11488         default) real_theme=colibre ;;
11489         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11490         esac
11491         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11492     done
11494 AC_MSG_RESULT([$WITH_THEMES])
11495 AC_SUBST([WITH_THEMES])
11496 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11497 for theme in $with_theme; do
11498     case $theme in
11499     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11500     *) ;;
11501     esac
11502 done
11504 dnl ===================================================================
11505 dnl Test whether to integrate helppacks into the product's installer
11506 dnl ===================================================================
11507 AC_MSG_CHECKING([for helppack integration])
11508 if test "$with_helppack_integration" = "no"; then
11509     AC_MSG_RESULT([no integration])
11510 else
11511     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11512     AC_MSG_RESULT([integration])
11515 ###############################################################################
11516 # Extensions checking
11517 ###############################################################################
11518 AC_MSG_CHECKING([for extensions integration])
11519 if test "x$enable_extension_integration" != "xno"; then
11520     WITH_EXTENSION_INTEGRATION=TRUE
11521     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11522     AC_MSG_RESULT([yes, use integration])
11523 else
11524     WITH_EXTENSION_INTEGRATION=
11525     AC_MSG_RESULT([no, do not integrate])
11527 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11529 dnl Should any extra extensions be included?
11530 dnl There are standalone tests for each of these below.
11531 WITH_EXTRA_EXTENSIONS=
11532 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11534 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11535 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11536 if test "x$with_java" != "xno"; then
11537     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11538     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11541 AC_MSG_CHECKING([whether to build opens___.ttf])
11542 if test "$enable_build_opensymbol" = "yes"; then
11543     AC_MSG_RESULT([yes])
11544     AC_PATH_PROG(FONTFORGE, fontforge)
11545     if test -z "$FONTFORGE"; then
11546         AC_MSG_ERROR([fontforge not installed])
11547     fi
11548 else
11549     AC_MSG_RESULT([no])
11550     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11551     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11553 AC_SUBST(OPENSYMBOL_TTF)
11554 AC_SUBST(FONTFORGE)
11556 dnl ===================================================================
11557 dnl Test whether to include fonts
11558 dnl ===================================================================
11559 AC_MSG_CHECKING([whether to include third-party fonts])
11560 if test "$with_fonts" != "no"; then
11561     AC_MSG_RESULT([yes])
11562     WITH_FONTS=TRUE
11563     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11564     AC_DEFINE(HAVE_MORE_FONTS)
11565 else
11566     AC_MSG_RESULT([no])
11567     WITH_FONTS=
11568     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11570 AC_SUBST(WITH_FONTS)
11573 dnl ===================================================================
11574 dnl Test whether to enable online update service
11575 dnl ===================================================================
11576 AC_MSG_CHECKING([whether to enable online update])
11577 ENABLE_ONLINE_UPDATE=
11578 ENABLE_ONLINE_UPDATE_MAR=
11579 UPDATE_CONFIG=
11580 if test "$enable_online_update" = ""; then
11581     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11582         AC_MSG_RESULT([yes])
11583         ENABLE_ONLINE_UPDATE="TRUE"
11584     else
11585         AC_MSG_RESULT([no])
11586     fi
11587 else
11588     if test "$enable_online_update" = "mar"; then
11589         AC_MSG_RESULT([yes - MAR-based online update])
11590         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11591         if test "$with_update_config" = ""; then
11592             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11593         fi
11594         UPDATE_CONFIG="$with_update_config"
11595         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11596     elif test "$enable_online_update" = "yes"; then
11597         AC_MSG_RESULT([yes])
11598         ENABLE_ONLINE_UPDATE="TRUE"
11599     else
11600         AC_MSG_RESULT([no])
11601     fi
11603 AC_SUBST(ENABLE_ONLINE_UPDATE)
11604 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11605 AC_SUBST(UPDATE_CONFIG)
11607 dnl ===================================================================
11608 dnl Test whether we need bzip2
11609 dnl ===================================================================
11610 SYSTEM_BZIP2=
11611 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11612     AC_MSG_CHECKING([whether to use system bzip2])
11613     if test "$with_system_bzip2" = yes; then
11614         SYSTEM_BZIP2=TRUE
11615         AC_MSG_RESULT([yes])
11616         PKG_CHECK_MODULES(BZIP2, bzip2)
11617         FilterLibs "${BZIP2_LIBS}"
11618         BZIP2_LIBS="${filteredlibs}"
11619     else
11620         AC_MSG_RESULT([no])
11621         BUILD_TYPE="$BUILD_TYPE BZIP2"
11622     fi
11624 AC_SUBST(SYSTEM_BZIP2)
11625 AC_SUBST(BZIP2_CFLAGS)
11626 AC_SUBST(BZIP2_LIBS)
11628 dnl ===================================================================
11629 dnl Test whether to enable extension update
11630 dnl ===================================================================
11631 AC_MSG_CHECKING([whether to enable extension update])
11632 ENABLE_EXTENSION_UPDATE=
11633 if test "x$enable_extension_update" = "xno"; then
11634     AC_MSG_RESULT([no])
11635 else
11636     AC_MSG_RESULT([yes])
11637     ENABLE_EXTENSION_UPDATE="TRUE"
11638     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11639     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11641 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11644 dnl ===================================================================
11645 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11646 dnl ===================================================================
11647 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11648 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11649     AC_MSG_RESULT([no])
11650     ENABLE_SILENT_MSI=
11651 else
11652     AC_MSG_RESULT([yes])
11653     ENABLE_SILENT_MSI=TRUE
11654     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11656 AC_SUBST(ENABLE_SILENT_MSI)
11658 AC_MSG_CHECKING([whether and how to use Xinerama])
11659 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11660     if test "$x_libraries" = "default_x_libraries"; then
11661         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11662         if test "x$XINERAMALIB" = x; then
11663            XINERAMALIB="/usr/lib"
11664         fi
11665     else
11666         XINERAMALIB="$x_libraries"
11667     fi
11668     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11669         # we have both versions, let the user decide but use the dynamic one
11670         # per default
11671         USE_XINERAMA=TRUE
11672         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11673             XINERAMA_LINK=dynamic
11674         else
11675             XINERAMA_LINK=static
11676         fi
11677     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11678         # we have only the dynamic version
11679         USE_XINERAMA=TRUE
11680         XINERAMA_LINK=dynamic
11681     elif test -e "$XINERAMALIB/libXinerama.a"; then
11682         # static version
11683         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11684             USE_XINERAMA=TRUE
11685             XINERAMA_LINK=static
11686         else
11687             USE_XINERAMA=
11688             XINERAMA_LINK=none
11689         fi
11690     else
11691         # no Xinerama
11692         USE_XINERAMA=
11693         XINERAMA_LINK=none
11694     fi
11695     if test "$USE_XINERAMA" = "TRUE"; then
11696         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11697         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11698             [AC_MSG_ERROR(Xinerama header not found.)], [])
11699         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11700         if test "x$XEXTLIB" = x; then
11701            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11702         fi
11703         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11704         if test "$_os" = "FreeBSD"; then
11705             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11706         fi
11707         if test "$_os" = "Linux"; then
11708             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11709         fi
11710         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11711             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11712     else
11713         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11714     fi
11715 else
11716     USE_XINERAMA=
11717     XINERAMA_LINK=none
11718     AC_MSG_RESULT([no])
11720 AC_SUBST(USE_XINERAMA)
11721 AC_SUBST(XINERAMA_LINK)
11723 dnl ===================================================================
11724 dnl Test whether to build cairo or rely on the system version
11725 dnl ===================================================================
11727 if test "$USING_X11" = TRUE; then
11728     # Used in vcl/Library_vclplug_gen.mk
11729     test_cairo=yes
11732 if test "$test_cairo" = "yes"; then
11733     AC_MSG_CHECKING([whether to use the system cairo])
11735     : ${with_system_cairo:=$with_system_libs}
11736     if test "$with_system_cairo" = "yes"; then
11737         SYSTEM_CAIRO=TRUE
11738         AC_MSG_RESULT([yes])
11740         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11741         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11742         FilterLibs "${CAIRO_LIBS}"
11743         CAIRO_LIBS="${filteredlibs}"
11745         if test "$test_xrender" = "yes"; then
11746             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11747             AC_LANG_PUSH([C])
11748             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11749 #ifdef PictStandardA8
11750 #else
11751       return fail;
11752 #endif
11753 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11755             AC_LANG_POP([C])
11756         fi
11757     else
11758         SYSTEM_CAIRO=
11759         AC_MSG_RESULT([no])
11761         BUILD_TYPE="$BUILD_TYPE CAIRO"
11762     fi
11765 AC_SUBST(SYSTEM_CAIRO)
11766 AC_SUBST(CAIRO_CFLAGS)
11767 AC_SUBST(CAIRO_LIBS)
11769 dnl ===================================================================
11770 dnl Test whether to use avahi
11771 dnl ===================================================================
11772 if test "$_os" = "WINNT"; then
11773     # Windows uses bundled mDNSResponder
11774     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11775 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11776     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11777                       [ENABLE_AVAHI="TRUE"])
11778     AC_DEFINE(HAVE_FEATURE_AVAHI)
11779     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11780     FilterLibs "${AVAHI_LIBS}"
11781     AVAHI_LIBS="${filteredlibs}"
11784 AC_SUBST(ENABLE_AVAHI)
11785 AC_SUBST(AVAHI_CFLAGS)
11786 AC_SUBST(AVAHI_LIBS)
11788 dnl ===================================================================
11789 dnl Test whether to use liblangtag
11790 dnl ===================================================================
11791 SYSTEM_LIBLANGTAG=
11792 AC_MSG_CHECKING([whether to use system liblangtag])
11793 if test "$with_system_liblangtag" = yes; then
11794     SYSTEM_LIBLANGTAG=TRUE
11795     AC_MSG_RESULT([yes])
11796     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11797     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11798     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11799     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11800     FilterLibs "${LIBLANGTAG_LIBS}"
11801     LIBLANGTAG_LIBS="${filteredlibs}"
11802 else
11803     SYSTEM_LIBLANGTAG=
11804     AC_MSG_RESULT([no])
11805     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11806     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11807     if test "$COM" = "MSC"; then
11808         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11809     else
11810         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11811     fi
11813 AC_SUBST(SYSTEM_LIBLANGTAG)
11814 AC_SUBST(LIBLANGTAG_CFLAGS)
11815 AC_SUBST(LIBLANGTAG_LIBS)
11817 dnl ===================================================================
11818 dnl Test whether to build libpng or rely on the system version
11819 dnl ===================================================================
11821 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11823 dnl ===================================================================
11824 dnl Check for runtime JVM search path
11825 dnl ===================================================================
11826 if test "$ENABLE_JAVA" != ""; then
11827     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11828     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11829         AC_MSG_RESULT([yes])
11830         if ! test -d "$with_jvm_path"; then
11831             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11832         fi
11833         if ! test -d "$with_jvm_path"jvm; then
11834             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11835         fi
11836         JVM_ONE_PATH_CHECK="$with_jvm_path"
11837         AC_SUBST(JVM_ONE_PATH_CHECK)
11838     else
11839         AC_MSG_RESULT([no])
11840     fi
11843 dnl ===================================================================
11844 dnl Test for the presence of Ant and that it works
11845 dnl ===================================================================
11847 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11848     ANT_HOME=; export ANT_HOME
11849     WITH_ANT_HOME=; export WITH_ANT_HOME
11850     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11851         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11852             if test "$_os" = "WINNT"; then
11853                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11854             else
11855                 with_ant_home="$LODE_HOME/opt/ant"
11856             fi
11857         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11858             with_ant_home="$LODE_HOME/opt/ant"
11859         fi
11860     fi
11861     if test -z "$with_ant_home"; then
11862         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11863     else
11864         if test "$_os" = "WINNT"; then
11865             # AC_PATH_PROGS needs unix path
11866             with_ant_home=`cygpath -u "$with_ant_home"`
11867         fi
11868         AbsolutePath "$with_ant_home"
11869         with_ant_home=$absolute_path
11870         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11871         WITH_ANT_HOME=$with_ant_home
11872         ANT_HOME=$with_ant_home
11873     fi
11875     if test -z "$ANT"; then
11876         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11877     else
11878         # resolve relative or absolute symlink
11879         while test -h "$ANT"; do
11880             a_cwd=`pwd`
11881             a_basename=`basename "$ANT"`
11882             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11883             cd "`dirname "$ANT"`"
11884             cd "`dirname "$a_script"`"
11885             ANT="`pwd`"/"`basename "$a_script"`"
11886             cd "$a_cwd"
11887         done
11889         AC_MSG_CHECKING([if $ANT works])
11890         mkdir -p conftest.dir
11891         a_cwd=$(pwd)
11892         cd conftest.dir
11893         cat > conftest.java << EOF
11894         public class conftest {
11895             int testmethod(int a, int b) {
11896                     return a + b;
11897             }
11898         }
11901         cat > conftest.xml << EOF
11902         <project name="conftest" default="conftest">
11903         <target name="conftest">
11904             <javac srcdir="." includes="conftest.java">
11905             </javac>
11906         </target>
11907         </project>
11910         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11911         if test $? = 0 -a -f ./conftest.class; then
11912             AC_MSG_RESULT([Ant works])
11913             if test -z "$WITH_ANT_HOME"; then
11914                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11915                 if test -z "$ANT_HOME"; then
11916                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11917                 fi
11918             else
11919                 ANT_HOME="$WITH_ANT_HOME"
11920             fi
11921         else
11922             echo "configure: Ant test failed" >&5
11923             cat conftest.java >&5
11924             cat conftest.xml >&5
11925             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11926         fi
11927         cd "$a_cwd"
11928         rm -fr conftest.dir
11929     fi
11930     if test -z "$ANT_HOME"; then
11931         ANT_HOME="NO_ANT_HOME"
11932     else
11933         PathFormat "$ANT_HOME"
11934         ANT_HOME="$formatted_path"
11935         PathFormat "$ANT"
11936         ANT="$formatted_path"
11937     fi
11938     AC_SUBST(ANT_HOME)
11939     AC_SUBST(ANT)
11941     dnl Checking for ant.jar
11942     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11943         AC_MSG_CHECKING([Ant lib directory])
11944         if test -f $ANT_HOME/lib/ant.jar; then
11945             ANT_LIB="$ANT_HOME/lib"
11946         else
11947             if test -f $ANT_HOME/ant.jar; then
11948                 ANT_LIB="$ANT_HOME"
11949             else
11950                 if test -f /usr/share/java/ant.jar; then
11951                     ANT_LIB=/usr/share/java
11952                 else
11953                     if test -f /usr/share/ant-core/lib/ant.jar; then
11954                         ANT_LIB=/usr/share/ant-core/lib
11955                     else
11956                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11957                             ANT_LIB="$ANT_HOME/lib/ant"
11958                         else
11959                             if test -f /usr/share/lib/ant/ant.jar; then
11960                                 ANT_LIB=/usr/share/lib/ant
11961                             else
11962                                 AC_MSG_ERROR([Ant libraries not found!])
11963                             fi
11964                         fi
11965                     fi
11966                 fi
11967             fi
11968         fi
11969         PathFormat "$ANT_LIB"
11970         ANT_LIB="$formatted_path"
11971         AC_MSG_RESULT([Ant lib directory found.])
11972     fi
11973     AC_SUBST(ANT_LIB)
11975     ant_minver=1.6.0
11976     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11978     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11979     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11980     ant_version_major=`echo $ant_version | cut -d. -f1`
11981     ant_version_minor=`echo $ant_version | cut -d. -f2`
11982     echo "configure: ant_version $ant_version " >&5
11983     echo "configure: ant_version_major $ant_version_major " >&5
11984     echo "configure: ant_version_minor $ant_version_minor " >&5
11985     if test "$ant_version_major" -ge "2"; then
11986         AC_MSG_RESULT([yes, $ant_version])
11987     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11988         AC_MSG_RESULT([yes, $ant_version])
11989     else
11990         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11991     fi
11993     rm -f conftest* core core.* *.core
11996 OOO_JUNIT_JAR=
11997 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11998     AC_MSG_CHECKING([for JUnit 4])
11999     if test "$with_junit" = "yes"; then
12000         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12001             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12002         elif test -e /usr/share/java/junit4.jar; then
12003             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12004         else
12005            if test -e /usr/share/lib/java/junit.jar; then
12006               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12007            else
12008               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12009            fi
12010         fi
12011     else
12012         OOO_JUNIT_JAR=$with_junit
12013     fi
12014     if test "$_os" = "WINNT"; then
12015         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12016     fi
12017     printf 'import org.junit.Before;' > conftest.java
12018     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12019         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12020     else
12021         AC_MSG_ERROR(
12022 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12023  specify its pathname via --with-junit=..., or disable it via --without-junit])
12024     fi
12025     rm -f conftest.class conftest.java
12026     if test $OOO_JUNIT_JAR != ""; then
12027     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12028     fi
12030 AC_SUBST(OOO_JUNIT_JAR)
12032 HAMCREST_JAR=
12033 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12034     AC_MSG_CHECKING([for included Hamcrest])
12035     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12036     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12037         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12038     else
12039         AC_MSG_RESULT([Not included])
12040         AC_MSG_CHECKING([for standalone hamcrest jar.])
12041         if test "$with_hamcrest" = "yes"; then
12042             if test -e /usr/share/lib/java/hamcrest.jar; then
12043                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12044             elif test -e /usr/share/java/hamcrest/core.jar; then
12045                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12046             else
12047                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12048             fi
12049         else
12050             HAMCREST_JAR=$with_hamcrest
12051         fi
12052         if test "$_os" = "WINNT"; then
12053             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12054         fi
12055         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12056             AC_MSG_RESULT([$HAMCREST_JAR])
12057         else
12058             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),
12059                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12060         fi
12061     fi
12062     rm -f conftest.class conftest.java
12064 AC_SUBST(HAMCREST_JAR)
12067 AC_SUBST(SCPDEFS)
12070 # check for wget and curl
12072 WGET=
12073 CURL=
12075 if test "$enable_fetch_external" != "no"; then
12077 CURL=`which curl 2>/dev/null`
12079 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12080     # wget new enough?
12081     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12082     if test $? -eq 0; then
12083         WGET=$i
12084         break
12085     fi
12086 done
12088 if test -z "$WGET" -a -z "$CURL"; then
12089     AC_MSG_ERROR([neither wget nor curl found!])
12094 AC_SUBST(WGET)
12095 AC_SUBST(CURL)
12098 # check for sha256sum
12100 SHA256SUM=
12102 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12103     eval "$i -a 256 --version" > /dev/null 2>&1
12104     ret=$?
12105     if test $ret -eq 0; then
12106         SHA256SUM="$i -a 256"
12107         break
12108     fi
12109 done
12111 if test -z "$SHA256SUM"; then
12112     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12113         eval "$i --version" > /dev/null 2>&1
12114         ret=$?
12115         if test $ret -eq 0; then
12116             SHA256SUM=$i
12117             break
12118         fi
12119     done
12122 if test -z "$SHA256SUM"; then
12123     AC_MSG_ERROR([no sha256sum found!])
12126 AC_SUBST(SHA256SUM)
12128 dnl ===================================================================
12129 dnl Dealing with l10n options
12130 dnl ===================================================================
12131 AC_MSG_CHECKING([which languages to be built])
12132 # get list of all languages
12133 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12134 # the sed command does the following:
12135 #   + if a line ends with a backslash, append the next line to it
12136 #   + adds " on the beginning of the value (after =)
12137 #   + adds " at the end of the value
12138 #   + removes en-US; we want to put it on the beginning
12139 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12140 [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)]
12141 ALL_LANGS="en-US $completelangiso"
12142 # check the configured localizations
12143 WITH_LANG="$with_lang"
12145 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12146 # (Norwegian is "nb" and "nn".)
12147 if test "$WITH_LANG" = "no"; then
12148     WITH_LANG=
12151 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12152     AC_MSG_RESULT([en-US])
12153 else
12154     AC_MSG_RESULT([$WITH_LANG])
12155     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12156     if test -z "$MSGFMT"; then
12157         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12158             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12159         elif test -x "/opt/lo/bin/msgfmt"; then
12160             MSGFMT="/opt/lo/bin/msgfmt"
12161         else
12162             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12163             if test -z "$MSGFMT"; then
12164                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12165             fi
12166         fi
12167     fi
12168     if test -z "$MSGUNIQ"; then
12169         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12170             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12171         elif test -x "/opt/lo/bin/msguniq"; then
12172             MSGUNIQ="/opt/lo/bin/msguniq"
12173         else
12174             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12175             if test -z "$MSGUNIQ"; then
12176                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12177             fi
12178         fi
12179     fi
12181 AC_SUBST(MSGFMT)
12182 AC_SUBST(MSGUNIQ)
12183 # check that the list is valid
12184 for lang in $WITH_LANG; do
12185     test "$lang" = "ALL" && continue
12186     # need to check for the exact string, so add space before and after the list of all languages
12187     for vl in $ALL_LANGS; do
12188         if test "$vl" = "$lang"; then
12189            break
12190         fi
12191     done
12192     if test "$vl" != "$lang"; then
12193         # if you're reading this - you prolly quoted your languages remove the quotes ...
12194         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12195     fi
12196 done
12197 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12198     echo $WITH_LANG | grep -q en-US
12199     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12201 # list with substituted ALL
12202 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12203 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12204 test "$WITH_LANG" = "en-US" && WITH_LANG=
12205 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12206     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12207     ALL_LANGS=`echo $ALL_LANGS qtz`
12209 AC_SUBST(ALL_LANGS)
12210 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12211 AC_SUBST(WITH_LANG)
12212 AC_SUBST(WITH_LANG_LIST)
12213 AC_SUBST(GIT_NEEDED_SUBMODULES)
12215 WITH_POOR_HELP_LOCALIZATIONS=
12216 if test -d "$SRC_ROOT/translations/source"; then
12217     for l in `ls -1 $SRC_ROOT/translations/source`; do
12218         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12219             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12220         fi
12221     done
12223 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12225 if test -n "$with_locales"; then
12226     WITH_LOCALES="$with_locales"
12228     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12229     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12230     # config_host/config_locales.h.in
12231     for locale in $WITH_LOCALES; do
12232         lang=${locale%_*}
12234         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12236         case $lang in
12237         hi|mr*ne)
12238             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12239             ;;
12240         bg|ru)
12241             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12242             ;;
12243         esac
12244     done
12245 else
12246     AC_DEFINE(WITH_LOCALE_ALL)
12248 AC_SUBST(WITH_LOCALES)
12250 dnl git submodule update --reference
12251 dnl ===================================================================
12252 if test -n "${GIT_REFERENCE_SRC}"; then
12253     for repo in ${GIT_NEEDED_SUBMODULES}; do
12254         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12255             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12256         fi
12257     done
12259 AC_SUBST(GIT_REFERENCE_SRC)
12261 dnl git submodules linked dirs
12262 dnl ===================================================================
12263 if test -n "${GIT_LINK_SRC}"; then
12264     for repo in ${GIT_NEEDED_SUBMODULES}; do
12265         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12266             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12267         fi
12268     done
12270 AC_SUBST(GIT_LINK_SRC)
12272 dnl branding
12273 dnl ===================================================================
12274 AC_MSG_CHECKING([for alternative branding images directory])
12275 # initialize mapped arrays
12276 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12277 brand_files="$BRAND_INTRO_IMAGES about.svg"
12279 if test -z "$with_branding" -o "$with_branding" = "no"; then
12280     AC_MSG_RESULT([none])
12281     DEFAULT_BRAND_IMAGES="$brand_files"
12282 else
12283     if ! test -d $with_branding ; then
12284         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12285     else
12286         AC_MSG_RESULT([$with_branding])
12287         CUSTOM_BRAND_DIR="$with_branding"
12288         for lfile in $brand_files
12289         do
12290             if ! test -f $with_branding/$lfile ; then
12291                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12292                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12293             else
12294                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12295             fi
12296         done
12297         check_for_progress="yes"
12298     fi
12300 AC_SUBST([BRAND_INTRO_IMAGES])
12301 AC_SUBST([CUSTOM_BRAND_DIR])
12302 AC_SUBST([CUSTOM_BRAND_IMAGES])
12303 AC_SUBST([DEFAULT_BRAND_IMAGES])
12306 AC_MSG_CHECKING([for 'intro' progress settings])
12307 PROGRESSBARCOLOR=
12308 PROGRESSSIZE=
12309 PROGRESSPOSITION=
12310 PROGRESSFRAMECOLOR=
12311 PROGRESSTEXTCOLOR=
12312 PROGRESSTEXTBASELINE=
12314 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12315     source "$with_branding/progress.conf"
12316     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12317 else
12318     AC_MSG_RESULT([none])
12321 AC_SUBST(PROGRESSBARCOLOR)
12322 AC_SUBST(PROGRESSSIZE)
12323 AC_SUBST(PROGRESSPOSITION)
12324 AC_SUBST(PROGRESSFRAMECOLOR)
12325 AC_SUBST(PROGRESSTEXTCOLOR)
12326 AC_SUBST(PROGRESSTEXTBASELINE)
12329 AC_MSG_CHECKING([for extra build ID])
12330 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12331     EXTRA_BUILDID="$with_extra_buildid"
12333 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12334 if test -n "$EXTRA_BUILDID" ; then
12335     AC_MSG_RESULT([$EXTRA_BUILDID])
12336 else
12337     AC_MSG_RESULT([not set])
12339 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12341 OOO_VENDOR=
12342 AC_MSG_CHECKING([for vendor])
12343 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12344     OOO_VENDOR="$USERNAME"
12346     if test -z "$OOO_VENDOR"; then
12347         OOO_VENDOR="$USER"
12348     fi
12350     if test -z "$OOO_VENDOR"; then
12351         OOO_VENDOR="`id -u -n`"
12352     fi
12354     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12355 else
12356     OOO_VENDOR="$with_vendor"
12357     AC_MSG_RESULT([$OOO_VENDOR])
12359 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12360 AC_SUBST(OOO_VENDOR)
12362 if test "$_os" = "Android" ; then
12363     ANDROID_PACKAGE_NAME=
12364     AC_MSG_CHECKING([for Android package name])
12365     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12366         if test -n "$ENABLE_DEBUG"; then
12367             # Default to the package name that makes ndk-gdb happy.
12368             ANDROID_PACKAGE_NAME="org.libreoffice"
12369         else
12370             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12371         fi
12373         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12374     else
12375         ANDROID_PACKAGE_NAME="$with_android_package_name"
12376         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12377     fi
12378     AC_SUBST(ANDROID_PACKAGE_NAME)
12381 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12382 if test "$with_compat_oowrappers" = "yes"; then
12383     WITH_COMPAT_OOWRAPPERS=TRUE
12384     AC_MSG_RESULT(yes)
12385 else
12386     WITH_COMPAT_OOWRAPPERS=
12387     AC_MSG_RESULT(no)
12389 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12391 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12392 AC_MSG_CHECKING([for install dirname])
12393 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12394     INSTALLDIRNAME="$with_install_dirname"
12396 AC_MSG_RESULT([$INSTALLDIRNAME])
12397 AC_SUBST(INSTALLDIRNAME)
12399 AC_MSG_CHECKING([for prefix])
12400 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12401 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12402 PREFIXDIR="$prefix"
12403 AC_MSG_RESULT([$PREFIXDIR])
12404 AC_SUBST(PREFIXDIR)
12406 LIBDIR=[$(eval echo $(eval echo $libdir))]
12407 AC_SUBST(LIBDIR)
12409 DATADIR=[$(eval echo $(eval echo $datadir))]
12410 AC_SUBST(DATADIR)
12412 MANDIR=[$(eval echo $(eval echo $mandir))]
12413 AC_SUBST(MANDIR)
12415 DOCDIR=[$(eval echo $(eval echo $docdir))]
12416 AC_SUBST(DOCDIR)
12418 BINDIR=[$(eval echo $(eval echo $bindir))]
12419 AC_SUBST(BINDIR)
12421 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12422 AC_SUBST(INSTALLDIR)
12424 TESTINSTALLDIR="${BUILDDIR}/test-install"
12425 AC_SUBST(TESTINSTALLDIR)
12428 # ===================================================================
12429 # OAuth2 id and secrets
12430 # ===================================================================
12432 AC_MSG_CHECKING([for Google Drive client id and secret])
12433 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12434     AC_MSG_RESULT([not set])
12435     GDRIVE_CLIENT_ID="\"\""
12436     GDRIVE_CLIENT_SECRET="\"\""
12437 else
12438     AC_MSG_RESULT([set])
12439     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12440     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12442 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12443 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12445 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12446 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12447     AC_MSG_RESULT([not set])
12448     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12449     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12450 else
12451     AC_MSG_RESULT([set])
12452     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12453     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12455 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12456 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12458 AC_MSG_CHECKING([for OneDrive client id and secret])
12459 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12460     AC_MSG_RESULT([not set])
12461     ONEDRIVE_CLIENT_ID="\"\""
12462     ONEDRIVE_CLIENT_SECRET="\"\""
12463 else
12464     AC_MSG_RESULT([set])
12465     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12466     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12468 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12469 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12472 dnl ===================================================================
12473 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12474 dnl --enable-dependency-tracking configure option
12475 dnl ===================================================================
12476 AC_MSG_CHECKING([whether to enable dependency tracking])
12477 if test "$enable_dependency_tracking" = "no"; then
12478     nodep=TRUE
12479     AC_MSG_RESULT([no])
12480 else
12481     AC_MSG_RESULT([yes])
12483 AC_SUBST(nodep)
12485 dnl ===================================================================
12486 dnl Number of CPUs to use during the build
12487 dnl ===================================================================
12488 AC_MSG_CHECKING([for number of processors to use])
12489 # plain --with-parallelism is just the default
12490 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12491     if test "$with_parallelism" = "no"; then
12492         PARALLELISM=0
12493     else
12494         PARALLELISM=$with_parallelism
12495     fi
12496 else
12497     if test "$enable_icecream" = "yes"; then
12498         PARALLELISM="40"
12499     else
12500         case `uname -s` in
12502         Darwin|FreeBSD|NetBSD|OpenBSD)
12503             PARALLELISM=`sysctl -n hw.ncpu`
12504             ;;
12506         Linux)
12507             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12508         ;;
12509         # what else than above does profit here *and* has /proc?
12510         *)
12511             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12512             ;;
12513         esac
12515         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12516         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12517     fi
12520 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12521     if test -z "$with_parallelism"; then
12522             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12523             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12524             PARALLELISM="1"
12525     else
12526         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."
12527     fi
12530 if test $PARALLELISM -eq 0; then
12531     AC_MSG_RESULT([explicit make -j option needed])
12532 else
12533     AC_MSG_RESULT([$PARALLELISM])
12535 AC_SUBST(PARALLELISM)
12537 IWYU_PATH="$with_iwyu"
12538 AC_SUBST(IWYU_PATH)
12539 if test ! -z "$IWYU_PATH"; then
12540     if test ! -f "$IWYU_PATH"; then
12541         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12542     fi
12546 # Set up ILIB for MSVC build
12548 ILIB1=
12549 if test "$build_os" = "cygwin"; then
12550     ILIB="."
12551     if test -n "$JAVA_HOME"; then
12552         ILIB="$ILIB;$JAVA_HOME/lib"
12553     fi
12554     ILIB1=-link
12555     if test "$BITNESS_OVERRIDE" = 64; then
12556         ILIB="$ILIB;$COMPATH/lib/x64"
12557         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12558         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12559         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12560         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12561             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12562             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12563         fi
12564         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12565         ucrtlibpath_formatted=$formatted_path
12566         ILIB="$ILIB;$ucrtlibpath_formatted"
12567         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12568     else
12569         ILIB="$ILIB;$COMPATH/lib/x86"
12570         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12571         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12572         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12573         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12574             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12575             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12576         fi
12577         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12578         ucrtlibpath_formatted=$formatted_path
12579         ILIB="$ILIB;$ucrtlibpath_formatted"
12580         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12581     fi
12582     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12583         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12584     else
12585         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12586     fi
12588     AC_SUBST(ILIB)
12591 # ===================================================================
12592 # Creating bigger shared library to link against
12593 # ===================================================================
12594 AC_MSG_CHECKING([whether to create huge library])
12595 MERGELIBS=
12597 if test $_os = iOS -o $_os = Android; then
12598     # Never any point in mergelibs for these as we build just static
12599     # libraries anyway...
12600     enable_mergelibs=no
12603 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12604     if test $_os != Linux -a $_os != WINNT; then
12605         add_warning "--enable-mergelibs is not tested for this platform"
12606     fi
12607     MERGELIBS="TRUE"
12608     AC_MSG_RESULT([yes])
12609 else
12610     AC_MSG_RESULT([no])
12612 AC_SUBST([MERGELIBS])
12614 dnl ===================================================================
12615 dnl icerun is a wrapper that stops us spawning tens of processes
12616 dnl locally - for tools that can't be executed on the compile cluster
12617 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12618 dnl ===================================================================
12619 AC_MSG_CHECKING([whether to use icerun wrapper])
12620 ICECREAM_RUN=
12621 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12622     ICECREAM_RUN=icerun
12623     AC_MSG_RESULT([yes])
12624 else
12625     AC_MSG_RESULT([no])
12627 AC_SUBST(ICECREAM_RUN)
12629 dnl ===================================================================
12630 dnl Setup the ICECC_VERSION for the build the same way it was set for
12631 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12632 dnl ===================================================================
12633 x_ICECC_VERSION=[\#]
12634 if test -n "$ICECC_VERSION" ; then
12635     x_ICECC_VERSION=
12637 AC_SUBST(x_ICECC_VERSION)
12638 AC_SUBST(ICECC_VERSION)
12640 dnl ===================================================================
12642 AC_MSG_CHECKING([MPL subset])
12643 MPL_SUBSET=
12645 if test "$enable_mpl_subset" = "yes"; then
12646     warn_report=false
12647     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12648         warn_report=true
12649     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12650         warn_report=true
12651     fi
12652     if test "$warn_report" = "true"; then
12653         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12654     fi
12655     if test "x$enable_postgresql_sdbc" != "xno"; then
12656         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12657     fi
12658     if test "$enable_lotuswordpro" = "yes"; then
12659         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12660     fi
12661     if test "$WITH_WEBDAV" = "neon"; then
12662         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12663     fi
12664     if test -n "$ENABLE_POPPLER"; then
12665         if test "x$SYSTEM_POPPLER" = "x"; then
12666             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12667         fi
12668     fi
12669     # cf. m4/libo_check_extension.m4
12670     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12671         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12672     fi
12673     for theme in $WITH_THEMES; do
12674         case $theme in
12675         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12676             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12677         *) : ;;
12678         esac
12679     done
12681     ENABLE_OPENGL_TRANSITIONS=
12683     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12684         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12685     fi
12687     MPL_SUBSET="TRUE"
12688     AC_DEFINE(MPL_HAVE_SUBSET)
12689     AC_MSG_RESULT([only])
12690 else
12691     AC_MSG_RESULT([no restrictions])
12693 AC_SUBST(MPL_SUBSET)
12695 dnl ===================================================================
12697 AC_MSG_CHECKING([formula logger])
12698 ENABLE_FORMULA_LOGGER=
12700 if test "x$enable_formula_logger" = "xyes"; then
12701     AC_MSG_RESULT([yes])
12702     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12703     ENABLE_FORMULA_LOGGER=TRUE
12704 elif test -n "$ENABLE_DBGUTIL" ; then
12705     AC_MSG_RESULT([yes])
12706     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12707     ENABLE_FORMULA_LOGGER=TRUE
12708 else
12709     AC_MSG_RESULT([no])
12712 AC_SUBST(ENABLE_FORMULA_LOGGER)
12714 dnl ===================================================================
12715 dnl Setting up the environment.
12716 dnl ===================================================================
12717 AC_MSG_NOTICE([setting up the build environment variables...])
12719 AC_SUBST(COMPATH)
12721 if test "$build_os" = "cygwin"; then
12722     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12723         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12724         ATL_INCLUDE="$COMPATH/atlmfc/include"
12725     elif test -d "$COMPATH/atlmfc/lib"; then
12726         ATL_LIB="$COMPATH/atlmfc/lib"
12727         ATL_INCLUDE="$COMPATH/atlmfc/include"
12728     else
12729         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12730         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12731     fi
12732     if test "$BITNESS_OVERRIDE" = 64; then
12733         ATL_LIB="$ATL_LIB/x64"
12734     else
12735         ATL_LIB="$ATL_LIB/x86"
12736     fi
12737     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12738     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12740     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12741     PathFormat "/usr/bin/find.exe"
12742     FIND="$formatted_path"
12743     PathFormat "/usr/bin/sort.exe"
12744     SORT="$formatted_path"
12745     PathFormat "/usr/bin/grep.exe"
12746     WIN_GREP="$formatted_path"
12747     PathFormat "/usr/bin/ls.exe"
12748     WIN_LS="$formatted_path"
12749     PathFormat "/usr/bin/touch.exe"
12750     WIN_TOUCH="$formatted_path"
12751 else
12752     FIND=find
12753     SORT=sort
12756 AC_SUBST(ATL_INCLUDE)
12757 AC_SUBST(ATL_LIB)
12758 AC_SUBST(FIND)
12759 AC_SUBST(SORT)
12760 AC_SUBST(WIN_GREP)
12761 AC_SUBST(WIN_LS)
12762 AC_SUBST(WIN_TOUCH)
12764 AC_SUBST(BUILD_TYPE)
12766 AC_SUBST(SOLARINC)
12768 PathFormat "$PERL"
12769 PERL="$formatted_path"
12770 AC_SUBST(PERL)
12772 if test -n "$TMPDIR"; then
12773     TEMP_DIRECTORY="$TMPDIR"
12774 else
12775     TEMP_DIRECTORY="/tmp"
12777 if test "$build_os" = "cygwin"; then
12778     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12780 AC_SUBST(TEMP_DIRECTORY)
12782 # setup the PATH for the environment
12783 if test -n "$LO_PATH_FOR_BUILD"; then
12784     LO_PATH="$LO_PATH_FOR_BUILD"
12785 else
12786     LO_PATH="$PATH"
12788     case "$host_os" in
12790     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12791         if test "$ENABLE_JAVA" != ""; then
12792             pathmunge "$JAVA_HOME/bin" "after"
12793         fi
12794         ;;
12796     cygwin*)
12797         # Win32 make needs native paths
12798         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12799             LO_PATH=`cygpath -p -m "$PATH"`
12800         fi
12801         if test "$BITNESS_OVERRIDE" = 64; then
12802             # needed for msi packaging
12803             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12804         fi
12805         # .NET 4.6 and higher don't have bin directory
12806         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12807             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12808         fi
12809         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12810         pathmunge "$CSC_PATH" "before"
12811         pathmunge "$MIDL_PATH" "before"
12812         pathmunge "$AL_PATH" "before"
12813         pathmunge "$MSPDB_PATH" "before"
12814         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12815             pathmunge "$CL_PATH" "before"
12816         fi
12817         if test -n "$MSBUILD_PATH" ; then
12818             pathmunge "$MSBUILD_PATH" "before"
12819         fi
12820         if test "$BITNESS_OVERRIDE" = 64; then
12821             pathmunge "$COMPATH/bin/amd64" "before"
12822             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12823         else
12824             pathmunge "$COMPATH/bin" "before"
12825             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12826         fi
12827         if test "$ENABLE_JAVA" != ""; then
12828             if test -d "$JAVA_HOME/jre/bin/client"; then
12829                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12830             fi
12831             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12832                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12833             fi
12834             pathmunge "$JAVA_HOME/bin" "before"
12835         fi
12836         ;;
12838     solaris*)
12839         pathmunge "/usr/css/bin" "before"
12840         if test "$ENABLE_JAVA" != ""; then
12841             pathmunge "$JAVA_HOME/bin" "after"
12842         fi
12843         ;;
12844     esac
12847 AC_SUBST(LO_PATH)
12849 libo_FUZZ_SUMMARY
12851 # Generate a configuration sha256 we can use for deps
12852 if test -f config_host.mk; then
12853     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12855 if test -f config_host_lang.mk; then
12856     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12859 CFLAGS=$my_original_CFLAGS
12860 CXXFLAGS=$my_original_CXXFLAGS
12861 CPPFLAGS=$my_original_CPPFLAGS
12863 AC_CONFIG_FILES([config_host.mk
12864                  config_host_lang.mk
12865                  Makefile
12866                  bin/bffvalidator.sh
12867                  bin/odfvalidator.sh
12868                  bin/officeotron.sh
12869                  instsetoo_native/util/openoffice.lst
12870                  sysui/desktop/macosx/Info.plist])
12871 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12872 AC_CONFIG_HEADERS([config_host/config_clang.h])
12873 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12874 AC_CONFIG_HEADERS([config_host/config_eot.h])
12875 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12876 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12877 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12878 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12879 AC_CONFIG_HEADERS([config_host/config_features.h])
12880 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12881 AC_CONFIG_HEADERS([config_host/config_folders.h])
12882 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12883 AC_CONFIG_HEADERS([config_host/config_gio.h])
12884 AC_CONFIG_HEADERS([config_host/config_global.h])
12885 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12886 AC_CONFIG_HEADERS([config_host/config_java.h])
12887 AC_CONFIG_HEADERS([config_host/config_langs.h])
12888 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12889 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12890 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12891 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12892 AC_CONFIG_HEADERS([config_host/config_locales.h])
12893 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12894 AC_CONFIG_HEADERS([config_host/config_oox.h])
12895 AC_CONFIG_HEADERS([config_host/config_options.h])
12896 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12897 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12898 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12899 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12900 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12901 AC_CONFIG_HEADERS([config_host/config_version.h])
12902 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12903 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12904 AC_CONFIG_HEADERS([config_host/config_python.h])
12905 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12906 AC_OUTPUT
12908 if test "$CROSS_COMPILING" = TRUE; then
12909     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12912 # touch the config timestamp file
12913 if test ! -f config_host.mk.stamp; then
12914     echo > config_host.mk.stamp
12915 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12916     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12917 else
12918     echo > config_host.mk.stamp
12921 # touch the config lang timestamp file
12922 if test ! -f config_host_lang.mk.stamp; then
12923     echo > config_host_lang.mk.stamp
12924 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12925     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12926 else
12927     echo > config_host_lang.mk.stamp
12931 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12932         -a "$build_os" = "cygwin"; then
12934 cat << _EOS
12935 ****************************************************************************
12936 WARNING:
12937 Your make version is known to be horribly slow, and hard to debug
12938 problems with. To get a reasonably functional make please do:
12940 to install a pre-compiled binary make for Win32
12942  mkdir -p /opt/lo/bin
12943  cd /opt/lo/bin
12944  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12945  cp make-4.2.1-msvc.exe make
12946  chmod +x make
12948 to install from source:
12949 place yourself in a working directory of you choice.
12951  git clone git://git.savannah.gnu.org/make.git
12953  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12954  set PATH=%PATH%;C:\Cygwin\bin
12955  [or Cygwin64, if that is what you have]
12956  cd path-to-make-repo-you-cloned-above
12957  build_w32.bat --without-guile
12959 should result in a WinRel/gnumake.exe.
12960 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12962 Then re-run autogen.sh
12964 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12965 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12967 _EOS
12968 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12969     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12974 cat << _EOF
12975 ****************************************************************************
12977 To build, run:
12978 $GNUMAKE
12980 To view some help, run:
12981 $GNUMAKE help
12983 _EOF
12985 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12986     cat << _EOF
12987 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12988 _EOF
12990     if test $_os = Darwin; then
12991         echo open instdir/$PRODUCTNAME.app
12992     else
12993         echo instdir/program/soffice
12994     fi
12995     cat << _EOF
12997 If you want to run the smoketest, run:
12998 $GNUMAKE check
13000 _EOF
13003 if test -f warn; then
13004     cat warn
13005     rm warn
13008 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: