Bump version to 21.06.41.1
[LibreOffice.git] / configure.ac
blobaf6e05ab3737895466f3f4eae769e279d9615a66
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([Collabora Office],[21.06.41.1],[],[],[https://collaboraoffice.com/])
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     # Return value: $filteredlibs
48     filteredlibs=
49     for f in $1; do
50         case "$f" in
51             # let's start with Fedora's paths for now
52             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
53                 # ignore it: on UNIXoids it is searched by default anyway
54                 # but if it's given explicitly then it may override other paths
55                 # (on macOS it would be an error to use it instead of SDK)
56                 ;;
57             *)
58                 filteredlibs="$filteredlibs $f"
59                 ;;
60         esac
61     done
64 PathFormat()
66     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
67     # function is called also on Unix.
68     #
69     # Return value: $formatted_path and $formatted_path_unix.
70     #
71     # $formatted_path is the argument in Windows format, but using forward slashes instead of
72     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
73     # or shell metacharacters).
74     #
75     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
76     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
77     # Unix pathname.
78     #
79     # Errors out if 8.3 names are needed but aren't present for some of the path components.
81     # Examples:
82     #
83     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
84     #
85     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
86     #
87     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
88     #
89     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
90     #
91     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
92     #
93     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
94     #
95     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
97     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
98         printf "PathFormat $1 ==> "
99     fi
101     formatted_path="$1"
102     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
103         if test "$build_os" = "wsl"; then
104             formatted_path=$(echo "$formatted_path" | tr -d '\r')
105         fi
107         pf_conv_to_dos=
108         # spaces,parentheses,brackets,braces are problematic in pathname
109         # so are backslashes
110         case "$formatted_path" in
111             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
112                 pf_conv_to_dos="yes"
113             ;;
114         esac
115         if test "$pf_conv_to_dos" = "yes"; then
116             if test "$build_os" = "wsl"; then
117                 case "$formatted_path" in
118                     /*)
119                         formatted_path=$(wslpath -w "$formatted_path")
120                         ;;
121                 esac
122                 formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path")
123             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
124                 formatted_path=`cygpath -sm "$formatted_path"`
125             else
126                 formatted_path=`cygpath -d "$formatted_path"`
127             fi
128             if test $? -ne 0;  then
129                 AC_MSG_ERROR([path conversion failed for "$1".])
130             fi
131         fi
132         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
133         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
134         if test "$fp_count_slash$fp_count_colon" != "00"; then
135             if test "$fp_count_colon" = "0"; then
136                 new_formatted_path=`realpath "$formatted_path"`
137                 if test $? -ne 0;  then
138                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
139                 else
140                     formatted_path="$new_formatted_path"
141                 fi
142             fi
143             if test "$build_os" = "wsl"; then
144                 if test "$fp_count_colon" != "0"; then
145                     formatted_path=$(wslpath "$formatted_path")
146                     local final_slash=
147                     case "$formatted_path" in
148                         */)
149                             final_slash=/
150                             ;;
151                     esac
152                     formatted_path=$(wslpath -m $formatted_path)
153                     case "$formatted_path" in
154                         */)
155                             ;;
156                         *)
157                             formatted_path="$formatted_path"$final_slash
158                             ;;
159                     esac
160                 else
161                     formatted_path=$(wslpath -m "$formatted_path")
162                 fi
163             else
164                 formatted_path=`cygpath -m "$formatted_path"`
165             fi
166             if test $? -ne 0;  then
167                 AC_MSG_ERROR([path conversion failed for "$1".])
168             fi
169         fi
170         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
171         if test "$fp_count_space" != "0"; then
172             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
173         fi
174     fi
175     if test "$build_os" = "wsl"; then
176         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
177         formatted_path_unix=$(wslpath "$formatted_path")
178     else
179         # But Cygwin can
180         formatted_path_unix="$formatted_path"
181     fi
184 AbsolutePath()
186     # There appears to be no simple and portable method to get an absolute and
187     # canonical path, so we try creating the directory if does not exist and
188     # utilizing the shell and pwd.
190     # Args: $1: A possibly relative pathname
191     # Return value: $absolute_path
193     local rel="$1"
194     absolute_path=""
195     test ! -e "$rel" && mkdir -p "$rel"
196     if test -d "$rel" ; then
197         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
198         absolute_path="$(pwd)"
199         cd - > /dev/null
200     else
201         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
202     fi
205 rm -f warn
206 have_WARNINGS="no"
207 add_warning()
209     if test "$have_WARNINGS" = "no"; then
210         echo "*************************************" > warn
211         have_WARNINGS="yes"
212         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
213             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
214             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
215         else
216             COLORWARN="* WARNING :"
217         fi
218     fi
219     echo "$COLORWARN $@" >> warn
222 dnl Some Mac User have the bad habit of letting a lot of crap
223 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
224 dnl that confuse the build.
225 dnl For the ones that use LODE, let's be nice and protect them
226 dnl from themselves
228 mac_sanitize_path()
230     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
231 dnl a common but nevertheless necessary thing that may be in a fancy
232 dnl path location is git, so make sure we have it
233     mac_git_path=`which git 2>/dev/null`
234     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
235         mac_path="$mac_path:`dirname $mac_git_path`"
236     fi
237 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
238 dnl path location is gpg, so make sure we find it
239     mac_gpg_path=`which gpg 2>/dev/null`
240     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
241         mac_path="$mac_path:`dirname $mac_gpg_path`"
242     fi
243     PATH="$mac_path"
244     unset mac_path
245     unset mac_git_path
246     unset mac_gpg_path
249 echo "********************************************************************"
250 echo "*"
251 echo "*   Running ${PACKAGE_NAME} build configuration."
252 echo "*"
253 echo "********************************************************************"
254 echo ""
256 dnl ===================================================================
257 dnl checks build and host OSes
258 dnl do this before argument processing to allow for platform dependent defaults
259 dnl ===================================================================
261 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
262 # Linux on WSL) trust that.
263 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
264     ac_cv_host="x86_64-pc-wsl"
265     ac_cv_host_cpu="x86_64"
266     ac_cv_host_os="wsl"
267     ac_cv_build="$ac_cv_host"
268     ac_cv_build_cpu="$ac_cv_host_cpu"
269     ac_cv_build_os="$ac_cv_host_os"
271     # Emulation of Cygwin's cygpath command for WSL.
272     cygpath()
273     {
274         if test -n "$UNITTEST_WSL_CYGPATH"; then
275             echo -n cygpath "$@" "==> "
276         fi
278         # Cygwin's real cygpath has a plethora of options but we use only a few here.
279         local args="$@"
280         local opt
281         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
282         OPTIND=1
284         while getopts dmuwlsp opt; do
285             case "$opt" in
286                 \?)
287                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
288                     ;;
289                 ?)
290                     eval opt_$opt=yes
291                     ;;
292             esac
293         done
295         shift $((OPTIND-1))
297         if test $# -ne 1; then
298             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
299         fi
301         local input="$1"
303         local result
305         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
306             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
308             if test -n "$opt_u"; then
309                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
310             fi
312             case "$input" in
313                 /mnt/*)
314                     # A Windows file in WSL format
315                     input=$(wslpath -w "$input")
316                     ;;
317                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
318                     # Already in Windows format
319                     ;;
320                 /*)
321                     input=$(wslpath -w "$input")
322                     ;;
323                 *)
324                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
325                     ;;
326             esac
327             if test -n "$opt_d" -o -n "$opt_s"; then
328                 input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
329             fi
330             if test -n "$opt_m"; then
331                 input="${input//\\//}"
332             fi
333             echo "$input"
334         else
335             # Print Unix path
337             case "$input" in
338                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
339                     wslpath -u "$input"
340                     ;;
341                 /)
342                     echo "$input"
343                     ;;
344                 *)
345                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
346                     ;;
347             esac
348         fi
349     }
351     if test -n "$UNITTEST_WSL_CYGPATH"; then
352         BUILDDIR=.
354         # Nothing special with these file names, just arbitrary ones picked to test with
355         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
356         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
357         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
358         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
359         # At least on my machine for instance this file does have an 8.3 name
360         cygpath -d /mnt/c/windows/WindowsUpdate.log
361         # But for instance this one doesn't
362         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
363         cygpath -ws /mnt/c/windows/WindowsUpdate.log
364         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
365         cygpath -ms /mnt/c/windows/WindowsUpdate.log
367         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
368         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
370         exit 0
371     fi
374 AC_CANONICAL_HOST
375 AC_CANONICAL_BUILD
377 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
378     BUILDDIR=.
379     GREP=grep
381     # Use of PathFormat must be after AC_CANONICAL_BUILD above
382     PathFormat /
383     printf "$formatted_path , $formatted_path_unix\n"
385     PathFormat $PWD
386     printf "$formatted_path , $formatted_path_unix\n"
388     PathFormat "$PROGRAMFILESX86"
389     printf "$formatted_path , $formatted_path_unix\n"
391     exit 0
394 AC_MSG_CHECKING([for product name])
395 PRODUCTNAME="AC_PACKAGE_NAME"
396 if test -n "$with_product_name" -a "$with_product_name" != no; then
397     PRODUCTNAME="$with_product_name"
399 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
400     PRODUCTNAME="${PRODUCTNAME}Dev"
401     PRODUCTNAME=AC_PACKAGE_NAME
403 AC_MSG_RESULT([$PRODUCTNAME])
404 AC_SUBST(PRODUCTNAME)
405 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
406 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
408 dnl ===================================================================
409 dnl Our version is defined by the AC_INIT() at the top of this script.
410 dnl ===================================================================
412 AC_MSG_CHECKING([for package version])
413 if test -n "$with_package_version" -a "$with_package_version" != no; then
414     PACKAGE_VERSION="$with_package_version"
416 AC_MSG_RESULT([$PACKAGE_VERSION])
418 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
420 LIBO_VERSION_MAJOR=$1
421 LIBO_VERSION_MINOR=$2
422 LIBO_VERSION_MICRO=$3
423 LIBO_VERSION_PATCH=$4
425 LIBO_VERSION_SUFFIX=$5
427 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
428 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
429 # they get undoubled before actually passed to sed.
430 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
431 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
432 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
433 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
435 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
436 # three non-negative integers. Please find more information about CFBundleVersion at
437 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
439 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
440 # of at most three non-negative integers. Please find more information about
441 # CFBundleShortVersionString at
442 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
444 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
445 MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
447 AC_SUBST(LIBO_VERSION_MAJOR)
448 AC_SUBST(LIBO_VERSION_MINOR)
449 AC_SUBST(LIBO_VERSION_MICRO)
450 AC_SUBST(LIBO_VERSION_PATCH)
451 AC_SUBST(LIBO_VERSION_SUFFIX)
452 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
453 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
454 AC_SUBST(MACOSX_BUNDLE_VERSION)
456 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
457 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
458 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
459 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
461 LIBO_THIS_YEAR=`date +%Y`
462 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
464 dnl ===================================================================
465 dnl Product version
466 dnl ===================================================================
467 AC_MSG_CHECKING([for product version])
468 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
469 AC_MSG_RESULT([$PRODUCTVERSION])
470 AC_SUBST(PRODUCTVERSION)
472 AC_PROG_EGREP
473 # AC_PROG_EGREP doesn't set GREP on all systems as well
474 AC_PATH_PROG(GREP, grep)
476 BUILDDIR=`pwd`
477 cd $srcdir
478 SRC_ROOT=`pwd`
479 cd $BUILDDIR
480 x_Cygwin=[\#]
482 dnl ======================================
483 dnl Required GObject introspection version
484 dnl ======================================
485 INTROSPECTION_REQUIRED_VERSION=1.32.0
487 dnl ===================================================================
488 dnl Search all the common names for GNU Make
489 dnl ===================================================================
490 AC_MSG_CHECKING([for GNU Make])
492 # try to use our own make if it is available and GNUMAKE was not already defined
493 if test -z "$GNUMAKE"; then
494     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
495         GNUMAKE="$LODE_HOME/opt/bin/make"
496     elif test -x "/opt/lo/bin/make"; then
497         GNUMAKE="/opt/lo/bin/make"
498     fi
501 GNUMAKE_WIN_NATIVE=
502 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
503     if test -n "$a"; then
504         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
505         if test $? -eq 0;  then
506             if test "$build_os" = "cygwin"; then
507                 if test -n "$($a -v | grep 'Built for Windows')" ; then
508                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
509                     GNUMAKE_WIN_NATIVE="TRUE"
510                 else
511                     GNUMAKE=`which $a`
512                 fi
513             else
514                 GNUMAKE=`which $a`
515             fi
516             break
517         fi
518     fi
519 done
520 AC_MSG_RESULT($GNUMAKE)
521 if test -z "$GNUMAKE"; then
522     AC_MSG_ERROR([not found. install GNU Make.])
523 else
524     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
525         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
526     fi
529 win_short_path_for_make()
531     local short_path="$1"
532     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
533         cygpath -sm "$short_path"
534     else
535         cygpath -u "$(cygpath -d "$short_path")"
536     fi
540 if test "$build_os" = "cygwin"; then
541     PathFormat "$SRC_ROOT"
542     SRC_ROOT="$formatted_path"
543     PathFormat "$BUILDDIR"
544     BUILDDIR="$formatted_path"
545     x_Cygwin=
546     AC_MSG_CHECKING(for explicit COMSPEC)
547     if test -z "$COMSPEC"; then
548         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
549     else
550         AC_MSG_RESULT([found: $COMSPEC])
551     fi
554 AC_SUBST(SRC_ROOT)
555 AC_SUBST(BUILDDIR)
556 AC_SUBST(x_Cygwin)
557 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
558 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
559 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
561 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
562     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
565 # need sed in os checks...
566 AC_PATH_PROGS(SED, sed)
567 if test -z "$SED"; then
568     AC_MSG_ERROR([install sed to run this script])
571 # Set the ENABLE_LTO variable
572 # ===================================================================
573 AC_MSG_CHECKING([whether to use link-time optimization])
574 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
575     ENABLE_LTO="TRUE"
576     AC_MSG_RESULT([yes])
577 else
578     ENABLE_LTO=""
579     AC_MSG_RESULT([no])
581 AC_SUBST(ENABLE_LTO)
583 AC_ARG_ENABLE(fuzz-options,
584     AS_HELP_STRING([--enable-fuzz-options],
585         [Randomly enable or disable each of those configurable options
586          that are supposed to be freely selectable without interdependencies,
587          or where bad interaction from interdependencies is automatically avoided.])
590 dnl ===================================================================
591 dnl When building for Android, --with-android-ndk,
592 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
593 dnl mandatory
594 dnl ===================================================================
596 AC_ARG_WITH(android-ndk,
597     AS_HELP_STRING([--with-android-ndk],
598         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
601 AC_ARG_WITH(android-ndk-toolchain-version,
602     AS_HELP_STRING([--with-android-ndk-toolchain-version],
603         [Specify which toolchain version to use, of those present in the
604         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
605         with_android_ndk_toolchain_version=clang5.0)
607 AC_ARG_WITH(android-sdk,
608     AS_HELP_STRING([--with-android-sdk],
609         [Specify location of the Android SDK. Mandatory when building for Android.]),
612 AC_ARG_WITH(android-api-level,
613     AS_HELP_STRING([--with-android-api-level],
614         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
617 ANDROID_NDK_HOME=
618 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
619     with_android_ndk="$SRC_ROOT/external/android-ndk"
621 if test -n "$with_android_ndk"; then
622     eval ANDROID_NDK_HOME=$with_android_ndk
624     # Set up a lot of pre-canned defaults
626     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
627         if test ! -f $ANDROID_NDK_HOME/source.properties; then
628             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
629         fi
630         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
631     else
632         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
633     fi
634     if test -z "$ANDROID_NDK_VERSION";  then
635         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
636     fi
637     case $ANDROID_NDK_VERSION in
638     r9*|r10*)
639         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
640         ;;
641     11.1.*|12.1.*|13.1.*|14.1.*)
642         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
643         ;;
644     16.*|17.*|18.*|19.*|20.*)
645         ;;
646     *)
647         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
648         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
649         ;;
650     esac
652     ANDROID_API_LEVEL=16
653     if test -n "$with_android_api_level" ; then
654         ANDROID_API_LEVEL="$with_android_api_level"
655     fi
657     android_cpu=$host_cpu
658     if test $host_cpu = arm; then
659         android_platform_prefix=arm-linux-androideabi
660         android_gnu_prefix=$android_platform_prefix
661         LLVM_TRIPLE=armv7a-linux-androideabi
662         ANDROID_APP_ABI=armeabi-v7a
663         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
664     elif test $host_cpu = aarch64; then
665         android_platform_prefix=aarch64-linux-android
666         android_gnu_prefix=$android_platform_prefix
667         LLVM_TRIPLE=$android_platform_prefix
668         # minimum android version that supports aarch64
669         if test "$ANDROID_API_LEVEL" -lt "21" ; then
670             ANDROID_API_LEVEL=21
671         fi
672         ANDROID_APP_ABI=arm64-v8a
673     elif test $host_cpu = x86_64; then
674         android_platform_prefix=x86_64-linux-android
675         android_gnu_prefix=$android_platform_prefix
676         LLVM_TRIPLE=$android_platform_prefix
677         # minimum android version that supports x86_64
678         ANDROID_API_LEVEL=21
679         ANDROID_APP_ABI=x86_64
680     else
681         # host_cpu is something like "i386" or "i686" I guess, NDK uses
682         # "x86" in some contexts
683         android_cpu=x86
684         android_platform_prefix=$android_cpu
685         android_gnu_prefix=i686-linux-android
686         LLVM_TRIPLE=$android_gnu_prefix
687         ANDROID_APP_ABI=x86
688     fi
690     case "$with_android_ndk_toolchain_version" in
691     clang5.0)
692         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
693         ;;
694     *)
695         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
696     esac
698     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
700     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
701     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
702     # manage to link the (app-specific) single huge .so that is built for the app in
703     # android/source/ if there is debug information in a significant part of the object files.
704     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
705     # all objects have been built with debug information.)
706     case $build_os in
707     linux-gnu*)
708         android_HOST_TAG=linux-x86_64
709         ;;
710     darwin*)
711         android_HOST_TAG=darwin-x86_64
712         ;;
713     *)
714         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
715         # ndk would also support windows and windows-x86_64
716         ;;
717     esac
718     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
719     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
720     dnl TODO: NSS build uses it...
721     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
722     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
724     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
725     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
726     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
727     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
728     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
730     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
731     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
732     if test "$ENABLE_LTO" = TRUE; then
733         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
734         # $CC and $CXX when building external libraries
735         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
736     fi
738     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
740     if test -z "$CC"; then
741         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
742         CC_BASE="clang"
743     fi
744     if test -z "$CXX"; then
745         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
746         CXX_BASE="clang++"
747     fi
749     # remember to download the ownCloud Android library later
750     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
752 AC_SUBST(ANDROID_NDK_HOME)
753 AC_SUBST(ANDROID_APP_ABI)
754 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
756 dnl ===================================================================
757 dnl --with-android-sdk
758 dnl ===================================================================
759 ANDROID_SDK_HOME=
760 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
761     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
763 if test -n "$with_android_sdk"; then
764     eval ANDROID_SDK_HOME=$with_android_sdk
765     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
767 AC_SUBST(ANDROID_SDK_HOME)
769 AC_ARG_ENABLE([android-lok],
770     AS_HELP_STRING([--enable-android-lok],
771         [The Android app from the android/ subdir needs several tweaks all
772          over the place that break the LOK when used in the Online-based
773          Android app.  This switch indicates that the intent of this build is
774          actually the Online-based, non-modified LOK.])
776 ENABLE_ANDROID_LOK=
777 if test -n "$ANDROID_NDK_HOME" ; then
778     if test "$enable_android_lok" = yes; then
779         ENABLE_ANDROID_LOK=TRUE
780         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
781         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
782     else
783         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
784     fi
786 AC_SUBST([ENABLE_ANDROID_LOK])
788 libo_FUZZ_ARG_ENABLE([android-editing],
789     AS_HELP_STRING([--enable-android-editing],
790         [Enable the experimental editing feature on Android.])
792 ENABLE_ANDROID_EDITING=
793 if test "$enable_android_editing" = yes; then
794     ENABLE_ANDROID_EDITING=TRUE
796 AC_SUBST([ENABLE_ANDROID_EDITING])
798 dnl ===================================================================
799 dnl The following is a list of supported systems.
800 dnl Sequential to keep the logic very simple
801 dnl These values may be checked and reset later.
802 dnl ===================================================================
803 #defaults unless the os test overrides this:
804 test_randr=yes
805 test_xrender=yes
806 test_cups=yes
807 test_dbus=yes
808 test_fontconfig=yes
809 test_cairo=no
810 test_gdb_index=no
811 test_split_debug=no
813 # Default values, as such probably valid just for Linux, set
814 # differently below just for Mac OSX, but at least better than
815 # hardcoding these as we used to do. Much of this is duplicated also
816 # in solenv for old build system and for gbuild, ideally we should
817 # perhaps define stuff like this only here in configure.ac?
819 LINKFLAGSSHL="-shared"
820 PICSWITCH="-fpic"
821 DLLPOST=".so"
823 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
825 INSTROOTBASESUFFIX=
826 INSTROOTCONTENTSUFFIX=
827 SDKDIRNAME=sdk
829 HOST_PLATFORM="$host"
831 host_cpu_for_clang="$host_cpu"
833 case "$host_os" in
835 solaris*)
836     build_gstreamer_1_0=yes
837     test_freetype=yes
838     build_skia=yes
839     _os=SunOS
841     dnl ===========================================================
842     dnl Check whether we're using Solaris 10 - SPARC or Intel.
843     dnl ===========================================================
844     AC_MSG_CHECKING([the Solaris operating system release])
845     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
846     if test "$_os_release" -lt "10"; then
847         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
848     else
849         AC_MSG_RESULT([ok ($_os_release)])
850     fi
852     dnl Check whether we're using a SPARC or i386 processor
853     AC_MSG_CHECKING([the processor type])
854     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
855         AC_MSG_RESULT([ok ($host_cpu)])
856     else
857         AC_MSG_ERROR([only SPARC and i386 processors are supported])
858     fi
859     ;;
861 linux-gnu*|k*bsd*-gnu*)
862     build_gstreamer_1_0=yes
863     test_kf5=yes
864     test_gtk3_kde5=yes
865     build_skia=yes
866     test_gdb_index=yes
867     test_split_debug=yes
868     if test "$enable_fuzzers" != yes; then
869         test_freetype=yes
870         test_fontconfig=yes
871     else
872         test_freetype=no
873         test_fontconfig=no
874         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
875     fi
876     _os=Linux
877     ;;
879 gnu)
880     test_randr=no
881     test_xrender=no
882     _os=GNU
883      ;;
885 cygwin*|wsl*)
887     # When building on Windows normally with MSVC under Cygwin,
888     # configure thinks that the host platform (the platform the
889     # built code will run on) is Cygwin, even if it obviously is
890     # Windows, which in Autoconf terminology is called
891     # "mingw32". (Which is misleading as MinGW is the name of the
892     # tool-chain, not an operating system.)
894     # Somewhat confusing, yes. But this configure script doesn't
895     # look at $host etc that much, it mostly uses its own $_os
896     # variable, set here in this case statement.
898     test_cups=no
899     test_dbus=no
900     test_randr=no
901     test_xrender=no
902     test_freetype=no
903     test_fontconfig=no
904     build_skia=yes
905     _os=WINNT
907     DLLPOST=".dll"
908     LINKFLAGSNOUNDEFS=
910     if test "$host_cpu" = "aarch64"; then
911         enable_gpgmepp=no
912         enable_coinmp=no
913         enable_firebird_sdbc=no
914     fi
915     ;;
917 darwin*|macos*) # macOS
918     test_randr=no
919     test_xrender=no
920     test_freetype=no
921     test_fontconfig=no
922     test_dbus=no
923     if test -n "$LODE_HOME" ; then
924         mac_sanitize_path
925         AC_MSG_NOTICE([sanitized the PATH to $PATH])
926     fi
927     _os=Darwin
928     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
929     INSTROOTCONTENTSUFFIX=/Contents
930     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
931     # See comment above the case "$host_os"
932     LINKFLAGSSHL="-dynamiclib -single_module"
934     # -fPIC is default
935     PICSWITCH=""
937     DLLPOST=".dylib"
939     # -undefined error is the default
940     LINKFLAGSNOUNDEFS=""
941     case "$host_cpu" in
942     aarch64|arm64)
943         case "$host_os" in
944         macos*)
945             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
946             # the "macos" part so be sure to use aarch64-apple-darwin for now.
947             HOST_PLATFORM=aarch64-apple-darwin
948             ;;
949         esac
951         # Apple's Clang uses "arm64"
952         host_cpu_for_clang=arm64
953     esac
956 ios*) # iOS
957     test_randr=no
958     test_xrender=no
959     test_freetype=no
960     test_fontconfig=no
961     test_dbus=no
962     if test -n "$LODE_HOME" ; then
963         mac_sanitize_path
964         AC_MSG_NOTICE([sanitized the PATH to $PATH])
965     fi
966     enable_gpgmepp=no
967     _os=iOS
968     test_cups=no
969     enable_mpl_subset=yes
970     enable_lotuswordpro=no
971     enable_coinmp=no
972     enable_lpsolve=no
973     enable_mariadb_sdbc=no
974     enable_postgresql_sdbc=no
975     enable_extension_integration=no
976     enable_report_builder=no
977     with_ppds=no
978     if test "$enable_ios_simulator" = "yes"; then
979         host=x86_64-apple-darwin
980     fi
981     # See comment above the case "$host_os"
982     LINKFLAGSSHL="-dynamiclib -single_module"
984     # -fPIC is default
985     PICSWITCH=""
987     DLLPOST=".dylib"
989     # -undefined error is the default
990     LINKFLAGSNOUNDEFS=""
992     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
993     # part, so use aarch64-apple-darwin for now.
994     HOST_PLATFORM=aarch64-apple-darwin
996     # Apple's Clang uses "arm64"
997     host_cpu_for_clang=arm64
1000 freebsd*)
1001     build_gstreamer_1_0=yes
1002     test_kf5=yes
1003     test_gtk3_kde5=yes
1004     test_freetype=yes
1005     build_skia=yes
1006     AC_MSG_CHECKING([the FreeBSD operating system release])
1007     if test -n "$with_os_version"; then
1008         OSVERSION="$with_os_version"
1009     else
1010         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1011     fi
1012     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1013     AC_MSG_CHECKING([which thread library to use])
1014     if test "$OSVERSION" -lt "500016"; then
1015         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1016         PTHREAD_LIBS="-pthread"
1017     elif test "$OSVERSION" -lt "502102"; then
1018         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1019         PTHREAD_LIBS="-lc_r"
1020     else
1021         PTHREAD_CFLAGS=""
1022         PTHREAD_LIBS="-pthread"
1023     fi
1024     AC_MSG_RESULT([$PTHREAD_LIBS])
1025     _os=FreeBSD
1026     ;;
1028 *netbsd*)
1029     build_gstreamer_1_0=yes
1030     test_kf5=yes
1031     test_gtk3_kde5=yes
1032     test_freetype=yes
1033     build_skia=yes
1034     PTHREAD_LIBS="-pthread -lpthread"
1035     _os=NetBSD
1036     ;;
1038 aix*)
1039     test_randr=no
1040     test_freetype=yes
1041     PTHREAD_LIBS=-pthread
1042     _os=AIX
1043     ;;
1045 openbsd*)
1046     test_freetype=yes
1047     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1048     PTHREAD_LIBS="-pthread"
1049     _os=OpenBSD
1050     ;;
1052 dragonfly*)
1053     build_gstreamer_1_0=yes
1054     test_kf5=yes
1055     test_gtk3_kde5=yes
1056     test_freetype=yes
1057     build_skia=yes
1058     PTHREAD_LIBS="-pthread"
1059     _os=DragonFly
1060     ;;
1062 linux-android*)
1063     build_gstreamer_1_0=no
1064     enable_lotuswordpro=no
1065     enable_mpl_subset=yes
1066     enable_coinmp=yes
1067     enable_lpsolve=no
1068     enable_mariadb_sdbc=no
1069     enable_report_builder=no
1070     enable_odk=no
1071     enable_postgresql_sdbc=no
1072     enable_python=no
1073     test_cups=no
1074     test_dbus=no
1075     test_fontconfig=no
1076     test_freetype=no
1077     test_kf5=no
1078     test_qt5=no
1079     test_gtk3_kde5=no
1080     test_randr=no
1081     test_xrender=no
1082     _os=Android
1084     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1085     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
1086     ;;
1088 haiku*)
1089     test_cups=no
1090     test_dbus=no
1091     test_randr=no
1092     test_xrender=no
1093     test_freetype=yes
1094     enable_odk=no
1095     enable_gstreamer_1_0=no
1096     enable_vlc=no
1097     enable_coinmp=no
1098     enable_pdfium=no
1099     enable_sdremote=no
1100     enable_postgresql_sdbc=no
1101     enable_firebird_sdbc=no
1102     _os=Haiku
1103     ;;
1106     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1107     ;;
1108 esac
1110 AC_SUBST(HOST_PLATFORM)
1112 if test "$_os" = "Android" ; then
1113     # Verify that the NDK and SDK options are proper
1114     if test -z "$with_android_ndk"; then
1115         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1116     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1117         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1118     fi
1120     if test -z "$ANDROID_SDK_HOME"; then
1121         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1122     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1123         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1124     fi
1126     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1127     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1128         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1129                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1130                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1131         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1132         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1133         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1134     fi
1135     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1136         AC_MSG_WARN([android support repository not found - install with
1137                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1138                      to allow the build to download the specified version of the android support libraries])
1139         add_warning "android support repository not found - install with"
1140         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1141         add_warning "to allow the build to download the specified version of the android support libraries"
1142     fi
1145 if test "$_os" = "AIX"; then
1146     AC_PATH_PROG(GAWK, gawk)
1147     if test -z "$GAWK"; then
1148         AC_MSG_ERROR([gawk not found in \$PATH])
1149     fi
1152 AC_SUBST(SDKDIRNAME)
1154 AC_SUBST(PTHREAD_CFLAGS)
1155 AC_SUBST(PTHREAD_LIBS)
1157 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1158 # By default use the ones specified by our build system,
1159 # but explicit override is possible.
1160 AC_MSG_CHECKING(for explicit AFLAGS)
1161 if test -n "$AFLAGS"; then
1162     AC_MSG_RESULT([$AFLAGS])
1163     x_AFLAGS=
1164 else
1165     AC_MSG_RESULT(no)
1166     x_AFLAGS=[\#]
1168 AC_MSG_CHECKING(for explicit CFLAGS)
1169 if test -n "$CFLAGS"; then
1170     AC_MSG_RESULT([$CFLAGS])
1171     x_CFLAGS=
1172 else
1173     AC_MSG_RESULT(no)
1174     x_CFLAGS=[\#]
1176 AC_MSG_CHECKING(for explicit CXXFLAGS)
1177 if test -n "$CXXFLAGS"; then
1178     AC_MSG_RESULT([$CXXFLAGS])
1179     x_CXXFLAGS=
1180 else
1181     AC_MSG_RESULT(no)
1182     x_CXXFLAGS=[\#]
1184 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1185 if test -n "$OBJCFLAGS"; then
1186     AC_MSG_RESULT([$OBJCFLAGS])
1187     x_OBJCFLAGS=
1188 else
1189     AC_MSG_RESULT(no)
1190     x_OBJCFLAGS=[\#]
1192 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1193 if test -n "$OBJCXXFLAGS"; then
1194     AC_MSG_RESULT([$OBJCXXFLAGS])
1195     x_OBJCXXFLAGS=
1196 else
1197     AC_MSG_RESULT(no)
1198     x_OBJCXXFLAGS=[\#]
1200 AC_MSG_CHECKING(for explicit LDFLAGS)
1201 if test -n "$LDFLAGS"; then
1202     AC_MSG_RESULT([$LDFLAGS])
1203     x_LDFLAGS=
1204 else
1205     AC_MSG_RESULT(no)
1206     x_LDFLAGS=[\#]
1208 AC_SUBST(AFLAGS)
1209 AC_SUBST(CFLAGS)
1210 AC_SUBST(CXXFLAGS)
1211 AC_SUBST(OBJCFLAGS)
1212 AC_SUBST(OBJCXXFLAGS)
1213 AC_SUBST(LDFLAGS)
1214 AC_SUBST(x_AFLAGS)
1215 AC_SUBST(x_CFLAGS)
1216 AC_SUBST(x_CXXFLAGS)
1217 AC_SUBST(x_OBJCFLAGS)
1218 AC_SUBST(x_OBJCXXFLAGS)
1219 AC_SUBST(x_LDFLAGS)
1221 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1222 my_original_CFLAGS=$CFLAGS
1223 my_original_CXXFLAGS=$CXXFLAGS
1224 my_original_CPPFLAGS=$CPPFLAGS
1226 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1227 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1228 dnl AC_PROG_CC internally.
1229 if test "$_os" != "WINNT"; then
1230     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1231     save_CFLAGS=$CFLAGS
1232     AC_PROG_CC
1233     CFLAGS=$save_CFLAGS
1234     if test -z "$CC_BASE"; then
1235         CC_BASE=`first_arg_basename "$CC"`
1236     fi
1239 if test "$_os" != "WINNT"; then
1240     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1241 else
1242     ENDIANNESS=little
1244 AC_SUBST(ENDIANNESS)
1246 if test $_os != "WINNT"; then
1247     save_LIBS="$LIBS"
1248     AC_SEARCH_LIBS([dlsym], [dl],
1249         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1250         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1251     LIBS="$save_LIBS"
1253 AC_SUBST(DLOPEN_LIBS)
1255 AC_ARG_ENABLE(ios-simulator,
1256     AS_HELP_STRING([--enable-ios-simulator],
1257         [build for iOS simulator])
1260 AC_ARG_ENABLE(ios-libreofficelight-app,
1261     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1262         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1263          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1264          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1267 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1268 if test "$enable_ios_libreofficelight_app" = yes; then
1269     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1271 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1273 ###############################################################################
1274 # Extensions switches --enable/--disable
1275 ###############################################################################
1276 # By default these should be enabled unless having extra dependencies.
1277 # If there is extra dependency over configure options then the enable should
1278 # be automagic based on whether the requiring feature is enabled or not.
1279 # All this options change anything only with --enable-extension-integration.
1281 # The name of this option and its help string makes it sound as if
1282 # extensions are built anyway, just not integrated in the installer,
1283 # if you use --disable-extension-integration. Is that really the
1284 # case?
1286 libo_FUZZ_ARG_ENABLE(extension-integration,
1287     AS_HELP_STRING([--disable-extension-integration],
1288         [Disable integration of the built extensions in the installer of the
1289          product. Use this switch to disable the integration.])
1292 AC_ARG_ENABLE(avmedia,
1293     AS_HELP_STRING([--disable-avmedia],
1294         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1297 AC_ARG_ENABLE(database-connectivity,
1298     AS_HELP_STRING([--disable-database-connectivity],
1299         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1302 # This doesn't mean not building (or "integrating") extensions
1303 # (although it probably should; i.e. it should imply
1304 # --disable-extension-integration I guess), it means not supporting
1305 # any extension mechanism at all
1306 libo_FUZZ_ARG_ENABLE(extensions,
1307     AS_HELP_STRING([--disable-extensions],
1308         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1311 AC_ARG_ENABLE(scripting,
1312     AS_HELP_STRING([--disable-scripting],
1313         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1316 # This is mainly for Android and iOS, but could potentially be used in some
1317 # special case otherwise, too, so factored out as a separate setting
1319 AC_ARG_ENABLE(dynamic-loading,
1320     AS_HELP_STRING([--disable-dynamic-loading],
1321         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1324 libo_FUZZ_ARG_ENABLE(report-builder,
1325     AS_HELP_STRING([--disable-report-builder],
1326         [Disable the Report Builder.])
1329 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1330     AS_HELP_STRING([--enable-ext-wiki-publisher],
1331         [Enable the Wiki Publisher extension.])
1334 libo_FUZZ_ARG_ENABLE(lpsolve,
1335     AS_HELP_STRING([--disable-lpsolve],
1336         [Disable compilation of the lp solve solver ])
1338 libo_FUZZ_ARG_ENABLE(coinmp,
1339     AS_HELP_STRING([--disable-coinmp],
1340         [Disable compilation of the CoinMP solver ])
1343 libo_FUZZ_ARG_ENABLE(pdfimport,
1344     AS_HELP_STRING([--disable-pdfimport],
1345         [Disable building the PDF import feature.])
1348 libo_FUZZ_ARG_ENABLE(pdfium,
1349     AS_HELP_STRING([--disable-pdfium],
1350         [Disable building PDFium. Results in unsecure PDF signature verification.])
1353 libo_FUZZ_ARG_ENABLE(skia,
1354     AS_HELP_STRING([--disable-skia],
1355         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1358 ###############################################################################
1360 dnl ---------- *** ----------
1362 libo_FUZZ_ARG_ENABLE(mergelibs,
1363     AS_HELP_STRING([--enable-mergelibs],
1364         [Merge several of the smaller libraries into one big, "merged", one.])
1367 libo_FUZZ_ARG_ENABLE(breakpad,
1368     AS_HELP_STRING([--enable-breakpad],
1369         [Enables breakpad for crash reporting.])
1372 libo_FUZZ_ARG_ENABLE(crashdump,
1373     AS_HELP_STRING([--disable-crashdump],
1374         [Disable dump.ini and dump-file, when --enable-breakpad])
1377 AC_ARG_ENABLE(fetch-external,
1378     AS_HELP_STRING([--disable-fetch-external],
1379         [Disables fetching external tarballs from web sources.])
1382 AC_ARG_ENABLE(fuzzers,
1383     AS_HELP_STRING([--enable-fuzzers],
1384         [Enables building libfuzzer targets for fuzz testing.])
1387 libo_FUZZ_ARG_ENABLE(pch,
1388     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1389         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1390          Using 'system' will include only external headers, 'base' will add also headers
1391          from base modules, 'normal' will also add all headers except from the module built,
1392          'full' will use all suitable headers even from a module itself.])
1395 libo_FUZZ_ARG_ENABLE(epm,
1396     AS_HELP_STRING([--enable-epm],
1397         [LibreOffice includes self-packaging code, that requires epm, however epm is
1398          useless for large scale package building.])
1401 libo_FUZZ_ARG_ENABLE(odk,
1402     AS_HELP_STRING([--disable-odk],
1403         [LibreOffice includes an ODK, office development kit which some packagers may
1404          wish to build without.])
1407 AC_ARG_ENABLE(mpl-subset,
1408     AS_HELP_STRING([--enable-mpl-subset],
1409         [Don't compile any pieces which are not MPL or more liberally licensed])
1412 libo_FUZZ_ARG_ENABLE(evolution2,
1413     AS_HELP_STRING([--enable-evolution2],
1414         [Allows the built-in evolution 2 addressbook connectivity build to be
1415          enabled.])
1418 AC_ARG_ENABLE(avahi,
1419     AS_HELP_STRING([--enable-avahi],
1420         [Determines whether to use Avahi to advertise Impress to remote controls.])
1423 libo_FUZZ_ARG_ENABLE(werror,
1424     AS_HELP_STRING([--enable-werror],
1425         [Turn warnings to errors. (Has no effect in modules where the treating
1426          of warnings as errors is disabled explicitly.)]),
1429 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1430     AS_HELP_STRING([--enable-assert-always-abort],
1431         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1434 libo_FUZZ_ARG_ENABLE(dbgutil,
1435     AS_HELP_STRING([--enable-dbgutil],
1436         [Provide debugging support from --enable-debug and include additional debugging
1437          utilities such as object counting or more expensive checks.
1438          This is the recommended option for developers.
1439          Note that this makes the build ABI incompatible, it is not possible to mix object
1440          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1442 libo_FUZZ_ARG_ENABLE(debug,
1443     AS_HELP_STRING([--enable-debug],
1444         [Include debugging information, disable compiler optimization and inlining plus
1445          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1447 libo_FUZZ_ARG_ENABLE(split-debug,
1448     AS_HELP_STRING([--disable-split-debug],
1449         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1450          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1452 libo_FUZZ_ARG_ENABLE(gdb-index,
1453     AS_HELP_STRING([--disable-gdb-index],
1454         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1455          The feature requires the gold or lld linker.]))
1457 libo_FUZZ_ARG_ENABLE(sal-log,
1458     AS_HELP_STRING([--enable-sal-log],
1459         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1461 libo_FUZZ_ARG_ENABLE(symbols,
1462     AS_HELP_STRING([--enable-symbols],
1463         [Generate debug information.
1464          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1465          otherwise. It is possible to explicitly specify gbuild build targets
1466          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1467          everything in the directory; there is no ordering, more specific overrides
1468          more general, and disabling takes precedence).
1469          Example: --enable-symbols="all -sw/ -Library_sc".]))
1471 libo_FUZZ_ARG_ENABLE(optimized,
1472     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1473         [Whether to compile with optimization flags.
1474          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1475          otherwise. Using 'debug' will try to use only optimizations that should
1476          not interfere with debugging.]))
1478 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1479     AS_HELP_STRING([--disable-runtime-optimizations],
1480         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1481          JVM JIT) that are known to interact badly with certain dynamic analysis
1482          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1483          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1484          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1486 AC_ARG_WITH(valgrind,
1487     AS_HELP_STRING([--with-valgrind],
1488         [Make availability of Valgrind headers a hard requirement.]))
1490 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1491     AS_HELP_STRING([--enable-compiler-plugins],
1492         [Enable compiler plugins that will perform additional checks during
1493          building. Enabled automatically by --enable-dbgutil.
1494          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1495 COMPILER_PLUGINS_DEBUG=
1496 if test "$enable_compiler_plugins" = debug; then
1497     enable_compiler_plugins=yes
1498     COMPILER_PLUGINS_DEBUG=TRUE
1501 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1502     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1503         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1504          relevant in the --disable-compiler-plugins case.]))
1506 libo_FUZZ_ARG_ENABLE(ooenv,
1507     AS_HELP_STRING([--disable-ooenv],
1508         [Disable ooenv for the instdir installation.]))
1510 AC_ARG_ENABLE(lto,
1511     AS_HELP_STRING([--enable-lto],
1512         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1513          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1514          linker. For MSVC, this option is broken at the moment. This is experimental work
1515          in progress that shouldn't be used unless you are working on it.)]))
1517 AC_ARG_ENABLE(python,
1518     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1519         [Enables or disables Python support at run-time.
1520          Also specifies what Python to use at build-time.
1521          'fully-internal' even forces the internal version for uses of Python
1522          during the build.
1523          On macOS the only choices are
1524          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1525          ]))
1527 libo_FUZZ_ARG_ENABLE(gtk3,
1528     AS_HELP_STRING([--disable-gtk3],
1529         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1530 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1532 AC_ARG_ENABLE(introspection,
1533     AS_HELP_STRING([--enable-introspection],
1534         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1535          Linux distributions.)]))
1537 AC_ARG_ENABLE(split-app-modules,
1538     AS_HELP_STRING([--enable-split-app-modules],
1539         [Split file lists for app modules, e.g. base, calc.
1540          Has effect only with make distro-pack-install]),
1543 AC_ARG_ENABLE(split-opt-features,
1544     AS_HELP_STRING([--enable-split-opt-features],
1545         [Split file lists for some optional features, e.g. pyuno, testtool.
1546          Has effect only with make distro-pack-install]),
1549 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1550     AS_HELP_STRING([--disable-cairo-canvas],
1551         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1554 libo_FUZZ_ARG_ENABLE(dbus,
1555     AS_HELP_STRING([--disable-dbus],
1556         [Determines whether to enable features that depend on dbus.
1557          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1558 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1560 libo_FUZZ_ARG_ENABLE(sdremote,
1561     AS_HELP_STRING([--disable-sdremote],
1562         [Determines whether to enable Impress remote control (i.e. the server component).]),
1563 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1565 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1566     AS_HELP_STRING([--disable-sdremote-bluetooth],
1567         [Determines whether to build sdremote with bluetooth support.
1568          Requires dbus on Linux.]))
1570 libo_FUZZ_ARG_ENABLE(gio,
1571     AS_HELP_STRING([--disable-gio],
1572         [Determines whether to use the GIO support.]),
1573 ,test "${enable_gio+set}" = set || enable_gio=yes)
1575 AC_ARG_ENABLE(qt5,
1576     AS_HELP_STRING([--enable-qt5],
1577         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1578          available.]),
1581 AC_ARG_ENABLE(kf5,
1582     AS_HELP_STRING([--enable-kf5],
1583         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1584          KF5 are available.]),
1587 AC_ARG_ENABLE(kde5,
1588     AS_HELP_STRING([--enable-kde5],
1589         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1592 AC_ARG_ENABLE(gtk3_kde5,
1593     AS_HELP_STRING([--enable-gtk3-kde5],
1594         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1595          platforms where Gtk3, Qt5 and Plasma is available.]),
1598 AC_ARG_ENABLE(gui,
1599     AS_HELP_STRING([--disable-gui],
1600         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1601 ,enable_gui=yes)
1603 libo_FUZZ_ARG_ENABLE(randr,
1604     AS_HELP_STRING([--disable-randr],
1605         [Disable RandR support in the vcl project.]),
1606 ,test "${enable_randr+set}" = set || enable_randr=yes)
1608 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1609     AS_HELP_STRING([--disable-gstreamer-1-0],
1610         [Disable building with the gstreamer 1.0 avmedia backend.]),
1611 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1613 libo_FUZZ_ARG_ENABLE(vlc,
1614     AS_HELP_STRING([--enable-vlc],
1615         [Enable building with the (experimental) VLC avmedia backend.]),
1616 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1618 libo_FUZZ_ARG_ENABLE(neon,
1619     AS_HELP_STRING([--disable-neon],
1620         [Disable neon and the compilation of webdav binding.]),
1623 libo_FUZZ_ARG_ENABLE([eot],
1624     [AS_HELP_STRING([--enable-eot],
1625         [Enable support for Embedded OpenType fonts.])],
1626 ,test "${enable_eot+set}" = set || enable_eot=no)
1628 libo_FUZZ_ARG_ENABLE(cve-tests,
1629     AS_HELP_STRING([--disable-cve-tests],
1630         [Prevent CVE tests to be executed]),
1633 libo_FUZZ_ARG_ENABLE(chart-tests,
1634     AS_HELP_STRING([--enable-chart-tests],
1635         [Executes chart XShape tests. In a perfect world these tests would be
1636          stable and everyone could run them, in reality it is best to run them
1637          only on a few machines that are known to work and maintained by people
1638          who can judge if a test failure is a regression or not.]),
1641 AC_ARG_ENABLE(build-unowinreg,
1642     AS_HELP_STRING([--enable-build-unowinreg],
1643         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1644          compiler is needed on Linux.]),
1647 AC_ARG_ENABLE(build-opensymbol,
1648     AS_HELP_STRING([--enable-build-opensymbol],
1649         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1650          fontforge installed.]),
1653 AC_ARG_ENABLE(dependency-tracking,
1654     AS_HELP_STRING([--enable-dependency-tracking],
1655         [Do not reject slow dependency extractors.])[
1656   --disable-dependency-tracking
1657                           Disables generation of dependency information.
1658                           Speed up one-time builds.],
1661 AC_ARG_ENABLE(icecream,
1662     AS_HELP_STRING([--enable-icecream],
1663         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1664          It defaults to /opt/icecream for the location of the icecream gcc/g++
1665          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1668 AC_ARG_ENABLE(ld,
1669     AS_HELP_STRING([--enable-ld=<linker>],
1670         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1671          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1672          If <linker> contains any ':', the part before the first ':' is used as the value of
1673          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1674          needed for Clang 12).]),
1677 libo_FUZZ_ARG_ENABLE(cups,
1678     AS_HELP_STRING([--disable-cups],
1679         [Do not build cups support.])
1682 AC_ARG_ENABLE(ccache,
1683     AS_HELP_STRING([--disable-ccache],
1684         [Do not try to use ccache automatically.
1685          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1686          CC/CXX are not yet set, and --enable-icecream is not given, we
1687          attempt to use ccache. --disable-ccache disables ccache completely.
1688          Additionally ccache's depend mode is enabled if possible,
1689          use --enable-ccache=nodepend to enable ccache without depend mode.
1693 libo_FUZZ_ARG_ENABLE(online-update,
1694     AS_HELP_STRING([--enable-online-update],
1695         [Enable the online update service that will check for new versions of
1696          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1697          If the value is "mar", the experimental Mozilla-like update will be
1698          enabled instead of the traditional update mechanism.]),
1701 AC_ARG_WITH(update-config,
1702     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1703                    [Path to the update config ini file]))
1705 libo_FUZZ_ARG_ENABLE(extension-update,
1706     AS_HELP_STRING([--disable-extension-update],
1707         [Disable possibility to update installed extensions.]),
1710 libo_FUZZ_ARG_ENABLE(release-build,
1711     AS_HELP_STRING([--enable-release-build],
1712         [Enable release build. Note that the "release build" choice is orthogonal to
1713          whether symbols are present, debug info is generated, or optimization
1714          is done.
1715          See http://wiki.documentfoundation.org/Development/DevBuild]),
1718 AC_ARG_ENABLE(windows-build-signing,
1719     AS_HELP_STRING([--enable-windows-build-signing],
1720         [Enable signing of windows binaries (*.exe, *.dll)]),
1723 AC_ARG_ENABLE(silent-msi,
1724     AS_HELP_STRING([--enable-silent-msi],
1725         [Enable MSI with LIMITUI=1 (silent install).]),
1728 AC_ARG_ENABLE(macosx-code-signing,
1729     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1730         [Sign executables, dylibs, frameworks and the app bundle. If you
1731          don't provide an identity the first suitable certificate
1732          in your keychain is used.]),
1735 AC_ARG_ENABLE(macosx-package-signing,
1736     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1737         [Create a .pkg suitable for uploading to the Mac App Store and sign
1738          it. If you don't provide an identity the first suitable certificate
1739          in your keychain is used.]),
1742 AC_ARG_ENABLE(macosx-sandbox,
1743     AS_HELP_STRING([--enable-macosx-sandbox],
1744         [Make the app bundle run in a sandbox. Requires code signing.
1745          Is required by apps distributed in the Mac App Store, and implies
1746          adherence to App Store rules.]),
1749 AC_ARG_WITH(macosx-bundle-identifier,
1750     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1751         [Define the macOS bundle identifier. Default is the somewhat weird
1752          org.libreoffice.script ("script", huh?).]),
1753 ,with_macosx_bundle_identifier=org.libreoffice.script)
1755 AC_ARG_WITH(product-name,
1756     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1757         [Define the product name. Default is AC_PACKAGE_NAME.]),
1758 ,with_product_name=$PRODUCTNAME)
1760 libo_FUZZ_ARG_ENABLE(community-flavor,
1761     AS_HELP_STRING([--disable-community-flavor],
1762         [Disable the Community branding.]),
1765 AC_ARG_WITH(package-version,
1766     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1767         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1770 libo_FUZZ_ARG_ENABLE(readonly-installset,
1771     AS_HELP_STRING([--enable-readonly-installset],
1772         [Prevents any attempts by LibreOffice to write into its installation. That means
1773          at least that no "system-wide" extensions can be added. Partly experimental work in
1774          progress, probably not fully implemented. Always enabled for macOS.]),
1777 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1778     AS_HELP_STRING([--disable-mariadb-sdbc],
1779         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1782 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1783     AS_HELP_STRING([--disable-postgresql-sdbc],
1784         [Disable the build of the PostgreSQL-SDBC driver.])
1787 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1788     AS_HELP_STRING([--disable-lotuswordpro],
1789         [Disable the build of the Lotus Word Pro filter.]),
1790 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1792 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1793     AS_HELP_STRING([--disable-firebird-sdbc],
1794         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1795 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1797 AC_ARG_ENABLE(bogus-pkg-config,
1798     AS_HELP_STRING([--enable-bogus-pkg-config],
1799         [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.]),
1802 AC_ARG_ENABLE(openssl,
1803     AS_HELP_STRING([--disable-openssl],
1804         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1805          components will either use GNUTLS or NSS. Work in progress,
1806          use only if you are hacking on it.]),
1807 ,enable_openssl=yes)
1809 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1810     AS_HELP_STRING([--enable-cipher-openssl-backend],
1811         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1812          Requires --enable-openssl.]))
1814 AC_ARG_ENABLE(library-bin-tar,
1815     AS_HELP_STRING([--enable-library-bin-tar],
1816         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1817         Some libraries can save their build result in a tarball
1818         stored in TARFILE_LOCATION. That binary tarball is
1819         uniquely identified by the source tarball,
1820         the content of the config_host.mk file and the content
1821         of the top-level directory in core for that library
1822         If this option is enabled, then if such a tarfile exist, it will be untarred
1823         instead of the source tarfile, and the build step will be skipped for that
1824         library.
1825         If a proper tarfile does not exist, then the normal source-based
1826         build is done for that library and a proper binary tarfile is created
1827         for the next time.]),
1830 AC_ARG_ENABLE(dconf,
1831     AS_HELP_STRING([--disable-dconf],
1832         [Disable the dconf configuration backend (enabled by default where
1833          available).]))
1835 libo_FUZZ_ARG_ENABLE(formula-logger,
1836     AS_HELP_STRING(
1837         [--enable-formula-logger],
1838         [Enable formula logger for logging formula calculation flow in Calc.]
1839     )
1842 AC_ARG_ENABLE(ldap,
1843     AS_HELP_STRING([--disable-ldap],
1844         [Disable LDAP support.]),
1845 ,enable_ldap=yes)
1847 AC_ARG_ENABLE(opencl,
1848     AS_HELP_STRING([--disable-opencl],
1849         [Disable OpenCL support.]),
1850 ,enable_opencl=yes)
1852 dnl ===================================================================
1853 dnl Optional Packages (--with/without-)
1854 dnl ===================================================================
1856 AC_ARG_WITH(gcc-home,
1857     AS_HELP_STRING([--with-gcc-home],
1858         [Specify the location of gcc/g++ manually. This can be used in conjunction
1859          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1860          non-default path.]),
1863 AC_ARG_WITH(gnu-patch,
1864     AS_HELP_STRING([--with-gnu-patch],
1865         [Specify location of GNU patch on Solaris or FreeBSD.]),
1868 AC_ARG_WITH(build-platform-configure-options,
1869     AS_HELP_STRING([--with-build-platform-configure-options],
1870         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1873 AC_ARG_WITH(gnu-cp,
1874     AS_HELP_STRING([--with-gnu-cp],
1875         [Specify location of GNU cp on Solaris or FreeBSD.]),
1878 AC_ARG_WITH(external-tar,
1879     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1880         [Specify an absolute path of where to find (and store) tarfiles.]),
1881     TARFILE_LOCATION=$withval ,
1884 AC_ARG_WITH(referenced-git,
1885     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1886         [Specify another checkout directory to reference. This makes use of
1887                  git submodule update --reference, and saves a lot of diskspace
1888                  when having multiple trees side-by-side.]),
1889     GIT_REFERENCE_SRC=$withval ,
1892 AC_ARG_WITH(linked-git,
1893     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1894         [Specify a directory where the repositories of submodules are located.
1895          This uses a method similar to git-new-workdir to get submodules.]),
1896     GIT_LINK_SRC=$withval ,
1899 AC_ARG_WITH(galleries,
1900     AS_HELP_STRING([--with-galleries],
1901         [Specify how galleries should be built. It is possible either to
1902          build these internally from source ("build"),
1903          or to disable them ("no")]),
1906 AC_ARG_WITH(theme,
1907     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1908         [Choose which themes to include. By default those themes with an '*' are included.
1909          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1910          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1913 libo_FUZZ_ARG_WITH(helppack-integration,
1914     AS_HELP_STRING([--without-helppack-integration],
1915         [It will not integrate the helppacks to the installer
1916          of the product. Please use this switch to use the online help
1917          or separate help packages.]),
1920 libo_FUZZ_ARG_WITH(fonts,
1921     AS_HELP_STRING([--without-fonts],
1922         [LibreOffice includes some third-party fonts to provide a reliable basis for
1923          help content, templates, samples, etc. When these fonts are already
1924          known to be available on the system then you should use this option.]),
1927 AC_ARG_ENABLE(noto-font,
1928     AS_HELP_STRING([--enable-noto-font],
1929         [Add more Google Noto fonts.]),
1932 AC_ARG_WITH(epm,
1933     AS_HELP_STRING([--with-epm],
1934         [Decides which epm to use. Default is to use the one from the system if
1935          one is built. When either this is not there or you say =internal epm
1936          will be built.]),
1939 AC_ARG_WITH(package-format,
1940     AS_HELP_STRING([--with-package-format],
1941         [Specify package format(s) for LibreOffice installation sets. The
1942          implicit --without-package-format leads to no installation sets being
1943          generated. Possible values: aix, archive, bsd, deb, dmg,
1944          installed, msi, pkg, and rpm.
1945          Example: --with-package-format='deb rpm']),
1948 AC_ARG_WITH(tls,
1949     AS_HELP_STRING([--with-tls],
1950         [Decides which TLS/SSL and cryptographic implementations to use for
1951          LibreOffice's code. Notice that this doesn't apply for depending
1952          libraries like "neon", for example. Default is to use NSS
1953          although OpenSSL is also possible. Notice that selecting NSS restricts
1954          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1955          restrict by now the usage of NSS in LO's code. Possible values:
1956          openssl, nss. Example: --with-tls="nss"]),
1959 AC_ARG_WITH(system-libs,
1960     AS_HELP_STRING([--with-system-libs],
1961         [Use libraries already on system -- enables all --with-system-* flags.]),
1964 AC_ARG_WITH(system-bzip2,
1965     AS_HELP_STRING([--with-system-bzip2],
1966         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1967     [with_system_bzip2="$with_system_libs"])
1969 AC_ARG_WITH(system-headers,
1970     AS_HELP_STRING([--with-system-headers],
1971         [Use headers already on system -- enables all --with-system-* flags for
1972          external packages whose headers are the only entities used i.e.
1973          boost/odbc/sane-header(s).]),,
1974     [with_system_headers="$with_system_libs"])
1976 AC_ARG_WITH(system-jars,
1977     AS_HELP_STRING([--without-system-jars],
1978         [When building with --with-system-libs, also the needed jars are expected
1979          on the system. Use this to disable that]),,
1980     [with_system_jars="$with_system_libs"])
1982 AC_ARG_WITH(system-cairo,
1983     AS_HELP_STRING([--with-system-cairo],
1984         [Use cairo libraries already on system.  Happens automatically for
1985          (implicit) --enable-gtk3.]))
1987 AC_ARG_WITH(system-epoxy,
1988     AS_HELP_STRING([--with-system-epoxy],
1989         [Use epoxy libraries already on system.  Happens automatically for
1990          (implicit) --enable-gtk3.]),,
1991        [with_system_epoxy="$with_system_libs"])
1993 AC_ARG_WITH(myspell-dicts,
1994     AS_HELP_STRING([--with-myspell-dicts],
1995         [Adds myspell dictionaries to the LibreOffice installation set]),
1998 AC_ARG_WITH(system-dicts,
1999     AS_HELP_STRING([--without-system-dicts],
2000         [Do not use dictionaries from system paths.]),
2003 AC_ARG_WITH(external-dict-dir,
2004     AS_HELP_STRING([--with-external-dict-dir],
2005         [Specify external dictionary dir.]),
2008 AC_ARG_WITH(external-hyph-dir,
2009     AS_HELP_STRING([--with-external-hyph-dir],
2010         [Specify external hyphenation pattern dir.]),
2013 AC_ARG_WITH(external-thes-dir,
2014     AS_HELP_STRING([--with-external-thes-dir],
2015         [Specify external thesaurus dir.]),
2018 AC_ARG_WITH(system-zlib,
2019     AS_HELP_STRING([--with-system-zlib],
2020         [Use zlib already on system.]),,
2021     [with_system_zlib=auto])
2023 AC_ARG_WITH(system-jpeg,
2024     AS_HELP_STRING([--with-system-jpeg],
2025         [Use jpeg already on system.]),,
2026     [with_system_jpeg="$with_system_libs"])
2028 AC_ARG_WITH(system-clucene,
2029     AS_HELP_STRING([--with-system-clucene],
2030         [Use clucene already on system.]),,
2031     [with_system_clucene="$with_system_libs"])
2033 AC_ARG_WITH(system-expat,
2034     AS_HELP_STRING([--with-system-expat],
2035         [Use expat already on system.]),,
2036     [with_system_expat="$with_system_libs"])
2038 AC_ARG_WITH(system-libxml,
2039     AS_HELP_STRING([--with-system-libxml],
2040         [Use libxml/libxslt already on system.]),,
2041     [with_system_libxml=auto])
2043 AC_ARG_WITH(system-icu,
2044     AS_HELP_STRING([--with-system-icu],
2045         [Use icu already on system.]),,
2046     [with_system_icu="$with_system_libs"])
2048 AC_ARG_WITH(system-ucpp,
2049     AS_HELP_STRING([--with-system-ucpp],
2050         [Use ucpp already on system.]),,
2051     [])
2053 AC_ARG_WITH(system-openldap,
2054     AS_HELP_STRING([--with-system-openldap],
2055         [Use the OpenLDAP LDAP SDK already on system.]),,
2056     [with_system_openldap="$with_system_libs"])
2058 libo_FUZZ_ARG_ENABLE(poppler,
2059     AS_HELP_STRING([--disable-poppler],
2060         [Disable building Poppler.])
2063 AC_ARG_WITH(system-poppler,
2064     AS_HELP_STRING([--with-system-poppler],
2065         [Use system poppler (only needed for PDF import).]),,
2066     [with_system_poppler="$with_system_libs"])
2068 libo_FUZZ_ARG_ENABLE(gpgmepp,
2069     AS_HELP_STRING([--disable-gpgmepp],
2070         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2073 AC_ARG_WITH(system-gpgmepp,
2074     AS_HELP_STRING([--with-system-gpgmepp],
2075         [Use gpgmepp already on system]),,
2076     [with_system_gpgmepp="$with_system_libs"])
2078 AC_ARG_WITH(system-apache-commons,
2079     AS_HELP_STRING([--with-system-apache-commons],
2080         [Use Apache commons libraries already on system.]),,
2081     [with_system_apache_commons="$with_system_jars"])
2083 AC_ARG_WITH(system-mariadb,
2084     AS_HELP_STRING([--with-system-mariadb],
2085         [Use MariaDB/MySQL libraries already on system.]),,
2086     [with_system_mariadb="$with_system_libs"])
2088 AC_ARG_ENABLE(bundle-mariadb,
2089     AS_HELP_STRING([--enable-bundle-mariadb],
2090         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2093 AC_ARG_WITH(system-postgresql,
2094     AS_HELP_STRING([--with-system-postgresql],
2095         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2096          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2097     [with_system_postgresql="$with_system_libs"])
2099 AC_ARG_WITH(libpq-path,
2100     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2101         [Use this PostgreSQL C interface (libpq) installation for building
2102          the PostgreSQL-SDBC extension.]),
2105 AC_ARG_WITH(system-firebird,
2106     AS_HELP_STRING([--with-system-firebird],
2107         [Use Firebird libraries already on system, for building the Firebird-SDBC
2108          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2109     [with_system_firebird="$with_system_libs"])
2111 AC_ARG_WITH(system-libtommath,
2112             AS_HELP_STRING([--with-system-libtommath],
2113                            [Use libtommath already on system]),,
2114             [with_system_libtommath="$with_system_libs"])
2116 AC_ARG_WITH(system-hsqldb,
2117     AS_HELP_STRING([--with-system-hsqldb],
2118         [Use hsqldb already on system.]))
2120 AC_ARG_WITH(hsqldb-jar,
2121     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2122         [Specify path to jarfile manually.]),
2123     HSQLDB_JAR=$withval)
2125 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2126     AS_HELP_STRING([--disable-scripting-beanshell],
2127         [Disable support for scripts in BeanShell.]),
2131 AC_ARG_WITH(system-beanshell,
2132     AS_HELP_STRING([--with-system-beanshell],
2133         [Use beanshell already on system.]),,
2134     [with_system_beanshell="$with_system_jars"])
2136 AC_ARG_WITH(beanshell-jar,
2137     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2138         [Specify path to jarfile manually.]),
2139     BSH_JAR=$withval)
2141 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2142     AS_HELP_STRING([--disable-scripting-javascript],
2143         [Disable support for scripts in JavaScript.]),
2147 AC_ARG_WITH(system-rhino,
2148     AS_HELP_STRING([--with-system-rhino],
2149         [Use rhino already on system.]),,)
2150 #    [with_system_rhino="$with_system_jars"])
2151 # Above is not used as we have different debug interface
2152 # patched into internal rhino. This code needs to be fixed
2153 # before we can enable it by default.
2155 AC_ARG_WITH(rhino-jar,
2156     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2157         [Specify path to jarfile manually.]),
2158     RHINO_JAR=$withval)
2160 AC_ARG_WITH(commons-logging-jar,
2161     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
2162         [Specify path to jarfile manually.]),
2163     COMMONS_LOGGING_JAR=$withval)
2165 AC_ARG_WITH(system-jfreereport,
2166     AS_HELP_STRING([--with-system-jfreereport],
2167         [Use JFreeReport already on system.]),,
2168     [with_system_jfreereport="$with_system_jars"])
2170 AC_ARG_WITH(sac-jar,
2171     AS_HELP_STRING([--with-sac-jar=JARFILE],
2172         [Specify path to jarfile manually.]),
2173     SAC_JAR=$withval)
2175 AC_ARG_WITH(libxml-jar,
2176     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2177         [Specify path to jarfile manually.]),
2178     LIBXML_JAR=$withval)
2180 AC_ARG_WITH(flute-jar,
2181     AS_HELP_STRING([--with-flute-jar=JARFILE],
2182         [Specify path to jarfile manually.]),
2183     FLUTE_JAR=$withval)
2185 AC_ARG_WITH(jfreereport-jar,
2186     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2187         [Specify path to jarfile manually.]),
2188     JFREEREPORT_JAR=$withval)
2190 AC_ARG_WITH(liblayout-jar,
2191     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2192         [Specify path to jarfile manually.]),
2193     LIBLAYOUT_JAR=$withval)
2195 AC_ARG_WITH(libloader-jar,
2196     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2197         [Specify path to jarfile manually.]),
2198     LIBLOADER_JAR=$withval)
2200 AC_ARG_WITH(libformula-jar,
2201     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2202         [Specify path to jarfile manually.]),
2203     LIBFORMULA_JAR=$withval)
2205 AC_ARG_WITH(librepository-jar,
2206     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2207         [Specify path to jarfile manually.]),
2208     LIBREPOSITORY_JAR=$withval)
2210 AC_ARG_WITH(libfonts-jar,
2211     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2212         [Specify path to jarfile manually.]),
2213     LIBFONTS_JAR=$withval)
2215 AC_ARG_WITH(libserializer-jar,
2216     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2217         [Specify path to jarfile manually.]),
2218     LIBSERIALIZER_JAR=$withval)
2220 AC_ARG_WITH(libbase-jar,
2221     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2222         [Specify path to jarfile manually.]),
2223     LIBBASE_JAR=$withval)
2225 AC_ARG_WITH(system-odbc,
2226     AS_HELP_STRING([--with-system-odbc],
2227         [Use the odbc headers already on system.]),,
2228     [with_system_odbc="auto"])
2230 AC_ARG_WITH(system-sane,
2231     AS_HELP_STRING([--with-system-sane],
2232         [Use sane.h already on system.]),,
2233     [with_system_sane="$with_system_headers"])
2235 AC_ARG_WITH(system-bluez,
2236     AS_HELP_STRING([--with-system-bluez],
2237         [Use bluetooth.h already on system.]),,
2238     [with_system_bluez="$with_system_headers"])
2240 AC_ARG_WITH(system-curl,
2241     AS_HELP_STRING([--with-system-curl],
2242         [Use curl already on system.]),,
2243     [with_system_curl=auto])
2245 AC_ARG_WITH(system-boost,
2246     AS_HELP_STRING([--with-system-boost],
2247         [Use boost already on system.]),,
2248     [with_system_boost="$with_system_headers"])
2250 AC_ARG_WITH(system-glm,
2251     AS_HELP_STRING([--with-system-glm],
2252         [Use glm already on system.]),,
2253     [with_system_glm="$with_system_headers"])
2255 AC_ARG_WITH(system-hunspell,
2256     AS_HELP_STRING([--with-system-hunspell],
2257         [Use libhunspell already on system.]),,
2258     [with_system_hunspell="$with_system_libs"])
2260 libo_FUZZ_ARG_ENABLE(qrcodegen,
2261     AS_HELP_STRING([--disable-qrcodegen],
2262         [Disable use of qrcodegen external library.]))
2264 AC_ARG_WITH(system-qrcodegen,
2265     AS_HELP_STRING([--with-system-qrcodegen],
2266         [Use libqrcodegen already on system.]),,
2267     [with_system_qrcodegen="$with_system_libs"])
2269 AC_ARG_WITH(system-box2d,
2270     AS_HELP_STRING([--with-system-box2d],
2271         [Use box2d already on system.]),,
2272     [with_system_box2d="$with_system_libs"])
2274 AC_ARG_WITH(system-mythes,
2275     AS_HELP_STRING([--with-system-mythes],
2276         [Use mythes already on system.]),,
2277     [with_system_mythes="$with_system_libs"])
2279 AC_ARG_WITH(system-altlinuxhyph,
2280     AS_HELP_STRING([--with-system-altlinuxhyph],
2281         [Use ALTLinuxhyph already on system.]),,
2282     [with_system_altlinuxhyph="$with_system_libs"])
2284 AC_ARG_WITH(system-lpsolve,
2285     AS_HELP_STRING([--with-system-lpsolve],
2286         [Use lpsolve already on system.]),,
2287     [with_system_lpsolve="$with_system_libs"])
2289 AC_ARG_WITH(system-coinmp,
2290     AS_HELP_STRING([--with-system-coinmp],
2291         [Use CoinMP already on system.]),,
2292     [with_system_coinmp="$with_system_libs"])
2294 AC_ARG_WITH(system-liblangtag,
2295     AS_HELP_STRING([--with-system-liblangtag],
2296         [Use liblangtag library already on system.]),,
2297     [with_system_liblangtag="$with_system_libs"])
2299 AC_ARG_WITH(webdav,
2300     AS_HELP_STRING([--with-webdav],
2301         [Specify which library to use for webdav implementation.
2302          Possible values: "neon", "serf", "no". The default value is "neon".
2303          Example: --with-webdav="serf"]),
2304     WITH_WEBDAV=$withval,
2305     WITH_WEBDAV="neon")
2307 AC_ARG_WITH(linker-hash-style,
2308     AS_HELP_STRING([--with-linker-hash-style],
2309         [Use linker with --hash-style=<style> when linking shared objects.
2310          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2311          if supported on the build system, and "sysv" otherwise.]))
2313 AC_ARG_WITH(jdk-home,
2314     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2315         [If you have installed JDK 9 or later on your system please supply the
2316          path here. Note that this is not the location of the java command but the
2317          location of the entire distribution. In case of cross-compiling, this
2318          is the JDK of the host os. Use --with-build-platform-configure-options
2319          to point to a different build platform JDK.]),
2322 AC_ARG_WITH(help,
2323     AS_HELP_STRING([--with-help],
2324         [Enable the build of help. There is a special parameter "common" that
2325          can be used to bundle only the common part, .e.g help-specific icons.
2326          This is useful when you build the helpcontent separately.])
2327     [
2328                           Usage:     --with-help    build the old local help
2329                                  --without-help     no local help (default)
2330                                  --with-help=html   build the new HTML local help
2331                                  --with-help=online build the new HTML online help
2332     ],
2335 AC_ARG_WITH(omindex,
2336    AS_HELP_STRING([--with-omindex],
2337         [Enable the support of xapian-omega index for online help.])
2338    [
2339                          Usage: --with-omindex=server prepare the pages for omindex
2340                                 but let xapian-omega be built in server.
2341                                 --with-omindex=noxap do not prepare online pages
2342                                 for xapian-omega
2343   ],
2346 libo_FUZZ_ARG_WITH(java,
2347     AS_HELP_STRING([--with-java=<java command>],
2348         [Specify the name of the Java interpreter command. Typically "java"
2349          which is the default.
2351          To build without support for Java components, applets, accessibility
2352          or the XML filters written in Java, use --without-java or --with-java=no.]),
2353     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2354     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2357 AC_ARG_WITH(jvm-path,
2358     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2359         [Use a specific JVM search path at runtime.
2360          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2363 AC_ARG_WITH(ant-home,
2364     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2365         [If you have installed Apache Ant on your system, please supply the path here.
2366          Note that this is not the location of the Ant binary but the location
2367          of the entire distribution.]),
2370 AC_ARG_WITH(symbol-config,
2371     AS_HELP_STRING([--with-symbol-config],
2372         [Configuration for the crashreport symbol upload]),
2373         [],
2374         [with_symbol_config=no])
2376 AC_ARG_WITH(export-validation,
2377     AS_HELP_STRING([--without-export-validation],
2378         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2379 ,with_export_validation=auto)
2381 AC_ARG_WITH(bffvalidator,
2382     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2383         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2384          Requires installed Microsoft Office Binary File Format Validator.
2385          Note: export-validation (--with-export-validation) is required to be turned on.
2386          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2387 ,with_bffvalidator=no)
2389 libo_FUZZ_ARG_WITH(junit,
2390     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2391         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2392          --without-junit disables those tests. Not relevant in the --without-java case.]),
2393 ,with_junit=yes)
2395 AC_ARG_WITH(hamcrest,
2396     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2397         [Specifies the hamcrest jar file to use for JUnit-based tests.
2398          --without-junit disables those tests. Not relevant in the --without-java case.]),
2399 ,with_hamcrest=yes)
2401 AC_ARG_WITH(perl-home,
2402     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2403         [If you have installed Perl 5 Distribution, on your system, please
2404          supply the path here. Note that this is not the location of the Perl
2405          binary but the location of the entire distribution.]),
2408 libo_FUZZ_ARG_WITH(doxygen,
2409     AS_HELP_STRING(
2410         [--with-doxygen=<absolute path to doxygen executable>],
2411         [Specifies the doxygen executable to use when generating ODK C/C++
2412          documentation. --without-doxygen disables generation of ODK C/C++
2413          documentation. Not relevant in the --disable-odk case.]),
2414 ,with_doxygen=yes)
2416 AC_ARG_WITH(visual-studio,
2417     AS_HELP_STRING([--with-visual-studio=<2019>],
2418         [Specify which Visual Studio version to use in case several are
2419          installed. Currently only 2019 (default) is supported.]),
2422 AC_ARG_WITH(windows-sdk,
2423     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2424         [Specify which Windows SDK, or "Windows Kit", version to use
2425          in case the one that came with the selected Visual Studio
2426          is not what you want for some reason. Note that not all compiler/SDK
2427          combinations are supported. The intent is that this option should not
2428          be needed.]),
2431 AC_ARG_WITH(lang,
2432     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2433         [Use this option to build LibreOffice with additional UI language support.
2434          English (US) is always included by default.
2435          Separate multiple languages with space.
2436          For all languages, use --with-lang=ALL.]),
2439 AC_ARG_WITH(locales,
2440     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2441         [Use this option to limit the locale information built in.
2442          Separate multiple locales with space.
2443          Very experimental and might well break stuff.
2444          Just a desperate measure to shrink code and data size.
2445          By default all the locales available is included.
2446          This option is completely unrelated to --with-lang.])
2447     [
2448                           Affects also our character encoding conversion
2449                           tables for encodings mainly targeted for a
2450                           particular locale, like EUC-CN and EUC-TW for
2451                           zh, ISO-2022-JP for ja.
2453                           Affects also our add-on break iterator data for
2454                           some languages.
2456                           For the default, all locales, don't use this switch at all.
2457                           Specifying just the language part of a locale means all matching
2458                           locales will be included.
2459     ],
2462 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2463 libo_FUZZ_ARG_WITH(krb5,
2464     AS_HELP_STRING([--with-krb5],
2465         [Enable MIT Kerberos 5 support in modules that support it.
2466          By default automatically enabled on platforms
2467          where a good system Kerberos 5 is available.]),
2470 libo_FUZZ_ARG_WITH(gssapi,
2471     AS_HELP_STRING([--with-gssapi],
2472         [Enable GSSAPI support in modules that support it.
2473          By default automatically enabled on platforms
2474          where a good system GSSAPI is available.]),
2477 AC_ARG_WITH(iwyu,
2478     AS_HELP_STRING([--with-iwyu],
2479         [Use given IWYU binary path to check unneeded includes instead of building.
2480          Use only if you are hacking on it.]),
2483 libo_FUZZ_ARG_WITH(lxml,
2484     AS_HELP_STRING([--without-lxml],
2485         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2486          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2487          report widget classes and ids.]),
2490 libo_FUZZ_ARG_WITH(latest-c++,
2491     AS_HELP_STRING([--with-latest-c++],
2492         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2493          published standard.]),,
2494         [with_latest_c__=no])
2496 dnl ===================================================================
2497 dnl Branding
2498 dnl ===================================================================
2500 AC_ARG_WITH(branding,
2501     AS_HELP_STRING([--with-branding=/path/to/images],
2502         [Use given path to retrieve branding images set.])
2503     [
2504                           Search for intro.png about.svg and logo.svg.
2505                           If any is missing, default ones will be used instead.
2507                           Search also progress.conf for progress
2508                           settings on intro screen :
2510                           PROGRESSBARCOLOR="255,255,255" Set color of
2511                           progress bar. Comma separated RGB decimal values.
2512                           PROGRESSSIZE="407,6" Set size of progress bar.
2513                           Comma separated decimal values (width, height).
2514                           PROGRESSPOSITION="61,317" Set position of progress
2515                           bar from left,top. Comma separated decimal values.
2516                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2517                           bar frame. Comma separated RGB decimal values.
2518                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2519                           bar text. Comma separated RGB decimal values.
2520                           PROGRESSTEXTBASELINE="287" Set vertical position of
2521                           progress bar text from top. Decimal value.
2523                           Default values will be used if not found.
2524     ],
2528 AC_ARG_WITH(extra-buildid,
2529     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2530         [Show addition build identification in about dialog.]),
2534 AC_ARG_WITH(vendor,
2535     AS_HELP_STRING([--with-vendor="John the Builder"],
2536         [Set vendor of the build.]),
2539 AC_ARG_WITH(android-package-name,
2540     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2541         [Set Android package name of the build.]),
2544 AC_ARG_WITH(compat-oowrappers,
2545     AS_HELP_STRING([--with-compat-oowrappers],
2546         [Install oo* wrappers in parallel with
2547          lo* ones to keep backward compatibility.
2548          Has effect only with make distro-pack-install]),
2551 AC_ARG_WITH(os-version,
2552     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2553         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2556 AC_ARG_WITH(mingw-cross-compiler,
2557     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2558         [Specify the MinGW cross-compiler to use.
2559          When building on the ODK on Unix and building unowinreg.dll,
2560          specify the MinGW C++ cross-compiler.]),
2563 AC_ARG_WITH(idlc-cpp,
2564     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2565         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2568 AC_ARG_WITH(parallelism,
2569     AS_HELP_STRING([--with-parallelism],
2570         [Number of jobs to run simultaneously during build. Parallel builds can
2571         save a lot of time on multi-cpu machines. Defaults to the number of
2572         CPUs on the machine, unless you configure --enable-icecream - then to
2573         40.]),
2576 AC_ARG_WITH(all-tarballs,
2577     AS_HELP_STRING([--with-all-tarballs],
2578         [Download all external tarballs unconditionally]))
2580 AC_ARG_WITH(gdrive-client-id,
2581     AS_HELP_STRING([--with-gdrive-client-id],
2582         [Provides the client id of the application for OAuth2 authentication
2583         on Google Drive. If either this or --with-gdrive-client-secret is
2584         empty, the feature will be disabled]),
2587 AC_ARG_WITH(gdrive-client-secret,
2588     AS_HELP_STRING([--with-gdrive-client-secret],
2589         [Provides the client secret of the application for OAuth2
2590         authentication on Google Drive. If either this or
2591         --with-gdrive-client-id is empty, the feature will be disabled]),
2594 AC_ARG_WITH(alfresco-cloud-client-id,
2595     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2596         [Provides the client id of the application for OAuth2 authentication
2597         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2598         empty, the feature will be disabled]),
2601 AC_ARG_WITH(alfresco-cloud-client-secret,
2602     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2603         [Provides the client secret of the application for OAuth2
2604         authentication on Alfresco Cloud. If either this or
2605         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2608 AC_ARG_WITH(onedrive-client-id,
2609     AS_HELP_STRING([--with-onedrive-client-id],
2610         [Provides the client id of the application for OAuth2 authentication
2611         on OneDrive. If either this or --with-onedrive-client-secret is
2612         empty, the feature will be disabled]),
2615 AC_ARG_WITH(onedrive-client-secret,
2616     AS_HELP_STRING([--with-onedrive-client-secret],
2617         [Provides the client secret of the application for OAuth2
2618         authentication on OneDrive. If either this or
2619         --with-onedrive-client-id is empty, the feature will be disabled]),
2621 dnl ===================================================================
2622 dnl Do we want to use pre-build binary tarball for recompile
2623 dnl ===================================================================
2625 if test "$enable_library_bin_tar" = "yes" ; then
2626     USE_LIBRARY_BIN_TAR=TRUE
2627 else
2628     USE_LIBRARY_BIN_TAR=
2630 AC_SUBST(USE_LIBRARY_BIN_TAR)
2632 dnl ===================================================================
2633 dnl Test whether build target is Release Build
2634 dnl ===================================================================
2635 AC_MSG_CHECKING([whether build target is Release Build])
2636 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2637     AC_MSG_RESULT([no])
2638     ENABLE_RELEASE_BUILD=
2639     GET_TASK_ALLOW_ENTITLEMENT='
2640         <!-- We want to be able to debug a hardened process when not building for release -->
2641         <key>com.apple.security.get-task-allow</key>
2642         <true/>'
2643 else
2644     AC_MSG_RESULT([yes])
2645     ENABLE_RELEASE_BUILD=TRUE
2646     GET_TASK_ALLOW_ENTITLEMENT=''
2648 AC_SUBST(ENABLE_RELEASE_BUILD)
2649 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2651 AC_MSG_CHECKING([whether to build a Community flavor])
2652 if test -z "$enable_community_flavor" -o "$enable_community_flavor" == "yes"; then
2653     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2654     AC_MSG_RESULT([yes])
2655 else
2656     AC_MSG_RESULT([no])
2659 dnl ===================================================================
2660 dnl Test whether to sign Windows Build
2661 dnl ===================================================================
2662 AC_MSG_CHECKING([whether to sign windows build])
2663 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2664     AC_MSG_RESULT([yes])
2665     WINDOWS_BUILD_SIGNING="TRUE"
2666 else
2667     AC_MSG_RESULT([no])
2668     WINDOWS_BUILD_SIGNING="FALSE"
2670 AC_SUBST(WINDOWS_BUILD_SIGNING)
2672 dnl ===================================================================
2673 dnl MacOSX build and runtime environment options
2674 dnl ===================================================================
2676 AC_ARG_WITH(macosx-sdk,
2677     AS_HELP_STRING([--with-macosx-sdk=<version>],
2678         [Prefer a specific SDK for building.])
2679     [
2680                           If the requested SDK is not available, a search for the oldest one will be done.
2681                           With current Xcode versions, only the latest SDK is included, so this option is
2682                           not terribly useful. It works fine to build with a new SDK and run the result
2683                           on an older OS.
2685                           e. g.: --with-macosx-sdk=10.10
2687                           there are 3 options to control the MacOSX build:
2688                           --with-macosx-sdk (referred as 'sdk' below)
2689                           --with-macosx-version-min-required (referred as 'min' below)
2690                           --with-macosx-version-max-allowed (referred as 'max' below)
2692                           the connection between these value and the default they take is as follow:
2693                           ( ? means not specified on the command line, s means the SDK version found,
2694                           constraint: 8 <= x <= y <= z)
2696                           ==========================================
2697                            command line      || config result
2698                           ==========================================
2699                           min  | max  | sdk  || min   | max  | sdk  |
2700                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2701                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2702                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2703                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2704                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2705                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2706                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2707                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2710                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2711                           for a detailed technical explanation of these variables
2713                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2714     ],
2717 AC_ARG_WITH(macosx-version-min-required,
2718     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2719         [set the minimum OS version needed to run the built LibreOffice])
2720     [
2721                           e. g.: --with-macosx-version-min-required=10.10
2722                           see --with-macosx-sdk for more info
2723     ],
2726 AC_ARG_WITH(macosx-version-max-allowed,
2727     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2728         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2729     [
2730                           e. g.: --with-macosx-version-max-allowed=10.10
2731                           see --with-macosx-sdk for more info
2732     ],
2736 dnl ===================================================================
2737 dnl options for stuff used during cross-compilation build
2738 dnl Not quite superseded by --with-build-platform-configure-options.
2739 dnl TODO: check, if the "force" option is still needed anywhere.
2740 dnl ===================================================================
2742 AC_ARG_WITH(system-icu-for-build,
2743     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2744         [Use icu already on system for build tools (cross-compilation only).]))
2747 dnl ===================================================================
2748 dnl Check for incompatible options set by fuzzing, and reset those
2749 dnl automatically to working combinations
2750 dnl ===================================================================
2752 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2753         "$enable_dbus" != "$enable_avahi"; then
2754     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2755     enable_avahi=$enable_dbus
2758 add_lopath_after ()
2760     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2761         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2762     fi
2765 add_lopath_before ()
2767     local IFS=${P_SEP}
2768     local path_cleanup
2769     local dir
2770     for dir in $LO_PATH ; do
2771         if test "$dir" != "$1" ; then
2772             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2773         fi
2774     done
2775     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2778 dnl ===================================================================
2779 dnl check for required programs (grep, awk, sed, bash)
2780 dnl ===================================================================
2782 pathmunge ()
2784     local new_path
2785     if test -n "$1"; then
2786         if test "$build_os" = "cygwin"; then
2787             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2788                 PathFormat "$1"
2789                 new_path=`cygpath -sm "$formatted_path"`
2790             else
2791                 PathFormat "$1"
2792                 new_path=`cygpath -u "$formatted_path"`
2793             fi
2794         else
2795             new_path="$1"
2796         fi
2797         if test "$2" = "after"; then
2798             add_lopath_after "$new_path"
2799         else
2800             add_lopath_before "$new_path"
2801         fi
2802     fi
2805 AC_PROG_AWK
2806 AC_PATH_PROG( AWK, $AWK)
2807 if test -z "$AWK"; then
2808     AC_MSG_ERROR([install awk to run this script])
2811 AC_PATH_PROG(BASH, bash)
2812 if test -z "$BASH"; then
2813     AC_MSG_ERROR([bash not found in \$PATH])
2815 AC_SUBST(BASH)
2817 # prefer parallel comression tools, if available
2818 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2819 if test -z "$COMPRESSIONTOOL"; then
2820     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2821     if test -z "$COMPRESSIONTOOL"; then
2822         AC_MSG_ERROR([gzip not found in \$PATH])
2823     fi
2825 AC_SUBST(COMPRESSIONTOOL)
2827 # use GNU parallel for packaging, if available
2828 AC_PATH_PROG(GNUPARALLEL, parallel)
2829 AC_SUBST(GNUPARALLEL)
2831 AC_MSG_CHECKING([for GNU or BSD tar])
2832 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2833     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2834     if test $? -eq 0;  then
2835         GNUTAR=$a
2836         break
2837     fi
2838 done
2839 AC_MSG_RESULT($GNUTAR)
2840 if test -z "$GNUTAR"; then
2841     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2843 AC_SUBST(GNUTAR)
2845 AC_MSG_CHECKING([for tar's option to strip components])
2846 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2847 if test $? -eq 0; then
2848     STRIP_COMPONENTS="--strip-components"
2849 else
2850     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2851     if test $? -eq 0; then
2852         STRIP_COMPONENTS="--strip-path"
2853     else
2854         STRIP_COMPONENTS="unsupported"
2855     fi
2857 AC_MSG_RESULT($STRIP_COMPONENTS)
2858 if test x$STRIP_COMPONENTS = xunsupported; then
2859     AC_MSG_ERROR([you need a tar that is able to strip components.])
2861 AC_SUBST(STRIP_COMPONENTS)
2863 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2864 dnl desktop OSes from "mobile" ones.
2866 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2867 dnl In other words, that when building for an OS that is not a
2868 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2870 dnl Note the direction of the implication; there is no assumption that
2871 dnl cross-compiling would imply a non-desktop OS.
2873 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2874     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2875     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2876     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2879 # Whether to build "avmedia" functionality or not.
2881 if test -z "$enable_avmedia"; then
2882     enable_avmedia=yes
2885 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2886 if test "$enable_avmedia" = yes; then
2887     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2888 else
2889     USE_AVMEDIA_DUMMY='TRUE'
2891 AC_SUBST(USE_AVMEDIA_DUMMY)
2893 # Decide whether to build database connectivity stuff (including
2894 # Base) or not. We probably don't want to on non-desktop OSes.
2895 if test -z "$enable_database_connectivity"; then
2896     # --disable-database-connectivity is unfinished work in progress
2897     # and the iOS test app doesn't link if we actually try to use it.
2898     # if test $_os != iOS -a $_os != Android; then
2899     if test $_os != iOS; then
2900         enable_database_connectivity=yes
2901     fi
2904 if test "$enable_database_connectivity" = yes; then
2905     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2906     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2909 if test -z "$enable_extensions"; then
2910     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2911     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2912         enable_extensions=yes
2913     fi
2916 if test "$enable_extensions" = yes; then
2917     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2918     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2921 if test -z "$enable_scripting"; then
2922     enable_scripting=yes
2925 DISABLE_SCRIPTING=''
2926 if test "$enable_scripting" = yes; then
2927     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2928     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2929 else
2930     DISABLE_SCRIPTING='TRUE'
2931     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2934 if test $_os = iOS -o $_os = Android; then
2935     # Disable dynamic_loading always for iOS and Android
2936     enable_dynamic_loading=no
2937 elif test -z "$enable_dynamic_loading"; then
2938     # Otherwise enable it unless specifically disabled
2939     enable_dynamic_loading=yes
2942 DISABLE_DYNLOADING=''
2943 if test "$enable_dynamic_loading" = yes; then
2944     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2945 else
2946     DISABLE_DYNLOADING='TRUE'
2948 AC_SUBST(DISABLE_DYNLOADING)
2950 # remember SYSBASE value
2951 AC_SUBST(SYSBASE)
2953 dnl ===================================================================
2954 dnl  Sort out various gallery compilation options
2955 dnl ===================================================================
2956 AC_MSG_CHECKING([how to build and package galleries])
2957 if test -n "${with_galleries}"; then
2958     if test "$with_galleries" = "build"; then
2959         WITH_GALLERY_BUILD=TRUE
2960         AC_MSG_RESULT([build from source images internally])
2961     elif test "$with_galleries" = "no"; then
2962         WITH_GALLERY_BUILD=
2963         AC_MSG_RESULT([disable non-internal gallery build])
2964     else
2965         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2966     fi
2967 else
2968     if test $_os != iOS -a $_os != Android; then
2969         WITH_GALLERY_BUILD=TRUE
2970         AC_MSG_RESULT([internal src images for desktop])
2971     else
2972         WITH_GALLERY_BUILD=
2973         AC_MSG_RESULT([disable src image build])
2974     fi
2976 AC_SUBST(WITH_GALLERY_BUILD)
2978 dnl ===================================================================
2979 dnl  Checks if ccache is available
2980 dnl ===================================================================
2981 CCACHE_DEPEND_MODE=
2982 if test "$_os" = "WINNT"; then
2983     # on windows/VC build do not use ccache
2984     CCACHE=""
2985 elif test "$enable_ccache" = "no"; then
2986     CCACHE=""
2987 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2988     case "%$CC%$CXX%" in
2989     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2990     # assume that's good then
2991     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2992         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2993         CCACHE_DEPEND_MODE=1
2994         ;;
2995     *)
2996         AC_PATH_PROG([CCACHE],[ccache],[not found])
2997         if test "$CCACHE" = "not found"; then
2998             CCACHE=""
2999         else
3000             CCACHE_DEPEND_MODE=1
3001             # Need to check for ccache version: otherwise prevents
3002             # caching of the results (like "-x objective-c++" for Mac)
3003             if test $_os = Darwin -o $_os = iOS; then
3004                 # Check ccache version
3005                 AC_MSG_CHECKING([whether version of ccache is suitable])
3006                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3007                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3008                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3009                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3010                 else
3011                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3012                     CCACHE=""
3013                     CCACHE_DEPEND_MODE=
3014                 fi
3015             fi
3016         fi
3017         ;;
3018     esac
3019 else
3020     CCACHE=""
3022 if test "$enable_ccache" = "nodepend"; then
3023     CCACHE_DEPEND_MODE=""
3025 AC_SUBST(CCACHE_DEPEND_MODE)
3027 if test "$CCACHE" != ""; then
3028     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3029     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3030     if test "$ccache_size" = ""; then
3031         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3032         if test "$ccache_size" = ""; then
3033             ccache_size=0
3034         fi
3035         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3036         if test $ccache_size -lt 1024; then
3037             CCACHE=""
3038             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3039             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3040         else
3041             # warn that ccache may be too small for debug build
3042             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3043             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3044         fi
3045     else
3046         if test $ccache_size -lt 5; then
3047             #warn that ccache may be too small for debug build
3048             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3049             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3050         fi
3051     fi
3054 dnl ===================================================================
3055 dnl  Checks for C compiler,
3056 dnl  The check for the C++ compiler is later on.
3057 dnl ===================================================================
3058 if test "$_os" != "WINNT"; then
3059     GCC_HOME_SET="true"
3060     AC_MSG_CHECKING([gcc home])
3061     if test -z "$with_gcc_home"; then
3062         if test "$enable_icecream" = "yes"; then
3063             if test -d "/usr/lib/icecc/bin"; then
3064                 GCC_HOME="/usr/lib/icecc/"
3065             elif test -d "/usr/libexec/icecc/bin"; then
3066                 GCC_HOME="/usr/libexec/icecc/"
3067             elif test -d "/opt/icecream/bin"; then
3068                 GCC_HOME="/opt/icecream/"
3069             else
3070                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3072             fi
3073         else
3074             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3075             GCC_HOME_SET="false"
3076         fi
3077     else
3078         GCC_HOME="$with_gcc_home"
3079     fi
3080     AC_MSG_RESULT($GCC_HOME)
3081     AC_SUBST(GCC_HOME)
3083     if test "$GCC_HOME_SET" = "true"; then
3084         if test -z "$CC"; then
3085             CC="$GCC_HOME/bin/gcc"
3086             CC_BASE="gcc"
3087         fi
3088         if test -z "$CXX"; then
3089             CXX="$GCC_HOME/bin/g++"
3090             CXX_BASE="g++"
3091         fi
3092     fi
3095 COMPATH=`dirname "$CC"`
3096 if test "$COMPATH" = "."; then
3097     AC_PATH_PROGS(COMPATH, $CC)
3098     dnl double square bracket to get single because of M4 quote...
3099     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3101 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3103 dnl ===================================================================
3104 dnl Java support
3105 dnl ===================================================================
3106 AC_MSG_CHECKING([whether to build with Java support])
3107 if test "$with_java" != "no"; then
3108     if test "$DISABLE_SCRIPTING" = TRUE; then
3109         AC_MSG_RESULT([no, overridden by --disable-scripting])
3110         ENABLE_JAVA=""
3111         with_java=no
3112     else
3113         AC_MSG_RESULT([yes])
3114         ENABLE_JAVA="TRUE"
3115         AC_DEFINE(HAVE_FEATURE_JAVA)
3116     fi
3117 else
3118     AC_MSG_RESULT([no])
3119     ENABLE_JAVA=""
3122 AC_SUBST(ENABLE_JAVA)
3124 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3126 dnl ENABLE_JAVA="" indicate no Java support at all
3128 dnl ===================================================================
3129 dnl Check macOS SDK and compiler
3130 dnl ===================================================================
3132 if test $_os = Darwin; then
3134     # If no --with-macosx-sdk option is given, look for one
3136     # The intent is that for "most" Mac-based developers, a suitable
3137     # SDK will be found automatically without any configure options.
3139     # For developers with a current Xcode, the lowest-numbered SDK
3140     # higher than or equal to the minimum required should be found.
3142     AC_MSG_CHECKING([what macOS SDK to use])
3143     for _macosx_sdk in ${with_macosx_sdk-12.3 12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13}; do
3144         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3145         if test -d "$MACOSX_SDK_PATH"; then
3146             with_macosx_sdk="${_macosx_sdk}"
3147             break
3148         else
3149             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3150             if test -d "$MACOSX_SDK_PATH"; then
3151                 with_macosx_sdk="${_macosx_sdk}"
3152                 break
3153             fi
3154         fi
3155     done
3156     if test ! -d "$MACOSX_SDK_PATH"; then
3157         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3158     fi
3160     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3162     case $with_macosx_sdk in
3163     10.13)
3164         MACOSX_SDK_VERSION=101300
3165         ;;
3166     10.14)
3167         MACOSX_SDK_VERSION=101400
3168         ;;
3169     10.15)
3170         MACOSX_SDK_VERSION=101500
3171         ;;
3172     11.0)
3173         MACOSX_SDK_VERSION=110000
3174         ;;
3175     11.1)
3176         MACOSX_SDK_VERSION=110100
3177         ;;
3178     11.3)
3179         MACOSX_SDK_VERSION=110300
3180         ;;
3181     12.0)
3182         MACOSX_SDK_VERSION=120000
3183         ;;
3184     12.1)
3185         MACOSX_SDK_VERSION=120100
3186         ;;
3187     12.3)
3188         MACOSX_SDK_VERSION=120300
3189         ;;
3190     *)
3191         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--12.3])
3192         ;;
3193     esac
3195     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3196         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3197     fi
3199     if test "$with_macosx_version_min_required" = "" ; then
3200         if test "$host_cpu" = x86_64; then
3201             with_macosx_version_min_required="10.10";
3202         else
3203             with_macosx_version_min_required="11.0";
3204         fi
3205     fi
3207     if test "$with_macosx_version_max_allowed" = "" ; then
3208         with_macosx_version_max_allowed="$with_macosx_sdk"
3209     fi
3211     # export this so that "xcrun" invocations later return matching values
3212     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3213     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3214     export DEVELOPER_DIR
3215     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3216     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3218     AC_MSG_CHECKING([whether Xcode is new enough])
3219     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3220     my_xcode_ver2=${my_xcode_ver1#Xcode }
3221     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3222     if test "$my_xcode_ver3" -ge 1103; then
3223         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3224     else
3225         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3226     fi
3228     case "$with_macosx_version_min_required" in
3229     10.10)
3230         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3231         ;;
3232     10.11)
3233         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3234         ;;
3235     10.12)
3236         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3237         ;;
3238     10.13)
3239         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3240         ;;
3241     10.14)
3242         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3243         ;;
3244     10.15)
3245         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3246         ;;
3247     10.16)
3248         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3249         ;;
3250     11.0)
3251         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3252         ;;
3253     11.1)
3254         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3255         ;;
3256     11.3)
3257         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3258         ;;
3259     12.0)
3260         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3261         ;;
3262     12.1)
3263         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
3264         ;;
3265     12.3)
3266         MAC_OS_X_VERSION_MIN_REQUIRED="120300"
3267         ;;
3268     *)
3269         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.3])
3270         ;;
3271     esac
3273     LIBTOOL=/usr/bin/libtool
3274     INSTALL_NAME_TOOL=install_name_tool
3275     if test -z "$save_CC"; then
3276         stdlib=-stdlib=libc++
3278         AC_MSG_CHECKING([what C compiler to use])
3279         CC="`xcrun -find clang`"
3280         CC_BASE=`first_arg_basename "$CC"`
3281         if test "$host_cpu" = x86_64; then
3282             CC+=" -target x86_64-apple-macos"
3283         else
3284             CC+=" -target arm64-apple-macos"
3285         fi
3286         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3287         AC_MSG_RESULT([$CC])
3289         AC_MSG_CHECKING([what C++ compiler to use])
3290         CXX="`xcrun -find clang++`"
3291         CXX_BASE=`first_arg_basename "$CXX"`
3292         if test "$host_cpu" = x86_64; then
3293             CXX+=" -target x86_64-apple-macos"
3294         else
3295             CXX+=" -target arm64-apple-macos"
3296         fi
3297         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3298         AC_MSG_RESULT([$CXX])
3300         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3301         AR=`xcrun -find ar`
3302         NM=`xcrun -find nm`
3303         STRIP=`xcrun -find strip`
3304         LIBTOOL=`xcrun -find libtool`
3305         RANLIB=`xcrun -find ranlib`
3306     fi
3308     case "$with_macosx_version_max_allowed" in
3309     10.10)
3310         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3311         ;;
3312     10.11)
3313         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3314         ;;
3315     10.12)
3316         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3317         ;;
3318     10.13)
3319         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3320         ;;
3321     10.14)
3322         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3323         ;;
3324     10.15)
3325         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3326         ;;
3327     11.0)
3328         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3329         ;;
3330     11.1)
3331         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3332         ;;
3333     11.3)
3334         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3335         ;;
3336     12.0)
3337         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3338         ;;
3339     12.1)
3340         MAC_OS_X_VERSION_MAX_ALLOWED="120100"
3341         ;;
3342     12.3)
3343         MAC_OS_X_VERSION_MAX_ALLOWED="120300"
3344         ;;
3345     *)
3346         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.3])
3347         ;;
3348     esac
3350     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3351     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3352         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])
3353     else
3354         AC_MSG_RESULT([ok])
3355     fi
3357     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3358     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3359         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3360     else
3361         AC_MSG_RESULT([ok])
3362     fi
3363     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3364     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3366     AC_MSG_CHECKING([whether to do code signing])
3368     if test "$enable_macosx_code_signing" = yes; then
3369         # By default use the first suitable certificate (?).
3371         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3372         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3373         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3374         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3375         # "Developer ID Application" one.
3377         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3378         if test -n "$identity"; then
3379             MACOSX_CODESIGNING_IDENTITY=$identity
3380             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3381             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3382         else
3383             AC_MSG_ERROR([cannot determine identity to use])
3384         fi
3385     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3386         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3387         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3388         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3389     else
3390         AC_MSG_RESULT([no])
3391     fi
3393     AC_MSG_CHECKING([whether to create a Mac App Store package])
3395     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3396         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3397     elif test "$enable_macosx_package_signing" = yes; then
3398         # By default use the first suitable certificate.
3399         # It should be a "3rd Party Mac Developer Installer" one
3401         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3402         if test -n "$identity"; then
3403             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3404             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3405             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3406         else
3407             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3408         fi
3409     elif test -n "$enable_macosx_package_signing"; then
3410         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3411         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3412         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3413     else
3414         AC_MSG_RESULT([no])
3415     fi
3417     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3418         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3419     fi
3421     AC_MSG_CHECKING([whether to sandbox the application])
3423     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3424         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3425     elif test "$enable_macosx_sandbox" = yes; then
3426         ENABLE_MACOSX_SANDBOX=TRUE
3427         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3428         AC_MSG_RESULT([yes])
3429     else
3430         AC_MSG_RESULT([no])
3431     fi
3433     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3434     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3435     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3437 AC_SUBST(MACOSX_SDK_PATH)
3438 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3439 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3440 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3441 AC_SUBST(INSTALL_NAME_TOOL)
3442 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3443 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3444 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3445 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3446 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3448 dnl ===================================================================
3449 dnl Check iOS SDK and compiler
3450 dnl ===================================================================
3452 if test $_os = iOS; then
3453     AC_MSG_CHECKING([what iOS SDK to use])
3454     current_sdk_ver=16.0
3455     older_sdk_vers="15.6 15.5 15.4 15.2 15.0 14.5"
3456     if test "$enable_ios_simulator" = "yes"; then
3457         platform=iPhoneSimulator
3458         versionmin=-mios-simulator-version-min=12.2
3459     else
3460         platform=iPhoneOS
3461         versionmin=-miphoneos-version-min=12.2
3462     fi
3463     xcode_developer=`xcode-select -print-path`
3465     for sdkver in $current_sdk_ver $older_sdk_vers; do
3466         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3467         if test -d $t; then
3468             sysroot=$t
3469             break
3470         fi
3471     done
3473     if test -z "$sysroot"; then
3474         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3475     fi
3477     AC_MSG_RESULT($sysroot)
3479     stdlib="-stdlib=libc++"
3481     AC_MSG_CHECKING([what C compiler to use])
3482     CC="`xcrun -find clang`"
3483     CC_BASE=`first_arg_basename "$CC"`
3484     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3485     AC_MSG_RESULT([$CC])
3487     AC_MSG_CHECKING([what C++ compiler to use])
3488     CXX="`xcrun -find clang++`"
3489     CXX_BASE=`first_arg_basename "$CXX"`
3490     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3491     AC_MSG_RESULT([$CXX])
3493     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3494     AR=`xcrun -find ar`
3495     NM=`xcrun -find nm`
3496     STRIP=`xcrun -find strip`
3497     LIBTOOL=`xcrun -find libtool`
3498     RANLIB=`xcrun -find ranlib`
3501 AC_MSG_CHECKING([whether to treat the installation as read-only])
3503 if test $_os = Darwin; then
3504     enable_readonly_installset=yes
3505 elif test "$enable_extensions" != yes; then
3506     enable_readonly_installset=yes
3508 if test "$enable_readonly_installset" = yes; then
3509     AC_MSG_RESULT([yes])
3510     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3511 else
3512     AC_MSG_RESULT([no])
3515 dnl ===================================================================
3516 dnl Structure of install set
3517 dnl ===================================================================
3519 if test $_os = Darwin; then
3520     LIBO_BIN_FOLDER=MacOS
3521     LIBO_ETC_FOLDER=Resources
3522     LIBO_LIBEXEC_FOLDER=MacOS
3523     LIBO_LIB_FOLDER=Frameworks
3524     LIBO_LIB_PYUNO_FOLDER=Resources
3525     LIBO_SHARE_FOLDER=Resources
3526     LIBO_SHARE_HELP_FOLDER=Resources/help
3527     LIBO_SHARE_JAVA_FOLDER=Resources/java
3528     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3529     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3530     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3531     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3532     LIBO_URE_BIN_FOLDER=MacOS
3533     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3534     LIBO_URE_LIB_FOLDER=Frameworks
3535     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3536     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3537 elif test $_os = WINNT; then
3538     LIBO_BIN_FOLDER=program
3539     LIBO_ETC_FOLDER=program
3540     LIBO_LIBEXEC_FOLDER=program
3541     LIBO_LIB_FOLDER=program
3542     LIBO_LIB_PYUNO_FOLDER=program
3543     LIBO_SHARE_FOLDER=share
3544     LIBO_SHARE_HELP_FOLDER=help
3545     LIBO_SHARE_JAVA_FOLDER=program/classes
3546     LIBO_SHARE_PRESETS_FOLDER=presets
3547     LIBO_SHARE_READMES_FOLDER=readmes
3548     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3549     LIBO_SHARE_SHELL_FOLDER=program/shell
3550     LIBO_URE_BIN_FOLDER=program
3551     LIBO_URE_ETC_FOLDER=program
3552     LIBO_URE_LIB_FOLDER=program
3553     LIBO_URE_MISC_FOLDER=program
3554     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3555 else
3556     LIBO_BIN_FOLDER=program
3557     LIBO_ETC_FOLDER=program
3558     LIBO_LIBEXEC_FOLDER=program
3559     LIBO_LIB_FOLDER=program
3560     LIBO_LIB_PYUNO_FOLDER=program
3561     LIBO_SHARE_FOLDER=share
3562     LIBO_SHARE_HELP_FOLDER=help
3563     LIBO_SHARE_JAVA_FOLDER=program/classes
3564     LIBO_SHARE_PRESETS_FOLDER=presets
3565     LIBO_SHARE_READMES_FOLDER=readmes
3566     if test "$enable_fuzzers" != yes; then
3567         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3568     else
3569         LIBO_SHARE_RESOURCE_FOLDER=resource
3570     fi
3571     LIBO_SHARE_SHELL_FOLDER=program/shell
3572     LIBO_URE_BIN_FOLDER=program
3573     LIBO_URE_ETC_FOLDER=program
3574     LIBO_URE_LIB_FOLDER=program
3575     LIBO_URE_MISC_FOLDER=program
3576     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3578 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3579 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3580 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3581 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3582 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3583 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3584 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3585 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3586 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3587 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3588 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3589 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3590 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3591 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3592 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3593 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3595 # Not all of them needed in config_host.mk, add more if need arises
3596 AC_SUBST(LIBO_BIN_FOLDER)
3597 AC_SUBST(LIBO_ETC_FOLDER)
3598 AC_SUBST(LIBO_LIB_FOLDER)
3599 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3600 AC_SUBST(LIBO_SHARE_FOLDER)
3601 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3602 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3603 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3604 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3605 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3606 AC_SUBST(LIBO_URE_BIN_FOLDER)
3607 AC_SUBST(LIBO_URE_ETC_FOLDER)
3608 AC_SUBST(LIBO_URE_LIB_FOLDER)
3609 AC_SUBST(LIBO_URE_MISC_FOLDER)
3610 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3612 dnl ===================================================================
3613 dnl Windows specific tests and stuff
3614 dnl ===================================================================
3616 reg_get_value()
3618     # Return value: $regvalue
3619     unset regvalue
3621     if test "$build_os" = "wsl"; then
3622         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3623         return
3624     fi
3626     local _regentry="/proc/registry${1}/${2}"
3627     if test -f "$_regentry"; then
3628         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3629         # Registry keys read via /proc/registry* are always \0 terminated!
3630         local _regvalue=$(tr -d '\0' < "$_regentry")
3631         if test $? -eq 0; then
3632             regvalue=$_regvalue
3633         fi
3634     fi
3637 # Get a value from the 32-bit side of the Registry
3638 reg_get_value_32()
3640     reg_get_value "32" "$1"
3643 # Get a value from the 64-bit side of the Registry
3644 reg_get_value_64()
3646     reg_get_value "64" "$1"
3649 case "$host_os" in
3650 cygwin*|wsl*)
3651     COM=MSC
3652     USING_X11=
3653     OS=WNT
3654     RTL_OS=Windows
3655     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3656         P_SEP=";"
3657     else
3658         P_SEP=:
3659     fi
3660     case "$host_cpu" in
3661     x86_64)
3662         CPUNAME=X86_64
3663         RTL_ARCH=X86_64
3664         PLATFORMID=windows_x86_64
3665         WINDOWS_X64=1
3666         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3667         WIN_HOST_ARCH="x64"
3668         WIN_MULTI_ARCH="x86"
3669         WIN_HOST_BITS=64
3670         ;;
3671     i*86)
3672         CPUNAME=INTEL
3673         RTL_ARCH=x86
3674         PLATFORMID=windows_x86
3675         WIN_HOST_ARCH="x86"
3676         WIN_HOST_BITS=32
3677         WIN_OTHER_ARCH="x64"
3678         ;;
3679     aarch64)
3680         CPUNAME=ARM64
3681         RTL_ARCH=arm64
3682         PLATFORMID=windows_arm64
3683         WINDOWS_X64=1
3684         SCPDEFS="$SCPDEFS -DWINDOWS_ARM64"
3685         WIN_HOST_ARCH="arm64"
3686         WIN_HOST_BITS=64
3687         with_ucrt_dir=no
3688         ;;
3689     *)
3690         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3691         ;;
3692     esac
3694     case "$build_cpu" in
3695     x86_64) WIN_BUILD_ARCH="x64" ;;
3696     i*86) WIN_BUILD_ARCH="x86" ;;
3697     aarch64) WIN_BUILD_ARCH="arm64" ;;
3698     *)
3699         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3700         ;;
3701     esac
3703     SCPDEFS="$SCPDEFS -D_MSC_VER"
3704     AC_SUBST(WIN_HOST_ARCH)
3705     ;;
3706 esac
3708 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3709 # other-arch won't, but wouldn't break the build (x64 on x86).
3710 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3711     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3715 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3716     # To allow building Windows multi-arch releases without cross-tooling
3717     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3718         cross_compiling="yes"
3719     fi
3721 if test "$cross_compiling" = "yes"; then
3722     export CROSS_COMPILING=TRUE
3723 else
3724     CROSS_COMPILING=
3725     BUILD_TYPE="$BUILD_TYPE NATIVE"
3727 AC_SUBST(CROSS_COMPILING)
3729 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3730 # NOTE: must _not_ be used for bundled external libraries!
3731 ISYSTEM=
3732 if test "$GCC" = "yes"; then
3733     AC_MSG_CHECKING( for -isystem )
3734     save_CFLAGS=$CFLAGS
3735     CFLAGS="$CFLAGS -Werror"
3736     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3737     CFLAGS=$save_CFLAGS
3738     if test -n "$ISYSTEM"; then
3739         AC_MSG_RESULT(yes)
3740     else
3741         AC_MSG_RESULT(no)
3742     fi
3744 if test -z "$ISYSTEM"; then
3745     # fall back to using -I
3746     ISYSTEM=-I
3748 AC_SUBST(ISYSTEM)
3750 dnl ===================================================================
3751 dnl  Check which Visual Studio compiler is used
3752 dnl ===================================================================
3754 map_vs_year_to_version()
3756     # Return value: $vsversion
3758     unset vsversion
3760     case $1 in
3761     2019)
3762         vsversion=16;;
3763     *)
3764         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3765     esac
3768 vs_versions_to_check()
3770     # Args: $1 (optional) : versions to check, in the order of preference
3771     # Return value: $vsversions
3773     unset vsversions
3775     if test -n "$1"; then
3776         map_vs_year_to_version "$1"
3777         vsversions=$vsversion
3778     else
3779         # We accept only 2019
3780         vsversions="16"
3781     fi
3784 win_get_env_from_vsvars32bat()
3786     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3787     # Also seems to be located in another directory under the same name: vsvars32.bat
3788     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3789     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3790     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3791     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3792     local result
3793     if test "$build_os" = "wsl"; then
3794         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3795     else
3796         chmod +x $WRAPPERBATCHFILEPATH
3797         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3798     fi
3799     rm -f $WRAPPERBATCHFILEPATH
3800     printf '%s' "$result"
3803 find_ucrt()
3805     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3806     if test -n "$regvalue"; then
3807         PathFormat "$regvalue"
3808         UCRTSDKDIR=$formatted_path_unix
3809         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3810         UCRTVERSION=$regvalue
3811         # Rest if not exist
3812         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3813           UCRTSDKDIR=
3814         fi
3815     fi
3816     if test -z "$UCRTSDKDIR"; then
3817         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3818         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3819         if test -f "$ide_env_file"; then
3820             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3821             UCRTSDKDIR=$formatted_path
3822             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3823             dnl Hack needed at least by tml:
3824             if test "$UCRTVERSION" = 10.0.15063.0 \
3825                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3826                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3827             then
3828                 UCRTVERSION=10.0.14393.0
3829             fi
3830         else
3831           AC_MSG_ERROR([No UCRT found])
3832         fi
3833     fi
3836 find_msvc()
3838     # Find Visual C++ 2019
3839     # Args: $1 (optional) : The VS version year
3840     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3842     unset vctest vcnum vcnumwithdot vcbuildnumber
3844     vs_versions_to_check "$1"
3845     if test "$build_os" = wsl; then
3846         vswhere="$PROGRAMFILESX86"
3847     else
3848         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3849     fi
3850     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3851     PathFormat "$vswhere"
3852     vswhere=$formatted_path_unix
3853     for ver in $vsversions; do
3854         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3855         # Fall back to all MS products (this includes VC++ Build Tools)
3856         if ! test -n "$vswhereoutput"; then
3857             AC_MSG_CHECKING([VC++ Build Tools and similar])
3858             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3859         fi
3860         if test -n "$vswhereoutput"; then
3861             PathFormat "$vswhereoutput"
3862             vctest=$formatted_path_unix
3863             break
3864         fi
3865     done
3867     if test -n "$vctest"; then
3868         vcnumwithdot="$ver.0"
3869         case "$vcnumwithdot" in
3870         16.0)
3871             vcyear=2019
3872             vcnum=160
3873             ;;
3874         esac
3875         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3877     fi
3880 test_cl_exe()
3882     AC_MSG_CHECKING([$1 compiler])
3884     CL_EXE_PATH="$2/cl.exe"
3886     if test ! -f "$CL_EXE_PATH"; then
3887         if test "$1" = "multi-arch"; then
3888             AC_MSG_WARN([no compiler (cl.exe) in $2])
3889             return 1
3890         else
3891             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3892         fi
3893     fi
3895     dnl ===========================================================
3896     dnl  Check for the corresponding mspdb*.dll
3897     dnl ===========================================================
3899     # MSVC 15.0 has libraries from 14.0?
3900     mspdbnum="140"
3902     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3903         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3904     fi
3906     # The compiles has to find its shared libraries
3907     OLD_PATH="$PATH"
3908     TEMP_PATH=`cygpath -d "$2"`
3909     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3911     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3912         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3913     fi
3915     PATH="$OLD_PATH"
3917     AC_MSG_RESULT([$CL_EXE_PATH])
3920 SOLARINC=
3921 MSBUILD_PATH=
3922 DEVENV=
3923 if test "$_os" = "WINNT"; then
3924     AC_MSG_CHECKING([Visual C++])
3925     find_msvc "$with_visual_studio"
3926     if test -z "$vctest"; then
3927         if test -n "$with_visual_studio"; then
3928             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3929         else
3930             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3931         fi
3932     fi
3933     AC_MSG_RESULT([])
3935     VC_PRODUCT_DIR="$vctest/VC"
3936     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3938     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3939     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3940         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3941         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3942         if test $? -ne 0; then
3943             WIN_MULTI_ARCH=""
3944             WIN_OTHER_ARCH=""
3945         fi
3946     fi
3948     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3949         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3950         test_cl_exe "build" "$MSVC_BUILD_PATH"
3951     fi
3953     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3954         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3955         test_cl_exe "host" "$MSVC_HOST_PATH"
3956     else
3957         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3958     fi
3960     AC_MSG_CHECKING([for short pathname of VC product directory])
3961     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3962     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3964     UCRTSDKDIR=
3965     UCRTVERSION=
3967     AC_MSG_CHECKING([for UCRT location])
3968     find_ucrt
3969     # find_ucrt errors out if it doesn't find it
3970     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
3971     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3972     ucrtincpath_formatted=$formatted_path
3973     # SOLARINC is used for external modules and must be set too.
3974     # And no, it's not sufficient to set SOLARINC only, as configure
3975     # itself doesn't honour it.
3976     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3977     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3978     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3979     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3981     AC_SUBST(UCRTSDKDIR)
3982     AC_SUBST(UCRTVERSION)
3984     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3985     # Find the proper version of MSBuild.exe to use based on the VS version
3986     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3987     if test -n "$regvalue" ; then
3988         AC_MSG_RESULT([found: $regvalue])
3989         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3990     else
3991         if test "$vcnumwithdot" = "16.0"; then
3992             if test "$WIN_BUILD_ARCH" != "x64"; then
3993                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3994             else
3995                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3996             fi
3997         else
3998             if test "$WIN_BUILD_ARCH" != "x64"; then
3999                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
4000             else
4001                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
4002             fi
4003         fi
4004         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4005         AC_MSG_RESULT([$regvalue])
4006     fi
4008     # Find the version of devenv.exe
4009     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4010     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4011     DEVENV_unix=$(cygpath -u "$DEVENV")
4012     if test ! -e "$DEVENV_unix"; then
4013         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4014     fi
4016     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4017     dnl needed when building CLR code:
4018     if test -z "$MSVC_CXX"; then
4019         # This gives us a posix path with 8.3 filename restrictions
4020         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4021     fi
4023     if test -z "$CC"; then
4024         CC=$MSVC_CXX
4025         CC_BASE=`first_arg_basename "$CC"`
4026     fi
4027     if test -z "$CXX"; then
4028         CXX=$MSVC_CXX
4029         CXX_BASE=`first_arg_basename "$CXX"`
4030     fi
4032     if test -n "$CC"; then
4033         # Remove /cl.exe from CC case insensitive
4034         AC_MSG_NOTICE([found Visual C++ $vcyear])
4036         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4037         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4039         PathFormat "$COMPATH"
4040         COMPATH=`win_short_path_for_make "$formatted_path"`
4042         VCVER=$vcnum
4044         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4045         # are always "better", we list them in reverse chronological order.
4047         case "$vcnum" in
4048         160)
4049             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4050             ;;
4051         esac
4053         # The expectation is that --with-windows-sdk should not need to be used
4054         if test -n "$with_windows_sdk"; then
4055             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4056             *" "$with_windows_sdk" "*)
4057                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4058                 ;;
4059             *)
4060                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4061                 ;;
4062             esac
4063         fi
4065         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4066         ac_objext=obj
4067         ac_exeext=exe
4069     else
4070         AC_MSG_ERROR([Visual C++ not found after all, huh])
4071     fi
4073     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
4074     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4075         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4076         // between Visual Studio versions and _MSC_VER:
4077         #if _MSC_VER < 1924
4078         #error
4079         #endif
4080     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4082     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4083     # version of the Explorer extension (and maybe other small
4084     # bits, too) needed when installing a 32-bit LibreOffice on a
4085     # 64-bit OS. The 64-bit Explorer extension is a feature that
4086     # has been present since long in OOo. Don't confuse it with
4087     # building LibreOffice itself as 64-bit code.
4089     BUILD_X64=
4090     CXX_X64_BINARY=
4092     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4093         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4094         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4095              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4096         then
4097             BUILD_X64=TRUE
4098             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4099             AC_MSG_RESULT([found])
4100         else
4101             AC_MSG_RESULT([not found])
4102             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4103         fi
4104     elif test "$WIN_HOST_ARCH" = "x64"; then
4105         CXX_X64_BINARY=$CXX
4106     fi
4107     AC_SUBST(BUILD_X64)
4109     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4110     AC_SUBST(CXX_X64_BINARY)
4112     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4113     # needed to support TWAIN scan on both 32- and 64-bit systems
4115     case "$WIN_HOST_ARCH" in
4116     x64)
4117         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4118         if test -n "$CXX_X86_BINARY"; then
4119             BUILD_X86=TRUE
4120             AC_MSG_RESULT([preset])
4121         elif test -n "$WIN_MULTI_ARCH"; then
4122             BUILD_X86=TRUE
4123             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4124             CXX_X86_BINARY+=" /arch:SSE"
4125             AC_MSG_RESULT([found])
4126         else
4127             AC_MSG_RESULT([not found])
4128             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4129         fi
4130         ;;
4131     x86)
4132         BUILD_X86=TRUE
4133         CXX_X86_BINARY=$MSVC_CXX
4134         ;;
4135     esac
4136     AC_SUBST(BUILD_X86)
4137     AC_SUBST(CXX_X86_BINARY)
4139 AC_SUBST(VCVER)
4140 AC_SUBST(DEVENV)
4141 AC_SUBST(MSVC_CXX)
4144 # unowinreg.dll
4146 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
4147 AC_SUBST(UNOWINREG_DLL)
4149 COM_IS_CLANG=
4150 AC_MSG_CHECKING([whether the compiler is actually Clang])
4151 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4152     #ifndef __clang__
4153     you lose
4154     #endif
4155     int foo=42;
4156     ]])],
4157     [AC_MSG_RESULT([yes])
4158      COM_IS_CLANG=TRUE],
4159     [AC_MSG_RESULT([no])])
4160 AC_SUBST(COM_IS_CLANG)
4162 CC_PLAIN=$CC
4163 CLANGVER=
4164 if test "$COM_IS_CLANG" = TRUE; then
4165     AC_MSG_CHECKING([whether Clang is new enough])
4166     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4167         #if !defined __apple_build_version__
4168         #error
4169         #endif
4170         ]])],
4171         [my_apple_clang=yes],[my_apple_clang=])
4172     if test "$my_apple_clang" = yes; then
4173         AC_MSG_RESULT([assumed yes (Apple Clang)])
4174     else
4175         if test "$_os" = WINNT; then
4176             dnl In which case, assume clang-cl:
4177             my_args="/EP /TC"
4178             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4179             dnl clang-cl:
4180             CC_PLAIN=
4181             for i in $CC; do
4182                 case $i in
4183                 -FIIntrin.h)
4184                     ;;
4185                 *)
4186                     CC_PLAIN="$CC_PLAIN $i"
4187                     ;;
4188                 esac
4189             done
4190         else
4191             my_args="-E -P"
4192         fi
4193         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4194         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4195         CLANGVER=`echo $clang_version \
4196             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4197         if test "$CLANGVER" -ge 50002; then
4198             AC_MSG_RESULT([yes ($clang_version)])
4199         else
4200             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4201         fi
4202         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4203         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4204     fi
4207 SHOWINCLUDES_PREFIX=
4208 if test "$_os" = WINNT; then
4209     dnl We need to guess the prefix of the -showIncludes output, it can be
4210     dnl localized
4211     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4212     echo "#include <stdlib.h>" > conftest.c
4213     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4214         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4215     rm -f conftest.c conftest.obj
4216     if test -z "$SHOWINCLUDES_PREFIX"; then
4217         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4218     else
4219         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4220     fi
4222 AC_SUBST(SHOWINCLUDES_PREFIX)
4225 # prefix C with ccache if needed
4227 if test "$CCACHE" != ""; then
4228     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4230     AC_LANG_PUSH([C])
4231     save_CFLAGS=$CFLAGS
4232     CFLAGS="$CFLAGS --ccache-skip -O2"
4233     dnl an empty program will do, we're checking the compiler flags
4234     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4235                       [use_ccache=yes], [use_ccache=no])
4236     CFLAGS=$save_CFLAGS
4237     if test $use_ccache = yes; then
4238         AC_MSG_RESULT([yes])
4239     else
4240         CC="$CCACHE $CC"
4241         CC_BASE="ccache $CC_BASE"
4242         AC_MSG_RESULT([no])
4243     fi
4244     AC_LANG_POP([C])
4247 # ===================================================================
4248 # check various GCC options that Clang does not support now but maybe
4249 # will somewhen in the future, check them even for GCC, so that the
4250 # flags are set
4251 # ===================================================================
4253 HAVE_GCC_GGDB2=
4254 if test "$GCC" = "yes"; then
4255     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4256     save_CFLAGS=$CFLAGS
4257     CFLAGS="$CFLAGS -Werror -ggdb2"
4258     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4259     CFLAGS=$save_CFLAGS
4260     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4261         AC_MSG_RESULT([yes])
4262     else
4263         AC_MSG_RESULT([no])
4264     fi
4266     if test "$host_cpu" = "m68k"; then
4267         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4268         save_CFLAGS=$CFLAGS
4269         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4270         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4271         CFLAGS=$save_CFLAGS
4272         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4273             AC_MSG_RESULT([yes])
4274         else
4275             AC_MSG_ERROR([no])
4276         fi
4277     fi
4279 AC_SUBST(HAVE_GCC_GGDB2)
4281 dnl ===================================================================
4282 dnl  Test the gcc version
4283 dnl ===================================================================
4284 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4285     AC_MSG_CHECKING([the GCC version])
4286     _gcc_version=`$CC -dumpversion`
4287     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4288         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4289     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4291     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4293     if test "$gcc_full_version" -lt 70000; then
4294         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4295     fi
4296 else
4297     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4298     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4299     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4300     # (which reports itself as GCC 4.2.1).
4301     GCC_VERSION=
4303 AC_SUBST(GCC_VERSION)
4305 dnl Set the ENABLE_DBGUTIL variable
4306 dnl ===================================================================
4307 AC_MSG_CHECKING([whether to build with additional debug utilities])
4308 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4309     ENABLE_DBGUTIL="TRUE"
4310     # this is an extra var so it can have different default on different MSVC
4311     # versions (in case there are version specific problems with it)
4312     MSVC_USE_DEBUG_RUNTIME="TRUE"
4314     AC_MSG_RESULT([yes])
4315     # cppunit and graphite expose STL in public headers
4316     if test "$with_system_cppunit" = "yes"; then
4317         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4318     else
4319         with_system_cppunit=no
4320     fi
4321     if test "$with_system_graphite" = "yes"; then
4322         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4323     else
4324         with_system_graphite=no
4325     fi
4326     if test "$with_system_orcus" = "yes"; then
4327         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4328     else
4329         with_system_orcus=no
4330     fi
4331     if test "$with_system_libcmis" = "yes"; then
4332         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4333     else
4334         with_system_libcmis=no
4335     fi
4336     if test "$with_system_hunspell" = "yes"; then
4337         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4338     else
4339         with_system_hunspell=no
4340     fi
4341     if test "$with_system_gpgmepp" = "yes"; then
4342         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4343     else
4344         with_system_gpgmepp=no
4345     fi
4346     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4347     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4348     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4349     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4350     # of those two is using the system variant:
4351     if test "$with_system_libnumbertext" = "yes"; then
4352         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4353     else
4354         with_system_libnumbertext=no
4355     fi
4356     if test "$with_system_libwps" = "yes"; then
4357         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4358     else
4359         with_system_libwps=no
4360     fi
4361 else
4362     ENABLE_DBGUTIL=""
4363     MSVC_USE_DEBUG_RUNTIME=""
4364     AC_MSG_RESULT([no])
4366 AC_SUBST(ENABLE_DBGUTIL)
4367 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4369 dnl Set the ENABLE_DEBUG variable.
4370 dnl ===================================================================
4371 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4372     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4374 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4375     if test -z "$libo_fuzzed_enable_debug"; then
4376         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4377     else
4378         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4379         enable_debug=yes
4380     fi
4383 AC_MSG_CHECKING([whether to do a debug build])
4384 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4385     ENABLE_DEBUG="TRUE"
4386     if test -n "$ENABLE_DBGUTIL" ; then
4387         AC_MSG_RESULT([yes (dbgutil)])
4388     else
4389         AC_MSG_RESULT([yes])
4390     fi
4391 else
4392     ENABLE_DEBUG=""
4393     AC_MSG_RESULT([no])
4395 AC_SUBST(ENABLE_DEBUG)
4397 dnl ===================================================================
4398 dnl Select the linker to use (gold/lld/ld.bfd).
4399 dnl This is done only after compiler checks (need to know if Clang is
4400 dnl used, for different defaults) and after checking if a debug build
4401 dnl is wanted (non-debug builds get the default linker if not explicitly
4402 dnl specified otherwise).
4403 dnl All checks for linker features/options should come after this.
4404 dnl ===================================================================
4405 check_use_ld()
4407     use_ld=-fuse-ld=${1%%:*}
4408     use_ld_path=${1#*:}
4409     if test "$use_ld_path" != "$1"; then
4410         use_ld="$use_ld --ld-path=$use_ld_path"
4411     fi
4412     use_ld_fail_if_error=$2
4413     use_ld_ok=
4414     AC_MSG_CHECKING([for $use_ld linker support])
4415     use_ld_ldflags_save="$LDFLAGS"
4416     LDFLAGS="$LDFLAGS $use_ld"
4417     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4418 #include <stdio.h>
4419         ],[
4420 printf ("hello world\n");
4421         ])], USE_LD=$use_ld, [])
4422     if test -n "$USE_LD"; then
4423         AC_MSG_RESULT( yes )
4424         use_ld_ok=yes
4425     else
4426         if test -n "$use_ld_fail_if_error"; then
4427             AC_MSG_ERROR( no )
4428         else
4429             AC_MSG_RESULT( no )
4430         fi
4431     fi
4432     if test -n "$use_ld_ok"; then
4433         dnl keep the value of LDFLAGS
4434         return 0
4435     fi
4436     LDFLAGS="$use_ld_ldflags_save"
4437     return 1
4439 USE_LD=
4440 if test "$enable_ld" != "no"; then
4441     if test "$GCC" = "yes"; then
4442         if test -n "$enable_ld"; then
4443             check_use_ld "$enable_ld" fail_if_error
4444         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4445             dnl non-debug builds default to the default linker
4446             true
4447         elif test -n "$COM_IS_CLANG"; then
4448             check_use_ld lld
4449             if test $? -ne 0; then
4450                 check_use_ld gold
4451             fi
4452         else
4453             # For gcc first try gold, new versions also support lld.
4454             check_use_ld gold
4455             if test $? -ne 0; then
4456                 check_use_ld lld
4457             fi
4458         fi
4459         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4460         rm conftest.out
4461         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4462         if test -z "$ld_used"; then
4463             ld_used="unknown"
4464         fi
4465         AC_MSG_CHECKING([for linker that is used])
4466         AC_MSG_RESULT([$ld_used])
4467         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4468             if echo "$ld_used" | grep -q "^GNU ld"; then
4469                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4470                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4471             fi
4472         fi
4473     else
4474         if test "$enable_ld" = "yes"; then
4475             AC_MSG_ERROR([--enable-ld not supported])
4476         fi
4477     fi
4479 AC_SUBST(USE_LD)
4481 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4482 if test "$GCC" = "yes"; then
4483     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4484     bsymbolic_functions_ldflags_save=$LDFLAGS
4485     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4486     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4487 #include <stdio.h>
4488         ],[
4489 printf ("hello world\n");
4490         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4491     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4492         AC_MSG_RESULT( found )
4493     else
4494         AC_MSG_RESULT( not found )
4495     fi
4496     LDFLAGS=$bsymbolic_functions_ldflags_save
4498 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4500 LD_GC_SECTIONS=
4501 if test "$GCC" = "yes"; then
4502     for flag in "--gc-sections" "-dead_strip"; do
4503         AC_MSG_CHECKING([for $flag linker support])
4504         ldflags_save=$LDFLAGS
4505         LDFLAGS="$LDFLAGS -Wl,$flag"
4506         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4507 #include <stdio.h>
4508             ],[
4509 printf ("hello world\n");
4510             ])],[
4511             LD_GC_SECTIONS="-Wl,$flag"
4512             AC_MSG_RESULT( found )
4513             ], [
4514             AC_MSG_RESULT( not found )
4515             ])
4516         LDFLAGS=$ldflags_save
4517         if test -n "$LD_GC_SECTIONS"; then
4518             break
4519         fi
4520     done
4522 AC_SUBST(LD_GC_SECTIONS)
4524 HAVE_GSPLIT_DWARF=
4525 if test "$enable_split_debug" != no; then
4526     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4527     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4528         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4529         save_CFLAGS=$CFLAGS
4530         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4531         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4532         CFLAGS=$save_CFLAGS
4533         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4534             AC_MSG_RESULT([yes])
4535         else
4536             if test "$enable_split_debug" = yes; then
4537                 AC_MSG_ERROR([no])
4538             else
4539                 AC_MSG_RESULT([no])
4540             fi
4541         fi
4542     fi
4543     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4544         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4545         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4546     fi
4548 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4550 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4551 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4552 save_CFLAGS=$CFLAGS
4553 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4554 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4555 CFLAGS=$save_CFLAGS
4556 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4557     AC_MSG_RESULT([yes])
4558 else
4559     AC_MSG_RESULT([no])
4561 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4563 ENABLE_GDB_INDEX=
4564 if test "$enable_gdb_index" != "no"; then
4565     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4566     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4567         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4568         save_CFLAGS=$CFLAGS
4569         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4570         have_ggnu_pubnames=
4571         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4572         if test "$have_ggnu_pubnames" != "TRUE"; then
4573             if test "$enable_gdb_index" = "yes"; then
4574                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4575             else
4576                 AC_MSG_RESULT( no )
4577             fi
4578         else
4579             AC_MSG_RESULT( yes )
4580             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4581             ldflags_save=$LDFLAGS
4582             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4583             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4584 #include <stdio.h>
4585                 ],[
4586 printf ("hello world\n");
4587                 ])], ENABLE_GDB_INDEX=TRUE, [])
4588             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4589                 AC_MSG_RESULT( yes )
4590             else
4591                 if test "$enable_gdb_index" = "yes"; then
4592                     AC_MSG_ERROR( no )
4593                 else
4594                     AC_MSG_RESULT( no )
4595                 fi
4596             fi
4597             LDFLAGS=$ldflags_save
4598         fi
4599         CFLAGS=$save_CFLAGS
4600         fi
4601     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4602         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4603         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4604     fi
4606 AC_SUBST(ENABLE_GDB_INDEX)
4608 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4609     enable_sal_log=yes
4611 if test "$enable_sal_log" = yes; then
4612     ENABLE_SAL_LOG=TRUE
4614 AC_SUBST(ENABLE_SAL_LOG)
4616 dnl Check for enable symbols option
4617 dnl ===================================================================
4618 AC_MSG_CHECKING([whether to generate debug information])
4619 if test -z "$enable_symbols"; then
4620     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4621         enable_symbols=yes
4622     else
4623         enable_symbols=no
4624     fi
4626 if test "$enable_symbols" = yes; then
4627     ENABLE_SYMBOLS_FOR=all
4628     AC_MSG_RESULT([yes])
4629 elif test "$enable_symbols" = no; then
4630     ENABLE_SYMBOLS_FOR=
4631     AC_MSG_RESULT([no])
4632 else
4633     # Selective debuginfo.
4634     ENABLE_SYMBOLS_FOR="$enable_symbols"
4635     AC_MSG_RESULT([for "$enable_symbols"])
4637 AC_SUBST(ENABLE_SYMBOLS_FOR)
4638 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4639     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4640     AC_MSG_CHECKING([whether enough memory is available for linking])
4641     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4642     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4643     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4644         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4645     else
4646         AC_MSG_RESULT([yes])
4647     fi
4650 ENABLE_OPTIMIZED=
4651 ENABLE_OPTIMIZED_DEBUG=
4652 AC_MSG_CHECKING([whether to compile with optimization flags])
4653 if test -z "$enable_optimized"; then
4654     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4655         enable_optimized=no
4656     else
4657         enable_optimized=yes
4658     fi
4660 if test "$enable_optimized" = yes; then
4661     ENABLE_OPTIMIZED=TRUE
4662     AC_MSG_RESULT([yes])
4663 elif test "$enable_optimized" = debug; then
4664     ENABLE_OPTIMIZED_DEBUG=TRUE
4665     AC_MSG_RESULT([yes (debug)])
4666     HAVE_GCC_OG=
4667     if test "$GCC" = "yes"; then
4668         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4669         save_CFLAGS=$CFLAGS
4670         CFLAGS="$CFLAGS -Werror -Og"
4671         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4672         CFLAGS=$save_CFLAGS
4673         if test "$HAVE_GCC_OG" = "TRUE"; then
4674             AC_MSG_RESULT([yes])
4675         else
4676             AC_MSG_RESULT([no])
4677         fi
4678     fi
4679     if test -z "$HAVE_GCC_OG"; then
4680         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4681     fi
4682 else
4683     AC_MSG_RESULT([no])
4685 AC_SUBST(ENABLE_OPTIMIZED)
4686 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4689 # determine CPUNAME, OS, ...
4690 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4692 case "$host_os" in
4694 aix*)
4695     COM=GCC
4696     CPUNAME=POWERPC
4697     USING_X11=TRUE
4698     OS=AIX
4699     RTL_OS=AIX
4700     RTL_ARCH=PowerPC
4701     PLATFORMID=aix_powerpc
4702     P_SEP=:
4703     ;;
4705 cygwin*|wsl*)
4706     # Already handled
4707     ;;
4709 darwin*|macos*)
4710     COM=GCC
4711     USING_X11=
4712     OS=MACOSX
4713     RTL_OS=MacOSX
4714     P_SEP=:
4716     case "$host_cpu" in
4717     aarch64|arm64)
4718         if test "$enable_ios_simulator" = "yes"; then
4719             OS=iOS
4720         else
4721             CPUNAME=AARCH64
4722             RTL_ARCH=AARCH64
4723             PLATFORMID=macosx_arm64
4724         fi
4725         ;;
4726     x86_64)
4727         if test "$enable_ios_simulator" = "yes"; then
4728             OS=iOS
4729         fi
4730         CPUNAME=X86_64
4731         RTL_ARCH=X86_64
4732         PLATFORMID=macosx_x86_64
4733         ;;
4734     *)
4735         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4736         ;;
4737     esac
4738     ;;
4740 ios*)
4741     COM=GCC
4742     USING_X11=
4743     OS=iOS
4744     RTL_OS=iOS
4745     P_SEP=:
4747     case "$host_cpu" in
4748     aarch64|arm64)
4749         if test "$enable_ios_simulator" = "yes"; then
4750             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4751         fi
4752         ;;
4753     *)
4754         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4755         ;;
4756     esac
4757     CPUNAME=AARCH64
4758     RTL_ARCH=AARCH64
4759     PLATFORMID=ios_arm64
4760     ;;
4762 dragonfly*)
4763     COM=GCC
4764     USING_X11=TRUE
4765     OS=DRAGONFLY
4766     RTL_OS=DragonFly
4767     P_SEP=:
4769     case "$host_cpu" in
4770     i*86)
4771         CPUNAME=INTEL
4772         RTL_ARCH=x86
4773         PLATFORMID=dragonfly_x86
4774         ;;
4775     x86_64)
4776         CPUNAME=X86_64
4777         RTL_ARCH=X86_64
4778         PLATFORMID=dragonfly_x86_64
4779         ;;
4780     *)
4781         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4782         ;;
4783     esac
4784     ;;
4786 freebsd*)
4787     COM=GCC
4788     USING_X11=TRUE
4789     RTL_OS=FreeBSD
4790     OS=FREEBSD
4791     P_SEP=:
4793     case "$host_cpu" in
4794     aarch64)
4795         CPUNAME=AARCH64
4796         PLATFORMID=freebsd_aarch64
4797         RTL_ARCH=AARCH64
4798         ;;
4799     i*86)
4800         CPUNAME=INTEL
4801         RTL_ARCH=x86
4802         PLATFORMID=freebsd_x86
4803         ;;
4804     x86_64|amd64)
4805         CPUNAME=X86_64
4806         RTL_ARCH=X86_64
4807         PLATFORMID=freebsd_x86_64
4808         ;;
4809     powerpc64)
4810         CPUNAME=POWERPC64
4811         RTL_ARCH=PowerPC_64
4812         PLATFORMID=freebsd_powerpc64
4813         ;;
4814     powerpc|powerpcspe)
4815         CPUNAME=POWERPC
4816         RTL_ARCH=PowerPC
4817         PLATFORMID=freebsd_powerpc
4818         ;;
4819     *)
4820         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4821         ;;
4822     esac
4823     ;;
4825 haiku*)
4826     COM=GCC
4827     USING_X11=
4828     GUIBASE=haiku
4829     RTL_OS=Haiku
4830     OS=HAIKU
4831     P_SEP=:
4833     case "$host_cpu" in
4834     i*86)
4835         CPUNAME=INTEL
4836         RTL_ARCH=x86
4837         PLATFORMID=haiku_x86
4838         ;;
4839     x86_64|amd64)
4840         CPUNAME=X86_64
4841         RTL_ARCH=X86_64
4842         PLATFORMID=haiku_x86_64
4843         ;;
4844     *)
4845         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4846         ;;
4847     esac
4848     ;;
4850 kfreebsd*)
4851     COM=GCC
4852     USING_X11=TRUE
4853     OS=LINUX
4854     RTL_OS=kFreeBSD
4855     P_SEP=:
4857     case "$host_cpu" in
4859     i*86)
4860         CPUNAME=INTEL
4861         RTL_ARCH=x86
4862         PLATFORMID=kfreebsd_x86
4863         ;;
4864     x86_64)
4865         CPUNAME=X86_64
4866         RTL_ARCH=X86_64
4867         PLATFORMID=kfreebsd_x86_64
4868         ;;
4869     *)
4870         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4871         ;;
4872     esac
4873     ;;
4875 linux-gnu*)
4876     COM=GCC
4877     USING_X11=TRUE
4878     OS=LINUX
4879     RTL_OS=Linux
4880     P_SEP=:
4882     case "$host_cpu" in
4884     aarch64)
4885         CPUNAME=AARCH64
4886         PLATFORMID=linux_aarch64
4887         RTL_ARCH=AARCH64
4888         EPM_FLAGS="-a arm64"
4889         ;;
4890     alpha)
4891         CPUNAME=AXP
4892         RTL_ARCH=ALPHA
4893         PLATFORMID=linux_alpha
4894         ;;
4895     arm*)
4896         CPUNAME=ARM
4897         EPM_FLAGS="-a arm"
4898         RTL_ARCH=ARM_EABI
4899         PLATFORMID=linux_arm_eabi
4900         case "$host_cpu" in
4901         arm*-linux)
4902             RTL_ARCH=ARM_OABI
4903             PLATFORMID=linux_arm_oabi
4904             ;;
4905         esac
4906         ;;
4907     hppa)
4908         CPUNAME=HPPA
4909         RTL_ARCH=HPPA
4910         EPM_FLAGS="-a hppa"
4911         PLATFORMID=linux_hppa
4912         ;;
4913     i*86)
4914         CPUNAME=INTEL
4915         RTL_ARCH=x86
4916         PLATFORMID=linux_x86
4917         ;;
4918     ia64)
4919         CPUNAME=IA64
4920         RTL_ARCH=IA64
4921         PLATFORMID=linux_ia64
4922         ;;
4923     mips)
4924         CPUNAME=GODSON
4925         RTL_ARCH=MIPS_EB
4926         EPM_FLAGS="-a mips"
4927         PLATFORMID=linux_mips_eb
4928         ;;
4929     mips64)
4930         CPUNAME=GODSON64
4931         RTL_ARCH=MIPS64_EB
4932         EPM_FLAGS="-a mips64"
4933         PLATFORMID=linux_mips64_eb
4934         ;;
4935     mips64el)
4936         CPUNAME=GODSON64
4937         RTL_ARCH=MIPS64_EL
4938         EPM_FLAGS="-a mips64el"
4939         PLATFORMID=linux_mips64_el
4940         ;;
4941     mipsel)
4942         CPUNAME=GODSON
4943         RTL_ARCH=MIPS_EL
4944         EPM_FLAGS="-a mipsel"
4945         PLATFORMID=linux_mips_el
4946         ;;
4947     m68k)
4948         CPUNAME=M68K
4949         RTL_ARCH=M68K
4950         PLATFORMID=linux_m68k
4951         ;;
4952     powerpc)
4953         CPUNAME=POWERPC
4954         RTL_ARCH=PowerPC
4955         PLATFORMID=linux_powerpc
4956         ;;
4957     powerpc64)
4958         CPUNAME=POWERPC64
4959         RTL_ARCH=PowerPC_64
4960         PLATFORMID=linux_powerpc64
4961         ;;
4962     powerpc64le)
4963         CPUNAME=POWERPC64
4964         RTL_ARCH=PowerPC_64_LE
4965         PLATFORMID=linux_powerpc64_le
4966         ;;
4967     sparc)
4968         CPUNAME=SPARC
4969         RTL_ARCH=SPARC
4970         PLATFORMID=linux_sparc
4971         ;;
4972     sparc64)
4973         CPUNAME=SPARC64
4974         RTL_ARCH=SPARC64
4975         PLATFORMID=linux_sparc64
4976         ;;
4977     s390)
4978         CPUNAME=S390
4979         RTL_ARCH=S390
4980         PLATFORMID=linux_s390
4981         ;;
4982     s390x)
4983         CPUNAME=S390X
4984         RTL_ARCH=S390x
4985         PLATFORMID=linux_s390x
4986         ;;
4987     x86_64)
4988         CPUNAME=X86_64
4989         RTL_ARCH=X86_64
4990         PLATFORMID=linux_x86_64
4991         ;;
4992     *)
4993         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4994         ;;
4995     esac
4996     ;;
4998 linux-android*)
4999     COM=GCC
5000     USING_X11=
5001     OS=ANDROID
5002     RTL_OS=Android
5003     P_SEP=:
5005     case "$host_cpu" in
5007     arm|armel)
5008         CPUNAME=ARM
5009         RTL_ARCH=ARM_EABI
5010         PLATFORMID=android_arm_eabi
5011         ;;
5012     aarch64)
5013         CPUNAME=AARCH64
5014         RTL_ARCH=AARCH64
5015         PLATFORMID=android_aarch64
5016         ;;
5017     i*86)
5018         CPUNAME=INTEL
5019         RTL_ARCH=x86
5020         PLATFORMID=android_x86
5021         ;;
5022     x86_64)
5023         CPUNAME=X86_64
5024         RTL_ARCH=X86_64
5025         PLATFORMID=android_x86_64
5026         ;;
5027     *)
5028         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5029         ;;
5030     esac
5031     ;;
5033 *netbsd*)
5034     COM=GCC
5035     USING_X11=TRUE
5036     OS=NETBSD
5037     RTL_OS=NetBSD
5038     P_SEP=:
5040     case "$host_cpu" in
5041     i*86)
5042         CPUNAME=INTEL
5043         RTL_ARCH=x86
5044         PLATFORMID=netbsd_x86
5045         ;;
5046     powerpc)
5047         CPUNAME=POWERPC
5048         RTL_ARCH=PowerPC
5049         PLATFORMID=netbsd_powerpc
5050         ;;
5051     sparc)
5052         CPUNAME=SPARC
5053         RTL_ARCH=SPARC
5054         PLATFORMID=netbsd_sparc
5055         ;;
5056     x86_64)
5057         CPUNAME=X86_64
5058         RTL_ARCH=X86_64
5059         PLATFORMID=netbsd_x86_64
5060         ;;
5061     *)
5062         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5063         ;;
5064     esac
5065     ;;
5067 openbsd*)
5068     COM=GCC
5069     USING_X11=TRUE
5070     OS=OPENBSD
5071     RTL_OS=OpenBSD
5072     P_SEP=:
5074     case "$host_cpu" in
5075     i*86)
5076         CPUNAME=INTEL
5077         RTL_ARCH=x86
5078         PLATFORMID=openbsd_x86
5079         ;;
5080     x86_64)
5081         CPUNAME=X86_64
5082         RTL_ARCH=X86_64
5083         PLATFORMID=openbsd_x86_64
5084         ;;
5085     *)
5086         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5087         ;;
5088     esac
5089     SOLARINC="$SOLARINC -I/usr/local/include"
5090     ;;
5092 solaris*)
5093     COM=GCC
5094     USING_X11=TRUE
5095     OS=SOLARIS
5096     RTL_OS=Solaris
5097     P_SEP=:
5099     case "$host_cpu" in
5100     i*86)
5101         CPUNAME=INTEL
5102         RTL_ARCH=x86
5103         PLATFORMID=solaris_x86
5104         ;;
5105     sparc)
5106         CPUNAME=SPARC
5107         RTL_ARCH=SPARC
5108         PLATFORMID=solaris_sparc
5109         ;;
5110     sparc64)
5111         CPUNAME=SPARC64
5112         RTL_ARCH=SPARC64
5113         PLATFORMID=solaris_sparc64
5114         ;;
5115     *)
5116         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5117         ;;
5118     esac
5119     SOLARINC="$SOLARINC -I/usr/local/include"
5120     ;;
5123     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5124     ;;
5125 esac
5127 if test "$with_x" = "no"; then
5128     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5131 DISABLE_GUI=""
5132 if test "$enable_gui" = "no"; then
5133     if test "$USING_X11" != TRUE; then
5134         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5135     fi
5136     USING_X11=
5137     DISABLE_GUI=TRUE
5138     AC_DEFINE(HAVE_FEATURE_UI,0)
5139     test_cairo=yes
5141 AC_SUBST(DISABLE_GUI)
5143 WORKDIR="${BUILDDIR}/workdir"
5144 INSTDIR="${BUILDDIR}/instdir"
5145 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5146 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5147 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5148 AC_SUBST(COM)
5149 AC_SUBST(CPUNAME)
5150 AC_SUBST(RTL_OS)
5151 AC_SUBST(RTL_ARCH)
5152 AC_SUBST(EPM_FLAGS)
5153 AC_SUBST(USING_X11)
5154 AC_SUBST([INSTDIR])
5155 AC_SUBST([INSTROOT])
5156 AC_SUBST([INSTROOTBASE])
5157 AC_SUBST(OS)
5158 AC_SUBST(P_SEP)
5159 AC_SUBST(WORKDIR)
5160 AC_SUBST(PLATFORMID)
5161 AC_SUBST(WINDOWS_X64)
5162 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5164 dnl ===================================================================
5165 dnl Test which package format to use
5166 dnl ===================================================================
5167 AC_MSG_CHECKING([which package format to use])
5168 if test -n "$with_package_format" -a "$with_package_format" != no; then
5169     for i in $with_package_format; do
5170         case "$i" in
5171         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5172             ;;
5173         *)
5174             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5175 aix - AIX software distribution
5176 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5177 deb - Debian software distribution
5178 pkg - Solaris software distribution
5179 rpm - RedHat software distribution
5181 LibreOffice additionally supports:
5182 archive - .tar.gz or .zip
5183 dmg - macOS .dmg
5184 installed - installation tree
5185 msi - Windows .msi
5186         ])
5187             ;;
5188         esac
5189     done
5190     # fakeroot is needed to ensure correct file ownerships/permissions
5191     # inside deb packages and tar archives created on Linux and Solaris.
5192     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5193         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5194         if test "$FAKEROOT" = "no"; then
5195             AC_MSG_ERROR(
5196                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5197         fi
5198     fi
5199     PKGFORMAT="$with_package_format"
5200     AC_MSG_RESULT([$PKGFORMAT])
5201 else
5202     PKGFORMAT=
5203     AC_MSG_RESULT([none])
5205 AC_SUBST(PKGFORMAT)
5207 dnl ===================================================================
5208 dnl Set up a different compiler to produce tools to run on the build
5209 dnl machine when doing cross-compilation
5210 dnl ===================================================================
5212 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5213 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5214 if test "$cross_compiling" = "yes"; then
5215     AC_MSG_CHECKING([for BUILD platform configuration])
5216     echo
5217     rm -rf CONF-FOR-BUILD config_build.mk
5218     mkdir CONF-FOR-BUILD
5219     # Here must be listed all files needed when running the configure script. In particular, also
5220     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5221     # keep them in the same order as there.
5222     (cd $SRC_ROOT && tar cf - \
5223         config.guess \
5224         bin/get_config_variables \
5225         solenv/bin/getcompver.awk \
5226         solenv/inc/langlist.mk \
5227         download.lst \
5228         config_host.mk.in \
5229         config_host_lang.mk.in \
5230         Makefile.in \
5231         bin/bffvalidator.sh.in \
5232         bin/odfvalidator.sh.in \
5233         bin/officeotron.sh.in \
5234         hardened_runtime.xcent.in \
5235         instsetoo_native/util/openoffice.lst.in \
5236         setup_native/source/packinfo/finals_instsetoo.txt.in \
5237         config_host/*.in \
5238         sysui/desktop/macosx/Info.plist.in) \
5239     | (cd CONF-FOR-BUILD && tar xf -)
5240     cp configure CONF-FOR-BUILD
5241     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5242     (
5243     unset COM USING_X11 OS CPUNAME
5244     unset CC CXX SYSBASE CFLAGS
5245     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5246     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5247     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
5248     if test -n "$CC_FOR_BUILD"; then
5249         export CC="$CC_FOR_BUILD"
5250         CC_BASE=`first_arg_basename "$CC"`
5251     fi
5252     if test -n "$CXX_FOR_BUILD"; then
5253         export CXX="$CXX_FOR_BUILD"
5254         CXX_BASE=`first_arg_basename "$CXX"`
5255     fi
5256     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5257     cd CONF-FOR-BUILD
5259     sub_conf_opts=""
5260     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5261     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5262     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5263     if test -n "$ENABLE_JAVA"; then
5264         case "$_os" in
5265         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5266         Android)
5267             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5268             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5269             ;;
5270         *)
5271             if test -z "$with_jdk_home"; then
5272                 AC_MSG_ERROR([Missing host JDK! This can't be detected for the build OS, so you have to specify it with --with-jdk-home.])
5273             fi
5274             ;;
5275         esac
5276     else
5277         sub_conf_opts="$sub_conf_opts --without-java"
5278     fi
5279     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5280     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5281     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5283     # Don't bother having configure look for stuff not needed for the build platform anyway
5284     ./configure \
5285         --build="$build_alias" \
5286         --disable-cups \
5287         --disable-firebird-sdbc \
5288         --disable-gpgmepp \
5289         --disable-gstreamer-1-0 \
5290         --disable-gtk3 \
5291         --disable-mariadb-sdbc \
5292         --disable-online-update \
5293         --disable-opencl \
5294         --disable-pdfimport \
5295         --disable-postgresql-sdbc \
5296         --disable-skia \
5297         --enable-icecream="$enable_icecream" \
5298         --without-doxygen \
5299         --without-webdav \
5300         --with-parallelism="$with_parallelism" \
5301         --with-theme="$with_theme" \
5302         --with-tls=openssl \
5303         $sub_conf_opts \
5304         --srcdir=$srcdir \
5305         2>&1 | sed -e 's/^/    /'
5306     test -f ./config_host.mk 2>/dev/null || exit
5308     # filter permitted build targets
5309     PERMITTED_BUILD_TARGETS="
5310         AVMEDIA
5311         BOOST
5312         CLUCENE
5313         DBCONNECTIVITY
5314         DESKTOP
5315         DYNLOADING
5316         EPOXY
5317         EXPAT
5318         GLM
5319         GRAPHITE
5320         HARFBUZZ
5321         ICU
5322         LCMS2
5323         LIBJPEG_TURBO
5324         LIBLANGTAG
5325         LibO
5326         LIBFFI
5327         LIBPN
5328         LIBXML2
5329         LIBXSLT
5330         MDDS
5331         NATIVE
5332         OPENSSL
5333         ORCUS
5334         PYTHON
5335         SCRIPTING
5336         ZLIB
5338     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5339     # newlined lists, to use grep as a filter
5340     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5341     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5342     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5343     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5345     cp config_host.mk ../config_build.mk
5346     cp config_host_lang.mk ../config_build_lang.mk
5347     mv config.log ../config.Build.log
5348     mkdir -p ../config_build
5349     mv config_host/*.h ../config_build
5351     # all these will get a _FOR_BUILD postfix
5352     DIRECT_FOR_BUILD_SETTINGS="
5353         CC
5354         CXX
5355         ILIB
5356         JAVA_HOME
5357         JAVAIFLAGS
5358         JDK
5359         LIBO_BIN_FOLDER
5360         LIBO_LIB_FOLDER
5361         LIBO_URE_LIB_FOLDER
5362         LIBO_URE_MISC_FOLDER
5363         OS
5364         SDKDIRNAME
5365         SYSTEM_LIBXML
5366         SYSTEM_LIBXSLT
5368     # these overwrite host config with build config
5369     OVERWRITING_SETTINGS="
5370         ANT
5371         ANT_HOME
5372         ANT_LIB
5373         HSQLDB_USE_JDBC_4_1
5374         JAVA_CLASSPATH_NOT_SET
5375         JAVA_SOURCE_VER
5376         JAVA_TARGET_VER
5377         JAVACFLAGS
5378         JAVACOMPILER
5379         JAVADOC
5380         JAVADOCISGJDOC
5382     # these need some special handling
5383     EXTRA_HANDLED_SETTINGS="
5384         INSTDIR
5385         INSTROOT
5386         PATH
5387         WORKDIR
5389     OLD_PATH=$PATH
5390     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5391     BUILD_PATH=$PATH
5392     PATH=$OLD_PATH
5394     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5395     echo "$line" >>build-config
5397     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5398         VV='$'$V
5399         VV=`eval "echo $VV"`
5400         if test -n "$VV"; then
5401             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5402             echo "$line" >>build-config
5403         fi
5404     done
5406     for V in $OVERWRITING_SETTINGS; do
5407         VV='$'$V
5408         VV=`eval "echo $VV"`
5409         if test -n "$VV"; then
5410             line=${V}='${'${V}:-$VV'}'
5411             echo "$line" >>build-config
5412         fi
5413     done
5415     for V in INSTDIR INSTROOT WORKDIR; do
5416         VV='$'$V
5417         VV=`eval "echo $VV"`
5418         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5419         if test -n "$VV"; then
5420             line="${V}_FOR_BUILD='$VV'"
5421             echo "$line" >>build-config
5422         fi
5423     done
5425     )
5426     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
5427     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])
5428     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5429              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5431     eval `cat CONF-FOR-BUILD/build-config`
5433     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5435     rm -rf CONF-FOR-BUILD
5436 else
5437     OS_FOR_BUILD="$OS"
5438     CC_FOR_BUILD="$CC"
5439     CXX_FOR_BUILD="$CXX"
5440     INSTDIR_FOR_BUILD="$INSTDIR"
5441     INSTROOT_FOR_BUILD="$INSTROOT"
5442     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5443     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5444     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5445     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5446     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5447     WORKDIR_FOR_BUILD="$WORKDIR"
5449 AC_SUBST(OS_FOR_BUILD)
5450 AC_SUBST(INSTDIR_FOR_BUILD)
5451 AC_SUBST(INSTROOT_FOR_BUILD)
5452 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5453 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5454 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5455 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5456 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5457 AC_SUBST(WORKDIR_FOR_BUILD)
5458 AC_SUBST(CC_FOR_BUILD)
5459 AC_SUBST(CXX_FOR_BUILD)
5461 dnl ===================================================================
5462 dnl Check for syslog header
5463 dnl ===================================================================
5464 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5466 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5467 dnl ===================================================================
5468 AC_MSG_CHECKING([whether to turn warnings to errors])
5469 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5470     ENABLE_WERROR="TRUE"
5471     PYTHONWARNINGS="error"
5472     AC_MSG_RESULT([yes])
5473 else
5474     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5475         ENABLE_WERROR="TRUE"
5476         PYTHONWARNINGS="error"
5477         AC_MSG_RESULT([yes])
5478     else
5479         AC_MSG_RESULT([no])
5480     fi
5482 AC_SUBST(ENABLE_WERROR)
5483 AC_SUBST(PYTHONWARNINGS)
5485 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5486 dnl ===================================================================
5487 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5488 if test -z "$enable_assert_always_abort"; then
5489    if test "$ENABLE_DEBUG" = TRUE; then
5490        enable_assert_always_abort=yes
5491    else
5492        enable_assert_always_abort=no
5493    fi
5495 if test "$enable_assert_always_abort" = "yes"; then
5496     ASSERT_ALWAYS_ABORT="TRUE"
5497     AC_MSG_RESULT([yes])
5498 else
5499     ASSERT_ALWAYS_ABORT="FALSE"
5500     AC_MSG_RESULT([no])
5502 AC_SUBST(ASSERT_ALWAYS_ABORT)
5504 # Determine whether to use ooenv for the instdir installation
5505 # ===================================================================
5506 if test $_os != "WINNT" -a $_os != "Darwin"; then
5507     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5508     if test "$enable_ooenv" = "no"; then
5509         AC_MSG_RESULT([no])
5510     else
5511         ENABLE_OOENV="TRUE"
5512         AC_MSG_RESULT([yes])
5513     fi
5515 AC_SUBST(ENABLE_OOENV)
5517 if test "$USING_X11" != TRUE; then
5518     # be sure to do not mess with unneeded stuff
5519     test_randr=no
5520     test_xrender=no
5521     test_cups=no
5522     test_dbus=no
5523     build_gstreamer_1_0=no
5524     test_kf5=no
5525     test_qt5=no
5526     test_gtk3_kde5=no
5527     enable_cairo_canvas=no
5530 if test "$OS" = "HAIKU"; then
5531     enable_cairo_canvas=yes
5532     test_kf5=yes
5535 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5536     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!])
5537     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!"
5538     enable_kf5=yes
5541 if test "$test_kf5" = "yes"; then
5542     test_qt5=yes
5545 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5546     if test "$enable_qt5" = "no"; then
5547         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5548     else
5549         enable_qt5=yes
5550     fi
5553 dnl ===================================================================
5554 dnl check for cups support
5555 dnl ===================================================================
5556 ENABLE_CUPS=""
5558 if test "$enable_cups" = "no"; then
5559     test_cups=no
5562 AC_MSG_CHECKING([whether to enable CUPS support])
5563 if test "$test_cups" = "yes"; then
5564     ENABLE_CUPS="TRUE"
5565     AC_MSG_RESULT([yes])
5567     AC_MSG_CHECKING([whether cups support is present])
5568     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5569     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5570     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5571         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5572     fi
5574 else
5575     AC_MSG_RESULT([no])
5578 AC_SUBST(ENABLE_CUPS)
5580 # fontconfig checks
5581 if test "$test_fontconfig" = "yes"; then
5582     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5583     SYSTEM_FONTCONFIG=TRUE
5584     FilterLibs "${FONTCONFIG_LIBS}"
5585     FONTCONFIG_LIBS="${filteredlibs}"
5587 AC_SUBST(FONTCONFIG_CFLAGS)
5588 AC_SUBST(FONTCONFIG_LIBS)
5589 AC_SUBST([SYSTEM_FONTCONFIG])
5591 dnl whether to find & fetch external tarballs?
5592 dnl ===================================================================
5593 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5594    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5595        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5596    else
5597        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5598    fi
5600 if test -z "$TARFILE_LOCATION"; then
5601     if test -d "$SRC_ROOT/src" ; then
5602         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5603         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5604     fi
5605     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5606 else
5607     AbsolutePath "$TARFILE_LOCATION"
5608     PathFormat "${absolute_path}"
5609     TARFILE_LOCATION="${formatted_path}"
5611 AC_SUBST(TARFILE_LOCATION)
5613 AC_MSG_CHECKING([whether we want to fetch tarballs])
5614 if test "$enable_fetch_external" != "no"; then
5615     if test "$with_all_tarballs" = "yes"; then
5616         AC_MSG_RESULT([yes, all of them])
5617         DO_FETCH_TARBALLS="ALL"
5618     else
5619         AC_MSG_RESULT([yes, if we use them])
5620         DO_FETCH_TARBALLS="TRUE"
5621     fi
5622 else
5623     AC_MSG_RESULT([no])
5624     DO_FETCH_TARBALLS=
5626 AC_SUBST(DO_FETCH_TARBALLS)
5628 AC_MSG_CHECKING([whether to build help])
5629 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5630     BUILD_TYPE="$BUILD_TYPE HELP"
5631     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5632     case "$with_help" in
5633     "html")
5634         ENABLE_HTMLHELP=TRUE
5635         SCPDEFS="$SCPDEFS -DWITH_HELP"
5636         AC_MSG_RESULT([HTML])
5637         ;;
5638     "online")
5639         ENABLE_HTMLHELP=TRUE
5640         HELP_ONLINE=TRUE
5641         AC_MSG_RESULT([HTML])
5642         ;;
5643     yes)
5644         SCPDEFS="$SCPDEFS -DWITH_HELP"
5645         AC_MSG_RESULT([yes])
5646         ;;
5647     *)
5648         AC_MSG_ERROR([Unknown --with-help=$with_help])
5649         ;;
5650     esac
5651 else
5652     AC_MSG_RESULT([no])
5654 AC_SUBST([ENABLE_HTMLHELP])
5655 AC_SUBST([HELP_ONLINE])
5657 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5658 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5659     BUILD_TYPE="$BUILD_TYPE HELP"
5660     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5661     case "$with_omindex" in
5662     "server")
5663         ENABLE_HTMLHELP=TRUE
5664         HELP_ONLINE=TRUE
5665         HELP_OMINDEX_PAGE=TRUE
5666         AC_MSG_RESULT([SERVER])
5667         ;;
5668     "noxap")
5669         ENABLE_HTMLHELP=TRUE
5670         HELP_ONLINE=TRUE
5671         HELP_OMINDEX_PAGE=FALSE
5672         AC_MSG_RESULT([NOXAP])
5673         ;;
5674     *)
5675         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5676         ;;
5677     esac
5678 else
5679     HELP_OMINDEX_PAGE=FALSE
5680     AC_MSG_RESULT([no])
5682 AC_SUBST([ENABLE_HTMLHELP])
5683 AC_SUBST([HELP_OMINDEX_PAGE])
5684 AC_SUBST([HELP_ONLINE])
5687 dnl Test whether to include MySpell dictionaries
5688 dnl ===================================================================
5689 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5690 if test "$with_myspell_dicts" = "yes"; then
5691     AC_MSG_RESULT([yes])
5692     WITH_MYSPELL_DICTS=TRUE
5693     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5694     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5695 else
5696     AC_MSG_RESULT([no])
5697     WITH_MYSPELL_DICTS=
5699 AC_SUBST(WITH_MYSPELL_DICTS)
5701 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5702 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5703     if test "$with_system_dicts" = yes; then
5704         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5705     fi
5706     with_system_dicts=no
5709 AC_MSG_CHECKING([whether to use dicts from external paths])
5710 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5711     AC_MSG_RESULT([yes])
5712     SYSTEM_DICTS=TRUE
5713     AC_MSG_CHECKING([for spelling dictionary directory])
5714     if test -n "$with_external_dict_dir"; then
5715         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5716     else
5717         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5718         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5719             DICT_SYSTEM_DIR=file:///usr/share/myspell
5720         fi
5721     fi
5722     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5723     AC_MSG_CHECKING([for hyphenation patterns directory])
5724     if test -n "$with_external_hyph_dir"; then
5725         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5726     else
5727         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5728     fi
5729     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5730     AC_MSG_CHECKING([for thesaurus directory])
5731     if test -n "$with_external_thes_dir"; then
5732         THES_SYSTEM_DIR=file://$with_external_thes_dir
5733     else
5734         THES_SYSTEM_DIR=file:///usr/share/mythes
5735     fi
5736     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5737 else
5738     AC_MSG_RESULT([no])
5739     SYSTEM_DICTS=
5741 AC_SUBST(SYSTEM_DICTS)
5742 AC_SUBST(DICT_SYSTEM_DIR)
5743 AC_SUBST(HYPH_SYSTEM_DIR)
5744 AC_SUBST(THES_SYSTEM_DIR)
5746 dnl ===================================================================
5747 dnl Precompiled headers.
5748 ENABLE_PCH=""
5749 AC_MSG_CHECKING([whether to enable pch feature])
5750 if test -z "$enable_pch"; then
5751     if test "$_os" = "WINNT"; then
5752         # Enabled by default on Windows.
5753         enable_pch=yes
5754     else
5755         enable_pch=no
5756     fi
5758 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5759     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5761 if test "$enable_pch" = "system"; then
5762     ENABLE_PCH="1"
5763     AC_MSG_RESULT([yes (system headers)])
5764 elif test "$enable_pch" = "base"; then
5765     ENABLE_PCH="2"
5766     AC_MSG_RESULT([yes (system and base headers)])
5767 elif test "$enable_pch" = "normal"; then
5768     ENABLE_PCH="3"
5769     AC_MSG_RESULT([yes (normal)])
5770 elif test "$enable_pch" = "full"; then
5771     ENABLE_PCH="4"
5772     AC_MSG_RESULT([yes (full)])
5773 elif test "$enable_pch" = "yes"; then
5774     # Pick a suitable default.
5775     if test "$GCC" = "yes"; then
5776         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5777         # while making the PCHs larger and rebuilds more likely.
5778         ENABLE_PCH="2"
5779         AC_MSG_RESULT([yes (system and base headers)])
5780     else
5781         # With MSVC the highest level makes a significant difference,
5782         # and it was the default when there used to be no PCH levels.
5783         ENABLE_PCH="4"
5784         AC_MSG_RESULT([yes (full)])
5785     fi
5786 elif test "$enable_pch" = "no"; then
5787     AC_MSG_RESULT([no])
5788 else
5789     AC_MSG_ERROR([Unknown value for --enable-pch])
5791 AC_SUBST(ENABLE_PCH)
5792 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5793 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5794     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5795     if test "$CCACHE_BIN" != "not found"; then
5796         AC_MSG_CHECKING([ccache version])
5797         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5798         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5799         AC_MSG_RESULT([$CCACHE_VERSION])
5800         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5801         if test "$CCACHE_NUMVER" -gt "030701"; then
5802             AC_MSG_RESULT([yes])
5803         else
5804             AC_MSG_RESULT([no (not newer than 3.7.1)])
5805             CCACHE_DEPEND_MODE=
5806         fi
5807     fi
5810 PCH_INSTANTIATE_TEMPLATES=
5811 if test -n "$ENABLE_PCH"; then
5812     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5813     save_CFLAGS=$CFLAGS
5814     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5815     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5816     CFLAGS=$save_CFLAGS
5817     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5818         AC_MSG_RESULT(yes)
5819     else
5820         AC_MSG_RESULT(no)
5821     fi
5823 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5825 BUILDING_PCH_WITH_OBJ=
5826 if test -n "$ENABLE_PCH"; then
5827     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5828     save_CFLAGS=$CFLAGS
5829     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5830     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5831     CFLAGS=$save_CFLAGS
5832     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5833         AC_MSG_RESULT(yes)
5834     else
5835         AC_MSG_RESULT(no)
5836     fi
5838 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5840 PCH_CODEGEN=
5841 PCH_NO_CODEGEN=
5842 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5843     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5844     save_CFLAGS=$CFLAGS
5845     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5846     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5847         [
5848         PCH_CODEGEN="-fpch-codegen"
5849         PCH_NO_CODEGEN="-fno-pch-codegen"
5850         ],[])
5851     CFLAGS=$save_CFLAGS
5852     if test -n "$PCH_CODEGEN"; then
5853         AC_MSG_RESULT(yes)
5854     else
5855         AC_MSG_RESULT(no)
5856     fi
5858 AC_SUBST(PCH_CODEGEN)
5859 AC_SUBST(PCH_NO_CODEGEN)
5860 PCH_DEBUGINFO=
5861 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5862     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5863     save_CFLAGS=$CFLAGS
5864     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5865     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5866     CFLAGS=$save_CFLAGS
5867     if test -n "$PCH_DEBUGINFO"; then
5868         AC_MSG_RESULT(yes)
5869     else
5870         AC_MSG_RESULT(no)
5871     fi
5873 AC_SUBST(PCH_DEBUGINFO)
5875 TAB=`printf '\t'`
5877 AC_MSG_CHECKING([the GNU Make version])
5878 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5879 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5880 if test "$_make_longver" -ge "038200"; then
5881     AC_MSG_RESULT([$GNUMAKE $_make_version])
5883 elif test "$_make_longver" -ge "038100"; then
5884     if test "$build_os" = "cygwin"; then
5885         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5886     fi
5887     AC_MSG_RESULT([$GNUMAKE $_make_version])
5889     dnl ===================================================================
5890     dnl Search all the common names for sha1sum
5891     dnl ===================================================================
5892     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5893     if test -z "$SHA1SUM"; then
5894         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5895     elif test "$SHA1SUM" = "openssl"; then
5896         SHA1SUM="openssl sha1"
5897     fi
5898     AC_MSG_CHECKING([for GNU Make bug 20033])
5899     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5900     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5901 A := \$(wildcard *.a)
5903 .PHONY: all
5904 all: \$(A:.a=.b)
5905 <TAB>@echo survived bug20033.
5907 .PHONY: setup
5908 setup:
5909 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5911 define d1
5912 @echo lala \$(1)
5913 @sleep 1
5914 endef
5916 define d2
5917 @echo tyty \$(1)
5918 @sleep 1
5919 endef
5921 %.b : %.a
5922 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5923 <TAB>\$(call d1,\$(CHECKSUM)),\
5924 <TAB>\$(call d2,\$(CHECKSUM)))
5926     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5927         no_parallelism_make="YES"
5928         AC_MSG_RESULT([yes, disable parallelism])
5929     else
5930         AC_MSG_RESULT([no, keep parallelism enabled])
5931     fi
5932     rm -rf $TESTGMAKEBUG20033
5933 else
5934     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5937 # find if gnumake support file function
5938 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5939 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5940 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5941     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5943 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5944 \$(file >test.txt,Success )
5946 .PHONY: all
5947 all:
5948 <TAB>@cat test.txt
5951 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5952 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5953     HAVE_GNUMAKE_FILE_FUNC=TRUE
5954     AC_MSG_RESULT([yes])
5955 else
5956     AC_MSG_RESULT([no])
5958 rm -rf $TESTGMAKEFILEFUNC
5959 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5961 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5962 STALE_MAKE=
5963 if test "$_make_ver_check" = ""; then
5964    STALE_MAKE=TRUE
5967 HAVE_LD_HASH_STYLE=FALSE
5968 WITH_LINKER_HASH_STYLE=
5969 AC_MSG_CHECKING([for --hash-style gcc linker support])
5970 if test "$GCC" = "yes"; then
5971     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5972         hash_styles="gnu sysv"
5973     elif test "$with_linker_hash_style" = "no"; then
5974         hash_styles=
5975     else
5976         hash_styles="$with_linker_hash_style"
5977     fi
5979     for hash_style in $hash_styles; do
5980         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5981         hash_style_ldflags_save=$LDFLAGS
5982         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5984         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5985             [
5986 #include <stdio.h>
5987             ],[
5988 printf ("");
5989             ])],
5990             [
5991                   HAVE_LD_HASH_STYLE=TRUE
5992                   WITH_LINKER_HASH_STYLE=$hash_style
5993             ],
5994             [HAVE_LD_HASH_STYLE=FALSE],
5995             [HAVE_LD_HASH_STYLE=FALSE])
5996         LDFLAGS=$hash_style_ldflags_save
5997     done
5999     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6000         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6001     else
6002         AC_MSG_RESULT( no )
6003     fi
6004     LDFLAGS=$hash_style_ldflags_save
6005 else
6006     AC_MSG_RESULT( no )
6008 AC_SUBST(HAVE_LD_HASH_STYLE)
6009 AC_SUBST(WITH_LINKER_HASH_STYLE)
6011 dnl ===================================================================
6012 dnl Check whether there's a Perl version available.
6013 dnl ===================================================================
6014 if test -z "$with_perl_home"; then
6015     AC_PATH_PROG(PERL, perl)
6016 else
6017     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6018     _perl_path="$with_perl_home/bin/perl"
6019     if test -x "$_perl_path"; then
6020         PERL=$_perl_path
6021     else
6022         AC_MSG_ERROR([$_perl_path not found])
6023     fi
6026 dnl ===================================================================
6027 dnl Testing for Perl version 5 or greater.
6028 dnl $] is the Perl version variable, it is returned as an integer
6029 dnl ===================================================================
6030 if test "$PERL"; then
6031     AC_MSG_CHECKING([the Perl version])
6032     ${PERL} -e "exit($]);"
6033     _perl_version=$?
6034     if test "$_perl_version" -lt 5; then
6035         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6036     fi
6037     AC_MSG_RESULT([Perl $_perl_version])
6038 else
6039     AC_MSG_ERROR([Perl not found, install Perl 5])
6042 dnl ===================================================================
6043 dnl Testing for required Perl modules
6044 dnl ===================================================================
6046 AC_MSG_CHECKING([for required Perl modules])
6047 perl_use_string="use Cwd ; use Digest::MD5"
6048 if test "$_os" = "WINNT"; then
6049     if test -n "$PKGFORMAT"; then
6050         for i in $PKGFORMAT; do
6051             case "$i" in
6052             msi)
6053                 # for getting fonts versions to use in MSI
6054                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6055                 ;;
6056             esac
6057         done
6058     fi
6060 if test "$with_system_hsqldb" = "yes"; then
6061     perl_use_string="$perl_use_string ; use Archive::Zip"
6063 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6064     # OpenSSL needs that to build
6065     perl_use_string="$perl_use_string ; use FindBin"
6067 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6068     AC_MSG_RESULT([all modules found])
6069 else
6070     AC_MSG_RESULT([failed to find some modules])
6071     # Find out which modules are missing.
6072     for i in $perl_use_string; do
6073         if test "$i" != "use" -a "$i" != ";"; then
6074             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6075                 missing_perl_modules="$missing_perl_modules $i"
6076             fi
6077         fi
6078     done
6079     AC_MSG_ERROR([
6080     The missing Perl modules are: $missing_perl_modules
6081     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6084 dnl ===================================================================
6085 dnl Check for pkg-config
6086 dnl ===================================================================
6087 if test "$_os" != "WINNT"; then
6088     PKG_PROG_PKG_CONFIG
6091 if test "$_os" != "WINNT"; then
6093     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6094     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6095     # explicitly. Or put /path/to/compiler in PATH yourself.
6097     # Use wrappers for LTO
6098     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6099         AC_CHECK_TOOL(AR,gcc-ar)
6100         AC_CHECK_TOOL(NM,gcc-nm)
6101         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6102     else
6103         AC_CHECK_TOOL(AR,ar)
6104         AC_CHECK_TOOL(NM,nm)
6105         AC_CHECK_TOOL(RANLIB,ranlib)
6106     fi
6107     AC_CHECK_TOOL(OBJDUMP,objdump)
6108     AC_CHECK_TOOL(READELF,readelf)
6109     AC_CHECK_TOOL(STRIP,strip)
6110     if test "$_os" = "WINNT"; then
6111         AC_CHECK_TOOL(DLLTOOL,dlltool)
6112         AC_CHECK_TOOL(WINDRES,windres)
6113     fi
6115 AC_SUBST(AR)
6116 AC_SUBST(DLLTOOL)
6117 AC_SUBST(NM)
6118 AC_SUBST(OBJDUMP)
6119 AC_SUBST(PKG_CONFIG)
6120 AC_SUBST(RANLIB)
6121 AC_SUBST(READELF)
6122 AC_SUBST(STRIP)
6123 AC_SUBST(WINDRES)
6125 dnl ===================================================================
6126 dnl pkg-config checks on macOS
6127 dnl ===================================================================
6129 if test $_os = Darwin; then
6130     AC_MSG_CHECKING([for bogus pkg-config])
6131     if test -n "$PKG_CONFIG"; then
6132         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6133             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6134         else
6135             if test "$enable_bogus_pkg_config" = "yes"; then
6136                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6137             else
6138                 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.])
6139             fi
6140         fi
6141     else
6142         AC_MSG_RESULT([no, good])
6143     fi
6146 find_csc()
6148     # Return value: $csctest
6150     unset csctest
6152     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6153     if test -n "$regvalue"; then
6154         csctest=$regvalue
6155         return
6156     fi
6159 find_al()
6161     # Return value: $altest
6163     unset altest
6165     # We need this check to detect 4.6.1 or above.
6166     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6167         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6168         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6169             altest=$regvalue
6170             return
6171         fi
6172     done
6174     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6175         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6176         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6177             altest=$regvalue
6178             return
6179         fi
6180     done
6183 find_dotnetsdk46()
6185     unset frametest
6187     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6188         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6189         if test -n "$regvalue"; then
6190             frametest=$regvalue
6191             return
6192         fi
6193     done
6196 find_winsdk_version()
6198     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6199     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6201     unset winsdktest winsdkbinsubdir winsdklibsubdir
6203     case "$1" in
6204     8.0|8.0A)
6205         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6206         if test -n "$regvalue"; then
6207             winsdktest=$regvalue
6208             winsdklibsubdir=win8
6209             return
6210         fi
6211         ;;
6212     8.1|8.1A)
6213         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6214         if test -n "$regvalue"; then
6215             winsdktest=$regvalue
6216             winsdklibsubdir=winv6.3
6217             return
6218         fi
6219         ;;
6220     10.0)
6221         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6222         if test -n "$regvalue"; then
6223             winsdktest=$regvalue
6224             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6225             if test -n "$regvalue"; then
6226                 winsdkbinsubdir="$regvalue".0
6227                 winsdklibsubdir=$winsdkbinsubdir
6228                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6229                 local tmppath_unix=$(cygpath -u "$tmppath")
6230                 # test exist the SDK path
6231                 if test -d "$tmppath_unix"; then
6232                    # when path is convertible to a short path then path is okay
6233                    cygpath -d "$tmppath" >/dev/null 2>&1
6234                    if test $? -ne 0; then
6235                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6236                    fi
6237                 else
6238                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6239                 fi
6240             fi
6241             return
6242         fi
6243         ;;
6244     esac
6247 find_winsdk()
6249     # Return value: From find_winsdk_version
6251     unset winsdktest
6253     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6254         find_winsdk_version $ver
6255         if test -n "$winsdktest"; then
6256             return
6257         fi
6258     done
6261 find_msms()
6263     # Return value: $msmdir
6265     AC_MSG_CHECKING([for MSVC merge modules directory])
6266     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6267     local my_msm_dir
6269     case "$VCVER" in
6270         160)
6271         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6272         ;;
6273     esac
6274     for f in $my_msm_files; do
6275         echo "$as_me:$LINENO: searching for $f" >&5
6276     done
6278     msmdir=
6279     for ver in 14.0 15.0; do
6280         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6281         if test -n "$regvalue"; then
6282             for f in ${my_msm_files}; do
6283                 if test -e "$regvalue/${f}"; then
6284                     msmdir=$regvalue
6285                     break
6286                 fi
6287             done
6288         fi
6289     done
6290     dnl Is the following fallback really necessary, or was it added in response
6291     dnl to never having started Visual Studio on a given machine, so the
6292     dnl registry keys checked above had presumably not yet been created?
6293     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6294     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6295     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6296     dnl expanding to "C:\Program Files\Common Files"), which would need
6297     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6298     dnl obtain its value from cygwin:
6299     if test -z "$msmdir"; then
6300         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6301         for f in ${my_msm_files}; do
6302             if test -e "$my_msm_dir/${f}"; then
6303                 msmdir=$my_msm_dir
6304             fi
6305         done
6306     fi
6308     dnl Starting from MSVC 15.0, merge modules are located in different directory
6309     case "$VCVER" in
6310     160)
6311         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6312             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6313             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6314             for f in ${my_msm_files}; do
6315                 if test -e "$my_msm_dir/${f}"; then
6316                     msmdir=$my_msm_dir
6317                     break
6318                 fi
6319             done
6320         done
6321         ;;
6322     esac
6324     if test -n "$msmdir"; then
6325         msmdir=`cygpath -m "$msmdir"`
6326         AC_MSG_RESULT([$msmdir])
6327     else
6328         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6329             AC_MSG_FAILURE([not found])
6330         else
6331             AC_MSG_WARN([not found (check config.log)])
6332             add_warning "MSM none of ${my_msm_files} found"
6333         fi
6334     fi
6337 find_msvc_x64_dlls()
6339     # Return value: $msvcdllpath, $msvcdlls
6341     AC_MSG_CHECKING([for MSVC x64 DLL path])
6342     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6343     case "$VCVER" in
6344     160)
6345         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6346             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6347             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6348                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6349                 break
6350             fi
6351             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6352             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6353                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6354                 break
6355             fi
6356         done
6357         ;;
6358     esac
6359     AC_MSG_RESULT([$msvcdllpath])
6360     AC_MSG_CHECKING([for MSVC x64 DLLs])
6361     msvcdlls="msvcp140.dll vcruntime140.dll"
6362     for dll in $msvcdlls; do
6363         if ! test -f "$msvcdllpath/$dll"; then
6364             AC_MSG_FAILURE([missing $dll])
6365         fi
6366     done
6367     AC_MSG_RESULT([found all ($msvcdlls)])
6370 dnl =========================================
6371 dnl Check for the Windows  SDK.
6372 dnl =========================================
6373 if test "$_os" = "WINNT"; then
6374     AC_MSG_CHECKING([for Windows SDK])
6375     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6376         find_winsdk
6377         WINDOWS_SDK_HOME=$winsdktest
6379         # normalize if found
6380         if test -n "$WINDOWS_SDK_HOME"; then
6381             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6382             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6383         fi
6385         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6386     fi
6388     if test -n "$WINDOWS_SDK_HOME"; then
6389         # Remove a possible trailing backslash
6390         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6392         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6393              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6394              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6395             have_windows_sdk_headers=yes
6396         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6397              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6398              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6399             have_windows_sdk_headers=yes
6400         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6401              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6402              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6403             have_windows_sdk_headers=yes
6404         else
6405             have_windows_sdk_headers=no
6406         fi
6408         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6409             have_windows_sdk_libs=yes
6410         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6411             have_windows_sdk_libs=yes
6412         else
6413             have_windows_sdk_libs=no
6414         fi
6416         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6417             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6418 the  Windows SDK are installed.])
6419         fi
6420     fi
6422     if test -z "$WINDOWS_SDK_HOME"; then
6423         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6424     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6425         WINDOWS_SDK_VERSION=80
6426         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6427     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6428         WINDOWS_SDK_VERSION=81
6429         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6430     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6431         WINDOWS_SDK_VERSION=10
6432         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6433     else
6434         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6435     fi
6436     PathFormat "$WINDOWS_SDK_HOME"
6437     WINDOWS_SDK_HOME="$formatted_path"
6438     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6439     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6440         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6441         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6442             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6443         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6444             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6445         fi
6446     fi
6448     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6449     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6450     dnl but not in v8.0), so allow this to be overridden with a
6451     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6452     dnl and configuration error if no WiLangId.vbs is found would arguably be
6453     dnl better, but I do not know under which conditions exactly it is needed by
6454     dnl msiglobal.pm:
6455     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6456         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6457         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6458         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6459             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6460             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6461         fi
6462         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6463             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6464             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6465         fi
6466         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6467             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6468             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6469         fi
6470     fi
6471     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6472         if test -n "$with_package_format" -a "$with_package_format" != no; then
6473             for i in "$with_package_format"; do
6474                 if test "$i" = "msi"; then
6475                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6476                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6477                     fi
6478                 fi
6479             done
6480         fi
6481     fi
6483 AC_SUBST(WINDOWS_SDK_HOME)
6484 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6485 AC_SUBST(WINDOWS_SDK_VERSION)
6486 AC_SUBST(WINDOWS_SDK_WILANGID)
6488 if test "$build_os" = "cygwin"; then
6489     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6490     dnl dir, it also determines that dir's path w/o an arch segment if any,
6491     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6492     AC_MSG_CHECKING([for midl.exe])
6494     find_winsdk
6495     if test -n "$winsdkbinsubdir" \
6496         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6497     then
6498         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6499         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6500     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6501         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6502         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6503     elif test -f "$winsdktest/Bin/midl.exe"; then
6504         MIDL_PATH=$winsdktest/Bin
6505         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6506     fi
6507     if test ! -f "$MIDL_PATH/midl.exe"; then
6508         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6509     else
6510         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6511     fi
6513     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6514     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6516     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6517          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6518          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6519          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6520     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6521          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6522          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6523          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6524     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6525          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6526          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6527          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6528     else
6529         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6530     fi
6532     dnl Check csc.exe
6533     AC_MSG_CHECKING([for csc.exe])
6534     find_csc
6535     if test -f "$csctest/csc.exe"; then
6536         CSC_PATH="$csctest"
6537     fi
6538     if test ! -f "$CSC_PATH/csc.exe"; then
6539         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6540     else
6541         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6542     fi
6544     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6546     dnl Check al.exe
6547     AC_MSG_CHECKING([for al.exe])
6548     find_winsdk
6549     if test -n "$winsdkbinsubdir" \
6550         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6551     then
6552         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6553     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6554         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6555     elif test -f "$winsdktest/Bin/al.exe"; then
6556         AL_PATH="$winsdktest/Bin"
6557     fi
6559     if test -z "$AL_PATH"; then
6560         find_al
6561         if test -f "$altest/bin/al.exe"; then
6562             AL_PATH="$altest/bin"
6563         elif test -f "$altest/al.exe"; then
6564             AL_PATH="$altest"
6565         fi
6566     fi
6567     if test ! -f "$AL_PATH/al.exe"; then
6568         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6569     else
6570         AC_MSG_RESULT([$AL_PATH/al.exe])
6571     fi
6573     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6575     dnl Check mscoree.lib / .NET Framework dir
6576     AC_MSG_CHECKING(.NET Framework)
6577     find_dotnetsdk46
6578     PathFormat "$frametest"
6579     frametest="$formatted_path"
6580     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6581         DOTNET_FRAMEWORK_HOME="$frametest"
6582     else
6583         find_winsdk
6584         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6585             DOTNET_FRAMEWORK_HOME="$winsdktest"
6586         fi
6587     fi
6588     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6589         AC_MSG_ERROR([mscoree.lib not found])
6590     fi
6591     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6593     PathFormat "$MIDL_PATH"
6594     MIDL_PATH="$formatted_path"
6596     PathFormat "$AL_PATH"
6597     AL_PATH="$formatted_path"
6599     PathFormat "$DOTNET_FRAMEWORK_HOME"
6600     DOTNET_FRAMEWORK_HOME="$formatted_path"
6602     PathFormat "$CSC_PATH"
6603     CSC_PATH="$formatted_path"
6606 dnl ===================================================================
6607 dnl Testing for C++ compiler and version...
6608 dnl ===================================================================
6610 if test "$_os" != "WINNT"; then
6611     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6612     save_CXXFLAGS=$CXXFLAGS
6613     AC_PROG_CXX
6614     CXXFLAGS=$save_CXXFLAGS
6615     if test -z "$CXX_BASE"; then
6616         CXX_BASE=`first_arg_basename "$CXX"`
6617     fi
6620 dnl check for GNU C++ compiler version
6621 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6622     AC_MSG_CHECKING([the GNU C++ compiler version])
6624     _gpp_version=`$CXX -dumpversion`
6625     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6627     if test "$_gpp_majmin" -lt "700"; then
6628         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6629     else
6630         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6631     fi
6633     dnl see https://code.google.com/p/android/issues/detail?id=41770
6634         glibcxx_threads=no
6635         AC_LANG_PUSH([C++])
6636         AC_REQUIRE_CPP
6637         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6638         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6639             #include <bits/c++config.h>]],[[
6640             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6641             && !defined(_GLIBCXX__PTHREADS) \
6642             && !defined(_GLIBCXX_HAS_GTHREADS)
6643             choke me
6644             #endif
6645         ]])],[AC_MSG_RESULT([yes])
6646         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6647         AC_LANG_POP([C++])
6648         if test $glibcxx_threads = yes; then
6649             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6650         fi
6652 AC_SUBST(BOOST_CXXFLAGS)
6655 # prefx CXX with ccache if needed
6657 if test "$CCACHE" != ""; then
6658     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6659     AC_LANG_PUSH([C++])
6660     save_CXXFLAGS=$CXXFLAGS
6661     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6662     dnl an empty program will do, we're checking the compiler flags
6663     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6664                       [use_ccache=yes], [use_ccache=no])
6665     if test $use_ccache = yes; then
6666         AC_MSG_RESULT([yes])
6667     else
6668         CXX="$CCACHE $CXX"
6669         CXX_BASE="ccache $CXX_BASE"
6670         AC_MSG_RESULT([no])
6671     fi
6672     CXXFLAGS=$save_CXXFLAGS
6673     AC_LANG_POP([C++])
6676 dnl ===================================================================
6677 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6678 dnl ===================================================================
6680 if test "$_os" != "WINNT"; then
6681     AC_PROG_CXXCPP
6683     dnl Check whether there's a C pre-processor.
6684     AC_PROG_CPP
6688 dnl ===================================================================
6689 dnl Find integral type sizes and alignments
6690 dnl ===================================================================
6692 if test "$_os" != "WINNT"; then
6694     AC_CHECK_SIZEOF(long)
6695     AC_CHECK_SIZEOF(short)
6696     AC_CHECK_SIZEOF(int)
6697     AC_CHECK_SIZEOF(long long)
6698     AC_CHECK_SIZEOF(double)
6699     AC_CHECK_SIZEOF(void*)
6700     AC_CHECK_SIZEOF(size_t)
6702     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6703     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6704     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6705     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6706     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6707     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
6709     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6710     m4_pattern_allow([AC_CHECK_ALIGNOF])
6711     m4_ifdef([AC_CHECK_ALIGNOF],
6712         [
6713             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6714             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6715             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6716             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6717         ],
6718         [
6719             case "$_os-$host_cpu" in
6720             Linux-i686)
6721                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6722                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6723                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6724                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6725                 ;;
6726             Linux-x86_64)
6727                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6728                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6729                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6730                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6731                 ;;
6732             *)
6733                 if test -z "$ac_cv_alignof_short" -o \
6734                         -z "$ac_cv_alignof_int" -o \
6735                         -z "$ac_cv_alignof_long" -o \
6736                         -z "$ac_cv_alignof_double"; then
6737                    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.])
6738                 fi
6739                 ;;
6740             esac
6741         ])
6743     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6744     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6745     if test $ac_cv_sizeof_long -eq 8; then
6746         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6747     elif test $ac_cv_sizeof_double -eq 8; then
6748         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6749     else
6750         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6751     fi
6753     dnl Check for large file support
6754     AC_SYS_LARGEFILE
6755     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6756         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6757     fi
6758     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6759         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6760     fi
6761 else
6762     # Hardcode for MSVC
6763     SAL_TYPES_SIZEOFSHORT=2
6764     SAL_TYPES_SIZEOFINT=4
6765     SAL_TYPES_SIZEOFLONG=4
6766     SAL_TYPES_SIZEOFLONGLONG=8
6767     if test $WIN_HOST_BITS -eq 32; then
6768         SAL_TYPES_SIZEOFPOINTER=4
6769         SIZEOF_SIZE_T=4
6770     else
6771         SAL_TYPES_SIZEOFPOINTER=8
6772         SIZEOF_SIZE_T=8
6773     fi
6774     SAL_TYPES_ALIGNMENT2=2
6775     SAL_TYPES_ALIGNMENT4=4
6776     SAL_TYPES_ALIGNMENT8=8
6777     LFS_CFLAGS=''
6779 AC_SUBST(LFS_CFLAGS)
6780 AC_SUBST(SIZEOF_SIZE_T)
6782 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6783 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6784 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6785 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6786 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6787 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6788 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6789 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6791 dnl ===================================================================
6792 dnl Check whether to enable runtime optimizations
6793 dnl ===================================================================
6794 ENABLE_RUNTIME_OPTIMIZATIONS=
6795 AC_MSG_CHECKING([whether to enable runtime optimizations])
6796 if test -z "$enable_runtime_optimizations"; then
6797     for i in $CC; do
6798         case $i in
6799         -fsanitize=*)
6800             enable_runtime_optimizations=no
6801             break
6802             ;;
6803         esac
6804     done
6806 if test "$enable_runtime_optimizations" != no; then
6807     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6808     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6809     AC_MSG_RESULT([yes])
6810 else
6811     AC_MSG_RESULT([no])
6813 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6815 dnl ===================================================================
6816 dnl Check if valgrind headers are available
6817 dnl ===================================================================
6818 ENABLE_VALGRIND=
6819 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6820     prev_cppflags=$CPPFLAGS
6821     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6822     # or where does it come from?
6823     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6824     AC_CHECK_HEADER([valgrind/valgrind.h],
6825         [ENABLE_VALGRIND=TRUE])
6826     CPPFLAGS=$prev_cppflags
6828 AC_SUBST([ENABLE_VALGRIND])
6829 if test -z "$ENABLE_VALGRIND"; then
6830     if test "$with_valgrind" = yes; then
6831         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6832     fi
6833     VALGRIND_CFLAGS=
6835 AC_SUBST([VALGRIND_CFLAGS])
6838 dnl ===================================================================
6839 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6840 dnl ===================================================================
6842 # We need at least the sys/sdt.h include header.
6843 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6844 if test "$SDT_H_FOUND" = "TRUE"; then
6845     # Found sys/sdt.h header, now make sure the c++ compiler works.
6846     # Old g++ versions had problems with probes in constructors/destructors.
6847     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6848     AC_LANG_PUSH([C++])
6849     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6850     #include <sys/sdt.h>
6851     class ProbeClass
6852     {
6853     private:
6854       int& ref;
6855       const char *name;
6857     public:
6858       ProbeClass(int& v, const char *n) : ref(v), name(n)
6859       {
6860         DTRACE_PROBE2(_test_, cons, name, ref);
6861       }
6863       void method(int min)
6864       {
6865         DTRACE_PROBE3(_test_, meth, name, ref, min);
6866         ref -= min;
6867       }
6869       ~ProbeClass()
6870       {
6871         DTRACE_PROBE2(_test_, dest, name, ref);
6872       }
6873     };
6874     ]],[[
6875     int i = 64;
6876     DTRACE_PROBE1(_test_, call, i);
6877     ProbeClass inst = ProbeClass(i, "call");
6878     inst.method(24);
6879     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6880           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6881     AC_LANG_POP([C++])
6883 AC_CONFIG_HEADERS([config_host/config_probes.h])
6885 dnl ===================================================================
6886 dnl GCC features
6887 dnl ===================================================================
6888 HAVE_GCC_STACK_CLASH_PROTECTION=
6889 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6890     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6891     save_CFLAGS=$CFLAGS
6892     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6893     AC_LINK_IFELSE(
6894         [AC_LANG_PROGRAM(, [[return 0;]])],
6895         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6896         [AC_MSG_RESULT([no])])
6897     CFLAGS=$save_CFLAGS
6899     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6900     save_CFLAGS=$CFLAGS
6901     CFLAGS="$CFLAGS -Werror -mno-avx"
6902     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6903     CFLAGS=$save_CFLAGS
6904     if test "$HAVE_GCC_AVX" = "TRUE"; then
6905         AC_MSG_RESULT([yes])
6906     else
6907         AC_MSG_RESULT([no])
6908     fi
6910     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6911     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6912     int v = 0;
6913     if (__sync_add_and_fetch(&v, 1) != 1 ||
6914         __sync_sub_and_fetch(&v, 1) != 0)
6915         return 1;
6916     __sync_synchronize();
6917     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6918         v != 1)
6919         return 1;
6920     return 0;
6921 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6922     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6923         AC_MSG_RESULT([yes])
6924         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6925     else
6926         AC_MSG_RESULT([no])
6927     fi
6929     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6930     AC_LANG_PUSH([C++])
6931     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6932             #include <cstddef>
6933             #include <cxxabi.h>
6934             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6935         ])], [
6936             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6937             AC_MSG_RESULT([yes])
6938         ], [AC_MSG_RESULT([no])])
6939     AC_LANG_POP([C++])
6941     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6942     AC_LANG_PUSH([C++])
6943     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6944             #include <cstddef>
6945             #include <cxxabi.h>
6946             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6947         ])], [
6948             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6949             AC_MSG_RESULT([yes])
6950         ], [AC_MSG_RESULT([no])])
6951     AC_LANG_POP([C++])
6953     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6954     AC_LANG_PUSH([C++])
6955     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6956             #include <cxxabi.h>
6957             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6958         ])], [
6959             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6960             AC_MSG_RESULT([yes])
6961         ], [AC_MSG_RESULT([no])])
6962     AC_LANG_POP([C++])
6964     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6965     AC_LANG_PUSH([C++])
6966     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6967             #include <cstddef>
6968             #include <cxxabi.h>
6969             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6970         ])], [
6971             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6972             AC_MSG_RESULT([yes])
6973         ], [AC_MSG_RESULT([no])])
6974     AC_LANG_POP([C++])
6976     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6977     AC_LANG_PUSH([C++])
6978     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6979             #include <cstddef>
6980             #include <cxxabi.h>
6981             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6982         ])], [
6983             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6984             AC_MSG_RESULT([yes])
6985         ], [AC_MSG_RESULT([no])])
6986     AC_LANG_POP([C++])
6988     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6989     AC_LANG_PUSH([C++])
6990     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6991             #include <cxxabi.h>
6992             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6993         ])], [
6994             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6995             AC_MSG_RESULT([yes])
6996         ], [AC_MSG_RESULT([no])])
6997     AC_LANG_POP([C++])
6999     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7000     AC_LANG_PUSH([C++])
7001     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7002             #include <cxxabi.h>
7003             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7004         ])], [
7005             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7006             AC_MSG_RESULT([yes])
7007         ], [AC_MSG_RESULT([no])])
7008     AC_LANG_POP([C++])
7010     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7011     AC_LANG_PUSH([C++])
7012     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7013             #include <cxxabi.h>
7014             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7015         ])], [
7016             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7017             AC_MSG_RESULT([yes])
7018         ], [AC_MSG_RESULT([no])])
7019     AC_LANG_POP([C++])
7021     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7022     AC_LANG_PUSH([C++])
7023     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7024             #include <cstddef>
7025             #include <cxxabi.h>
7026             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7027         ])], [
7028             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7029             AC_MSG_RESULT([yes])
7030         ], [AC_MSG_RESULT([no])])
7031     AC_LANG_POP([C++])
7033     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7034     AC_LANG_PUSH([C++])
7035     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7036             #include <cstddef>
7037             #include <cxxabi.h>
7038             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7039         ])], [
7040             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7041             AC_MSG_RESULT([yes])
7042         ], [AC_MSG_RESULT([no])])
7043     AC_LANG_POP([C++])
7046 AC_SUBST(HAVE_GCC_AVX)
7047 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7048 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7050 dnl ===================================================================
7051 dnl Identify the C++ library
7052 dnl ===================================================================
7054 AC_MSG_CHECKING([what the C++ library is])
7055 AC_LANG_PUSH([C++])
7056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7057 #include <utility>
7058 #ifndef __GLIBCXX__
7059 foo bar
7060 #endif
7061 ]])],
7062     [CPP_LIBRARY=GLIBCXX
7063      cpp_library_name="GNU libstdc++"
7064     ],
7065     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7066 #include <utility>
7067 #ifndef _LIBCPP_VERSION
7068 foo bar
7069 #endif
7070 ]])],
7071     [CPP_LIBRARY=LIBCPP
7072      cpp_library_name="LLVM libc++"
7073      AC_DEFINE([HAVE_LIBCXX])
7074     ],
7075     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7076 #include <utility>
7077 #ifndef _MSC_VER
7078 foo bar
7079 #endif
7080 ]])],
7081     [CPP_LIBRARY=MSVCRT
7082      cpp_library_name="Microsoft"
7083     ],
7084     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7085 AC_MSG_RESULT([$cpp_library_name])
7086 AC_LANG_POP([C++])
7088 dnl ===================================================================
7089 dnl Check for gperf
7090 dnl ===================================================================
7091 AC_PATH_PROG(GPERF, gperf)
7092 if test -z "$GPERF"; then
7093     AC_MSG_ERROR([gperf not found but needed. Install it.])
7095 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7096     GPERF=`cygpath -m $GPERF`
7098 AC_MSG_CHECKING([whether gperf is new enough])
7099 my_gperf_ver1=$($GPERF --version | head -n 1)
7100 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7101 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7102 if test "$my_gperf_ver3" -ge 301; then
7103     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7104 else
7105     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7107 AC_SUBST(GPERF)
7109 dnl ===================================================================
7110 dnl Check for system libcmis
7111 dnl ===================================================================
7112 # libcmis requires curl and we can't build curl for iOS
7113 if test $_os != iOS; then
7114     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7115     ENABLE_LIBCMIS=TRUE
7116 else
7117     ENABLE_LIBCMIS=
7119 AC_SUBST(ENABLE_LIBCMIS)
7121 dnl ===================================================================
7122 dnl C++11
7123 dnl ===================================================================
7125 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7126 CXXFLAGS_CXX11=
7127 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7128     if test "$with_latest_c__" = yes; then
7129         CXXFLAGS_CXX11=-std:c++latest
7130     else
7131         CXXFLAGS_CXX11=-std:c++17
7132     fi
7133     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
7134 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7135     my_flags='-std=c++17 -std=c++1z'
7136     if test "$with_latest_c__" = yes; then
7137         my_flags="-std=c++20 -std=c++2a $my_flags"
7138     fi
7139     for flag in $my_flags; do
7140         if test "$COM" = MSC; then
7141             flag="-Xclang $flag"
7142         fi
7143         save_CXXFLAGS=$CXXFLAGS
7144         CXXFLAGS="$CXXFLAGS $flag -Werror"
7145         if test "$SYSTEM_LIBCMIS" = TRUE; then
7146             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7147         fi
7148         AC_LANG_PUSH([C++])
7149         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7150             #include <algorithm>
7151             #include <functional>
7152             #include <vector>
7154             #if defined SYSTEM_LIBCMIS
7155             // See ucb/source/ucp/cmis/auth_provider.hxx:
7156             #if !defined __clang__
7157             #pragma GCC diagnostic push
7158             #pragma GCC diagnostic ignored "-Wdeprecated"
7159             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7160             #endif
7161             #include <libcmis/libcmis.hxx>
7162             #if !defined __clang__
7163             #pragma GCC diagnostic pop
7164             #endif
7165             #endif
7167             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7168                 std::sort(v.begin(), v.end(), fn);
7169             }
7170             ]])],[CXXFLAGS_CXX11=$flag])
7171         AC_LANG_POP([C++])
7172         CXXFLAGS=$save_CXXFLAGS
7173         if test -n "$CXXFLAGS_CXX11"; then
7174             break
7175         fi
7176     done
7178 if test -n "$CXXFLAGS_CXX11"; then
7179     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7180 else
7181     AC_MSG_ERROR(no)
7183 AC_SUBST(CXXFLAGS_CXX11)
7185 if test "$GCC" = "yes"; then
7186     save_CXXFLAGS=$CXXFLAGS
7187     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7188     CHECK_L_ATOMIC
7189     CXXFLAGS=$save_CXXFLAGS
7190     AC_SUBST(ATOMIC_LIB)
7193 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7194 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7195 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7196 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7197 dnl again towards 4.7.2:
7198 if test $CPP_LIBRARY = GLIBCXX; then
7199     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7200     AC_LANG_PUSH([C++])
7201     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7202 #include <list>
7203 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7204     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7205     //   GCC 4.7.0: 20120322
7206     //   GCC 4.7.1: 20120614
7207     // and using a range check is not possible as the mapping between
7208     // __GLIBCXX__ values and GCC versions is not monotonic
7209 /* ok */
7210 #else
7211 abi broken
7212 #endif
7213         ]])], [AC_MSG_RESULT(no, ok)],
7214         [AC_MSG_ERROR(yes)])
7215     AC_LANG_POP([C++])
7218 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7219 save_CXXFLAGS=$CXXFLAGS
7220 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7221 AC_LANG_PUSH([C++])
7223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7224 #include <stddef.h>
7226 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7228 namespace
7230         struct b
7231         {
7232                 int i;
7233                 int j;
7234         };
7236 ]], [[
7237 struct a
7239         int i;
7240         int j;
7242 a thinga[]={{0,0}, {1,1}};
7243 b thingb[]={{0,0}, {1,1}};
7244 size_t i = sizeof(sal_n_array_size(thinga));
7245 size_t j = sizeof(sal_n_array_size(thingb));
7246 return !(i != 0 && j != 0);
7248     ], [ AC_MSG_RESULT(yes) ],
7249     [ AC_MSG_ERROR(no)])
7250 AC_LANG_POP([C++])
7251 CXXFLAGS=$save_CXXFLAGS
7253 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7254 if test "$GCC" = yes; then
7255     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7256     AC_LANG_PUSH([C++])
7257     save_CXXFLAGS=$CXXFLAGS
7258     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7259     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7260     CXXFLAGS=$save_CXXFLAGS
7261     AC_LANG_POP([C++])
7262     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7263         AC_MSG_RESULT([yes])
7264     else
7265         AC_MSG_RESULT([no])
7266     fi
7268 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7270 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7271 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7272 dnl from consteval constructor initializing const variable":
7273 AC_LANG_PUSH([C++])
7274 save_CXXFLAGS=$CXXFLAGS
7275 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7276 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7277         struct S {
7278             consteval S() { i = 1; }
7279             int i = 0;
7280         };
7281         S const s;
7282     ], [
7283         return (s.i == 1) ? 0 : 1;
7284     ])], [
7285         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7286         AC_MSG_RESULT([yes])
7287     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7288 CXXFLAGS=$save_CXXFLAGS
7289 AC_LANG_POP([C++])
7291 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7292 AC_LANG_PUSH([C++])
7293 save_CXXFLAGS=$CXXFLAGS
7294 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7295 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7296         #include <algorithm>
7297         #include <initializer_list>
7298         #include <vector>
7299         template<typename T> class S {
7300         private:
7301             std::vector<T> v_;
7302         public:
7303             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7304         };
7305         constinit S<int> s{3, 2, 1};
7306     ])], [
7307         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7308         AC_MSG_RESULT([yes])
7309     ], [AC_MSG_RESULT([no])])
7310 CXXFLAGS=$save_CXXFLAGS
7311 AC_LANG_POP([C++])
7313 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7314 AC_LANG_PUSH([C++])
7315 save_CXXFLAGS=$CXXFLAGS
7316 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7317 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7318         #include <span>
7319         #include <type_traits>
7320         // Don't check size_type directly, as it was called index_type before P1872R0:
7321         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7322     ])], [
7323         AC_DEFINE([HAVE_CPP_SPAN],[1])
7324         AC_MSG_RESULT([yes])
7325     ], [AC_MSG_RESULT([no])])
7326 CXXFLAGS=$save_CXXFLAGS
7327 AC_LANG_POP([C++])
7329 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7330 AC_LANG_PUSH([C++])
7331 save_CXXFLAGS=$CXXFLAGS
7332 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7333 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7334         struct S1 { S1(S1 &&); };
7335         struct S2: S1 {};
7336         S1 f(S2 s) { return s; }
7337     ])], [
7338         AC_DEFINE([HAVE_P1155R3],[1])
7339         AC_MSG_RESULT([yes])
7340     ], [AC_MSG_RESULT([no])])
7341 CXXFLAGS=$save_CXXFLAGS
7342 AC_LANG_POP([C++])
7344 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7345 dnl which is included in -Wextra anyway):
7346 HAVE_WDEPRECATED_COPY_DTOR=
7347 if test "$GCC" = yes; then
7348     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7349     AC_LANG_PUSH([C++])
7350     save_CXXFLAGS=$CXXFLAGS
7351     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7352     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7353             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7354             AC_MSG_RESULT([yes])
7355         ], [AC_MSG_RESULT([no])])
7356     CXXFLAGS=$save_CXXFLAGS
7357     AC_LANG_POP([C++])
7359 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7361 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7362 dnl uninitialized warning for code like
7364 dnl   OString f();
7365 dnl   boost::optional<OString> * g(bool b) {
7366 dnl       boost::optional<OString> o;
7367 dnl       if (b) o = f();
7368 dnl       return new boost::optional<OString>(o);
7369 dnl   }
7371 dnl (as is e.g. present, in a slightly more elaborate form, in
7372 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7373 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7374 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7375 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7376     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7377     AC_LANG_PUSH([C++])
7378     save_CXXFLAGS=$CXXFLAGS
7379     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7380     if test "$ENABLE_OPTIMIZED" = TRUE; then
7381         CXXFLAGS="$CXXFLAGS -O2"
7382     else
7383         CXXFLAGS="$CXXFLAGS -O0"
7384     fi
7385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7386             #include <new>
7387             void f1(int);
7388             struct S1 {
7389                 ~S1() { f1(n); }
7390                 int n = 0;
7391             };
7392             struct S2 {
7393                 S2() {}
7394                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7395                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7396                 void set(S1 s) {
7397                     new (stg) S1(s);
7398                     init = true;
7399                 }
7400                 bool init = false;
7401                 char stg[sizeof (S1)];
7402             } ;
7403             S1 f2();
7404             S2 * f3(bool b) {
7405                 S2 o;
7406                 if (b) o.set(f2());
7407                 return new S2(o);
7408             }
7409         ]])], [AC_MSG_RESULT([no])], [
7410             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7411             AC_MSG_RESULT([yes])
7412         ])
7413     CXXFLAGS=$save_CXXFLAGS
7414     AC_LANG_POP([C++])
7416 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7418 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7419 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7420 dnl hits us e.g. with GCC 10 and --enable-optimized at
7422 dnl   In file included from include/rtl/string.hxx:49,
7423 dnl                    from include/rtl/ustring.hxx:43,
7424 dnl                    from include/osl/file.hxx:35,
7425 dnl                    from include/codemaker/global.hxx:28,
7426 dnl                    from include/codemaker/options.hxx:23,
7427 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7428 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7429 dnl       inlined from â€˜static char* rtl::ToStringHelper<const char [N]>::addData(char*, const char*) [with long unsigned int N = 3]’ at include/rtl/stringconcat.hxx:147:85,
7430 dnl       inlined from â€˜char* rtl::OStringConcat<T1, T2>::addData(char*) const [with T1 = const char [3]; T2 = rtl::OString]’ at include/rtl/stringconcat.hxx:226:103,
7431 dnl       inlined from â€˜rtl::OStringBuffer& rtl::OStringBuffer::append(rtl::OStringConcat<T1, T2>&&) [with T1 = const char [3]; T2 = rtl::OString]’ at include/rtl/strbuf.hxx:599:30,
7432 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7433 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7434 dnl      78 |         memcpy( buffer, data, length );
7435 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7436 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7437 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7438     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7439     AC_LANG_PUSH([C++])
7440     save_CXXFLAGS=$CXXFLAGS
7441     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7442     if test "$ENABLE_OPTIMIZED" = TRUE; then
7443         CXXFLAGS="$CXXFLAGS -O2"
7444     else
7445         CXXFLAGS="$CXXFLAGS -O0"
7446     fi
7447     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7448     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7449             void fill(char const * begin, char const * end, char c);
7450             struct q {
7451                 char ids[4];
7452                 char username[6];
7453             };
7454             void test(q & c) {
7455                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7456                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7457             }
7458         ]])], [AC_MSG_RESULT([no])], [
7459             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7460             AC_MSG_RESULT([yes])
7461         ])
7462     CXXFLAGS=$save_CXXFLAGS
7463     AC_LANG_POP([C++])
7465 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7467 dnl ===================================================================
7468 dnl CPU Intrinsics support - SSE, AVX
7469 dnl ===================================================================
7471 CXXFLAGS_INTRINSICS_SSE2=
7472 CXXFLAGS_INTRINSICS_SSSE3=
7473 CXXFLAGS_INTRINSICS_SSE41=
7474 CXXFLAGS_INTRINSICS_SSE42=
7475 CXXFLAGS_INTRINSICS_AVX=
7476 CXXFLAGS_INTRINSICS_AVX2=
7477 CXXFLAGS_INTRINSICS_AVX512=
7478 CXXFLAGS_INTRINSICS_F16C=
7479 CXXFLAGS_INTRINSICS_FMA=
7481 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7482     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7483     flag_sse2=-msse2
7484     flag_ssse3=-mssse3
7485     flag_sse41=-msse4.1
7486     flag_sse42=-msse4.2
7487     flag_avx=-mavx
7488     flag_avx2=-mavx2
7489     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7490     flag_f16c=-mf16c
7491     flag_fma=-mfma
7492 else
7493     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7494     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7495     # SSE2 seems to be SSE2+.
7496     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7497     # is not empty (and can be tested in gbuild).
7498     flag_sse2=-arch:SSE2
7499     flag_ssse3=-arch:SSE2
7500     flag_sse41=-arch:SSE2
7501     flag_sse42=-arch:SSE2
7502     flag_avx=-arch:AVX
7503     flag_avx2=-arch:AVX2
7504     flag_avx512=-arch:AVX512
7505     # These are part of -arch:AVX2
7506     flag_f16c=-arch:AVX2
7507     flag_fma=-arch:AVX2
7510 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7511 AC_LANG_PUSH([C++])
7512 save_CXXFLAGS=$CXXFLAGS
7513 CXXFLAGS="$CXXFLAGS $flag_sse2"
7514 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7515     #include <emmintrin.h>
7516     int main () {
7517         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7518         c = _mm_xor_si128 (a, b);
7519         return 0;
7520     }
7521     ])],
7522     [can_compile_sse2=yes],
7523     [can_compile_sse2=no])
7524 AC_LANG_POP([C++])
7525 CXXFLAGS=$save_CXXFLAGS
7526 AC_MSG_RESULT([${can_compile_sse2}])
7527 if test "${can_compile_sse2}" = "yes" ; then
7528     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7531 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7532 AC_LANG_PUSH([C++])
7533 save_CXXFLAGS=$CXXFLAGS
7534 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7535 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7536     #include <tmmintrin.h>
7537     int main () {
7538         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7539         c = _mm_maddubs_epi16 (a, b);
7540         return 0;
7541     }
7542     ])],
7543     [can_compile_ssse3=yes],
7544     [can_compile_ssse3=no])
7545 AC_LANG_POP([C++])
7546 CXXFLAGS=$save_CXXFLAGS
7547 AC_MSG_RESULT([${can_compile_ssse3}])
7548 if test "${can_compile_ssse3}" = "yes" ; then
7549     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7552 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7553 AC_LANG_PUSH([C++])
7554 save_CXXFLAGS=$CXXFLAGS
7555 CXXFLAGS="$CXXFLAGS $flag_sse41"
7556 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7557     #include <smmintrin.h>
7558     int main () {
7559         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7560         c = _mm_cmpeq_epi64 (a, b);
7561         return 0;
7562     }
7563     ])],
7564     [can_compile_sse41=yes],
7565     [can_compile_sse41=no])
7566 AC_LANG_POP([C++])
7567 CXXFLAGS=$save_CXXFLAGS
7568 AC_MSG_RESULT([${can_compile_sse41}])
7569 if test "${can_compile_sse41}" = "yes" ; then
7570     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7573 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7574 AC_LANG_PUSH([C++])
7575 save_CXXFLAGS=$CXXFLAGS
7576 CXXFLAGS="$CXXFLAGS $flag_sse42"
7577 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7578     #include <nmmintrin.h>
7579     int main () {
7580         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7581         c = _mm_cmpgt_epi64 (a, b);
7582         return 0;
7583     }
7584     ])],
7585     [can_compile_sse42=yes],
7586     [can_compile_sse42=no])
7587 AC_LANG_POP([C++])
7588 CXXFLAGS=$save_CXXFLAGS
7589 AC_MSG_RESULT([${can_compile_sse42}])
7590 if test "${can_compile_sse42}" = "yes" ; then
7591     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7594 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7595 AC_LANG_PUSH([C++])
7596 save_CXXFLAGS=$CXXFLAGS
7597 CXXFLAGS="$CXXFLAGS $flag_avx"
7598 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7599     #include <immintrin.h>
7600     int main () {
7601         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7602         c = _mm256_xor_ps(a, b);
7603         return 0;
7604     }
7605     ])],
7606     [can_compile_avx=yes],
7607     [can_compile_avx=no])
7608 AC_LANG_POP([C++])
7609 CXXFLAGS=$save_CXXFLAGS
7610 AC_MSG_RESULT([${can_compile_avx}])
7611 if test "${can_compile_avx}" = "yes" ; then
7612     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7615 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7616 AC_LANG_PUSH([C++])
7617 save_CXXFLAGS=$CXXFLAGS
7618 CXXFLAGS="$CXXFLAGS $flag_avx2"
7619 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7620     #include <immintrin.h>
7621     int main () {
7622         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7623         c = _mm256_maddubs_epi16(a, b);
7624         return 0;
7625     }
7626     ])],
7627     [can_compile_avx2=yes],
7628     [can_compile_avx2=no])
7629 AC_LANG_POP([C++])
7630 CXXFLAGS=$save_CXXFLAGS
7631 AC_MSG_RESULT([${can_compile_avx2}])
7632 if test "${can_compile_avx2}" = "yes" ; then
7633     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7636 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7637 AC_LANG_PUSH([C++])
7638 save_CXXFLAGS=$CXXFLAGS
7639 CXXFLAGS="$CXXFLAGS $flag_avx512"
7640 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7641     #include <immintrin.h>
7642     int main () {
7643         __m512i a = _mm512_loadu_si512(0);
7644         return 0;
7645     }
7646     ])],
7647     [can_compile_avx512=yes],
7648     [can_compile_avx512=no])
7649 AC_LANG_POP([C++])
7650 CXXFLAGS=$save_CXXFLAGS
7651 AC_MSG_RESULT([${can_compile_avx512}])
7652 if test "${can_compile_avx512}" = "yes" ; then
7653     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7656 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7657 AC_LANG_PUSH([C++])
7658 save_CXXFLAGS=$CXXFLAGS
7659 CXXFLAGS="$CXXFLAGS $flag_f16c"
7660 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7661     #include <immintrin.h>
7662     int main () {
7663         __m128i a = _mm_set1_epi32 (0);
7664         __m128 c;
7665         c = _mm_cvtph_ps(a);
7666         return 0;
7667     }
7668     ])],
7669     [can_compile_f16c=yes],
7670     [can_compile_f16c=no])
7671 AC_LANG_POP([C++])
7672 CXXFLAGS=$save_CXXFLAGS
7673 AC_MSG_RESULT([${can_compile_f16c}])
7674 if test "${can_compile_f16c}" = "yes" ; then
7675     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7678 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7679 AC_LANG_PUSH([C++])
7680 save_CXXFLAGS=$CXXFLAGS
7681 CXXFLAGS="$CXXFLAGS $flag_fma"
7682 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7683     #include <immintrin.h>
7684     int main () {
7685         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7686         d = _mm256_fmadd_ps(a, b, c);
7687         return 0;
7688     }
7689     ])],
7690     [can_compile_fma=yes],
7691     [can_compile_fma=no])
7692 AC_LANG_POP([C++])
7693 CXXFLAGS=$save_CXXFLAGS
7694 AC_MSG_RESULT([${can_compile_fma}])
7695 if test "${can_compile_fma}" = "yes" ; then
7696     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7699 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7700 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7701 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7702 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7703 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7704 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7705 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7706 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7707 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7709 dnl ===================================================================
7710 dnl system stl sanity tests
7711 dnl ===================================================================
7712 if test "$_os" != "WINNT"; then
7714     AC_LANG_PUSH([C++])
7716     save_CPPFLAGS="$CPPFLAGS"
7717     if test -n "$MACOSX_SDK_PATH"; then
7718         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7719     fi
7721     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7722     # only.
7723     if test "$CPP_LIBRARY" = GLIBCXX; then
7724         dnl gcc#19664, gcc#22482, rhbz#162935
7725         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7726         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7727         AC_MSG_RESULT([$stlvisok])
7728         if test "$stlvisok" = "no"; then
7729             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7730         fi
7731     fi
7733     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7734     # when we don't make any dynamic libraries?
7735     if test "$DISABLE_DYNLOADING" = ""; then
7736         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7737         cat > conftestlib1.cc <<_ACEOF
7738 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7739 struct S2: S1<int> { virtual ~S2(); };
7740 S2::~S2() {}
7741 _ACEOF
7742         cat > conftestlib2.cc <<_ACEOF
7743 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7744 struct S2: S1<int> { virtual ~S2(); };
7745 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7746 _ACEOF
7747         gccvisinlineshiddenok=yes
7748         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7749             gccvisinlineshiddenok=no
7750         else
7751             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7752             dnl known to not work with -z defs (unsetting which makes the test
7753             dnl moot, though):
7754             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7755             if test "$COM_IS_CLANG" = TRUE; then
7756                 for i in $CXX $CXXFLAGS; do
7757                     case $i in
7758                     -fsanitize=*)
7759                         my_linkflagsnoundefs=
7760                         break
7761                         ;;
7762                     esac
7763                 done
7764             fi
7765             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7766                 gccvisinlineshiddenok=no
7767             fi
7768         fi
7770         rm -fr libconftest*
7771         AC_MSG_RESULT([$gccvisinlineshiddenok])
7772         if test "$gccvisinlineshiddenok" = "no"; then
7773             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7774         fi
7775     fi
7777    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7778     cat >visibility.cxx <<_ACEOF
7779 #pragma GCC visibility push(hidden)
7780 struct __attribute__ ((visibility ("default"))) TestStruct {
7781   static void Init();
7783 __attribute__ ((visibility ("default"))) void TestFunc() {
7784   TestStruct::Init();
7786 _ACEOF
7787     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7788         gccvisbroken=yes
7789     else
7790         case "$host_cpu" in
7791         i?86|x86_64)
7792             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7793                 gccvisbroken=no
7794             else
7795                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7796                     gccvisbroken=no
7797                 else
7798                     gccvisbroken=yes
7799                 fi
7800             fi
7801             ;;
7802         *)
7803             gccvisbroken=no
7804             ;;
7805         esac
7806     fi
7807     rm -f visibility.s visibility.cxx
7809     AC_MSG_RESULT([$gccvisbroken])
7810     if test "$gccvisbroken" = "yes"; then
7811         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7812     fi
7814     CPPFLAGS="$save_CPPFLAGS"
7816     AC_LANG_POP([C++])
7819 dnl ===================================================================
7820 dnl  Clang++ tests
7821 dnl ===================================================================
7823 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7824 if test "$GCC" = "yes"; then
7825     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7826     AC_LANG_PUSH([C++])
7827     save_CXXFLAGS=$CXXFLAGS
7828     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7829     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7830     CXXFLAGS=$save_CXXFLAGS
7831     AC_LANG_POP([C++])
7832     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7833         AC_MSG_RESULT([yes])
7834     else
7835         AC_MSG_RESULT([no])
7836     fi
7838 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7840 dnl ===================================================================
7841 dnl Compiler plugins
7842 dnl ===================================================================
7844 COMPILER_PLUGINS=
7845 # currently only Clang
7847 if test "$COM_IS_CLANG" != "TRUE"; then
7848     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7849         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7850         enable_compiler_plugins=no
7851     fi
7854 COMPILER_PLUGINS_COM_IS_CLANG=
7855 if test "$COM_IS_CLANG" = "TRUE"; then
7856     if test -n "$enable_compiler_plugins"; then
7857         compiler_plugins="$enable_compiler_plugins"
7858     elif test -n "$ENABLE_DBGUTIL"; then
7859         compiler_plugins=test
7860     else
7861         compiler_plugins=no
7862     fi
7863     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7864         if test "$CLANGVER" -lt 50002; then
7865             if test "$compiler_plugins" = yes; then
7866                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7867             else
7868                 compiler_plugins=no
7869             fi
7870         fi
7871     fi
7872     if test "$compiler_plugins" != "no"; then
7873         dnl The prefix where Clang resides, override to where Clang resides if
7874         dnl using a source build:
7875         if test -z "$CLANGDIR"; then
7876             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7877         fi
7878         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7879         if test -z "$COMPILER_PLUGINS_CXX"; then
7880             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7881         fi
7882         clangbindir=$CLANGDIR/bin
7883         if test "$build_os" = "cygwin"; then
7884             clangbindir=$(cygpath -u "$clangbindir")
7885         fi
7886         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7887         if test -n "$LLVM_CONFIG"; then
7888             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7889             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7890             if test -z "$CLANGLIBDIR"; then
7891                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7892             fi
7893             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7894             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7895             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7896             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7897                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7898             fi
7899             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7900             clangobjdir=$($LLVM_CONFIG --obj-root)
7901             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7902                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7903             fi
7904         fi
7905         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7906         AC_LANG_PUSH([C++])
7907         save_CXX=$CXX
7908         save_CXXCPP=$CXXCPP
7909         save_CPPFLAGS=$CPPFLAGS
7910         save_CXXFLAGS=$CXXFLAGS
7911         save_LDFLAGS=$LDFLAGS
7912         save_LIBS=$LIBS
7913         CXX=$COMPILER_PLUGINS_CXX
7914         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7915         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7916         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7917         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7918             [COMPILER_PLUGINS=TRUE],
7919             [
7920             if test "$compiler_plugins" = "yes"; then
7921                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7922             else
7923                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7924                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7925             fi
7926             ])
7927         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7928         dnl comment in compilerplugins/Makefile-clang.mk:
7929         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7930             LDFLAGS=""
7931             AC_MSG_CHECKING([for clang libraries to use])
7932             if test -z "$CLANGTOOLLIBS"; then
7933                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7934  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7935                 AC_LINK_IFELSE([
7936                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7937                         [[ clang::FullSourceLoc().dump(); ]])
7938                 ],[CLANGTOOLLIBS="$LIBS"],[])
7939             fi
7940             if test -z "$CLANGTOOLLIBS"; then
7941                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7942                 AC_LINK_IFELSE([
7943                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7944                         [[ clang::FullSourceLoc().dump(); ]])
7945                 ],[CLANGTOOLLIBS="$LIBS"],[])
7946             fi
7947             AC_MSG_RESULT([$CLANGTOOLLIBS])
7948             if test -z "$CLANGTOOLLIBS"; then
7949                 if test "$compiler_plugins" = "yes"; then
7950                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7951                 else
7952                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7953                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7954                 fi
7955                 COMPILER_PLUGINS=
7956             fi
7957             if test -n "$COMPILER_PLUGINS"; then
7958                 if test -z "$CLANGSYSINCLUDE"; then
7959                     if test -n "$LLVM_CONFIG"; then
7960                         # Path to the clang system headers (no idea if there's a better way to get it).
7961                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7962                     fi
7963                 fi
7964             fi
7965         fi
7966         CXX=$save_CXX
7967         CXXCPP=$save_CXXCPP
7968         CPPFLAGS=$save_CPPFLAGS
7969         CXXFLAGS=$save_CXXFLAGS
7970         LDFLAGS=$save_LDFLAGS
7971         LIBS="$save_LIBS"
7972         AC_LANG_POP([C++])
7974         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7975         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7976             #ifndef __clang__
7977             you lose
7978             #endif
7979             int foo=42;
7980             ]])],
7981             [AC_MSG_RESULT([yes])
7982              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7983             [AC_MSG_RESULT([no])])
7984         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7985     fi
7986 else
7987     if test "$enable_compiler_plugins" = "yes"; then
7988         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7989     fi
7991 COMPILER_PLUGINS_ANALYZER_PCH=
7992 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7993     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7995 AC_SUBST(COMPILER_PLUGINS)
7996 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7997 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7998 AC_SUBST(COMPILER_PLUGINS_CXX)
7999 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8000 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8001 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8002 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8003 AC_SUBST(CLANGDIR)
8004 AC_SUBST(CLANGLIBDIR)
8005 AC_SUBST(CLANGTOOLLIBS)
8006 AC_SUBST(CLANGSYSINCLUDE)
8008 # Plugin to help linker.
8009 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8010 # This makes --enable-lto build with clang work.
8011 AC_SUBST(LD_PLUGIN)
8013 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8014 AC_SUBST(HAVE_POSIX_FALLOCATE)
8016 JITC_PROCESSOR_TYPE=""
8017 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8018     # IBMs JDK needs this...
8019     JITC_PROCESSOR_TYPE=6
8020     export JITC_PROCESSOR_TYPE
8022 AC_SUBST([JITC_PROCESSOR_TYPE])
8024 # Misc Windows Stuff
8025 AC_ARG_WITH(ucrt-dir,
8026     AS_HELP_STRING([--with-ucrt-dir],
8027         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8028         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8029         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8030             Windows6.1-KB2999226-x64.msu
8031             Windows6.1-KB2999226-x86.msu
8032             Windows8.1-KB2999226-x64.msu
8033             Windows8.1-KB2999226-x86.msu
8034             Windows8-RT-KB2999226-x64.msu
8035             Windows8-RT-KB2999226-x86.msu
8036         A zip archive including those files is available from Microsoft site:
8037         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8040 UCRT_REDISTDIR="$with_ucrt_dir"
8041 if test $_os = "WINNT"; then
8042     find_msvc_x64_dlls
8043     for i in $PKGFORMAT; do
8044         if test "$i" = msi; then
8045             find_msms
8046             break
8047         fi
8048     done
8049     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8050     MSVC_DLLS="$msvcdlls"
8051     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8052     # MSVC 15.3 changed it to VC141
8053     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8054         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8055     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8056         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8057     else
8058         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8059     fi
8061     if test "$UCRT_REDISTDIR" = "no"; then
8062         dnl explicitly disabled
8063         UCRT_REDISTDIR=""
8064     else
8065         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8066                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8067                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8068                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8069                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8070                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8071             UCRT_REDISTDIR=""
8072             if test -n "$PKGFORMAT"; then
8073                for i in $PKGFORMAT; do
8074                    case "$i" in
8075                    msi)
8076                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8077                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8078                        ;;
8079                    esac
8080                done
8081             fi
8082         fi
8083     fi
8086 AC_SUBST(UCRT_REDISTDIR)
8087 AC_SUBST(MSVC_DLL_PATH)
8088 AC_SUBST(MSVC_DLLS)
8089 AC_SUBST(MSM_PATH)
8091 dnl ===================================================================
8092 dnl Checks for Java
8093 dnl ===================================================================
8094 if test "$ENABLE_JAVA" != ""; then
8096     # Windows-specific tests
8097     if test "$build_os" = "cygwin"; then
8098         if test -z "$with_jdk_home"; then
8099             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8100             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8101             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8102             if test -n "$regvalue"; then
8103                 ver=$regvalue
8104                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8105                 reg_jdk_home=$regvalue
8106             fi
8108             if test -f "$reg_jdk_home/lib/jvm.lib" -a -f "$reg_jdk_home/bin/java.exe"; then
8109                 with_jdk_home="$reg_jdk_home"
8110                 howfound="found automatically"
8111             else
8112                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8113             fi
8114         else
8115             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8116             howfound="you passed"
8117         fi
8118     fi
8120     # 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.
8121     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8122     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8123         with_jdk_home=`/usr/libexec/java_home`
8124     fi
8126     JAVA_HOME=; export JAVA_HOME
8127     if test -z "$with_jdk_home"; then
8128         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8129     else
8130         _java_path="$with_jdk_home/bin/$with_java"
8131         dnl Check if there is a Java interpreter at all.
8132         if test -x "$_java_path"; then
8133             JAVAINTERPRETER=$_java_path
8134         else
8135             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8136         fi
8137     fi
8139     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8140     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8141     dnl loaded by java to run JunitTests:
8142     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8143         shortjdkhome=`cygpath -d "$with_jdk_home"`
8144         if test $WIN_HOST_BITS -eq 64 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8145             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8146             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8147         elif test $WIN_HOST_BITS -eq 32 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8148             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8149             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8150         fi
8152         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8153             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8154         fi
8155         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8156     elif test "$cross_compiling" != "yes"; then
8157         case $CPUNAME in
8158             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8159                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8160                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8161                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8162                 fi
8163                 ;;
8164             *) # assumption: everything else 32-bit
8165                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8166                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8167                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8168                 fi
8169                 ;;
8170         esac
8171     fi
8174 dnl ===================================================================
8175 dnl Checks for JDK.
8176 dnl ===================================================================
8178 # Whether all the complexity here actually is needed any more or not, no idea.
8180 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8181     _gij_longver=0
8182     AC_MSG_CHECKING([the installed JDK])
8183     if test -n "$JAVAINTERPRETER"; then
8184         dnl java -version sends output to stderr!
8185         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8186             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8187         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8188             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8189         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8190             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8191         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8192             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8193         else
8194             JDK=sun
8196             dnl Sun JDK specific tests
8197             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8198             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8200             if test "$_jdk_ver" -lt 10900; then
8201                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8202             fi
8203             if test "$_jdk_ver" -gt 10900; then
8204                 JAVA_CLASSPATH_NOT_SET=TRUE
8205             fi
8207             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8208             if test "$_os" = "WINNT"; then
8209                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8210             fi
8211             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8213             # set to limit VM usage for JunitTests
8214             JAVAIFLAGS=-Xmx64M
8215             # set to limit VM usage for javac
8216             JAVACFLAGS=-J-Xmx128M
8217         fi
8218     else
8219         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8220     fi
8221 else
8222     if test -z "$ENABLE_JAVA"; then
8223         dnl Java disabled
8224         JAVA_HOME=
8225         export JAVA_HOME
8226     elif test "$cross_compiling" = "yes"; then
8227         # Just assume compatibility of build and host JDK
8228         JDK=$JDK_FOR_BUILD
8229         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8230     fi
8233 dnl ===================================================================
8234 dnl Checks for javac
8235 dnl ===================================================================
8236 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8237     javacompiler="javac"
8238     : ${JAVA_SOURCE_VER=8}
8239     : ${JAVA_TARGET_VER=8}
8240     if test -z "$with_jdk_home"; then
8241         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8242     else
8243         _javac_path="$with_jdk_home/bin/$javacompiler"
8244         dnl Check if there is a Java compiler at all.
8245         if test -x "$_javac_path"; then
8246             JAVACOMPILER=$_javac_path
8247         fi
8248     fi
8249     if test -z "$JAVACOMPILER"; then
8250         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8251     fi
8252     if test "$build_os" = "cygwin"; then
8253         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8254             JAVACOMPILER="${JAVACOMPILER}.exe"
8255         fi
8256         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8257     fi
8260 dnl ===================================================================
8261 dnl Checks for javadoc
8262 dnl ===================================================================
8263 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8264     if test -z "$with_jdk_home"; then
8265         AC_PATH_PROG(JAVADOC, javadoc)
8266     else
8267         _javadoc_path="$with_jdk_home/bin/javadoc"
8268         dnl Check if there is a javadoc at all.
8269         if test -x "$_javadoc_path"; then
8270             JAVADOC=$_javadoc_path
8271         else
8272             AC_PATH_PROG(JAVADOC, javadoc)
8273         fi
8274     fi
8275     if test -z "$JAVADOC"; then
8276         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8277     fi
8278     if test "$build_os" = "cygwin"; then
8279         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8280             JAVADOC="${JAVADOC}.exe"
8281         fi
8282         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8283     fi
8285     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8286     JAVADOCISGJDOC="yes"
8287     fi
8289 AC_SUBST(JAVADOC)
8290 AC_SUBST(JAVADOCISGJDOC)
8292 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8293     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8294     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8295         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8296            # try to recover first by looking whether we have an alternative
8297            # system as in Debian or newer SuSEs where following /usr/bin/javac
8298            # over /etc/alternatives/javac leads to the right bindir where we
8299            # just need to strip a bit away to get a valid JAVA_HOME
8300            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8301         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8302             # maybe only one level of symlink (e.g. on Mac)
8303             JAVA_HOME=$(readlink $JAVACOMPILER)
8304             if test "$(dirname $JAVA_HOME)" = "."; then
8305                 # we've got no path to trim back
8306                 JAVA_HOME=""
8307             fi
8308         else
8309             # else warn
8310             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8311             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8312             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8313             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8314         fi
8315         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8316         if test "$JAVA_HOME" != "/usr"; then
8317             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8318                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8319                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8320                 dnl Tiger already returns a JDK path...
8321                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8322             else
8323                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8324                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8325                 dnl that checks which version to run
8326                 if test -f "$JAVA_HOME"; then
8327                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8328                 fi
8329             fi
8330         fi
8331     fi
8332     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8334     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8335     if test -z "$JAVA_HOME"; then
8336         if test "x$with_jdk_home" = "x"; then
8337             cat > findhome.java <<_ACEOF
8338 [import java.io.File;
8340 class findhome
8342     public static void main(String args[])
8343     {
8344         String jrelocation = System.getProperty("java.home");
8345         File jre = new File(jrelocation);
8346         System.out.println(jre.getParent());
8347     }
8349 _ACEOF
8350             AC_MSG_CHECKING([if javac works])
8351             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8352             AC_TRY_EVAL(javac_cmd)
8353             if test $? = 0 -a -f ./findhome.class; then
8354                 AC_MSG_RESULT([javac works])
8355             else
8356                 echo "configure: javac test failed" >&5
8357                 cat findhome.java >&5
8358                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8359             fi
8360             AC_MSG_CHECKING([if gij knows its java.home])
8361             JAVA_HOME=`$JAVAINTERPRETER findhome`
8362             if test $? = 0 -a "$JAVA_HOME" != ""; then
8363                 AC_MSG_RESULT([$JAVA_HOME])
8364             else
8365                 echo "configure: java test failed" >&5
8366                 cat findhome.java >&5
8367                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8368             fi
8369             # clean-up after ourselves
8370             rm -f ./findhome.java ./findhome.class
8371         else
8372             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8373         fi
8374     fi
8376     # now check if $JAVA_HOME is really valid
8377     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8378         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8379             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8380             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8381             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8382             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8383             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8384             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8385         fi
8386     fi
8387     PathFormat "$JAVA_HOME"
8388     JAVA_HOME="$formatted_path"
8391 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8392     "$_os" != Darwin
8393 then
8394     AC_MSG_CHECKING([for JAWT lib])
8395     if test "$_os" = WINNT; then
8396         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8397         JAWTLIB=jawt.lib
8398     else
8399         case "$host_cpu" in
8400         arm*)
8401             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8402             JAVA_ARCH=$my_java_arch
8403             ;;
8404         i*86)
8405             my_java_arch=i386
8406             ;;
8407         m68k)
8408             my_java_arch=m68k
8409             ;;
8410         powerpc)
8411             my_java_arch=ppc
8412             ;;
8413         powerpc64)
8414             my_java_arch=ppc64
8415             ;;
8416         powerpc64le)
8417             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8418             JAVA_ARCH=$my_java_arch
8419             ;;
8420         sparc64)
8421             my_java_arch=sparcv9
8422             ;;
8423         x86_64)
8424             my_java_arch=amd64
8425             ;;
8426         *)
8427             my_java_arch=$host_cpu
8428             ;;
8429         esac
8430         # This is where JDK9 puts the library
8431         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8432             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8433         else
8434             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8435         fi
8436         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8437     fi
8438     AC_MSG_RESULT([$JAWTLIB])
8440 AC_SUBST(JAWTLIB)
8442 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8443     case "$host_os" in
8445     aix*)
8446         JAVAINC="-I$JAVA_HOME/include"
8447         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8448         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8449         ;;
8451     cygwin*|wsl*)
8452         JAVAINC="-I$JAVA_HOME/include/win32"
8453         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8454         ;;
8456     darwin*|macos*)
8457         if test -d "$JAVA_HOME/include/darwin"; then
8458             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8459         else
8460             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8461         fi
8462         ;;
8464     dragonfly*)
8465         JAVAINC="-I$JAVA_HOME/include"
8466         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8467         ;;
8469     freebsd*)
8470         JAVAINC="-I$JAVA_HOME/include"
8471         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8472         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8473         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8474         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8475         ;;
8477     k*bsd*-gnu*)
8478         JAVAINC="-I$JAVA_HOME/include"
8479         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8480         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8481         ;;
8483     linux-gnu*)
8484         JAVAINC="-I$JAVA_HOME/include"
8485         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8486         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8487         ;;
8489     *netbsd*)
8490         JAVAINC="-I$JAVA_HOME/include"
8491         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8492         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8493        ;;
8495     openbsd*)
8496         JAVAINC="-I$JAVA_HOME/include"
8497         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8498         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8499         ;;
8501     solaris*)
8502         JAVAINC="-I$JAVA_HOME/include"
8503         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8504         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8505         ;;
8506     esac
8508 SOLARINC="$SOLARINC $JAVAINC"
8510 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8511     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8512     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8513     JDK_FOR_BUILD=$JDK
8516 AC_SUBST(JAVACFLAGS)
8517 AC_SUBST(JAVACOMPILER)
8518 AC_SUBST(JAVAINTERPRETER)
8519 AC_SUBST(JAVAIFLAGS)
8520 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8521 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8522 AC_SUBST(JAVA_HOME)
8523 AC_SUBST(JAVA_HOME_FOR_BUILD)
8524 AC_SUBST(JDK)
8525 AC_SUBST(JDK_FOR_BUILD)
8526 AC_SUBST(JAVA_SOURCE_VER)
8527 AC_SUBST(JAVA_TARGET_VER)
8530 dnl ===================================================================
8531 dnl Export file validation
8532 dnl ===================================================================
8533 AC_MSG_CHECKING([whether to enable export file validation])
8534 if test "$with_export_validation" != "no"; then
8535     if test -z "$ENABLE_JAVA"; then
8536         if test "$with_export_validation" = "yes"; then
8537             AC_MSG_ERROR([requested, but Java is disabled])
8538         else
8539             AC_MSG_RESULT([no, as Java is disabled])
8540         fi
8541     elif ! test -d "${SRC_ROOT}/schema"; then
8542         if test "$with_export_validation" = "yes"; then
8543             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8544         else
8545             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8546         fi
8547     else
8548         AC_MSG_RESULT([yes])
8549         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8551         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8552         if test -z "$ODFVALIDATOR"; then
8553             # remember to download the ODF toolkit with validator later
8554             AC_MSG_NOTICE([no odfvalidator found, will download it])
8555             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8556             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8558             # and fetch name of odfvalidator jar name from download.lst
8559             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8560             AC_SUBST(ODFVALIDATOR_JAR)
8562             if test -z "$ODFVALIDATOR_JAR"; then
8563                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8564             fi
8565         fi
8566         if test "$build_os" = "cygwin"; then
8567             # In case of Cygwin it will be executed from Windows,
8568             # so we need to run bash and absolute path to validator
8569             # so instead of "odfvalidator" it will be
8570             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8571             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8572         else
8573             ODFVALIDATOR="sh $ODFVALIDATOR"
8574         fi
8575         AC_SUBST(ODFVALIDATOR)
8578         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8579         if test -z "$OFFICEOTRON"; then
8580             # remember to download the officeotron with validator later
8581             AC_MSG_NOTICE([no officeotron found, will download it])
8582             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8583             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8585             # and fetch name of officeotron jar name from download.lst
8586             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8587             AC_SUBST(OFFICEOTRON_JAR)
8589             if test -z "$OFFICEOTRON_JAR"; then
8590                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8591             fi
8592         else
8593             # check version of existing officeotron
8594             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8595             if test 0"$OFFICEOTRON_VER" -lt 704; then
8596                 AC_MSG_ERROR([officeotron too old])
8597             fi
8598         fi
8599         if test "$build_os" = "cygwin"; then
8600             # In case of Cygwin it will be executed from Windows,
8601             # so we need to run bash and absolute path to validator
8602             # so instead of "odfvalidator" it will be
8603             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8604             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8605         else
8606             OFFICEOTRON="sh $OFFICEOTRON"
8607         fi
8608     fi
8609     AC_SUBST(OFFICEOTRON)
8610 else
8611     AC_MSG_RESULT([no])
8614 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8615 if test "$with_bffvalidator" != "no"; then
8616     AC_DEFINE(HAVE_BFFVALIDATOR)
8618     if test "$with_export_validation" = "no"; then
8619         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8620     fi
8622     if test "$with_bffvalidator" = "yes"; then
8623         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8624     else
8625         BFFVALIDATOR="$with_bffvalidator"
8626     fi
8628     if test "$build_os" = "cygwin"; then
8629         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8630             AC_MSG_RESULT($BFFVALIDATOR)
8631         else
8632             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8633         fi
8634     elif test -n "$BFFVALIDATOR"; then
8635         # We are not in Cygwin but need to run Windows binary with wine
8636         AC_PATH_PROGS(WINE, wine)
8638         # so swap in a shell wrapper that converts paths transparently
8639         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8640         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8641         AC_SUBST(BFFVALIDATOR_EXE)
8642         AC_MSG_RESULT($BFFVALIDATOR)
8643     else
8644         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8645     fi
8646     AC_SUBST(BFFVALIDATOR)
8647 else
8648     AC_MSG_RESULT([no])
8651 dnl ===================================================================
8652 dnl Check for C preprocessor to use
8653 dnl ===================================================================
8654 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8655 if test -n "$with_idlc_cpp"; then
8656     AC_MSG_RESULT([$with_idlc_cpp])
8657     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8658 else
8659     AC_MSG_RESULT([ucpp])
8660     AC_MSG_CHECKING([which ucpp tp use])
8661     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8662         AC_MSG_RESULT([external])
8663         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8664     else
8665         AC_MSG_RESULT([internal])
8666         BUILD_TYPE="$BUILD_TYPE UCPP"
8667     fi
8669 AC_SUBST(SYSTEM_UCPP)
8671 dnl ===================================================================
8672 dnl Check for epm (not needed for Windows)
8673 dnl ===================================================================
8674 AC_MSG_CHECKING([whether to enable EPM for packing])
8675 if test "$enable_epm" = "yes"; then
8676     AC_MSG_RESULT([yes])
8677     if test "$_os" != "WINNT"; then
8678         if test $_os = Darwin; then
8679             EPM=internal
8680         elif test -n "$with_epm"; then
8681             EPM=$with_epm
8682         else
8683             AC_PATH_PROG(EPM, epm, no)
8684         fi
8685         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8686             AC_MSG_NOTICE([EPM will be built.])
8687             BUILD_TYPE="$BUILD_TYPE EPM"
8688             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8689         else
8690             # Gentoo has some epm which is something different...
8691             AC_MSG_CHECKING([whether the found epm is the right epm])
8692             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8693                 AC_MSG_RESULT([yes])
8694             else
8695                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8696             fi
8697             AC_MSG_CHECKING([epm version])
8698             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8699             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8700                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8701                 AC_MSG_RESULT([OK, >= 3.7])
8702             else
8703                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8704                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8705             fi
8706         fi
8707     fi
8709     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8710         AC_MSG_CHECKING([for rpm])
8711         for a in "$RPM" rpmbuild rpm; do
8712             $a --usage >/dev/null 2> /dev/null
8713             if test $? -eq 0; then
8714                 RPM=$a
8715                 break
8716             else
8717                 $a --version >/dev/null 2> /dev/null
8718                 if test $? -eq 0; then
8719                     RPM=$a
8720                     break
8721                 fi
8722             fi
8723         done
8724         if test -z "$RPM"; then
8725             AC_MSG_ERROR([not found])
8726         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8727             RPM_PATH=`which $RPM`
8728             AC_MSG_RESULT([$RPM_PATH])
8729             SCPDEFS="$SCPDEFS -DWITH_RPM"
8730         else
8731             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8732         fi
8733     fi
8734     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8735         AC_PATH_PROG(DPKG, dpkg, no)
8736         if test "$DPKG" = "no"; then
8737             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8738         fi
8739     fi
8740     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8741        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8742         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8743             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8744                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8745                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8746                     AC_MSG_RESULT([yes])
8747                 else
8748                     AC_MSG_RESULT([no])
8749                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8750                         _pt="rpm"
8751                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8752                         add_warning "the rpms will need to be installed with --nodeps"
8753                     else
8754                         _pt="pkg"
8755                     fi
8756                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8757                     add_warning "the ${_pt}s will not be relocatable"
8758                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8759                                  relocation will work, you need to patch your epm with the
8760                                  patch in epm/epm-3.7.patch or build with
8761                                  --with-epm=internal which will build a suitable epm])
8762                 fi
8763             fi
8764         fi
8765     fi
8766     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8767         AC_PATH_PROG(PKGMK, pkgmk, no)
8768         if test "$PKGMK" = "no"; then
8769             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8770         fi
8771     fi
8772     AC_SUBST(RPM)
8773     AC_SUBST(DPKG)
8774     AC_SUBST(PKGMK)
8775 else
8776     for i in $PKGFORMAT; do
8777         case "$i" in
8778         aix | bsd | deb | pkg | rpm | native | portable)
8779             AC_MSG_ERROR(
8780                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8781             ;;
8782         esac
8783     done
8784     AC_MSG_RESULT([no])
8785     EPM=NO
8787 AC_SUBST(EPM)
8789 ENABLE_LWP=
8790 if test "$enable_lotuswordpro" = "yes"; then
8791     ENABLE_LWP="TRUE"
8793 AC_SUBST(ENABLE_LWP)
8795 dnl ===================================================================
8796 dnl Check for building ODK
8797 dnl ===================================================================
8798 if test "$enable_odk" = no; then
8799     unset DOXYGEN
8800 else
8801     if test "$with_doxygen" = no; then
8802         AC_MSG_CHECKING([for doxygen])
8803         unset DOXYGEN
8804         AC_MSG_RESULT([no])
8805     else
8806         if test "$with_doxygen" = yes; then
8807             AC_PATH_PROG([DOXYGEN], [doxygen])
8808             if test -z "$DOXYGEN"; then
8809                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8810             fi
8811             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8812                 if ! dot -V 2>/dev/null; then
8813                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8814                 fi
8815             fi
8816         else
8817             AC_MSG_CHECKING([for doxygen])
8818             DOXYGEN=$with_doxygen
8819             AC_MSG_RESULT([$DOXYGEN])
8820         fi
8821         if test -n "$DOXYGEN"; then
8822             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8823             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8824             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8825                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8826             fi
8827         fi
8828     fi
8830 AC_SUBST([DOXYGEN])
8832 AC_MSG_CHECKING([whether to build the ODK])
8833 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8834     AC_MSG_RESULT([yes])
8836     if test "$with_java" != "no"; then
8837         AC_MSG_CHECKING([whether to build unowinreg.dll])
8838         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8839             # build on Win by default
8840             enable_build_unowinreg=yes
8841         fi
8842         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8843             AC_MSG_RESULT([no])
8844             BUILD_UNOWINREG=
8845         else
8846             AC_MSG_RESULT([yes])
8847             BUILD_UNOWINREG=TRUE
8848         fi
8849         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8850             if test -z "$with_mingw_cross_compiler"; then
8851                 dnl Guess...
8852                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8853             elif test -x "$with_mingw_cross_compiler"; then
8854                  MINGWCXX="$with_mingw_cross_compiler"
8855             else
8856                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8857             fi
8859             if test "$MINGWCXX" = "false"; then
8860                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8861             fi
8863             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8864             if test -x "$mingwstrip_test"; then
8865                 MINGWSTRIP="$mingwstrip_test"
8866             else
8867                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8868             fi
8870             if test "$MINGWSTRIP" = "false"; then
8871                 AC_MSG_ERROR(MinGW32 binutils not found.)
8872             fi
8873         fi
8874     fi
8875     BUILD_TYPE="$BUILD_TYPE ODK"
8876 else
8877     AC_MSG_RESULT([no])
8878     BUILD_UNOWINREG=
8880 AC_SUBST(BUILD_UNOWINREG)
8881 AC_SUBST(MINGWCXX)
8882 AC_SUBST(MINGWSTRIP)
8884 dnl ===================================================================
8885 dnl Check for system zlib
8886 dnl ===================================================================
8887 if test "$with_system_zlib" = "auto"; then
8888     case "$_os" in
8889     WINNT)
8890         with_system_zlib="$with_system_libs"
8891         ;;
8892     *)
8893         if test "$enable_fuzzers" != "yes"; then
8894             with_system_zlib=yes
8895         else
8896             with_system_zlib=no
8897         fi
8898         ;;
8899     esac
8902 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8903 dnl and has no pkg-config for it at least on some tinderboxes,
8904 dnl so leaving that out for now
8905 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8906 AC_MSG_CHECKING([which zlib to use])
8907 if test "$with_system_zlib" = "yes"; then
8908     AC_MSG_RESULT([external])
8909     SYSTEM_ZLIB=TRUE
8910     AC_CHECK_HEADER(zlib.h, [],
8911         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8912     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8913         [AC_MSG_ERROR(zlib not found or functional)], [])
8914 else
8915     AC_MSG_RESULT([internal])
8916     SYSTEM_ZLIB=
8917     BUILD_TYPE="$BUILD_TYPE ZLIB"
8918     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8919     if test "$COM" = "MSC"; then
8920         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
8921     else
8922         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8923     fi
8925 AC_SUBST(ZLIB_CFLAGS)
8926 AC_SUBST(ZLIB_LIBS)
8927 AC_SUBST(SYSTEM_ZLIB)
8929 dnl ===================================================================
8930 dnl Check for system jpeg
8931 dnl ===================================================================
8932 AC_MSG_CHECKING([which libjpeg to use])
8933 if test "$with_system_jpeg" = "yes"; then
8934     AC_MSG_RESULT([external])
8935     SYSTEM_LIBJPEG=TRUE
8936     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8937         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8938     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8939         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8940 else
8941     SYSTEM_LIBJPEG=
8942     AC_MSG_RESULT([internal, libjpeg-turbo])
8943     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8945     case "$host_cpu" in
8946     x86_64 | amd64 | i*86 | x86 | ia32)
8947         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8948         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8949             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8950                 NASM="$LODE_HOME/opt/bin/nasm"
8951             elif test -x "/opt/lo/bin/nasm"; then
8952                 NASM="/opt/lo/bin/nasm"
8953             fi
8954         fi
8956         if test -n "$NASM"; then
8957             AC_MSG_CHECKING([for object file format of host system])
8958             case "$host_os" in
8959               cygwin* | mingw* | pw32* | wsl*)
8960                 case "$host_cpu" in
8961                   x86_64)
8962                     objfmt='Win64-COFF'
8963                     ;;
8964                   *)
8965                     objfmt='Win32-COFF'
8966                     ;;
8967                 esac
8968               ;;
8969               msdosdjgpp* | go32*)
8970                 objfmt='COFF'
8971               ;;
8972               os2-emx*) # not tested
8973                 objfmt='MSOMF' # obj
8974               ;;
8975               linux*coff* | linux*oldld*)
8976                 objfmt='COFF' # ???
8977               ;;
8978               linux*aout*)
8979                 objfmt='a.out'
8980               ;;
8981               linux*)
8982                 case "$host_cpu" in
8983                   x86_64)
8984                     objfmt='ELF64'
8985                     ;;
8986                   *)
8987                     objfmt='ELF'
8988                     ;;
8989                 esac
8990               ;;
8991               kfreebsd* | freebsd* | netbsd* | openbsd*)
8992                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8993                   objfmt='BSD-a.out'
8994                 else
8995                   case "$host_cpu" in
8996                     x86_64 | amd64)
8997                       objfmt='ELF64'
8998                       ;;
8999                     *)
9000                       objfmt='ELF'
9001                       ;;
9002                   esac
9003                 fi
9004               ;;
9005               solaris* | sunos* | sysv* | sco*)
9006                 case "$host_cpu" in
9007                   x86_64)
9008                     objfmt='ELF64'
9009                     ;;
9010                   *)
9011                     objfmt='ELF'
9012                     ;;
9013                 esac
9014               ;;
9015               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9016                 case "$host_cpu" in
9017                   x86_64)
9018                     objfmt='Mach-O64'
9019                     ;;
9020                   *)
9021                     objfmt='Mach-O'
9022                     ;;
9023                 esac
9024               ;;
9025               *)
9026                 objfmt='ELF ?'
9027               ;;
9028             esac
9030             AC_MSG_RESULT([$objfmt])
9031             if test "$objfmt" = 'ELF ?'; then
9032               objfmt='ELF'
9033               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9034             fi
9036             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9037             case "$objfmt" in
9038               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9039               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9040               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9041               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9042               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9043               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9044               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9045               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9046               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9047               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9048               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9049             esac
9050             AC_MSG_RESULT([$NAFLAGS])
9052             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9053             cat > conftest.asm << EOF
9054             [%line __oline__ "configure"
9055                     section .text
9056                     global  _main,main
9057             _main:
9058             main:   xor     eax,eax
9059                     ret
9060             ]
9062             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9063             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9064               AC_MSG_RESULT(yes)
9065             else
9066               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9067               cat conftest.asm >&AS_MESSAGE_LOG_FD
9068               rm -rf conftest*
9069               AC_MSG_RESULT(no)
9070               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9071               NASM=""
9072             fi
9074         fi
9076         if test -z "$NASM"; then
9077 cat << _EOS
9078 ****************************************************************************
9079 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9080 To get one please:
9082 _EOS
9083             if test "$build_os" = "cygwin"; then
9084 cat << _EOS
9085 install a pre-compiled binary for Win32
9087 mkdir -p /opt/lo/bin
9088 cd /opt/lo/bin
9089 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9090 chmod +x nasm
9092 or get and install one from http://www.nasm.us/
9094 Then re-run autogen.sh
9096 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9097 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9099 _EOS
9100             else
9101 cat << _EOS
9102 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9104 _EOS
9105             fi
9106             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9107             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9108         fi
9109       ;;
9110     esac
9113 AC_SUBST(NASM)
9114 AC_SUBST(NAFLAGS)
9115 AC_SUBST(LIBJPEG_CFLAGS)
9116 AC_SUBST(LIBJPEG_LIBS)
9117 AC_SUBST(SYSTEM_LIBJPEG)
9119 dnl ===================================================================
9120 dnl Check for system clucene
9121 dnl ===================================================================
9122 dnl we should rather be using
9123 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9124 dnl but the contribs-lib check seems tricky
9125 AC_MSG_CHECKING([which clucene to use])
9126 if test "$with_system_clucene" = "yes"; then
9127     AC_MSG_RESULT([external])
9128     SYSTEM_CLUCENE=TRUE
9129     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9130     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9131     FilterLibs "${CLUCENE_LIBS}"
9132     CLUCENE_LIBS="${filteredlibs}"
9133     AC_LANG_PUSH([C++])
9134     save_CXXFLAGS=$CXXFLAGS
9135     save_CPPFLAGS=$CPPFLAGS
9136     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9137     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9138     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9139     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9140     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9141                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9142     CXXFLAGS=$save_CXXFLAGS
9143     CPPFLAGS=$save_CPPFLAGS
9144     AC_LANG_POP([C++])
9146     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9147 else
9148     AC_MSG_RESULT([internal])
9149     SYSTEM_CLUCENE=
9150     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9152 AC_SUBST(SYSTEM_CLUCENE)
9153 AC_SUBST(CLUCENE_CFLAGS)
9154 AC_SUBST(CLUCENE_LIBS)
9156 dnl ===================================================================
9157 dnl Check for system expat
9158 dnl ===================================================================
9159 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9161 dnl ===================================================================
9162 dnl Check for system xmlsec
9163 dnl ===================================================================
9164 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9166 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9167 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9168     ENABLE_EOT="TRUE"
9169     AC_DEFINE([ENABLE_EOT])
9170     AC_MSG_RESULT([yes])
9172     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9173 else
9174     ENABLE_EOT=
9175     AC_MSG_RESULT([no])
9177 AC_SUBST([ENABLE_EOT])
9179 dnl ===================================================================
9180 dnl Check for DLP libs
9181 dnl ===================================================================
9182 AS_IF([test "$COM" = "MSC"],
9183       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9184       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9186 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9188 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9190 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9192 AS_IF([test "$COM" = "MSC"],
9193       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9194       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9196 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9198 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9200 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9201 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9203 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9205 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9207 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9209 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9210 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.17])
9212 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9213 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9215 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9217 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9218 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9220 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9222 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9224 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9226 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9228 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9229 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9231 dnl ===================================================================
9232 dnl Check for system lcms2
9233 dnl ===================================================================
9234 if test "$with_system_lcms2" != "yes"; then
9235     SYSTEM_LCMS2=
9237 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9238 if test "$GCC" = "yes"; then
9239     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9241 if test "$COM" = "MSC"; then # override the above
9242     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9245 dnl ===================================================================
9246 dnl Check for system cppunit
9247 dnl ===================================================================
9248 if test "$_os" != "Android" ; then
9249     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9252 dnl ===================================================================
9253 dnl Check whether freetype is available
9254 dnl ===================================================================
9255 if test  "$test_freetype" = "yes"; then
9256     AC_MSG_CHECKING([whether freetype is available])
9257     # FreeType has 3 different kinds of versions
9258     # * release, like 2.4.10
9259     # * libtool, like 13.0.7 (this what pkg-config returns)
9260     # * soname
9261     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9262     #
9263     # 9.9.3 is 2.2.0
9264     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9265     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9266     FilterLibs "${FREETYPE_LIBS}"
9267     FREETYPE_LIBS="${filteredlibs}"
9268     SYSTEM_FREETYPE=TRUE
9269 else
9270     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9271     if test "x$ac_config_site_64bit_host" = xYES; then
9272         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9273     else
9274         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9275     fi
9277 AC_SUBST(FREETYPE_CFLAGS)
9278 AC_SUBST(FREETYPE_LIBS)
9279 AC_SUBST([SYSTEM_FREETYPE])
9281 # ===================================================================
9282 # Check for system libxslt
9283 # to prevent incompatibilities between internal libxml2 and external libxslt,
9284 # or vice versa, use with_system_libxml here
9285 # ===================================================================
9286 if test "$with_system_libxml" = "auto"; then
9287     case "$_os" in
9288     WINNT|iOS|Android)
9289         with_system_libxml="$with_system_libs"
9290         ;;
9291     *)
9292         if test "$enable_fuzzers" != "yes"; then
9293             with_system_libxml=yes
9294         else
9295             with_system_libxml=no
9296         fi
9297         ;;
9298     esac
9301 AC_MSG_CHECKING([which libxslt to use])
9302 if test "$with_system_libxml" = "yes"; then
9303     AC_MSG_RESULT([external])
9304     SYSTEM_LIBXSLT=TRUE
9305     if test "$_os" = "Darwin"; then
9306         dnl make sure to use SDK path
9307         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9308         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9309         dnl omit -L/usr/lib
9310         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9311         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9312     else
9313         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9314         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9315         FilterLibs "${LIBXSLT_LIBS}"
9316         LIBXSLT_LIBS="${filteredlibs}"
9317         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9318         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9319         FilterLibs "${LIBEXSLT_LIBS}"
9320         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9321     fi
9323     dnl Check for xsltproc
9324     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9325     if test "$XSLTPROC" = "no"; then
9326         AC_MSG_ERROR([xsltproc is required])
9327     fi
9328 else
9329     AC_MSG_RESULT([internal])
9330     SYSTEM_LIBXSLT=
9331     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9333 AC_SUBST(SYSTEM_LIBXSLT)
9334 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9335     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9337 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9339 AC_SUBST(LIBEXSLT_CFLAGS)
9340 AC_SUBST(LIBEXSLT_LIBS)
9341 AC_SUBST(LIBXSLT_CFLAGS)
9342 AC_SUBST(LIBXSLT_LIBS)
9343 AC_SUBST(XSLTPROC)
9345 # ===================================================================
9346 # Check for system libxml
9347 # ===================================================================
9348 AC_MSG_CHECKING([which libxml to use])
9349 if test "$with_system_libxml" = "yes"; then
9350     AC_MSG_RESULT([external])
9351     SYSTEM_LIBXML=TRUE
9352     if test "$_os" = "Darwin"; then
9353         dnl make sure to use SDK path
9354         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9355         dnl omit -L/usr/lib
9356         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9357     elif test $_os = iOS; then
9358         dnl make sure to use SDK path
9359         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9360         LIBXML_CFLAGS="-I$usr/include/libxml2"
9361         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9362     else
9363         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9364         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9365         FilterLibs "${LIBXML_LIBS}"
9366         LIBXML_LIBS="${filteredlibs}"
9367     fi
9369     dnl Check for xmllint
9370     AC_PATH_PROG(XMLLINT, xmllint, no)
9371     if test "$XMLLINT" = "no"; then
9372         AC_MSG_ERROR([xmllint is required])
9373     fi
9374 else
9375     AC_MSG_RESULT([internal])
9376     SYSTEM_LIBXML=
9377     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9378     if test "$COM" = "MSC"; then
9379         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9380     fi
9381     if test "$COM" = "MSC"; then
9382         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9383     else
9384         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9385         if test "$_os" = Android; then
9386             LIBXML_LIBS="$LIBXML_LIBS -lm"
9387         fi
9388     fi
9389     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9391 AC_SUBST(SYSTEM_LIBXML)
9392 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9393     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9395 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9396 AC_SUBST(LIBXML_CFLAGS)
9397 AC_SUBST(LIBXML_LIBS)
9398 AC_SUBST(XMLLINT)
9400 # =====================================================================
9401 # Checking for a Python interpreter with version >= 3.3.
9402 # Optionally user can pass an option to configure, i. e.
9403 # ./configure PYTHON=/usr/bin/python
9404 # =====================================================================
9405 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
9406     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9407     enable_python=internal
9409 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9410     if test -n "$PYTHON"; then
9411         PYTHON_FOR_BUILD=$PYTHON
9412     else
9413         # This allows a lack of system python with no error, we use internal one in that case.
9414         AM_PATH_PYTHON([3.3],, [:])
9415         # Clean PYTHON_VERSION checked below if cross-compiling
9416         PYTHON_VERSION=""
9417         if test "$PYTHON" != ":"; then
9418             PYTHON_FOR_BUILD=$PYTHON
9419         fi
9420     fi
9422 AC_SUBST(PYTHON_FOR_BUILD)
9424 # Checks for Python to use for Pyuno
9425 AC_MSG_CHECKING([which Python to use for Pyuno])
9426 case "$enable_python" in
9427 no|disable)
9428     if test -z $PYTHON_FOR_BUILD; then
9429         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9430         # requirement from the choice whether to include Python stuff in the installer, but why
9431         # bother?
9432         AC_MSG_ERROR([Python is required at build time.])
9433     fi
9434     enable_python=no
9435     AC_MSG_RESULT([none])
9436     ;;
9437 ""|yes|auto)
9438     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9439         AC_MSG_RESULT([no, overridden by --disable-scripting])
9440         enable_python=no
9441     elif test $build_os = cygwin; then
9442         dnl When building on Windows we don't attempt to use any installed
9443         dnl "system"  Python.
9444         AC_MSG_RESULT([fully internal])
9445         enable_python=internal
9446     elif test "$cross_compiling" = yes; then
9447         AC_MSG_RESULT([system])
9448         enable_python=system
9449     else
9450         # Unset variables set by the above AM_PATH_PYTHON so that
9451         # we actually do check anew.
9452         AC_MSG_RESULT([])
9453         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
9454         AM_PATH_PYTHON([3.3],, [:])
9455         AC_MSG_CHECKING([which Python to use for Pyuno])
9456         if test "$PYTHON" = ":"; then
9457             if test -z "$PYTHON_FOR_BUILD"; then
9458                 AC_MSG_RESULT([fully internal])
9459             else
9460                 AC_MSG_RESULT([internal])
9461             fi
9462             enable_python=internal
9463         else
9464             AC_MSG_RESULT([system])
9465             enable_python=system
9466         fi
9467     fi
9468     ;;
9469 internal)
9470     AC_MSG_RESULT([internal])
9471     ;;
9472 fully-internal)
9473     AC_MSG_RESULT([fully internal])
9474     enable_python=internal
9475     ;;
9476 system)
9477     AC_MSG_RESULT([system])
9478     if test "$_os" = Darwin; then
9479         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9480     fi
9481     ;;
9483     AC_MSG_ERROR([Incorrect --enable-python option])
9484     ;;
9485 esac
9487 if test $enable_python != no; then
9488     BUILD_TYPE="$BUILD_TYPE PYUNO"
9491 if test $enable_python = system; then
9492     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9493         # Fallback: Accept these in the environment, or as set above
9494         # for MacOSX.
9495         :
9496     elif test "$cross_compiling" != yes; then
9497         # Unset variables set by the above AM_PATH_PYTHON so that
9498         # we actually do check anew.
9499         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
9500         # This causes an error if no python command is found
9501         AM_PATH_PYTHON([3.3])
9502         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9503         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9504         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9505         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9506         if test -z "$PKG_CONFIG"; then
9507             PYTHON_CFLAGS="-I$python_include"
9508             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9509         elif $PKG_CONFIG --exists python-$python_version-embed; then
9510             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9511             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9512         elif $PKG_CONFIG --exists python-$python_version; then
9513             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9514             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9515         else
9516             PYTHON_CFLAGS="-I$python_include"
9517             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9518         fi
9519         FilterLibs "${PYTHON_LIBS}"
9520         PYTHON_LIBS="${filteredlibs}"
9521     else
9522         dnl How to find out the cross-compilation Python installation path?
9523         AC_MSG_CHECKING([for python version])
9524         AS_IF([test -n "$PYTHON_VERSION"],
9525               [AC_MSG_RESULT([$PYTHON_VERSION])],
9526               [AC_MSG_RESULT([not found])
9527                AC_MSG_ERROR([no usable python found])])
9528         test -n "$PYTHON_CFLAGS" && break
9529     fi
9531     dnl Check if the headers really work
9532     save_CPPFLAGS="$CPPFLAGS"
9533     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9534     AC_CHECK_HEADER(Python.h)
9535     CPPFLAGS="$save_CPPFLAGS"
9537     # let the PYTHON_FOR_BUILD match the same python installation that
9538     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9539     # better for PythonTests.
9540     PYTHON_FOR_BUILD=$PYTHON
9543 if test "$with_lxml" != no; then
9544     if test -z "$PYTHON_FOR_BUILD"; then
9545         case $build_os in
9546             cygwin)
9547                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9548                 ;;
9549             *)
9550                 if test "$cross_compiling" != yes ; then
9551                     BUILD_TYPE="$BUILD_TYPE LXML"
9552                 fi
9553                 ;;
9554         esac
9555     else
9556         AC_MSG_CHECKING([for python lxml])
9557         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9558             AC_MSG_RESULT([yes])
9559         else
9560             case $build_os in
9561                 cygwin)
9562                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9563                     ;;
9564                 *)
9565                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9566                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9567                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9568                         else
9569                             BUILD_TYPE="$BUILD_TYPE LXML"
9570                             AC_MSG_RESULT([no, using internal lxml])
9571                         fi
9572                     else
9573                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9574                     fi
9575                     ;;
9576             esac
9577         fi
9578     fi
9581 dnl By now enable_python should be "system", "internal" or "no"
9582 case $enable_python in
9583 system)
9584     SYSTEM_PYTHON=TRUE
9586     if test "x$ac_cv_header_Python_h" != "xyes"; then
9587        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9588     fi
9590     AC_LANG_PUSH(C)
9591     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9592     AC_MSG_CHECKING([for correct python library version])
9593        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9594 #include <Python.h>
9596 int main(int argc, char **argv) {
9597    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9598    else return 1;
9600        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9601     AC_LANG_POP(C)
9603     dnl FIXME Check if the Python library can be linked with, too?
9604     ;;
9606 internal)
9607     SYSTEM_PYTHON=
9608     PYTHON_VERSION_MAJOR=3
9609     PYTHON_VERSION_MINOR=8
9610     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9611     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9612         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9613     fi
9614     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9615     BUILD_TYPE="$BUILD_TYPE PYTHON"
9616     if test "$OS" = LINUX -o "$OS" = WNT ; then
9617         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9618     fi
9619     # Embedded Python dies without Home set
9620     if test "$HOME" = ""; then
9621         export HOME=""
9622     fi
9623     ;;
9625     DISABLE_PYTHON=TRUE
9626     SYSTEM_PYTHON=
9627     ;;
9629     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9630     ;;
9631 esac
9633 AC_SUBST(DISABLE_PYTHON)
9634 AC_SUBST(SYSTEM_PYTHON)
9635 AC_SUBST(PYTHON_CFLAGS)
9636 AC_SUBST(PYTHON_LIBS)
9637 AC_SUBST(PYTHON_VERSION)
9638 AC_SUBST(PYTHON_VERSION_MAJOR)
9639 AC_SUBST(PYTHON_VERSION_MINOR)
9641 ENABLE_MARIADBC=
9642 MARIADBC_MAJOR=1
9643 MARIADBC_MINOR=0
9644 MARIADBC_MICRO=2
9645 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9646 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9647     ENABLE_MARIADBC=TRUE
9648     AC_MSG_RESULT([yes])
9649     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9650 else
9651     AC_MSG_RESULT([no])
9653 AC_SUBST(ENABLE_MARIADBC)
9654 AC_SUBST(MARIADBC_MAJOR)
9655 AC_SUBST(MARIADBC_MINOR)
9656 AC_SUBST(MARIADBC_MICRO)
9658 if test "$ENABLE_MARIADBC" = "TRUE"; then
9659     dnl ===================================================================
9660     dnl Check for system MariaDB
9661     dnl ===================================================================
9662     AC_MSG_CHECKING([which MariaDB to use])
9663     if test "$with_system_mariadb" = "yes"; then
9664         AC_MSG_RESULT([external])
9665         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9666         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9667         if test -z "$MARIADBCONFIG"; then
9668             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9669             if test -z "$MARIADBCONFIG"; then
9670                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9671                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9672             fi
9673         fi
9674         AC_MSG_CHECKING([MariaDB version])
9675         MARIADB_VERSION=`$MARIADBCONFIG --version`
9676         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9677         if test "$MARIADB_MAJOR" -ge "5"; then
9678             AC_MSG_RESULT([OK])
9679         else
9680             AC_MSG_ERROR([too old, use 5.0.x or later])
9681         fi
9682         AC_MSG_CHECKING([for MariaDB Client library])
9683         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9684         if test "$COM_IS_CLANG" = TRUE; then
9685             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9686         fi
9687         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9688         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9689         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9690         dnl linux32:
9691         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9692             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9693             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9694                 | sed -e 's|/lib64/|/lib/|')
9695         fi
9696         FilterLibs "${MARIADB_LIBS}"
9697         MARIADB_LIBS="${filteredlibs}"
9698         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9699         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9700         if test "$enable_bundle_mariadb" = "yes"; then
9701             AC_MSG_RESULT([yes])
9702             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9703             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9705 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9707 /g' | grep -E '(mysqlclient|mariadb)')
9708             if test "$_os" = "Darwin"; then
9709                 LIBMARIADB=${LIBMARIADB}.dylib
9710             elif test "$_os" = "WINNT"; then
9711                 LIBMARIADB=${LIBMARIADB}.dll
9712             else
9713                 LIBMARIADB=${LIBMARIADB}.so
9714             fi
9715             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9716             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9717             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9718                 AC_MSG_RESULT([found.])
9719                 PathFormat "$LIBMARIADB_PATH"
9720                 LIBMARIADB_PATH="$formatted_path"
9721             else
9722                 AC_MSG_ERROR([not found.])
9723             fi
9724         else
9725             AC_MSG_RESULT([no])
9726             BUNDLE_MARIADB_CONNECTOR_C=
9727         fi
9728     else
9729         AC_MSG_RESULT([internal])
9730         SYSTEM_MARIADB_CONNECTOR_C=
9731         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9732         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9733         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9734     fi
9736     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9737     AC_SUBST(MARIADB_CFLAGS)
9738     AC_SUBST(MARIADB_LIBS)
9739     AC_SUBST(LIBMARIADB)
9740     AC_SUBST(LIBMARIADB_PATH)
9741     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9744 dnl ===================================================================
9745 dnl Check for system hsqldb
9746 dnl ===================================================================
9747 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9748     HSQLDB_USE_JDBC_4_1=
9749     AC_MSG_CHECKING([which hsqldb to use])
9750     if test "$with_system_hsqldb" = "yes"; then
9751         AC_MSG_RESULT([external])
9752         SYSTEM_HSQLDB=TRUE
9753         if test -z $HSQLDB_JAR; then
9754             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9755         fi
9756         if ! test -f $HSQLDB_JAR; then
9757                AC_MSG_ERROR(hsqldb.jar not found.)
9758         fi
9759         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9760         export HSQLDB_JAR
9761         if $PERL -e \
9762            'use Archive::Zip;
9763             my $file = "$ENV{'HSQLDB_JAR'}";
9764             my $zip = Archive::Zip->new( $file );
9765             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9766             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9767             {
9768                 push @l, split(/\n/, $mf);
9769                 foreach my $line (@l)
9770                 {
9771                     if ($line =~ m/Specification-Version:/)
9772                     {
9773                         ($t, $version) = split (/:/,$line);
9774                         $version =~ s/^\s//;
9775                         ($a, $b, $c, $d) = split (/\./,$version);
9776                         if ($c == "0" && $d > "8")
9777                         {
9778                             exit 0;
9779                         }
9780                         else
9781                         {
9782                             exit 1;
9783                         }
9784                     }
9785                 }
9786             }
9787             else
9788             {
9789                 exit 1;
9790             }'; then
9791             AC_MSG_RESULT([yes])
9792         else
9793             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9794         fi
9795     else
9796         AC_MSG_RESULT([internal])
9797         SYSTEM_HSQLDB=
9798         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9799         NEED_ANT=TRUE
9800         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9801         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9802         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9803             AC_MSG_RESULT([yes])
9804             HSQLDB_USE_JDBC_4_1=TRUE
9805         else
9806             AC_MSG_RESULT([no])
9807         fi
9808     fi
9809 else
9810     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9811         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9812     fi
9814 AC_SUBST(SYSTEM_HSQLDB)
9815 AC_SUBST(HSQLDB_JAR)
9816 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9818 dnl ===================================================================
9819 dnl Check for PostgreSQL stuff
9820 dnl ===================================================================
9821 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9822 if test "x$enable_postgresql_sdbc" != "xno"; then
9823     AC_MSG_RESULT([yes])
9824     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9826     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9827         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9828     fi
9829     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9830         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9831     fi
9833     postgres_interface=""
9834     if test "$with_system_postgresql" = "yes"; then
9835         postgres_interface="external PostgreSQL"
9836         SYSTEM_POSTGRESQL=TRUE
9837         if test "$_os" = Darwin; then
9838             supp_path=''
9839             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9840                 pg_supp_path="$P_SEP$d$pg_supp_path"
9841             done
9842         fi
9843         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9844         if test -n "$PGCONFIG"; then
9845             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9846             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9847         else
9848             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9849               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9850               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9851             ],[
9852               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9853             ])
9854         fi
9855         FilterLibs "${POSTGRESQL_LIB}"
9856         POSTGRESQL_LIB="${filteredlibs}"
9857     else
9858         # if/when anything else than PostgreSQL uses Kerberos,
9859         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9860         WITH_KRB5=
9861         WITH_GSSAPI=
9862         case "$_os" in
9863         Darwin)
9864             # macOS has system MIT Kerberos 5 since 10.4
9865             if test "$with_krb5" != "no"; then
9866                 WITH_KRB5=TRUE
9867                 save_LIBS=$LIBS
9868                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9869                 # that the libraries where these functions are located on macOS will change, is it?
9870                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9871                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9872                 KRB5_LIBS=$LIBS
9873                 LIBS=$save_LIBS
9874                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9875                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9876                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9877                 LIBS=$save_LIBS
9878             fi
9879             if test "$with_gssapi" != "no"; then
9880                 WITH_GSSAPI=TRUE
9881                 save_LIBS=$LIBS
9882                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9883                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9884                 GSSAPI_LIBS=$LIBS
9885                 LIBS=$save_LIBS
9886             fi
9887             ;;
9888         WINNT)
9889             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9890                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9891             fi
9892             ;;
9893         Linux|GNU|*BSD|DragonFly)
9894             if test "$with_krb5" != "no"; then
9895                 WITH_KRB5=TRUE
9896                 save_LIBS=$LIBS
9897                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9898                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9899                 KRB5_LIBS=$LIBS
9900                 LIBS=$save_LIBS
9901                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9902                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9903                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9904                 LIBS=$save_LIBS
9905             fi
9906             if test "$with_gssapi" != "no"; then
9907                 WITH_GSSAPI=TRUE
9908                 save_LIBS=$LIBS
9909                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9910                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9911                 GSSAPI_LIBS=$LIBS
9912                 LIBS=$save_LIBS
9913             fi
9914             ;;
9915         *)
9916             if test "$with_krb5" = "yes"; then
9917                 WITH_KRB5=TRUE
9918                 save_LIBS=$LIBS
9919                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9920                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9921                 KRB5_LIBS=$LIBS
9922                 LIBS=$save_LIBS
9923                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9924                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9925                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9926                 LIBS=$save_LIBS
9927             fi
9928             if test "$with_gssapi" = "yes"; then
9929                 WITH_GSSAPI=TRUE
9930                 save_LIBS=$LIBS
9931                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9932                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9933                 LIBS=$save_LIBS
9934                 GSSAPI_LIBS=$LIBS
9935             fi
9936         esac
9938         if test -n "$with_libpq_path"; then
9939             SYSTEM_POSTGRESQL=TRUE
9940             postgres_interface="external libpq"
9941             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9942             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9943         else
9944             SYSTEM_POSTGRESQL=
9945             postgres_interface="internal"
9946             POSTGRESQL_LIB=""
9947             POSTGRESQL_INC="%OVERRIDE_ME%"
9948             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9949         fi
9950     fi
9952     AC_MSG_CHECKING([PostgreSQL C interface])
9953     AC_MSG_RESULT([$postgres_interface])
9955     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9956         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9957         save_CFLAGS=$CFLAGS
9958         save_CPPFLAGS=$CPPFLAGS
9959         save_LIBS=$LIBS
9960         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9961         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9962         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9963         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9964             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9965         CFLAGS=$save_CFLAGS
9966         CPPFLAGS=$save_CPPFLAGS
9967         LIBS=$save_LIBS
9968     fi
9969     BUILD_POSTGRESQL_SDBC=TRUE
9970 else
9971     AC_MSG_RESULT([no])
9973 AC_SUBST(WITH_KRB5)
9974 AC_SUBST(WITH_GSSAPI)
9975 AC_SUBST(GSSAPI_LIBS)
9976 AC_SUBST(KRB5_LIBS)
9977 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9978 AC_SUBST(SYSTEM_POSTGRESQL)
9979 AC_SUBST(POSTGRESQL_INC)
9980 AC_SUBST(POSTGRESQL_LIB)
9982 dnl ===================================================================
9983 dnl Check for Firebird stuff
9984 dnl ===================================================================
9985 ENABLE_FIREBIRD_SDBC=
9986 if test "$enable_firebird_sdbc" = "yes" ; then
9987     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9989     dnl ===================================================================
9990     dnl Check for system Firebird
9991     dnl ===================================================================
9992     AC_MSG_CHECKING([which Firebird to use])
9993     if test "$with_system_firebird" = "yes"; then
9994         AC_MSG_RESULT([external])
9995         SYSTEM_FIREBIRD=TRUE
9996         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9997         if test -z "$FIREBIRDCONFIG"; then
9998             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9999             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10000                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10001             ])
10002             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10003         else
10004             AC_MSG_NOTICE([fb_config found])
10005             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10006             AC_MSG_CHECKING([for Firebird Client library])
10007             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10008             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10009             FilterLibs "${FIREBIRD_LIBS}"
10010             FIREBIRD_LIBS="${filteredlibs}"
10011         fi
10012         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10013         AC_MSG_CHECKING([Firebird version])
10014         if test -n "${FIREBIRD_VERSION}"; then
10015             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10016             if test "$FIREBIRD_MAJOR" -ge "3"; then
10017                 AC_MSG_RESULT([OK])
10018             else
10019                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10020             fi
10021         else
10022             save_CFLAGS="${CFLAGS}"
10023             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10024             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10025 #if defined(FB_API_VER) && FB_API_VER == 30
10026 int fb_api_is_30(void) { return 0; }
10027 #else
10028 #error "Wrong Firebird API version"
10029 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10030             CFLAGS="$save_CFLAGS"
10031         fi
10032         ENABLE_FIREBIRD_SDBC=TRUE
10033         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10034     elif test "$enable_database_connectivity" != yes; then
10035         AC_MSG_RESULT([none])
10036     elif test "$cross_compiling" = "yes"; then
10037         AC_MSG_RESULT([none])
10038     else
10039         dnl Embedded Firebird has version 3.0
10040         dnl We need libatomic_ops for any non X86/X64 system
10041         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10042             dnl ===================================================================
10043             dnl Check for system libatomic_ops
10044             dnl ===================================================================
10045             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10046             if test "$with_system_libatomic_ops" = "yes"; then
10047                 SYSTEM_LIBATOMIC_OPS=TRUE
10048                 AC_CHECK_HEADERS(atomic_ops.h, [],
10049                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10050             else
10051                 SYSTEM_LIBATOMIC_OPS=
10052                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10053                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10054                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10055             fi
10056         fi
10058         AC_MSG_RESULT([internal])
10059         SYSTEM_FIREBIRD=
10060         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10061         FIREBIRD_LIBS="-lfbclient"
10063         if test "$with_system_libtommath" = "yes"; then
10064             SYSTEM_LIBTOMMATH=TRUE
10065             dnl check for tommath presence
10066             save_LIBS=$LIBS
10067             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10068             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10069             LIBS=$save_LIBS
10070         else
10071             SYSTEM_LIBTOMMATH=
10072             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10073             LIBTOMMATH_LIBS="-ltommath"
10074             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10075         fi
10077         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10078         ENABLE_FIREBIRD_SDBC=TRUE
10079         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10080     fi
10082 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10083 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10084 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10085 AC_SUBST(LIBATOMIC_OPS_LIBS)
10086 AC_SUBST(SYSTEM_FIREBIRD)
10087 AC_SUBST(FIREBIRD_CFLAGS)
10088 AC_SUBST(FIREBIRD_LIBS)
10089 AC_SUBST(SYSTEM_LIBTOMMATH)
10090 AC_SUBST(LIBTOMMATH_CFLAGS)
10091 AC_SUBST(LIBTOMMATH_LIBS)
10093 dnl ===================================================================
10094 dnl Check for system curl
10095 dnl ===================================================================
10096 AC_MSG_CHECKING([which libcurl to use])
10097 if test "$with_system_curl" = "auto"; then
10098     with_system_curl="$with_system_libs"
10101 if test "$with_system_curl" = "yes"; then
10102     AC_MSG_RESULT([external])
10103     SYSTEM_CURL=TRUE
10105     # First try PKGCONFIG and then fall back
10106     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10108     if test -n "$CURL_PKG_ERRORS"; then
10109         AC_PATH_PROG(CURLCONFIG, curl-config)
10110         if test -z "$CURLCONFIG"; then
10111             AC_MSG_ERROR([curl development files not found])
10112         fi
10113         CURL_LIBS=`$CURLCONFIG --libs`
10114         FilterLibs "${CURL_LIBS}"
10115         CURL_LIBS="${filteredlibs}"
10116         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10117         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10119         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10120         case $curl_version in
10121         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10122         dnl so they need to be doubled to end up in the configure script
10123         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10124             AC_MSG_RESULT([yes])
10125             ;;
10126         *)
10127             AC_MSG_ERROR([no, you have $curl_version])
10128             ;;
10129         esac
10130     fi
10132     ENABLE_CURL=TRUE
10133 else
10134     AC_MSG_RESULT([internal])
10135     SYSTEM_CURL=
10136     BUILD_TYPE="$BUILD_TYPE CURL"
10137     ENABLE_CURL=TRUE
10139 AC_SUBST(SYSTEM_CURL)
10140 AC_SUBST(CURL_CFLAGS)
10141 AC_SUBST(CURL_LIBS)
10142 AC_SUBST(ENABLE_CURL)
10144 dnl ===================================================================
10145 dnl Check for system boost
10146 dnl ===================================================================
10147 AC_MSG_CHECKING([which boost to use])
10148 if test "$with_system_boost" = "yes"; then
10149     AC_MSG_RESULT([external])
10150     SYSTEM_BOOST=TRUE
10151     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10152     AX_BOOST_DATE_TIME
10153     AX_BOOST_FILESYSTEM
10154     AX_BOOST_IOSTREAMS
10155     AX_BOOST_LOCALE
10156     AC_LANG_PUSH([C++])
10157     save_CXXFLAGS=$CXXFLAGS
10158     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10159     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10160        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10161     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10162        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10163     CXXFLAGS=$save_CXXFLAGS
10164     AC_LANG_POP([C++])
10165     # this is in m4/ax_boost_base.m4
10166     FilterLibs "${BOOST_LDFLAGS}"
10167     BOOST_LDFLAGS="${filteredlibs}"
10168 else
10169     AC_MSG_RESULT([internal])
10170     BUILD_TYPE="$BUILD_TYPE BOOST"
10171     SYSTEM_BOOST=
10172     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10173         # use warning-suppressing wrapper headers
10174         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10175     else
10176         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10177     fi
10179 AC_SUBST(SYSTEM_BOOST)
10181 dnl ===================================================================
10182 dnl Check for system mdds
10183 dnl ===================================================================
10184 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10186 dnl ===================================================================
10187 dnl Check for system glm
10188 dnl ===================================================================
10189 AC_MSG_CHECKING([which glm to use])
10190 if test "$with_system_glm" = "yes"; then
10191     AC_MSG_RESULT([external])
10192     SYSTEM_GLM=TRUE
10193     AC_LANG_PUSH([C++])
10194     AC_CHECK_HEADER([glm/glm.hpp], [],
10195        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10196     AC_LANG_POP([C++])
10197 else
10198     AC_MSG_RESULT([internal])
10199     BUILD_TYPE="$BUILD_TYPE GLM"
10200     SYSTEM_GLM=
10201     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10203 AC_SUBST([GLM_CFLAGS])
10204 AC_SUBST([SYSTEM_GLM])
10206 dnl ===================================================================
10207 dnl Check for system odbc
10208 dnl ===================================================================
10209 AC_MSG_CHECKING([which odbc headers to use])
10210 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
10211     AC_MSG_RESULT([external])
10212     SYSTEM_ODBC_HEADERS=TRUE
10214     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10215         save_CPPFLAGS=$CPPFLAGS
10216         find_winsdk
10217         PathFormat "$winsdktest"
10218         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"
10219         AC_CHECK_HEADER(sqlext.h, [],
10220             [AC_MSG_ERROR(odbc not found. install odbc)],
10221             [#include <windows.h>])
10222         CPPFLAGS=$save_CPPFLAGS
10223     else
10224         AC_CHECK_HEADER(sqlext.h, [],
10225             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10226     fi
10227 elif test "$enable_database_connectivity" != yes; then
10228     AC_MSG_RESULT([none])
10229 else
10230     AC_MSG_RESULT([internal])
10231     SYSTEM_ODBC_HEADERS=
10232     BUILD_TYPE="$BUILD_TYPE IODBC"
10234 AC_SUBST(SYSTEM_ODBC_HEADERS)
10236 dnl ===================================================================
10237 dnl Enable LDAP support
10238 dnl ===================================================================
10240 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10241 AC_MSG_CHECKING([whether to enable LDAP support])
10242     if test "$enable_ldap" != "yes"; then
10243         AC_MSG_RESULT([no])
10244         ENABLE_LDAP=""
10245         enable_ldap=no
10246     else
10247         AC_MSG_RESULT([yes])
10248         ENABLE_LDAP="TRUE"
10249     fi
10251 AC_SUBST(ENABLE_LDAP)
10253 dnl ===================================================================
10254 dnl Check for system openldap
10255 dnl ===================================================================
10257 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10258 AC_MSG_CHECKING([which openldap library to use])
10259 if test "$with_system_openldap" = "yes"; then
10260     AC_MSG_RESULT([external])
10261     SYSTEM_OPENLDAP=TRUE
10262     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10263     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10264     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10265 else
10266     AC_MSG_RESULT([internal])
10267     SYSTEM_OPENLDAP=
10268     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10271 AC_SUBST(SYSTEM_OPENLDAP)
10273 dnl ===================================================================
10274 dnl Check for system NSS
10275 dnl ===================================================================
10276 if test "$enable_fuzzers" != "yes"; then
10277     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10278     AC_DEFINE(HAVE_FEATURE_NSS)
10279     ENABLE_NSS="TRUE"
10280     AC_DEFINE(ENABLE_NSS)
10281 elif test $_os != iOS ; then
10282     with_tls=openssl
10284 AC_SUBST(ENABLE_NSS)
10286 dnl ===================================================================
10287 dnl Check for TLS/SSL and cryptographic implementation to use
10288 dnl ===================================================================
10289 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10290 if test -n "$with_tls"; then
10291     case $with_tls in
10292     openssl)
10293         AC_DEFINE(USE_TLS_OPENSSL)
10294         TLS=OPENSSL
10295         AC_MSG_RESULT([$TLS])
10297         if test "$enable_openssl" != "yes"; then
10298             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10299         fi
10301         # warn that OpenSSL has been selected but not all TLS code has this option
10302         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10303         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10304         ;;
10305     nss)
10306         AC_DEFINE(USE_TLS_NSS)
10307         TLS=NSS
10308         AC_MSG_RESULT([$TLS])
10309         ;;
10310     no)
10311         AC_MSG_RESULT([none])
10312         AC_MSG_WARN([Skipping TLS/SSL])
10313         ;;
10314     *)
10315         AC_MSG_RESULT([])
10316         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10317 openssl - OpenSSL
10318 nss - Mozilla's Network Security Services (NSS)
10319     ])
10320         ;;
10321     esac
10322 else
10323     # default to using NSS, it results in smaller oox lib
10324     AC_DEFINE(USE_TLS_NSS)
10325     TLS=NSS
10326     AC_MSG_RESULT([$TLS])
10328 AC_SUBST(TLS)
10330 dnl ===================================================================
10331 dnl Check for system sane
10332 dnl ===================================================================
10333 AC_MSG_CHECKING([which sane header to use])
10334 if test "$with_system_sane" = "yes"; then
10335     AC_MSG_RESULT([external])
10336     AC_CHECK_HEADER(sane/sane.h, [],
10337       [AC_MSG_ERROR(sane not found. install sane)], [])
10338 else
10339     AC_MSG_RESULT([internal])
10340     BUILD_TYPE="$BUILD_TYPE SANE"
10343 dnl ===================================================================
10344 dnl Check for system icu
10345 dnl ===================================================================
10346 SYSTEM_GENBRK=
10347 SYSTEM_GENCCODE=
10348 SYSTEM_GENCMN=
10350 ICU_MAJOR=68
10351 ICU_MINOR=1
10352 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10353 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10354 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10355 AC_MSG_CHECKING([which icu to use])
10356 if test "$with_system_icu" = "yes"; then
10357     AC_MSG_RESULT([external])
10358     SYSTEM_ICU=TRUE
10359     AC_LANG_PUSH([C++])
10360     AC_MSG_CHECKING([for unicode/rbbi.h])
10361     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10362     AC_LANG_POP([C++])
10364     if test "$cross_compiling" != "yes"; then
10365         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10366         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10367         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10368         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10369     fi
10371     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10372         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10373         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10374         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10375         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10376         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10377             AC_MSG_RESULT([yes])
10378         else
10379             AC_MSG_RESULT([no])
10380             if test "$with_system_icu_for_build" != "force"; then
10381                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10382 You can use --with-system-icu-for-build=force to use it anyway.])
10383             fi
10384         fi
10385     fi
10387     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10388         # using the system icu tools can lead to version confusion, use the
10389         # ones from the build environment when cross-compiling
10390         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10391         if test -z "$SYSTEM_GENBRK"; then
10392             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10393         fi
10394         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10395         if test -z "$SYSTEM_GENCCODE"; then
10396             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10397         fi
10398         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10399         if test -z "$SYSTEM_GENCMN"; then
10400             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10401         fi
10402         if test "$ICU_MAJOR" -ge "49"; then
10403             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10404             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10405             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10406         else
10407             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10408             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10409             ICU_RECLASSIFIED_HEBREW_LETTER=
10410         fi
10411     fi
10413     if test "$cross_compiling" = "yes"; then
10414         if test "$ICU_MAJOR" -ge "50"; then
10415             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10416             ICU_MINOR=""
10417         fi
10418     fi
10419 else
10420     AC_MSG_RESULT([internal])
10421     SYSTEM_ICU=
10422     BUILD_TYPE="$BUILD_TYPE ICU"
10423     # surprisingly set these only for "internal" (to be used by various other
10424     # external libs): the system icu-config is quite unhelpful and spits out
10425     # dozens of weird flags and also default path -I/usr/include
10426     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10427     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10429 if test "$ICU_MAJOR" -ge "59"; then
10430     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10431     # with -std=c++11 but not all external libraries can be built with that,
10432     # for those use a bit-compatible typedef uint16_t UChar; see
10433     # icu/source/common/unicode/umachine.h
10434     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10435 else
10436     ICU_UCHAR_TYPE=""
10438 AC_SUBST(SYSTEM_ICU)
10439 AC_SUBST(SYSTEM_GENBRK)
10440 AC_SUBST(SYSTEM_GENCCODE)
10441 AC_SUBST(SYSTEM_GENCMN)
10442 AC_SUBST(ICU_MAJOR)
10443 AC_SUBST(ICU_MINOR)
10444 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10445 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10446 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10447 AC_SUBST(ICU_CFLAGS)
10448 AC_SUBST(ICU_LIBS)
10449 AC_SUBST(ICU_UCHAR_TYPE)
10451 dnl ==================================================================
10452 dnl Breakpad
10453 dnl ==================================================================
10454 DEFAULT_CRASHDUMP_VALUE="true"
10455 AC_MSG_CHECKING([whether to enable breakpad])
10456 if test "$enable_breakpad" != yes; then
10457     AC_MSG_RESULT([no])
10458 else
10459     AC_MSG_RESULT([yes])
10460     ENABLE_BREAKPAD="TRUE"
10461     AC_DEFINE(ENABLE_BREAKPAD)
10462     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10463     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10465     AC_MSG_CHECKING([for disable crash dump])
10466     if test "$enable_crashdump" = no; then
10467         DEFAULT_CRASHDUMP_VALUE="false"
10468         AC_MSG_RESULT([yes])
10469     else
10470        AC_MSG_RESULT([no])
10471     fi
10473     AC_MSG_CHECKING([for crashreport config])
10474     if test "$with_symbol_config" = "no"; then
10475         BREAKPAD_SYMBOL_CONFIG="invalid"
10476         AC_MSG_RESULT([no])
10477     else
10478         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10479         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10480         AC_MSG_RESULT([yes])
10481     fi
10482     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10484 AC_SUBST(ENABLE_BREAKPAD)
10485 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10487 dnl ==================================================================
10488 dnl libfuzzer
10489 dnl ==================================================================
10490 AC_MSG_CHECKING([whether to enable fuzzers])
10491 if test "$enable_fuzzers" != yes; then
10492     AC_MSG_RESULT([no])
10493 else
10494     AC_MSG_RESULT([yes])
10495     ENABLE_FUZZERS="TRUE"
10496     AC_DEFINE([ENABLE_FUZZERS],1)
10497     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10499 AC_SUBST(ENABLE_FUZZERS)
10501 dnl ===================================================================
10502 dnl Orcus
10503 dnl ===================================================================
10504 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10505 if test "$with_system_orcus" != "yes"; then
10506     if test "$SYSTEM_BOOST" = "TRUE"; then
10507         # ===========================================================
10508         # Determine if we are going to need to link with Boost.System
10509         # ===========================================================
10510         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10511         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10512         dnl in documentation has no effect.
10513         AC_MSG_CHECKING([if we need to link with Boost.System])
10514         AC_LANG_PUSH([C++])
10515         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10516                 @%:@include <boost/version.hpp>
10517             ]],[[
10518                 #if BOOST_VERSION >= 105000
10519                 #   error yes, we need to link with Boost.System
10520                 #endif
10521             ]])],[
10522                 AC_MSG_RESULT([no])
10523             ],[
10524                 AC_MSG_RESULT([yes])
10525                 AX_BOOST_SYSTEM
10526         ])
10527         AC_LANG_POP([C++])
10528     fi
10530 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10531 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10532 AC_SUBST([BOOST_SYSTEM_LIB])
10533 AC_SUBST(SYSTEM_LIBORCUS)
10535 dnl ===================================================================
10536 dnl HarfBuzz
10537 dnl ===================================================================
10538 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10539                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10540                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10542 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10543                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10544                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10546 if test "$COM" = "MSC"; then # override the above
10547     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10548     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10551 if test "$with_system_harfbuzz" = "yes"; then
10552     if test "$with_system_graphite" = "no"; then
10553         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10554     fi
10555     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10556     save_LIBS="$LIBS"
10557     save_CFLAGS="$CFLAGS"
10558     LIBS="$LIBS $HARFBUZZ_LIBS"
10559     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10560     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10561     LIBS="$save_LIBS"
10562     CFLAGS="$save_CFLAGS"
10563 else
10564     if test "$with_system_graphite" = "yes"; then
10565         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10566     fi
10569 AC_MSG_CHECKING([whether to use X11])
10570 dnl ***************************************
10571 dnl testing for X libraries and includes...
10572 dnl ***************************************
10573 if test "$USING_X11" = TRUE; then
10574     AC_DEFINE(HAVE_FEATURE_X11)
10576 AC_MSG_RESULT([$USING_X11])
10578 if test "$USING_X11" = TRUE; then
10579     AC_PATH_X
10580     AC_PATH_XTRA
10581     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10583     if test -z "$x_includes"; then
10584         x_includes="default_x_includes"
10585     fi
10586     if test -z "$x_libraries"; then
10587         x_libraries="default_x_libraries"
10588     fi
10589     CFLAGS="$CFLAGS $X_CFLAGS"
10590     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10591     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10592 else
10593     x_includes="no_x_includes"
10594     x_libraries="no_x_libraries"
10597 if test "$USING_X11" = TRUE; then
10598     dnl ===================================================================
10599     dnl Check for extension headers
10600     dnl ===================================================================
10601     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10602      [#include <X11/extensions/shape.h>])
10604     # vcl needs ICE and SM
10605     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10606     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10607         [AC_MSG_ERROR(ICE library not found)])
10608     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10609     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10610         [AC_MSG_ERROR(SM library not found)])
10613 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10614     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10615     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10618 dnl ===================================================================
10619 dnl Check for system Xrender
10620 dnl ===================================================================
10621 AC_MSG_CHECKING([whether to use Xrender])
10622 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10623     AC_MSG_RESULT([yes])
10624     PKG_CHECK_MODULES(XRENDER, xrender)
10625     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10626     FilterLibs "${XRENDER_LIBS}"
10627     XRENDER_LIBS="${filteredlibs}"
10628     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10629       [AC_MSG_ERROR(libXrender not found or functional)], [])
10630     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10631       [AC_MSG_ERROR(Xrender not found. install X)], [])
10632 else
10633     AC_MSG_RESULT([no])
10635 AC_SUBST(XRENDER_CFLAGS)
10636 AC_SUBST(XRENDER_LIBS)
10638 dnl ===================================================================
10639 dnl Check for XRandr
10640 dnl ===================================================================
10641 AC_MSG_CHECKING([whether to enable RandR support])
10642 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10643     AC_MSG_RESULT([yes])
10644     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10645     if test "$ENABLE_RANDR" != "TRUE"; then
10646         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10647                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10648         XRANDR_CFLAGS=" "
10649         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10650           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10651         XRANDR_LIBS="-lXrandr "
10652         ENABLE_RANDR="TRUE"
10653     fi
10654     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10655     FilterLibs "${XRANDR_LIBS}"
10656     XRANDR_LIBS="${filteredlibs}"
10657 else
10658     ENABLE_RANDR=""
10659     AC_MSG_RESULT([no])
10661 AC_SUBST(XRANDR_CFLAGS)
10662 AC_SUBST(XRANDR_LIBS)
10663 AC_SUBST(ENABLE_RANDR)
10665 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10666     if test -z "$WITH_WEBDAV"; then
10667         WITH_WEBDAV="serf"
10668     fi
10670 if test $_os = iOS -o $_os = Android; then
10671     WITH_WEBDAV="no"
10673 AC_MSG_CHECKING([for webdav library])
10674 case "$WITH_WEBDAV" in
10675 serf)
10676     AC_MSG_RESULT([serf])
10677     # Check for system apr-util
10678     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10679                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10680                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10681     if test "$COM" = "MSC"; then
10682         APR_LIB_DIR="LibR"
10683         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10684         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10685     fi
10687     # Check for system serf
10688     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10689     ;;
10690 neon)
10691     AC_MSG_RESULT([neon])
10692     # Check for system neon
10693     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10694     if test "$with_system_neon" = "yes"; then
10695         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10696     else
10697         NEON_VERSION=0312
10698     fi
10699     AC_SUBST(NEON_VERSION)
10700     ;;
10702     AC_MSG_RESULT([none, disabled])
10703     WITH_WEBDAV=""
10704     ;;
10705 esac
10706 AC_SUBST(WITH_WEBDAV)
10708 dnl ===================================================================
10709 dnl Check for disabling cve_tests
10710 dnl ===================================================================
10711 AC_MSG_CHECKING([whether to execute CVE tests])
10712 # If not explicitly enabled or disabled, default
10713 if test -z "$enable_cve_tests"; then
10714     case "$OS" in
10715     WNT)
10716         # Default cves off for Windows with its wild and wonderful
10717         # variety of AV software kicking in and panicking
10718         enable_cve_tests=no
10719         ;;
10720     *)
10721         # otherwise yes
10722         enable_cve_tests=yes
10723         ;;
10724     esac
10726 if test "$enable_cve_tests" = "no"; then
10727     AC_MSG_RESULT([no])
10728     DISABLE_CVE_TESTS=TRUE
10729     AC_SUBST(DISABLE_CVE_TESTS)
10730 else
10731     AC_MSG_RESULT([yes])
10734 dnl ===================================================================
10735 dnl Check for enabling chart XShape tests
10736 dnl ===================================================================
10737 AC_MSG_CHECKING([whether to execute chart XShape tests])
10738 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10739     AC_MSG_RESULT([yes])
10740     ENABLE_CHART_TESTS=TRUE
10741     AC_SUBST(ENABLE_CHART_TESTS)
10742 else
10743     AC_MSG_RESULT([no])
10746 dnl ===================================================================
10747 dnl Check for system openssl
10748 dnl ===================================================================
10749 DISABLE_OPENSSL=
10750 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10751 if test "$enable_openssl" = "yes"; then
10752     AC_MSG_RESULT([no])
10753     if test "$_os" = Darwin ; then
10754         # OpenSSL is deprecated when building for 10.7 or later.
10755         #
10756         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10757         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10759         with_system_openssl=no
10760         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10761     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10762             && test "$with_system_openssl" != "no"; then
10763         with_system_openssl=yes
10764         SYSTEM_OPENSSL=TRUE
10765         OPENSSL_CFLAGS=
10766         OPENSSL_LIBS="-lssl -lcrypto"
10767     else
10768         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10769     fi
10770     if test "$with_system_openssl" = "yes"; then
10771         AC_MSG_CHECKING([whether openssl supports SHA512])
10772         AC_LANG_PUSH([C])
10773         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10774             SHA512_CTX context;
10775 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10776         AC_LANG_POP(C)
10777     fi
10778 else
10779     AC_MSG_RESULT([yes])
10780     DISABLE_OPENSSL=TRUE
10782     # warn that although OpenSSL is disabled, system libraries may depend on it
10783     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10784     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10787 AC_SUBST([DISABLE_OPENSSL])
10789 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10790     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10791         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10792         enable_cipher_openssl_backend=no
10793     else
10794         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10795     fi
10797 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10798 ENABLE_CIPHER_OPENSSL_BACKEND=
10799 if test "$enable_cipher_openssl_backend" = yes; then
10800     AC_MSG_RESULT([yes])
10801     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10802 else
10803     AC_MSG_RESULT([no])
10805 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10807 dnl ===================================================================
10808 dnl Check for building gnutls
10809 dnl ===================================================================
10810 AC_MSG_CHECKING([whether to use gnutls])
10811 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10812     AC_MSG_RESULT([yes])
10813     AM_PATH_LIBGCRYPT()
10814     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10815         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10816                       available in the system to use as replacement.]]))
10817     FilterLibs "${LIBGCRYPT_LIBS}"
10818     LIBGCRYPT_LIBS="${filteredlibs}"
10819 else
10820     AC_MSG_RESULT([no])
10823 AC_SUBST([LIBGCRYPT_CFLAGS])
10824 AC_SUBST([LIBGCRYPT_LIBS])
10826 dnl ===================================================================
10827 dnl Check for system redland
10828 dnl ===================================================================
10829 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10830 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10831 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10832 if test "$with_system_redland" = "yes"; then
10833     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10834             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10835 else
10836     RAPTOR_MAJOR="0"
10837     RASQAL_MAJOR="3"
10838     REDLAND_MAJOR="0"
10840 AC_SUBST(RAPTOR_MAJOR)
10841 AC_SUBST(RASQAL_MAJOR)
10842 AC_SUBST(REDLAND_MAJOR)
10844 dnl ===================================================================
10845 dnl Check for system hunspell
10846 dnl ===================================================================
10847 AC_MSG_CHECKING([which libhunspell to use])
10848 if test "$with_system_hunspell" = "yes"; then
10849     AC_MSG_RESULT([external])
10850     SYSTEM_HUNSPELL=TRUE
10851     AC_LANG_PUSH([C++])
10852     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10853     if test "$HUNSPELL_PC" != "TRUE"; then
10854         AC_CHECK_HEADER(hunspell.hxx, [],
10855             [
10856             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10857             [AC_MSG_ERROR(hunspell headers not found.)], [])
10858             ], [])
10859         AC_CHECK_LIB([hunspell], [main], [:],
10860            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10861         HUNSPELL_LIBS=-lhunspell
10862     fi
10863     AC_LANG_POP([C++])
10864     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10865     FilterLibs "${HUNSPELL_LIBS}"
10866     HUNSPELL_LIBS="${filteredlibs}"
10867 else
10868     AC_MSG_RESULT([internal])
10869     SYSTEM_HUNSPELL=
10870     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10871     if test "$COM" = "MSC"; then
10872         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10873     else
10874         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10875     fi
10876     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10878 AC_SUBST(SYSTEM_HUNSPELL)
10879 AC_SUBST(HUNSPELL_CFLAGS)
10880 AC_SUBST(HUNSPELL_LIBS)
10882 dnl ===================================================================
10883 dnl Check for system qrcodegen
10884 dnl ===================================================================
10885 AC_MSG_CHECKING([whether to use libqrcodegen])
10886 if test "$enable_qrcodegen" = "no"; then
10887     AC_MSG_RESULT([no])
10888     ENABLE_QRCODEGEN=
10889     SYSTEM_QRCODEGEN=
10890 else
10891     AC_MSG_RESULT([yes])
10892     ENABLE_QRCODEGEN=TRUE
10893     AC_MSG_CHECKING([which libqrcodegen to use])
10894     if test "$with_system_qrcodegen" = "yes"; then
10895         AC_MSG_RESULT([external])
10896         SYSTEM_QRCODEGEN=TRUE
10897         AC_LANG_PUSH([C++])
10898         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10899             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10900         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10901             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10902         QRCODEGEN_LIBS=-lqrcodegencpp
10903         AC_LANG_POP([C++])
10904         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10905         FilterLibs "${QRCODEGEN_LIBS}"
10906         QRCODEGEN_LIBS="${filteredlibs}"
10907     else
10908         AC_MSG_RESULT([internal])
10909         SYSTEM_QRCODEGEN=
10910         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10911     fi
10912     if test "$ENABLE_QRCODEGEN" = TRUE; then
10913         AC_DEFINE(ENABLE_QRCODEGEN)
10914     fi
10916 AC_SUBST(SYSTEM_QRCODEGEN)
10917 AC_SUBST(ENABLE_QRCODEGEN)
10918 AC_SUBST(QRCODEGEN_CFLAGS)
10919 AC_SUBST(QRCODEGEN_LIBS)
10921 dnl ===================================================================
10922 dnl Check for system box2d
10923 dnl ===================================================================
10924 AC_MSG_CHECKING([which box2d to use])
10925 if test "$with_system_box2d" = "yes"; then
10926     AC_MSG_RESULT([external])
10927     SYSTEM_BOX2D=TRUE
10928     AC_LANG_PUSH([C++])
10929     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
10930         [BOX2D_H_FOUND='FALSE'])
10931     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
10932         _BOX2D_LIB=box2d
10933         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
10934     else
10935         # fail this. there's no other alternative to check when we are here.
10936         AC_CHECK_HEADER([Box2D/Box2D.h], [],
10937                 [AC_MSG_ERROR(box2d headers not found.)])
10938         _BOX2D_LIB=Box2D
10939         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
10940     fi
10941     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
10942         [ AC_MSG_ERROR(box2d library not found.) ], [])
10943     BOX2D_LIBS=-l$_BOX2D_LIB
10944     AC_LANG_POP([C++])
10945     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10946     FilterLibs "${BOX2D_LIBS}"
10947     BOX2D_LIBS="${filteredlibs}"
10948 else
10949     AC_MSG_RESULT([internal])
10950     SYSTEM_BOX2D=
10951     BUILD_TYPE="$BUILD_TYPE BOX2D"
10953 AC_SUBST(SYSTEM_BOX2D)
10954 AC_SUBST(BOX2D_CFLAGS)
10955 AC_SUBST(BOX2D_LIBS)
10957 dnl ===================================================================
10958 dnl Checking for altlinuxhyph
10959 dnl ===================================================================
10960 AC_MSG_CHECKING([which altlinuxhyph to use])
10961 if test "$with_system_altlinuxhyph" = "yes"; then
10962     AC_MSG_RESULT([external])
10963     SYSTEM_HYPH=TRUE
10964     AC_CHECK_HEADER(hyphen.h, [],
10965        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10966     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10967        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10968        [#include <hyphen.h>])
10969     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10970         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10971     if test -z "$HYPHEN_LIB"; then
10972         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10973            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10974     fi
10975     if test -z "$HYPHEN_LIB"; then
10976         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10977            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10978     fi
10979 else
10980     AC_MSG_RESULT([internal])
10981     SYSTEM_HYPH=
10982     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10983     if test "$COM" = "MSC"; then
10984         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10985     else
10986         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10987     fi
10989 AC_SUBST(SYSTEM_HYPH)
10990 AC_SUBST(HYPHEN_LIB)
10992 dnl ===================================================================
10993 dnl Checking for mythes
10994 dnl ===================================================================
10995 AC_MSG_CHECKING([which mythes to use])
10996 if test "$with_system_mythes" = "yes"; then
10997     AC_MSG_RESULT([external])
10998     SYSTEM_MYTHES=TRUE
10999     AC_LANG_PUSH([C++])
11000     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11001     if test "$MYTHES_PKGCONFIG" = "no"; then
11002         AC_CHECK_HEADER(mythes.hxx, [],
11003             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11004         AC_CHECK_LIB([mythes-1.2], [main], [:],
11005             [ MYTHES_FOUND=no], [])
11006     if test "$MYTHES_FOUND" = "no"; then
11007         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11008                 [ MYTHES_FOUND=no], [])
11009     fi
11010     if test "$MYTHES_FOUND" = "no"; then
11011         AC_MSG_ERROR([mythes library not found!.])
11012     fi
11013     fi
11014     AC_LANG_POP([C++])
11015     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11016     FilterLibs "${MYTHES_LIBS}"
11017     MYTHES_LIBS="${filteredlibs}"
11018 else
11019     AC_MSG_RESULT([internal])
11020     SYSTEM_MYTHES=
11021     BUILD_TYPE="$BUILD_TYPE MYTHES"
11022     if test "$COM" = "MSC"; then
11023         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11024     else
11025         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11026     fi
11028 AC_SUBST(SYSTEM_MYTHES)
11029 AC_SUBST(MYTHES_CFLAGS)
11030 AC_SUBST(MYTHES_LIBS)
11032 dnl ===================================================================
11033 dnl How should we build the linear programming solver ?
11034 dnl ===================================================================
11036 ENABLE_COINMP=
11037 AC_MSG_CHECKING([whether to build with CoinMP])
11038 if test "$enable_coinmp" != "no"; then
11039     ENABLE_COINMP=TRUE
11040     AC_MSG_RESULT([yes])
11041     if test "$with_system_coinmp" = "yes"; then
11042         SYSTEM_COINMP=TRUE
11043         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11044         FilterLibs "${COINMP_LIBS}"
11045         COINMP_LIBS="${filteredlibs}"
11046     else
11047         BUILD_TYPE="$BUILD_TYPE COINMP"
11048     fi
11049 else
11050     AC_MSG_RESULT([no])
11052 AC_SUBST(ENABLE_COINMP)
11053 AC_SUBST(SYSTEM_COINMP)
11054 AC_SUBST(COINMP_CFLAGS)
11055 AC_SUBST(COINMP_LIBS)
11057 ENABLE_LPSOLVE=
11058 AC_MSG_CHECKING([whether to build with lpsolve])
11059 if test "$enable_lpsolve" != "no"; then
11060     ENABLE_LPSOLVE=TRUE
11061     AC_MSG_RESULT([yes])
11062 else
11063     AC_MSG_RESULT([no])
11065 AC_SUBST(ENABLE_LPSOLVE)
11067 if test "$ENABLE_LPSOLVE" = TRUE; then
11068     AC_MSG_CHECKING([which lpsolve to use])
11069     if test "$with_system_lpsolve" = "yes"; then
11070         AC_MSG_RESULT([external])
11071         SYSTEM_LPSOLVE=TRUE
11072         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11073            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11074         save_LIBS=$LIBS
11075         # some systems need this. Like Ubuntu...
11076         AC_CHECK_LIB(m, floor)
11077         AC_CHECK_LIB(dl, dlopen)
11078         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11079             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11080         LIBS=$save_LIBS
11081     else
11082         AC_MSG_RESULT([internal])
11083         SYSTEM_LPSOLVE=
11084         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11085     fi
11087 AC_SUBST(SYSTEM_LPSOLVE)
11089 dnl ===================================================================
11090 dnl Checking for libexttextcat
11091 dnl ===================================================================
11092 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11093 if test "$with_system_libexttextcat" = "yes"; then
11094     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11096 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11098 dnl ===================================================================
11099 dnl Checking for libnumbertext
11100 dnl ===================================================================
11101 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11102 if test "$with_system_libnumbertext" = "yes"; then
11103     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11104     SYSTEM_LIBNUMBERTEXT=YES
11105 else
11106     SYSTEM_LIBNUMBERTEXT=
11107     AC_LANG_PUSH([C++])
11108     save_CPPFLAGS=$CPPFLAGS
11109     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11110     AC_CHECK_HEADERS([codecvt regex])
11111     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11112             [ LIBNUMBERTEXT_CFLAGS=''
11113               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11114                            Enable libnumbertext fallback (missing number to number name conversion).])
11115             ])
11116     CPPFLAGS=$save_CPPFLAGS
11117     AC_LANG_POP([C++])
11119 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11120 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11121 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11123 dnl ***************************************
11124 dnl testing libc version for Linux...
11125 dnl ***************************************
11126 if test "$_os" = "Linux"; then
11127     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11128     exec 6>/dev/null # no output
11129     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11130     exec 6>&1 # output on again
11131     if test "$HAVE_LIBC"; then
11132         AC_MSG_RESULT([yes])
11133     else
11134         AC_MSG_ERROR([no, upgrade libc])
11135     fi
11138 dnl =========================================
11139 dnl Check for uuidgen
11140 dnl =========================================
11141 if test "$_os" = "WINNT"; then
11142     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11143     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11144     UUIDGEN=uuidgen.exe
11145     AC_SUBST(UUIDGEN)
11146 else
11147     AC_PATH_PROG([UUIDGEN], [uuidgen])
11148     if test -z "$UUIDGEN"; then
11149         AC_MSG_WARN([uuid is needed for building installation sets])
11150     fi
11153 dnl ***************************************
11154 dnl Checking for bison and flex
11155 dnl ***************************************
11156 AC_PATH_PROG(BISON, bison)
11157 if test -z "$BISON"; then
11158     AC_MSG_ERROR([no bison found in \$PATH, install it])
11159 else
11160     AC_MSG_CHECKING([the bison version])
11161     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11162     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11163     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11164     dnl cause
11165     dnl
11166     dnl   idlc/source/parser.y:222:15: error: externally available entity 'YYSTYPE' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]
11167     dnl   typedef union YYSTYPE
11168     dnl           ~~~~~~^~~~~~~
11169     dnl
11170     dnl while at least 3.4.1 is know to be good:
11171     if test "$COMPILER_PLUGINS" = TRUE; then
11172         if test "$_bison_longver" -lt 2004; then
11173             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11174         fi
11175     else
11176         if test "$_bison_longver" -lt 2000; then
11177             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11178         fi
11179     fi
11181 AC_SUBST([BISON])
11183 AC_PATH_PROG(FLEX, flex)
11184 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11185     FLEX=`cygpath -m $FLEX`
11187 if test -z "$FLEX"; then
11188     AC_MSG_ERROR([no flex found in \$PATH, install it])
11189 else
11190     AC_MSG_CHECKING([the flex version])
11191     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11192     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11193         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11194     fi
11196 AC_SUBST([FLEX])
11197 dnl ***************************************
11198 dnl Checking for patch
11199 dnl ***************************************
11200 AC_PATH_PROG(PATCH, patch)
11201 if test -z "$PATCH"; then
11202     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11205 dnl On Solaris or macOS, check if --with-gnu-patch was used
11206 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11207     if test -z "$with_gnu_patch"; then
11208         GNUPATCH=$PATCH
11209     else
11210         if test -x "$with_gnu_patch"; then
11211             GNUPATCH=$with_gnu_patch
11212         else
11213             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11214         fi
11215     fi
11217     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11218     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11219         AC_MSG_RESULT([yes])
11220     else
11221         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11222     fi
11223 else
11224     GNUPATCH=$PATCH
11227 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11228     GNUPATCH=`cygpath -m $GNUPATCH`
11231 dnl We also need to check for --with-gnu-cp
11233 if test -z "$with_gnu_cp"; then
11234     # check the place where the good stuff is hidden on Solaris...
11235     if test -x /usr/gnu/bin/cp; then
11236         GNUCP=/usr/gnu/bin/cp
11237     else
11238         AC_PATH_PROGS(GNUCP, gnucp cp)
11239     fi
11240     if test -z $GNUCP; then
11241         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11242     fi
11243 else
11244     if test -x "$with_gnu_cp"; then
11245         GNUCP=$with_gnu_cp
11246     else
11247         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11248     fi
11251 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11252     GNUCP=`cygpath -m $GNUCP`
11255 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11256 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11257     AC_MSG_RESULT([yes])
11258 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11259     AC_MSG_RESULT([yes])
11260 else
11261     case "$build_os" in
11262     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11263         x_GNUCP=[\#]
11264         GNUCP=''
11265         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11266         ;;
11267     *)
11268         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11269         ;;
11270     esac
11273 AC_SUBST(GNUPATCH)
11274 AC_SUBST(GNUCP)
11275 AC_SUBST(x_GNUCP)
11277 dnl ***************************************
11278 dnl testing assembler path
11279 dnl ***************************************
11280 ML_EXE=""
11281 if test "$_os" = "WINNT"; then
11282     case "$WIN_HOST_ARCH" in
11283     x86) assembler=ml.exe ;;
11284     x64) assembler=ml64.exe ;;
11285     arm64) assembler=armasm64.exe ;;
11286     esac
11288     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11289     if test -f "$MSVC_HOST_PATH/$assembler"; then
11290         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11291         AC_MSG_RESULT([$ML_EXE])
11292     else
11293         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11294     fi
11297 AC_SUBST(ML_EXE)
11299 dnl ===================================================================
11300 dnl We need zip and unzip
11301 dnl ===================================================================
11302 AC_PATH_PROG(ZIP, zip)
11303 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11304 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11305     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],,)
11308 AC_PATH_PROG(UNZIP, unzip)
11309 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11311 dnl ===================================================================
11312 dnl Zip must be a specific type for different build types.
11313 dnl ===================================================================
11314 if test $build_os = cygwin; then
11315     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11316         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11317     fi
11320 dnl ===================================================================
11321 dnl We need touch with -h option support.
11322 dnl ===================================================================
11323 AC_PATH_PROG(TOUCH, touch)
11324 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11325 touch warn
11326 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11327     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],,)
11330 dnl ===================================================================
11331 dnl Check for system epoxy
11332 dnl ===================================================================
11333 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11335 dnl ===================================================================
11336 dnl Set vcl option: coordinate device in double or sal_Int32
11337 dnl ===================================================================
11339 dnl disabled for now, we don't want subtle differences between OSs
11340 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11341 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11342 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11343 dnl     AC_MSG_RESULT([double])
11344 dnl else
11345 dnl     AC_MSG_RESULT([sal_Int32])
11346 dnl fi
11348 dnl ===================================================================
11349 dnl Test which vclplugs have to be built.
11350 dnl ===================================================================
11351 R=""
11352 if test "$USING_X11" != TRUE; then
11353     enable_gtk3=no
11356 ENABLE_GTK3=""
11357 if test "x$enable_gtk3" = "xyes"; then
11358     ENABLE_GTK3="TRUE"
11359     AC_DEFINE(ENABLE_GTK3)
11360     R="$R gtk3"
11362 AC_SUBST(ENABLE_GTK3)
11364 ENABLE_GTK3_KDE5=""
11365 if test "x$enable_gtk3_kde5" = "xyes"; then
11366     ENABLE_GTK3_KDE5="TRUE"
11367     AC_DEFINE(ENABLE_GTK3_KDE5)
11368     R="$R gtk3_kde5"
11370 AC_SUBST(ENABLE_GTK3_KDE5)
11372 ENABLE_QT5=""
11373 if test "x$enable_qt5" = "xyes"; then
11374     ENABLE_QT5="TRUE"
11375     AC_DEFINE(ENABLE_QT5)
11376     R="$R qt5"
11378 AC_SUBST(ENABLE_QT5)
11380 ENABLE_KF5=""
11381 if test "x$enable_kf5" = "xyes"; then
11382     ENABLE_KF5="TRUE"
11383     AC_DEFINE(ENABLE_KF5)
11384     R="$R kf5"
11386 AC_SUBST(ENABLE_KF5)
11388 GTK3_CFLAGS=""
11389 GTK3_LIBS=""
11390 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11391     if test "$with_system_cairo" = no; then
11392         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11393     fi
11394     : ${with_system_cairo:=yes}
11395     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo)
11396     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11397     FilterLibs "${GTK3_LIBS}"
11398     GTK3_LIBS="${filteredlibs}"
11400     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11401     if test "$with_system_epoxy" != "yes"; then
11402         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11403         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11404                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11405     fi
11407 AC_SUBST(GTK3_LIBS)
11408 AC_SUBST(GTK3_CFLAGS)
11410 if test "$enable_introspection" = yes; then
11411     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11412         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11413     else
11414         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11415     fi
11418 if test "$_os" = "WINNT"; then
11419     R="$R win"
11420 elif test "$_os" = "Darwin"; then
11421     R="$R osx"
11422 elif test "$_os" = "iOS"; then
11423     R="ios (builtin)"
11426 build_vcl_plugins="$R"
11427 if test -z "$build_vcl_plugins"; then
11428     build_vcl_plugins="none"
11430 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
11432 dnl ===================================================================
11433 dnl check for dbus support
11434 dnl ===================================================================
11435 ENABLE_DBUS=""
11436 DBUS_CFLAGS=""
11437 DBUS_LIBS=""
11438 DBUS_GLIB_CFLAGS=""
11439 DBUS_GLIB_LIBS=""
11440 DBUS_HAVE_GLIB=""
11442 if test "$enable_dbus" = "no"; then
11443     test_dbus=no
11446 AC_MSG_CHECKING([whether to enable DBUS support])
11447 if test "$test_dbus" = "yes"; then
11448     ENABLE_DBUS="TRUE"
11449     AC_MSG_RESULT([yes])
11450     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11451     AC_DEFINE(ENABLE_DBUS)
11452     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11453     FilterLibs "${DBUS_LIBS}"
11454     DBUS_LIBS="${filteredlibs}"
11456     # Glib is needed for BluetoothServer
11457     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11458     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11459         [
11460             DBUS_HAVE_GLIB="TRUE"
11461             AC_DEFINE(DBUS_HAVE_GLIB,1)
11462         ],
11463         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11464     )
11465 else
11466     AC_MSG_RESULT([no])
11469 AC_SUBST(ENABLE_DBUS)
11470 AC_SUBST(DBUS_CFLAGS)
11471 AC_SUBST(DBUS_LIBS)
11472 AC_SUBST(DBUS_GLIB_CFLAGS)
11473 AC_SUBST(DBUS_GLIB_LIBS)
11474 AC_SUBST(DBUS_HAVE_GLIB)
11476 AC_MSG_CHECKING([whether to enable Impress remote control])
11477 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11478     AC_MSG_RESULT([yes])
11479     ENABLE_SDREMOTE=TRUE
11480     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11482     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11483         # The Bluetooth code doesn't compile with macOS SDK 10.15
11484         if test "$enable_sdremote_bluetooth" = yes; then
11485             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11486         fi
11487         enable_sdremote_bluetooth=no
11488     fi
11489     # If not explicitly enabled or disabled, default
11490     if test -z "$enable_sdremote_bluetooth"; then
11491         case "$OS" in
11492         LINUX|MACOSX|WNT)
11493             # Default to yes for these
11494             enable_sdremote_bluetooth=yes
11495             ;;
11496         *)
11497             # otherwise no
11498             enable_sdremote_bluetooth=no
11499             ;;
11500         esac
11501     fi
11502     # $enable_sdremote_bluetooth is guaranteed non-empty now
11504     if test "$enable_sdremote_bluetooth" != "no"; then
11505         if test "$OS" = "LINUX"; then
11506             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11507                 AC_MSG_RESULT([yes])
11508                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11509                 dnl ===================================================================
11510                 dnl Check for system bluez
11511                 dnl ===================================================================
11512                 AC_MSG_CHECKING([which Bluetooth header to use])
11513                 if test "$with_system_bluez" = "yes"; then
11514                     AC_MSG_RESULT([external])
11515                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11516                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11517                     SYSTEM_BLUEZ=TRUE
11518                 else
11519                     AC_MSG_RESULT([internal])
11520                     SYSTEM_BLUEZ=
11521                 fi
11522             else
11523                 AC_MSG_RESULT([no, dbus disabled])
11524                 ENABLE_SDREMOTE_BLUETOOTH=
11525                 SYSTEM_BLUEZ=
11526             fi
11527         else
11528             AC_MSG_RESULT([yes])
11529             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11530             SYSTEM_BLUEZ=
11531         fi
11532     else
11533         AC_MSG_RESULT([no])
11534         ENABLE_SDREMOTE_BLUETOOTH=
11535         SYSTEM_BLUEZ=
11536     fi
11537 else
11538     ENABLE_SDREMOTE=
11539     SYSTEM_BLUEZ=
11540     AC_MSG_RESULT([no])
11542 AC_SUBST(ENABLE_SDREMOTE)
11543 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11544 AC_SUBST(SYSTEM_BLUEZ)
11546 dnl ===================================================================
11547 dnl Check whether to enable GIO support
11548 dnl ===================================================================
11549 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11550     AC_MSG_CHECKING([whether to enable GIO support])
11551     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11552         dnl Need at least 2.26 for the dbus support.
11553         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11554                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11555         if test "$ENABLE_GIO" = "TRUE"; then
11556             AC_DEFINE(ENABLE_GIO)
11557             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11558             FilterLibs "${GIO_LIBS}"
11559             GIO_LIBS="${filteredlibs}"
11560         fi
11561     else
11562         AC_MSG_RESULT([no])
11563     fi
11565 AC_SUBST(ENABLE_GIO)
11566 AC_SUBST(GIO_CFLAGS)
11567 AC_SUBST(GIO_LIBS)
11570 dnl ===================================================================
11572 SPLIT_APP_MODULES=""
11573 if test "$enable_split_app_modules" = "yes"; then
11574     SPLIT_APP_MODULES="TRUE"
11576 AC_SUBST(SPLIT_APP_MODULES)
11578 SPLIT_OPT_FEATURES=""
11579 if test "$enable_split_opt_features" = "yes"; then
11580     SPLIT_OPT_FEATURES="TRUE"
11582 AC_SUBST(SPLIT_OPT_FEATURES)
11584 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11585     if test "$enable_cairo_canvas" = yes; then
11586         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11587     fi
11588     enable_cairo_canvas=no
11589 elif test -z "$enable_cairo_canvas"; then
11590     enable_cairo_canvas=yes
11593 ENABLE_CAIRO_CANVAS=""
11594 if test "$enable_cairo_canvas" = "yes"; then
11595     test_cairo=yes
11596     ENABLE_CAIRO_CANVAS="TRUE"
11597     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11599 AC_SUBST(ENABLE_CAIRO_CANVAS)
11601 dnl ===================================================================
11602 dnl Check whether the GStreamer libraries are available.
11603 dnl ===================================================================
11605 ENABLE_GSTREAMER_1_0=""
11607 if test "$build_gstreamer_1_0" = "yes"; then
11609     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11610     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11611         ENABLE_GSTREAMER_1_0="TRUE"
11612         AC_MSG_RESULT([yes])
11613         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11614         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11615         FilterLibs "${GSTREAMER_1_0_LIBS}"
11616         GSTREAMER_1_0_LIBS="${filteredlibs}"
11617         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11618     else
11619         AC_MSG_RESULT([no])
11620     fi
11622 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11623 AC_SUBST(GSTREAMER_1_0_LIBS)
11624 AC_SUBST(ENABLE_GSTREAMER_1_0)
11626 dnl ===================================================================
11627 dnl Check whether to build the VLC avmedia backend
11628 dnl ===================================================================
11630 ENABLE_VLC=""
11632 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11633 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11634     ENABLE_VLC="TRUE"
11635     AC_MSG_RESULT([yes])
11636 else
11637     AC_MSG_RESULT([no])
11639 AC_SUBST(ENABLE_VLC)
11641 ENABLE_OPENGL_TRANSITIONS=
11642 ENABLE_OPENGL_CANVAS=
11643 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11644    : # disable
11645 elif test "$_os" = "Darwin"; then
11646     # We use frameworks on macOS, no need for detail checks
11647     ENABLE_OPENGL_TRANSITIONS=TRUE
11648     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11649     ENABLE_OPENGL_CANVAS=TRUE
11650 elif test $_os = WINNT; then
11651     ENABLE_OPENGL_TRANSITIONS=TRUE
11652     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11653     ENABLE_OPENGL_CANVAS=TRUE
11654 else
11655     if test "$USING_X11" = TRUE; then
11656         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11657         ENABLE_OPENGL_TRANSITIONS=TRUE
11658         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11659         ENABLE_OPENGL_CANVAS=TRUE
11660     fi
11663 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11664 AC_SUBST(ENABLE_OPENGL_CANVAS)
11666 dnl =================================================
11667 dnl Check whether to build with OpenCL support.
11668 dnl =================================================
11670 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11671     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11672     # platform (optional at run-time, used through clew).
11673     BUILD_TYPE="$BUILD_TYPE OPENCL"
11674     AC_DEFINE(HAVE_FEATURE_OPENCL)
11677 dnl =================================================
11678 dnl Check whether to build with dconf support.
11679 dnl =================================================
11681 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11682     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11683         if test "$enable_dconf" = yes; then
11684             AC_MSG_ERROR([dconf not found])
11685         else
11686             enable_dconf=no
11687         fi])
11689 AC_MSG_CHECKING([whether to enable dconf])
11690 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11691     DCONF_CFLAGS=
11692     DCONF_LIBS=
11693     ENABLE_DCONF=
11694     AC_MSG_RESULT([no])
11695 else
11696     ENABLE_DCONF=TRUE
11697     AC_DEFINE(ENABLE_DCONF)
11698     AC_MSG_RESULT([yes])
11700 AC_SUBST([DCONF_CFLAGS])
11701 AC_SUBST([DCONF_LIBS])
11702 AC_SUBST([ENABLE_DCONF])
11704 # pdf import?
11705 AC_MSG_CHECKING([whether to build the PDF import feature])
11706 ENABLE_PDFIMPORT=
11707 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11708     AC_MSG_RESULT([yes])
11709     ENABLE_PDFIMPORT=TRUE
11710     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11711 else
11712     AC_MSG_RESULT([no])
11715 # Pdfium?
11716 AC_MSG_CHECKING([whether to build PDFium])
11717 ENABLE_PDFIUM=
11718 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11719     AC_MSG_RESULT([yes])
11720     ENABLE_PDFIUM=TRUE
11721     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11722     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11723 else
11724     AC_MSG_RESULT([no])
11726 AC_SUBST(ENABLE_PDFIUM)
11728 dnl ===================================================================
11729 dnl Check for poppler
11730 dnl ===================================================================
11731 ENABLE_POPPLER=
11732 AC_MSG_CHECKING([whether to build Poppler])
11733 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11734     AC_MSG_RESULT([yes])
11735     ENABLE_POPPLER=TRUE
11736     AC_DEFINE(HAVE_FEATURE_POPPLER)
11737 else
11738     AC_MSG_RESULT([no])
11740 AC_SUBST(ENABLE_POPPLER)
11742 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11743     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11746 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11747     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11750 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11751     dnl ===================================================================
11752     dnl Check for system poppler
11753     dnl ===================================================================
11754     AC_MSG_CHECKING([which PDF import poppler to use])
11755     if test "$with_system_poppler" = "yes"; then
11756         AC_MSG_RESULT([external])
11757         SYSTEM_POPPLER=TRUE
11758         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11759         AC_LANG_PUSH([C++])
11760         save_CXXFLAGS=$CXXFLAGS
11761         save_CPPFLAGS=$CPPFLAGS
11762         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11763         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11764         AC_CHECK_HEADER([cpp/poppler-version.h],
11765             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11766             [])
11767         CXXFLAGS=$save_CXXFLAGS
11768         CPPFLAGS=$save_CPPFLAGS
11769         AC_LANG_POP([C++])
11770         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11772         FilterLibs "${POPPLER_LIBS}"
11773         POPPLER_LIBS="${filteredlibs}"
11774     else
11775         AC_MSG_RESULT([internal])
11776         SYSTEM_POPPLER=
11777         BUILD_TYPE="$BUILD_TYPE POPPLER"
11778         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11779     fi
11780     AC_DEFINE([ENABLE_PDFIMPORT],1)
11782 AC_SUBST(ENABLE_PDFIMPORT)
11783 AC_SUBST(SYSTEM_POPPLER)
11784 AC_SUBST(POPPLER_CFLAGS)
11785 AC_SUBST(POPPLER_LIBS)
11787 # Skia?
11788 AC_MSG_CHECKING([whether to build Skia])
11789 ENABLE_SKIA=
11790 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11791     if test "$enable_skia" = "debug"; then
11792         AC_MSG_RESULT([yes (debug)])
11793         ENABLE_SKIA_DEBUG=TRUE
11794     else
11795         AC_MSG_RESULT([yes])
11796         ENABLE_SKIA_DEBUG=
11797     fi
11798     ENABLE_SKIA=TRUE
11799     AC_DEFINE(HAVE_FEATURE_SKIA)
11800     BUILD_TYPE="$BUILD_TYPE SKIA"
11801 else
11802     AC_MSG_RESULT([no])
11804 AC_SUBST(ENABLE_SKIA)
11805 AC_SUBST(ENABLE_SKIA_DEBUG)
11807 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11808 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11809 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11810 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11811 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11812 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11813 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11814 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11815 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11816 HAVE_LO_CLANG_DLLEXPORTINLINES=
11818 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "ARM64" \); then
11819     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11820         AC_MSG_CHECKING([for Clang])
11821         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11822     else
11823         if test "$_os" = "WINNT"; then
11824             AC_MSG_CHECKING([for clang-cl])
11825             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11826                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11827                 dnl explicitly set -m32/-m64
11828                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11829                 LO_CLANG_CXX="$LO_CLANG_CC"
11830                 AC_MSG_RESULT([$LO_CLANG_CC])
11831             else
11832                 AC_MSG_RESULT([no])
11833             fi
11834         else
11835             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11836             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11837         fi
11838     fi
11839     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11840         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11841         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11842         if test "$clang2_ver" -lt 50002; then
11843             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11844             LO_CLANG_CC=
11845             LO_CLANG_CXX=
11846         fi
11847     fi
11848     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
11849         save_CXX="$CXX"
11850         CXX="$LO_CLANG_CXX"
11851         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
11852         AC_LANG_PUSH([C++])
11853         save_CXXFLAGS=$CXXFLAGS
11854         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
11855         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
11856                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
11857                 AC_MSG_RESULT([yes])
11858             ], [AC_MSG_RESULT([no])])
11859         CXXFLAGS=$save_CXXFLAGS
11860         AC_LANG_POP([C++])
11861         CXX="$save_CXX"
11862         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
11863             AC_MSG_ERROR([Clang compiler does not support -Zc:dllexportInlines-. The Skia library needs to be built using a newer Clang version, or use --disable-skia.])
11864         fi
11865     fi
11866     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11867         # Skia is the default on Windows, so hard-require Clang.
11868         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11869         if test "$_os" = "WINNT"; then
11870             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11871         else
11872             AC_MSG_WARN([Clang compiler not found.])
11873         fi
11874     else
11876         save_CXX="$CXX"
11877         CXX="$LO_CLANG_CXX"
11878         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11879         flag_sse2=-msse2
11880         flag_ssse3=-mssse3
11881         flag_sse41=-msse4.1
11882         flag_sse42=-msse4.2
11883         flag_avx=-mavx
11884         flag_avx2=-mavx2
11885         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11886         flag_f16c=-mf16c
11887         flag_fma=-mfma
11889         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11890         AC_LANG_PUSH([C++])
11891         save_CXXFLAGS=$CXXFLAGS
11892         CXXFLAGS="$CXXFLAGS $flag_sse2"
11893         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11894             #include <emmintrin.h>
11895             int main () {
11896                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11897                 c = _mm_xor_si128 (a, b);
11898                 return 0;
11899             }
11900             ])],
11901             [can_compile_sse2=yes],
11902             [can_compile_sse2=no])
11903         AC_LANG_POP([C++])
11904         CXXFLAGS=$save_CXXFLAGS
11905         AC_MSG_RESULT([${can_compile_sse2}])
11906         if test "${can_compile_sse2}" = "yes" ; then
11907             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11908         fi
11910         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11911         AC_LANG_PUSH([C++])
11912         save_CXXFLAGS=$CXXFLAGS
11913         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11914         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11915             #include <tmmintrin.h>
11916             int main () {
11917                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11918                 c = _mm_maddubs_epi16 (a, b);
11919                 return 0;
11920             }
11921             ])],
11922             [can_compile_ssse3=yes],
11923             [can_compile_ssse3=no])
11924         AC_LANG_POP([C++])
11925         CXXFLAGS=$save_CXXFLAGS
11926         AC_MSG_RESULT([${can_compile_ssse3}])
11927         if test "${can_compile_ssse3}" = "yes" ; then
11928             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11929         fi
11931         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11932         AC_LANG_PUSH([C++])
11933         save_CXXFLAGS=$CXXFLAGS
11934         CXXFLAGS="$CXXFLAGS $flag_sse41"
11935         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11936             #include <smmintrin.h>
11937             int main () {
11938                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11939                 c = _mm_cmpeq_epi64 (a, b);
11940                 return 0;
11941             }
11942             ])],
11943             [can_compile_sse41=yes],
11944             [can_compile_sse41=no])
11945         AC_LANG_POP([C++])
11946         CXXFLAGS=$save_CXXFLAGS
11947         AC_MSG_RESULT([${can_compile_sse41}])
11948         if test "${can_compile_sse41}" = "yes" ; then
11949             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11950         fi
11952         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11953         AC_LANG_PUSH([C++])
11954         save_CXXFLAGS=$CXXFLAGS
11955         CXXFLAGS="$CXXFLAGS $flag_sse42"
11956         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11957             #include <nmmintrin.h>
11958             int main () {
11959                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11960                 c = _mm_cmpgt_epi64 (a, b);
11961                 return 0;
11962             }
11963             ])],
11964             [can_compile_sse42=yes],
11965             [can_compile_sse42=no])
11966         AC_LANG_POP([C++])
11967         CXXFLAGS=$save_CXXFLAGS
11968         AC_MSG_RESULT([${can_compile_sse42}])
11969         if test "${can_compile_sse42}" = "yes" ; then
11970             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11971         fi
11973         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11974         AC_LANG_PUSH([C++])
11975         save_CXXFLAGS=$CXXFLAGS
11976         CXXFLAGS="$CXXFLAGS $flag_avx"
11977         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11978             #include <immintrin.h>
11979             int main () {
11980                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11981                 c = _mm256_xor_ps(a, b);
11982                 return 0;
11983             }
11984             ])],
11985             [can_compile_avx=yes],
11986             [can_compile_avx=no])
11987         AC_LANG_POP([C++])
11988         CXXFLAGS=$save_CXXFLAGS
11989         AC_MSG_RESULT([${can_compile_avx}])
11990         if test "${can_compile_avx}" = "yes" ; then
11991             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11992         fi
11994         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11995         AC_LANG_PUSH([C++])
11996         save_CXXFLAGS=$CXXFLAGS
11997         CXXFLAGS="$CXXFLAGS $flag_avx2"
11998         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11999             #include <immintrin.h>
12000             int main () {
12001                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12002                 c = _mm256_maddubs_epi16(a, b);
12003                 return 0;
12004             }
12005             ])],
12006             [can_compile_avx2=yes],
12007             [can_compile_avx2=no])
12008         AC_LANG_POP([C++])
12009         CXXFLAGS=$save_CXXFLAGS
12010         AC_MSG_RESULT([${can_compile_avx2}])
12011         if test "${can_compile_avx2}" = "yes" ; then
12012             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12013         fi
12015         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12016         AC_LANG_PUSH([C++])
12017         save_CXXFLAGS=$CXXFLAGS
12018         CXXFLAGS="$CXXFLAGS $flag_avx512"
12019         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12020             #include <immintrin.h>
12021             int main () {
12022                 __m512i a = _mm512_loadu_si512(0);
12023                 return 0;
12024             }
12025             ])],
12026             [can_compile_avx512=yes],
12027             [can_compile_avx512=no])
12028         AC_LANG_POP([C++])
12029         CXXFLAGS=$save_CXXFLAGS
12030         AC_MSG_RESULT([${can_compile_avx512}])
12031         if test "${can_compile_avx512}" = "yes" ; then
12032             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12033         fi
12035         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12036         AC_LANG_PUSH([C++])
12037         save_CXXFLAGS=$CXXFLAGS
12038         CXXFLAGS="$CXXFLAGS $flag_f16c"
12039         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12040             #include <immintrin.h>
12041             int main () {
12042                 __m128i a = _mm_set1_epi32 (0);
12043                 __m128 c;
12044                 c = _mm_cvtph_ps(a);
12045                 return 0;
12046             }
12047             ])],
12048             [can_compile_f16c=yes],
12049             [can_compile_f16c=no])
12050         AC_LANG_POP([C++])
12051         CXXFLAGS=$save_CXXFLAGS
12052         AC_MSG_RESULT([${can_compile_f16c}])
12053         if test "${can_compile_f16c}" = "yes" ; then
12054             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12055         fi
12057         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12058         AC_LANG_PUSH([C++])
12059         save_CXXFLAGS=$CXXFLAGS
12060         CXXFLAGS="$CXXFLAGS $flag_fma"
12061         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12062             #include <immintrin.h>
12063             int main () {
12064                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12065                 d = _mm256_fmadd_ps(a, b, c);
12066                 return 0;
12067             }
12068             ])],
12069             [can_compile_fma=yes],
12070             [can_compile_fma=no])
12071         AC_LANG_POP([C++])
12072         CXXFLAGS=$save_CXXFLAGS
12073         AC_MSG_RESULT([${can_compile_fma}])
12074         if test "${can_compile_fma}" = "yes" ; then
12075             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12076         fi
12078         CXX="$save_CXX"
12079     fi
12082 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12084 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12085     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12086     AC_LANG_PUSH([C])
12087     save_CC="$CC"
12088     CC="$LO_CLANG_CC"
12089     save_CFLAGS=$CFLAGS
12090     CFLAGS="$CFLAGS --ccache-skip -O2"
12091     dnl an empty program will do, we're checking the compiler flags
12092     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12093                       [use_ccache=yes], [use_ccache=no])
12094     CFLAGS=$save_CFLAGS
12095     CC=$save_CC
12096     if test $use_ccache = yes; then
12097         AC_MSG_RESULT([yes])
12098     else
12099         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12100         AC_MSG_RESULT([no])
12101     fi
12102     AC_LANG_POP([C])
12104     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12105     AC_LANG_PUSH([C++])
12106     save_CXX="$CXX"
12107     CXX="$LO_CLANG_CXX"
12108     save_CXXFLAGS=$CXXFLAGS
12109     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12110     dnl an empty program will do, we're checking the compiler flags
12111     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12112                       [use_ccache=yes], [use_ccache=no])
12113     if test $use_ccache = yes; then
12114         AC_MSG_RESULT([yes])
12115     else
12116         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12117         AC_MSG_RESULT([no])
12118     fi
12119     CXXFLAGS=$save_CXXFLAGS
12120     CXX=$save_CXX
12121     AC_LANG_POP([C++])
12124 AC_SUBST(LO_CLANG_CC)
12125 AC_SUBST(LO_CLANG_CXX)
12126 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12127 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12128 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12129 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12130 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12131 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12132 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12133 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12134 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12135 AC_SUBST(CLANG_USE_LD)
12136 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12138 SYSTEM_GPGMEPP=
12140 if test "$enable_gpgmepp" = no; then
12141     AC_MSG_CHECKING([whether to enable gpgmepp])
12142     AC_MSG_RESULT([no])
12143 elif test "$enable_mpl_subset" = "yes"; then
12144     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12145     AC_MSG_RESULT([yes])
12146 elif test "$enable_fuzzers" = "yes"; then
12147     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12148     AC_MSG_RESULT([yes])
12149 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12150     dnl ===================================================================
12151     dnl Check for system gpgme
12152     dnl ===================================================================
12153     AC_MSG_CHECKING([which gpgmepp to use])
12154     if test "$with_system_gpgmepp" = "yes"; then
12155         AC_MSG_RESULT([external])
12156         SYSTEM_GPGMEPP=TRUE
12158         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12159         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12160             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12161         # progress_callback is the only func with plain C linkage
12162         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12163         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12164             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12165         AC_CHECK_HEADER(gpgme.h, [],
12166             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12167     else
12168         AC_MSG_RESULT([internal])
12169         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12170         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12172         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12173         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12174         if test "$_os" != "WINNT"; then
12175             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12176             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12177         fi
12178     fi
12179     ENABLE_GPGMEPP=TRUE
12180     AC_DEFINE([HAVE_FEATURE_GPGME])
12181     AC_PATH_PROG(GPG, gpg)
12182     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12183     # so let's exclude that manually for the moment
12184     if test -n "$GPG" -a "$_os" != "WINNT"; then
12185         # make sure we not only have a working gpgme, but a full working
12186         # gpg installation to run OpenPGP signature verification
12187         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12188     fi
12189     if test "$_os" = "Linux"; then
12190       uid=`id -u`
12191       AC_MSG_CHECKING([for /run/user/$uid])
12192       if test -d /run/user/$uid; then
12193         AC_MSG_RESULT([yes])
12194         AC_PATH_PROG(GPGCONF, gpgconf)
12196         # Older versions of gpgconf are not working as expected, since
12197         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12198         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12199         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12200         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12201         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12202         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12203         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12204           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12205           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12206           if $GPGCONF --dump-options > /dev/null ; then
12207             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12208               AC_MSG_RESULT([yes])
12209               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12210               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12211             else
12212               AC_MSG_RESULT([no])
12213             fi
12214           else
12215             AC_MSG_RESULT([no. missing or broken gpgconf?])
12216           fi
12217         else
12218           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12219         fi
12220       else
12221         AC_MSG_RESULT([no])
12222      fi
12223    fi
12225 AC_SUBST(ENABLE_GPGMEPP)
12226 AC_SUBST(SYSTEM_GPGMEPP)
12227 AC_SUBST(GPG_ERROR_CFLAGS)
12228 AC_SUBST(GPG_ERROR_LIBS)
12229 AC_SUBST(LIBASSUAN_CFLAGS)
12230 AC_SUBST(LIBASSUAN_LIBS)
12231 AC_SUBST(GPGMEPP_CFLAGS)
12232 AC_SUBST(GPGMEPP_LIBS)
12234 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12235 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12236     AC_MSG_RESULT([yes])
12237     ENABLE_MEDIAWIKI=TRUE
12238     BUILD_TYPE="$BUILD_TYPE XSLTML"
12239     if test  "x$with_java" = "xno"; then
12240         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12241     fi
12242 else
12243     AC_MSG_RESULT([no])
12244     ENABLE_MEDIAWIKI=
12245     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12247 AC_SUBST(ENABLE_MEDIAWIKI)
12249 AC_MSG_CHECKING([whether to build the Report Builder])
12250 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12251     AC_MSG_RESULT([yes])
12252     ENABLE_REPORTBUILDER=TRUE
12253     AC_MSG_CHECKING([which jfreereport libs to use])
12254     if test "$with_system_jfreereport" = "yes"; then
12255         SYSTEM_JFREEREPORT=TRUE
12256         AC_MSG_RESULT([external])
12257         if test -z $SAC_JAR; then
12258             SAC_JAR=/usr/share/java/sac.jar
12259         fi
12260         if ! test -f $SAC_JAR; then
12261              AC_MSG_ERROR(sac.jar not found.)
12262         fi
12264         if test -z $LIBXML_JAR; then
12265             if test -f /usr/share/java/libxml-1.0.0.jar; then
12266                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12267             elif test -f /usr/share/java/libxml.jar; then
12268                 LIBXML_JAR=/usr/share/java/libxml.jar
12269             else
12270                 AC_MSG_ERROR(libxml.jar replacement not found.)
12271             fi
12272         elif ! test -f $LIBXML_JAR; then
12273             AC_MSG_ERROR(libxml.jar not found.)
12274         fi
12276         if test -z $FLUTE_JAR; then
12277             if test -f /usr/share/java/flute-1.3.0.jar; then
12278                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12279             elif test -f /usr/share/java/flute.jar; then
12280                 FLUTE_JAR=/usr/share/java/flute.jar
12281             else
12282                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12283             fi
12284         elif ! test -f $FLUTE_JAR; then
12285             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12286         fi
12288         if test -z $JFREEREPORT_JAR; then
12289             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12290                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12291             elif test -f /usr/share/java/flow-engine.jar; then
12292                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12293             else
12294                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12295             fi
12296         elif ! test -f  $JFREEREPORT_JAR; then
12297                 AC_MSG_ERROR(jfreereport.jar not found.)
12298         fi
12300         if test -z $LIBLAYOUT_JAR; then
12301             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12302                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12303             elif test -f /usr/share/java/liblayout.jar; then
12304                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12305             else
12306                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12307             fi
12308         elif ! test -f $LIBLAYOUT_JAR; then
12309                 AC_MSG_ERROR(liblayout.jar not found.)
12310         fi
12312         if test -z $LIBLOADER_JAR; then
12313             if test -f /usr/share/java/libloader-1.0.0.jar; then
12314                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12315             elif test -f /usr/share/java/libloader.jar; then
12316                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12317             else
12318                 AC_MSG_ERROR(libloader.jar replacement not found.)
12319             fi
12320         elif ! test -f  $LIBLOADER_JAR; then
12321             AC_MSG_ERROR(libloader.jar not found.)
12322         fi
12324         if test -z $LIBFORMULA_JAR; then
12325             if test -f /usr/share/java/libformula-0.2.0.jar; then
12326                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12327             elif test -f /usr/share/java/libformula.jar; then
12328                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12329             else
12330                 AC_MSG_ERROR(libformula.jar replacement not found.)
12331             fi
12332         elif ! test -f $LIBFORMULA_JAR; then
12333                 AC_MSG_ERROR(libformula.jar not found.)
12334         fi
12336         if test -z $LIBREPOSITORY_JAR; then
12337             if test -f /usr/share/java/librepository-1.0.0.jar; then
12338                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12339             elif test -f /usr/share/java/librepository.jar; then
12340                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12341             else
12342                 AC_MSG_ERROR(librepository.jar replacement not found.)
12343             fi
12344         elif ! test -f $LIBREPOSITORY_JAR; then
12345             AC_MSG_ERROR(librepository.jar not found.)
12346         fi
12348         if test -z $LIBFONTS_JAR; then
12349             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12350                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12351             elif test -f /usr/share/java/libfonts.jar; then
12352                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12353             else
12354                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12355             fi
12356         elif ! test -f $LIBFONTS_JAR; then
12357                 AC_MSG_ERROR(libfonts.jar not found.)
12358         fi
12360         if test -z $LIBSERIALIZER_JAR; then
12361             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12362                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12363             elif test -f /usr/share/java/libserializer.jar; then
12364                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12365             else
12366                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12367             fi
12368         elif ! test -f $LIBSERIALIZER_JAR; then
12369                 AC_MSG_ERROR(libserializer.jar not found.)
12370         fi
12372         if test -z $LIBBASE_JAR; then
12373             if test -f /usr/share/java/libbase-1.0.0.jar; then
12374                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12375             elif test -f /usr/share/java/libbase.jar; then
12376                 LIBBASE_JAR=/usr/share/java/libbase.jar
12377             else
12378                 AC_MSG_ERROR(libbase.jar replacement not found.)
12379             fi
12380         elif ! test -f $LIBBASE_JAR; then
12381             AC_MSG_ERROR(libbase.jar not found.)
12382         fi
12384     else
12385         AC_MSG_RESULT([internal])
12386         SYSTEM_JFREEREPORT=
12387         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12388         NEED_ANT=TRUE
12389     fi
12390 else
12391     AC_MSG_RESULT([no])
12392     ENABLE_REPORTBUILDER=
12393     SYSTEM_JFREEREPORT=
12395 AC_SUBST(ENABLE_REPORTBUILDER)
12396 AC_SUBST(SYSTEM_JFREEREPORT)
12397 AC_SUBST(SAC_JAR)
12398 AC_SUBST(LIBXML_JAR)
12399 AC_SUBST(FLUTE_JAR)
12400 AC_SUBST(JFREEREPORT_JAR)
12401 AC_SUBST(LIBBASE_JAR)
12402 AC_SUBST(LIBLAYOUT_JAR)
12403 AC_SUBST(LIBLOADER_JAR)
12404 AC_SUBST(LIBFORMULA_JAR)
12405 AC_SUBST(LIBREPOSITORY_JAR)
12406 AC_SUBST(LIBFONTS_JAR)
12407 AC_SUBST(LIBSERIALIZER_JAR)
12409 # this has to be here because both the Wiki Publisher and the SRB use
12410 # commons-logging
12411 COMMONS_LOGGING_VERSION=1.2
12412 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12413     AC_MSG_CHECKING([which Apache commons-* libs to use])
12414     if test "$with_system_apache_commons" = "yes"; then
12415         SYSTEM_APACHE_COMMONS=TRUE
12416         AC_MSG_RESULT([external])
12417         if test -z $COMMONS_LOGGING_JAR; then
12418             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
12419                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
12420            elif test -f /usr/share/java/commons-logging.jar; then
12421                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
12422             else
12423                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
12424             fi
12425         elif ! test -f $COMMONS_LOGGING_JAR; then
12426             AC_MSG_ERROR(commons-logging.jar not found.)
12427         fi
12428     else
12429         AC_MSG_RESULT([internal])
12430         SYSTEM_APACHE_COMMONS=
12431         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
12432         NEED_ANT=TRUE
12433     fi
12435 AC_SUBST(SYSTEM_APACHE_COMMONS)
12436 AC_SUBST(COMMONS_LOGGING_JAR)
12437 AC_SUBST(COMMONS_LOGGING_VERSION)
12439 # scripting provider for BeanShell?
12440 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12441 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12442     AC_MSG_RESULT([yes])
12443     ENABLE_SCRIPTING_BEANSHELL=TRUE
12445     dnl ===================================================================
12446     dnl Check for system beanshell
12447     dnl ===================================================================
12448     AC_MSG_CHECKING([which beanshell to use])
12449     if test "$with_system_beanshell" = "yes"; then
12450         AC_MSG_RESULT([external])
12451         SYSTEM_BSH=TRUE
12452         if test -z $BSH_JAR; then
12453             BSH_JAR=/usr/share/java/bsh.jar
12454         fi
12455         if ! test -f $BSH_JAR; then
12456             AC_MSG_ERROR(bsh.jar not found.)
12457         fi
12458     else
12459         AC_MSG_RESULT([internal])
12460         SYSTEM_BSH=
12461         BUILD_TYPE="$BUILD_TYPE BSH"
12462     fi
12463 else
12464     AC_MSG_RESULT([no])
12465     ENABLE_SCRIPTING_BEANSHELL=
12466     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12468 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12469 AC_SUBST(SYSTEM_BSH)
12470 AC_SUBST(BSH_JAR)
12472 # scripting provider for JavaScript?
12473 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12474 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12475     AC_MSG_RESULT([yes])
12476     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12478     dnl ===================================================================
12479     dnl Check for system rhino
12480     dnl ===================================================================
12481     AC_MSG_CHECKING([which rhino to use])
12482     if test "$with_system_rhino" = "yes"; then
12483         AC_MSG_RESULT([external])
12484         SYSTEM_RHINO=TRUE
12485         if test -z $RHINO_JAR; then
12486             RHINO_JAR=/usr/share/java/js.jar
12487         fi
12488         if ! test -f $RHINO_JAR; then
12489             AC_MSG_ERROR(js.jar not found.)
12490         fi
12491     else
12492         AC_MSG_RESULT([internal])
12493         SYSTEM_RHINO=
12494         BUILD_TYPE="$BUILD_TYPE RHINO"
12495         NEED_ANT=TRUE
12496     fi
12497 else
12498     AC_MSG_RESULT([no])
12499     ENABLE_SCRIPTING_JAVASCRIPT=
12500     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12502 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12503 AC_SUBST(SYSTEM_RHINO)
12504 AC_SUBST(RHINO_JAR)
12506 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12507 # paths should be added to library search path. So lets put all 64-bit
12508 # platforms there.
12509 supports_multilib=
12510 case "$host_cpu" in
12511 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12512     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12513         supports_multilib="yes"
12514     fi
12515     ;;
12517     ;;
12518 esac
12520 dnl ===================================================================
12521 dnl QT5 Integration
12522 dnl ===================================================================
12524 QT5_CFLAGS=""
12525 QT5_LIBS=""
12526 QMAKE5="qmake"
12527 MOC5="moc"
12528 QT5_GOBJECT_CFLAGS=""
12529 QT5_GOBJECT_LIBS=""
12530 QT5_HAVE_GOBJECT=""
12531 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12532         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12533         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12534 then
12535     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12536     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12538     if test -n "$supports_multilib"; then
12539         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12540     fi
12542     qt5_test_include="QtWidgets/qapplication.h"
12543     qt5_test_library="libQt5Widgets.so"
12545     dnl Check for qmake5
12546     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
12547     if test "$QMAKE5" = "no"; then
12548         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12549     else
12550         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12551         if test -z "$qmake5_test_ver"; then
12552             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12553         fi
12554         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12555         qt5_minimal_minor="6"
12556         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12557             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12558         else
12559             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12560         fi
12561     fi
12563     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12564     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12566     AC_MSG_CHECKING([for Qt5 headers])
12567     qt5_incdir="no"
12568     for inc_dir in $qt5_incdirs; do
12569         if test -r "$inc_dir/$qt5_test_include"; then
12570             qt5_incdir="$inc_dir"
12571             break
12572         fi
12573     done
12574     AC_MSG_RESULT([$qt5_incdir])
12575     if test "x$qt5_incdir" = "xno"; then
12576         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12577     fi
12578     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12579     AC_LANG_PUSH([C++])
12580     save_CPPFLAGS=$CPPFLAGS
12581     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12582     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12583         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12584     CPPFLAGS=$save_CPPFLAGS
12585     AC_LANG_POP([C++])
12587     AC_MSG_CHECKING([for Qt5 libraries])
12588     qt5_libdir="no"
12589     for lib_dir in $qt5_libdirs; do
12590         if test -r "$lib_dir/$qt5_test_library"; then
12591             qt5_libdir="$lib_dir"
12592             break
12593         fi
12594     done
12595     AC_MSG_RESULT([$qt5_libdir])
12596     if test "x$qt5_libdir" = "xno"; then
12597         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12598     fi
12600     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12601     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12602     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12604     if test "$USING_X11" = TRUE; then
12605         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12606         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12607             QT5_HAVE_XCB_ICCCM=1
12608             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12609         ],[
12610             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
12611             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12612         ])
12613         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12614         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12615         QT5_USING_X11=1
12616         AC_DEFINE(QT5_USING_X11)
12617     fi
12619     dnl Check for Meta Object Compiler
12621     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12622     if test "$MOC5" = "no"; then
12623         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12624 the root of your Qt installation by exporting QT5DIR before running "configure".])
12625     fi
12627     if test "$build_gstreamer_1_0" = "yes"; then
12628         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12629                 QT5_HAVE_GOBJECT=1
12630                 AC_DEFINE(QT5_HAVE_GOBJECT)
12631             ],
12632             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12633         )
12634     fi
12636 AC_SUBST(QT5_CFLAGS)
12637 AC_SUBST(QT5_LIBS)
12638 AC_SUBST(MOC5)
12639 AC_SUBST(QT5_GOBJECT_CFLAGS)
12640 AC_SUBST(QT5_GOBJECT_LIBS)
12641 AC_SUBST(QT5_HAVE_GOBJECT)
12643 dnl ===================================================================
12644 dnl KF5 Integration
12645 dnl ===================================================================
12647 KF5_CFLAGS=""
12648 KF5_LIBS=""
12649 KF5_CONFIG="kf5-config"
12650 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12651         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12652 then
12653     if test "$OS" = "HAIKU"; then
12654         haiku_arch="`echo $RTL_ARCH | tr X x`"
12655         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12656         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12657     fi
12659     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12660     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12661     if test -n "$supports_multilib"; then
12662         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12663     fi
12665     kf5_test_include="KF5/kcoreaddons_version.h"
12666     kf5_test_library="libKF5CoreAddons.so"
12667     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12669     dnl kf5 KDE4 support compatibility installed
12670     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12671     if test "$KF5_CONFIG" != "no"; then
12672         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12673         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12674     fi
12676     dnl Check for KF5 headers
12677     AC_MSG_CHECKING([for KF5 headers])
12678     kf5_incdir="no"
12679     for kf5_check in $kf5_incdirs; do
12680         if test -r "$kf5_check/$kf5_test_include"; then
12681             kf5_incdir="$kf5_check/KF5"
12682             break
12683         fi
12684     done
12685     AC_MSG_RESULT([$kf5_incdir])
12686     if test "x$kf5_incdir" = "xno"; then
12687         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12688     fi
12690     dnl Check for KF5 libraries
12691     AC_MSG_CHECKING([for KF5 libraries])
12692     kf5_libdir="no"
12693     for kf5_check in $kf5_libdirs; do
12694         if test -r "$kf5_check/$kf5_test_library"; then
12695             kf5_libdir="$kf5_check"
12696             break
12697         fi
12698     done
12700     AC_MSG_RESULT([$kf5_libdir])
12701     if test "x$kf5_libdir" = "xno"; then
12702         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12703     fi
12705     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"
12706     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12707     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12709     if test "$USING_X11" = TRUE; then
12710         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12711     fi
12713     AC_LANG_PUSH([C++])
12714     save_CXXFLAGS=$CXXFLAGS
12715     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12716     AC_MSG_CHECKING([whether KDE is >= 5.0])
12717        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12718 #include <kcoreaddons_version.h>
12720 int main(int argc, char **argv) {
12721        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12722        else return 1;
12724        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12725     CXXFLAGS=$save_CXXFLAGS
12726     AC_LANG_POP([C++])
12728 AC_SUBST(KF5_CFLAGS)
12729 AC_SUBST(KF5_LIBS)
12731 dnl ===================================================================
12732 dnl Test whether to include Evolution 2 support
12733 dnl ===================================================================
12734 AC_MSG_CHECKING([whether to enable evolution 2 support])
12735 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12736     AC_MSG_RESULT([yes])
12737     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12738     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12739     FilterLibs "${GOBJECT_LIBS}"
12740     GOBJECT_LIBS="${filteredlibs}"
12741     ENABLE_EVOAB2="TRUE"
12742 else
12743     ENABLE_EVOAB2=""
12744     AC_MSG_RESULT([no])
12746 AC_SUBST(ENABLE_EVOAB2)
12747 AC_SUBST(GOBJECT_CFLAGS)
12748 AC_SUBST(GOBJECT_LIBS)
12750 dnl ===================================================================
12751 dnl Test which themes to include
12752 dnl ===================================================================
12753 AC_MSG_CHECKING([which themes to include])
12754 # if none given use default subset of available themes
12755 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12756     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg"
12759 WITH_THEMES=""
12760 if test "x$with_theme" != "xno"; then
12761     for theme in $with_theme; do
12762         case $theme in
12763         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg) real_theme="$theme" ;;
12764         default) real_theme=colibre ;;
12765         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12766         esac
12767         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12768     done
12770 AC_MSG_RESULT([$WITH_THEMES])
12771 AC_SUBST([WITH_THEMES])
12772 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12773 for theme in $with_theme; do
12774     case $theme in
12775     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12776     *) ;;
12777     esac
12778 done
12780 dnl ===================================================================
12781 dnl Test whether to integrate helppacks into the product's installer
12782 dnl ===================================================================
12783 AC_MSG_CHECKING([for helppack integration])
12784 if test "$with_helppack_integration" = "no"; then
12785     AC_MSG_RESULT([no integration])
12786 else
12787     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12788     AC_MSG_RESULT([integration])
12791 ###############################################################################
12792 # Extensions checking
12793 ###############################################################################
12794 AC_MSG_CHECKING([for extensions integration])
12795 if test "x$enable_extension_integration" != "xno"; then
12796     WITH_EXTENSION_INTEGRATION=TRUE
12797     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12798     AC_MSG_RESULT([yes, use integration])
12799 else
12800     WITH_EXTENSION_INTEGRATION=
12801     AC_MSG_RESULT([no, do not integrate])
12803 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12805 dnl Should any extra extensions be included?
12806 dnl There are standalone tests for each of these below.
12807 WITH_EXTRA_EXTENSIONS=
12808 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12810 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12811 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12812 if test "x$with_java" != "xno"; then
12813     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12814     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12817 AC_MSG_CHECKING([whether to build opens___.ttf])
12818 if test "$enable_build_opensymbol" = "yes"; then
12819     AC_MSG_RESULT([yes])
12820     AC_PATH_PROG(FONTFORGE, fontforge)
12821     if test -z "$FONTFORGE"; then
12822         AC_MSG_ERROR([fontforge not installed])
12823     fi
12824 else
12825     AC_MSG_RESULT([no])
12826     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12827     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12829 AC_SUBST(OPENSYMBOL_TTF)
12830 AC_SUBST(FONTFORGE)
12832 dnl ===================================================================
12833 dnl Test whether to include fonts
12834 dnl ===================================================================
12835 AC_MSG_CHECKING([whether to include third-party fonts])
12836 if test "$with_fonts" != "no"; then
12837     AC_MSG_RESULT([yes])
12838     WITH_FONTS=TRUE
12839     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12840     AC_DEFINE(HAVE_MORE_FONTS)
12841 else
12842     AC_MSG_RESULT([no])
12843     WITH_FONTS=
12844     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12846 AC_SUBST(WITH_FONTS)
12848 dnl Test whether to include more Google Noto fonts
12849 dnl ===================================================================
12850 AC_MSG_CHECKING([whether to include more Google Noto fonts])
12851 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
12852     AC_MSG_RESULT([no])
12853     WITH_NOTO_FONT=
12854 else
12855     AC_MSG_RESULT([yes])
12856     WITH_NOTO_FONT=TRUE
12857     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
12858     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
12860 AC_SUBST(WITH_NOTO_FONT)
12862 dnl ===================================================================
12863 dnl Test whether to enable online update service
12864 dnl ===================================================================
12865 AC_MSG_CHECKING([whether to enable online update])
12866 ENABLE_ONLINE_UPDATE=
12867 ENABLE_ONLINE_UPDATE_MAR=
12868 UPDATE_CONFIG=
12869 if test "$enable_online_update" = ""; then
12870     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12871         AC_MSG_RESULT([yes])
12872         ENABLE_ONLINE_UPDATE="TRUE"
12873     else
12874         AC_MSG_RESULT([no])
12875     fi
12876 else
12877     if test "$enable_online_update" = "mar"; then
12878         AC_MSG_RESULT([yes - MAR-based online update])
12879         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12880         if test "$with_update_config" = ""; then
12881             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12882         fi
12883         UPDATE_CONFIG="$with_update_config"
12884         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12885     elif test "$enable_online_update" = "yes"; then
12886         AC_MSG_RESULT([yes])
12887         ENABLE_ONLINE_UPDATE="TRUE"
12888     else
12889         AC_MSG_RESULT([no])
12890     fi
12892 AC_SUBST(ENABLE_ONLINE_UPDATE)
12893 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12894 AC_SUBST(UPDATE_CONFIG)
12896 dnl ===================================================================
12897 dnl Test whether we need bzip2
12898 dnl ===================================================================
12899 SYSTEM_BZIP2=
12900 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12901     AC_MSG_CHECKING([whether to use system bzip2])
12902     if test "$with_system_bzip2" = yes; then
12903         SYSTEM_BZIP2=TRUE
12904         AC_MSG_RESULT([yes])
12905         PKG_CHECK_MODULES(BZIP2, bzip2)
12906         FilterLibs "${BZIP2_LIBS}"
12907         BZIP2_LIBS="${filteredlibs}"
12908     else
12909         AC_MSG_RESULT([no])
12910         BUILD_TYPE="$BUILD_TYPE BZIP2"
12911     fi
12913 AC_SUBST(SYSTEM_BZIP2)
12914 AC_SUBST(BZIP2_CFLAGS)
12915 AC_SUBST(BZIP2_LIBS)
12917 dnl ===================================================================
12918 dnl Test whether to enable extension update
12919 dnl ===================================================================
12920 AC_MSG_CHECKING([whether to enable extension update])
12921 ENABLE_EXTENSION_UPDATE=
12922 if test "x$enable_extension_update" = "xno"; then
12923     AC_MSG_RESULT([no])
12924 else
12925     AC_MSG_RESULT([yes])
12926     ENABLE_EXTENSION_UPDATE="TRUE"
12927     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12928     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12930 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12933 dnl ===================================================================
12934 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12935 dnl ===================================================================
12936 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12937 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12938     AC_MSG_RESULT([no])
12939     ENABLE_SILENT_MSI=
12940 else
12941     AC_MSG_RESULT([yes])
12942     ENABLE_SILENT_MSI=TRUE
12943     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12945 AC_SUBST(ENABLE_SILENT_MSI)
12947 AC_MSG_CHECKING([whether and how to use Xinerama])
12948 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12949     if test "$x_libraries" = "default_x_libraries"; then
12950         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12951         if test "x$XINERAMALIB" = x; then
12952            XINERAMALIB="/usr/lib"
12953         fi
12954     else
12955         XINERAMALIB="$x_libraries"
12956     fi
12957     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12958         # we have both versions, let the user decide but use the dynamic one
12959         # per default
12960         USE_XINERAMA=TRUE
12961         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12962             XINERAMA_LINK=dynamic
12963         else
12964             XINERAMA_LINK=static
12965         fi
12966     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12967         # we have only the dynamic version
12968         USE_XINERAMA=TRUE
12969         XINERAMA_LINK=dynamic
12970     elif test -e "$XINERAMALIB/libXinerama.a"; then
12971         # static version
12972         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12973             USE_XINERAMA=TRUE
12974             XINERAMA_LINK=static
12975         else
12976             USE_XINERAMA=
12977             XINERAMA_LINK=none
12978         fi
12979     else
12980         # no Xinerama
12981         USE_XINERAMA=
12982         XINERAMA_LINK=none
12983     fi
12984     if test "$USE_XINERAMA" = "TRUE"; then
12985         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12986         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12987             [AC_MSG_ERROR(Xinerama header not found.)], [])
12988         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12989         if test "x$XEXTLIB" = x; then
12990            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12991         fi
12992         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12993         if test "$_os" = "FreeBSD"; then
12994             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12995         fi
12996         if test "$_os" = "Linux"; then
12997             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12998         fi
12999         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13000             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13001     else
13002         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13003     fi
13004 else
13005     USE_XINERAMA=
13006     XINERAMA_LINK=none
13007     AC_MSG_RESULT([no])
13009 AC_SUBST(USE_XINERAMA)
13010 AC_SUBST(XINERAMA_LINK)
13012 dnl ===================================================================
13013 dnl Test whether to build cairo or rely on the system version
13014 dnl ===================================================================
13016 if test "$USING_X11" = TRUE; then
13017     # Used in vcl/Library_vclplug_gen.mk
13018     test_cairo=yes
13021 if test "$test_cairo" = "yes"; then
13022     AC_MSG_CHECKING([whether to use the system cairo])
13024     : ${with_system_cairo:=$with_system_libs}
13025     if test "$with_system_cairo" = "yes"; then
13026         SYSTEM_CAIRO=TRUE
13027         AC_MSG_RESULT([yes])
13029         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13030         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13031         FilterLibs "${CAIRO_LIBS}"
13032         CAIRO_LIBS="${filteredlibs}"
13034         if test "$test_xrender" = "yes"; then
13035             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13036             AC_LANG_PUSH([C])
13037             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13038 #ifdef PictStandardA8
13039 #else
13040       return fail;
13041 #endif
13042 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13044             AC_LANG_POP([C])
13045         fi
13046     else
13047         SYSTEM_CAIRO=
13048         AC_MSG_RESULT([no])
13050         BUILD_TYPE="$BUILD_TYPE CAIRO"
13051     fi
13054 AC_SUBST(SYSTEM_CAIRO)
13055 AC_SUBST(CAIRO_CFLAGS)
13056 AC_SUBST(CAIRO_LIBS)
13058 dnl ===================================================================
13059 dnl Test whether to use avahi
13060 dnl ===================================================================
13061 if test "$_os" = "WINNT"; then
13062     # Windows uses bundled mDNSResponder
13063     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13064 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13065     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13066                       [ENABLE_AVAHI="TRUE"])
13067     AC_DEFINE(HAVE_FEATURE_AVAHI)
13068     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13069     FilterLibs "${AVAHI_LIBS}"
13070     AVAHI_LIBS="${filteredlibs}"
13073 AC_SUBST(ENABLE_AVAHI)
13074 AC_SUBST(AVAHI_CFLAGS)
13075 AC_SUBST(AVAHI_LIBS)
13077 dnl ===================================================================
13078 dnl Test whether to use liblangtag
13079 dnl ===================================================================
13080 SYSTEM_LIBLANGTAG=
13081 AC_MSG_CHECKING([whether to use system liblangtag])
13082 if test "$with_system_liblangtag" = yes; then
13083     SYSTEM_LIBLANGTAG=TRUE
13084     AC_MSG_RESULT([yes])
13085     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13086     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13087     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13088     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13089     FilterLibs "${LIBLANGTAG_LIBS}"
13090     LIBLANGTAG_LIBS="${filteredlibs}"
13091 else
13092     SYSTEM_LIBLANGTAG=
13093     AC_MSG_RESULT([no])
13094     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13095     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13096     if test "$COM" = "MSC"; then
13097         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13098     else
13099         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13100     fi
13102 AC_SUBST(SYSTEM_LIBLANGTAG)
13103 AC_SUBST(LIBLANGTAG_CFLAGS)
13104 AC_SUBST(LIBLANGTAG_LIBS)
13106 dnl ===================================================================
13107 dnl Test whether to build libpng or rely on the system version
13108 dnl ===================================================================
13110 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13112 dnl ===================================================================
13113 dnl Test whether to build libwebp or rely on the system version
13114 dnl ===================================================================
13116 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13118 dnl ===================================================================
13119 dnl Check for runtime JVM search path
13120 dnl ===================================================================
13121 if test "$ENABLE_JAVA" != ""; then
13122     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13123     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13124         AC_MSG_RESULT([yes])
13125         if ! test -d "$with_jvm_path"; then
13126             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13127         fi
13128         if ! test -d "$with_jvm_path"jvm; then
13129             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13130         fi
13131         JVM_ONE_PATH_CHECK="$with_jvm_path"
13132         AC_SUBST(JVM_ONE_PATH_CHECK)
13133     else
13134         AC_MSG_RESULT([no])
13135     fi
13138 dnl ===================================================================
13139 dnl Test for the presence of Ant and that it works
13140 dnl ===================================================================
13142 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13143     ANT_HOME=; export ANT_HOME
13144     WITH_ANT_HOME=; export WITH_ANT_HOME
13145     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13146         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13147             if test "$_os" = "WINNT"; then
13148                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13149             else
13150                 with_ant_home="$LODE_HOME/opt/ant"
13151             fi
13152         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13153             with_ant_home="$LODE_HOME/opt/ant"
13154         fi
13155     fi
13156     if test -z "$with_ant_home"; then
13157         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13158     else
13159         if test "$_os" = "WINNT"; then
13160             # AC_PATH_PROGS needs unix path
13161             with_ant_home=`cygpath -u "$with_ant_home"`
13162         fi
13163         AbsolutePath "$with_ant_home"
13164         with_ant_home=$absolute_path
13165         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13166         WITH_ANT_HOME=$with_ant_home
13167         ANT_HOME=$with_ant_home
13168     fi
13170     if test -z "$ANT"; then
13171         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13172     else
13173         # resolve relative or absolute symlink
13174         while test -h "$ANT"; do
13175             a_cwd=`pwd`
13176             a_basename=`basename "$ANT"`
13177             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13178             cd "`dirname "$ANT"`"
13179             cd "`dirname "$a_script"`"
13180             ANT="`pwd`"/"`basename "$a_script"`"
13181             cd "$a_cwd"
13182         done
13184         AC_MSG_CHECKING([if $ANT works])
13185         mkdir -p conftest.dir
13186         a_cwd=$(pwd)
13187         cd conftest.dir
13188         cat > conftest.java << EOF
13189         public class conftest {
13190             int testmethod(int a, int b) {
13191                     return a + b;
13192             }
13193         }
13196         cat > conftest.xml << EOF
13197         <project name="conftest" default="conftest">
13198         <target name="conftest">
13199             <javac srcdir="." includes="conftest.java">
13200             </javac>
13201         </target>
13202         </project>
13205         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13206         if test $? = 0 -a -f ./conftest.class; then
13207             AC_MSG_RESULT([Ant works])
13208             if test -z "$WITH_ANT_HOME"; then
13209                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13210                 if test -z "$ANT_HOME"; then
13211                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13212                 fi
13213             else
13214                 ANT_HOME="$WITH_ANT_HOME"
13215             fi
13216         else
13217             echo "configure: Ant test failed" >&5
13218             cat conftest.java >&5
13219             cat conftest.xml >&5
13220             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13221         fi
13222         cd "$a_cwd"
13223         rm -fr conftest.dir
13224     fi
13225     if test -z "$ANT_HOME"; then
13226         ANT_HOME="NO_ANT_HOME"
13227     else
13228         PathFormat "$ANT_HOME"
13229         ANT_HOME="$formatted_path"
13230         PathFormat "$ANT"
13231         ANT="$formatted_path"
13232     fi
13234     dnl Checking for ant.jar
13235     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13236         AC_MSG_CHECKING([Ant lib directory])
13237         if test -f $ANT_HOME/lib/ant.jar; then
13238             ANT_LIB="$ANT_HOME/lib"
13239         else
13240             if test -f $ANT_HOME/ant.jar; then
13241                 ANT_LIB="$ANT_HOME"
13242             else
13243                 if test -f /usr/share/java/ant.jar; then
13244                     ANT_LIB=/usr/share/java
13245                 else
13246                     if test -f /usr/share/ant-core/lib/ant.jar; then
13247                         ANT_LIB=/usr/share/ant-core/lib
13248                     else
13249                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13250                             ANT_LIB="$ANT_HOME/lib/ant"
13251                         else
13252                             if test -f /usr/share/lib/ant/ant.jar; then
13253                                 ANT_LIB=/usr/share/lib/ant
13254                             else
13255                                 AC_MSG_ERROR([Ant libraries not found!])
13256                             fi
13257                         fi
13258                     fi
13259                 fi
13260             fi
13261         fi
13262         PathFormat "$ANT_LIB"
13263         ANT_LIB="$formatted_path"
13264         AC_MSG_RESULT([Ant lib directory found.])
13265     fi
13267     ant_minver=1.6.0
13268     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13270     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13271     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13272     ant_version_major=`echo $ant_version | cut -d. -f1`
13273     ant_version_minor=`echo $ant_version | cut -d. -f2`
13274     echo "configure: ant_version $ant_version " >&5
13275     echo "configure: ant_version_major $ant_version_major " >&5
13276     echo "configure: ant_version_minor $ant_version_minor " >&5
13277     if test "$ant_version_major" -ge "2"; then
13278         AC_MSG_RESULT([yes, $ant_version])
13279     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13280         AC_MSG_RESULT([yes, $ant_version])
13281     else
13282         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13283     fi
13285     rm -f conftest* core core.* *.core
13287 AC_SUBST(ANT)
13288 AC_SUBST(ANT_HOME)
13289 AC_SUBST(ANT_LIB)
13291 OOO_JUNIT_JAR=
13292 HAMCREST_JAR=
13293 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13294     AC_MSG_CHECKING([for JUnit 4])
13295     if test "$with_junit" = "yes"; then
13296         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13297             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13298         elif test -e /usr/share/java/junit4.jar; then
13299             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13300         else
13301            if test -e /usr/share/lib/java/junit.jar; then
13302               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13303            else
13304               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13305            fi
13306         fi
13307     else
13308         OOO_JUNIT_JAR=$with_junit
13309     fi
13310     if test "$_os" = "WINNT"; then
13311         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13312     fi
13313     printf 'import org.junit.Before;' > conftest.java
13314     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13315         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13316     else
13317         AC_MSG_ERROR(
13318 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13319  specify its pathname via --with-junit=..., or disable it via --without-junit])
13320     fi
13321     rm -f conftest.class conftest.java
13322     if test $OOO_JUNIT_JAR != ""; then
13323         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13324     fi
13326     AC_MSG_CHECKING([for included Hamcrest])
13327     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13328     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13329         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13330     else
13331         AC_MSG_RESULT([Not included])
13332         AC_MSG_CHECKING([for standalone hamcrest jar.])
13333         if test "$with_hamcrest" = "yes"; then
13334             if test -e /usr/share/lib/java/hamcrest.jar; then
13335                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13336             elif test -e /usr/share/java/hamcrest/core.jar; then
13337                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13338             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13339                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13340             else
13341                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13342             fi
13343         else
13344             HAMCREST_JAR=$with_hamcrest
13345         fi
13346         if test "$_os" = "WINNT"; then
13347             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13348         fi
13349         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13350             AC_MSG_RESULT([$HAMCREST_JAR])
13351         else
13352             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),
13353                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13354         fi
13355     fi
13356     rm -f conftest.class conftest.java
13358 AC_SUBST(OOO_JUNIT_JAR)
13359 AC_SUBST(HAMCREST_JAR)
13362 AC_SUBST(SCPDEFS)
13365 # check for wget and curl
13367 WGET=
13368 CURL=
13370 if test "$enable_fetch_external" != "no"; then
13372 CURL=`which curl 2>/dev/null`
13374 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13375     # wget new enough?
13376     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13377     if test $? -eq 0; then
13378         WGET=$i
13379         break
13380     fi
13381 done
13383 if test -z "$WGET" -a -z "$CURL"; then
13384     AC_MSG_ERROR([neither wget nor curl found!])
13389 AC_SUBST(WGET)
13390 AC_SUBST(CURL)
13393 # check for sha256sum
13395 SHA256SUM=
13397 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13398     eval "$i -a 256 --version" > /dev/null 2>&1
13399     ret=$?
13400     if test $ret -eq 0; then
13401         SHA256SUM="$i -a 256"
13402         break
13403     fi
13404 done
13406 if test -z "$SHA256SUM"; then
13407     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13408         eval "$i --version" > /dev/null 2>&1
13409         ret=$?
13410         if test $ret -eq 0; then
13411             SHA256SUM=$i
13412             break
13413         fi
13414     done
13417 if test -z "$SHA256SUM"; then
13418     AC_MSG_ERROR([no sha256sum found!])
13421 AC_SUBST(SHA256SUM)
13423 dnl ===================================================================
13424 dnl Dealing with l10n options
13425 dnl ===================================================================
13426 AC_MSG_CHECKING([which languages to be built])
13427 # get list of all languages
13428 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13429 # the sed command does the following:
13430 #   + if a line ends with a backslash, append the next line to it
13431 #   + adds " on the beginning of the value (after =)
13432 #   + adds " at the end of the value
13433 #   + removes en-US; we want to put it on the beginning
13434 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13435 [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)]
13436 ALL_LANGS="en-US $completelangiso"
13437 # check the configured localizations
13438 WITH_LANG="$with_lang"
13440 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13441 # (Norwegian is "nb" and "nn".)
13442 if test "$WITH_LANG" = "no"; then
13443     WITH_LANG=
13446 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13447     AC_MSG_RESULT([en-US])
13448 else
13449     AC_MSG_RESULT([$WITH_LANG])
13450     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13451     if test -z "$MSGFMT"; then
13452         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13453             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13454         elif test -x "/opt/lo/bin/msgfmt"; then
13455             MSGFMT="/opt/lo/bin/msgfmt"
13456         else
13457             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13458             if test -z "$MSGFMT"; then
13459                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13460             fi
13461         fi
13462     fi
13463     if test -z "$MSGUNIQ"; then
13464         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13465             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13466         elif test -x "/opt/lo/bin/msguniq"; then
13467             MSGUNIQ="/opt/lo/bin/msguniq"
13468         else
13469             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13470             if test -z "$MSGUNIQ"; then
13471                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13472             fi
13473         fi
13474     fi
13476 AC_SUBST(MSGFMT)
13477 AC_SUBST(MSGUNIQ)
13478 # check that the list is valid
13479 for lang in $WITH_LANG; do
13480     test "$lang" = "ALL" && continue
13481     # need to check for the exact string, so add space before and after the list of all languages
13482     for vl in $ALL_LANGS; do
13483         if test "$vl" = "$lang"; then
13484            break
13485         fi
13486     done
13487     if test "$vl" != "$lang"; then
13488         # if you're reading this - you prolly quoted your languages remove the quotes ...
13489         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13490     fi
13491 done
13492 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13493     echo $WITH_LANG | grep -q en-US
13494     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13496 # list with substituted ALL
13497 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13498 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13499 test "$WITH_LANG" = "en-US" && WITH_LANG=
13500 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13501     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13502     ALL_LANGS=`echo $ALL_LANGS qtz`
13504 AC_SUBST(ALL_LANGS)
13505 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13506 AC_SUBST(WITH_LANG)
13507 AC_SUBST(WITH_LANG_LIST)
13508 AC_SUBST(GIT_NEEDED_SUBMODULES)
13510 WITH_POOR_HELP_LOCALIZATIONS=
13511 if test -d "$SRC_ROOT/translations/source"; then
13512     for l in `ls -1 $SRC_ROOT/translations/source`; do
13513         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13514             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13515         fi
13516     done
13518 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13520 if test -n "$with_locales"; then
13521     WITH_LOCALES="$with_locales"
13523     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13524     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13525     # config_host/config_locales.h.in
13526     for locale in $WITH_LOCALES; do
13527         lang=${locale%_*}
13529         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13531         case $lang in
13532         hi|mr*ne)
13533             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13534             ;;
13535         bg|ru)
13536             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13537             ;;
13538         esac
13539     done
13540 else
13541     AC_DEFINE(WITH_LOCALE_ALL)
13543 AC_SUBST(WITH_LOCALES)
13545 dnl git submodule update --reference
13546 dnl ===================================================================
13547 if test -n "${GIT_REFERENCE_SRC}"; then
13548     for repo in ${GIT_NEEDED_SUBMODULES}; do
13549         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13550             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13551         fi
13552     done
13554 AC_SUBST(GIT_REFERENCE_SRC)
13556 dnl git submodules linked dirs
13557 dnl ===================================================================
13558 if test -n "${GIT_LINK_SRC}"; then
13559     for repo in ${GIT_NEEDED_SUBMODULES}; do
13560         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13561             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13562         fi
13563     done
13565 AC_SUBST(GIT_LINK_SRC)
13567 dnl branding
13568 dnl ===================================================================
13569 AC_MSG_CHECKING([for alternative branding images directory])
13570 # initialize mapped arrays
13571 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13572 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13574 if test -z "$with_branding" -o "$with_branding" = "no"; then
13575     AC_MSG_RESULT([none])
13576     DEFAULT_BRAND_IMAGES="$brand_files"
13577 else
13578     if ! test -d $with_branding ; then
13579         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13580     else
13581         AC_MSG_RESULT([$with_branding])
13582         CUSTOM_BRAND_DIR="$with_branding"
13583         for lfile in $brand_files
13584         do
13585             if ! test -f $with_branding/$lfile ; then
13586                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13587                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13588             else
13589                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13590             fi
13591         done
13592         check_for_progress="yes"
13593     fi
13595 AC_SUBST([BRAND_INTRO_IMAGES])
13596 AC_SUBST([CUSTOM_BRAND_DIR])
13597 AC_SUBST([CUSTOM_BRAND_IMAGES])
13598 AC_SUBST([DEFAULT_BRAND_IMAGES])
13601 AC_MSG_CHECKING([for 'intro' progress settings])
13602 PROGRESSBARCOLOR=
13603 PROGRESSSIZE=
13604 PROGRESSPOSITION=
13605 PROGRESSFRAMECOLOR=
13606 PROGRESSTEXTCOLOR=
13607 PROGRESSTEXTBASELINE=
13609 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13610     source "$with_branding/progress.conf"
13611     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13612 else
13613     AC_MSG_RESULT([none])
13616 AC_SUBST(PROGRESSBARCOLOR)
13617 AC_SUBST(PROGRESSSIZE)
13618 AC_SUBST(PROGRESSPOSITION)
13619 AC_SUBST(PROGRESSFRAMECOLOR)
13620 AC_SUBST(PROGRESSTEXTCOLOR)
13621 AC_SUBST(PROGRESSTEXTBASELINE)
13624 dnl ===================================================================
13625 dnl Custom build version
13626 dnl ===================================================================
13627 AC_MSG_CHECKING([for extra build ID])
13628 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13629     EXTRA_BUILDID="$with_extra_buildid"
13631 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13632 if test -n "$EXTRA_BUILDID" ; then
13633     AC_MSG_RESULT([$EXTRA_BUILDID])
13634 else
13635     AC_MSG_RESULT([not set])
13637 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13639 OOO_VENDOR=
13640 AC_MSG_CHECKING([for vendor])
13641 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13642     OOO_VENDOR="$USERNAME"
13644     if test -z "$OOO_VENDOR"; then
13645         OOO_VENDOR="$USER"
13646     fi
13648     if test -z "$OOO_VENDOR"; then
13649         OOO_VENDOR="`id -u -n`"
13650     fi
13652     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13653 else
13654     OOO_VENDOR="$with_vendor"
13655     AC_MSG_RESULT([$OOO_VENDOR])
13657 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13658 AC_SUBST(OOO_VENDOR)
13660 if test "$_os" = "Android" ; then
13661     ANDROID_PACKAGE_NAME=
13662     AC_MSG_CHECKING([for Android package name])
13663     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13664         if test -n "$ENABLE_DEBUG"; then
13665             # Default to the package name that makes ndk-gdb happy.
13666             ANDROID_PACKAGE_NAME="org.libreoffice"
13667         else
13668             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13669         fi
13671         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13672     else
13673         ANDROID_PACKAGE_NAME="$with_android_package_name"
13674         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13675     fi
13676     AC_SUBST(ANDROID_PACKAGE_NAME)
13679 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13680 if test "$with_compat_oowrappers" = "yes"; then
13681     WITH_COMPAT_OOWRAPPERS=TRUE
13682     AC_MSG_RESULT(yes)
13683 else
13684     WITH_COMPAT_OOWRAPPERS=
13685     AC_MSG_RESULT(no)
13687 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13689 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
13690 AC_MSG_CHECKING([for install dirname])
13691 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13692     INSTALLDIRNAME="$with_install_dirname"
13694 AC_MSG_RESULT([$INSTALLDIRNAME])
13695 AC_SUBST(INSTALLDIRNAME)
13697 AC_MSG_CHECKING([for prefix])
13698 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13699 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13700 PREFIXDIR="$prefix"
13701 AC_MSG_RESULT([$PREFIXDIR])
13702 AC_SUBST(PREFIXDIR)
13704 LIBDIR=[$(eval echo $(eval echo $libdir))]
13705 AC_SUBST(LIBDIR)
13707 DATADIR=[$(eval echo $(eval echo $datadir))]
13708 AC_SUBST(DATADIR)
13710 MANDIR=[$(eval echo $(eval echo $mandir))]
13711 AC_SUBST(MANDIR)
13713 DOCDIR=[$(eval echo $(eval echo $docdir))]
13714 AC_SUBST(DOCDIR)
13716 BINDIR=[$(eval echo $(eval echo $bindir))]
13717 AC_SUBST(BINDIR)
13719 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13720 AC_SUBST(INSTALLDIR)
13722 TESTINSTALLDIR="${BUILDDIR}/test-install"
13723 AC_SUBST(TESTINSTALLDIR)
13726 # ===================================================================
13727 # OAuth2 id and secrets
13728 # ===================================================================
13730 AC_MSG_CHECKING([for Google Drive client id and secret])
13731 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13732     AC_MSG_RESULT([not set])
13733     GDRIVE_CLIENT_ID="\"\""
13734     GDRIVE_CLIENT_SECRET="\"\""
13735 else
13736     AC_MSG_RESULT([set])
13737     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13738     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13740 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13741 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13743 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13744 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13745     AC_MSG_RESULT([not set])
13746     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13747     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13748 else
13749     AC_MSG_RESULT([set])
13750     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13751     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13753 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13754 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13756 AC_MSG_CHECKING([for OneDrive client id and secret])
13757 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13758     AC_MSG_RESULT([not set])
13759     ONEDRIVE_CLIENT_ID="\"\""
13760     ONEDRIVE_CLIENT_SECRET="\"\""
13761 else
13762     AC_MSG_RESULT([set])
13763     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13764     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13766 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13767 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13770 dnl ===================================================================
13771 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13772 dnl --enable-dependency-tracking configure option
13773 dnl ===================================================================
13774 AC_MSG_CHECKING([whether to enable dependency tracking])
13775 if test "$enable_dependency_tracking" = "no"; then
13776     nodep=TRUE
13777     AC_MSG_RESULT([no])
13778 else
13779     AC_MSG_RESULT([yes])
13781 AC_SUBST(nodep)
13783 dnl ===================================================================
13784 dnl Number of CPUs to use during the build
13785 dnl ===================================================================
13786 AC_MSG_CHECKING([for number of processors to use])
13787 # plain --with-parallelism is just the default
13788 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13789     if test "$with_parallelism" = "no"; then
13790         PARALLELISM=0
13791     else
13792         PARALLELISM=$with_parallelism
13793     fi
13794 else
13795     if test "$enable_icecream" = "yes"; then
13796         PARALLELISM="40"
13797     else
13798         case `uname -s` in
13800         Darwin|FreeBSD|NetBSD|OpenBSD)
13801             PARALLELISM=`sysctl -n hw.ncpu`
13802             ;;
13804         Linux)
13805             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13806         ;;
13807         # what else than above does profit here *and* has /proc?
13808         *)
13809             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13810             ;;
13811         esac
13813         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13814         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13815     fi
13818 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13819     if test -z "$with_parallelism"; then
13820             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13821             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13822             PARALLELISM="1"
13823     else
13824         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."
13825     fi
13828 if test $PARALLELISM -eq 0; then
13829     AC_MSG_RESULT([explicit make -j option needed])
13830 else
13831     AC_MSG_RESULT([$PARALLELISM])
13833 AC_SUBST(PARALLELISM)
13835 IWYU_PATH="$with_iwyu"
13836 AC_SUBST(IWYU_PATH)
13837 if test ! -z "$IWYU_PATH"; then
13838     if test ! -f "$IWYU_PATH"; then
13839         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13840     fi
13844 # Set up ILIB for MSVC build
13846 ILIB1=
13847 if test "$build_os" = "cygwin"; then
13848     ILIB="."
13849     if test -n "$JAVA_HOME"; then
13850         ILIB="$ILIB;$JAVA_HOME/lib"
13851     fi
13852     ILIB1=-link
13853     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13854     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13855     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13856     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13857     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13858         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13859         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13860     fi
13861     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13862     ucrtlibpath_formatted=$formatted_path
13863     ILIB="$ILIB;$ucrtlibpath_formatted"
13864     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13865     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13866         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13867     else
13868         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13869     fi
13871     if test "$cross_compiling" != "yes"; then
13872         ILIB_FOR_BUILD="$ILIB"
13873     fi
13875 AC_SUBST(ILIB)
13876 AC_SUBST(ILIB_FOR_BUILD)
13878 # ===================================================================
13879 # Creating bigger shared library to link against
13880 # ===================================================================
13881 AC_MSG_CHECKING([whether to create huge library])
13882 MERGELIBS=
13884 if test $_os = iOS -o $_os = Android; then
13885     # Never any point in mergelibs for these as we build just static
13886     # libraries anyway...
13887     enable_mergelibs=no
13890 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13891     if test $_os != Linux -a $_os != WINNT; then
13892         add_warning "--enable-mergelibs is not tested for this platform"
13893     fi
13894     MERGELIBS="TRUE"
13895     AC_MSG_RESULT([yes])
13896     AC_DEFINE(ENABLE_MERGELIBS)
13897 else
13898     AC_MSG_RESULT([no])
13900 AC_SUBST([MERGELIBS])
13902 dnl ===================================================================
13903 dnl icerun is a wrapper that stops us spawning tens of processes
13904 dnl locally - for tools that can't be executed on the compile cluster
13905 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13906 dnl ===================================================================
13907 AC_MSG_CHECKING([whether to use icerun wrapper])
13908 ICECREAM_RUN=
13909 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13910     ICECREAM_RUN=icerun
13911     AC_MSG_RESULT([yes])
13912 else
13913     AC_MSG_RESULT([no])
13915 AC_SUBST(ICECREAM_RUN)
13917 dnl ===================================================================
13918 dnl Setup the ICECC_VERSION for the build the same way it was set for
13919 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13920 dnl ===================================================================
13921 x_ICECC_VERSION=[\#]
13922 if test -n "$ICECC_VERSION" ; then
13923     x_ICECC_VERSION=
13925 AC_SUBST(x_ICECC_VERSION)
13926 AC_SUBST(ICECC_VERSION)
13928 dnl ===================================================================
13930 AC_MSG_CHECKING([MPL subset])
13931 MPL_SUBSET=
13933 if test "$enable_mpl_subset" = "yes"; then
13934     warn_report=false
13935     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13936         warn_report=true
13937     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13938         warn_report=true
13939     fi
13940     if test "$warn_report" = "true"; then
13941         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13942     fi
13943     if test "x$enable_postgresql_sdbc" != "xno"; then
13944         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13945     fi
13946     if test "$enable_lotuswordpro" = "yes"; then
13947         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13948     fi
13949     if test "$WITH_WEBDAV" = "neon"; then
13950         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13951     fi
13952     if test -n "$ENABLE_POPPLER"; then
13953         if test "x$SYSTEM_POPPLER" = "x"; then
13954             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13955         fi
13956     fi
13957     # cf. m4/libo_check_extension.m4
13958     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13959         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13960     fi
13961     for theme in $WITH_THEMES; do
13962         case $theme in
13963         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
13964             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13965         *) : ;;
13966         esac
13967     done
13969     ENABLE_OPENGL_TRANSITIONS=
13971     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13972         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13973     fi
13975     MPL_SUBSET="TRUE"
13976     AC_DEFINE(MPL_HAVE_SUBSET)
13977     AC_MSG_RESULT([only])
13978 else
13979     AC_MSG_RESULT([no restrictions])
13981 AC_SUBST(MPL_SUBSET)
13983 dnl ===================================================================
13985 AC_MSG_CHECKING([formula logger])
13986 ENABLE_FORMULA_LOGGER=
13988 if test "x$enable_formula_logger" = "xyes"; then
13989     AC_MSG_RESULT([yes])
13990     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13991     ENABLE_FORMULA_LOGGER=TRUE
13992 elif test -n "$ENABLE_DBGUTIL" ; then
13993     AC_MSG_RESULT([yes])
13994     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13995     ENABLE_FORMULA_LOGGER=TRUE
13996 else
13997     AC_MSG_RESULT([no])
14000 AC_SUBST(ENABLE_FORMULA_LOGGER)
14002 dnl ===================================================================
14003 dnl Checking for active Antivirus software.
14004 dnl ===================================================================
14006 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14007     AC_MSG_CHECKING([for active Antivirus software])
14008     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14009     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14010         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14011             AC_MSG_RESULT([found])
14012             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14013             echo $EICAR_STRING > $SRC_ROOT/eicar
14014             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14015             rm $SRC_ROOT/eicar
14016             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14017                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14018             fi
14019             echo $EICAR_STRING > $BUILDDIR/eicar
14020             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14021             rm $BUILDDIR/eicar
14022             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14023                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14024             fi
14025             add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST"
14026         else
14027             AC_MSG_RESULT([not found])
14028         fi
14029     else
14030         AC_MSG_RESULT([n/a])
14031     fi
14034 dnl ===================================================================
14035 dnl Setting up the environment.
14036 dnl ===================================================================
14037 AC_MSG_NOTICE([setting up the build environment variables...])
14039 AC_SUBST(COMPATH)
14041 if test "$build_os" = "cygwin"; then
14042     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14043         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14044         ATL_INCLUDE="$COMPATH/atlmfc/include"
14045     elif test -d "$COMPATH/atlmfc/lib"; then
14046         ATL_LIB="$COMPATH/atlmfc/lib"
14047         ATL_INCLUDE="$COMPATH/atlmfc/include"
14048     else
14049         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14050         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14051     fi
14052     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14053     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14054     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14056     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14057     PathFormat "/usr/bin/find.exe"
14058     FIND="$formatted_path"
14059     PathFormat "/usr/bin/sort.exe"
14060     SORT="$formatted_path"
14061     PathFormat "/usr/bin/grep.exe"
14062     WIN_GREP="$formatted_path"
14063     PathFormat "/usr/bin/ls.exe"
14064     WIN_LS="$formatted_path"
14065     PathFormat "/usr/bin/touch.exe"
14066     WIN_TOUCH="$formatted_path"
14067 else
14068     FIND=find
14069     SORT=sort
14072 AC_SUBST(ATL_INCLUDE)
14073 AC_SUBST(ATL_LIB)
14074 AC_SUBST(FIND)
14075 AC_SUBST(SORT)
14076 AC_SUBST(WIN_GREP)
14077 AC_SUBST(WIN_LS)
14078 AC_SUBST(WIN_TOUCH)
14080 AC_SUBST(BUILD_TYPE)
14082 AC_SUBST(SOLARINC)
14084 PathFormat "$PERL"
14085 PERL="$formatted_path"
14086 AC_SUBST(PERL)
14088 if test -n "$TMPDIR"; then
14089     TEMP_DIRECTORY="$TMPDIR"
14090 else
14091     TEMP_DIRECTORY="/tmp"
14093 if test "$build_os" = "cygwin"; then
14094     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14096 AC_SUBST(TEMP_DIRECTORY)
14098 # setup the PATH for the environment
14099 if test -n "$LO_PATH_FOR_BUILD"; then
14100     LO_PATH="$LO_PATH_FOR_BUILD"
14101     case "$host_os" in
14102     cygwin*|wsl*)
14103         pathmunge "$MSVC_HOST_PATH" "before"
14104         ;;
14105     esac
14106 else
14107     LO_PATH="$PATH"
14109     case "$host_os" in
14111     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14112         if test "$ENABLE_JAVA" != ""; then
14113             pathmunge "$JAVA_HOME/bin" "after"
14114         fi
14115         ;;
14117     cygwin*|wsl*)
14118         # Win32 make needs native paths
14119         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14120             LO_PATH=`cygpath -p -m "$PATH"`
14121         fi
14122         if test "$WIN_BUILD_ARCH" = "x64"; then
14123             # needed for msi packaging
14124             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14125         fi
14126         # .NET 4.6 and higher don't have bin directory
14127         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14128             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14129         fi
14130         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14131         pathmunge "$CSC_PATH" "before"
14132         pathmunge "$MIDL_PATH" "before"
14133         pathmunge "$AL_PATH" "before"
14134         pathmunge "$MSVC_MULTI_PATH" "before"
14135         pathmunge "$MSVC_BUILD_PATH" "before"
14136         if test -n "$MSBUILD_PATH" ; then
14137             pathmunge "$MSBUILD_PATH" "before"
14138         fi
14139         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14140         if test "$ENABLE_JAVA" != ""; then
14141             if test -d "$JAVA_HOME/jre/bin/client"; then
14142                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14143             fi
14144             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14145                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14146             fi
14147             pathmunge "$JAVA_HOME/bin" "before"
14148         fi
14149         pathmunge "$MSVC_HOST_PATH" "before"
14150         ;;
14152     solaris*)
14153         pathmunge "/usr/css/bin" "before"
14154         if test "$ENABLE_JAVA" != ""; then
14155             pathmunge "$JAVA_HOME/bin" "after"
14156         fi
14157         ;;
14158     esac
14161 AC_SUBST(LO_PATH)
14163 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14164 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14165     x_LO_ELFCHECK_ALLOWLIST=
14166 else
14167     x_LO_ELFCHECK_ALLOWLIST=[\#]
14169 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14170 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14172 libo_FUZZ_SUMMARY
14174 # Generate a configuration sha256 we can use for deps
14175 if test -f config_host.mk; then
14176     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14178 if test -f config_host_lang.mk; then
14179     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14182 CFLAGS=$my_original_CFLAGS
14183 CXXFLAGS=$my_original_CXXFLAGS
14184 CPPFLAGS=$my_original_CPPFLAGS
14186 AC_CONFIG_LINKS([include:include])
14188 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14189 # BUILD platform configuration] - otherwise breaks cross building
14190 AC_CONFIG_FILES([config_host.mk
14191                  config_host_lang.mk
14192                  Makefile
14193                  bin/bffvalidator.sh
14194                  bin/odfvalidator.sh
14195                  bin/officeotron.sh
14196                  hardened_runtime.xcent
14197                  instsetoo_native/util/openoffice.lst
14198                  setup_native/source/packinfo/finals_instsetoo.txt
14199                  sysui/desktop/macosx/Info.plist])
14200 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14201 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14202 AC_CONFIG_HEADERS([config_host/config_clang.h])
14203 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14204 AC_CONFIG_HEADERS([config_host/config_eot.h])
14205 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14206 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14207 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14208 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14209 AC_CONFIG_HEADERS([config_host/config_features.h])
14210 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14211 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14212 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14213 AC_CONFIG_HEADERS([config_host/config_folders.h])
14214 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14215 AC_CONFIG_HEADERS([config_host/config_gio.h])
14216 AC_CONFIG_HEADERS([config_host/config_global.h])
14217 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14218 AC_CONFIG_HEADERS([config_host/config_java.h])
14219 AC_CONFIG_HEADERS([config_host/config_langs.h])
14220 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14221 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14222 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14223 AC_CONFIG_HEADERS([config_host/config_locales.h])
14224 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14225 AC_CONFIG_HEADERS([config_host/config_oox.h])
14226 AC_CONFIG_HEADERS([config_host/config_options.h])
14227 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14228 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
14229 AC_CONFIG_HEADERS([config_host/config_skia.h])
14230 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14231 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14232 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14233 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14234 AC_CONFIG_HEADERS([config_host/config_version.h])
14235 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14236 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14237 AC_CONFIG_HEADERS([config_host/config_python.h])
14238 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14239 AC_OUTPUT
14241 if test "$CROSS_COMPILING" = TRUE; then
14242     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14245 # touch the config timestamp file
14246 if test ! -f config_host.mk.stamp; then
14247     echo > config_host.mk.stamp
14248 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14249     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14250 else
14251     echo > config_host.mk.stamp
14254 # touch the config lang timestamp file
14255 if test ! -f config_host_lang.mk.stamp; then
14256     echo > config_host_lang.mk.stamp
14257 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14258     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14259 else
14260     echo > config_host_lang.mk.stamp
14264 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14265         -a "$build_os" = "cygwin"; then
14267 cat << _EOS
14268 ****************************************************************************
14269 WARNING:
14270 Your make version is known to be horribly slow, and hard to debug
14271 problems with. To get a reasonably functional make please do:
14273 to install a pre-compiled binary make for Win32
14275  mkdir -p /opt/lo/bin
14276  cd /opt/lo/bin
14277  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14278  cp make-4.2.1-msvc.exe make
14279  chmod +x make
14281 to install from source:
14282 place yourself in a working directory of you choice.
14284  git clone git://git.savannah.gnu.org/make.git
14286  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14287  set PATH=%PATH%;C:\Cygwin\bin
14288  [or Cygwin64, if that is what you have]
14289  cd path-to-make-repo-you-cloned-above
14290  build_w32.bat --without-guile
14292 should result in a WinRel/gnumake.exe.
14293 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14295 Then re-run autogen.sh
14297 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14298 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14300 _EOS
14301 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14302     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14307 cat << _EOF
14308 ****************************************************************************
14310 To build, run:
14311 $GNUMAKE
14313 To view some help, run:
14314 $GNUMAKE help
14316 _EOF
14318 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14319     cat << _EOF
14320 After the build has finished successfully, you can immediately run what you built using the command:
14321 _EOF
14323     if test $_os = Darwin; then
14324         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14325     else
14326         echo instdir/program/soffice
14327     fi
14328     cat << _EOF
14330 If you want to run the smoketest, run:
14331 $GNUMAKE check
14333 _EOF
14336 if test -f warn; then
14337     cat warn
14338     rm warn
14341 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: