tdf#145614 Convert #define to enum class
[LibreOffice.git] / configure.ac
blob01cb56658cffcec1347dd0655b4a53379892329e
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([LibreOffice],[25.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
45 FilterLibs()
47     # Return value: $filteredlibs
49     filteredlibs=
50     if test "$COM" = "MSC"; then
51         for f in $1; do
52             if test "x$f" != "x${f#-L}"; then
53                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
54             elif test "x$f" != "x${f#-l}"; then
55                 filteredlibs="$filteredlibs ${f:2}.lib"
56             else
57                 filteredlibs="$filteredlibs $f"
58             fi
59         done
60     else
61         for f in $1; do
62             case "$f" in
63                 # let's start with Fedora's paths for now
64                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
65                     # ignore it: on UNIXoids it is searched by default anyway
66                     # but if it's given explicitly then it may override other paths
67                     # (on macOS it would be an error to use it instead of SDK)
68                     ;;
69                 *)
70                     filteredlibs="$filteredlibs $f"
71                     ;;
72             esac
73         done
74     fi
77 PathFormat()
79     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
80     # function is called also on Unix.
81     #
82     # Return value: $formatted_path and $formatted_path_unix.
83     #
84     # $formatted_path is the argument in Windows format, but using forward slashes instead of
85     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
86     # or shell metacharacters).
87     #
88     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
89     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
90     # Unix pathname.
91     #
92     # Errors out if 8.3 names are needed but aren't present for some of the path components.
94     # Examples:
95     #
96     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
97     #
98     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
99     #
100     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
101     #
102     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
103     #
104     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
105     #
106     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
107     #
108     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
110     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
111         printf "PathFormat $1 ==> "
112     fi
114     formatted_path="$1"
115     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
116         if test "$build_os" = "wsl"; then
117             formatted_path=$(echo "$formatted_path" | tr -d '\r')
118         fi
120         pf_conv_to_dos=
121         # spaces,parentheses,brackets,braces are problematic in pathname
122         # so are backslashes
123         case "$formatted_path" in
124             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
125                 pf_conv_to_dos="yes"
126             ;;
127         esac
128         if test "$pf_conv_to_dos" = "yes"; then
129             if test "$build_os" = "wsl"; then
130                 case "$formatted_path" in
131                     /*)
132                         formatted_path=$(wslpath -w "$formatted_path")
133                         ;;
134                 esac
135                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
136             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
137                 formatted_path=`cygpath -sm "$formatted_path"`
138             else
139                 formatted_path=`cygpath -d "$formatted_path"`
140             fi
141             if test $? -ne 0;  then
142                 AC_MSG_ERROR([path conversion failed for "$1".])
143             fi
144         fi
145         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
146         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
147         if test "$fp_count_slash$fp_count_colon" != "00"; then
148             if test "$fp_count_colon" = "0"; then
149                 new_formatted_path=`realpath "$formatted_path"`
150                 if test $? -ne 0;  then
151                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
152                 else
153                     formatted_path="$new_formatted_path"
154                 fi
155             fi
156             if test "$build_os" = "wsl"; then
157                 if test "$fp_count_colon" != "0"; then
158                     formatted_path=$(wslpath "$formatted_path")
159                     local final_slash=
160                     case "$formatted_path" in
161                         */)
162                             final_slash=/
163                             ;;
164                     esac
165                     formatted_path=$(wslpath -m $formatted_path)
166                     case "$formatted_path" in
167                         */)
168                             ;;
169                         *)
170                             formatted_path="$formatted_path"$final_slash
171                             ;;
172                     esac
173                 else
174                     formatted_path=$(wslpath -m "$formatted_path")
175                 fi
176             else
177                 formatted_path=`cygpath -m "$formatted_path"`
178             fi
179             if test $? -ne 0;  then
180                 AC_MSG_ERROR([path conversion failed for "$1".])
181             fi
182         fi
183         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
184         if test "$fp_count_space" != "0"; then
185             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
186         fi
187     fi
188     if test "$build_os" = "wsl"; then
189         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
190         formatted_path_unix=$(wslpath "$formatted_path")
191     else
192         # But Cygwin can
193         formatted_path_unix="$formatted_path"
194     fi
195     if test -n "$WSL_ONLY_AS_HELPER"; then
196         # if already in unix format, switch to windows format to create shortened path
197         case "$formatted_path" in
198             /*)
199                 formatted_path=$(wslpath -m "$formatted_path")
200                 ;;
201         esac
203         # cd to /mnt/c to avoid wsl/cmd complaining about not supporting UNC paths/the current working directory
204         formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
205         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
206         formatted_path=$(wslpath -m "$formatted_path_unix")
207     fi
210 AbsolutePath()
212     # There appears to be no simple and portable method to get an absolute and
213     # canonical path, so we try creating the directory if does not exist and
214     # utilizing the shell and pwd.
216     # Args: $1: A possibly relative pathname
217     # Return value: $absolute_path
219     # Convert to unix path, mkdir would treat c:/path as a relative path.
220     PathFormat "$1"
221     local rel="$formatted_path_unix"
222     absolute_path=""
223     test ! -e "$rel" && mkdir -p "$rel"
224     if test -d "$rel" ; then
225         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
226         absolute_path="$(pwd)"
227         cd - > /dev/null
228     else
229         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
230     fi
233 WARNINGS_FILE=config.warn
234 WARNINGS_FILE_FOR_BUILD=config.Build.warn
235 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
236 have_WARNINGS="no"
237 add_warning()
239     if test "$have_WARNINGS" = "no"; then
240         echo "*************************************" > "$WARNINGS_FILE"
241         have_WARNINGS="yes"
242         if command -v tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
243             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
244             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
245         else
246             COLORWARN="* WARNING :"
247         fi
248     fi
249     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
252 dnl Some Mac User have the bad habit of letting a lot of crap
253 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
254 dnl that confuse the build.
255 dnl For the ones that use LODE, let's be nice and protect them
256 dnl from themselves
258 mac_sanitize_path()
260     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
261 dnl a common but nevertheless necessary thing that may be in a fancy
262 dnl path location is git, so make sure we have it
263     mac_git_path=`command -v git`
264     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
265         mac_path="$mac_path:`dirname $mac_git_path`"
266     fi
267 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
268 dnl path location is gpg, so make sure we find it
269     mac_gpg_path=`command -v gpg`
270     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
271         mac_path="$mac_path:`dirname $mac_gpg_path`"
272     fi
273     PATH="$mac_path"
274     unset mac_path
275     unset mac_git_path
276     unset mac_gpg_path
279 dnl semantically test a three digits version
280 dnl $1 - $3 = minimal version
281 dnl $4 - $6 = current version
283 check_semantic_version_three()
285     test "$4" -gt "$1" \
286         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
287         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
288     return $?
291 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
292 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
293 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
295 check_semantic_version_three_prefixed()
297     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
298     eval local MIN_MINOR="\$${1}_${2}_MINOR"
299     eval local MIN_TINY="\$${1}_${2}_TINY"
300     eval local CUR_MAJOR="\$${1}_MAJOR"
301     eval local CUR_MINOR="\$${1}_MINOR"
302     eval local CUR_TINY="\$${1}_TINY"
303     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
304     return $?
307 echo "********************************************************************"
308 echo "*"
309 echo "*   Running ${PACKAGE_NAME} build configuration."
310 echo "*"
311 echo "********************************************************************"
312 echo ""
314 dnl ===================================================================
315 dnl checks build and host OSes
316 dnl do this before argument processing to allow for platform dependent defaults
317 dnl ===================================================================
319 # are we running in wsl but are called from git-bash/env with mingw64 in path?
320 # if so, we aim to run nearly everything in the Windows realm, and only run autogen/configure
321 # in wsl and run a few tools via wsl
322 WSL_ONLY_AS_HELPER=
323 if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then
324     WSL_ONLY_AS_HELPER=TRUE
325     AC_ARG_WITH([strawberry-perl-portable],
326         [AS_HELP_STRING([--with-strawberry-perl-portable],
327             [Specify the base path to strawberry perl portable])],
328         [],
329         [AC_MSG_ERROR(
330             [for the moment strawberry-perl-portable is a requirement, feel free to replace it])])
331     shortpath_cmd=$(wslpath -m $srcdir/solenv/bin/shortpath.cmd)
332     PathFormat "$with_strawberry_perl_portable"
333     if test ! -f "$formatted_path_unix/perl/bin/perl.exe" -o ! -d "$formatted_path_unix/c/bin"; then
334         AC_MSG_ERROR([$formatted_path doesn't contain perl or the utilities - sure you provided the base path?])
335     fi
336     STRAWBERRY_TOOLS="$formatted_path/c/bin"
337     STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
338     AC_ARG_WITH([wsl-command],
339         [AS_HELP_STRING([--with-wsl-command],
340             [Specify your wsl distro command if it isn't the default/the one used with just wsl.exe â€“
341              for example: wsl.exe -d MyDistro -u NonDefaultUser])],
342         [],
343         [with_wsl_command="wsl.exe"])
344     WSL="$with_wsl_command"
346 AC_SUBST([STRAWBERRY_PERL])
347 AC_SUBST([WSL])
349 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
350 # Linux on WSL) trust that.
351 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
352     ac_cv_host="x86_64-pc-wsl"
353     ac_cv_host_cpu="x86_64"
354     ac_cv_host_os="wsl"
355     ac_cv_build="$ac_cv_host"
356     ac_cv_build_cpu="$ac_cv_host_cpu"
357     ac_cv_build_os="$ac_cv_host_os"
359     # Emulation of Cygwin's cygpath command for WSL.
360     cygpath()
361     {
362         if test -n "$UNITTEST_WSL_CYGPATH"; then
363             echo -n cygpath "$@" "==> "
364         fi
366         # Cygwin's real cygpath has a plethora of options but we use only a few here.
367         local args="$@"
368         local opt
369         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
370         OPTIND=1
372         while getopts dmuwlsp opt; do
373             case "$opt" in
374                 \?)
375                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
376                     ;;
377                 ?)
378                     eval opt_$opt=yes
379                     ;;
380             esac
381         done
383         shift $((OPTIND-1))
385         if test $# -ne 1; then
386             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
387         fi
389         local input="$1"
391         local result
393         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
394             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
396             if test -n "$opt_u"; then
397                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
398             fi
400             case "$input" in
401                 /mnt/*)
402                     # A Windows file in WSL format
403                     input=$(wslpath -w "$input")
404                     ;;
405                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
406                     # Already in Windows format
407                     ;;
408                 /*)
409                     input=$(wslpath -w "$input")
410                     ;;
411                 *)
412                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
413                     ;;
414             esac
415             if test -n "$opt_d" -o -n "$opt_s"; then
416                 input=$($WSL_LO_HELPER --8.3 "$input")
417             fi
418             if test -n "$opt_m"; then
419                 input="${input//\\//}"
420             fi
421             echo "$input"
422         else
423             # Print Unix path
425             case "$input" in
426                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
427                     wslpath -u "$input"
428                     ;;
429                 /)
430                     echo "$input"
431                     ;;
432                 *)
433                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
434                     ;;
435             esac
436         fi
437     }
439     if test -n "$UNITTEST_WSL_CYGPATH"; then
440         BUILDDIR=.
442         # Nothing special with these file names, just arbitrary ones picked to test with
443         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
444         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
445         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
446         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
447         # At least on my machine for instance this file does have an 8.3 name
448         cygpath -d /mnt/c/windows/WindowsUpdate.log
449         # But for instance this one doesn't
450         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
451         cygpath -ws /mnt/c/windows/WindowsUpdate.log
452         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
453         cygpath -ms /mnt/c/windows/WindowsUpdate.log
455         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
456         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
458         exit 0
459     fi
461     if test -z "$WSL_LO_HELPER"; then
462         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
463             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
464         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
465             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
466         fi
467     fi
468     if test -z "$WSL_LO_HELPER"; then
469         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
470     fi
473 AC_CANONICAL_HOST
474 AC_CANONICAL_BUILD
476 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
477     BUILDDIR=.
478     GREP=grep
480     # Use of PathFormat must be after AC_CANONICAL_BUILD above
481     PathFormat /
482     printf "$formatted_path , $formatted_path_unix\n"
484     PathFormat $PWD
485     printf "$formatted_path , $formatted_path_unix\n"
487     PathFormat "$PROGRAMFILESX86"
488     printf "$formatted_path , $formatted_path_unix\n"
490     exit 0
493 AC_MSG_CHECKING([for product name])
494 PRODUCTNAME="AC_PACKAGE_NAME"
495 if test -n "$with_product_name" -a "$with_product_name" != no; then
496     PRODUCTNAME="$with_product_name"
498 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
499     PRODUCTNAME="${PRODUCTNAME}Dev"
501 AC_MSG_RESULT([$PRODUCTNAME])
502 AC_SUBST(PRODUCTNAME)
503 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
504 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
506 dnl ===================================================================
507 dnl Our version is defined by the AC_INIT() at the top of this script.
508 dnl ===================================================================
510 AC_MSG_CHECKING([for package version])
511 if test -n "$with_package_version" -a "$with_package_version" != no; then
512     PACKAGE_VERSION="$with_package_version"
514 AC_MSG_RESULT([$PACKAGE_VERSION])
516 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
518 LIBO_VERSION_MAJOR=$1
519 LIBO_VERSION_MINOR=$2
520 LIBO_VERSION_MICRO=$3
521 LIBO_VERSION_PATCH=$4
523 LIBO_VERSION_SUFFIX=$5
525 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
526 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
527 # they get undoubled before actually passed to sed.
528 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
529 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
530 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
531 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
533 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
534 # three non-negative integers. Please find more information about CFBundleVersion at
535 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
537 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
538 # of at most three non-negative integers. Please find more information about
539 # CFBundleShortVersionString at
540 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
542 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
544 if test "$enable_macosx_sandbox" = yes; then
545     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
546     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
547 else
548     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
549     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
552 AC_SUBST(LIBO_VERSION_MAJOR)
553 AC_SUBST(LIBO_VERSION_MINOR)
554 AC_SUBST(LIBO_VERSION_MICRO)
555 AC_SUBST(LIBO_VERSION_PATCH)
556 AC_SUBST(LIBO_VERSION_SUFFIX)
557 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
558 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
559 AC_SUBST(MACOSX_BUNDLE_VERSION)
561 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
562 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
563 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
564 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
566 git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>/dev/null`
567 LIBO_THIS_YEAR=${git_date:-2024}
568 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
570 dnl ===================================================================
571 dnl Product version
572 dnl ===================================================================
573 AC_MSG_CHECKING([for product version])
574 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
575 AC_MSG_RESULT([$PRODUCTVERSION])
576 AC_SUBST(PRODUCTVERSION)
578 AC_PROG_EGREP
579 # AC_PROG_EGREP doesn't set GREP on all systems as well
580 AC_PATH_PROG(GREP, grep)
582 BUILDDIR=`pwd`
583 cd $srcdir
584 SRC_ROOT=`pwd`
585 cd $BUILDDIR
586 x_Cygwin=[\#]
588 dnl ======================================
589 dnl Required GObject introspection version
590 dnl ======================================
591 INTROSPECTION_REQUIRED_VERSION=1.32.0
593 dnl ===================================================================
594 dnl Search all the common names for GNU Make
595 dnl ===================================================================
596 AC_MSG_CHECKING([for GNU Make])
598 # try to use our own make if it is available and GNUMAKE was not already defined
599 if test -z "$GNUMAKE"; then
600     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
601         GNUMAKE="$LODE_HOME/opt/bin/make"
602     elif test -x "/opt/lo/bin/make"; then
603         GNUMAKE="/opt/lo/bin/make"
604     fi
607 GNUMAKE_WIN_NATIVE=
608 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
609     if test -n "$a"; then
610         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
611         if test $? -eq 0;  then
612             if test "$build_os" = "cygwin"; then
613                 if test -n "$($a -v | grep 'Built for Windows')" ; then
614                     GNUMAKE="$(cygpath -m "$(command -v "$(cygpath -u $a)")")"
615                     GNUMAKE_WIN_NATIVE="TRUE"
616                 else
617                     GNUMAKE=`command -v $a`
618                 fi
619             else
620                 GNUMAKE=`command -v $a`
621             fi
622             break
623         fi
624     fi
625 done
626 AC_MSG_RESULT($GNUMAKE)
627 if test -z "$GNUMAKE"; then
628     AC_MSG_ERROR([not found. install GNU Make.])
629 else
630     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
631         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
632     fi
635 win_short_path_for_make()
637     local short_path="$1"
638     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
639         cygpath -sm "$short_path"
640     elif test -n "$WSL_ONLY_AS_HELPER"; then
641         # when already unix-style path, wslpath doesn't return anything
642         case "$short_path" in
643         /*)
644             echo $short_path
645             exit
646             ;;
647         esac
648         wslpath -m "$(wslpath -u "$short_path")"
649     else
650         cygpath -u "$(cygpath -d "$short_path")"
651     fi
655 if test "$build_os" = "cygwin"; then
656     PathFormat "$SRC_ROOT"
657     SRC_ROOT="$formatted_path"
658     PathFormat "$BUILDDIR"
659     BUILDDIR="$formatted_path"
660     x_Cygwin=
661     AC_MSG_CHECKING(for explicit COMSPEC)
662     if test -z "$COMSPEC"; then
663         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
664     else
665         AC_MSG_RESULT([found: $COMSPEC])
666     fi
669 AC_SUBST(SRC_ROOT)
670 AC_SUBST(BUILDDIR)
671 AC_SUBST(x_Cygwin)
672 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
673 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
674 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
676 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
677     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
680 # need sed in os checks...
681 AC_PATH_PROGS(SED, sed)
682 if test -z "$SED"; then
683     AC_MSG_ERROR([install sed to run this script])
686 # Set the ENABLE_LTO variable
687 # ===================================================================
688 AC_MSG_CHECKING([whether to use link-time optimization])
689 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
690     ENABLE_LTO="TRUE"
691     AC_MSG_RESULT([yes])
692 else
693     ENABLE_LTO=""
694     AC_MSG_RESULT([no])
696 AC_SUBST(ENABLE_LTO)
698 AC_ARG_ENABLE(fuzz-options,
699     AS_HELP_STRING([--enable-fuzz-options],
700         [Randomly enable or disable each of those configurable options
701          that are supposed to be freely selectable without interdependencies,
702          or where bad interaction from interdependencies is automatically avoided.])
705 dnl ===================================================================
706 dnl When building for Android, --with-android-ndk,
707 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
708 dnl mandatory
709 dnl ===================================================================
711 AC_ARG_WITH(android-ndk,
712     AS_HELP_STRING([--with-android-ndk],
713         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
716 AC_ARG_WITH(android-ndk-toolchain-version,
717     AS_HELP_STRING([--with-android-ndk-toolchain-version],
718         [Specify which toolchain version to use, of those present in the
719         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
720         with_android_ndk_toolchain_version=clang5.0)
722 AC_ARG_WITH(android-sdk,
723     AS_HELP_STRING([--with-android-sdk],
724         [Specify location of the Android SDK. Mandatory when building for Android.]),
727 AC_ARG_WITH(android-api-level,
728     AS_HELP_STRING([--with-android-api-level],
729         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
732 ANDROID_NDK_DIR=
733 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
734     with_android_ndk="$SRC_ROOT/external/android-ndk"
736 if test -n "$with_android_ndk"; then
737     eval ANDROID_NDK_DIR=$with_android_ndk
739     ANDROID_API_LEVEL=21
740     if test -n "$with_android_api_level" ; then
741         ANDROID_API_LEVEL="$with_android_api_level"
742     fi
744     if test $host_cpu = arm; then
745         LLVM_TRIPLE=armv7a-linux-androideabi
746         ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
747         ANDROID_APP_ABI=armeabi-v7a
748         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
749     elif test $host_cpu = aarch64; then
750         LLVM_TRIPLE=aarch64-linux-android
751         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
752         ANDROID_APP_ABI=arm64-v8a
753     elif test $host_cpu = x86_64; then
754         LLVM_TRIPLE=x86_64-linux-android
755         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
756         ANDROID_APP_ABI=x86_64
757     else
758         # host_cpu is something like "i386" or "i686" I guess, NDK uses
759         # "x86" in some contexts
760         LLVM_TRIPLE=i686-linux-android
761         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
762         ANDROID_APP_ABI=x86
763     fi
765     # Set up a lot of pre-canned defaults
767     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
768         if test ! -f $ANDROID_NDK_DIR/source.properties; then
769             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
770         fi
771         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
772     else
773         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
774     fi
775     if test -z "$ANDROID_NDK_VERSION";  then
776         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
777     fi
778     case $ANDROID_NDK_VERSION in
779     r9*|r10*)
780         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
781         ;;
782     11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
783         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
784         ;;
785     23.*|24.*|25.*)
786         ;;
787     *)
788         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
789         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
790         ;;
791     esac
793     case "$with_android_ndk_toolchain_version" in
794     clang5.0)
795         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
796         ;;
797     *)
798         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
799     esac
801     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
803     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
804     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
805     # manage to link the (app-specific) single huge .so that is built for the app in
806     # android/source/ if there is debug information in a significant part of the object files.
807     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
808     # all objects have been built with debug information.)
809     case $build_os in
810     linux-gnu*)
811         android_HOST_TAG=linux-x86_64
812         ;;
813     darwin*)
814         android_HOST_TAG=darwin-x86_64
815         ;;
816     *)
817         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
818         # ndk would also support windows and windows-x86_64
819         ;;
820     esac
821     ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
822     ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
824     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
825     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
826     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
827     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
828     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
830     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
831     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
832     if test "$ENABLE_LTO" = TRUE; then
833         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
834         # $CC and $CXX when building external libraries
835         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
836     fi
838     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
840     if test -z "$CC"; then
841         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
842         CC_BASE="clang"
843     fi
844     if test -z "$CXX"; then
845         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
846         CXX_BASE="clang++"
847     fi
849 AC_SUBST(ANDROID_NDK_DIR)
850 AC_SUBST(ANDROID_NDK_VERSION)
851 AC_SUBST(ANDROID_API_LEVEL)
852 AC_SUBST(ANDROID_APP_ABI)
853 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
854 AC_SUBST(ANDROID_SYSROOT_PLATFORM)
855 AC_SUBST(ANDROID_TOOLCHAIN)
857 dnl ===================================================================
858 dnl --with-android-sdk
859 dnl ===================================================================
860 ANDROID_SDK_DIR=
861 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
862     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
864 if test -n "$with_android_sdk"; then
865     eval ANDROID_SDK_DIR=$with_android_sdk
866     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
868 AC_SUBST(ANDROID_SDK_DIR)
870 AC_ARG_ENABLE([android-lok],
871     AS_HELP_STRING([--enable-android-lok],
872         [The Android app from the android/ subdir needs several tweaks all
873          over the place that break the LOK when used in the Online-based
874          Android app.  This switch indicates that the intent of this build is
875          actually the Online-based, non-modified LOK.])
877 ENABLE_ANDROID_LOK=
878 if test -n "$ANDROID_NDK_DIR" ; then
879     if test "$enable_android_lok" = yes; then
880         ENABLE_ANDROID_LOK=TRUE
881         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
882         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
883     else
884         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
885     fi
887 AC_SUBST([ENABLE_ANDROID_LOK])
889 libo_FUZZ_ARG_ENABLE([android-editing],
890     AS_HELP_STRING([--enable-android-editing],
891         [Enable the experimental editing feature on Android.])
893 ENABLE_ANDROID_EDITING=
894 if test "$enable_android_editing" = yes; then
895     ENABLE_ANDROID_EDITING=TRUE
897 AC_SUBST([ENABLE_ANDROID_EDITING])
899 disable_database_connectivity_dependencies()
901     enable_evolution2=no
902     enable_firebird_sdbc=no
903     enable_mariadb_sdbc=no
904     enable_postgresql_sdbc=no
905     enable_report_builder=no
908 # ===================================================================
910 # Start initial platform setup
912 # The using_* variables reflect platform support and should not be
913 # changed after the "End initial platform setup" block.
914 # This is also true for most test_* variables.
915 # ===================================================================
916 build_crypto=yes
917 test_clucene=no
918 test_gdb_index=no
919 test_openldap=yes
920 test_split_debug=no
921 test_webdav=yes
922 usable_dlapi=yes
924 # There is currently just iOS not using salplug, so this explicitly enables it.
925 # must: using_freetype_fontconfig
926 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
927 # must: using_x11
929 # Default values, as such probably valid just for Linux, set
930 # differently below just for Mac OSX, but at least better than
931 # hardcoding these as we used to do. Much of this is duplicated also
932 # in solenv for old build system and for gbuild, ideally we should
933 # perhaps define stuff like this only here in configure.ac?
935 LINKFLAGSSHL="-shared"
936 PICSWITCH="-fpic"
937 DLLPOST=".so"
939 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
941 INSTROOTBASESUFFIX=
942 INSTROOTCONTENTSUFFIX=
943 SDKDIRNAME=sdk
945 HOST_PLATFORM="$host"
947 host_cpu_for_clang="$host_cpu"
949 case "$host_os" in
951 solaris*)
952     using_freetype_fontconfig=yes
953     using_x11=yes
954     build_skia=yes
955     _os=SunOS
957     dnl ===========================================================
958     dnl Check whether we're using Solaris 10 - SPARC or Intel.
959     dnl ===========================================================
960     AC_MSG_CHECKING([the Solaris operating system release])
961     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
962     if test "$_os_release" -lt "10"; then
963         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
964     else
965         AC_MSG_RESULT([ok ($_os_release)])
966     fi
968     dnl Check whether we're using a SPARC or i386 processor
969     AC_MSG_CHECKING([the processor type])
970     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
971         AC_MSG_RESULT([ok ($host_cpu)])
972     else
973         AC_MSG_ERROR([only SPARC and i386 processors are supported])
974     fi
975     ;;
977 linux-gnu*|k*bsd*-gnu*|linux-musl*)
978     using_freetype_fontconfig=yes
979     using_x11=yes
980     build_skia=yes
981     test_gdb_index=yes
982     test_split_debug=yes
983     if test "$enable_fuzzers" = yes; then
984         test_system_freetype=no
985     fi
986     _os=Linux
987     ;;
989 gnu)
990     using_freetype_fontconfig=yes
991     using_x11=no
992     _os=GNU
993      ;;
995 cygwin*|wsl*)
996     # When building on Windows normally with MSVC under Cygwin,
997     # configure thinks that the host platform (the platform the
998     # built code will run on) is Cygwin, even if it obviously is
999     # Windows, which in Autoconf terminology is called
1000     # "mingw32". (Which is misleading as MinGW is the name of the
1001     # tool-chain, not an operating system.)
1003     # Somewhat confusing, yes. But this configure script doesn't
1004     # look at $host etc that much, it mostly uses its own $_os
1005     # variable, set here in this case statement.
1007     using_freetype_fontconfig=no
1008     using_x11=no
1009     test_unix_dlapi=no
1010     test_openldap=no
1011     enable_pagein=no
1012     build_skia=yes
1013     _os=WINNT
1015     DLLPOST=".dll"
1016     LINKFLAGSNOUNDEFS=
1018     if test "$host_cpu" = "aarch64"; then
1019         build_skia=no
1020         enable_gpgmepp=no
1021         enable_coinmp=no
1022         enable_firebird_sdbc=no
1023     fi
1024     ;;
1026 darwin*) # macOS
1027     using_freetype_fontconfig=no
1028     using_x11=no
1029     build_skia=yes
1030     enable_pagein=no
1031     if test -n "$LODE_HOME" ; then
1032         mac_sanitize_path
1033         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1034     fi
1035     _os=Darwin
1036     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
1037     INSTROOTCONTENTSUFFIX=/Contents
1038     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1039     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1040     LINKFLAGSSHL="-dynamiclib"
1042     # -fPIC is default
1043     PICSWITCH=""
1045     DLLPOST=".dylib"
1047     # -undefined error is the default
1048     LINKFLAGSNOUNDEFS=""
1049     case "$host_cpu" in
1050     aarch64|arm64)
1051         # Apple's Clang uses "arm64"
1052         host_cpu_for_clang=arm64
1053     esac
1056 ios*) # iOS
1057     using_freetype_fontconfig=no
1058     using_x11=no
1059     build_crypto=no
1060     test_libcmis=no
1061     test_openldap=no
1062     test_webdav=no
1063     with_gssapi=no
1064     if test -n "$LODE_HOME" ; then
1065         mac_sanitize_path
1066         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1067     fi
1068     enable_gpgmepp=no
1069     _os=iOS
1070     enable_mpl_subset=yes
1071     enable_lotuswordpro=no
1072     disable_database_connectivity_dependencies
1073     enable_coinmp=no
1074     enable_lpsolve=no
1075     enable_extension_integration=no
1076     enable_xmlhelp=no
1077     with_ppds=no
1078     if test "$enable_ios_simulator" = "yes"; then
1079         host=x86_64-apple-darwin
1080     fi
1081     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1082     LINKFLAGSSHL="-dynamiclib"
1084     # -fPIC is default
1085     PICSWITCH=""
1087     DLLPOST=".dylib"
1089     # -undefined error is the default
1090     LINKFLAGSNOUNDEFS=""
1092     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1093     # part, so use aarch64-apple-darwin for now.
1094     HOST_PLATFORM=aarch64-apple-darwin
1096     # Apple's Clang uses "arm64"
1097     host_cpu_for_clang=arm64
1100 freebsd*)
1101     using_freetype_fontconfig=yes
1102     using_x11=yes
1103     build_skia=yes
1104     AC_MSG_CHECKING([the FreeBSD operating system release])
1105     if test -n "$with_os_version"; then
1106         OSVERSION="$with_os_version"
1107     else
1108         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1109     fi
1110     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1111     AC_MSG_CHECKING([which thread library to use])
1112     if test "$OSVERSION" -lt "500016"; then
1113         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1114         PTHREAD_LIBS="-pthread"
1115     elif test "$OSVERSION" -lt "502102"; then
1116         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1117         PTHREAD_LIBS="-lc_r"
1118     else
1119         PTHREAD_CFLAGS=""
1120         PTHREAD_LIBS="-pthread"
1121     fi
1122     AC_MSG_RESULT([$PTHREAD_LIBS])
1123     _os=FreeBSD
1124     ;;
1126 *netbsd*)
1127     using_freetype_fontconfig=yes
1128     using_x11=yes
1129     test_gtk3_kde5=no
1130     build_skia=yes
1131     PTHREAD_LIBS="-pthread -lpthread"
1132     _os=NetBSD
1133     ;;
1135 openbsd*)
1136     using_freetype_fontconfig=yes
1137     using_x11=yes
1138     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1139     PTHREAD_LIBS="-pthread"
1140     _os=OpenBSD
1141     ;;
1143 dragonfly*)
1144     using_freetype_fontconfig=yes
1145     using_x11=yes
1146     build_skia=yes
1147     PTHREAD_LIBS="-pthread"
1148     _os=DragonFly
1149     ;;
1151 linux-android*)
1152     # API exists, but seems not really usable since Android 7 AFAIK
1153     usable_dlapi=no
1154     using_freetype_fontconfig=yes
1155     using_headless_plugin=no
1156     using_x11=no
1157     build_crypto=no
1158     test_openldap=no
1159     test_system_freetype=no
1160     test_webdav=no
1161     with_gssapi=no
1162     disable_database_connectivity_dependencies
1163     enable_lotuswordpro=no
1164     enable_mpl_subset=yes
1165     enable_cairo_canvas=no
1166     enable_coinmp=yes
1167     enable_lpsolve=no
1168     enable_odk=no
1169     enable_python=no
1170     enable_xmlhelp=no
1171     _os=Android
1172     ;;
1174 haiku*)
1175     using_freetype_fontconfig=yes
1176     using_x11=no
1177     test_gtk3=no
1178     test_gtk3_kde5=no
1179     test_kf5=yes
1180     test_kf6=yes
1181     enable_odk=no
1182     enable_coinmp=no
1183     enable_pdfium=no
1184     enable_sdremote=no
1185     enable_postgresql_sdbc=no
1186     enable_firebird_sdbc=no
1187     _os=Haiku
1188     ;;
1190 emscripten)
1191     # API currently just exists in headers, not code
1192     usable_dlapi=no
1193     using_freetype_fontconfig=yes
1194     using_x11=yes
1195     test_openldap=no
1196     test_qt5=yes
1197     test_split_debug=yes
1198     test_system_freetype=no
1199     enable_compiler_plugins=no
1200     enable_customtarget_components=yes
1201     enable_split_debug=yes
1202     enable_wasm_strip=yes
1203     with_system_zlib=no
1204     with_theme="colibre"
1205     _os=Emscripten
1206     ;;
1209     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1210     ;;
1211 esac
1213 AC_SUBST(HOST_PLATFORM)
1215 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1216     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1219 # Set defaults, if not set by platform
1220 test "${test_cpdb+set}" = set || test_cpdb="$using_x11"
1221 test "${test_cups+set}" = set || test_cups="$using_x11"
1222 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1223 test "${test_gen+set}" = set || test_gen="$using_x11"
1224 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1225 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1226 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1227 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1228 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1229 # don't handle test_qt5, so it can disable test_kf5 later
1230 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1231 test "${test_randr+set}" = set || test_randr="$using_x11"
1232 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1233 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1235 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1236 # Make sure fontconfig and freetype test both either system or not
1237 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1238 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1240 # convenience / platform overriding "fixes"
1241 # Don't sort!
1242 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1243 test "$test_kf5" = yes && test_qt5=yes
1244 test "$test_gtk3" != yes && enable_gtk3=no
1245 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1246 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1247 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1249 # Keep in sync with the above $using_x11 depending test default list
1250 disable_x11_tests()
1252     test_cpdb=no
1253     test_cups=no
1254     test_dbus=no
1255     test_gen=no
1256     test_gstreamer_1_0=no
1257     test_gtk3_kde5=no
1258     test_gtk3=no
1259     test_gtk4=no
1260     test_kf5=no
1261     test_kf6=no
1262     test_qt5=no
1263     test_qt6=no
1264     test_randr=no
1265     test_xrender=no
1268 test "$using_x11" = yes && USING_X11=TRUE
1270 if test "$using_freetype_fontconfig" = yes; then
1271     AC_DEFINE(USE_HEADLESS_CODE)
1272     USE_HEADLESS_CODE=TRUE
1273     if test "$using_headless_plugin" = yes; then
1274         AC_DEFINE(ENABLE_HEADLESS)
1275         ENABLE_HEADLESS=TRUE
1276     fi
1277 else
1278     test_fontconfig=no
1279     test_freetype=no
1282 AC_SUBST(ENABLE_HEADLESS)
1283 AC_SUBST(USE_HEADLESS_CODE)
1285 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1286 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1287 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1288 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1290 # ===================================================================
1292 # End initial platform setup
1294 # ===================================================================
1296 if test "$_os" = "Android" ; then
1297     # Verify that the NDK and SDK options are proper
1298     if test -z "$with_android_ndk"; then
1299         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1300     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1301         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1302     fi
1304     if test -z "$ANDROID_SDK_DIR"; then
1305         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1306     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1307         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1308     fi
1311 AC_SUBST(SDKDIRNAME)
1313 AC_SUBST(PTHREAD_CFLAGS)
1314 AC_SUBST(PTHREAD_LIBS)
1316 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1317 # By default use the ones specified by our build system,
1318 # but explicit override is possible.
1319 AC_MSG_CHECKING(for explicit AFLAGS)
1320 if test -n "$AFLAGS"; then
1321     AC_MSG_RESULT([$AFLAGS])
1322     x_AFLAGS=
1323 else
1324     AC_MSG_RESULT(no)
1325     x_AFLAGS=[\#]
1327 AC_MSG_CHECKING(for explicit CFLAGS)
1328 if test -n "$CFLAGS"; then
1329     AC_MSG_RESULT([$CFLAGS])
1330     x_CFLAGS=
1331 else
1332     AC_MSG_RESULT(no)
1333     x_CFLAGS=[\#]
1335 AC_MSG_CHECKING(for explicit CXXFLAGS)
1336 if test -n "$CXXFLAGS"; then
1337     AC_MSG_RESULT([$CXXFLAGS])
1338     x_CXXFLAGS=
1339 else
1340     AC_MSG_RESULT(no)
1341     x_CXXFLAGS=[\#]
1343 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1344 if test -n "$OBJCFLAGS"; then
1345     AC_MSG_RESULT([$OBJCFLAGS])
1346     x_OBJCFLAGS=
1347 else
1348     AC_MSG_RESULT(no)
1349     x_OBJCFLAGS=[\#]
1351 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1352 if test -n "$OBJCXXFLAGS"; then
1353     AC_MSG_RESULT([$OBJCXXFLAGS])
1354     x_OBJCXXFLAGS=
1355 else
1356     AC_MSG_RESULT(no)
1357     x_OBJCXXFLAGS=[\#]
1359 AC_MSG_CHECKING(for explicit LDFLAGS)
1360 if test -n "$LDFLAGS"; then
1361     AC_MSG_RESULT([$LDFLAGS])
1362     x_LDFLAGS=
1363 else
1364     AC_MSG_RESULT(no)
1365     x_LDFLAGS=[\#]
1367 AC_SUBST(AFLAGS)
1368 AC_SUBST(CFLAGS)
1369 AC_SUBST(CXXFLAGS)
1370 AC_SUBST(OBJCFLAGS)
1371 AC_SUBST(OBJCXXFLAGS)
1372 AC_SUBST(LDFLAGS)
1373 AC_SUBST(x_AFLAGS)
1374 AC_SUBST(x_CFLAGS)
1375 AC_SUBST(x_CXXFLAGS)
1376 AC_SUBST(x_OBJCFLAGS)
1377 AC_SUBST(x_OBJCXXFLAGS)
1378 AC_SUBST(x_LDFLAGS)
1380 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1381 my_original_CFLAGS=$CFLAGS
1382 my_original_CXXFLAGS=$CXXFLAGS
1383 my_original_CPPFLAGS=$CPPFLAGS
1385 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1386 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1387 dnl AC_PROG_CC internally.
1388 if test "$_os" != "WINNT"; then
1389     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CC,
1390     # Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
1391     save_CFLAGS=$CFLAGS
1392     CFLAGS=-g
1393     AC_PROG_CC
1394     CFLAGS=$save_CFLAGS
1395     if test -z "$CC_BASE"; then
1396         CC_BASE=`first_arg_basename "$CC"`
1397     fi
1400 if test "$_os" != "WINNT"; then
1401     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1402 else
1403     ENDIANNESS=little
1405 AC_SUBST(ENDIANNESS)
1407 if test "$usable_dlapi" != no; then
1408     AC_DEFINE([HAVE_DLAPI])
1409     if test "$test_unix_dlapi" != no; then
1410         save_LIBS="$LIBS"
1411         AC_SEARCH_LIBS([dlsym], [dl],
1412             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1413             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1414         LIBS="$save_LIBS"
1415         AC_DEFINE([HAVE_UNIX_DLAPI])
1416     fi
1418 AC_SUBST(UNIX_DLAPI_LIBS)
1420 # Check for a (GNU) backtrace implementation
1421 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1422 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1423 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1424     save_LIBS="$LIBS"
1425     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1426         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1427         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1428     LIBS="$save_LIBS"
1430 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1431     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1434 dnl ===================================================================
1435 dnl Sanity checks for Emscripten SDK setup
1436 dnl ===================================================================
1438 EMSCRIPTEN_MIN_MAJOR=3
1439 EMSCRIPTEN_MIN_MINOR=1
1440 EMSCRIPTEN_MIN_TINY=46
1441 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1443 EMSCRIPTEN_WORKERJS=
1444 if test "$_os" = "Emscripten"; then
1445     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1446     if test -z "$EMSCRIPTEN_VERSION_H"; then
1447         AS_IF([test -z "$EMSDK"],
1448               [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1449         EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1450         if test ! -f "$EMSCRIPTEN_VERSION_H"; then
1451             EMSCRIPTEN_VERSION_H=$EMSDK/emscripten/main/cache/sysroot/include/emscripten/version.h
1452         fi
1453     fi
1454     if test -f "$EMSCRIPTEN_VERSION_H"; then
1455         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1456         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1457         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1458     else
1459         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1460         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1461         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1462         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1463     fi
1465     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1467     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1468     if test $? -eq 0; then
1469         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1470     else
1471         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1472     fi
1474     EMSCRIPTEN_ERROR=0
1475     if ! command -v emconfigure >/dev/null 2>&1; then
1476         AC_MSG_WARN([emconfigure must be in your \$PATH])
1477         EMSCRIPTEN_ERROR=1
1478     fi
1479     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1480         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1481         EMSCRIPTEN_ERROR=1
1482     fi
1483     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1484     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1485         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1486         EMSCRIPTEN_ERROR=1
1487     fi
1488     if test $EMSCRIPTEN_ERROR -ne 0; then
1489         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1490     fi
1492     dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
1493     BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
1495     dnl Generation of .worker.js files has been dropped completely from Emscripten 3.1.68, and the
1496     dnl generated files were just unused dummies since Emscripten 3.1.58:
1497     AC_MSG_CHECKING([if Emscripten still depends on a separate .worker.js file])
1498     check_semantic_version_three 3 1 58 "$EMSCRIPTEN_MAJOR" "$EMSCRIPTEN_MINOR" "$EMSCRIPTEN_TINY"
1499     if test $? -ne 0; then
1500         AC_MSG_RESULT([yes])
1501         EMSCRIPTEN_WORKERJS=TRUE
1502     else
1503         AC_MSG_RESULT([no])
1504     fi
1506 AC_SUBST(EMSDK_FILE_PACKAGER)
1507 AC_SUBST(EMSCRIPTEN_EXTRA_SOFFICE_PRE_JS)
1508 AC_SUBST(EMSCRIPTEN_WORKERJS)
1510 ###############################################################################
1511 # Extensions switches --enable/--disable
1512 ###############################################################################
1513 # By default these should be enabled unless having extra dependencies.
1514 # If there is extra dependency over configure options then the enable should
1515 # be automagic based on whether the requiring feature is enabled or not.
1516 # All this options change anything only with --enable-extension-integration.
1518 # The name of this option and its help string makes it sound as if
1519 # extensions are built anyway, just not integrated in the installer,
1520 # if you use --disable-extension-integration. Is that really the
1521 # case?
1523 AC_ARG_ENABLE(ios-simulator,
1524     AS_HELP_STRING([--enable-ios-simulator],
1525         [build for iOS simulator])
1528 libo_FUZZ_ARG_ENABLE(extension-integration,
1529     AS_HELP_STRING([--disable-extension-integration],
1530         [Disable integration of the built extensions in the installer of the
1531          product. Use this switch to disable the integration.])
1534 AC_ARG_ENABLE(avmedia,
1535     AS_HELP_STRING([--disable-avmedia],
1536         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1537 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1539 AC_ARG_ENABLE(database-connectivity,
1540     AS_HELP_STRING([--disable-database-connectivity],
1541         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1544 # This doesn't mean not building (or "integrating") extensions
1545 # (although it probably should; i.e. it should imply
1546 # --disable-extension-integration I guess), it means not supporting
1547 # any extension mechanism at all
1548 libo_FUZZ_ARG_ENABLE(extensions,
1549     AS_HELP_STRING([--disable-extensions],
1550         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1553 AC_ARG_ENABLE(scripting,
1554     AS_HELP_STRING([--disable-scripting],
1555         [Disable BASIC, Java, Python and .NET. Work in progress, use only if you are hacking on it.]),
1556 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1558 # This is mainly for Android and iOS, but could potentially be used in some
1559 # special case otherwise, too, so factored out as a separate setting
1561 AC_ARG_ENABLE(dynamic-loading,
1562     AS_HELP_STRING([--disable-dynamic-loading],
1563         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1566 libo_FUZZ_ARG_ENABLE(report-builder,
1567     AS_HELP_STRING([--disable-report-builder],
1568         [Disable the Report Builder.])
1571 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1572     AS_HELP_STRING([--enable-ext-wiki-publisher],
1573         [Enable the Wiki Publisher extension.])
1576 libo_FUZZ_ARG_ENABLE(lpsolve,
1577     AS_HELP_STRING([--disable-lpsolve],
1578         [Disable compilation of the lp solve solver ])
1580 libo_FUZZ_ARG_ENABLE(coinmp,
1581     AS_HELP_STRING([--disable-coinmp],
1582         [Disable compilation of the CoinMP solver ])
1585 libo_FUZZ_ARG_ENABLE(pdfimport,
1586     AS_HELP_STRING([--disable-pdfimport],
1587         [Disable building the PDF import feature.])
1590 libo_FUZZ_ARG_ENABLE(pdfium,
1591     AS_HELP_STRING([--disable-pdfium],
1592         [Disable building PDFium. Results in insecure PDF signature verification.])
1595 libo_FUZZ_ARG_ENABLE(skia,
1596     AS_HELP_STRING([--disable-skia],
1597         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1600 ###############################################################################
1602 dnl ---------- *** ----------
1604 libo_FUZZ_ARG_ENABLE(mergelibs,
1605     AS_HELP_STRING([--enable-mergelibs=yes/no/more],
1606         [Merge several of the smaller libraries into one big "merged" library.
1607          The "more" option will link even more of the smaller libraries.
1608          "more" not appropriate for distros which split up LibreOffice into multiple packages.
1609          It is only appropriate for situations where all of LO is delivered in a single install/package. ])
1612 libo_FUZZ_ARG_ENABLE(breakpad,
1613     AS_HELP_STRING([--enable-breakpad],
1614         [Enables breakpad for crash reporting.])
1617 libo_FUZZ_ARG_ENABLE(crashdump,
1618     AS_HELP_STRING([--disable-crashdump],
1619         [Disable dump.ini and dump-file, when --enable-breakpad])
1622 AC_ARG_ENABLE(fetch-external,
1623     AS_HELP_STRING([--disable-fetch-external],
1624         [Disables fetching external tarballs from web sources.])
1627 AC_ARG_ENABLE(fuzzers,
1628     AS_HELP_STRING([--enable-fuzzers],
1629         [Enables building libfuzzer targets for fuzz testing.])
1632 libo_FUZZ_ARG_ENABLE(pch,
1633     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1634         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1635          Using 'system' will include only external headers, 'base' will add also headers
1636          from base modules, 'normal' will also add all headers except from the module built,
1637          'full' will use all suitable headers even from a module itself.])
1640 libo_FUZZ_ARG_ENABLE(epm,
1641     AS_HELP_STRING([--enable-epm],
1642         [LibreOffice includes self-packaging code, that requires epm, however epm is
1643          useless for large scale package building.])
1646 libo_FUZZ_ARG_ENABLE(odk,
1647     AS_HELP_STRING([--enable-odk],
1648         [Enable building the Office Development Kit, the part that extensions need to build against])
1651 AC_ARG_ENABLE(mpl-subset,
1652     AS_HELP_STRING([--enable-mpl-subset],
1653         [Don't compile any pieces which are not MPL or more liberally licensed])
1656 libo_FUZZ_ARG_ENABLE(evolution2,
1657     AS_HELP_STRING([--enable-evolution2],
1658         [Allows the built-in evolution 2 addressbook connectivity build to be
1659          enabled.])
1662 AC_ARG_ENABLE(avahi,
1663     AS_HELP_STRING([--enable-avahi],
1664         [Determines whether to use Avahi to advertise Impress to remote controls.])
1667 AC_ARG_ENABLE(msvc-analyze,
1668     AS_HELP_STRING([--enable-msvc-analyze],
1669         [Determines whether to enable the Microsoft Visual Studio /analyze flag to provide additional warnings.])
1672 libo_FUZZ_ARG_ENABLE(werror,
1673     AS_HELP_STRING([--enable-werror],
1674         [Turn warnings to errors. (Has no effect in modules where the treating
1675          of warnings as errors is disabled explicitly.)]),
1678 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1679     AS_HELP_STRING([--enable-assert-always-abort],
1680         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1683 libo_FUZZ_ARG_ENABLE(dbgutil,
1684     AS_HELP_STRING([--enable-dbgutil],
1685         [Provide debugging support from --enable-debug and include additional debugging
1686          utilities such as object counting or more expensive checks.
1687          This is the recommended option for developers.
1688          Note that this makes the build ABI incompatible, it is not possible to mix object
1689          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1691 libo_FUZZ_ARG_ENABLE(debug,
1692     AS_HELP_STRING([--enable-debug],
1693         [Include debugging information, disable compiler optimization and inlining plus
1694          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1696 libo_FUZZ_ARG_ENABLE(split-debug,
1697     AS_HELP_STRING([--disable-split-debug],
1698         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1699          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1701 libo_FUZZ_ARG_ENABLE(gdb-index,
1702     AS_HELP_STRING([--disable-gdb-index],
1703         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1704          The feature requires a linker that supports the --gdb-index option.]))
1706 libo_FUZZ_ARG_ENABLE(sal-log,
1707     AS_HELP_STRING([--enable-sal-log],
1708         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1710 libo_FUZZ_ARG_ENABLE(symbols,
1711     AS_HELP_STRING([--enable-symbols],
1712         [Generate debug information.
1713          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1714          otherwise. It is possible to explicitly specify gbuild build targets
1715          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1716          everything in the directory; there is no ordering, more specific overrides
1717          more general, and disabling takes precedence).
1718          Example: --enable-symbols="all -sw/ -Library_sc".]))
1720 libo_FUZZ_ARG_ENABLE(optimized,
1721     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1722         [Whether to compile with optimization flags.
1723          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1724          otherwise. Using 'debug' will try to use only optimizations that should
1725          not interfere with debugging. For Emscripten we default to optimized (-O1)
1726          debug build, as otherwise binaries become too large.]))
1728 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1729     AS_HELP_STRING([--disable-runtime-optimizations],
1730         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1731          JVM JIT) that are known to interact badly with certain dynamic analysis
1732          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1733          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1734          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1736 AC_ARG_WITH(valgrind,
1737     AS_HELP_STRING([--with-valgrind],
1738         [Make availability of Valgrind headers a hard requirement.]))
1740 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1741     AS_HELP_STRING([--enable-compiler-plugins],
1742         [Enable compiler plugins that will perform additional checks during
1743          building. Enabled automatically by --enable-dbgutil.
1744          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1745 COMPILER_PLUGINS_DEBUG=
1746 if test "$enable_compiler_plugins" = debug; then
1747     enable_compiler_plugins=yes
1748     COMPILER_PLUGINS_DEBUG=TRUE
1751 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1752     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1753         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1754          relevant in the --disable-compiler-plugins case.]))
1756 libo_FUZZ_ARG_ENABLE(ooenv,
1757     AS_HELP_STRING([--enable-ooenv],
1758         [Enable ooenv for the instdir installation.]))
1760 AC_ARG_ENABLE(lto,
1761     AS_HELP_STRING([--enable-lto],
1762         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1763          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1764          linker.)]))
1766 AC_ARG_ENABLE(python,
1767     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1768         [Enables or disables Python support at run-time.
1769          Also specifies what Python to use at build-time.
1770          'fully-internal' even forces the internal version for uses of Python
1771          during the build.
1772          On macOS the only choices are
1773          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1774          ]))
1776 libo_FUZZ_ARG_ENABLE(gtk3,
1777     AS_HELP_STRING([--disable-gtk3],
1778         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1779 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1781 AC_ARG_ENABLE(gtk4,
1782     AS_HELP_STRING([--enable-gtk4],
1783         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1785 AC_ARG_ENABLE(atspi-tests,
1786     AS_HELP_STRING([--disable-atspi-tests],
1787         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1789 AC_ARG_ENABLE(introspection,
1790     AS_HELP_STRING([--enable-introspection],
1791         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1792          Linux distributions.)]))
1794 AC_ARG_ENABLE(split-app-modules,
1795     AS_HELP_STRING([--enable-split-app-modules],
1796         [Split file lists for app modules, e.g. base, calc.
1797          Has effect only with make distro-pack-install]),
1800 AC_ARG_ENABLE(split-opt-features,
1801     AS_HELP_STRING([--enable-split-opt-features],
1802         [Split file lists for some optional features, e.g. pyuno, testtool.
1803          Has effect only with make distro-pack-install]),
1806 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1807     AS_HELP_STRING([--disable-cairo-canvas],
1808         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1811 libo_FUZZ_ARG_ENABLE(dbus,
1812     AS_HELP_STRING([--disable-dbus],
1813         [Determines whether to enable features that depend on dbus.
1814          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1815 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1817 libo_FUZZ_ARG_ENABLE(sdremote,
1818     AS_HELP_STRING([--disable-sdremote],
1819         [Determines whether to enable Impress remote control (i.e. the server component).]),
1820 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1822 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1823     AS_HELP_STRING([--disable-sdremote-bluetooth],
1824         [Determines whether to build sdremote with bluetooth support.
1825          Requires dbus on Linux.]))
1827 libo_FUZZ_ARG_ENABLE(gio,
1828     AS_HELP_STRING([--disable-gio],
1829         [Determines whether to use the GIO support.]),
1830 ,test "${enable_gio+set}" = set || enable_gio=yes)
1832 AC_ARG_ENABLE(qt5,
1833     AS_HELP_STRING([--enable-qt5],
1834         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1835          available.]),
1838 AC_ARG_ENABLE(qt6,
1839     AS_HELP_STRING([--enable-qt6],
1840         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1841          available.]),
1844 AC_ARG_ENABLE(qt6-multimedia,
1845     AS_HELP_STRING([--disable-qt6-multimedia],
1846         [Determines whether to enable media playback using QtMultimedia when using the qt6/kf6 VCL plugins.]))
1848 AC_ARG_ENABLE(kf5,
1849     AS_HELP_STRING([--enable-kf5],
1850         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1851          KF5 are available.]),
1854 AC_ARG_ENABLE(kf6,
1855     AS_HELP_STRING([--enable-kf6],
1856         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1857          KF6 are available.]),
1861 AC_ARG_ENABLE(gtk3_kde5,
1862     AS_HELP_STRING([--enable-gtk3-kde5],
1863         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1864          platforms where Gtk3, Qt5 and Plasma is available.]),
1867 AC_ARG_ENABLE(gen,
1868     AS_HELP_STRING([--enable-gen],
1869         [To select the gen backend in case of --disable-dynamic-loading.
1870          Per default auto-enabled when X11 is used.]),
1871 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1873 AC_ARG_ENABLE(gui,
1874     AS_HELP_STRING([--disable-gui],
1875         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1876 ,enable_gui=yes)
1878 libo_FUZZ_ARG_ENABLE(randr,
1879     AS_HELP_STRING([--disable-randr],
1880         [Disable RandR support in the vcl project.]),
1881 ,test "${enable_randr+set}" = set || enable_randr=yes)
1883 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1884     AS_HELP_STRING([--disable-gstreamer-1-0],
1885         [Disable building with the gstreamer 1.0 avmedia backend.]),
1886 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1888 libo_FUZZ_ARG_ENABLE([eot],
1889     [AS_HELP_STRING([--enable-eot],
1890         [Enable support for Embedded OpenType fonts.])],
1891 ,test "${enable_eot+set}" = set || enable_eot=no)
1893 libo_FUZZ_ARG_ENABLE(cve-tests,
1894     AS_HELP_STRING([--disable-cve-tests],
1895         [Prevent CVE tests to be executed]),
1898 AC_ARG_ENABLE(build-opensymbol,
1899     AS_HELP_STRING([--enable-build-opensymbol],
1900         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1901          fontforge installed.]),
1904 AC_ARG_ENABLE(dependency-tracking,
1905     AS_HELP_STRING([--enable-dependency-tracking],
1906         [Do not reject slow dependency extractors.])[
1907   --disable-dependency-tracking
1908                           Disables generation of dependency information.
1909                           Speed up one-time builds.],
1912 AC_ARG_ENABLE(icecream,
1913     AS_HELP_STRING([--enable-icecream],
1914         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1915          It defaults to /opt/icecream for the location of the icecream gcc/g++
1916          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1919 AC_ARG_ENABLE(ld,
1920     AS_HELP_STRING([--enable-ld=<linker>],
1921         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1922          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1923          If <linker> contains any ':', the part before the first ':' is used as the value of
1924          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1925          needed for Clang 12).]),
1928 AC_ARG_ENABLE(cpdb,
1929     AS_HELP_STRING([--enable-cpdb],
1930         [Build CPDB (Common Print Dialog Backends) support.]),
1933 libo_FUZZ_ARG_ENABLE(cups,
1934     AS_HELP_STRING([--disable-cups],
1935         [Do not build cups support.])
1938 AC_ARG_ENABLE(ccache,
1939     AS_HELP_STRING([--disable-ccache],
1940         [Do not try to use ccache automatically.
1941          By default we will try to detect if ccache is available; in that case if
1942          CC/CXX are not yet set, and --enable-icecream is not given, we
1943          attempt to use ccache. --disable-ccache disables ccache completely.
1944          Additionally ccache's depend mode is enabled if possible,
1945          use --enable-ccache=nodepend to enable ccache without depend mode.
1949 AC_ARG_ENABLE(z7-debug,
1950     AS_HELP_STRING([--enable-z7-debug],
1951         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1952          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1953          Enabled by default if ccache is detected.]))
1955 libo_FUZZ_ARG_ENABLE(online-update,
1956     AS_HELP_STRING([--enable-online-update],
1957         [Enable the online update service that will check for new versions of
1958          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
1961 libo_FUZZ_ARG_ENABLE(online-update-mar,
1962     AS_HELP_STRING([--enable-online-update-mar],
1963         [Enable the Mozilla-like online update service that will
1964          check for new versions of LibreOffice. Currently only works for
1965          Windows and Linux. Disabled by default.]),
1968 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1969     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1970         [Set the base URL value for --enable-online-update-mar.
1971          (Can be left off for debug purposes, even if that may render the feature
1972          non-functional.)]),
1975 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1976     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1977         [Set the certificate DER value for --enable-online-update-mar.
1978          (Can be left off for debug purposes, even if that may render the feature
1979          non-functional.)]),
1982 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1983     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1984         [Set the certificate name value for --enable-online-update-mar.
1985          (Can be left off for debug purposes, even if that may render the feature
1986          non-functional.)]),
1989 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1990     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1991         [Set the certificate path value for --enable-online-update-mar.
1992          (Can be left off for debug purposes, even if that may render the feature
1993          non-functional.)]),
1996 libo_FUZZ_ARG_ENABLE(extension-update,
1997     AS_HELP_STRING([--disable-extension-update],
1998         [Disable possibility to update installed extensions.]),
2001 libo_FUZZ_ARG_ENABLE(release-build,
2002     AS_HELP_STRING([--enable-release-build],
2003         [Enable release build. Note that the "release build" choice is orthogonal to
2004          whether symbols are present, debug info is generated, or optimization
2005          is done.
2006          See https://wiki.documentfoundation.org/Development/DevBuild]),
2009 libo_FUZZ_ARG_ENABLE(hardening-flags,
2010     AS_HELP_STRING([--enable-hardening-flags],
2011         [Enable automatically using hardening compiler flags. Distros typically
2012          instead use their default configuration via CXXFLAGS, etc. But this provides a
2013          convenient set of default hardening flags for non-distros]),
2016 AC_ARG_ENABLE(windows-build-signing,
2017     AS_HELP_STRING([--enable-windows-build-signing],
2018         [Enable signing of windows binaries (*.exe, *.dll)]),
2021 AC_ARG_ENABLE(silent-msi,
2022     AS_HELP_STRING([--enable-silent-msi],
2023         [Enable MSI with LIMITUI=1 (silent install).]),
2026 AC_ARG_ENABLE(wix,
2027     AS_HELP_STRING([--enable-wix],
2028         [Build Windows installer using WiX.]),
2031 AC_ARG_ENABLE(macosx-code-signing,
2032     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
2033         [Sign executables, dylibs, frameworks and the app bundle. If you
2034          don't provide an identity the first suitable certificate
2035          in your keychain is used.]),
2038 AC_ARG_ENABLE(macosx-package-signing,
2039     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2040         [Create a .pkg suitable for uploading to the Mac App Store and sign
2041          it. If you don't provide an identity the first suitable certificate
2042          in your keychain is used.]),
2045 AC_ARG_ENABLE(macosx-sandbox,
2046     AS_HELP_STRING([--enable-macosx-sandbox],
2047         [Make the app bundle run in a sandbox. Requires code signing.
2048          Is required by apps distributed in the Mac App Store, and implies
2049          adherence to App Store rules.]),
2052 AC_ARG_WITH(macosx-bundle-identifier,
2053     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2054         [Define the macOS bundle identifier. Default is the somewhat weird
2055          org.libreoffice.script ("script", huh?).]),
2056 ,with_macosx_bundle_identifier=org.libreoffice.script)
2058 AC_ARG_WITH(macosx-provisioning-profile,
2059     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2060         [Specify the path to a provisioning profile to use]),
2063 AC_ARG_WITH(product-name,
2064     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2065         [Define the product name. Default is AC_PACKAGE_NAME.]),
2066 ,with_product_name=$PRODUCTNAME)
2068 libo_FUZZ_ARG_ENABLE(community-flavor,
2069     AS_HELP_STRING([--disable-community-flavor],
2070         [Disable the Community branding.]),
2073 AC_ARG_WITH(package-version,
2074     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2075         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2078 libo_FUZZ_ARG_ENABLE(readonly-installset,
2079     AS_HELP_STRING([--enable-readonly-installset],
2080         [Prevents any attempts by LibreOffice to write into its installation. That means
2081          at least that no "system-wide" extensions can be added. Partly experimental work in
2082          progress, probably not fully implemented. Always enabled for macOS.]),
2085 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2086     AS_HELP_STRING([--disable-mariadb-sdbc],
2087         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2090 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2091     AS_HELP_STRING([--disable-postgresql-sdbc],
2092         [Disable the build of the PostgreSQL-SDBC driver.])
2095 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2096     AS_HELP_STRING([--disable-lotuswordpro],
2097         [Disable the build of the Lotus Word Pro filter.]),
2098 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2100 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2101     AS_HELP_STRING([--disable-firebird-sdbc],
2102         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2103 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2105 AC_ARG_ENABLE(bogus-pkg-config,
2106     AS_HELP_STRING([--enable-bogus-pkg-config],
2107         [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.]),
2110 AC_ARG_ENABLE(openssl,
2111     AS_HELP_STRING([--disable-openssl],
2112         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2113          components will use NSS. Work in progress,
2114          use only if you are hacking on it.]),
2115 ,enable_openssl=yes)
2117 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2118     AS_HELP_STRING([--enable-cipher-openssl-backend],
2119         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2120          Requires --enable-openssl.]))
2122 AC_ARG_ENABLE(nss,
2123     AS_HELP_STRING([--disable-nss],
2124         [Disable using NSS. If disabled,
2125          components will use openssl. Work in progress,
2126          use only if you are hacking on it.]),
2127 ,enable_nss=yes)
2129 AC_ARG_ENABLE(library-bin-tar,
2130     AS_HELP_STRING([--enable-library-bin-tar],
2131         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2132         Some libraries can save their build result in a tarball
2133         stored in TARFILE_LOCATION. That binary tarball is
2134         uniquely identified by the source tarball,
2135         the content of the config_host.mk file and the content
2136         of the top-level directory in core for that library
2137         If this option is enabled, then if such a tarfile exist, it will be untarred
2138         instead of the source tarfile, and the build step will be skipped for that
2139         library.
2140         If a proper tarfile does not exist, then the normal source-based
2141         build is done for that library and a proper binary tarfile is created
2142         for the next time.]),
2145 AC_ARG_ENABLE(dconf,
2146     AS_HELP_STRING([--disable-dconf],
2147         [Disable the dconf configuration backend (enabled by default where
2148          available).]))
2150 libo_FUZZ_ARG_ENABLE(formula-logger,
2151     AS_HELP_STRING(
2152         [--enable-formula-logger],
2153         [Enable formula logger for logging formula calculation flow in Calc.]
2154     )
2157 AC_ARG_ENABLE(ldap,
2158     AS_HELP_STRING([--disable-ldap],
2159         [Disable LDAP support.]),
2160 ,enable_ldap=yes)
2162 AC_ARG_ENABLE(opencl,
2163     AS_HELP_STRING([--disable-opencl],
2164         [Disable OpenCL support.]),
2165 ,enable_opencl=yes)
2167 libo_FUZZ_ARG_ENABLE(librelogo,
2168     AS_HELP_STRING([--disable-librelogo],
2169         [Do not build LibreLogo.]),
2170 ,enable_librelogo=yes)
2172 AC_ARG_ENABLE(wasm-strip,
2173     AS_HELP_STRING([--enable-wasm-strip],
2174         [Strip the static build like for WASM/emscripten platform.]),
2177 AC_ARG_WITH(main-module,
2178     AS_HELP_STRING([--with-main-module=<writer/calc>],
2179         [Specify which main module to build for wasm.
2180         Default value is 'writer'.]),
2183 if test "$_os" = Emscripten; then
2184     AC_ARG_ENABLE(emscripten-jspi,
2185         AS_HELP_STRING([--enable-emscripten-jspi],
2186             [Experimentally enable use of the Emscripten -sJSPI feature.]))
2187 else
2188     enable_emscripten_jspi=
2191 if test "$_os" = Emscripten; then
2192     AC_ARG_ENABLE(emscripten-proxy-to-pthread,
2193         AS_HELP_STRING([--disable-emscripten-proxy-to-pthread],
2194             [Experimentally disable use of the Emscripten -sPROXY_TO_PTHREAD feature.]),,
2195         enable_emscripten_proxy_to_pthread=yes)
2196 else
2197     enable_emscripten_proxy_to_pthread=
2200 if test "$_os" = Emscripten; then
2201     AC_ARG_ENABLE(emscripten-proxy-posix-sockets,
2202         AS_HELP_STRING([--enable-emscripten-proxy-posix-sockets],
2203             [Enable experimental Emscripten support for full POSIX sockets over WebSocket proxy
2204              server (-sPROXY_POSIX_SOCKETS).]))
2205 else
2206     enable_emscripten_proxy_posix_sockets=
2209 AC_ARG_ENABLE(xmlhelp,
2210     AS_HELP_STRING([--disable-xmlhelp],
2211         [Disable XML help support]),
2212 ,enable_xmlhelp=yes)
2214 AC_ARG_ENABLE(customtarget-components,
2215     AS_HELP_STRING([--enable-customtarget-components],
2216         [Generates the static UNO object constructor mapping from the build.]))
2218 AC_ARG_ENABLE(cli,
2219     AS_HELP_STRING([--disable-cli],
2220         [Disable the generation of old CLI bindings.]),
2221 ,enable_cli=yes)
2223 AC_ARG_WITH(extra-cc-flags,
2224     AS_HELP_STRING([--with-extra-cc-flags=...],
2225         [Specify extra flags (like GCC's -fdiagnostics-color=always, which is useful in combination
2226          with the GNU Make --output-sync option) to add to the end of the CC variable.]))
2228 AC_ARG_WITH(extra-cxx-flags,
2229     AS_HELP_STRING([--with-extra-cxx-flags=...],
2230         [Specify extra flags (like GCC's -fdiagnostics-color=always, which is useful in combination
2231          with the GNU Make --output-sync option) to add to the end of the CXX variable.]))
2233 dnl ===================================================================
2234 dnl Optional Packages (--with/without-)
2235 dnl ===================================================================
2237 AC_ARG_WITH(gcc-home,
2238     AS_HELP_STRING([--with-gcc-home],
2239         [Specify the location of gcc/g++ manually. This can be used in conjunction
2240          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2241          non-default path.]),
2244 AC_ARG_WITH(gnu-patch,
2245     AS_HELP_STRING([--with-gnu-patch],
2246         [Specify location of GNU patch on Solaris or FreeBSD.]),
2249 AC_ARG_WITH(build-platform-configure-options,
2250     AS_HELP_STRING([--with-build-platform-configure-options],
2251         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2254 AC_ARG_WITH(gnu-cp,
2255     AS_HELP_STRING([--with-gnu-cp],
2256         [Specify location of GNU cp on Solaris or FreeBSD.]),
2259 AC_ARG_WITH(external-tar,
2260     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2261         [Specify an absolute path of where to find (and store) tarfiles.]),
2262     TARFILE_LOCATION=$withval ,
2265 AC_ARG_WITH(referenced-git,
2266     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2267         [Specify another checkout directory to reference. This makes use of
2268                  git submodule update --reference, and saves a lot of diskspace
2269                  when having multiple trees side-by-side.]),
2270     GIT_REFERENCE_SRC=$withval ,
2273 AC_ARG_WITH(linked-git,
2274     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2275         [Specify a directory where the repositories of submodules are located.
2276          This uses a method similar to git-new-workdir to get submodules.]),
2277     GIT_LINK_SRC=$withval ,
2280 AC_ARG_WITH(galleries,
2281     AS_HELP_STRING([--with-galleries],
2282         [Specify how galleries should be built. It is possible either to
2283          build these internally from source ("build"),
2284          or to disable them ("no")]),
2287 AC_ARG_WITH(templates,
2288     AS_HELP_STRING([--with-templates],
2289         [Specify we build with or without template files. It is possible either to
2290          build with templates ("yes"),
2291          or to disable them ("no")]),
2294 AC_ARG_WITH(theme,
2295     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2296         [Choose which themes to include. By default those themes with an '*' are included.
2297          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2298          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2299          *elementary, *elementary_svg,
2300          *karasa_jaga, *karasa_jaga_svg,
2301          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2302          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2305 libo_FUZZ_ARG_WITH(helppack-integration,
2306     AS_HELP_STRING([--without-helppack-integration],
2307         [It will not integrate the helppacks to the installer
2308          of the product. Please use this switch to use the online help
2309          or separate help packages.]),
2312 libo_FUZZ_ARG_WITH(fonts,
2313     AS_HELP_STRING([--without-fonts],
2314         [LibreOffice includes some third-party fonts to provide a reliable basis for
2315          help content, templates, samples, etc. When these fonts are already
2316          known to be available on the system then you should use this option.]),
2319 libo_FUZZ_ARG_WITH(docrepair-fonts,
2320     AS_HELP_STRING([--with-docrepair-fonts],
2321         [LibreOffice optionally includes fonts from 'The DocRepair Project' that
2322          provide metrically equivalent fallback fonts for a variety of common fonts
2323          seen in Office Open XML documents. See https://github.com/docrepair-fonts
2324          for more details. This option has no effect when --without-fonts is used.]),
2327 AC_ARG_WITH(epm,
2328     AS_HELP_STRING([--with-epm],
2329         [Decides which epm to use. Default is to use the one from the system if
2330          one is built. When either this is not there or you say =internal epm
2331          will be built.]),
2334 AC_ARG_WITH(package-format,
2335     AS_HELP_STRING([--with-package-format],
2336         [Specify package format(s) for LibreOffice installation sets. The
2337          implicit --without-package-format leads to no installation sets being
2338          generated. Possible values: archive, bsd, deb, dmg, emscripten,
2339          installed, msi, pkg, and rpm.
2340          Example: --with-package-format='deb rpm']),
2343 AC_ARG_WITH(tls,
2344     AS_HELP_STRING([--with-tls],
2345         [Decides which TLS/SSL and cryptographic implementations to use for
2346          LibreOffice's code. Default is to use NSS although OpenSSL is also
2347          possible. Notice that selecting NSS restricts the usage of OpenSSL
2348          in LO's code but selecting OpenSSL doesn't restrict by now the
2349          usage of NSS in LO's code. Possible values: openssl, nss.
2350          Example: --with-tls="nss"]),
2353 AC_ARG_WITH(system-libs,
2354     AS_HELP_STRING([--with-system-libs],
2355         [Use libraries already on system -- enables all --with-system-* flags.]),
2358 AC_ARG_WITH(system-bzip2,
2359     AS_HELP_STRING([--with-system-bzip2],
2360         [Use bzip2 already on system. Used when --enable-online-update-mar
2361         or --enable-python=internal]),,
2362     [with_system_bzip2="$with_system_libs"])
2364 AC_ARG_WITH(system-headers,
2365     AS_HELP_STRING([--with-system-headers],
2366         [Use headers already on system -- enables all --with-system-* flags for
2367          external packages whose headers are the only entities used i.e.
2368          boost/odbc/sane-header(s).]),,
2369     [with_system_headers="$with_system_libs"])
2371 AC_ARG_WITH(system-jars,
2372     AS_HELP_STRING([--without-system-jars],
2373         [When building with --with-system-libs, also the needed jars are expected
2374          on the system. Use this to disable that]),,
2375     [with_system_jars="$with_system_libs"])
2377 AC_ARG_WITH(system-cairo,
2378     AS_HELP_STRING([--with-system-cairo],
2379         [Use cairo libraries already on system.  Happens automatically for
2380          (implicit) --enable-gtk3.]))
2382 AC_ARG_WITH(system-epoxy,
2383     AS_HELP_STRING([--with-system-epoxy],
2384         [Use epoxy libraries already on system.  Happens automatically for
2385          (implicit) --enable-gtk3.]),,
2386        [with_system_epoxy="$with_system_libs"])
2388 AC_ARG_WITH(myspell-dicts,
2389     AS_HELP_STRING([--with-myspell-dicts],
2390         [Adds myspell dictionaries to the LibreOffice installation set]),
2393 AC_ARG_WITH(system-dicts,
2394     AS_HELP_STRING([--without-system-dicts],
2395         [Do not use dictionaries from system paths.]),
2398 AC_ARG_WITH(external-dict-dir,
2399     AS_HELP_STRING([--with-external-dict-dir],
2400         [Specify external dictionary dir.]),
2403 AC_ARG_WITH(external-hyph-dir,
2404     AS_HELP_STRING([--with-external-hyph-dir],
2405         [Specify external hyphenation pattern dir.]),
2408 AC_ARG_WITH(external-thes-dir,
2409     AS_HELP_STRING([--with-external-thes-dir],
2410         [Specify external thesaurus dir.]),
2413 AC_ARG_WITH(system-zlib,
2414     AS_HELP_STRING([--with-system-zlib],
2415         [Use zlib already on system.]),,
2416     [with_system_zlib=auto])
2418 AC_ARG_WITH(system-jpeg,
2419     AS_HELP_STRING([--with-system-jpeg],
2420         [Use jpeg already on system.]),,
2421     [with_system_jpeg="$with_system_libs"])
2423 AC_ARG_WITH(system-expat,
2424     AS_HELP_STRING([--with-system-expat],
2425         [Use expat already on system.]),,
2426     [with_system_expat="$with_system_libs"])
2428 AC_ARG_WITH(system-libxml,
2429     AS_HELP_STRING([--with-system-libxml],
2430         [Use libxml/libxslt already on system.]),,
2431     [with_system_libxml=auto])
2433 AC_ARG_WITH(system-openldap,
2434     AS_HELP_STRING([--with-system-openldap],
2435         [Use the OpenLDAP LDAP SDK already on system.]),,
2436     [with_system_openldap="$with_system_libs"])
2438 libo_FUZZ_ARG_ENABLE(poppler,
2439     AS_HELP_STRING([--disable-poppler],
2440         [Disable building Poppler.])
2443 AC_ARG_WITH(system-poppler,
2444     AS_HELP_STRING([--with-system-poppler],
2445         [Use system poppler (only needed for PDF import).]),,
2446     [with_system_poppler="$with_system_libs"])
2448 AC_ARG_WITH(system-abseil,
2449     AS_HELP_STRING([--with-system-abseil],
2450         [Use the abseil libraries already on system.]),,
2451     [with_system_abseil="$with_system_libs"])
2453 AC_ARG_WITH(system-openjpeg,
2454     AS_HELP_STRING([--with-system-openjpeg],
2455         [Use the OpenJPEG library already on system.]),,
2456     [with_system_openjpeg="$with_system_libs"])
2458 libo_FUZZ_ARG_ENABLE(gpgmepp,
2459     AS_HELP_STRING([--disable-gpgmepp],
2460         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2463 AC_ARG_WITH(system-gpgmepp,
2464     AS_HELP_STRING([--with-system-gpgmepp],
2465         [Use gpgmepp already on system]),,
2466     [with_system_gpgmepp="$with_system_libs"])
2468 AC_ARG_WITH(system-mariadb,
2469     AS_HELP_STRING([--with-system-mariadb],
2470         [Use MariaDB/MySQL libraries already on system.]),,
2471     [with_system_mariadb="$with_system_libs"])
2473 AC_ARG_ENABLE(bundle-mariadb,
2474     AS_HELP_STRING([--enable-bundle-mariadb],
2475         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2478 AC_ARG_WITH(system-postgresql,
2479     AS_HELP_STRING([--with-system-postgresql],
2480         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2481          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2482     [with_system_postgresql="$with_system_libs"])
2484 AC_ARG_WITH(libpq-path,
2485     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2486         [Use this PostgreSQL C interface (libpq) installation for building
2487          the PostgreSQL-SDBC extension.]),
2490 AC_ARG_WITH(system-firebird,
2491     AS_HELP_STRING([--with-system-firebird],
2492         [Use Firebird libraries already on system, for building the Firebird-SDBC
2493          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2494     [with_system_firebird="$with_system_libs"])
2496 AC_ARG_WITH(system-libtommath,
2497             AS_HELP_STRING([--with-system-libtommath],
2498                            [Use libtommath already on system]),,
2499             [with_system_libtommath="$with_system_libs"])
2501 AC_ARG_WITH(system-hsqldb,
2502     AS_HELP_STRING([--with-system-hsqldb],
2503         [Use hsqldb already on system.]))
2505 AC_ARG_WITH(hsqldb-jar,
2506     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2507         [Specify path to jarfile manually.]),
2508     HSQLDB_JAR=$withval)
2510 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2511     AS_HELP_STRING([--disable-scripting-beanshell],
2512         [Disable support for scripts in BeanShell.]),
2516 AC_ARG_WITH(system-beanshell,
2517     AS_HELP_STRING([--with-system-beanshell],
2518         [Use beanshell already on system.]),,
2519     [with_system_beanshell="$with_system_jars"])
2521 AC_ARG_WITH(beanshell-jar,
2522     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2523         [Specify path to jarfile manually.]),
2524     BSH_JAR=$withval)
2526 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2527     AS_HELP_STRING([--disable-scripting-javascript],
2528         [Disable support for scripts in JavaScript.]),
2532 AC_ARG_WITH(system-rhino,
2533     AS_HELP_STRING([--with-system-rhino],
2534         [Use rhino already on system.]),,
2535     [with_system_rhino="$with_system_jars"])
2537 AC_ARG_WITH(rhino-jar,
2538     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2539         [Specify path to jarfile manually.]),
2540     RHINO_JAR=$withval)
2542 AC_ARG_WITH(system-jfreereport,
2543     AS_HELP_STRING([--with-system-jfreereport],
2544         [Use JFreeReport already on system.]),,
2545     [with_system_jfreereport="$with_system_jars"])
2547 AC_ARG_WITH(sac-jar,
2548     AS_HELP_STRING([--with-sac-jar=JARFILE],
2549         [Specify path to jarfile manually.]),
2550     SAC_JAR=$withval)
2552 AC_ARG_WITH(libxml-jar,
2553     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2554         [Specify path to jarfile manually.]),
2555     LIBXML_JAR=$withval)
2557 AC_ARG_WITH(flute-jar,
2558     AS_HELP_STRING([--with-flute-jar=JARFILE],
2559         [Specify path to jarfile manually.]),
2560     FLUTE_JAR=$withval)
2562 AC_ARG_WITH(jfreereport-jar,
2563     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2564         [Specify path to jarfile manually.]),
2565     JFREEREPORT_JAR=$withval)
2567 AC_ARG_WITH(liblayout-jar,
2568     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2569         [Specify path to jarfile manually.]),
2570     LIBLAYOUT_JAR=$withval)
2572 AC_ARG_WITH(libloader-jar,
2573     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2574         [Specify path to jarfile manually.]),
2575     LIBLOADER_JAR=$withval)
2577 AC_ARG_WITH(libformula-jar,
2578     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2579         [Specify path to jarfile manually.]),
2580     LIBFORMULA_JAR=$withval)
2582 AC_ARG_WITH(librepository-jar,
2583     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2584         [Specify path to jarfile manually.]),
2585     LIBREPOSITORY_JAR=$withval)
2587 AC_ARG_WITH(libfonts-jar,
2588     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2589         [Specify path to jarfile manually.]),
2590     LIBFONTS_JAR=$withval)
2592 AC_ARG_WITH(libserializer-jar,
2593     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2594         [Specify path to jarfile manually.]),
2595     LIBSERIALIZER_JAR=$withval)
2597 AC_ARG_WITH(libbase-jar,
2598     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2599         [Specify path to jarfile manually.]),
2600     LIBBASE_JAR=$withval)
2602 AC_ARG_WITH(system-odbc,
2603     AS_HELP_STRING([--with-system-odbc],
2604         [Use the odbc headers already on system.]),,
2605     [with_system_odbc="auto"])
2607 AC_ARG_WITH(system-sane,
2608     AS_HELP_STRING([--with-system-sane],
2609         [Use sane.h already on system.]),,
2610     [with_system_sane="$with_system_headers"])
2612 AC_ARG_WITH(system-bluez,
2613     AS_HELP_STRING([--with-system-bluez],
2614         [Use bluetooth.h already on system.]),,
2615     [with_system_bluez="$with_system_headers"])
2617 AC_ARG_WITH(system-boost,
2618     AS_HELP_STRING([--with-system-boost],
2619         [Use boost already on system.]),,
2620     [with_system_boost="$with_system_headers"])
2622 AC_ARG_WITH(system-dragonbox,
2623     AS_HELP_STRING([--with-system-dragonbox],
2624         [Use dragonbox already on system.]),,
2625     [with_system_dragonbox="$with_system_headers"])
2627 AC_ARG_WITH(system-frozen,
2628     AS_HELP_STRING([--with-system-frozen],
2629         [Use frozen already on system.]),,
2630     [with_system_frozen="$with_system_headers"])
2632 AC_ARG_WITH(system-libfixmath,
2633     AS_HELP_STRING([--with-system-libfixmath],
2634         [Use libfixmath already on system.]),,
2635     [with_system_libfixmath="$with_system_libs"])
2637 AC_ARG_WITH(system-glm,
2638     AS_HELP_STRING([--with-system-glm],
2639         [Use glm already on system.]),,
2640     [with_system_glm="$with_system_headers"])
2642 AC_ARG_WITH(system-hunspell,
2643     AS_HELP_STRING([--with-system-hunspell],
2644         [Use libhunspell already on system.]),,
2645     [with_system_hunspell="$with_system_libs"])
2647 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2648     AS_HELP_STRING([--enable-cairo-rgba],
2649         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2651 libo_FUZZ_ARG_ENABLE(zxing,
2652     AS_HELP_STRING([--disable-zxing],
2653        [Disable use of zxing external library.]))
2655 AC_ARG_WITH(system-zxing,
2656     AS_HELP_STRING([--with-system-zxing],
2657         [Use libzxing already on system.]),,
2658     [with_system_zxing="$with_system_libs"])
2660 AC_ARG_WITH(system-zxcvbn,
2661     AS_HELP_STRING([--with-system-zxcvbn],
2662         [Use libzxcvbn already on system.]),,
2663     [with_system_zxcvbn="$with_system_libs"])
2665 AC_ARG_WITH(system-box2d,
2666     AS_HELP_STRING([--with-system-box2d],
2667         [Use box2d already on system.]),,
2668     [with_system_box2d="$with_system_libs"])
2670 AC_ARG_WITH(system-mythes,
2671     AS_HELP_STRING([--with-system-mythes],
2672         [Use mythes already on system.]),,
2673     [with_system_mythes="$with_system_libs"])
2675 AC_ARG_WITH(system-altlinuxhyph,
2676     AS_HELP_STRING([--with-system-altlinuxhyph],
2677         [Use ALTLinuxhyph already on system.]),,
2678     [with_system_altlinuxhyph="$with_system_libs"])
2680 AC_ARG_WITH(system-lpsolve,
2681     AS_HELP_STRING([--with-system-lpsolve],
2682         [Use lpsolve already on system.]),,
2683     [with_system_lpsolve="$with_system_libs"])
2685 AC_ARG_WITH(system-coinmp,
2686     AS_HELP_STRING([--with-system-coinmp],
2687         [Use CoinMP already on system.]),,
2688     [with_system_coinmp="$with_system_libs"])
2690 AC_ARG_WITH(system-liblangtag,
2691     AS_HELP_STRING([--with-system-liblangtag],
2692         [Use liblangtag library already on system.]),,
2693     [with_system_liblangtag="$with_system_libs"])
2695 AC_ARG_WITH(system-lockfile,
2696     AS_HELP_STRING([--with-system-lockfile[=file]],
2697         [Detect a system lockfile program or use the \$file argument.]))
2699 AC_ARG_WITH(webdav,
2700     AS_HELP_STRING([--without-webdav],
2701         [Disable WebDAV support in the UCB.]))
2703 AC_ARG_WITH(linker-hash-style,
2704     AS_HELP_STRING([--with-linker-hash-style],
2705         [Use linker with --hash-style=<style> when linking shared objects.
2706          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2707          if supported on the build system, and "sysv" otherwise.]))
2709 AC_ARG_WITH(jdk-home,
2710     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2711         [If you have installed JDK 8 or later on your system please supply the
2712          path here. Note that this is not the location of the java command but the
2713          location of the entire distribution. In case of cross-compiling, this
2714          is the JDK of the host os. Use --with-build-platform-configure-options
2715          to point to a different build platform JDK.]),
2718 AC_ARG_WITH(help,
2719     AS_HELP_STRING([--with-help],
2720         [Enable the build of help. There is a special parameter "common" that
2721          can be used to bundle only the common part, .e.g help-specific icons.
2722          This is useful when you build the helpcontent separately.])
2723     [
2724                           Usage:     --with-help    build the old local help
2725                                  --without-help     no local help (default)
2726                                  --with-help=html   build the new HTML local help
2727                                  --with-help=online build the new HTML online help
2728     ],
2731 AC_ARG_WITH(omindex,
2732    AS_HELP_STRING([--with-omindex],
2733         [Enable the support of xapian-omega index for online help.])
2734    [
2735                          Usage: --with-omindex=server prepare the pages for omindex
2736                                 but let xapian-omega be built in server.
2737                                 --with-omindex=noxap do not prepare online pages
2738                                 for xapian-omega
2739   ],
2742 libo_FUZZ_ARG_WITH(java,
2743     AS_HELP_STRING([--with-java=<java command>],
2744         [Specify the name of the Java interpreter command. Typically "java"
2745          which is the default.
2747          To build without support for Java components, applets, accessibility
2748          or the XML filters written in Java, use --without-java or --with-java=no.]),
2749     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2750     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2753 AC_ARG_WITH(jvm-path,
2754     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2755         [Use a specific JVM search path at runtime.
2756          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2759 AC_ARG_WITH(ant-home,
2760     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2761         [If you have installed Apache Ant on your system, please supply the path here.
2762          Note that this is not the location of the Ant binary but the location
2763          of the entire distribution.]),
2766 AC_ARG_WITH(symbol-config,
2767     AS_HELP_STRING([--with-symbol-config],
2768         [Configuration for the crashreport symbol upload]),
2769         [],
2770         [with_symbol_config=no])
2772 AC_ARG_WITH(export-validation,
2773     AS_HELP_STRING([--without-export-validation],
2774         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2775 ,with_export_validation=auto)
2777 AC_ARG_WITH(bffvalidator,
2778     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2779         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2780          Requires installed Microsoft Office Binary File Format Validator.
2781          Note: export-validation (--with-export-validation) is required to be turned on.
2782          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2783 ,with_bffvalidator=no)
2785 libo_FUZZ_ARG_WITH(junit,
2786     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2787         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2788          --without-junit disables those tests. Not relevant in the --without-java case.]),
2789 ,with_junit=yes)
2791 AC_ARG_WITH(hamcrest,
2792     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2793         [Specifies the hamcrest jar file to use for JUnit-based tests.
2794          --without-junit disables those tests. Not relevant in the --without-java case.]),
2795 ,with_hamcrest=yes)
2797 AC_ARG_WITH(perl-home,
2798     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2799         [If you have installed Perl 5 Distribution, on your system, please
2800          supply the path here. Note that this is not the location of the Perl
2801          binary but the location of the entire distribution.]),
2804 libo_FUZZ_ARG_WITH(doxygen,
2805     AS_HELP_STRING(
2806         [--with-doxygen=<absolute path to doxygen executable>],
2807         [Only relevant when --enable-odk is set. Specifies the doxygen
2808          executable to use when generating ODK C/C++ documentation.
2809          --without-doxygen disables generation of ODK C/C++ documentation.]),
2810 ,with_doxygen=yes)
2812 AC_ARG_WITH(visual-studio,
2813     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2814         [Specify which Visual Studio version to use in case several are
2815          installed. Currently 2019 (default) and 2022 are supported.]),
2818 AC_ARG_WITH(windows-sdk,
2819     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2820         [Specify which Windows SDK, or "Windows Kit", version to use
2821          in case the one that came with the selected Visual Studio
2822          is not what you want for some reason. Note that not all compiler/SDK
2823          combinations are supported. The intent is that this option should not
2824          be needed.]),
2827 AC_ARG_WITH(lang,
2828     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2829         [Use this option to build LibreOffice with additional UI language support.
2830          English (US) is always included by default.
2831          Separate multiple languages with space.
2832          For all languages, use --with-lang=ALL.]),
2835 AC_ARG_WITH(locales,
2836     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2837         [Use this option to limit the locale information built in.
2838          Separate multiple locales with space.
2839          Very experimental and might well break stuff.
2840          Just a desperate measure to shrink code and data size.
2841          By default all the locales available is included.
2842          Just works with --disable-dynloading. Defaults to "ALL".
2843          This option is completely unrelated to --with-lang.])
2844     [
2845                           Affects also our character encoding conversion
2846                           tables for encodings mainly targeted for a
2847                           particular locale, like EUC-CN and EUC-TW for
2848                           zh, ISO-2022-JP for ja.
2850                           Affects also our add-on break iterator data for
2851                           some languages.
2853                           For the default, all locales, don't use this switch at all.
2854                           Specifying just the language part of a locale means all matching
2855                           locales will be included.
2856     ],
2859 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2860 # and also by Mariadb/Mysql and libcurl since LibO 24.8
2861 libo_FUZZ_ARG_WITH(krb5,
2862     AS_HELP_STRING([--with-krb5],
2863         [Enable MIT Kerberos 5 support in modules that support it.
2864          By default automatically enabled on platforms
2865          where a good system Kerberos 5 is available.]),
2868 libo_FUZZ_ARG_WITH(gssapi,
2869     AS_HELP_STRING([--with-gssapi],
2870         [Enable GSSAPI support in modules that support it.
2871          By default automatically enabled on platforms
2872          where a good system GSSAPI is available.]),
2875 libo_FUZZ_ARG_WITH(lxml,
2876     AS_HELP_STRING([--without-lxml],
2877         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2878          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2879          report widget classes and ids.]),
2882 libo_FUZZ_ARG_WITH(latest-c++,
2883     AS_HELP_STRING([--with-latest-c++],
2884         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2885          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2886         [with_latest_c__=no])
2888 AC_ARG_WITH(gtk3-build,
2889     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2890         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2891          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2893 AC_ARG_WITH(keep-awake,
2894     AS_HELP_STRING([--with-keep-awake],
2895         [command to prefix make with in order to prevent the system from going to sleep/suspend
2896          while building.
2897          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2898          and caffeinate on macOS]))
2900 AC_ARG_WITH(dotnet,
2901     AS_HELP_STRING([--with-dotnet=<absolute path to dotnet executable>],
2902         [Specify the dotnet executable used to build .NET bindings and components.
2903          Requires .NET SDK 8 or higher. To disable building .NET components, use
2904          --without-dotnet or --with-dotnet=no.]))
2906 dnl ===================================================================
2907 dnl Branding
2908 dnl ===================================================================
2910 AC_ARG_WITH(branding,
2911     AS_HELP_STRING([--with-branding=/path/to/images],
2912         [Use given path to retrieve branding images set.])
2913     [
2914                           Search for intro.png about.svg and logo.svg.
2915                           If any is missing, default ones will be used instead.
2917                           Search also progress.conf for progress
2918                           settings on intro screen :
2920                           PROGRESSBARCOLOR="255,255,255" Set color of
2921                           progress bar. Comma separated RGB decimal values.
2922                           PROGRESSSIZE="407,6" Set size of progress bar.
2923                           Comma separated decimal values (width, height).
2924                           PROGRESSPOSITION="61,317" Set position of progress
2925                           bar from left,top. Comma separated decimal values.
2926                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2927                           bar frame. Comma separated RGB decimal values.
2928                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2929                           bar text. Comma separated RGB decimal values.
2930                           PROGRESSTEXTBASELINE="287" Set vertical position of
2931                           progress bar text from top. Decimal value.
2933                           Default values will be used if not found.
2934     ],
2938 AC_ARG_WITH(extra-buildid,
2939     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2940         [Show addition build identification in about dialog.]),
2944 AC_ARG_WITH(vendor,
2945     AS_HELP_STRING([--with-vendor="John the Builder"],
2946         [Set vendor of the build.]),
2949 AC_ARG_WITH(privacy-policy-url,
2950     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2951         [The URL to your privacy policy (needed when
2952          enabling online-update or crashreporting via breakpad)]),
2953         [if test "x$with_privacy_policy_url" = "xyes"; then
2954             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2955          elif test "x$with_privacy_policy_url" = "xno"; then
2956             with_privacy_policy_url="undefined"
2957          fi]
2958 ,[with_privacy_policy_url="undefined"])
2960 AC_ARG_WITH(android-package-name,
2961     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2962         [Set Android package name of the build.]),
2965 AC_ARG_WITH(compat-oowrappers,
2966     AS_HELP_STRING([--with-compat-oowrappers],
2967         [Install oo* wrappers in parallel with
2968          lo* ones to keep backward compatibility.
2969          Has effect only with make distro-pack-install]),
2972 AC_ARG_WITH(os-version,
2973     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2974         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2977 AC_ARG_WITH(parallelism,
2978     AS_HELP_STRING([--with-parallelism],
2979         [Number of jobs to run simultaneously during build. Parallel builds can
2980         save a lot of time on multi-cpu machines. Defaults to the number of
2981         CPUs on the machine, unless you configure --enable-icecream - then to
2982         40.]),
2985 AC_ARG_WITH(all-tarballs,
2986     AS_HELP_STRING([--with-all-tarballs],
2987         [Download all external tarballs unconditionally]))
2989 AC_ARG_WITH(gdrive-client-id,
2990     AS_HELP_STRING([--with-gdrive-client-id],
2991         [Provides the client id of the application for OAuth2 authentication
2992         on Google Drive. If either this or --with-gdrive-client-secret is
2993         empty, the feature will be disabled]),
2996 AC_ARG_WITH(gdrive-client-secret,
2997     AS_HELP_STRING([--with-gdrive-client-secret],
2998         [Provides the client secret of the application for OAuth2
2999         authentication on Google Drive. If either this or
3000         --with-gdrive-client-id is empty, the feature will be disabled]),
3003 AC_ARG_WITH(alfresco-cloud-client-id,
3004     AS_HELP_STRING([--with-alfresco-cloud-client-id],
3005         [Provides the client id of the application for OAuth2 authentication
3006         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
3007         empty, the feature will be disabled]),
3010 AC_ARG_WITH(alfresco-cloud-client-secret,
3011     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
3012         [Provides the client secret of the application for OAuth2
3013         authentication on Alfresco Cloud. If either this or
3014         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
3017 AC_ARG_WITH(onedrive-client-id,
3018     AS_HELP_STRING([--with-onedrive-client-id],
3019         [Provides the client id of the application for OAuth2 authentication
3020         on OneDrive. If either this or --with-onedrive-client-secret is
3021         empty, the feature will be disabled]),
3024 AC_ARG_WITH(onedrive-client-secret,
3025     AS_HELP_STRING([--with-onedrive-client-secret],
3026         [Provides the client secret of the application for OAuth2
3027         authentication on OneDrive. If either this or
3028         --with-onedrive-client-id is empty, the feature will be disabled]),
3031 dnl Check for coredumpctl support to present information about crashing test processes:
3032 AC_ARG_WITH(coredumpctl,
3033     AS_HELP_STRING([--with-coredumpctl],
3034         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
3035         processes.]))
3037 AC_ARG_WITH(buildconfig-recorded,
3038     AS_HELP_STRING([--with-buildconfig-recorded],
3039         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
3042 AC_MSG_CHECKING([whether to record build config])
3043 if test -z "$with_buildconfig_recorded"; then
3044     with_buildconfig_recorded=no
3046 if test "$with_buildconfig_recorded" = no; then
3047     AC_MSG_RESULT([no])
3048 else
3049     AC_MSG_RESULT([yes])
3050     # replace backslashes, to get a valid c++ string
3051     config_args=$(echo $ac_configure_args | tr '\\' '/')
3052     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
3053     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
3056 dnl ===================================================================
3057 dnl Do we want to use pre-build binary tarball for recompile
3058 dnl ===================================================================
3060 if test "$enable_library_bin_tar" = "yes" ; then
3061     USE_LIBRARY_BIN_TAR=TRUE
3062 else
3063     USE_LIBRARY_BIN_TAR=
3065 AC_SUBST(USE_LIBRARY_BIN_TAR)
3067 dnl ===================================================================
3068 dnl Test whether build target is Release Build
3069 dnl ===================================================================
3070 AC_MSG_CHECKING([whether build target is Release Build])
3071 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
3072     AC_MSG_RESULT([no])
3073     ENABLE_RELEASE_BUILD=
3074     dnl Pu the value on one line as make (at least on macOS) seems to ignore
3075     dnl the newlines and then complains about spaces.
3076     GET_TASK_ALLOW_ENTITLEMENT='<!-- We want to be able to debug a hardened process when not building for release --><key>com.apple.security.get-task-allow</key><true/>'
3077 else
3078     AC_MSG_RESULT([yes])
3079     ENABLE_RELEASE_BUILD=TRUE
3080     GET_TASK_ALLOW_ENTITLEMENT=
3082 AC_SUBST(ENABLE_RELEASE_BUILD)
3083 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
3085 dnl ===================================================================
3086 dnl Test whether build should auto use hardening compiler flags
3087 dnl ===================================================================
3088 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3089 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3090     AC_MSG_RESULT([no])
3091     ENABLE_HARDENING_FLAGS=
3092 else
3093     AC_MSG_RESULT([yes])
3094     ENABLE_HARDENING_FLAGS=TRUE
3096 AC_SUBST(ENABLE_HARDENING_FLAGS)
3098 AC_MSG_CHECKING([whether to build a Community flavor])
3099 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3100     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3101     AC_MSG_RESULT([yes])
3102 else
3103     AC_MSG_RESULT([no])
3106 dnl ===================================================================
3107 dnl Test whether to sign Windows Build
3108 dnl ===================================================================
3109 AC_MSG_CHECKING([whether to sign windows build])
3110 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3111     AC_MSG_RESULT([yes])
3112     WINDOWS_BUILD_SIGNING="TRUE"
3113 else
3114     AC_MSG_RESULT([no])
3115     WINDOWS_BUILD_SIGNING="FALSE"
3117 AC_SUBST(WINDOWS_BUILD_SIGNING)
3119 dnl ===================================================================
3120 dnl MacOSX build and runtime environment options
3121 dnl ===================================================================
3123 AC_ARG_WITH(macosx-version-min-required,
3124     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3125         [set the minimum OS version needed to run the built LibreOffice])
3126     [
3127                           e. g.: --with-macosx-version-min-required=10.15
3128     ],
3131 dnl ===================================================================
3132 dnl Check for incompatible options set by fuzzing, and reset those
3133 dnl automatically to working combinations
3134 dnl ===================================================================
3136 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3137         "$enable_dbus" != "$enable_avahi"; then
3138     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3139     enable_avahi=$enable_dbus
3142 add_lopath_after ()
3144     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3145         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3146     fi
3149 add_lopath_before ()
3151     local IFS=${P_SEP}
3152     local path_cleanup
3153     local dir
3154     for dir in $LO_PATH ; do
3155         if test "$dir" != "$1" ; then
3156             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3157         fi
3158     done
3159     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3162 dnl ===================================================================
3163 dnl check for required programs (grep, awk, sed, bash)
3164 dnl ===================================================================
3166 pathmunge ()
3168     local new_path
3169     if test -n "$1"; then
3170         if test "$build_os" = "cygwin"; then
3171             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3172                 PathFormat "$1"
3173                 new_path=`cygpath -sm "$formatted_path"`
3174             else
3175                 PathFormat "$1"
3176                 new_path=`cygpath -u "$formatted_path"`
3177             fi
3178         else
3179             new_path="$1"
3180         fi
3181         if test "$2" = "after"; then
3182             add_lopath_after "$new_path"
3183         else
3184             add_lopath_before "$new_path"
3185         fi
3186     fi
3189 AC_PROG_AWK
3190 AC_PATH_PROG( AWK, $AWK)
3191 if test -z "$AWK"; then
3192     AC_MSG_ERROR([install awk to run this script])
3195 AC_PATH_PROG(BASH, bash)
3196 if test -z "$BASH"; then
3197     AC_MSG_ERROR([bash not found in \$PATH])
3199 AC_SUBST(BASH)
3201 # prefer parallel compression tools, if available
3202 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3203 if test -z "$COMPRESSIONTOOL"; then
3204     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3205     if test -z "$COMPRESSIONTOOL"; then
3206         AC_MSG_ERROR([gzip not found in \$PATH])
3207     fi
3209 AC_SUBST(COMPRESSIONTOOL)
3211 AC_MSG_CHECKING([for GNU or BSD tar])
3212 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3213     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3214     if test $? -eq 0;  then
3215         GNUTAR=$a
3216         break
3217     fi
3218 done
3219 AC_MSG_RESULT($GNUTAR)
3220 if test -z "$GNUTAR"; then
3221     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3223 AC_SUBST(GNUTAR)
3225 AC_MSG_CHECKING([for tar's option to strip components])
3226 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3227 if test $? -eq 0; then
3228     STRIP_COMPONENTS="--strip-components"
3229 else
3230     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3231     if test $? -eq 0; then
3232         STRIP_COMPONENTS="--strip-path"
3233     else
3234         STRIP_COMPONENTS="unsupported"
3235     fi
3237 AC_MSG_RESULT($STRIP_COMPONENTS)
3238 if test x$STRIP_COMPONENTS = xunsupported; then
3239     AC_MSG_ERROR([you need a tar that is able to strip components.])
3241 AC_SUBST(STRIP_COMPONENTS)
3243 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3244 dnl desktop OSes from "mobile" ones.
3246 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3247 dnl In other words, that when building for an OS that is not a
3248 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3250 dnl Note the direction of the implication; there is no assumption that
3251 dnl cross-compiling would imply a non-desktop OS.
3253 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3254     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3255     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3256     if test "$_os" != Emscripten; then
3257         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3258     fi
3261 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3262 # also work with the default gtk3 plugin.
3263 if test "$enable_wasm_strip" = "yes"; then
3264     enable_avmedia=no
3265     enable_libcmis=no
3266     enable_coinmp=no
3267     enable_cups=no
3268     enable_database_connectivity=no
3269     enable_dbus=no
3270     enable_dconf=no
3271     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3272     enable_extension_integration=no
3273     enable_extensions=no
3274     enable_extension_update=no
3275     enable_gio=no
3276     enable_gpgmepp=no
3277     enable_ldap=no
3278     enable_lotuswordpro=no
3279     enable_lpsolve=no
3280     enable_nss=no
3281     enable_odk=no
3282     enable_online_update=no
3283     enable_opencl=no
3284     enable_pdfimport=no
3285     enable_randr=no
3286     enable_report_builder=no
3287     enable_scripting=no
3288     enable_sdremote_bluetooth=no
3289     enable_skia=no
3290     enable_xmlhelp=no
3291     enable_zxing=no
3292     test_libepubgen=no
3293     test_libcdr=no
3294     test_libcmis=no
3295     test_libetonyek=no
3296     test_libfreehand=no
3297     test_libmspub=no
3298     test_libpagemaker=no
3299     test_libqxp=no
3300     test_libvisio=no
3301     test_libzmf=no
3302     with_galleries=no
3303     with_gssapi=no
3304     with_templates=no
3305     with_x=no
3307     test "${with_fonts+set}" = set || with_fonts=yes
3309     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3310     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3311     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3312     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3313 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3314     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3315     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3316     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3317     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3318 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3319     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3320     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3321     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3322     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3323     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3324     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3325     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3326     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3329 # Whether to build "avmedia" functionality or not.
3331 if test "$enable_avmedia" = yes; then
3332     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3333     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3334 else
3335     test_gstreamer_1_0=no
3338 # Decide whether to build database connectivity stuff (including Base) or not.
3339 if test "$enable_database_connectivity" != no; then
3340     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3341     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3342 else
3343     if test "$_os" = iOS; then
3344         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3345     fi
3346     disable_database_connectivity_dependencies
3349 if test -z "$enable_extensions"; then
3350     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3351     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3352         enable_extensions=yes
3353     fi
3356 DISABLE_SCRIPTING=''
3357 if test "$enable_scripting" = yes; then
3358     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3359     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3360 else
3361     DISABLE_SCRIPTING='TRUE'
3362     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3365 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3366     # Disable dynamic_loading always for iOS and Android
3367     enable_dynamic_loading=no
3368 elif test -z "$enable_dynamic_loading"; then
3369     # Otherwise enable it unless specifically disabled
3370     enable_dynamic_loading=yes
3373 DISABLE_DYNLOADING=''
3374 if test "$enable_dynamic_loading" = yes; then
3375     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3376 else
3377     DISABLE_DYNLOADING='TRUE'
3378     if test $_os != iOS -a $_os != Android; then
3379         enable_database_connectivity=no
3380         enable_nss=no
3381         enable_odk=no
3382         enable_python=no
3383         enable_skia=no
3384         with_java=no
3385     fi
3387 AC_SUBST(DISABLE_DYNLOADING)
3389 ENABLE_CUSTOMTARGET_COMPONENTS=
3390 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3391     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3392     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3393         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3394     fi
3396 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3398 if test "$enable_extensions" = yes; then
3399     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3400     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3401 else
3402     enable_extension_integration=no
3403     enable_extension_update=no
3406 # remember SYSBASE value
3407 AC_SUBST(SYSBASE)
3409 dnl ===================================================================
3410 dnl  Sort out various gallery compilation options
3411 dnl ===================================================================
3412 WITH_GALLERY_BUILD=TRUE
3413 AC_MSG_CHECKING([how to build and package galleries])
3414 if test -n "${with_galleries}"; then
3415     if test "$with_galleries" = "build"; then
3416         if test "$enable_database_connectivity" = no; then
3417             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3418         fi
3419         AC_MSG_RESULT([build from source images internally])
3420     elif test "$with_galleries" = "no"; then
3421         WITH_GALLERY_BUILD=
3422         AC_MSG_RESULT([disable non-internal gallery build])
3423     else
3424         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3425     fi
3426 else
3427     if test $_os != iOS -a $_os != Android; then
3428         AC_MSG_RESULT([internal src images for desktop])
3429     else
3430         WITH_GALLERY_BUILD=
3431         AC_MSG_RESULT([disable src image build])
3432     fi
3434 AC_SUBST(WITH_GALLERY_BUILD)
3436 dnl ===================================================================
3437 dnl  Sort out various templates compilation options
3438 dnl ===================================================================
3439 WITH_TEMPLATES=TRUE
3440 AC_MSG_CHECKING([build with or without template files])
3441 if test -n "${with_templates}"; then
3442     if test "$with_templates" = "yes"; then
3443         AC_MSG_RESULT([enable all templates])
3444     elif test "$with_templates" = "no"; then
3445         WITH_TEMPLATES=
3446         AC_MSG_RESULT([disable non-internal templates])
3447     else
3448         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3449     fi
3450 else
3451     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3452         AC_MSG_RESULT([enable all templates])
3453     else
3454         WITH_TEMPLATES=
3455         AC_MSG_RESULT([disable non-internal templates])
3456     fi
3458 AC_SUBST(WITH_TEMPLATES)
3460 dnl ===================================================================
3461 dnl  Checks if ccache is available
3462 dnl ===================================================================
3463 CCACHE_DEPEND_MODE=
3464 if test "$enable_ccache" = "no"; then
3465     CCACHE=""
3466 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3467     case "%$CC%$CXX%" in
3468     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3469     # assume that's good then
3470     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3471         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3472         CCACHE_DEPEND_MODE=1
3473         ;;
3474     *)
3475         # try to use our own ccache if it is available and CCACHE was not already defined
3476         if test -z "$CCACHE"; then
3477             if test "$_os" = "WINNT"; then
3478                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3479             fi
3480             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3481                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3482             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3483                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3484             fi
3485         fi
3486         AC_PATH_PROG([CCACHE],[ccache],[not found])
3487         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3488             CCACHE=`win_short_path_for_make "$CCACHE"`
3489             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3490             rm -f conftest.txt
3491             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3492             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3493             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3494                 AC_MSG_RESULT(yes)
3495             else
3496                 AC_MSG_RESULT(no)
3497                 CCACHE="not found"
3498             fi
3499             rm -f conftest.txt
3500         fi
3501         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3502             # on windows/VC perhaps sccache is around?
3503             case "%$CC%$CXX%" in
3504             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3505             # assume that's good then
3506             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3507                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3508                 CCACHE_DEPEND_MODE=1
3509                 SCCACHE=1
3510                 ;;
3511             *)
3512                 # for sharing code below, reuse CCACHE env var
3513                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3514                 if test "$CCACHE" != "not found"; then
3515                     CCACHE=`win_short_path_for_make "$CCACHE"`
3516                     SCCACHE=1
3517                     CCACHE_DEPEND_MODE=1
3518                 fi
3519                 ;;
3520             esac
3521         fi
3522         if test "$CCACHE" = "not found"; then
3523             CCACHE=""
3524         fi
3525         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3526             CCACHE_DEPEND_MODE=1
3527             # Need to check for ccache version: otherwise prevents
3528             # caching of the results (like "-x objective-c++" for Mac)
3529             if test $_os = Darwin -o $_os = iOS; then
3530                 # Check ccache version
3531                 AC_MSG_CHECKING([whether version of ccache is suitable])
3532                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3533                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3534                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3535                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3536                 else
3537                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3538                     CCACHE=""
3539                     CCACHE_DEPEND_MODE=
3540                 fi
3541             fi
3542         fi
3543         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3544             AC_MSG_ERROR([No suitable ccache found])
3545         fi
3546         ;;
3547     esac
3548 else
3549     CCACHE=""
3551 if test "$enable_ccache" = "nodepend"; then
3552     CCACHE_DEPEND_MODE=""
3554 AC_SUBST(CCACHE_DEPEND_MODE)
3556 # sccache defaults are good enough
3557 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3558     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3559     # or (...) max_size = 20.0 G
3560     # -p works with both 4.2 and 4.4
3561     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3562     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3563     if test "$ccache_size" = ""; then
3564         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3565         if test "$ccache_size" = ""; then
3566             ccache_size=0
3567         fi
3568         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3569         if test $ccache_size -lt 1024; then
3570             CCACHE=""
3571             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3572             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3573         else
3574             # warn that ccache may be too small for debug build
3575             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3576             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3577         fi
3578     else
3579         if test $ccache_size -lt 5; then
3580             #warn that ccache may be too small for debug build
3581             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3582             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3583         fi
3584     fi
3587 ENABLE_Z7_DEBUG=
3588 if test "$enable_z7_debug" != no; then
3589     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3590         ENABLE_Z7_DEBUG=TRUE
3591     fi
3592 else
3593     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3594     add_warning "ccache will not work with --disable-z7-debug"
3596 AC_SUBST(ENABLE_Z7_DEBUG)
3598 dnl ===================================================================
3599 dnl  Checks for C compiler,
3600 dnl  The check for the C++ compiler is later on.
3601 dnl ===================================================================
3602 if test "$_os" != "WINNT"; then
3603     GCC_HOME_SET="true"
3604     AC_MSG_CHECKING([gcc home])
3605     if test -z "$with_gcc_home"; then
3606         if test "$enable_icecream" = "yes"; then
3607             if test -d "/usr/lib/icecc/bin"; then
3608                 GCC_HOME="/usr/lib/icecc/"
3609             elif test -d "/usr/libexec/icecc/bin"; then
3610                 GCC_HOME="/usr/libexec/icecc/"
3611             elif test -d "/opt/icecream/bin"; then
3612                 GCC_HOME="/opt/icecream/"
3613             else
3614                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3616             fi
3617         else
3618             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3619             GCC_HOME_SET="false"
3620         fi
3621     else
3622         GCC_HOME="$with_gcc_home"
3623     fi
3624     AC_MSG_RESULT($GCC_HOME)
3626     if test "$GCC_HOME_SET" = "true"; then
3627         if test -z "$CC"; then
3628             CC="$GCC_HOME/bin/gcc"
3629             CC_BASE="gcc"
3630         fi
3631         if test -z "$CXX"; then
3632             CXX="$GCC_HOME/bin/g++"
3633             CXX_BASE="g++"
3634         fi
3635     fi
3638 COMPATH=`dirname "$CC"`
3639 if test "$COMPATH" = "."; then
3640     AC_PATH_PROGS(COMPATH, $CC)
3641     dnl double square bracket to get single because of M4 quote...
3642     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3644 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3646 dnl ===================================================================
3647 dnl Java support
3648 dnl ===================================================================
3649 AC_MSG_CHECKING([whether to build with Java support])
3650 javacompiler="javac"
3651 javadoc="javadoc"
3652 if test "$with_java" != "no"; then
3653     if test "$DISABLE_SCRIPTING" = TRUE; then
3654         AC_MSG_RESULT([no, overridden by --disable-scripting])
3655         ENABLE_JAVA=""
3656         with_java=no
3657     else
3658         AC_MSG_RESULT([yes])
3659         ENABLE_JAVA="TRUE"
3660         AC_DEFINE(HAVE_FEATURE_JAVA)
3661     fi
3662 else
3663     AC_MSG_RESULT([no])
3664     ENABLE_JAVA=""
3667 AC_SUBST(ENABLE_JAVA)
3669 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3671 dnl ENABLE_JAVA="" indicate no Java support at all
3673 dnl ===================================================================
3674 dnl Check macOS SDK and compiler
3675 dnl ===================================================================
3677 if test $_os = Darwin; then
3679     # The SDK in the currently selected Xcode should be found.
3681     AC_MSG_CHECKING([what macOS SDK to use])
3682     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3683     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3684     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3685     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3686     # problems that existed in the PPC days with target versions not being respected or random
3687     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3688     # SDK version is enough, no need to do both...
3689     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3690     if test ! -d "$MACOSX_SDK_PATH"; then
3691         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3692     fi
3693     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3694     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3695     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3696     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3697     # 10.10.2 is 101002
3698     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3699     # correct version in case such an old SDK is specified, it will be rejected later anyway
3700     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3701     if test $MACOSX_SDK_VERSION -lt 101500; then
3702         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3703     fi
3704     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3705         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3706     fi
3707     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3709     AC_MSG_CHECKING([what minimum version of macOS to require])
3710     if test "$with_macosx_version_min_required" = "" ; then
3711         if test "$host_cpu" = x86_64; then
3712             with_macosx_version_min_required="10.15";
3713         else
3714             with_macosx_version_min_required="11.0";
3715         fi
3716     fi
3717     # see same notes about MACOSX_SDK_VERSION above
3718     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3719     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3720         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3721     fi
3722     AC_MSG_RESULT([$with_macosx_version_min_required])
3724     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3725     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3726         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3727     else
3728         AC_MSG_RESULT([yes])
3729     fi
3731     # export this so that "xcrun" invocations later return matching values
3732     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3733     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3734     export DEVELOPER_DIR
3735     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3736     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3738     AC_MSG_CHECKING([whether Xcode is new enough])
3739     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3740     my_xcode_ver2=${my_xcode_ver1#Xcode }
3741     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3742     if test "$my_xcode_ver3" -ge 1205; then
3743         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3744         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3745             if test "$my_xcode_ver3" -eq 1500; then
3746                 dnl the bug was already fixed on 15.1 and 15.2 still has the same OS requirements as 15.0
3747                 dnl in other words all affected users could update to a working Xcode version
3748                 AC_MSG_WARN([Use a current version of XCode or bump the minimum deployment target])
3749                 AC_MSG_WARN([[see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking]])
3750                 AC_MSG_ERROR([Xcode 15.0 has a bug in the new linker that causes runtime crashes on macOS 11 - aborting])
3751             fi
3752         fi
3753     else
3754         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3755     fi
3757     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3758     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3760     LIBTOOL=/usr/bin/libtool
3761     INSTALL_NAME_TOOL=install_name_tool
3762     if test -z "$save_CC"; then
3763         stdlib=-stdlib=libc++
3765         AC_MSG_CHECKING([what C compiler to use])
3766         CC="`xcrun -find clang`"
3767         CC_BASE=`first_arg_basename "$CC"`
3768         if test "$host_cpu" = x86_64; then
3769             CC+=" -target x86_64-apple-macos"
3770         else
3771             CC+=" -target arm64-apple-macos"
3772         fi
3773         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3774         AC_MSG_RESULT([$CC])
3776         AC_MSG_CHECKING([what C++ compiler to use])
3777         CXX="`xcrun -find clang++`"
3778         CXX_BASE=`first_arg_basename "$CXX"`
3779         if test "$host_cpu" = x86_64; then
3780             CXX+=" -target x86_64-apple-macos"
3781         else
3782             CXX+=" -target arm64-apple-macos"
3783         fi
3784         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3785         AC_MSG_RESULT([$CXX])
3787         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3788         AR=`xcrun -find ar`
3789         NM=`xcrun -find nm`
3790         STRIP=`xcrun -find strip`
3791         LIBTOOL=`xcrun -find libtool`
3792         RANLIB=`xcrun -find ranlib`
3793     fi
3795     AC_MSG_CHECKING([whether to do code signing])
3797     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3798         AC_MSG_RESULT([no])
3799     else
3800         if test "$enable_macosx_code_signing" = yes; then
3801             # By default use the first suitable certificate (?).
3803             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3804             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3805             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3806             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3807             # "Developer ID Application" one.
3808             identity="Developer ID Application:"
3809         else
3810             identity=$enable_macosx_code_signing
3811         fi
3812         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3813         if test -n "$identity"; then
3814             MACOSX_CODESIGNING_IDENTITY=$identity
3815             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3816             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3817         else
3818             AC_MSG_ERROR([cannot determine identity to use])
3819         fi
3820     fi
3822     AC_MSG_CHECKING([whether to create a Mac App Store package])
3824     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3825         AC_MSG_RESULT([no])
3826     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3827         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3828     else
3829         if test "$enable_macosx_package_signing" = yes; then
3830             # By default use the first suitable certificate.
3831             # It should be a "3rd Party Mac Developer Installer" one
3832             identity="3rd Party Mac Developer Installer:"
3833         else
3834             identity=$enable_macosx_package_signing
3835         fi
3836         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3837         if test -n "$identity"; then
3838             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3839             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3840             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3841         else
3842             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3843         fi
3844     fi
3846     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3847         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3848     fi
3850     AC_MSG_CHECKING([whether to sandbox the application])
3852     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3853         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3854     elif test "$enable_macosx_sandbox" = yes; then
3855         ENABLE_MACOSX_SANDBOX=TRUE
3856         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3857         AC_MSG_RESULT([yes])
3858     else
3859         AC_MSG_RESULT([no])
3860     fi
3862     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3863     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3864     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3866     if test -n "$with_macosx_provisioning_profile" ; then
3867         if test ! -f "$with_macosx_provisioning_profile"; then
3868             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3869         else
3870             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3871             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3872                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3873                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3874                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3875         fi
3876     fi
3878 AC_SUBST(MACOSX_SDK_PATH)
3879 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3880 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3881 AC_SUBST(INSTALL_NAME_TOOL)
3882 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3883 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3884 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3885 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3886 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3887 AC_SUBST(MACOSX_PROVISIONING_INFO)
3888 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3889 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3890 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3892 dnl ===================================================================
3893 dnl Check iOS SDK and compiler
3894 dnl ===================================================================
3896 if test $_os = iOS; then
3897     AC_MSG_CHECKING([what iOS SDK to use])
3899     if test "$enable_ios_simulator" = "yes"; then
3900         platformlc=iphonesimulator
3901         versionmin=-mios-simulator-version-min=14.5
3902     else
3903         platformlc=iphoneos
3904         versionmin=-miphoneos-version-min=14.5
3905     fi
3907     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3909     if ! test -d "$sysroot"; then
3910         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3911     fi
3913     AC_MSG_RESULT($sysroot)
3915     stdlib="-stdlib=libc++"
3917     AC_MSG_CHECKING([what C compiler to use])
3918     CC="`xcrun -find clang`"
3919     CC_BASE=`first_arg_basename "$CC"`
3920     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3921     AC_MSG_RESULT([$CC])
3923     AC_MSG_CHECKING([what C++ compiler to use])
3924     CXX="`xcrun -find clang++`"
3925     CXX_BASE=`first_arg_basename "$CXX"`
3926     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3927     AC_MSG_RESULT([$CXX])
3929     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3930     AR=`xcrun -find ar`
3931     NM=`xcrun -find nm`
3932     STRIP=`xcrun -find strip`
3933     LIBTOOL=`xcrun -find libtool`
3934     RANLIB=`xcrun -find ranlib`
3937 AC_MSG_CHECKING([whether to treat the installation as read-only])
3939 if test $_os = Darwin; then
3940     enable_readonly_installset=yes
3941 elif test "$enable_extensions" != yes; then
3942     enable_readonly_installset=yes
3944 if test "$enable_readonly_installset" = yes; then
3945     AC_MSG_RESULT([yes])
3946     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3947 else
3948     AC_MSG_RESULT([no])
3951 dnl ===================================================================
3952 dnl Structure of install set
3953 dnl ===================================================================
3955 if test $_os = Darwin; then
3956     LIBO_BIN_FOLDER=MacOS
3957     LIBO_ETC_FOLDER=Resources
3958     LIBO_LIBEXEC_FOLDER=MacOS
3959     LIBO_LIB_FOLDER=Frameworks
3960     LIBO_LIB_PYUNO_FOLDER=Resources
3961     LIBO_SHARE_FOLDER=Resources
3962     LIBO_SHARE_HELP_FOLDER=Resources/help
3963     LIBO_SHARE_DOTNET_FOLDER=Resources/dotnet
3964     LIBO_SHARE_JAVA_FOLDER=Resources/java
3965     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3966     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3967     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3968     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3969     LIBO_URE_BIN_FOLDER=MacOS
3970     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3971     LIBO_URE_LIB_FOLDER=Frameworks
3972     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3973     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3974 elif test $_os = WINNT; then
3975     LIBO_BIN_FOLDER=program
3976     LIBO_ETC_FOLDER=program
3977     LIBO_LIBEXEC_FOLDER=program
3978     LIBO_LIB_FOLDER=program
3979     LIBO_LIB_PYUNO_FOLDER=program
3980     LIBO_SHARE_FOLDER=share
3981     LIBO_SHARE_HELP_FOLDER=help
3982     LIBO_SHARE_DOTNET_FOLDER=program/dotnet
3983     LIBO_SHARE_JAVA_FOLDER=program/classes
3984     LIBO_SHARE_PRESETS_FOLDER=presets
3985     LIBO_SHARE_READMES_FOLDER=readmes
3986     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3987     LIBO_SHARE_SHELL_FOLDER=program/shell
3988     LIBO_URE_BIN_FOLDER=program
3989     LIBO_URE_ETC_FOLDER=program
3990     LIBO_URE_LIB_FOLDER=program
3991     LIBO_URE_MISC_FOLDER=program
3992     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3993 else
3994     LIBO_BIN_FOLDER=program
3995     LIBO_ETC_FOLDER=program
3996     LIBO_LIBEXEC_FOLDER=program
3997     LIBO_LIB_FOLDER=program
3998     LIBO_LIB_PYUNO_FOLDER=program
3999     LIBO_SHARE_FOLDER=share
4000     LIBO_SHARE_HELP_FOLDER=help
4001     LIBO_SHARE_DOTNET_FOLDER=program/dotnet
4002     LIBO_SHARE_JAVA_FOLDER=program/classes
4003     LIBO_SHARE_PRESETS_FOLDER=presets
4004     LIBO_SHARE_READMES_FOLDER=readmes
4005     if test "$enable_fuzzers" != yes; then
4006         LIBO_SHARE_RESOURCE_FOLDER=program/resource
4007     else
4008         LIBO_SHARE_RESOURCE_FOLDER=resource
4009     fi
4010     LIBO_SHARE_SHELL_FOLDER=program/shell
4011     LIBO_URE_BIN_FOLDER=program
4012     LIBO_URE_ETC_FOLDER=program
4013     LIBO_URE_LIB_FOLDER=program
4014     LIBO_URE_MISC_FOLDER=program
4015     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
4017 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
4018 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
4019 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
4020 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
4021 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
4022 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
4023 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
4024 AC_DEFINE_UNQUOTED(LIBO_SHARE_DOTNET_FOLDER,"$LIBO_SHARE_DOTNET_FOLDER")
4025 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
4026 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
4027 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
4028 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
4029 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
4030 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
4031 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
4032 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
4033 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
4035 # Not all of them needed in config_host.mk, add more if need arises
4036 AC_SUBST(LIBO_BIN_FOLDER)
4037 AC_SUBST(LIBO_ETC_FOLDER)
4038 AC_SUBST(LIBO_LIB_FOLDER)
4039 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
4040 AC_SUBST(LIBO_SHARE_FOLDER)
4041 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
4042 AC_SUBST(LIBO_SHARE_DOTNET_FOLDER)
4043 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
4044 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
4045 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
4046 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
4047 AC_SUBST(LIBO_URE_BIN_FOLDER)
4048 AC_SUBST(LIBO_URE_ETC_FOLDER)
4049 AC_SUBST(LIBO_URE_LIB_FOLDER)
4050 AC_SUBST(LIBO_URE_MISC_FOLDER)
4051 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
4053 dnl ===================================================================
4054 dnl Windows specific tests and stuff
4055 dnl ===================================================================
4057 reg_get_value()
4059     # Return value: $regvalue
4060     unset regvalue
4062     if test "$build_os" = "wsl"; then
4063         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
4064         return
4065     elif test -n "$WSL_ONLY_AS_HELPER"; then
4066         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
4067         return
4068     fi
4070     local _regentry="/proc/registry${1}/${2}/${3}"
4071     if test -f "$_regentry"; then
4072         # Stop bash complaining about \0 bytes in input, as it can't handle them.
4073         # Registry keys read via /proc/registry* are always \0 terminated!
4074         local _regvalue=$(tr -d '\0' < "$_regentry")
4075         if test $? -eq 0; then
4076             regvalue=$_regvalue
4077         fi
4078     fi
4081 # Get a value from the 32-bit side of the Registry
4082 reg_get_value_32()
4084     reg_get_value "32" "$1" "$2"
4087 # Get a value from the 64-bit side of the Registry
4088 reg_get_value_64()
4090     reg_get_value "64" "$1" "$2"
4093 reg_list_values()
4095     # Return value: $reglist
4096     unset reglist
4098     if test "$build_os" = "wsl"; then
4099         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4100         return
4101     fi
4103     reglist=$(ls "/proc/registry${1}/${2}")
4106 # List values from the 32-bit side of the Registry
4107 reg_list_values_32()
4109     reg_list_values "32" "$1"
4112 # List values from the 64-bit side of the Registry
4113 reg_list_values_64()
4115     reg_list_values "64" "$1"
4118 case "$host_os" in
4119 cygwin*|wsl*)
4120     COM=MSC
4121     OS=WNT
4122     RTL_OS=Windows
4123     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4124         P_SEP=";"
4125     else
4126         P_SEP=:
4127     fi
4128     case "$host_cpu" in
4129     x86_64)
4130         CPUNAME=X86_64
4131         RTL_ARCH=X86_64
4132         PLATFORMID=windows_x86_64
4133         WINDOWS_X64=1
4134         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4135         WIN_HOST_ARCH="x64"
4136         WIN_MULTI_ARCH="x86"
4137         WIN_HOST_BITS=64
4138         ;;
4139     i*86)
4140         CPUNAME=INTEL
4141         RTL_ARCH=x86
4142         PLATFORMID=windows_x86
4143         WIN_HOST_ARCH="x86"
4144         WIN_HOST_BITS=32
4145         WIN_OTHER_ARCH="x64"
4146         ;;
4147     aarch64)
4148         CPUNAME=AARCH64
4149         RTL_ARCH=AARCH64
4150         PLATFORMID=windows_aarch64
4151         WINDOWS_X64=1
4152         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4153         WIN_HOST_ARCH="arm64"
4154         WIN_HOST_BITS=64
4155         with_ucrt_dir=no
4156         ;;
4157     *)
4158         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4159         ;;
4160     esac
4162     case "$build_cpu" in
4163     x86_64) WIN_BUILD_ARCH="x64" ;;
4164     i*86) WIN_BUILD_ARCH="x86" ;;
4165     aarch64) WIN_BUILD_ARCH="arm64" ;;
4166     *)
4167         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4168         ;;
4169     esac
4171     SCPDEFS="$SCPDEFS -D_MSC_VER"
4172     ;;
4173 esac
4175 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4176 # other-arch won't, but wouldn't break the build (x64 on x86).
4177 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4178     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4182 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4183     # To allow building Windows multi-arch releases without cross-tooling
4184     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4185         cross_compiling="yes"
4186     fi
4189 if test "$cross_compiling" = "yes"; then
4190     export CROSS_COMPILING=TRUE
4191     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4192         ENABLE_WASM_STRIP=TRUE
4193     fi
4194     if test "$_os" = "Emscripten"; then
4195         if test "$with_main_module" = "calc"; then
4196             ENABLE_WASM_STRIP_WRITER=TRUE
4197         elif test "$with_main_module" = "writer"; then
4198             ENABLE_WASM_STRIP_CALC=TRUE
4199         fi
4200     fi
4201 else
4202     CROSS_COMPILING=
4203     BUILD_TYPE="$BUILD_TYPE NATIVE"
4205 AC_SUBST(CROSS_COMPILING)
4206 AC_SUBST(ENABLE_WASM_STRIP)
4207 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4208 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4210 if test "$enable_emscripten_jspi" = yes; then
4211     ENABLE_EMSCRIPTEN_JSPI=TRUE
4212     AC_DEFINE(HAVE_EMSCRIPTEN_JSPI)
4213 else
4214     ENABLE_EMSCRIPTEN_JSPI=
4216 AC_SUBST(ENABLE_EMSCRIPTEN_JSPI)
4218 if test "$enable_emscripten_proxy_to_pthread" = yes; then
4219     ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=TRUE
4220     AC_DEFINE(HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD)
4221 else
4222     ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=
4224 AC_SUBST(ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD)
4226 if test "$enable_emscripten_proxy_posix_sockets" = yes; then
4227     ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=TRUE
4228     AC_DEFINE(HAVE_EMSCRIPTEN_PROXY_POSIX_SOCKETS)
4229 else
4230     ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=
4232 AC_SUBST(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS)
4234 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4235 # NOTE: must _not_ be used for bundled external libraries!
4236 ISYSTEM=
4237 if test "$GCC" = "yes"; then
4238     AC_MSG_CHECKING( for -isystem )
4239     save_CFLAGS=$CFLAGS
4240     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4241     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4242     CFLAGS=$save_CFLAGS
4243     if test -n "$ISYSTEM"; then
4244         AC_MSG_RESULT(yes)
4245     else
4246         AC_MSG_RESULT(no)
4247     fi
4249 if test -z "$ISYSTEM"; then
4250     # fall back to using -I
4251     ISYSTEM=-I
4253 AC_SUBST(ISYSTEM)
4255 dnl ===================================================================
4256 dnl  Check which Visual Studio compiler is used
4257 dnl ===================================================================
4259 map_vs_year_to_version()
4261     # Return value: $vsversion
4263     unset vsversion
4265     case $1 in
4266     2019)
4267         vsversion=16;;
4268     2022)
4269         vsversion=17;;
4270     2022preview)
4271         vsversion=17.12;;
4272     *)
4273         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4274     esac
4277 vs_versions_to_check()
4279     # Args: $1 (optional) : versions to check, in the order of preference
4280     # Return value: $vsversions
4282     unset vsversions
4284     if test -n "$1"; then
4285         map_vs_year_to_version "$1"
4286         vsversions=$vsversion
4287     else
4288         # Default version is 2019
4289         vsversions="16"
4290     fi
4293 win_get_env_from_vsdevcmdbat()
4295     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4296     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4297     PathFormat "$VC_PRODUCT_DIR"
4298     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4299     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4300     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4301     local result
4302     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4303         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4304     else
4305         chmod +x $WRAPPERBATCHFILEPATH
4306         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4307     fi
4308     rm -f $WRAPPERBATCHFILEPATH
4309     printf '%s' "$result"
4312 find_ucrt()
4314     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4315     if test -n "$regvalue"; then
4316         PathFormat "$regvalue"
4317         UCRTSDKDIR=$formatted_path_unix
4318         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4319         if test -n "$regvalue"; then
4320             UCRTVERSION="$regvalue".0
4321         fi
4323         # Rest if not exist
4324         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4325           UCRTSDKDIR=
4326         fi
4327     fi
4328     if test -z "$UCRTSDKDIR"; then
4329         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4330         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4331         if test -f "$ide_env_file"; then
4332             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4333             UCRTSDKDIR=$formatted_path_unix
4334             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4335             dnl Hack needed at least by tml:
4336             if test "$UCRTVERSION" = 10.0.15063.0 \
4337                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4338                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4339             then
4340                 UCRTVERSION=10.0.14393.0
4341             fi
4342         else
4343           AC_MSG_ERROR([No UCRT found])
4344         fi
4345     fi
4348 find_msvc()
4350     # Find Visual C++
4351     # Args: $1 (optional) : The VS version year
4352     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4354     unset vctest vctoolset vcnumwithdot vcbuildnumber
4356     vs_versions_to_check "$1"
4357     if test "$build_os" = wsl; then
4358         vswhere="$PROGRAMFILESX86"
4359         if test -z "$vswhere"; then
4360             vswhere="c:\\Program Files (x86)"
4361         fi
4362     elif test -n "$WSL_ONLY_AS_HELPER"; then
4363         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4364     else
4365         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4366     fi
4367     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4368     PathFormat "$vswhere"
4369     vswhere=$formatted_path_unix
4370     for ver in $vsversions; do
4371         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4372         if test -z "$vswhereoutput"; then
4373             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4374         fi
4375         # Fall back to all MS products (this includes VC++ Build Tools)
4376         if ! test -n "$vswhereoutput"; then
4377             AC_MSG_CHECKING([VC++ Build Tools and similar])
4378             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4379         fi
4380         if test -n "$vswhereoutput"; then
4381             PathFormat "$vswhereoutput"
4382             vctest=$formatted_path_unix
4383             break
4384         fi
4385     done
4387     if test -n "$vctest"; then
4388         vcnumwithdot="$ver"
4389         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4390             vcnumwithdot=$vcnumwithdot.0
4391         fi
4392         case "$vcnumwithdot" in
4393         16.0)
4394             vcyear=2019
4395             vctoolset=v142
4396             ;;
4397         17.0 | 17.12)
4398             vcyear=2022
4399             vctoolset=v143
4400             ;;
4401         esac
4402         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4404     fi
4407 test_cl_exe()
4409     AC_MSG_CHECKING([$1 compiler])
4411     CL_EXE_PATH="$2/cl.exe"
4413     if test ! -f "$CL_EXE_PATH"; then
4414         if test "$1" = "multi-arch"; then
4415             AC_MSG_WARN([no compiler (cl.exe) in $2])
4416             return 1
4417         else
4418             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4419         fi
4420     fi
4422     dnl ===========================================================
4423     dnl  Check for the corresponding mspdb*.dll
4424     dnl ===========================================================
4426     # MSVC 15.0 has libraries from 14.0?
4427     mspdbnum="140"
4429     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4430         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4431     fi
4433     # The compiles has to find its shared libraries
4434     OLD_PATH="$PATH"
4435     TEMP_PATH=`cygpath -d "$2"`
4436     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4438     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4439         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4440     fi
4442     PATH="$OLD_PATH"
4444     AC_MSG_RESULT([$CL_EXE_PATH])
4447 SOLARINC=
4448 MSBUILD_PATH=
4449 DEVENV=
4450 if test "$_os" = "WINNT"; then
4451     AC_MSG_CHECKING([Visual C++])
4452     find_msvc "$with_visual_studio"
4453     if test -z "$vctest"; then
4454         if test -n "$with_visual_studio"; then
4455             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4456         else
4457             AC_MSG_ERROR([no Visual Studio installation found])
4458         fi
4459     fi
4460     AC_MSG_RESULT([])
4462     VC_PRODUCT_DIR="$vctest/VC"
4463     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4465     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4466     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4467         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4468         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4469         if test $? -ne 0; then
4470             WIN_MULTI_ARCH=""
4471             WIN_OTHER_ARCH=""
4472         fi
4473     fi
4475     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4476         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4477         test_cl_exe "build" "$MSVC_BUILD_PATH"
4478     fi
4480     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4481         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4482         test_cl_exe "host" "$MSVC_HOST_PATH"
4483     else
4484         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4485     fi
4487     AC_MSG_CHECKING([for short pathname of VC product directory])
4488     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4489     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4491     UCRTSDKDIR=
4492     UCRTVERSION=
4494     AC_MSG_CHECKING([for UCRT location])
4495     find_ucrt
4496     # find_ucrt errors out if it doesn't find it
4497     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4498     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4499     ucrtincpath_formatted=$formatted_path
4500     # SOLARINC is used for external modules and must be set too.
4501     # And no, it's not sufficient to set SOLARINC only, as configure
4502     # itself doesn't honour it.
4503     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4504     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4505     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4506     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4508     AC_SUBST(UCRTSDKDIR)
4509     AC_SUBST(UCRTVERSION)
4511     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4512     # Find the proper version of MSBuild.exe to use based on the VS version
4513     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4514     if test -z "$regvalue" ; then
4515         if test "$WIN_BUILD_ARCH" != "x64"; then
4516             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4517         else
4518             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4519         fi
4520     fi
4521     if test -d "$regvalue" ; then
4522         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4523         AC_MSG_RESULT([$regvalue])
4524     else
4525         AC_MSG_ERROR([MSBuild.exe location not found])
4526     fi
4528     # Find the version of devenv.exe
4529     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4530     DEVENV="$formatted_path"
4531     DEVENV_unix="$formatted_path_unix"
4532     if test ! -e "$DEVENV_unix"; then
4533         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4534     fi
4536     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4537     dnl needed when building CLR code:
4538     if test -z "$MSVC_CXX"; then
4539         # This gives us a posix path with 8.3 filename restrictions
4540         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4541     fi
4543     if test -z "$CC"; then
4544         CC=$MSVC_CXX
4545         CC_BASE=`first_arg_basename "$CC"`
4546     fi
4547     if test -z "$CXX"; then
4548         CXX=$MSVC_CXX
4549         CXX_BASE=`first_arg_basename "$CXX"`
4550     fi
4552     if test -n "$CC"; then
4553         # Remove /cl.exe from CC case insensitive
4554         AC_MSG_NOTICE([found Visual C++ $vcyear])
4556         PathFormat "$COMPATH"
4557         COMPATH="$formatted_path"
4558         COMPATH_unix="$formatted_path_unix"
4559         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4561         VCVER=$vcnumwithdot
4562         VCTOOLSET=$vctoolset
4564         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4565         # are always "better", we list them in reverse chronological order.
4567         case "$vcnumwithdot" in
4568         16.0 | 17.0 | 17.12)
4569             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4570             ;;
4571         esac
4573         # The expectation is that --with-windows-sdk should not need to be used
4574         if test -n "$with_windows_sdk"; then
4575             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4576             *" "$with_windows_sdk" "*)
4577                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4578                 ;;
4579             *)
4580                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4581                 ;;
4582             esac
4583         fi
4585         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4586         ac_objext=obj
4587         ac_exeext=exe
4589     else
4590         AC_MSG_ERROR([Visual C++ not found after all, huh])
4591     fi
4593     # ERROR if VS version < 16.5
4594     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4595     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4596         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4597         // between Visual Studio versions and _MSC_VER:
4598         #if _MSC_VER < 1925
4599         #error
4600         #endif
4601     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4603     # WARN if VS version < 16.10
4604     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4605     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4606         #if _MSC_VER < 1929
4607         #error
4608         #endif
4609     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4611     if test $vs2019_recommended_version = yes; then
4612         AC_MSG_RESULT([yes])
4613     else
4614         AC_MSG_WARN([no])
4615         add_warning "You should have at least Visual Studio 2019 version 16.10 to avoid build problems. Otherwise, you may face problems with the build of some modules including dragonbox."
4616     fi
4618     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4619     # version of the Explorer extension (and maybe other small
4620     # bits, too) needed when installing a 32-bit LibreOffice on a
4621     # 64-bit OS. The 64-bit Explorer extension is a feature that
4622     # has been present since long in OOo. Don't confuse it with
4623     # building LibreOffice itself as 64-bit code.
4625     BUILD_X64=
4626     CXX_X64_BINARY=
4628     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4629         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4630         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4631              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4632         then
4633             BUILD_X64=TRUE
4634             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4635             AC_MSG_RESULT([found])
4636         else
4637             AC_MSG_RESULT([not found])
4638             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4639         fi
4640     elif test "$WIN_HOST_ARCH" = "x64"; then
4641         CXX_X64_BINARY=$CXX
4642     fi
4643     AC_SUBST(BUILD_X64)
4645     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4646     AC_SUBST(CXX_X64_BINARY)
4648     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4649     # needed to support TWAIN scan on both 32- and 64-bit systems
4651     case "$WIN_HOST_ARCH" in
4652     x64)
4653         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4654         if test -n "$CXX_X86_BINARY"; then
4655             BUILD_X86=TRUE
4656             AC_MSG_RESULT([preset])
4657         elif test -n "$WIN_MULTI_ARCH"; then
4658             BUILD_X86=TRUE
4659             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4660             AC_MSG_RESULT([found])
4661         else
4662             AC_MSG_RESULT([not found])
4663             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4664         fi
4665         ;;
4666     x86)
4667         BUILD_X86=TRUE
4668         CXX_X86_BINARY=$MSVC_CXX
4669         ;;
4670     esac
4671     AC_SUBST(BUILD_X86)
4672     AC_SUBST(CXX_X86_BINARY)
4674 AC_SUBST(VCVER)
4675 AC_SUBST(VCTOOLSET)
4676 AC_SUBST(DEVENV)
4677 AC_SUBST(MSVC_CXX)
4679 COM_IS_CLANG=
4680 AC_MSG_CHECKING([whether the compiler is actually Clang])
4681 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4682     #ifndef __clang__
4683     you lose
4684     #endif
4685     int foo=42;
4686     ]])],
4687     [AC_MSG_RESULT([yes])
4688      COM_IS_CLANG=TRUE],
4689     [AC_MSG_RESULT([no])])
4690 AC_SUBST(COM_IS_CLANG)
4692 CLANGVER=
4693 if test "$COM_IS_CLANG" = TRUE; then
4694     AC_MSG_CHECKING([whether Clang is new enough])
4695     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4696         #if !defined __apple_build_version__
4697         #error
4698         #endif
4699         ]])],
4700         [my_apple_clang=yes],[my_apple_clang=])
4701     if test "$my_apple_clang" = yes; then
4702         AC_MSG_RESULT([assumed yes (Apple Clang)])
4703     elif test "$_os" = Emscripten; then
4704         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4705     else
4706         if test "$_os" = WINNT; then
4707             dnl In which case, assume clang-cl:
4708             my_args="/EP /TC"
4709         else
4710             my_args="-E -P"
4711         fi
4712         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4713         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4714         CLANGVER=`echo $clang_version \
4715             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4716         if test "$CLANGVER" -ge 120000; then
4717             AC_MSG_RESULT([yes ($clang_version)])
4718         else
4719             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4720         fi
4721         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4722         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4723     fi
4726 SHOWINCLUDES_PREFIX=
4727 if test "$_os" = WINNT; then
4728     dnl We need to guess the prefix of the -showIncludes output, it can be
4729     dnl localized
4730     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4731     echo "#include <stdlib.h>" > conftest.c
4732     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4733         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4734     rm -f conftest.c conftest.obj
4735     if test -z "$SHOWINCLUDES_PREFIX"; then
4736         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4737     else
4738         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4739     fi
4741 AC_SUBST(SHOWINCLUDES_PREFIX)
4744 # prefix C with ccache if needed
4746 if test "$CCACHE" != ""; then
4747     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4749     AC_LANG_PUSH([C])
4750     save_CFLAGS=$CFLAGS
4751     CFLAGS="$CFLAGS --ccache-skip -O2"
4752     # msvc does not fail on unknown options, check stdout
4753     if test "$COM" = MSC; then
4754         CFLAGS="$CFLAGS -nologo"
4755     fi
4756     save_ac_c_werror_flag=$ac_c_werror_flag
4757     ac_c_werror_flag=yes
4758     dnl an empty program will do, we're checking the compiler flags
4759     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4760                       [use_ccache=yes], [use_ccache=no])
4761     CFLAGS=$save_CFLAGS
4762     ac_c_werror_flag=$save_ac_c_werror_flag
4763     if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
4764         AC_MSG_RESULT([yes])
4765     else
4766         CC="$CCACHE $CC"
4767         CC_BASE="ccache $CC_BASE"
4768         AC_MSG_RESULT([no])
4769     fi
4770     AC_LANG_POP([C])
4773 # ===================================================================
4774 # check various GCC options that Clang does not support now but maybe
4775 # will somewhen in the future, check them even for GCC, so that the
4776 # flags are set
4777 # ===================================================================
4779 HAVE_GCC_GGDB2=
4780 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4781     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4782     save_CFLAGS=$CFLAGS
4783     CFLAGS="$CFLAGS -Werror -ggdb2"
4784     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4785     CFLAGS=$save_CFLAGS
4786     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4787         AC_MSG_RESULT([yes])
4788     else
4789         AC_MSG_RESULT([no])
4790     fi
4792     if test "$host_cpu" = "m68k"; then
4793         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4794         save_CFLAGS=$CFLAGS
4795         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4796         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4797         CFLAGS=$save_CFLAGS
4798         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4799             AC_MSG_RESULT([yes])
4800         else
4801             AC_MSG_ERROR([no])
4802         fi
4803     fi
4805 AC_SUBST(HAVE_GCC_GGDB2)
4807 dnl ===================================================================
4808 dnl  Test the gcc version
4809 dnl ===================================================================
4810 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4811     AC_MSG_CHECKING([the GCC version])
4812     _gcc_version=`$CC -dumpfullversion`
4813     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4814         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4815     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4817     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4819     if test "$gcc_full_version" -lt 120000; then
4820         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4821     fi
4822 else
4823     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4824     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4825     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4826     # (which reports itself as GCC 4.2.1).
4827     GCC_VERSION=
4829 AC_SUBST(GCC_VERSION)
4831 dnl Set the ENABLE_DBGUTIL variable
4832 dnl ===================================================================
4833 AC_MSG_CHECKING([whether to build with additional debug utilities])
4834 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4835     ENABLE_DBGUTIL="TRUE"
4836     # this is an extra var so it can have different default on different MSVC
4837     # versions (in case there are version specific problems with it)
4838     MSVC_USE_DEBUG_RUNTIME="TRUE"
4840     AC_MSG_RESULT([yes])
4841     # cppunit and graphite expose STL in public headers
4842     if test "$with_system_cppunit" = "yes"; then
4843         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4844     else
4845         with_system_cppunit=no
4846     fi
4847     if test "$with_system_graphite" = "yes"; then
4848         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4849     else
4850         with_system_graphite=no
4851     fi
4852     if test "$with_system_orcus" = "yes"; then
4853         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4854     else
4855         with_system_orcus=no
4856     fi
4857     if test "$with_system_libcmis" = "yes"; then
4858         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4859     else
4860         with_system_libcmis=no
4861     fi
4862     if test "$with_system_hunspell" = "yes"; then
4863         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4864     else
4865         with_system_hunspell=no
4866     fi
4867     if test "$with_system_gpgmepp" = "yes"; then
4868         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4869     else
4870         with_system_gpgmepp=no
4871     fi
4872     if test "$with_system_zxing" = "yes"; then
4873         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4874     else
4875         with_system_zxing=no
4876     fi
4877     if test "$with_system_poppler" = "yes"; then
4878         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4879     else
4880         with_system_poppler=no
4881     fi
4882     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4883     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4884     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4885     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4886     # of those two is using the system variant:
4887     if test "$with_system_libnumbertext" = "yes"; then
4888         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4889     else
4890         with_system_libnumbertext=no
4891     fi
4892     if test "$with_system_libwps" = "yes"; then
4893         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4894     else
4895         with_system_libwps=no
4896     fi
4897 else
4898     ENABLE_DBGUTIL=""
4899     MSVC_USE_DEBUG_RUNTIME=""
4900     AC_MSG_RESULT([no])
4902 AC_SUBST(ENABLE_DBGUTIL)
4903 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4905 dnl Set the ENABLE_DEBUG variable.
4906 dnl ===================================================================
4907 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4908     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4910 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4911     if test -z "$libo_fuzzed_enable_debug"; then
4912         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4913     else
4914         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4915         enable_debug=yes
4916     fi
4919 AC_MSG_CHECKING([whether to do a debug build])
4920 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4921     ENABLE_DEBUG="TRUE"
4922     if test -n "$ENABLE_DBGUTIL" ; then
4923         AC_MSG_RESULT([yes (dbgutil)])
4924     else
4925         AC_MSG_RESULT([yes])
4926     fi
4927 else
4928     ENABLE_DEBUG=""
4929     AC_MSG_RESULT([no])
4931 AC_SUBST(ENABLE_DEBUG)
4933 dnl ===================================================================
4934 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4935 dnl This is done only after compiler checks (need to know if Clang is
4936 dnl used, for different defaults) and after checking if a debug build
4937 dnl is wanted (non-debug builds get the default linker if not explicitly
4938 dnl specified otherwise).
4939 dnl All checks for linker features/options should come after this.
4940 dnl ===================================================================
4941 check_use_ld()
4943     use_ld=-fuse-ld=${1%%:*}
4944     use_ld_path=${1#*:}
4945     if test "$use_ld_path" != "$1"; then
4946         if test "$COM_IS_CLANG" = TRUE; then
4947             if test "$CLANGVER" -ge 120000; then
4948                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4949             else
4950                 use_ld="-fuse-ld=${use_ld_path}"
4951             fi
4952         else
4953             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4954             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4955             # pickup the alternative linker, when called by libtool for linking.
4956             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4957             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4958         fi
4959     fi
4960     use_ld_fail_if_error=$2
4961     use_ld_ok=
4962     AC_MSG_CHECKING([for $use_ld linker support])
4963     use_ld_ldflags_save="$LDFLAGS"
4964     LDFLAGS="$LDFLAGS $use_ld"
4965     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4966 #include <stdio.h>
4967         ],[
4968 printf ("hello world\n");
4969         ])], USE_LD=$use_ld, [])
4970     if test -n "$USE_LD"; then
4971         AC_MSG_RESULT( yes )
4972         use_ld_ok=yes
4973     else
4974         if test -n "$use_ld_fail_if_error"; then
4975             AC_MSG_ERROR( no )
4976         else
4977             AC_MSG_RESULT( no )
4978         fi
4979     fi
4980     if test -n "$use_ld_ok"; then
4981         dnl keep the value of LDFLAGS
4982         return 0
4983     fi
4984     LDFLAGS="$use_ld_ldflags_save"
4985     return 1
4987 USE_LD=
4988 if test "$enable_ld" != "no"; then
4989     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4990         if test -n "$enable_ld"; then
4991             check_use_ld "$enable_ld" fail_if_error
4992         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4993             dnl non-debug builds default to the default linker
4994             true
4995         elif test -n "$COM_IS_CLANG"; then
4996             check_use_ld lld
4997             if test $? -ne 0; then
4998                 check_use_ld gold
4999                 if test $? -ne 0; then
5000                     check_use_ld mold
5001                 fi
5002             fi
5003         else
5004             # For gcc first try gold, new versions also support lld/mold.
5005             check_use_ld gold
5006             if test $? -ne 0; then
5007                 check_use_ld lld
5008                 if test $? -ne 0; then
5009                     check_use_ld mold
5010                 fi
5011             fi
5012         fi
5013         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
5014         rm conftest.out
5015         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
5016         if test -z "$ld_used"; then
5017             ld_used="unknown"
5018         fi
5019         AC_MSG_CHECKING([for linker that is used])
5020         AC_MSG_RESULT([$ld_used])
5021         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5022             if echo "$ld_used" | grep -q "^GNU ld"; then
5023                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
5024                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
5025             fi
5026         fi
5027     else
5028         if test "$enable_ld" = "yes"; then
5029             AC_MSG_ERROR([--enable-ld not supported])
5030         fi
5031     fi
5033 AC_SUBST(USE_LD)
5034 AC_SUBST(LD)
5036 HAVE_LD_BSYMBOLIC_FUNCTIONS=
5037 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
5038     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
5039     bsymbolic_functions_ldflags_save=$LDFLAGS
5040     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
5041     AC_LINK_IFELSE([AC_LANG_PROGRAM([
5042 #include <stdio.h>
5043         ],[
5044 printf ("hello world\n");
5045         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
5046     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
5047         AC_MSG_RESULT( found )
5048     else
5049         AC_MSG_RESULT( not found )
5050     fi
5051     LDFLAGS=$bsymbolic_functions_ldflags_save
5053 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
5055 LD_GC_SECTIONS=
5056 if test "$GCC" = "yes"; then
5057     for flag in "--gc-sections" "-dead_strip"; do
5058         AC_MSG_CHECKING([for $flag linker support])
5059         ldflags_save=$LDFLAGS
5060         LDFLAGS="$LDFLAGS -Wl,$flag"
5061         AC_LINK_IFELSE([AC_LANG_PROGRAM([
5062 #include <stdio.h>
5063             ],[
5064 printf ("hello world\n");
5065             ])],[
5066             LD_GC_SECTIONS="-Wl,$flag"
5067             AC_MSG_RESULT( found )
5068             ], [
5069             AC_MSG_RESULT( not found )
5070             ])
5071         LDFLAGS=$ldflags_save
5072         if test -n "$LD_GC_SECTIONS"; then
5073             break
5074         fi
5075     done
5077 AC_SUBST(LD_GC_SECTIONS)
5079 HAVE_EXTERNAL_DWARF=
5080 if test "$enable_split_debug" != no; then
5081     use_split_debug=
5082     if test -n "$ENABLE_LTO"; then
5083         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
5084     elif test "$enable_split_debug" = yes; then
5085         use_split_debug=1
5086     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
5087     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5088         use_split_debug=1
5089     fi
5090     if test -n "$use_split_debug"; then
5091         if test "$_os" = "Emscripten"; then
5092             TEST_CC_FLAG='-gsplit-dwarf -gpubnames'
5093         else
5094             TEST_CC_FLAG=-gsplit-dwarf
5095         fi
5096         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
5097         save_CFLAGS=$CFLAGS
5098         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
5099         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
5100         CFLAGS=$save_CFLAGS
5101         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
5102             AC_MSG_RESULT([yes])
5103         else
5104             if test "$enable_split_debug" = yes; then
5105                 AC_MSG_ERROR([no])
5106             else
5107                 AC_MSG_RESULT([no])
5108             fi
5109         fi
5110     fi
5111     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5112         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5113         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5114     fi
5116 AC_SUBST(HAVE_EXTERNAL_DWARF)
5118 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5119 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5120 save_CFLAGS=$CFLAGS
5121 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5122 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5123 CFLAGS=$save_CFLAGS
5124 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5125     AC_MSG_RESULT([yes])
5126 else
5127     AC_MSG_RESULT([no])
5129 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5131 ENABLE_GDB_INDEX=
5132 if test "$enable_gdb_index" != "no"; then
5133     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5134     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5135         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5136         save_CFLAGS=$CFLAGS
5137         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5138         have_ggnu_pubnames=
5139         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5140         if test "$have_ggnu_pubnames" != "TRUE"; then
5141             if test "$enable_gdb_index" = "yes"; then
5142                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5143             else
5144                 AC_MSG_RESULT( no )
5145             fi
5146         else
5147             AC_MSG_RESULT( yes )
5148             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5149             ldflags_save=$LDFLAGS
5150             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5151             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5152 #include <stdio.h>
5153                 ],[
5154 printf ("hello world\n");
5155                 ])], ENABLE_GDB_INDEX=TRUE, [])
5156             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5157                 AC_MSG_RESULT( yes )
5158             else
5159                 if test "$enable_gdb_index" = "yes"; then
5160                     AC_MSG_ERROR( no )
5161                 else
5162                     AC_MSG_RESULT( no )
5163                 fi
5164             fi
5165             LDFLAGS=$ldflags_save
5166         fi
5167         CFLAGS=$save_CFLAGS
5168         fi
5169     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5170         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5171         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5172     fi
5174 AC_SUBST(ENABLE_GDB_INDEX)
5176 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5177     enable_sal_log=yes
5179 if test "$enable_sal_log" = yes; then
5180     ENABLE_SAL_LOG=TRUE
5182 AC_SUBST(ENABLE_SAL_LOG)
5184 dnl Check for enable symbols option
5185 dnl ===================================================================
5186 AC_MSG_CHECKING([whether to generate debug information])
5187 if test -z "$enable_symbols"; then
5188     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5189         enable_symbols=yes
5190     else
5191         enable_symbols=no
5192     fi
5194 if test "$enable_symbols" = yes; then
5195     ENABLE_SYMBOLS_FOR=all
5196     AC_MSG_RESULT([yes])
5197 elif test "$enable_symbols" = no; then
5198     ENABLE_SYMBOLS_FOR=
5199     AC_MSG_RESULT([no])
5200 else
5201     # Selective debuginfo.
5202     ENABLE_SYMBOLS_FOR="$enable_symbols"
5203     AC_MSG_RESULT([for "$enable_symbols"])
5205 AC_SUBST(ENABLE_SYMBOLS_FOR)
5207 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5208     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5209     AC_MSG_CHECKING([whether enough memory is available for linking])
5210     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5211     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5212     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5213         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5214     else
5215         AC_MSG_RESULT([yes])
5216     fi
5219 ENABLE_OPTIMIZED=
5220 ENABLE_OPTIMIZED_DEBUG=
5221 AC_MSG_CHECKING([whether to compile with optimization flags])
5222 if test -z "$enable_optimized"; then
5223     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5224         enable_optimized=no
5225     else
5226         enable_optimized=yes
5227     fi
5229 if test "$enable_optimized" = yes; then
5230     ENABLE_OPTIMIZED=TRUE
5231     AC_MSG_RESULT([yes])
5232 elif test "$enable_optimized" = debug; then
5233     ENABLE_OPTIMIZED_DEBUG=TRUE
5234     AC_MSG_RESULT([yes (debug)])
5235     HAVE_GCC_OG=
5236     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5237         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5238         save_CFLAGS=$CFLAGS
5239         CFLAGS="$CFLAGS -Werror -Og"
5240         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5241         CFLAGS=$save_CFLAGS
5242         if test "$HAVE_GCC_OG" = "TRUE"; then
5243             AC_MSG_RESULT([yes])
5244         else
5245             AC_MSG_RESULT([no])
5246         fi
5247     fi
5248     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5249         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5250     fi
5251 else
5252     AC_MSG_RESULT([no])
5254 AC_SUBST(ENABLE_OPTIMIZED)
5255 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5258 # determine CPUNAME, OS, ...
5260 case "$host_os" in
5262 cygwin*|wsl*)
5263     # Already handled
5264     ;;
5266 darwin*)
5267     COM=GCC
5268     OS=MACOSX
5269     RTL_OS=MacOSX
5270     P_SEP=:
5272     case "$host_cpu" in
5273     aarch64|arm64)
5274         if test "$enable_ios_simulator" = "yes"; then
5275             OS=iOS
5276         else
5277             CPUNAME=AARCH64
5278             RTL_ARCH=AARCH64
5279             PLATFORMID=macosx_aarch64
5280         fi
5281         ;;
5282     x86_64)
5283         if test "$enable_ios_simulator" = "yes"; then
5284             OS=iOS
5285         fi
5286         CPUNAME=X86_64
5287         RTL_ARCH=X86_64
5288         PLATFORMID=macosx_x86_64
5289         ;;
5290     *)
5291         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5292         ;;
5293     esac
5294     ;;
5296 ios*)
5297     COM=GCC
5298     OS=iOS
5299     RTL_OS=iOS
5300     P_SEP=:
5302     case "$host_cpu" in
5303     aarch64|arm64)
5304         if test "$enable_ios_simulator" = "yes"; then
5305             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5306         fi
5307         ;;
5308     *)
5309         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5310         ;;
5311     esac
5312     CPUNAME=AARCH64
5313     RTL_ARCH=AARCH64
5314     PLATFORMID=ios_arm64
5315     ;;
5317 dragonfly*)
5318     COM=GCC
5319     OS=DRAGONFLY
5320     RTL_OS=DragonFly
5321     P_SEP=:
5323     case "$host_cpu" in
5324     i*86)
5325         CPUNAME=INTEL
5326         RTL_ARCH=x86
5327         PLATFORMID=dragonfly_x86
5328         ;;
5329     x86_64)
5330         CPUNAME=X86_64
5331         RTL_ARCH=X86_64
5332         PLATFORMID=dragonfly_x86_64
5333         ;;
5334     *)
5335         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5336         ;;
5337     esac
5338     ;;
5340 freebsd*)
5341     COM=GCC
5342     RTL_OS=FreeBSD
5343     OS=FREEBSD
5344     P_SEP=:
5346     case "$host_cpu" in
5347     aarch64)
5348         CPUNAME=AARCH64
5349         PLATFORMID=freebsd_aarch64
5350         RTL_ARCH=AARCH64
5351         ;;
5352     i*86)
5353         CPUNAME=INTEL
5354         RTL_ARCH=x86
5355         PLATFORMID=freebsd_x86
5356         ;;
5357     x86_64|amd64)
5358         CPUNAME=X86_64
5359         RTL_ARCH=X86_64
5360         PLATFORMID=freebsd_x86_64
5361         ;;
5362     powerpc64)
5363         CPUNAME=POWERPC64
5364         RTL_ARCH=PowerPC_64
5365         PLATFORMID=freebsd_powerpc64
5366         ;;
5367     powerpc|powerpcspe)
5368         CPUNAME=POWERPC
5369         RTL_ARCH=PowerPC
5370         PLATFORMID=freebsd_powerpc
5371         ;;
5372     *)
5373         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5374         ;;
5375     esac
5376     ;;
5378 haiku*)
5379     COM=GCC
5380     GUIBASE=haiku
5381     RTL_OS=Haiku
5382     OS=HAIKU
5383     P_SEP=:
5385     case "$host_cpu" in
5386     i*86)
5387         CPUNAME=INTEL
5388         RTL_ARCH=x86
5389         PLATFORMID=haiku_x86
5390         ;;
5391     x86_64|amd64)
5392         CPUNAME=X86_64
5393         RTL_ARCH=X86_64
5394         PLATFORMID=haiku_x86_64
5395         ;;
5396     *)
5397         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5398         ;;
5399     esac
5400     ;;
5402 kfreebsd*)
5403     COM=GCC
5404     OS=LINUX
5405     RTL_OS=kFreeBSD
5406     P_SEP=:
5408     case "$host_cpu" in
5410     i*86)
5411         CPUNAME=INTEL
5412         RTL_ARCH=x86
5413         PLATFORMID=kfreebsd_x86
5414         ;;
5415     x86_64)
5416         CPUNAME=X86_64
5417         RTL_ARCH=X86_64
5418         PLATFORMID=kfreebsd_x86_64
5419         ;;
5420     *)
5421         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5422         ;;
5423     esac
5424     ;;
5426 linux-gnu*|linux-musl*)
5427     COM=GCC
5428     OS=LINUX
5429     RTL_OS=Linux
5430     P_SEP=:
5432     case "$host_cpu" in
5434     aarch64)
5435         CPUNAME=AARCH64
5436         PLATFORMID=linux_aarch64
5437         RTL_ARCH=AARCH64
5438         EPM_FLAGS="-a arm64"
5439         ;;
5440     alpha)
5441         CPUNAME=AXP
5442         RTL_ARCH=ALPHA
5443         PLATFORMID=linux_alpha
5444         ;;
5445     arm*)
5446         CPUNAME=ARM
5447         EPM_FLAGS="-a arm"
5448         RTL_ARCH=ARM_EABI
5449         PLATFORMID=linux_arm_eabi
5450         case "$host_cpu" in
5451         arm*-linux)
5452             RTL_ARCH=ARM_OABI
5453             PLATFORMID=linux_arm_oabi
5454             ;;
5455         esac
5456         ;;
5457     hppa)
5458         CPUNAME=HPPA
5459         RTL_ARCH=HPPA
5460         EPM_FLAGS="-a hppa"
5461         PLATFORMID=linux_hppa
5462         ;;
5463     i*86)
5464         CPUNAME=INTEL
5465         RTL_ARCH=x86
5466         PLATFORMID=linux_x86
5467         ;;
5468     ia64)
5469         CPUNAME=IA64
5470         RTL_ARCH=IA64
5471         PLATFORMID=linux_ia64
5472         ;;
5473     mips)
5474         CPUNAME=MIPS
5475         RTL_ARCH=MIPS_EB
5476         EPM_FLAGS="-a mips"
5477         PLATFORMID=linux_mips_eb
5478         ;;
5479     mips64)
5480         CPUNAME=MIPS64
5481         RTL_ARCH=MIPS64_EB
5482         EPM_FLAGS="-a mips64"
5483         PLATFORMID=linux_mips64_eb
5484         ;;
5485     mips64el)
5486         CPUNAME=MIPS64
5487         RTL_ARCH=MIPS64_EL
5488         EPM_FLAGS="-a mips64el"
5489         PLATFORMID=linux_mips64_el
5490         ;;
5491     mipsel)
5492         CPUNAME=MIPS
5493         RTL_ARCH=MIPS_EL
5494         EPM_FLAGS="-a mipsel"
5495         PLATFORMID=linux_mips_el
5496         ;;
5497     riscv64)
5498         CPUNAME=RISCV64
5499         RTL_ARCH=RISCV64
5500         EPM_FLAGS="-a riscv64"
5501         PLATFORMID=linux_riscv64
5502         ;;
5503     m68k)
5504         CPUNAME=M68K
5505         RTL_ARCH=M68K
5506         PLATFORMID=linux_m68k
5507         ;;
5508     powerpc)
5509         CPUNAME=POWERPC
5510         RTL_ARCH=PowerPC
5511         PLATFORMID=linux_powerpc
5512         ;;
5513     powerpc64)
5514         CPUNAME=POWERPC64
5515         RTL_ARCH=PowerPC_64
5516         PLATFORMID=linux_powerpc64
5517         ;;
5518     powerpc64le)
5519         CPUNAME=POWERPC64
5520         RTL_ARCH=PowerPC_64_LE
5521         PLATFORMID=linux_powerpc64_le
5522         ;;
5523     sparc)
5524         CPUNAME=SPARC
5525         RTL_ARCH=SPARC
5526         PLATFORMID=linux_sparc
5527         ;;
5528     sparc64)
5529         CPUNAME=SPARC64
5530         RTL_ARCH=SPARC64
5531         PLATFORMID=linux_sparc64
5532         ;;
5533     s390x)
5534         CPUNAME=S390X
5535         RTL_ARCH=S390x
5536         PLATFORMID=linux_s390x
5537         ;;
5538     x86_64)
5539         CPUNAME=X86_64
5540         RTL_ARCH=X86_64
5541         PLATFORMID=linux_x86_64
5542         ;;
5543     loongarch64)
5544         CPUNAME=LOONGARCH64
5545         RTL_ARCH=LOONGARCH64
5546         PLATFORMID=linux_loongarch64
5547         ;;
5548     *)
5549         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5550         ;;
5551     esac
5552     ;;
5554 linux-android*)
5555     COM=GCC
5556     OS=ANDROID
5557     RTL_OS=Android
5558     P_SEP=:
5560     case "$host_cpu" in
5562     arm|armel)
5563         CPUNAME=ARM
5564         RTL_ARCH=ARM_EABI
5565         PLATFORMID=android_arm_eabi
5566         ;;
5567     aarch64)
5568         CPUNAME=AARCH64
5569         RTL_ARCH=AARCH64
5570         PLATFORMID=android_aarch64
5571         ;;
5572     i*86)
5573         CPUNAME=INTEL
5574         RTL_ARCH=x86
5575         PLATFORMID=android_x86
5576         ;;
5577     x86_64)
5578         CPUNAME=X86_64
5579         RTL_ARCH=X86_64
5580         PLATFORMID=android_x86_64
5581         ;;
5582     *)
5583         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5584         ;;
5585     esac
5586     ;;
5588 *netbsd*)
5589     COM=GCC
5590     OS=NETBSD
5591     RTL_OS=NetBSD
5592     P_SEP=:
5594     case "$host_cpu" in
5595     i*86)
5596         CPUNAME=INTEL
5597         RTL_ARCH=x86
5598         PLATFORMID=netbsd_x86
5599         ;;
5600     powerpc)
5601         CPUNAME=POWERPC
5602         RTL_ARCH=PowerPC
5603         PLATFORMID=netbsd_powerpc
5604         ;;
5605     sparc)
5606         CPUNAME=SPARC
5607         RTL_ARCH=SPARC
5608         PLATFORMID=netbsd_sparc
5609         ;;
5610     x86_64)
5611         CPUNAME=X86_64
5612         RTL_ARCH=X86_64
5613         PLATFORMID=netbsd_x86_64
5614         ;;
5615     *)
5616         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5617         ;;
5618     esac
5619     ;;
5621 openbsd*)
5622     COM=GCC
5623     OS=OPENBSD
5624     RTL_OS=OpenBSD
5625     P_SEP=:
5627     case "$host_cpu" in
5628     i*86)
5629         CPUNAME=INTEL
5630         RTL_ARCH=x86
5631         PLATFORMID=openbsd_x86
5632         ;;
5633     x86_64)
5634         CPUNAME=X86_64
5635         RTL_ARCH=X86_64
5636         PLATFORMID=openbsd_x86_64
5637         ;;
5638     *)
5639         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5640         ;;
5641     esac
5642     SOLARINC="$SOLARINC -I/usr/local/include"
5643     ;;
5645 solaris*)
5646     COM=GCC
5647     OS=SOLARIS
5648     RTL_OS=Solaris
5649     P_SEP=:
5651     case "$host_cpu" in
5652     i*86)
5653         CPUNAME=INTEL
5654         RTL_ARCH=x86
5655         PLATFORMID=solaris_x86
5656         ;;
5657     sparc)
5658         CPUNAME=SPARC
5659         RTL_ARCH=SPARC
5660         PLATFORMID=solaris_sparc
5661         ;;
5662     sparc64)
5663         CPUNAME=SPARC64
5664         RTL_ARCH=SPARC64
5665         PLATFORMID=solaris_sparc64
5666         ;;
5667     *)
5668         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5669         ;;
5670     esac
5671     SOLARINC="$SOLARINC -I/usr/local/include"
5672     ;;
5674 emscripten*)
5675     COM=GCC
5676     OS=EMSCRIPTEN
5677     RTL_OS=Emscripten
5678     P_SEP=:
5680     case "$host_cpu" in
5681     wasm32|wasm64)
5682         ;;
5683     *)
5684         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5685         ;;
5686     esac
5687     CPUNAME=INTEL
5688     RTL_ARCH=x86
5689     PLATFORMID=linux_x86
5690     ;;
5693     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5694     ;;
5695 esac
5697 dnl ===================================================================
5698 dnl .NET support
5699 dnl ===================================================================
5701 AC_MSG_CHECKING([whether to build with .NET support])
5702 if test "$with_dotnet" != no; then
5703     if test "$DISABLE_SCRIPTING" = TRUE; then
5704         AC_MSG_RESULT([no, overridden by --disable-scripting])
5705         with_dotnet=no
5706         ENABLE_DOTNET=""
5707     else
5708         AC_MSG_RESULT([yes])
5709         ENABLE_DOTNET=TRUE
5710     fi
5711 else
5712     AC_MSG_RESULT([no])
5713     ENABLE_DOTNET=""
5716 if test "$ENABLE_DOTNET" = TRUE; then
5717     if test -n "$with_dotnet" && test "$with_dotnet" != yes; then
5718         dnl the user explicitly asks for a particular dotnet executable here
5720         AC_MSG_CHECKING([for dotnet])
5721         PathFormat "$with_dotnet"
5722         DOTNET="$formatted_path_unix"
5724         if test -f "$DOTNET"; then
5725             dnl the user provided dotnet is valid
5726             AC_MSG_RESULT([$formatted_path])
5727         else
5728             dnl since the user wants to use a particular dotnet executable,
5729             dnl error out and let them correct the path instead of silently disabling.
5731             AC_MSG_ERROR([$DOTNET is not a valid dotnet executable])
5732             ENABLE_DOTNET=""
5733         fi
5734     else
5735         dnl no specific path to dotnet provided, try looking in $PATH
5737         if test "$OS" = WNT
5738         then
5739                 AC_PATH_PROGS(DOTNET, [dotnet.exe])
5740         else
5741                 AC_PATH_PROGS(DOTNET, [dotnet])
5742         fi
5743         PathFormat "$DOTNET"
5744         DOTNET="$formatted_path_unix"
5746         if test -z "$DOTNET"; then
5747             dnl since the user does not specify any particular dotnet
5748             dnl silently disable here instead of erroring out, to prevent
5749             dnl breaking their build, as --with-dotnet is enabled by default.
5751             AC_MSG_WARN([dotnet not found, disabling .NET support])
5752             ENABLE_DOTNET=""
5753         fi
5754     fi
5756     if test -n "$DOTNET"; then
5757         dnl the dotnet executable was found, but no guarantees on whether
5758         dnl it contains SDK version 8 or higher unless we check.
5760         AC_MSG_CHECKING([for .NET SDK 8 or higher])
5761         dotnet_sdk_ver_major=`"$DOTNET" --version | "$AWK" -F. '{ print $1 }'`
5762         if test "$dotnet_sdk_ver_major" -ge 8; then
5763             dnl the SDK seems valid, get the root directory
5765             dotnet_sdk_ver=`"$DOTNET" --version | "$SED" 's/\r//g'`
5766             dotnet_sdk_dir=`"$DOTNET" --list-sdks | "$AWK" -F [[]][[]] "/^$dotnet_sdk_ver/"'{ print $2 }' | "$SED" 's/\r//g'`
5767             PathFormat "$dotnet_sdk_dir"
5768             DOTNET_ROOT=`dirname "$formatted_path_unix"`
5770             AC_MSG_RESULT([yes])
5771         else
5772             dnl silently disable for same reason as before
5774             AC_MSG_RESULT([no, disabling .NET support])
5775             ENABLE_DOTNET=""
5776         fi
5777     fi
5780 if test "$ENABLE_DOTNET" != TRUE; then
5781     DOTNET=""
5782     DOTNET_ROOT=""
5785 AC_SUBST(ENABLE_DOTNET)
5786 AC_SUBST(DOTNET)
5787 AC_SUBST(DOTNET_ROOT)
5789 DISABLE_GUI=""
5790 if test "$enable_gui" = "no"; then
5791     if test "$using_x11" != yes; then
5792         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5793     fi
5794     USING_X11=
5795     DISABLE_GUI=TRUE
5796     test_epoxy=no
5797 else
5798     AC_DEFINE(HAVE_FEATURE_UI)
5800 AC_SUBST(DISABLE_GUI)
5802 if test "$with_x" = "no"; then
5803     USING_X11=
5806 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5807     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5810 if test "$using_x11" = yes; then
5811     if test "$USING_X11" = TRUE; then
5812         AC_DEFINE(USING_X11)
5813     else
5814         disable_x11_tests
5815         if test "$DISABLE_DYNLOADING" = TRUE; then
5816             test_qt5=yes
5817             test_qt6=yes
5818         fi
5819     fi
5820 else
5821     if test "$USING_X11" = TRUE; then
5822         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5823     fi
5826 WORKDIR="${BUILDDIR}/workdir"
5827 INSTDIR="${BUILDDIR}/instdir"
5828 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5829 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5830 AC_SUBST(COM)
5831 AC_SUBST(CPUNAME)
5832 AC_SUBST(RTL_OS)
5833 AC_SUBST(RTL_ARCH)
5834 AC_SUBST(EPM_FLAGS)
5835 AC_SUBST(USING_X11)
5836 AC_SUBST([INSTDIR])
5837 AC_SUBST([INSTROOT])
5838 AC_SUBST([INSTROOTBASE])
5839 AC_SUBST(OS)
5840 AC_SUBST(P_SEP)
5841 AC_SUBST(WORKDIR)
5842 AC_SUBST(PLATFORMID)
5843 AC_SUBST(WINDOWS_X64)
5844 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5845 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5847 if test "$OS" = WNT -a "$COM" = MSC; then
5848     case "$CPUNAME" in
5849     INTEL) CPPU_ENV=msci ;;
5850     X86_64) CPPU_ENV=mscx ;;
5851     AARCH64) CPPU_ENV=msca ;;
5852     *)
5853         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5854         ;;
5855     esac
5856 else
5857     CPPU_ENV=gcc3
5859 AC_SUBST(CPPU_ENV)
5861 dnl ===================================================================
5862 dnl Test which package format to use
5863 dnl ===================================================================
5864 AC_MSG_CHECKING([which package format to use])
5865 if test -n "$with_package_format" -a "$with_package_format" != no; then
5866     for i in $with_package_format; do
5867         case "$i" in
5868         bsd | deb | pkg | rpm | archive | dmg | installed | msi | emscripten)
5869             ;;
5870         *)
5871             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5872 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5873 deb - Debian software distribution
5874 pkg - Solaris software distribution
5875 rpm - RedHat software distribution
5877 LibreOffice additionally supports:
5878 archive - .tar.gz or .zip
5879 dmg - macOS .dmg
5880 emscripten - directory with qt_soffice.html etc.
5881 installed - installation tree
5882 msi - Windows .msi
5883         ])
5884             ;;
5885         esac
5886     done
5887     # fakeroot is needed to ensure correct file ownerships/permissions
5888     # inside deb packages and tar archives created on Linux and Solaris.
5889     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5890         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5891         if test "$FAKEROOT" = "no"; then
5892             AC_MSG_ERROR(
5893                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5894         fi
5895     fi
5896     PKGFORMAT="$with_package_format"
5897     AC_MSG_RESULT([$PKGFORMAT])
5898 else
5899     PKGFORMAT=
5900     AC_MSG_RESULT([none])
5902 AC_SUBST(PKGFORMAT)
5904 dnl ===================================================================
5905 dnl handle help related options
5907 dnl If you change help related options, please update README.help
5908 dnl ===================================================================
5910 ENABLE_HTMLHELP=
5911 HELP_OMINDEX_PAGE=
5912 HELP_ONLINE=
5913 WITH_HELPPACKS=
5915 AC_MSG_CHECKING([which help to build])
5916 if test -n "$with_help" -a "$with_help" != "no"; then
5917     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5918     BUILD_TYPE="$BUILD_TYPE HELP"
5919     case "$with_help" in
5920     "html")
5921         ENABLE_HTMLHELP=TRUE
5922         WITH_HELPPACKS=TRUE
5923         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5924         AC_MSG_RESULT([HTML (local)])
5925         ;;
5926     "online")
5927         ENABLE_HTMLHELP=TRUE
5928         HELP_ONLINE=TRUE
5929         AC_MSG_RESULT([HTML (online)])
5930         ;;
5931     yes)
5932         WITH_HELPPACKS=TRUE
5933         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5934         AC_MSG_RESULT([XML (local)])
5935         ;;
5936     *)
5937         AC_MSG_ERROR([Unknown --with-help=$with_help])
5938         ;;
5939     esac
5940 else
5941     AC_MSG_RESULT([no])
5944 AC_MSG_CHECKING([if we need to build the help index tooling])
5945 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5946     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5947     test_clucene=yes
5948     AC_MSG_RESULT([yes])
5949 else
5950     AC_MSG_RESULT([no])
5953 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5954 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5955     if test "$HELP_ONLINE" != TRUE; then
5956         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5957     fi
5958     case "$with_omindex" in
5959     "server")
5960         HELP_OMINDEX_PAGE=TRUE
5961         AC_MSG_RESULT([SERVER])
5962         ;;
5963     "noxap")
5964         AC_MSG_RESULT([NOXAP])
5965         ;;
5966     *)
5967         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5968         ;;
5969     esac
5970 else
5971     AC_MSG_RESULT([no])
5974 AC_MSG_CHECKING([whether to include the XML-help support])
5975 if test "$enable_xmlhelp" = yes; then
5976     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5977     test_clucene=yes
5978     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5979     AC_MSG_RESULT([yes])
5980 else
5981     if test "$with_help" = yes; then
5982         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5983     fi
5984     AC_MSG_RESULT([no])
5987 dnl Test whether to integrate helppacks into the product's installer
5988 AC_MSG_CHECKING([for helppack integration])
5989 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5990     AC_MSG_RESULT([no integration])
5991 else
5992     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5993     AC_MSG_RESULT([integration])
5996 AC_SUBST([ENABLE_HTMLHELP])
5997 AC_SUBST([HELP_OMINDEX_PAGE])
5998 AC_SUBST([HELP_ONLINE])
5999 # WITH_HELPPACKS is used only in configure
6001 dnl ===================================================================
6002 dnl Set up a different compiler to produce tools to run on the build
6003 dnl machine when doing cross-compilation
6004 dnl ===================================================================
6006 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
6007 m4_pattern_allow([PKG_CONFIG_LIBDIR])
6008 if test "$cross_compiling" = "yes"; then
6009     AC_MSG_CHECKING([for BUILD platform configuration])
6010     echo
6011     rm -rf CONF-FOR-BUILD config_build.mk
6012     mkdir CONF-FOR-BUILD
6013     # Here must be listed all files needed when running the configure script. In particular, also
6014     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
6015     # keep them in the same order as there.
6016     (cd $SRC_ROOT && tar cf - \
6017         config.guess \
6018         bin/get_config_variables \
6019         solenv/bin/getcompver.awk \
6020         solenv/inc/langlist.mk \
6021         download.lst \
6022         config_host.mk.in \
6023         config_host_lang.mk.in \
6024         Makefile.in \
6025         bin/bffvalidator.sh.in \
6026         bin/odfvalidator.sh.in \
6027         bin/officeotron.sh.in \
6028         instsetoo_native/util/openoffice.lst.in \
6029         config_host/*.in \
6030         sysui/desktop/macosx/Info.plist.in \
6031         sysui/desktop/macosx/hardened_runtime.xcent.in \
6032         sysui/desktop/macosx/lo.xcent.in \
6033         .vscode/vs-code-template.code-workspace.in \
6034         solenv/lockfile/autoconf.h.in \
6035         ) \
6036     | (cd CONF-FOR-BUILD && tar xf -)
6037     cp configure CONF-FOR-BUILD
6038     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
6039     (
6040     unset COM USING_X11 OS CPUNAME
6041     unset CC CXX SYSBASE CFLAGS
6042     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
6043     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
6044     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
6045     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
6046     if test -n "$CC_FOR_BUILD"; then
6047         export CC="$CC_FOR_BUILD"
6048         CC_BASE=`first_arg_basename "$CC"`
6049     fi
6050     if test -n "$CXX_FOR_BUILD"; then
6051         export CXX="$CXX_FOR_BUILD"
6052         CXX_BASE=`first_arg_basename "$CXX"`
6053     fi
6054     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
6055     cd CONF-FOR-BUILD
6057     # Handle host configuration, which affects the cross-toolset too
6058     sub_conf_opts=""
6059     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
6060     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
6061     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
6062     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
6063     if test -n "$ENABLE_JAVA"; then
6064         case "$_os" in
6065         Android)
6066             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
6067             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
6068             ;;
6069         *)
6070             if test -z "$with_jdk_home"; then
6071                 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.])
6072             fi
6073             ;;
6074         esac
6075     else
6076         sub_conf_opts="$sub_conf_opts --without-java"
6077     fi
6078     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
6079     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
6080     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
6081     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
6082     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
6083     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
6084     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
6085     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
6086     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
6087     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
6088     if test "$_os" = "Emscripten"; then
6089         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
6090         if test "${with_main_module+set}" = set; then
6091             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
6092         else
6093             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
6094         fi
6095     fi
6096     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
6097     # when cross-compiling for aarch64, overriding the defaults below
6098     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
6100     # Don't bother having configure look for stuff not needed for the build platform anyway
6101     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
6102     sub_conf_defaults=" \
6103         --build="$build_alias" \
6104         --disable-cairo-canvas \
6105         --disable-cups \
6106         --disable-customtarget-components \
6107         --disable-firebird-sdbc \
6108         --disable-gpgmepp \
6109         --disable-gstreamer-1-0 \
6110         --disable-gtk3 \
6111         --disable-gtk4 \
6112         --disable-libcmis \
6113         --disable-mariadb-sdbc \
6114         --disable-nss \
6115         --disable-online-update \
6116         --disable-opencl \
6117         --disable-openssl \
6118         --disable-pdfimport \
6119         --disable-postgresql-sdbc \
6120         --disable-skia \
6121         --disable-xmlhelp \
6122         --enable-dynamic-loading \
6123         --enable-icecream="$enable_icecream" \
6124         --without-gssapi \
6125         --without-doxygen \
6126         --without-tls \
6127         --without-webdav \
6128         --without-x \
6130     # single quotes added for better readability in case of spaces
6131     echo "    Running CONF-FOR-BUILD/configure" \
6132         $sub_conf_defaults \
6133         --with-parallelism="'$with_parallelism'" \
6134         --with-theme="'$with_theme'" \
6135         --with-vendor="'$with_vendor'" \
6136         $sub_conf_opts \
6137         $with_build_platform_configure_options \
6138         --srcdir=$srcdir
6140     ./configure \
6141         $sub_conf_defaults \
6142         --with-parallelism="$with_parallelism" \
6143         --with-theme="$with_theme" \
6144         "--with-vendor=$with_vendor" \
6145         $sub_conf_opts \
6146         $with_build_platform_configure_options \
6147         --srcdir=$srcdir \
6148         2>&1 | sed -e 's/^/    /'
6149     if test [${PIPESTATUS[0]}] -ne 0; then
6150         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
6151     fi
6153     # filter permitted build targets
6154     PERMITTED_BUILD_TARGETS="
6155         ARGON2
6156         AVMEDIA
6157         BOOST
6158         BZIP2
6159         CAIRO
6160         CLUCENE
6161         CURL
6162         DBCONNECTIVITY
6163         DESKTOP
6164         DRAGONBOX
6165         DYNLOADING
6166         EPOXY
6167         EXPAT
6168         FROZEN
6169         GLM
6170         GRAPHITE
6171         HARFBUZZ
6172         HELPTOOLS
6173         ICU
6174         LCMS2
6175         LIBJPEG_TURBO
6176         LIBLANGTAG
6177         LibO
6178         LIBFFI
6179         LIBPN
6180         LIBTIFF
6181         LIBWEBP
6182         LIBXML2
6183         LIBXSLT
6184         MDDS
6185         NATIVE
6186         OPENSSL
6187         ORCUS
6188         PYTHON
6189         REPORTBUILDER
6190         SCRIPTING
6191         ZLIB
6192         ZXCVBN
6194     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
6195     # newlined lists, to use grep as a filter
6196     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
6197     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
6198     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
6199     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
6201     cp config_host.mk ../config_build.mk
6202     cp config_host_lang.mk ../config_build_lang.mk
6203     mv config.log ../config.Build.log
6204     mkdir -p ../config_build
6205     mv config_host/*.h ../config_build
6206     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6208     # all these will get a _FOR_BUILD postfix
6209     DIRECT_FOR_BUILD_SETTINGS="
6210         CC
6211         CPPU_ENV
6212         CXX
6213         ILIB
6214         JAVA_HOME
6215         JAVAIFLAGS
6216         JDK
6217         JDK_SECURITYMANAGER_DISALLOWED
6218         LIBO_BIN_FOLDER
6219         LIBO_LIB_FOLDER
6220         LIBO_URE_LIB_FOLDER
6221         LIBO_URE_MISC_FOLDER
6222         OS
6223         SDKDIRNAME
6224         SYSTEM_LIBXML
6225         SYSTEM_LIBXSLT
6227     # these overwrite host config with build config
6228     OVERWRITING_SETTINGS="
6229         ANT
6230         ANT_HOME
6231         ANT_LIB
6232         JAVA_SOURCE_VER
6233         JAVA_TARGET_VER
6234         JAVACFLAGS
6235         JAVACOMPILER
6236         JAVADOC
6237         JAVADOCISGJDOC
6238         LOCKFILE
6239         SYSTEM_GENBRK
6240         SYSTEM_GENCCODE
6241         SYSTEM_GENCMN
6243     # these need some special handling
6244     EXTRA_HANDLED_SETTINGS="
6245         INSTDIR
6246         INSTROOT
6247         PATH
6248         WORKDIR
6250     OLD_PATH=$PATH
6251     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6252     BUILD_PATH=$PATH
6253     PATH=$OLD_PATH
6255     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6256     echo "$line" >>build-config
6258     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6259         VV='$'$V
6260         VV=`eval "echo $VV"`
6261         if test -n "$VV"; then
6262             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6263             echo "$line" >>build-config
6264         fi
6265     done
6267     for V in $OVERWRITING_SETTINGS; do
6268         VV='$'$V
6269         VV=`eval "echo $VV"`
6270         if test -n "$VV"; then
6271             line=${V}='${'${V}:-$VV'}'
6272             echo "$line" >>build-config
6273         fi
6274     done
6276     for V in INSTDIR INSTROOT WORKDIR; do
6277         VV='$'$V
6278         VV=`eval "echo $VV"`
6279         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6280         if test -n "$VV"; then
6281             line="${V}_FOR_BUILD='$VV'"
6282             echo "$line" >>build-config
6283         fi
6284     done
6286     )
6287     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6288     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])
6289     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6290              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6292     eval `cat CONF-FOR-BUILD/build-config`
6294     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6296     rm -rf CONF-FOR-BUILD
6297 else
6298     OS_FOR_BUILD="$OS"
6299     CC_FOR_BUILD="$CC"
6300     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6301     CXX_FOR_BUILD="$CXX"
6302     INSTDIR_FOR_BUILD="$INSTDIR"
6303     INSTROOT_FOR_BUILD="$INSTROOT"
6304     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6305     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6306     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6307     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6308     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6309     WORKDIR_FOR_BUILD="$WORKDIR"
6311 AC_SUBST(OS_FOR_BUILD)
6312 AC_SUBST(INSTDIR_FOR_BUILD)
6313 AC_SUBST(INSTROOT_FOR_BUILD)
6314 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6315 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6316 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6317 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6318 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6319 AC_SUBST(WORKDIR_FOR_BUILD)
6320 AC_SUBST(CC_FOR_BUILD)
6321 AC_SUBST(CXX_FOR_BUILD)
6322 AC_SUBST(CPPU_ENV_FOR_BUILD)
6324 dnl ===================================================================
6325 dnl Check for lockfile deps
6326 dnl ===================================================================
6327 if test -z "$CROSS_COMPILING"; then
6328     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6329     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6330     AC_MSG_CHECKING([which lockfile binary to use])
6331     case "$with_system_lockfile" in
6332     yes)
6333         AC_MSG_RESULT([external])
6334         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6335         ;;
6336     no)
6337         AC_MSG_RESULT([internal])
6338         ;;
6339     *)
6340         if test -x "$with_system_lockfile"; then
6341             LOCKFILE="$with_system_lockfile"
6342         else
6343             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6344         fi
6345         AC_MSG_RESULT([$with_system_lockfile])
6346         ;;
6347     esac
6350 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6351     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6354 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6355 AC_CHECK_FUNCS([utime utimes])
6356 AC_SUBST(LOCKFILE)
6358 dnl ===================================================================
6359 dnl Check for syslog header
6360 dnl ===================================================================
6361 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6363 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6364 dnl ===================================================================
6365 AC_MSG_CHECKING([whether to turn warnings to errors])
6366 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6367     ENABLE_WERROR="TRUE"
6368     PYTHONWARNINGS="error"
6369     AC_MSG_RESULT([yes])
6370 else
6371     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6372         ENABLE_WERROR="TRUE"
6373         PYTHONWARNINGS="error"
6374         AC_MSG_RESULT([yes])
6375     else
6376         AC_MSG_RESULT([no])
6377     fi
6379 AC_SUBST(ENABLE_WERROR)
6380 AC_SUBST(PYTHONWARNINGS)
6382 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6383 dnl ===================================================================
6384 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6385 if test -z "$enable_assert_always_abort"; then
6386    if test "$ENABLE_DEBUG" = TRUE; then
6387        enable_assert_always_abort=yes
6388    else
6389        enable_assert_always_abort=no
6390    fi
6392 if test "$enable_assert_always_abort" = "yes"; then
6393     ASSERT_ALWAYS_ABORT="TRUE"
6394     AC_MSG_RESULT([yes])
6395 else
6396     ASSERT_ALWAYS_ABORT="FALSE"
6397     AC_MSG_RESULT([no])
6399 AC_SUBST(ASSERT_ALWAYS_ABORT)
6401 # Determine whether to use ooenv for the instdir installation
6402 # ===================================================================
6403 if test $_os != "WINNT" -a $_os != "Darwin"; then
6404     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6405     if test -z "$enable_ooenv"; then
6406         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6407             enable_ooenv=yes
6408         else
6409             enable_ooenv=no
6410         fi
6411     fi
6412     if test "$enable_ooenv" = "no"; then
6413         AC_MSG_RESULT([no])
6414     else
6415         ENABLE_OOENV="TRUE"
6416         AC_MSG_RESULT([yes])
6417     fi
6419 AC_SUBST(ENABLE_OOENV)
6421 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6422     if test "$enable_qt5" = "no"; then
6423         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6424     else
6425         enable_qt5=yes
6426     fi
6429 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6430     if test "$enable_qt6" = "no"; then
6431         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6432     else
6433         enable_qt6=yes
6434     fi
6438 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6439 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6440     AC_MSG_RESULT([yes])
6441     ENABLE_PAGEIN=TRUE
6442     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6443 else
6444     AC_MSG_RESULT([no])
6446 AC_SUBST(ENABLE_PAGEIN)
6449 AC_MSG_CHECKING([whether to enable CPDB support])
6450 ENABLE_CPDB=""
6451 CPDB_CFLAGS=""
6452 CPDB_LIBS=""
6453 if test "$test_cpdb" = yes -a "x$enable_cpdb" = "xyes"; then
6454     ENABLE_CPDB="TRUE"
6455     AC_MSG_RESULT([yes])
6456     PKG_CHECK_MODULES(CPDB, cpdb-frontend)
6457     CPDB_CFLAGS=$(printf '%s' "$CPDB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
6458     FilterLibs "${CPDB_LIBS}"
6459     CPDB_LIBS="${filteredlibs}"
6460     AC_DEFINE([ENABLE_CPDB],[1])
6461 else
6462     AC_MSG_RESULT([no])
6464 AC_SUBST(ENABLE_CPDB)
6465 AC_SUBST(CPDB_LIBS)
6466 AC_SUBST(CPDB_CFLAGS)
6468 dnl ===================================================================
6469 dnl check for cups support
6470 dnl ===================================================================
6472 AC_MSG_CHECKING([whether to enable CUPS support])
6473 if test "$test_cups" = yes -a "$enable_cups" != no; then
6474     ENABLE_CUPS=TRUE
6475     AC_MSG_RESULT([yes])
6477     AC_MSG_CHECKING([whether cups support is present])
6478     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6479     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6480     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6481         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6482     fi
6483     AC_DEFINE([ENABLE_CUPS],[1])
6484 else
6485     AC_MSG_RESULT([no])
6488 AC_SUBST(ENABLE_CUPS)
6490 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6492 dnl whether to find & fetch external tarballs?
6493 dnl ===================================================================
6494 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6495    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6496        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6497    else
6498        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6499    fi
6501 if test -z "$TARFILE_LOCATION"; then
6502     if test -d "$SRC_ROOT/src" ; then
6503         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6504         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6505     fi
6506     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6507 else
6508     AbsolutePath "$TARFILE_LOCATION"
6509     PathFormat "${absolute_path}"
6510     TARFILE_LOCATION="${formatted_path_unix}"
6512 PathFormat "$TARFILE_LOCATION"
6513 TARFILE_LOCATION_NATIVE="$formatted_path"
6514 AC_SUBST(TARFILE_LOCATION)
6515 AC_SUBST(TARFILE_LOCATION_NATIVE)
6517 AC_MSG_CHECKING([whether we want to fetch tarballs])
6518 if test "$enable_fetch_external" != "no"; then
6519     if test "$with_all_tarballs" = "yes"; then
6520         AC_MSG_RESULT([yes, all of them])
6521         DO_FETCH_TARBALLS="ALL"
6522     else
6523         AC_MSG_RESULT([yes, if we use them])
6524         DO_FETCH_TARBALLS="TRUE"
6525     fi
6526 else
6527     AC_MSG_RESULT([no])
6528     DO_FETCH_TARBALLS=
6530 AC_SUBST(DO_FETCH_TARBALLS)
6532 dnl Test whether to include MySpell dictionaries
6533 dnl ===================================================================
6534 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6535 if test "$with_myspell_dicts" = "yes"; then
6536     AC_MSG_RESULT([yes])
6537     WITH_MYSPELL_DICTS=TRUE
6538     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6539     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6540 else
6541     AC_MSG_RESULT([no])
6542     WITH_MYSPELL_DICTS=
6544 AC_SUBST(WITH_MYSPELL_DICTS)
6546 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6547 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6548     if test "$with_system_dicts" = yes; then
6549         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6550     fi
6551     with_system_dicts=no
6554 AC_MSG_CHECKING([whether to use dicts from external paths])
6555 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6556     AC_MSG_RESULT([yes])
6557     SYSTEM_DICTS=TRUE
6558     AC_MSG_CHECKING([for spelling dictionary directory])
6559     if test -n "$with_external_dict_dir"; then
6560         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6561     else
6562         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6563         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6564             DICT_SYSTEM_DIR=file:///usr/share/myspell
6565         fi
6566     fi
6567     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6568     AC_MSG_CHECKING([for hyphenation patterns directory])
6569     if test -n "$with_external_hyph_dir"; then
6570         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6571     else
6572         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6573     fi
6574     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6575     AC_MSG_CHECKING([for thesaurus directory])
6576     if test -n "$with_external_thes_dir"; then
6577         THES_SYSTEM_DIR=file://$with_external_thes_dir
6578     else
6579         THES_SYSTEM_DIR=file:///usr/share/mythes
6580     fi
6581     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6582 else
6583     AC_MSG_RESULT([no])
6584     SYSTEM_DICTS=
6586 AC_SUBST(SYSTEM_DICTS)
6587 AC_SUBST(DICT_SYSTEM_DIR)
6588 AC_SUBST(HYPH_SYSTEM_DIR)
6589 AC_SUBST(THES_SYSTEM_DIR)
6591 dnl ===================================================================
6592 dnl Precompiled headers.
6593 ENABLE_PCH=""
6594 AC_MSG_CHECKING([whether to enable pch feature])
6595 if test -z "$enable_pch"; then
6596     if test "$_os" = "WINNT"; then
6597         # Enabled by default on Windows.
6598         enable_pch=yes
6599         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6600         if test -z "$enable_ccache" -a "$SCCACHE"; then
6601             CCACHE=""
6602         fi
6603     else
6604         enable_pch=no
6605     fi
6607 if test "$enable_pch" != no -a "$_os" = Emscripten; then
6608     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6610 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6611     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6613 if test "$enable_pch" = "system"; then
6614     ENABLE_PCH="1"
6615     AC_MSG_RESULT([yes (system headers)])
6616 elif test "$enable_pch" = "base"; then
6617     ENABLE_PCH="2"
6618     AC_MSG_RESULT([yes (system and base headers)])
6619 elif test "$enable_pch" = "normal"; then
6620     ENABLE_PCH="3"
6621     AC_MSG_RESULT([yes (normal)])
6622 elif test "$enable_pch" = "full"; then
6623     ENABLE_PCH="4"
6624     AC_MSG_RESULT([yes (full)])
6625 elif test "$enable_pch" = "yes"; then
6626     # Pick a suitable default.
6627     if test "$GCC" = "yes"; then
6628         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6629         # while making the PCHs larger and rebuilds more likely.
6630         ENABLE_PCH="2"
6631         AC_MSG_RESULT([yes (system and base headers)])
6632     else
6633         # With MSVC the highest level makes a significant difference,
6634         # and it was the default when there used to be no PCH levels.
6635         ENABLE_PCH="4"
6636         AC_MSG_RESULT([yes (full)])
6637     fi
6638 elif test "$enable_pch" = "no"; then
6639     AC_MSG_RESULT([no])
6640 else
6641     AC_MSG_ERROR([Unknown value for --enable-pch])
6643 AC_SUBST(ENABLE_PCH)
6644 if test -n "$ENABLE_PCH"; then
6645     AC_DEFINE(ENABLE_PCH)
6647 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6648 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6649     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6650     if test "$CCACHE_BIN" != "not found"; then
6651         AC_MSG_CHECKING([ccache version])
6652         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6653         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6654         AC_MSG_RESULT([$CCACHE_VERSION])
6655         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6656         if test "$CCACHE_NUMVER" -gt "030701"; then
6657             AC_MSG_RESULT([yes])
6658         else
6659             AC_MSG_RESULT([no (not newer than 3.7.1)])
6660             CCACHE_DEPEND_MODE=
6661         fi
6662     fi
6665 PCH_INSTANTIATE_TEMPLATES=
6666 if test -n "$ENABLE_PCH"; then
6667     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6668     save_CFLAGS=$CFLAGS
6669     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6670     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6671     CFLAGS=$save_CFLAGS
6672     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6673         AC_MSG_RESULT(yes)
6674     else
6675         AC_MSG_RESULT(no)
6676     fi
6678 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6680 BUILDING_PCH_WITH_OBJ=
6681 if test -n "$ENABLE_PCH"; then
6682     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6683     save_CFLAGS=$CFLAGS
6684     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6685     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6686     CFLAGS=$save_CFLAGS
6687     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6688         AC_MSG_RESULT(yes)
6689     else
6690         AC_MSG_RESULT(no)
6691     fi
6693 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6695 PCH_CODEGEN=
6696 PCH_NO_CODEGEN=
6697 fpch_prefix=
6698 if test "$COM" = MSC; then
6699     fpch_prefix="-Xclang "
6701 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6702     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6703     save_CFLAGS=$CFLAGS
6704     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6705     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6706         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6707     CFLAGS=$save_CFLAGS
6708     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6709     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6710         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6711     CFLAGS=$save_CFLAGS
6712     if test -n "$PCH_CODEGEN"; then
6713         AC_MSG_RESULT(yes)
6714     else
6715         AC_MSG_RESULT(no)
6716     fi
6718 AC_SUBST(PCH_CODEGEN)
6719 AC_SUBST(PCH_NO_CODEGEN)
6720 PCH_DEBUGINFO=
6721 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6722     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6723     save_CFLAGS=$CFLAGS
6724     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6725     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6726     CFLAGS=$save_CFLAGS
6727     if test -n "$PCH_DEBUGINFO"; then
6728         AC_MSG_RESULT(yes)
6729     else
6730         AC_MSG_RESULT(no)
6731     fi
6733 AC_SUBST(PCH_DEBUGINFO)
6735 TAB=`printf '\t'`
6737 AC_MSG_CHECKING([the GNU Make version])
6738 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6739 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6740 if test "$_make_longver" -ge "040000"; then
6741     AC_MSG_RESULT([$GNUMAKE $_make_version])
6742 else
6743     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6746 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6747 STALE_MAKE=
6748 if test "$_make_ver_check" = ""; then
6749    STALE_MAKE=TRUE
6752 HAVE_LD_HASH_STYLE=FALSE
6753 WITH_LINKER_HASH_STYLE=
6754 AC_MSG_CHECKING([for --hash-style gcc linker support])
6755 if test "$GCC" = "yes"; then
6756     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6757         hash_styles="gnu sysv"
6758     elif test "$with_linker_hash_style" = "no"; then
6759         hash_styles=
6760     else
6761         hash_styles="$with_linker_hash_style"
6762     fi
6764     for hash_style in $hash_styles; do
6765         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6766         hash_style_ldflags_save=$LDFLAGS
6767         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6769         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6770             [
6771 #include <stdio.h>
6772             ],[
6773 printf ("");
6774             ])],
6775             [
6776                   HAVE_LD_HASH_STYLE=TRUE
6777                   WITH_LINKER_HASH_STYLE=$hash_style
6778             ],
6779             [HAVE_LD_HASH_STYLE=FALSE],
6780             [HAVE_LD_HASH_STYLE=FALSE])
6781         LDFLAGS=$hash_style_ldflags_save
6782     done
6784     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6785         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6786     else
6787         AC_MSG_RESULT( no )
6788     fi
6789     LDFLAGS=$hash_style_ldflags_save
6790 else
6791     AC_MSG_RESULT( no )
6793 AC_SUBST(HAVE_LD_HASH_STYLE)
6794 AC_SUBST(WITH_LINKER_HASH_STYLE)
6796 dnl ===================================================================
6797 dnl Check whether there's a Perl version available.
6798 dnl ===================================================================
6799 if test -z "$with_perl_home"; then
6800     AC_PATH_PROG(PERL, perl)
6801 else
6802     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6803     _perl_path="$with_perl_home/bin/perl"
6804     if test -x "$_perl_path"; then
6805         PERL=$_perl_path
6806     else
6807         AC_MSG_ERROR([$_perl_path not found])
6808     fi
6811 dnl ===================================================================
6812 dnl Testing for Perl version 5 or greater.
6813 dnl $] is the Perl version variable, it is returned as an integer
6814 dnl ===================================================================
6815 if test "$PERL"; then
6816     AC_MSG_CHECKING([the Perl version])
6817     ${PERL} -e "exit($]);"
6818     _perl_version=$?
6819     if test "$_perl_version" -lt 5; then
6820         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6821     fi
6822     AC_MSG_RESULT([Perl $_perl_version])
6823 else
6824     AC_MSG_ERROR([Perl not found, install Perl 5])
6827 dnl ===================================================================
6828 dnl Testing for required Perl modules
6829 dnl ===================================================================
6831 AC_MSG_CHECKING([for required Perl modules])
6832 perl_use_string="use Cwd ; use Digest::MD5"
6833 if test "$_os" = "WINNT"; then
6834     if test -n "$PKGFORMAT"; then
6835         for i in $PKGFORMAT; do
6836             case "$i" in
6837             msi)
6838                 # for getting fonts versions to use in MSI
6839                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6840                 ;;
6841             esac
6842         done
6843     fi
6845 if test "$with_system_hsqldb" = "yes"; then
6846     perl_use_string="$perl_use_string ; use Archive::Zip"
6848 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6849     # OpenSSL needs that to build
6850     perl_use_string="$perl_use_string ; use FindBin"
6852 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6853     AC_MSG_RESULT([all modules found])
6854 else
6855     AC_MSG_RESULT([failed to find some modules])
6856     # Find out which modules are missing.
6857     for i in $perl_use_string; do
6858         if test "$i" != "use" -a "$i" != ";"; then
6859             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6860                 missing_perl_modules="$missing_perl_modules $i"
6861             fi
6862         fi
6863     done
6864     AC_MSG_ERROR([
6865     The missing Perl modules are: $missing_perl_modules
6866     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6869 dnl ===================================================================
6870 dnl Check for pkg-config
6871 dnl ===================================================================
6872 if test "$_os" != "WINNT"; then
6873     PKG_PROG_PKG_CONFIG
6875 AC_SUBST(PKG_CONFIG)
6876 AC_SUBST(PKG_CONFIG_PATH)
6877 AC_SUBST(PKG_CONFIG_LIBDIR)
6879 if test "$_os" != "WINNT"; then
6881     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6882     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6883     # explicitly. Or put /path/to/compiler in PATH yourself.
6885     toolprefix=gcc
6886     if test "$COM_IS_CLANG" = "TRUE"; then
6887         toolprefix=llvm
6888     fi
6889     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6890     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6891     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6892     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6893     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6894     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6896 AC_SUBST(AR)
6897 AC_SUBST(NM)
6898 AC_SUBST(OBJDUMP)
6899 AC_SUBST(RANLIB)
6900 AC_SUBST(READELF)
6901 AC_SUBST(STRIP)
6903 dnl ===================================================================
6904 dnl pkg-config checks on macOS
6905 dnl ===================================================================
6907 if test $_os = Darwin; then
6908     AC_MSG_CHECKING([for bogus pkg-config])
6909     if test -n "$PKG_CONFIG"; then
6910         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6911             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6912         else
6913             if test "$enable_bogus_pkg_config" = "yes"; then
6914                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6915             else
6916                 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.])
6917             fi
6918         fi
6919     else
6920         AC_MSG_RESULT([no, good])
6921     fi
6924 find_csc()
6926     # Return value: $csctest
6928     unset csctest
6930     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6931     if test -n "$regvalue"; then
6932         csctest=$regvalue
6933         return
6934     fi
6937 find_al()
6939     # Return value: $altest
6941     unset altest
6943     # We need this check to detect 4.6.1 or above.
6944     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6945         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6946         PathFormat "$regvalue"
6947         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6948             altest=$regvalue
6949             return
6950         fi
6951     done
6953     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6954     for x in $reglist; do
6955         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6956         PathFormat "$regvalue"
6957         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6958             altest=$regvalue
6959             return
6960         fi
6961     done
6964 find_dotnetsdk()
6966     unset frametest
6968     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6969         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6970         if test -n "$regvalue"; then
6971             frametest=$regvalue
6972             return
6973         fi
6974     done
6975     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6978 find_winsdk_version()
6980     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6981     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6983     unset winsdktest winsdkbinsubdir winsdklibsubdir
6985     case "$1" in
6986     8.0|8.0A)
6987         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6988         if test -n "$regvalue"; then
6989             winsdktest=$regvalue
6990             winsdklibsubdir=win8
6991             return
6992         fi
6993         ;;
6994     8.1|8.1A)
6995         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6996         if test -n "$regvalue"; then
6997             winsdktest=$regvalue
6998             winsdklibsubdir=winv6.3
6999             return
7000         fi
7001         ;;
7002     10.0)
7003         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
7004         if test -n "$regvalue"; then
7005             winsdktest=$regvalue
7006             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
7007             if test -n "$regvalue"; then
7008                 winsdkbinsubdir="$regvalue".0
7009                 winsdklibsubdir=$winsdkbinsubdir
7010                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
7011                 PathFormat "$tmppath"
7012                 local tmppath_unix=$formatted_path_unix
7013                 # test exist the SDK path
7014                 if test ! -d "$tmppath_unix"; then
7015                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
7016                 fi
7017             fi
7018             return
7019         fi
7020         ;;
7021     esac
7024 find_winsdk()
7026     # Return value: From find_winsdk_version
7028     unset winsdktest
7030     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
7031         find_winsdk_version $ver
7032         if test -n "$winsdktest"; then
7033             return
7034         fi
7035     done
7038 find_msms()
7040     # Return value: $msmdir
7041     local version="$1"
7043     AC_MSG_CHECKING([for MSVC $version merge modules directory])
7044     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
7045     local my_msm_dir
7047     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
7049     msmdir=
7050     case "$VCVER" in
7051     16.0 | 17.0 | 17.12)
7052         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
7053             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
7054             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
7055             if test -e "$my_msm_dir${my_msm_file}"; then
7056                 msmdir=$my_msm_dir
7057             fi
7058         done
7059         ;;
7060     esac
7062     if test -n "$msmdir"; then
7063         msmdir=`cygpath -m "$msmdir"`
7064         AC_MSG_RESULT([$msmdir])
7065     else
7066         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
7067             AC_MSG_FAILURE([not found])
7068         else
7069             AC_MSG_WARN([not found (check config.log)])
7070             add_warning "MSM ${my_msm_file} not found"
7071         fi
7072     fi
7075 find_msvc_x64_dlls()
7077     # Return value: $msvcdllpath, $msvcdlls
7079     AC_MSG_CHECKING([for MSVC x64 DLL path])
7081     dnl Order crtver in increasing order. Then check the directories returned by
7082     dnl ls in an inner loop; assuming they are also ordered in increasing order,
7083     dnl the result will be the highest CRT version found in the highest directory.
7085     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
7086     case "$VCVER" in
7087     16.0 | 17.0 | 17.12)
7088         for crtver in 141 142 143; do
7089             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
7090                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
7091                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
7092                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
7093                 fi
7094             done
7095         done
7096         ;;
7097     esac
7098     AC_MSG_RESULT([$msvcdllpath])
7099     AC_MSG_CHECKING([for MSVC x64 DLLs])
7100     msvcdlls="msvcp140.dll vcruntime140.dll"
7101     for dll in $msvcdlls; do
7102         if ! test -f "$msvcdllpath/$dll"; then
7103             AC_MSG_FAILURE([missing $dll])
7104         fi
7105     done
7106     AC_MSG_RESULT([found all ($msvcdlls)])
7109 dnl =========================================
7110 dnl Check for the Windows  SDK.
7111 dnl =========================================
7112 if test "$_os" = "WINNT"; then
7113     AC_MSG_CHECKING([for Windows SDK])
7114     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7115         find_winsdk
7116         WINDOWS_SDK_HOME=$winsdktest
7118         # normalize if found
7119         if test -n "$WINDOWS_SDK_HOME"; then
7120             PathFormat "$WINDOWS_SDK_HOME"
7121             WINDOWS_SDK_HOME=$formatted_path_unix
7122         fi
7124         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
7125         # The variable also contains the Windows SDK version
7126         echo $WINDOWS_SDK_LIB_SUBDIR
7127         # Assuming maximum of 5 digits for each part and ignoring last part
7128         SDK_NORMALIZED_VER=$(echo $WINDOWS_SDK_LIB_SUBDIR | awk -F. '{printf("%d%05d%05d\n", $1, $2, $3)}')
7129         # 10.0.20348.0 is the minimum required version
7130         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
7131             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
7132         fi
7133     fi
7135     if test -n "$WINDOWS_SDK_HOME"; then
7136         # Remove a possible trailing backslash
7137         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
7139         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
7140              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
7141              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
7142             have_windows_sdk_headers=yes
7143         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
7144              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
7145              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
7146             have_windows_sdk_headers=yes
7147         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
7148              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
7149              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
7150             have_windows_sdk_headers=yes
7151         else
7152             have_windows_sdk_headers=no
7153         fi
7155         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
7156             have_windows_sdk_libs=yes
7157         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
7158             have_windows_sdk_libs=yes
7159         else
7160             have_windows_sdk_libs=no
7161         fi
7163         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
7164             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
7165 the  Windows SDK are installed.])
7166         fi
7167     fi
7169     if test -z "$WINDOWS_SDK_HOME"; then
7170         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
7171     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
7172         WINDOWS_SDK_VERSION=80
7173         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
7174     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
7175         WINDOWS_SDK_VERSION=81
7176         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
7177     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
7178         WINDOWS_SDK_VERSION=10
7179         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
7180     else
7181         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
7182     fi
7183     PathFormat "$WINDOWS_SDK_HOME"
7184     WINDOWS_SDK_HOME="$formatted_path"
7185     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
7186     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7187         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
7188         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
7189             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
7190         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
7191             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
7192         fi
7193     fi
7195     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
7196     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
7197     dnl but not in v8.0), so allow this to be overridden with a
7198     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
7199     dnl and configuration error if no WiLangId.vbs is found would arguably be
7200     dnl better, but I do not know under which conditions exactly it is needed by
7201     dnl msiglobal.pm:
7202     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
7203         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
7204         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7205             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
7206         fi
7207         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7208             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
7209         fi
7210         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7211             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
7212         fi
7213         PathFormat "$WINDOWS_SDK_WILANGID_unix"
7214         WINDOWS_SDK_WILANGID="$formatted_path"
7215     fi
7216     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
7217         if test -n "$with_package_format" -a "$with_package_format" != no; then
7218             for i in "$with_package_format"; do
7219                 if test "$i" = "msi"; then
7220                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7221                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
7222                     fi
7223                 fi
7224             done
7225         fi
7226     fi
7228 AC_SUBST(WINDOWS_SDK_HOME)
7229 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7230 AC_SUBST(WINDOWS_SDK_VERSION)
7231 AC_SUBST(WINDOWS_SDK_WILANGID)
7233 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7234     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7235     dnl dir, it also determines that dir's path w/o an arch segment if any,
7236     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7237     AC_MSG_CHECKING([for midl.exe])
7239     find_winsdk
7240     PathFormat "$winsdktest"
7241     winsdktest_unix="$formatted_path_unix"
7243     if test -n "$winsdkbinsubdir" \
7244         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7245     then
7246         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7247         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7248     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7249         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7250         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7251     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7252         MIDL_PATH=$winsdktest_unix/Bin
7253         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7254     fi
7255     PathFormat "$MIDL_PATH"
7256     if test ! -f "$formatted_path_unix/midl.exe"; then
7257         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7258     else
7259         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7260     fi
7262     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7263     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7265     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7266          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7267          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7268          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7269     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7270          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7271          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7272          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7273     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7274          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7275          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7276          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7277     else
7278         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7279     fi
7281     PathFormat "$MIDL_PATH"
7282     MIDL_PATH="$formatted_path"
7284     if test "$enable_cli" = yes; then
7285         dnl Check csc.exe
7286         AC_MSG_CHECKING([for csc.exe])
7287         find_csc
7288         PathFormat "$csctest"
7289         csctest_unix="$formatted_path_unix"
7290         if test -f "$csctest_unix/csc.exe"; then
7291             CSC_PATH="$csctest"
7292         fi
7293         if test ! -f "$csctest_unix/csc.exe"; then
7294             AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7295         else
7296             AC_MSG_RESULT([$CSC_PATH/csc.exe])
7297         fi
7299         CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7301         dnl Check al.exe
7302         AC_MSG_CHECKING([for al.exe])
7303         if test -n "$winsdkbinsubdir" \
7304             -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7305         then
7306             AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7307         elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7308             AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7309         elif test -f "$winsdktest_unix/Bin/al.exe"; then
7310             AL_PATH="$winsdktest/Bin"
7311         fi
7313         if test -z "$AL_PATH"; then
7314             find_al
7315             PathFormat "$altest"
7316             altest_unix="$formatted_path_unix"
7317             if test -f "$altest_unix/bin/al.exe"; then
7318                 AL_PATH="$altest/bin"
7319             elif test -f "$altest_unix/al.exe"; then
7320                 AL_PATH="$altest"
7321             fi
7322         fi
7323         PathFormat "$AL_PATH"
7324         if test ! -f "$formatted_path_unix/al.exe"; then
7325             AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7326         else
7327             AC_MSG_RESULT([$AL_PATH/al.exe])
7328         fi
7330         AL_PATH=`win_short_path_for_make "$AL_PATH"`
7332         dnl Check mscoree.lib / .NET Framework dir
7333         AC_MSG_CHECKING(.NET Framework)
7334         find_dotnetsdk
7335         PathFormat "$frametest"
7336         frametest="$formatted_path_unix"
7337         if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7338             DOTNET_FRAMEWORK_HOME="$frametest"
7339         else
7340             if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7341                 DOTNET_FRAMEWORK_HOME="$winsdktest"
7342             fi
7343         fi
7344         PathFormat "$DOTNET_FRAMEWORK_HOME"
7345         if test ! -f "$formatted_path_unix/lib/mscoree.lib" -a ! -f "$formatted_path_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$formatted_path_unix/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7346             AC_MSG_ERROR([mscoree.lib not found])
7347         fi
7348         AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7350         PathFormat "$AL_PATH"
7351         AL_PATH="$formatted_path"
7353         PathFormat "$DOTNET_FRAMEWORK_HOME"
7354         DOTNET_FRAMEWORK_HOME="$formatted_path"
7356         PathFormat "$CSC_PATH"
7357         CSC_PATH="$formatted_path"
7359         ENABLE_CLI="TRUE"
7360     else
7361         ENABLE_CLI=""
7362     fi
7363 else
7364     ENABLE_CLI=""
7366 AC_SUBST(ENABLE_CLI)
7368 dnl ===================================================================
7369 dnl Testing for C++ compiler and version...
7370 dnl ===================================================================
7372 if test "$_os" != "WINNT"; then
7373     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7374     # see AC_PROG_CC above):
7375     save_CXXFLAGS=$CXXFLAGS
7376     CXXFLAGS=-g
7377     AC_PROG_CXX
7378     CXXFLAGS=$save_CXXFLAGS
7379     if test -z "$CXX_BASE"; then
7380         CXX_BASE=`first_arg_basename "$CXX"`
7381     fi
7384 CC="$CC $with_extra_cc_flags"
7385 CXX="$CXX $with_extra_cxx_flags"
7387 dnl check for GNU C++ compiler version
7388 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7389     AC_MSG_CHECKING([the GNU C++ compiler version])
7391     _gpp_version=`$CXX -dumpversion`
7392     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7394     if test "$_gpp_majmin" -lt "700"; then
7395         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7396     else
7397         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7398     fi
7400     dnl see https://issuetracker.google.com/issues/36962819
7401         glibcxx_threads=no
7402         AC_LANG_PUSH([C++])
7403         AC_REQUIRE_CPP
7404         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7405         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7406             #include <bits/c++config.h>]],[[
7407             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7408             && !defined(_GLIBCXX__PTHREADS) \
7409             && !defined(_GLIBCXX_HAS_GTHREADS)
7410             choke me
7411             #endif
7412         ]])],[AC_MSG_RESULT([yes])
7413         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7414         AC_LANG_POP([C++])
7415         if test $glibcxx_threads = yes; then
7416             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7417         fi
7419 AC_SUBST(BOOST_CXXFLAGS)
7422 # prefx CXX with ccache if needed
7424 if test "$CCACHE" != ""; then
7425     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7426     AC_LANG_PUSH([C++])
7427     save_CXXFLAGS=$CXXFLAGS
7428     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7429     # msvc does not fail on unknown options, check stdout
7430     if test "$COM" = MSC; then
7431         CXXFLAGS="$CXXFLAGS -nologo"
7432     fi
7433     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7434     ac_cxx_werror_flag=yes
7435     dnl an empty program will do, we're checking the compiler flags
7436     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7437                       [use_ccache=yes], [use_ccache=no])
7438     if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
7439         AC_MSG_RESULT([yes])
7440     else
7441         CXX="$CCACHE $CXX"
7442         CXX_BASE="ccache $CXX_BASE"
7443         AC_MSG_RESULT([no])
7444     fi
7445     CXXFLAGS=$save_CXXFLAGS
7446     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7447     AC_LANG_POP([C++])
7450 dnl ===================================================================
7451 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7452 dnl ===================================================================
7454 if test "$_os" != "WINNT"; then
7455     AC_PROG_CXXCPP
7457     dnl Check whether there's a C pre-processor.
7458     AC_PROG_CPP
7462 dnl ===================================================================
7463 dnl Find integral type sizes and alignments
7464 dnl ===================================================================
7466 if test "$_os" != "WINNT"; then
7468     AC_CHECK_SIZEOF(long)
7469     AC_CHECK_SIZEOF(short)
7470     AC_CHECK_SIZEOF(int)
7471     AC_CHECK_SIZEOF(long long)
7472     AC_CHECK_SIZEOF(double)
7473     AC_CHECK_SIZEOF(void*)
7474     AC_CHECK_SIZEOF(size_t)
7476     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7477     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7478     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7479     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7480     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7481     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7483     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7484     m4_pattern_allow([AC_CHECK_ALIGNOF])
7485     m4_ifdef([AC_CHECK_ALIGNOF],
7486         [
7487             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7488             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7489             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7490             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7491         ],
7492         [
7493             case "$_os-$host_cpu" in
7494             Linux-i686)
7495                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7496                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7497                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7498                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7499                 ;;
7500             Linux-x86_64)
7501                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7502                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7503                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7504                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7505                 ;;
7506             *)
7507                 if test -z "$ac_cv_alignof_short" -o \
7508                         -z "$ac_cv_alignof_int" -o \
7509                         -z "$ac_cv_alignof_long" -o \
7510                         -z "$ac_cv_alignof_double"; then
7511                    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.])
7512                 fi
7513                 ;;
7514             esac
7515         ])
7517     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7518     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7519     if test $ac_cv_sizeof_long -eq 8; then
7520         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7521     elif test $ac_cv_sizeof_double -eq 8; then
7522         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7523     else
7524         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7525     fi
7527     dnl Check for large file support
7528     AC_SYS_LARGEFILE
7529     if test -n "$ac_cv_sys_largefile_opts"  -a "$ac_cv_sys_largefile_opts" != "none needed" -a "$ac_cv_sys_largefile_opts" != "support not detected"; then
7530         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7531     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7532         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7533     fi
7534     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7535         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7536     fi
7537 else
7538     # Hardcode for MSVC
7539     SAL_TYPES_SIZEOFSHORT=2
7540     SAL_TYPES_SIZEOFINT=4
7541     SAL_TYPES_SIZEOFLONG=4
7542     SAL_TYPES_SIZEOFLONGLONG=8
7543     if test $WIN_HOST_BITS -eq 32; then
7544         SAL_TYPES_SIZEOFPOINTER=4
7545         SIZEOF_SIZE_T=4
7546     else
7547         SAL_TYPES_SIZEOFPOINTER=8
7548         SIZEOF_SIZE_T=8
7549     fi
7550     SAL_TYPES_ALIGNMENT2=2
7551     SAL_TYPES_ALIGNMENT4=4
7552     SAL_TYPES_ALIGNMENT8=8
7553     LFS_CFLAGS=''
7555 AC_SUBST(LFS_CFLAGS)
7556 AC_SUBST(SIZEOF_SIZE_T)
7558 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7559 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7560 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7561 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7562 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7563 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7564 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7565 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7567 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7568 AC_MSG_CHECKING([whether jumbo sheets are supported])
7569 if test "$_os" != "WINNT"; then
7570     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7571         AC_MSG_RESULT([yes])
7572         ENABLE_JUMBO_SHEETS=TRUE
7573         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7574     else
7575         AC_MSG_RESULT([no])
7576     fi
7577 else
7578     if test $WIN_HOST_BITS -gt 32; then
7579         # 64bit windows is special-cased for tools::Long because long is 32bit
7580         AC_MSG_RESULT([yes])
7581         ENABLE_JUMBO_SHEETS=TRUE
7582         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7583     else
7584         AC_MSG_RESULT([no])
7585     fi
7587 AC_SUBST(ENABLE_JUMBO_SHEETS)
7589 dnl ===================================================================
7590 dnl Check whether to enable runtime optimizations
7591 dnl ===================================================================
7592 ENABLE_RUNTIME_OPTIMIZATIONS=
7593 AC_MSG_CHECKING([whether to enable runtime optimizations])
7594 if test -z "$enable_runtime_optimizations"; then
7595     for i in $CC; do
7596         case $i in
7597         -fsanitize=*)
7598             enable_runtime_optimizations=no
7599             break
7600             ;;
7601         esac
7602     done
7604 if test "$enable_runtime_optimizations" != no; then
7605     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7606     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7607     AC_MSG_RESULT([yes])
7608 else
7609     AC_MSG_RESULT([no])
7611 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7613 dnl ===================================================================
7614 dnl Check if valgrind headers are available
7615 dnl ===================================================================
7616 ENABLE_VALGRIND=
7617 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7618     prev_cppflags=$CPPFLAGS
7619     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7620     # or where does it come from?
7621     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7622     AC_CHECK_HEADER([valgrind/valgrind.h],
7623         [ENABLE_VALGRIND=TRUE])
7624     CPPFLAGS=$prev_cppflags
7626 AC_SUBST([ENABLE_VALGRIND])
7627 if test -z "$ENABLE_VALGRIND"; then
7628     if test "$with_valgrind" = yes; then
7629         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7630     fi
7631     VALGRIND_CFLAGS=
7633 AC_SUBST([VALGRIND_CFLAGS])
7636 dnl ===================================================================
7637 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7638 dnl ===================================================================
7640 # We need at least the sys/sdt.h include header.
7641 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7642 if test "$SDT_H_FOUND" = "TRUE"; then
7643     # Found sys/sdt.h header, now make sure the c++ compiler works.
7644     # Old g++ versions had problems with probes in constructors/destructors.
7645     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7646     AC_LANG_PUSH([C++])
7647     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7648     #include <sys/sdt.h>
7649     class ProbeClass
7650     {
7651     private:
7652       int& ref;
7653       const char *name;
7655     public:
7656       ProbeClass(int& v, const char *n) : ref(v), name(n)
7657       {
7658         DTRACE_PROBE2(_test_, cons, name, ref);
7659       }
7661       void method(int min)
7662       {
7663         DTRACE_PROBE3(_test_, meth, name, ref, min);
7664         ref -= min;
7665       }
7667       ~ProbeClass()
7668       {
7669         DTRACE_PROBE2(_test_, dest, name, ref);
7670       }
7671     };
7672     ]],[[
7673     int i = 64;
7674     DTRACE_PROBE1(_test_, call, i);
7675     ProbeClass inst = ProbeClass(i, "call");
7676     inst.method(24);
7677     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7678           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7679     AC_LANG_POP([C++])
7681 AC_CONFIG_HEADERS([config_host/config_probes.h])
7683 dnl ===================================================================
7684 dnl GCC features
7685 dnl ===================================================================
7686 HAVE_GCC_STACK_CLASH_PROTECTION=
7687 HARDENING_CFLAGS=
7688 HARDENING_OPT_CFLAGS=
7689 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7690     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7691     save_CFLAGS=$CFLAGS
7692     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7693     AC_LINK_IFELSE(
7694         [AC_LANG_PROGRAM(, [[return 0;]])],
7695         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7696         [AC_MSG_RESULT([no])])
7697     CFLAGS=$save_CFLAGS
7699     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7700     save_CFLAGS=$CFLAGS
7701     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7702     if test "$ENABLE_OPTIMIZED" = TRUE; then
7703         CFLAGS="$CFLAGS -O2"
7704     fi
7705     AC_LINK_IFELSE(
7706         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7707         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7708         [AC_MSG_RESULT([no])])
7709     CFLAGS=$save_CFLAGS
7711     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7712     save_CFLAGS=$CFLAGS
7713     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7714     AC_LINK_IFELSE(
7715         [AC_LANG_PROGRAM(, [[return 0;]])],
7716         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7717         [AC_MSG_RESULT([no])])
7718     CFLAGS=$save_CFLAGS
7720     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7721     save_CFLAGS=$CFLAGS
7722     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7723     AC_LINK_IFELSE(
7724         [AC_LANG_PROGRAM(, [[return 0;]])],
7725         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7726         [AC_MSG_RESULT([no])])
7727     CFLAGS=$save_CFLAGS
7729     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7730     save_CFLAGS=$CFLAGS
7731     CFLAGS="$CFLAGS -Werror -fcf-protection"
7732     AC_LINK_IFELSE(
7733         [AC_LANG_PROGRAM(, [[return 0;]])],
7734         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7735         [AC_MSG_RESULT([no])])
7736     CFLAGS=$save_CFLAGS
7738     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7739     save_CFLAGS=$CFLAGS
7740     CFLAGS="$CFLAGS -Werror -mno-avx"
7741     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7742     CFLAGS=$save_CFLAGS
7743     if test "$HAVE_GCC_AVX" = "TRUE"; then
7744         AC_MSG_RESULT([yes])
7745     else
7746         AC_MSG_RESULT([no])
7747     fi
7749     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7750     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7751     int v = 0;
7752     if (__sync_add_and_fetch(&v, 1) != 1 ||
7753         __sync_sub_and_fetch(&v, 1) != 0)
7754         return 1;
7755     __sync_synchronize();
7756     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7757         v != 1)
7758         return 1;
7759     return 0;
7760 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7761     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7762         AC_MSG_RESULT([yes])
7763         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7764     else
7765         AC_MSG_RESULT([no])
7766     fi
7768     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7769     AC_LANG_PUSH([C++])
7770     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7771             #include <cstddef>
7772             #include <cxxabi.h>
7773             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7774         ])], [
7775             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7776             AC_MSG_RESULT([yes])
7777         ], [AC_MSG_RESULT([no])])
7778     AC_LANG_POP([C++])
7780     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7781     AC_LANG_PUSH([C++])
7782     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7783             #include <cstddef>
7784             #include <cxxabi.h>
7785             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7786         ])], [
7787             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7788             AC_MSG_RESULT([yes])
7789         ], [AC_MSG_RESULT([no])])
7790     AC_LANG_POP([C++])
7792     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7793     AC_LANG_PUSH([C++])
7794     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7795             #include <cxxabi.h>
7796             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7797         ])], [
7798             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7799             AC_MSG_RESULT([yes])
7800         ], [AC_MSG_RESULT([no])])
7801     AC_LANG_POP([C++])
7803     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7804     AC_LANG_PUSH([C++])
7805     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7806             #include <cstddef>
7807             #include <cxxabi.h>
7808             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7809         ])], [
7810             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7811             AC_MSG_RESULT([yes])
7812         ], [AC_MSG_RESULT([no])])
7813     AC_LANG_POP([C++])
7815     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7816     AC_LANG_PUSH([C++])
7817     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7818             #include <cstddef>
7819             #include <cxxabi.h>
7820             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7821         ])], [
7822             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7823             AC_MSG_RESULT([yes])
7824         ], [AC_MSG_RESULT([no])])
7825     AC_LANG_POP([C++])
7827     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7828     AC_LANG_PUSH([C++])
7829     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7830             #include <cxxabi.h>
7831             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7832         ])], [
7833             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7834             AC_MSG_RESULT([yes])
7835         ], [AC_MSG_RESULT([no])])
7836     AC_LANG_POP([C++])
7838     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7839     AC_LANG_PUSH([C++])
7840     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7841             #include <cxxabi.h>
7842             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7843         ])], [
7844             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7845             AC_MSG_RESULT([yes])
7846         ], [AC_MSG_RESULT([no])])
7847     AC_LANG_POP([C++])
7849     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7850     AC_LANG_PUSH([C++])
7851     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7852             #include <cxxabi.h>
7853             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7854         ])], [
7855             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7856             AC_MSG_RESULT([yes])
7857         ], [AC_MSG_RESULT([no])])
7858     AC_LANG_POP([C++])
7860     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7861     AC_LANG_PUSH([C++])
7862     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7863             #include <cstddef>
7864             #include <cxxabi.h>
7865             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7866         ])], [
7867             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7868             AC_MSG_RESULT([yes])
7869         ], [AC_MSG_RESULT([no])])
7870     AC_LANG_POP([C++])
7872     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7873     AC_LANG_PUSH([C++])
7874     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7875             #include <cstddef>
7876             #include <cxxabi.h>
7877             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7878         ])], [
7879             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7880             AC_MSG_RESULT([yes])
7881         ], [AC_MSG_RESULT([no])])
7882     AC_LANG_POP([C++])
7885 AC_SUBST(HAVE_GCC_AVX)
7886 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7887 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7888 AC_SUBST(HARDENING_CFLAGS)
7889 AC_SUBST(HARDENING_OPT_CFLAGS)
7891 dnl ===================================================================
7892 dnl Identify the C++ library
7893 dnl ===================================================================
7895 AC_MSG_CHECKING([what the C++ library is])
7896 HAVE_LIBSTDCPP=
7897 HAVE_LIBCPP=
7898 AC_LANG_PUSH([C++])
7899 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7900 #include <utility>
7901 #ifndef __GLIBCXX__
7902 foo bar
7903 #endif
7904 ]])],
7905     [CPP_LIBRARY=GLIBCXX
7906      cpp_library_name="GNU libstdc++"
7907      HAVE_LIBSTDCPP=TRUE
7908     ],
7909     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7910 #include <utility>
7911 #ifndef _LIBCPP_VERSION
7912 foo bar
7913 #endif
7914 ]])],
7915     [CPP_LIBRARY=LIBCPP
7916      cpp_library_name="LLVM libc++"
7917      AC_DEFINE([HAVE_LIBCPP])
7918      HAVE_LIBCPP=TRUE
7919     ],
7920     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7921 #include <utility>
7922 #ifndef _MSC_VER
7923 foo bar
7924 #endif
7925 ]])],
7926     [CPP_LIBRARY=MSVCRT
7927      cpp_library_name="Microsoft"
7928     ],
7929     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7930 AC_MSG_RESULT([$cpp_library_name])
7931 AC_LANG_POP([C++])
7932 AC_SUBST([HAVE_LIBSTDCPP])
7933 AC_SUBST([HAVE_LIBCPP])
7935 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7936 then
7937     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7938     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7939     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7940     # although there will be backwards compatibility).
7941     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7942     # and there would be undefined references to debug functions.
7943     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7944     # So check if debug mode can be used and disable or downgrade it to assertions
7945     # if needed.
7946     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7947     AC_LANG_PUSH([C++])
7948     libcpp_debug_links=
7949     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7950 #define _LIBCPP_DEBUG 0 // only assertions
7951 #include <vector>
7952 int main()
7954     std::vector<int> v;
7955     v.push_back( 1 );
7956     return v[ 3 ];
7958 ]])], [libcpp_debug_links=1])
7959     if test -n "$libcpp_debug_links"; then
7960         # we can use at least assertions, check if debug mode works
7961         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7962 #define _LIBCPP_DEBUG 1 // debug mode
7963 #include <string>
7964 #include <vector>
7965 int foo(const std::vector<int>& v) { return *v.begin(); }
7966 int main()
7968     std::vector<int> v;
7969     v.push_back( 1 );
7970     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7971     return (foo(v) + s.size()) != 0 ? 0 : 1;
7973 ]])],
7974         [AC_MSG_RESULT(yes)
7975          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7976         ],
7977         [AC_MSG_RESULT(no, using only assertions)
7978          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7979         ]
7980         )
7981     else
7982         AC_MSG_RESULT(no)
7983     fi
7984     AC_LANG_POP([C++])
7986 AC_SUBST([LIBCPP_DEBUG])
7988 dnl ===================================================================
7989 dnl Check for gperf
7990 dnl ===================================================================
7991 AC_PATH_PROG(GPERF, gperf)
7992 if test -z "$GPERF"; then
7993     AC_MSG_ERROR([gperf not found but needed. Install it.])
7995 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7996     GPERF=`cygpath -m $GPERF`
7998 AC_MSG_CHECKING([whether gperf is new enough])
7999 my_gperf_ver1=$($GPERF --version | head -n 1)
8000 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
8001 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
8002 if test "$my_gperf_ver3" -ge 301; then
8003     AC_MSG_RESULT([yes ($my_gperf_ver2)])
8004 else
8005     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
8007 AC_SUBST(GPERF)
8009 dnl ===================================================================
8010 dnl Check for system libcmis
8011 dnl ===================================================================
8012 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
8014 dnl ===================================================================
8015 dnl C++11
8016 dnl ===================================================================
8018 if test -z "${CXXFLAGS_CXX11+x}"; then
8019     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
8020     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
8021         if test "$with_latest_c__" = yes; then
8022             CXXFLAGS_CXX11=-std:c++latest
8023         else
8024             CXXFLAGS_CXX11=-std:c++20
8025         fi
8026         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
8027     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8028         my_flags='-std=c++20 -std=c++2a'
8029         if test "$with_latest_c__" = yes; then
8030             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
8031         fi
8032         for flag in $my_flags; do
8033             if test "$COM" = MSC; then
8034                 flag="-Xclang $flag"
8035             fi
8036             save_CXXFLAGS=$CXXFLAGS
8037             CXXFLAGS="$CXXFLAGS $flag -Werror"
8038             AC_LANG_PUSH([C++])
8039             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8040                 #include <algorithm>
8041                 #include <functional>
8042                 #include <vector>
8044                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
8045                     std::sort(v.begin(), v.end(), fn);
8046                 }
8047                 ]])],[CXXFLAGS_CXX11=$flag])
8048             AC_LANG_POP([C++])
8049             CXXFLAGS=$save_CXXFLAGS
8050             if test -n "$CXXFLAGS_CXX11"; then
8051                 break
8052             fi
8053         done
8054     fi
8055     if test -n "$CXXFLAGS_CXX11"; then
8056         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
8057     else
8058         AC_MSG_ERROR(no)
8059     fi
8061 AC_SUBST(CXXFLAGS_CXX11)
8063 if test "$GCC" = "yes"; then
8064     save_CXXFLAGS=$CXXFLAGS
8065     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8066     CHECK_L_ATOMIC
8067     CXXFLAGS=$save_CXXFLAGS
8068     AC_SUBST(ATOMIC_LIB)
8071 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
8072 save_CXXFLAGS=$CXXFLAGS
8073 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8074 AC_LANG_PUSH([C++])
8076 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8077 #include <stddef.h>
8079 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
8081 namespace
8083         struct b
8084         {
8085                 int i;
8086                 int j;
8087         };
8089 ]], [[
8090 struct a
8092         int i;
8093         int j;
8095 a thinga[]={{0,0}, {1,1}};
8096 b thingb[]={{0,0}, {1,1}};
8097 size_t i = sizeof(sal_n_array_size(thinga));
8098 size_t j = sizeof(sal_n_array_size(thingb));
8099 return !(i != 0 && j != 0);
8101     ], [ AC_MSG_RESULT(yes) ],
8102     [ AC_MSG_ERROR(no)])
8103 AC_LANG_POP([C++])
8104 CXXFLAGS=$save_CXXFLAGS
8106 HAVE_GCC_FNO_SIZED_DEALLOCATION=
8107 if test "$GCC" = yes; then
8108     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
8109     AC_LANG_PUSH([C++])
8110     save_CXXFLAGS=$CXXFLAGS
8111     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
8112     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
8113     CXXFLAGS=$save_CXXFLAGS
8114     AC_LANG_POP([C++])
8115     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
8116         AC_MSG_RESULT([yes])
8117     else
8118         AC_MSG_RESULT([no])
8119     fi
8121 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
8123 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
8124 AC_LANG_PUSH([C++])
8125 save_CXXFLAGS=$CXXFLAGS
8126 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8127 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8128         #include <algorithm>
8129         #include <initializer_list>
8130         #include <vector>
8131         template<typename T> class S {
8132         private:
8133             std::vector<T> v_;
8134         public:
8135             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
8136         };
8137         constinit S<int> s{3, 2, 1};
8138     ])], [
8139         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
8140         AC_MSG_RESULT([yes])
8141     ], [AC_MSG_RESULT([no])])
8142 CXXFLAGS=$save_CXXFLAGS
8143 AC_LANG_POP([C++])
8145 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
8146 AC_LANG_PUSH([C++])
8147 save_CXXFLAGS=$CXXFLAGS
8148 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8149 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8150         struct S1 { S1(S1 &&); };
8151         struct S2: S1 {};
8152         S1 f(S2 s) { return s; }
8153     ])], [
8154         AC_DEFINE([HAVE_P1155R3],[1])
8155         AC_MSG_RESULT([yes])
8156     ], [AC_MSG_RESULT([no])])
8157 CXXFLAGS=$save_CXXFLAGS
8158 AC_LANG_POP([C++])
8160 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
8161 HAVE_CXX20_ATOMIC_REF=
8162 AC_LANG_PUSH([C++])
8163 save_CXXFLAGS=$CXXFLAGS
8164 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8165 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8166         #include <atomic>
8167         int x;
8168         std::atomic_ref<int> y(x);
8169     ])], [
8170         HAVE_CXX20_ATOMIC_REF=TRUE
8171         AC_MSG_RESULT([yes])
8172     ], [AC_MSG_RESULT([no])])
8173 CXXFLAGS=$save_CXXFLAGS
8174 AC_LANG_POP([C++])
8175 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
8177 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
8178 dnl which is included in -Wextra anyway):
8179 HAVE_WDEPRECATED_COPY_DTOR=
8180 if test "$GCC" = yes; then
8181     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
8182     AC_LANG_PUSH([C++])
8183     save_CXXFLAGS=$CXXFLAGS
8184     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
8185     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8186             HAVE_WDEPRECATED_COPY_DTOR=TRUE
8187             AC_MSG_RESULT([yes])
8188         ], [AC_MSG_RESULT([no])])
8189     CXXFLAGS=$save_CXXFLAGS
8190     AC_LANG_POP([C++])
8192 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
8194 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
8195 dnl uninitialized warning for code like
8197 dnl   OString f();
8198 dnl   boost::optional<OString> * g(bool b) {
8199 dnl       boost::optional<OString> o;
8200 dnl       if (b) o = f();
8201 dnl       return new boost::optional<OString>(o);
8202 dnl   }
8204 dnl (as is e.g. present, in a slightly more elaborate form, in
8205 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
8206 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
8207 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
8208 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8209     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
8210     AC_LANG_PUSH([C++])
8211     save_CXXFLAGS=$CXXFLAGS
8212     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
8213     if test "$ENABLE_OPTIMIZED" = TRUE; then
8214         CXXFLAGS="$CXXFLAGS -O2"
8215     else
8216         CXXFLAGS="$CXXFLAGS -O0"
8217     fi
8218     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8219             #include <new>
8220             void f1(int);
8221             struct S1 {
8222                 ~S1() { f1(n); }
8223                 int n = 0;
8224             };
8225             struct S2 {
8226                 S2() {}
8227                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
8228                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
8229                 void set(S1 s) {
8230                     new (stg) S1(s);
8231                     init = true;
8232                 }
8233                 bool init = false;
8234                 char stg[sizeof (S1)];
8235             } ;
8236             S1 f2();
8237             S2 * f3(bool b) {
8238                 S2 o;
8239                 if (b) o.set(f2());
8240                 return new S2(o);
8241             }
8242         ]])], [AC_MSG_RESULT([no])], [
8243             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8244             AC_MSG_RESULT([yes])
8245         ])
8246     CXXFLAGS=$save_CXXFLAGS
8247     AC_LANG_POP([C++])
8249 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8251 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8252 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8253 dnl hits us e.g. with GCC 10 and --enable-optimized at
8255 dnl   In file included from include/rtl/string.hxx:49,
8256 dnl                    from include/rtl/ustring.hxx:43,
8257 dnl                    from include/osl/file.hxx:35,
8258 dnl                    from include/codemaker/global.hxx:28,
8259 dnl                    from include/codemaker/options.hxx:23,
8260 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8261 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8262 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,
8263 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,
8264 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,
8265 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8266 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8267 dnl      78 |         memcpy( buffer, data, length );
8268 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8269 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8270 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8271     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8272     AC_LANG_PUSH([C++])
8273     save_CXXFLAGS=$CXXFLAGS
8274     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8275     if test "$ENABLE_OPTIMIZED" = TRUE; then
8276         CXXFLAGS="$CXXFLAGS -O2"
8277     else
8278         CXXFLAGS="$CXXFLAGS -O0"
8279     fi
8280     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8281     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8282             void fill(char const * begin, char const * end, char c);
8283             struct q {
8284                 char ids[4];
8285                 char username[6];
8286             };
8287             void test(q & c) {
8288                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8289                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8290             }
8291         ]])], [AC_MSG_RESULT([no])], [
8292             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8293             AC_MSG_RESULT([yes])
8294         ])
8295     CXXFLAGS=$save_CXXFLAGS
8296     AC_LANG_POP([C++])
8298 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8300 HAVE_DLLEXPORTINLINES=
8301 if test "$_os" = "WINNT"; then
8302     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8303     AC_LANG_PUSH([C++])
8304     save_CXXFLAGS=$CXXFLAGS
8305     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8306     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8307             HAVE_DLLEXPORTINLINES=TRUE
8308             AC_MSG_RESULT([yes])
8309         ], [AC_MSG_RESULT([no])])
8310     CXXFLAGS=$save_CXXFLAGS
8311     AC_LANG_POP([C++])
8313 AC_SUBST([HAVE_DLLEXPORTINLINES])
8315 dnl ===================================================================
8316 dnl CPU Intrinsics support - SSE, AVX
8317 dnl ===================================================================
8319 CXXFLAGS_INTRINSICS_SSE2=
8320 CXXFLAGS_INTRINSICS_SSSE3=
8321 CXXFLAGS_INTRINSICS_SSE41=
8322 CXXFLAGS_INTRINSICS_SSE42=
8323 CXXFLAGS_INTRINSICS_AVX=
8324 CXXFLAGS_INTRINSICS_AVX2=
8325 CXXFLAGS_INTRINSICS_AVX512=
8326 CXXFLAGS_INTRINSICS_AVX512F=
8327 CXXFLAGS_INTRINSICS_F16C=
8328 CXXFLAGS_INTRINSICS_FMA=
8330 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8331     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8332     flag_sse2=-msse2
8333     flag_ssse3=-mssse3
8334     flag_sse41=-msse4.1
8335     flag_sse42=-msse4.2
8336     flag_avx=-mavx
8337     flag_avx2=-mavx2
8338     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8339     flag_avx512f=-mavx512f
8340     flag_f16c=-mf16c
8341     flag_fma=-mfma
8342 else
8343     # With MSVC using -arch is in fact not necessary for being able
8344     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8345     # even if compiled with -arch:AVX, the -arch option really only affects
8346     # instructions generated for C/C++ code.
8347     # So use the matching same (or lower) -arch options, but only in order
8348     # to generate the best matching instructions for the C++ code surrounding
8349     # the intrinsics.
8350     # SSE2 is the default for x86/x64, so no need to specify the option.
8351     flag_sse2=
8352     # No specific options for these, use the next lower.
8353     flag_ssse3="$flag_sse2"
8354     flag_sse41="$flag_sse2"
8355     flag_sse42="$flag_sse2"
8356     flag_avx=-arch:AVX
8357     flag_avx2=-arch:AVX2
8358     flag_avx512=-arch:AVX512
8359     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8360     flag_avx512f=-arch:AVX2
8361     # No MSVC options for these.
8362     flag_f16c="$flag_sse2"
8363     flag_fma="$flag_sse2"
8366 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8367 AC_LANG_PUSH([C++])
8368 save_CXXFLAGS=$CXXFLAGS
8369 CXXFLAGS="$CXXFLAGS $flag_sse2"
8370 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8371     #include <emmintrin.h>
8372     int main () {
8373         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8374         c = _mm_xor_si128 (a, b);
8375         return 0;
8376     }
8377     ])],
8378     [can_compile_sse2=yes],
8379     [can_compile_sse2=no])
8380 AC_LANG_POP([C++])
8381 CXXFLAGS=$save_CXXFLAGS
8382 AC_MSG_RESULT([${can_compile_sse2}])
8383 if test "${can_compile_sse2}" = "yes" ; then
8384     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8387 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8388 AC_LANG_PUSH([C++])
8389 save_CXXFLAGS=$CXXFLAGS
8390 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8391 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8392     #include <tmmintrin.h>
8393     int main () {
8394         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8395         c = _mm_maddubs_epi16 (a, b);
8396         return 0;
8397     }
8398     ])],
8399     [can_compile_ssse3=yes],
8400     [can_compile_ssse3=no])
8401 AC_LANG_POP([C++])
8402 CXXFLAGS=$save_CXXFLAGS
8403 AC_MSG_RESULT([${can_compile_ssse3}])
8404 if test "${can_compile_ssse3}" = "yes" ; then
8405     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8408 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8409 AC_LANG_PUSH([C++])
8410 save_CXXFLAGS=$CXXFLAGS
8411 CXXFLAGS="$CXXFLAGS $flag_sse41"
8412 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8413     #include <smmintrin.h>
8414     int main () {
8415         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8416         c = _mm_cmpeq_epi64 (a, b);
8417         return 0;
8418     }
8419     ])],
8420     [can_compile_sse41=yes],
8421     [can_compile_sse41=no])
8422 AC_LANG_POP([C++])
8423 CXXFLAGS=$save_CXXFLAGS
8424 AC_MSG_RESULT([${can_compile_sse41}])
8425 if test "${can_compile_sse41}" = "yes" ; then
8426     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8429 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8430 AC_LANG_PUSH([C++])
8431 save_CXXFLAGS=$CXXFLAGS
8432 CXXFLAGS="$CXXFLAGS $flag_sse42"
8433 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8434     #include <nmmintrin.h>
8435     int main () {
8436         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8437         c = _mm_cmpgt_epi64 (a, b);
8438         return 0;
8439     }
8440     ])],
8441     [can_compile_sse42=yes],
8442     [can_compile_sse42=no])
8443 AC_LANG_POP([C++])
8444 CXXFLAGS=$save_CXXFLAGS
8445 AC_MSG_RESULT([${can_compile_sse42}])
8446 if test "${can_compile_sse42}" = "yes" ; then
8447     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8450 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8451 AC_LANG_PUSH([C++])
8452 save_CXXFLAGS=$CXXFLAGS
8453 CXXFLAGS="$CXXFLAGS $flag_avx"
8454 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8455     #include <immintrin.h>
8456     int main () {
8457         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8458         c = _mm256_xor_ps(a, b);
8459         return 0;
8460     }
8461     ])],
8462     [can_compile_avx=yes],
8463     [can_compile_avx=no])
8464 AC_LANG_POP([C++])
8465 CXXFLAGS=$save_CXXFLAGS
8466 AC_MSG_RESULT([${can_compile_avx}])
8467 if test "${can_compile_avx}" = "yes" ; then
8468     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8471 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8472 AC_LANG_PUSH([C++])
8473 save_CXXFLAGS=$CXXFLAGS
8474 CXXFLAGS="$CXXFLAGS $flag_avx2"
8475 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8476     #include <immintrin.h>
8477     int main () {
8478         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8479         c = _mm256_maddubs_epi16(a, b);
8480         return 0;
8481     }
8482     ])],
8483     [can_compile_avx2=yes],
8484     [can_compile_avx2=no])
8485 AC_LANG_POP([C++])
8486 CXXFLAGS=$save_CXXFLAGS
8487 AC_MSG_RESULT([${can_compile_avx2}])
8488 if test "${can_compile_avx2}" = "yes" ; then
8489     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8492 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8493 AC_LANG_PUSH([C++])
8494 save_CXXFLAGS=$CXXFLAGS
8495 CXXFLAGS="$CXXFLAGS $flag_avx512"
8496 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8497     #include <immintrin.h>
8498     int main () {
8499         __m512i a = _mm512_loadu_si512(0);
8500         __m512d v1 = _mm512_load_pd(0);
8501         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8502         __m512d v2 = _mm512_abs_pd(v1);
8503         return 0;
8504     }
8505     ])],
8506     [can_compile_avx512=yes],
8507     [can_compile_avx512=no])
8508 AC_LANG_POP([C++])
8509 CXXFLAGS=$save_CXXFLAGS
8510 AC_MSG_RESULT([${can_compile_avx512}])
8511 if test "${can_compile_avx512}" = "yes" ; then
8512     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8513     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8516 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8517 AC_LANG_PUSH([C++])
8518 save_CXXFLAGS=$CXXFLAGS
8519 CXXFLAGS="$CXXFLAGS $flag_f16c"
8520 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8521     #include <immintrin.h>
8522     int main () {
8523         __m128i a = _mm_set1_epi32 (0);
8524         __m128 c;
8525         c = _mm_cvtph_ps(a);
8526         return 0;
8527     }
8528     ])],
8529     [can_compile_f16c=yes],
8530     [can_compile_f16c=no])
8531 AC_LANG_POP([C++])
8532 CXXFLAGS=$save_CXXFLAGS
8533 AC_MSG_RESULT([${can_compile_f16c}])
8534 if test "${can_compile_f16c}" = "yes" ; then
8535     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8538 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8539 AC_LANG_PUSH([C++])
8540 save_CXXFLAGS=$CXXFLAGS
8541 CXXFLAGS="$CXXFLAGS $flag_fma"
8542 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8543     #include <immintrin.h>
8544     int main () {
8545         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8546         d = _mm256_fmadd_ps(a, b, c);
8547         return 0;
8548     }
8549     ])],
8550     [can_compile_fma=yes],
8551     [can_compile_fma=no])
8552 AC_LANG_POP([C++])
8553 CXXFLAGS=$save_CXXFLAGS
8554 AC_MSG_RESULT([${can_compile_fma}])
8555 if test "${can_compile_fma}" = "yes" ; then
8556     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8559 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8560 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8561 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8562 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8563 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8564 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8565 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8566 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8567 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8568 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8570 dnl ===================================================================
8571 dnl system stl sanity tests
8572 dnl ===================================================================
8573 if test "$_os" != "WINNT"; then
8575     AC_LANG_PUSH([C++])
8577     save_CPPFLAGS="$CPPFLAGS"
8578     if test -n "$MACOSX_SDK_PATH"; then
8579         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8580     fi
8582     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8583     # only.
8584     if test "$CPP_LIBRARY" = GLIBCXX; then
8585         dnl gcc#19664, gcc#22482, rhbz#162935
8586         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8587         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8588         AC_MSG_RESULT([$stlvisok])
8589         if test "$stlvisok" = "no"; then
8590             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8591         fi
8592     fi
8594     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8595     # when we don't make any dynamic libraries?
8596     if test "$DISABLE_DYNLOADING" = ""; then
8597         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8598         cat > conftestlib1.cc <<_ACEOF
8599 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8600 struct S2: S1<int> { virtual ~S2(); };
8601 S2::~S2() {}
8602 _ACEOF
8603         cat > conftestlib2.cc <<_ACEOF
8604 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8605 struct S2: S1<int> { virtual ~S2(); };
8606 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8607 _ACEOF
8608         gccvisinlineshiddenok=yes
8609         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8610             gccvisinlineshiddenok=no
8611         else
8612             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8613             dnl known to not work with -z defs (unsetting which makes the test
8614             dnl moot, though):
8615             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8616             if test "$COM_IS_CLANG" = TRUE; then
8617                 for i in $CXX $CXXFLAGS; do
8618                     case $i in
8619                     -fsanitize=*)
8620                         my_linkflagsnoundefs=
8621                         break
8622                         ;;
8623                     esac
8624                 done
8625             fi
8626             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8627                 gccvisinlineshiddenok=no
8628             fi
8629         fi
8631         rm -fr libconftest*
8632         AC_MSG_RESULT([$gccvisinlineshiddenok])
8633         if test "$gccvisinlineshiddenok" = "no"; then
8634             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8635         fi
8636     fi
8638    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8639     cat >visibility.cxx <<_ACEOF
8640 #pragma GCC visibility push(hidden)
8641 struct __attribute__ ((visibility ("default"))) TestStruct {
8642   static void Init();
8644 __attribute__ ((visibility ("default"))) void TestFunc() {
8645   TestStruct::Init();
8647 _ACEOF
8648     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8649         gccvisbroken=yes
8650     else
8651         case "$host_cpu" in
8652         i?86|x86_64)
8653             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8654                 gccvisbroken=no
8655             else
8656                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8657                     gccvisbroken=no
8658                 else
8659                     gccvisbroken=yes
8660                 fi
8661             fi
8662             ;;
8663         *)
8664             gccvisbroken=no
8665             ;;
8666         esac
8667     fi
8668     rm -f visibility.s visibility.cxx
8670     AC_MSG_RESULT([$gccvisbroken])
8671     if test "$gccvisbroken" = "yes"; then
8672         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8673     fi
8675     CPPFLAGS="$save_CPPFLAGS"
8677     AC_MSG_CHECKING([if CET endbranch is recognized])
8678 cat > endbr.s <<_ACEOF
8679 endbr32
8680 _ACEOF
8681     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8682     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8683         AC_MSG_RESULT([yes])
8684         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8685     else
8686         AC_MSG_RESULT([no])
8687     fi
8688     rm -f endbr.s endbr.o
8689     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8691     AC_LANG_POP([C++])
8694 dnl ===================================================================
8695 dnl  Clang++ tests
8696 dnl ===================================================================
8698 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8699 if test "$GCC" = "yes"; then
8700     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8701     AC_LANG_PUSH([C++])
8702     save_CXXFLAGS=$CXXFLAGS
8703     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8704     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8705     CXXFLAGS=$save_CXXFLAGS
8706     AC_LANG_POP([C++])
8707     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8708         AC_MSG_RESULT([yes])
8709     else
8710         AC_MSG_RESULT([no])
8711     fi
8713 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8715 dnl ===================================================================
8716 dnl Compiler plugins
8717 dnl ===================================================================
8719 COMPILER_PLUGINS=
8720 # currently only Clang
8722 if test "$COM_IS_CLANG" != "TRUE"; then
8723     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8724         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8725         enable_compiler_plugins=no
8726     fi
8729 COMPILER_PLUGINS_COM_IS_CLANG=
8730 if test "$COM_IS_CLANG" = "TRUE"; then
8731     if test -n "$enable_compiler_plugins"; then
8732         compiler_plugins="$enable_compiler_plugins"
8733     elif test -n "$ENABLE_DBGUTIL"; then
8734         compiler_plugins=test
8735     else
8736         compiler_plugins=no
8737     fi
8738     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8739         if test "$CLANGVER" -lt 120001; then
8740             if test "$compiler_plugins" = yes; then
8741                 AC_MSG_ERROR(
8742                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8743             else
8744                 compiler_plugins=no
8745             fi
8746         fi
8747     fi
8748     if test "$compiler_plugins" != "no"; then
8749         dnl The prefix where Clang resides, override to where Clang resides if
8750         dnl using a source build:
8751         if test -z "$CLANGDIR"; then
8752             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8753         fi
8754         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8755         if test -z "$COMPILER_PLUGINS_CXX"; then
8756             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8757         fi
8758         clangbindir=$CLANGDIR/bin
8759         if test "$build_os" = "cygwin"; then
8760             clangbindir=$(cygpath -u "$clangbindir")
8761         fi
8762         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8763         if test -n "$LLVM_CONFIG"; then
8764             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8765             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8766             if test -z "$CLANGLIBDIR"; then
8767                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8768             fi
8769             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8770             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8771             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8772                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8773                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8774                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8775                 fi
8776             fi
8777             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8778             clangobjdir=$($LLVM_CONFIG --obj-root)
8779             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8780                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8781             fi
8782         fi
8783         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8784         AC_LANG_PUSH([C++])
8785         save_CXX=$CXX
8786         save_CXXCPP=$CXXCPP
8787         save_CPPFLAGS=$CPPFLAGS
8788         save_CXXFLAGS=$CXXFLAGS
8789         save_LDFLAGS=$LDFLAGS
8790         save_LIBS=$LIBS
8791         CXX=$COMPILER_PLUGINS_CXX
8792         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8793         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8794         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8795         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8796             [COMPILER_PLUGINS=TRUE],
8797             [
8798             if test "$compiler_plugins" = "yes"; then
8799                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8800             else
8801                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8802                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8803             fi
8804             ])
8805         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8806         dnl comment in compilerplugins/Makefile-clang.mk:
8807         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8808             LDFLAGS=""
8809             AC_MSG_CHECKING([for clang libraries to use])
8810             if test -z "$CLANGTOOLLIBS"; then
8811                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8812                 AC_LINK_IFELSE([
8813                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8814                         [[ clang::FullSourceLoc().dump(); ]])
8815                 ],[CLANGTOOLLIBS="$LIBS"],[])
8816             fi
8817             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8818             dnl list of individual -lclang* (but note that that list can become outdated over time,
8819             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8820             dnl needs to include -lclangSupport now"):
8821             if test -z "$CLANGTOOLLIBS"; then
8822                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8823  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8824                 AC_LINK_IFELSE([
8825                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8826                         [[ clang::FullSourceLoc().dump(); ]])
8827                 ],[CLANGTOOLLIBS="$LIBS"],[])
8828             fi
8829             AC_MSG_RESULT([$CLANGTOOLLIBS])
8830             if test -z "$CLANGTOOLLIBS"; then
8831                 if test "$compiler_plugins" = "yes"; then
8832                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8833                 else
8834                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8835                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8836                 fi
8837                 COMPILER_PLUGINS=
8838             fi
8839             if test -n "$COMPILER_PLUGINS"; then
8840                 if test -z "$CLANGSYSINCLUDE"; then
8841                     if test -n "$LLVM_CONFIG"; then
8842                         # Path to the clang system headers (no idea if there's a better way to get it).
8843                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8844                     fi
8845                 fi
8846             fi
8847         fi
8848         CXX=$save_CXX
8849         CXXCPP=$save_CXXCPP
8850         CPPFLAGS=$save_CPPFLAGS
8851         CXXFLAGS=$save_CXXFLAGS
8852         LDFLAGS=$save_LDFLAGS
8853         LIBS="$save_LIBS"
8854         AC_LANG_POP([C++])
8856         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8857         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8858             #ifndef __clang__
8859             you lose
8860             #endif
8861             int foo=42;
8862             ]])],
8863             [AC_MSG_RESULT([yes])
8864              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8865             [AC_MSG_RESULT([no])])
8866         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8867     fi
8868 else
8869     if test "$enable_compiler_plugins" = "yes"; then
8870         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8871     fi
8873 COMPILER_PLUGINS_ANALYZER_PCH=
8874 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8875     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8877 AC_SUBST(COMPILER_PLUGINS)
8878 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8879 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8880 AC_SUBST(COMPILER_PLUGINS_CXX)
8881 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8882 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8883 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8884 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8885 AC_SUBST(CLANGDIR)
8886 AC_SUBST(CLANGLIBDIR)
8887 AC_SUBST(CLANGTOOLLIBS)
8888 AC_SUBST(CLANGSYSINCLUDE)
8890 # Plugin to help linker.
8891 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8892 # This makes --enable-lto build with clang work.
8893 AC_SUBST(LD_PLUGIN)
8895 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8896 AC_SUBST(HAVE_POSIX_FALLOCATE)
8898 JITC_PROCESSOR_TYPE=""
8899 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8900     # IBMs JDK needs this...
8901     JITC_PROCESSOR_TYPE=6
8902     export JITC_PROCESSOR_TYPE
8904 AC_SUBST([JITC_PROCESSOR_TYPE])
8906 # Misc Windows Stuff
8907 AC_ARG_WITH(ucrt-dir,
8908     AS_HELP_STRING([--with-ucrt-dir],
8909         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8910         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8911         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8912             Windows6.1-KB2999226-x64.msu
8913             Windows6.1-KB2999226-x86.msu
8914             Windows8.1-KB2999226-x64.msu
8915             Windows8.1-KB2999226-x86.msu
8916             Windows8-RT-KB2999226-x64.msu
8917             Windows8-RT-KB2999226-x86.msu
8918         A zip archive including those files is available from Microsoft site:
8919         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8922 UCRT_REDISTDIR="$with_ucrt_dir"
8923 if test $_os = "WINNT"; then
8924     find_msvc_x64_dlls
8925     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8926     MSVC_DLLS="$msvcdlls"
8927     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8928         with_redist=143
8929     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8930         with_redist=142
8931     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8932         with_redist=141
8933     fi
8934     for i in $PKGFORMAT; do
8935         if test "$i" = msi; then
8936             find_msms "$with_redist"
8937             if test -n "$msmdir"; then
8938                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8939                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8940             fi
8941             break
8942         fi
8943     done
8945     if test "$UCRT_REDISTDIR" = "no"; then
8946         dnl explicitly disabled
8947         UCRT_REDISTDIR=""
8948     else
8949         PathFormat "$UCRT_REDISTDIR"
8950         UCRT_REDISTDIR="$formatted_path"
8951         UCRT_REDISTDIR_unix="$formatted_path_unix"
8952         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8953                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8954                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8955                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8956                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8957                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8958             UCRT_REDISTDIR=""
8959             if test -n "$PKGFORMAT"; then
8960                for i in $PKGFORMAT; do
8961                    case "$i" in
8962                    msi)
8963                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8964                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8965                        ;;
8966                    esac
8967                done
8968             fi
8969         fi
8970     fi
8973 AC_SUBST(UCRT_REDISTDIR)
8974 AC_SUBST(MSVC_DLL_PATH)
8975 AC_SUBST(MSVC_DLLS)
8976 AC_SUBST(MSM_PATH)
8979 dnl ===================================================================
8980 dnl Checks for Java
8981 dnl ===================================================================
8982 if test "$ENABLE_JAVA" != ""; then
8984     # Windows-specific tests
8985     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8986         if test -z "$with_jdk_home"; then
8987             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8988             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8989             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8990             if test -n "$regvalue"; then
8991                 ver=$regvalue
8992                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8993                 with_jdk_home=$regvalue
8994             fi
8995             howfound="found automatically"
8996         else
8997             howfound="you passed"
8998         fi
8999         PathFormat "$with_jdk_home"
9000         with_jdk_home="$formatted_path_unix"
9002         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
9003             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 8])
9004         fi
9005         with_java="java.exe"
9006         javacompiler="javac.exe"
9007         javadoc="javadoc.exe"
9008     fi
9010     # 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.
9011     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
9012     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
9013         with_jdk_home=`/usr/libexec/java_home`
9014     fi
9016     JAVA_HOME=; export JAVA_HOME
9017     if test -z "$with_jdk_home"; then
9018         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
9019     else
9020         _java_path="$with_jdk_home/bin/$with_java"
9021         dnl Check if there is a Java interpreter at all.
9022         if test -x "$_java_path"; then
9023             JAVAINTERPRETER=$_java_path
9024         else
9025             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
9026         fi
9027     fi
9029     dnl Check that the JDK found is correct architecture (at least 2 reasons to
9030     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
9031     dnl loaded by java to run JunitTests:
9032     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
9033         shortjdkhome=`cygpath -d "$with_jdk_home"`
9034         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
9035             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
9036             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
9037         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
9038             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
9039             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
9040         fi
9042         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
9043             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
9044         fi
9045         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
9046     elif test "$cross_compiling" != "yes"; then
9047         case $CPUNAME in
9048             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
9049                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
9050                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
9051                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
9052                 fi
9053                 ;;
9054             *) # assumption: everything else 32-bit
9055                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
9056                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
9057                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
9058                 fi
9059                 ;;
9060         esac
9061     fi
9064 dnl ===================================================================
9065 dnl Checks for JDK.
9066 dnl ===================================================================
9068 # Whether all the complexity here actually is needed any more or not, no idea.
9070 JDK_SECURITYMANAGER_DISALLOWED=
9071 MODULAR_JAVA=
9072 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9073     _gij_longver=0
9074     AC_MSG_CHECKING([the installed JDK])
9075     if test -n "$JAVAINTERPRETER"; then
9076         dnl java -version sends output to stderr!
9077         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
9078             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
9079         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
9080             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
9081         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
9082             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
9083         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
9084             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
9085         else
9086             JDK=sun
9088             dnl Sun JDK specific tests
9089             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
9090             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
9092             if test "$_jdk_ver" -lt 10800; then
9093                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
9094             fi
9095             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
9096             dnl completely removed in some Java version > 18 (see
9097             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
9098             if test "$_jdk_ver" -ge 180000; then
9099                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
9100             fi
9102             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
9103             if test "$_os" = "WINNT"; then
9104                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
9105             fi
9106             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
9108             dnl Check whether the build Java supports modules
9109             if test "$_jdk_ver" -ge 90000; then
9110                 MODULAR_JAVA=TRUE
9111             else
9112                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
9113                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
9114             fi
9116             # set to limit VM usage for JunitTests
9117             JAVAIFLAGS=-Xmx64M
9118             # set to limit VM usage for javac
9119             JAVACFLAGS=-J-Xmx128M
9120         fi
9121     else
9122         AC_MSG_ERROR([Java not found. You need at least JDK 8])
9123     fi
9124 else
9125     if test -z "$ENABLE_JAVA"; then
9126         dnl Java disabled
9127         JAVA_HOME=
9128         export JAVA_HOME
9129     elif test "$cross_compiling" = "yes"; then
9130         # Just assume compatibility of build and host JDK
9131         JDK=$JDK_FOR_BUILD
9132         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
9133     fi
9136 dnl ===================================================================
9137 dnl Checks for javac
9138 dnl ===================================================================
9139 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9140     : ${JAVA_SOURCE_VER=8}
9141     : ${JAVA_TARGET_VER=8}
9142     if test -z "$with_jdk_home"; then
9143         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
9144     else
9145         _javac_path="$with_jdk_home/bin/$javacompiler"
9146         dnl Check if there is a Java compiler at all.
9147         if test -x "$_javac_path"; then
9148             JAVACOMPILER=$_javac_path
9149         fi
9150     fi
9151     if test -z "$JAVACOMPILER"; then
9152         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
9153     fi
9154     if test "$build_os" = "cygwin"; then
9155         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
9156             JAVACOMPILER="${JAVACOMPILER}.exe"
9157         fi
9158         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
9159     fi
9162 dnl ===================================================================
9163 dnl Checks for javadoc
9164 dnl ===================================================================
9165 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9166     if test -z "$with_jdk_home"; then
9167         AC_PATH_PROG(JAVADOC, $javadoc)
9168     else
9169         _javadoc_path="$with_jdk_home/bin/$javadoc"
9170         dnl Check if there is a javadoc at all.
9171         if test -x "$_javadoc_path"; then
9172             JAVADOC=$_javadoc_path
9173         else
9174             AC_PATH_PROG(JAVADOC, $javadoc)
9175         fi
9176     fi
9177     if test -z "$JAVADOC"; then
9178         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
9179     fi
9180     if test "$build_os" = "cygwin"; then
9181         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
9182             JAVADOC="${JAVADOC}.exe"
9183         fi
9184         JAVADOC=`win_short_path_for_make "$JAVADOC"`
9185     fi
9187     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
9188     JAVADOCISGJDOC="yes"
9189     fi
9191 AC_SUBST(JAVADOC)
9192 AC_SUBST(JAVADOCISGJDOC)
9194 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
9195     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
9196     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
9197         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
9198            # try to recover first by looking whether we have an alternative
9199            # system as in Debian or newer SuSEs where following /usr/bin/javac
9200            # over /etc/alternatives/javac leads to the right bindir where we
9201            # just need to strip a bit away to get a valid JAVA_HOME
9202            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
9203         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
9204             # maybe only one level of symlink (e.g. on Mac)
9205             JAVA_HOME=$(readlink $JAVACOMPILER)
9206             if test "$(dirname $JAVA_HOME)" = "."; then
9207                 # we've got no path to trim back
9208                 JAVA_HOME=""
9209             fi
9210         else
9211             # else warn
9212             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
9213             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
9214             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
9215             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
9216         fi
9217         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
9218         if test "$JAVA_HOME" != "/usr"; then
9219             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9220                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
9221                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
9222                 dnl Tiger already returns a JDK path...
9223                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
9224             else
9225                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
9226                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
9227                 dnl that checks which version to run
9228                 if test -f "$JAVA_HOME"; then
9229                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
9230                 fi
9231             fi
9232         fi
9233     fi
9234     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
9236     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9237     if test -z "$JAVA_HOME"; then
9238         if test "x$with_jdk_home" = "x"; then
9239             cat > findhome.java <<_ACEOF
9240 [import java.io.File;
9242 class findhome
9244     public static void main(String args[])
9245     {
9246         String jrelocation = System.getProperty("java.home");
9247         File jre = new File(jrelocation);
9248         System.out.println(jre.getParent());
9249     }
9251 _ACEOF
9252             AC_MSG_CHECKING([if javac works])
9253             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9254             AC_TRY_EVAL(javac_cmd)
9255             if test $? = 0 -a -f ./findhome.class; then
9256                 AC_MSG_RESULT([javac works])
9257             else
9258                 echo "configure: javac test failed" >&5
9259                 cat findhome.java >&5
9260                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9261             fi
9262             AC_MSG_CHECKING([if gij knows its java.home])
9263             JAVA_HOME=`$JAVAINTERPRETER findhome`
9264             if test $? = 0 -a "$JAVA_HOME" != ""; then
9265                 AC_MSG_RESULT([$JAVA_HOME])
9266             else
9267                 echo "configure: java test failed" >&5
9268                 cat findhome.java >&5
9269                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9270             fi
9271             # clean-up after ourselves
9272             rm -f ./findhome.java ./findhome.class
9273         else
9274             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9275         fi
9276     fi
9278     # now check if $JAVA_HOME is really valid
9279     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9280         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9281             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9282             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9283             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9284             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9285             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9286             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9287         fi
9288     fi
9289     PathFormat "$JAVA_HOME"
9290     JAVA_HOME="$formatted_path_unix"
9293 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9294     "$_os" != Darwin
9295 then
9296     AC_MSG_CHECKING([for JAWT lib])
9297     if test "$_os" = WINNT; then
9298         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9299         JAWTLIB=jawt.lib
9300     else
9301         case "$host_cpu" in
9302         arm*)
9303             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9304             JAVA_ARCH=$my_java_arch
9305             ;;
9306         i*86)
9307             my_java_arch=i386
9308             ;;
9309         m68k)
9310             my_java_arch=m68k
9311             ;;
9312         powerpc)
9313             my_java_arch=ppc
9314             ;;
9315         powerpc64)
9316             my_java_arch=ppc64
9317             ;;
9318         powerpc64le)
9319             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9320             JAVA_ARCH=$my_java_arch
9321             ;;
9322         sparc64)
9323             my_java_arch=sparcv9
9324             ;;
9325         x86_64)
9326             my_java_arch=amd64
9327             ;;
9328         *)
9329             my_java_arch=$host_cpu
9330             ;;
9331         esac
9332         # This is where JDK9 puts the library
9333         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9334             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9335         else
9336             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9337         fi
9338         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9339     fi
9340     AC_MSG_RESULT([$JAWTLIB])
9342 AC_SUBST(JAWTLIB)
9344 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9345     case "$host_os" in
9347     cygwin*|wsl*)
9348         JAVAINC="-I$JAVA_HOME/include/win32"
9349         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9350         ;;
9352     darwin*)
9353         if test -d "$JAVA_HOME/include/darwin"; then
9354             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9355         else
9356             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9357         fi
9358         ;;
9360     dragonfly*)
9361         JAVAINC="-I$JAVA_HOME/include"
9362         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9363         ;;
9365     freebsd*)
9366         JAVAINC="-I$JAVA_HOME/include"
9367         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9368         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9369         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9370         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9371         ;;
9373     k*bsd*-gnu*)
9374         JAVAINC="-I$JAVA_HOME/include"
9375         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9376         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9377         ;;
9379     linux-gnu*)
9380         JAVAINC="-I$JAVA_HOME/include"
9381         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9382         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9383         ;;
9385     *netbsd*)
9386         JAVAINC="-I$JAVA_HOME/include"
9387         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9388         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9389        ;;
9391     openbsd*)
9392         JAVAINC="-I$JAVA_HOME/include"
9393         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9394         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9395         ;;
9397     solaris*)
9398         JAVAINC="-I$JAVA_HOME/include"
9399         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9400         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9401         ;;
9402     esac
9404 SOLARINC="$SOLARINC $JAVAINC"
9406 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9407     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9408     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9409     JDK_FOR_BUILD=$JDK
9410     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9413 AC_SUBST(JAVACFLAGS)
9414 AC_SUBST(JAVACOMPILER)
9415 AC_SUBST(JAVAINTERPRETER)
9416 AC_SUBST(JAVAIFLAGS)
9417 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9418 AC_SUBST(JAVA_HOME)
9419 AC_SUBST(JAVA_HOME_FOR_BUILD)
9420 AC_SUBST(JDK)
9421 AC_SUBST(JDK_FOR_BUILD)
9422 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9423 AC_SUBST(JAVA_SOURCE_VER)
9424 AC_SUBST(JAVA_TARGET_VER)
9425 AC_SUBST(MODULAR_JAVA)
9428 dnl ===================================================================
9429 dnl Export file validation
9430 dnl ===================================================================
9431 AC_MSG_CHECKING([whether to enable export file validation])
9432 if test "$with_export_validation" != "no"; then
9433     if test -z "$ENABLE_JAVA"; then
9434         if test "$with_export_validation" = "yes"; then
9435             AC_MSG_ERROR([requested, but Java is disabled])
9436         else
9437             AC_MSG_RESULT([no, as Java is disabled])
9438         fi
9439     elif ! test -d "${SRC_ROOT}/schema"; then
9440         if test "$with_export_validation" = "yes"; then
9441             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9442         else
9443             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9444         fi
9445     else
9446         AC_MSG_RESULT([yes])
9447         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9449         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9450         if test -z "$ODFVALIDATOR"; then
9451             # remember to download the ODF toolkit with validator later
9452             AC_MSG_NOTICE([no odfvalidator found, will download it])
9453             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9454             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9456             # and fetch name of odfvalidator jar name from download.lst
9457             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9458             AC_SUBST(ODFVALIDATOR_JAR)
9460             if test -z "$ODFVALIDATOR_JAR"; then
9461                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9462             fi
9463         fi
9464         if test "$build_os" = "cygwin"; then
9465             # In case of Cygwin it will be executed from Windows,
9466             # so we need to run bash and absolute path to validator
9467             # so instead of "odfvalidator" it will be
9468             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9469             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9470         else
9471             ODFVALIDATOR="sh $ODFVALIDATOR"
9472         fi
9473         AC_SUBST(ODFVALIDATOR)
9476         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9477         if test -z "$OFFICEOTRON"; then
9478             # remember to download the officeotron with validator later
9479             AC_MSG_NOTICE([no officeotron found, will download it])
9480             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9481             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9483             # and fetch name of officeotron jar name from download.lst
9484             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9485             AC_SUBST(OFFICEOTRON_JAR)
9487             if test -z "$OFFICEOTRON_JAR"; then
9488                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9489             fi
9490         else
9491             # check version of existing officeotron
9492             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9493             if test 0"$OFFICEOTRON_VER" -lt 704; then
9494                 AC_MSG_ERROR([officeotron too old])
9495             fi
9496         fi
9497         if test "$build_os" = "cygwin"; then
9498             # In case of Cygwin it will be executed from Windows,
9499             # so we need to run bash and absolute path to validator
9500             # so instead of "odfvalidator" it will be
9501             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9502             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9503         else
9504             OFFICEOTRON="sh $OFFICEOTRON"
9505         fi
9506     fi
9507     AC_SUBST(OFFICEOTRON)
9508 else
9509     AC_MSG_RESULT([no])
9512 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9513 if test "$with_bffvalidator" != "no"; then
9514     AC_DEFINE(HAVE_BFFVALIDATOR)
9516     if test "$with_export_validation" = "no"; then
9517         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9518     fi
9520     if test "$with_bffvalidator" = "yes"; then
9521         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9522     else
9523         BFFVALIDATOR="$with_bffvalidator"
9524     fi
9526     if test "$build_os" = "cygwin"; then
9527         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9528             AC_MSG_RESULT($BFFVALIDATOR)
9529         else
9530             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9531         fi
9532     elif test -n "$BFFVALIDATOR"; then
9533         # We are not in Cygwin but need to run Windows binary with wine
9534         AC_PATH_PROGS(WINE, wine)
9536         # so swap in a shell wrapper that converts paths transparently
9537         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9538         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9539         AC_SUBST(BFFVALIDATOR_EXE)
9540         AC_MSG_RESULT($BFFVALIDATOR)
9541     else
9542         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9543     fi
9544     AC_SUBST(BFFVALIDATOR)
9545 else
9546     AC_MSG_RESULT([no])
9549 dnl ===================================================================
9550 dnl Check for epm (not needed for Windows)
9551 dnl ===================================================================
9552 AC_MSG_CHECKING([whether to enable EPM for packing])
9553 if test "$enable_epm" = "yes"; then
9554     AC_MSG_RESULT([yes])
9555     if test "$_os" != "WINNT"; then
9556         if test $_os = Darwin; then
9557             EPM=internal
9558         elif test -n "$with_epm"; then
9559             EPM=$with_epm
9560         else
9561             AC_PATH_PROG(EPM, epm, no)
9562         fi
9563         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9564             AC_MSG_NOTICE([EPM will be built.])
9565             BUILD_TYPE="$BUILD_TYPE EPM"
9566             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9567         else
9568             # Gentoo has some epm which is something different...
9569             AC_MSG_CHECKING([whether the found epm is the right epm])
9570             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9571                 AC_MSG_RESULT([yes])
9572             else
9573                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9574             fi
9575             AC_MSG_CHECKING([epm version])
9576             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9577             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9578                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9579                 AC_MSG_RESULT([OK, >= 3.7])
9580             else
9581                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9582                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9583             fi
9584         fi
9585     fi
9587     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9588         AC_MSG_CHECKING([for rpm])
9589         for a in "$RPM" rpmbuild rpm; do
9590             $a --usage >/dev/null 2> /dev/null
9591             if test $? -eq 0; then
9592                 RPM=$a
9593                 break
9594             else
9595                 $a --version >/dev/null 2> /dev/null
9596                 if test $? -eq 0; then
9597                     RPM=$a
9598                     break
9599                 fi
9600             fi
9601         done
9602         if test -z "$RPM"; then
9603             AC_MSG_ERROR([not found])
9604         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9605             RPM_PATH=`command -v $RPM`
9606             AC_MSG_RESULT([$RPM_PATH])
9607             SCPDEFS="$SCPDEFS -DWITH_RPM"
9608         else
9609             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9610         fi
9611     fi
9612     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9613         AC_PATH_PROG(DPKG, dpkg, no)
9614         if test "$DPKG" = "no"; then
9615             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9616         fi
9617     fi
9618     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9619        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9620         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9621             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9622                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9623                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9624                     AC_MSG_RESULT([yes])
9625                 else
9626                     AC_MSG_RESULT([no])
9627                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9628                         _pt="rpm"
9629                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9630                         add_warning "the rpms will need to be installed with --nodeps"
9631                     else
9632                         _pt="pkg"
9633                     fi
9634                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9635                     add_warning "the ${_pt}s will not be relocatable"
9636                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9637                                  relocation will work, you need to patch your epm with the
9638                                  patch in epm/epm-3.7.patch or build with
9639                                  --with-epm=internal which will build a suitable epm])
9640                 fi
9641             fi
9642         fi
9643     fi
9644     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9645         AC_PATH_PROG(PKGMK, pkgmk, no)
9646         if test "$PKGMK" = "no"; then
9647             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9648         fi
9649     fi
9650     AC_SUBST(RPM)
9651     AC_SUBST(DPKG)
9652     AC_SUBST(PKGMK)
9653 else
9654     for i in $PKGFORMAT; do
9655         case "$i" in
9656         bsd | deb | pkg | rpm | native | portable)
9657             AC_MSG_ERROR(
9658                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9659             ;;
9660         esac
9661     done
9662     AC_MSG_RESULT([no])
9663     EPM=NO
9665 AC_SUBST(EPM)
9667 ENABLE_LWP=
9668 if test "$enable_lotuswordpro" = "yes"; then
9669     ENABLE_LWP="TRUE"
9671 AC_SUBST(ENABLE_LWP)
9673 dnl ===================================================================
9674 dnl Check for building ODK
9675 dnl ===================================================================
9676 AC_MSG_CHECKING([whether to build the ODK])
9677 if test "$enable_odk" = yes; then
9678     if test "$DISABLE_DYNLOADING" = TRUE; then
9679         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9680     fi
9681     AC_MSG_RESULT([yes])
9682     BUILD_TYPE="$BUILD_TYPE ODK"
9683 else
9684     AC_MSG_RESULT([no])
9687 if test "$enable_odk" != yes; then
9688     unset DOXYGEN
9689 else
9690     if test "$with_doxygen" = no; then
9691         AC_MSG_CHECKING([for doxygen])
9692         unset DOXYGEN
9693         AC_MSG_RESULT([no])
9694     else
9695         if test "$with_doxygen" = yes; then
9696             AC_PATH_PROG([DOXYGEN], [doxygen])
9697             if test -z "$DOXYGEN"; then
9698                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9699             fi
9700             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9701                 if ! dot -V 2>/dev/null; then
9702                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9703                 fi
9704             fi
9705         else
9706             AC_MSG_CHECKING([for doxygen])
9707             PathFormat "$with_doxygen"
9708             DOXYGEN="$formatted_path_unix"
9709             AC_MSG_RESULT([$formatted_path])
9710         fi
9711         if test -n "$DOXYGEN"; then
9712             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9713             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9714             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9715                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9716             fi
9717         fi
9718         if test -n "$WSL_ONLY_AS_HELPER"; then
9719             dnl what really should be tested is whether it is doxygen from windows-realm
9720             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9721             dnl using doxygen from wsl container would be possible, but there's a performance
9722             dnl penalty when accessing the files outside the container
9723             AC_MSG_CHECKING([whether doxygen is a windows executable])
9724             if $(file "$DOXYGEN" | grep -q "PE32"); then
9725                 AC_MSG_RESULT([yes])
9726             else
9727                 AC_MSG_RESULT([no])
9728                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9729             fi
9730         fi
9731     fi
9733 AC_SUBST([DOXYGEN])
9735 dnl ==================================================================
9736 dnl libfuzzer
9737 dnl ==================================================================
9738 AC_MSG_CHECKING([whether to enable fuzzers])
9739 if test "$enable_fuzzers" != yes; then
9740     AC_MSG_RESULT([no])
9741 else
9742     if test -z $LIB_FUZZING_ENGINE; then
9743       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9744     fi
9745     AC_MSG_RESULT([yes])
9746     ENABLE_FUZZERS="TRUE"
9747     AC_DEFINE([ENABLE_FUZZERS],1)
9748     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9750 AC_SUBST(LIB_FUZZING_ENGINE)
9752 dnl ===================================================================
9753 dnl Check for system zlib
9754 dnl ===================================================================
9755 if test "$with_system_zlib" = "auto"; then
9756     case "$_os" in
9757     WINNT)
9758         with_system_zlib="$with_system_libs"
9759         ;;
9760     *)
9761         if test "$enable_fuzzers" != "yes"; then
9762             with_system_zlib=yes
9763         else
9764             with_system_zlib=no
9765         fi
9766         ;;
9767     esac
9770 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9771 dnl and has no pkg-config for it at least on some tinderboxes,
9772 dnl so leaving that out for now
9773 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9774 AC_MSG_CHECKING([which zlib to use])
9775 if test "$with_system_zlib" = "yes"; then
9776     AC_MSG_RESULT([external])
9777     SYSTEM_ZLIB=TRUE
9778     AC_CHECK_HEADER(zlib.h, [],
9779         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9780     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9781         [AC_MSG_ERROR(zlib not found or functional)], [])
9782 else
9783     AC_MSG_RESULT([internal])
9784     SYSTEM_ZLIB=
9785     BUILD_TYPE="$BUILD_TYPE ZLIB"
9786     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9787     if test "$COM" = "MSC"; then
9788         ZLIB_LIBS='$(gb_StaticLibrary_WORKDIR)/zlib.lib'
9789     else
9790         ZLIB_LIBS='-L$(gb_StaticLibrary_WORKDIR) -lzlib'
9791     fi
9793 AC_SUBST(ZLIB_CFLAGS)
9794 AC_SUBST(ZLIB_LIBS)
9795 AC_SUBST(SYSTEM_ZLIB)
9797 dnl ===================================================================
9798 dnl Check for system jpeg
9799 dnl ===================================================================
9800 AC_MSG_CHECKING([which libjpeg to use])
9801 if test "$with_system_jpeg" = "yes"; then
9802     AC_MSG_RESULT([external])
9803     SYSTEM_LIBJPEG=TRUE
9804     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9805         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9806     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9807         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9808 else
9809     SYSTEM_LIBJPEG=
9810     AC_MSG_RESULT([internal, libjpeg-turbo])
9811     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9813     case "$host_cpu" in
9814     x86_64 | amd64 | i*86 | x86 | ia32)
9815         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9816         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9817             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9818                 NASM="$LODE_HOME/opt/bin/nasm"
9819             elif test -x "/opt/lo/bin/nasm"; then
9820                 NASM="/opt/lo/bin/nasm"
9821             fi
9822         fi
9824         if test -n "$NASM"; then
9825             AC_MSG_CHECKING([for object file format of host system])
9826             case "$host_os" in
9827               cygwin* | mingw* | pw32* | wsl*)
9828                 case "$host_cpu" in
9829                   x86_64)
9830                     objfmt='Win64-COFF'
9831                     ;;
9832                   *)
9833                     objfmt='Win32-COFF'
9834                     ;;
9835                 esac
9836               ;;
9837               msdosdjgpp* | go32*)
9838                 objfmt='COFF'
9839               ;;
9840               os2-emx*) # not tested
9841                 objfmt='MSOMF' # obj
9842               ;;
9843               linux*coff* | linux*oldld*)
9844                 objfmt='COFF' # ???
9845               ;;
9846               linux*aout*)
9847                 objfmt='a.out'
9848               ;;
9849               linux*)
9850                 case "$host_cpu" in
9851                   x86_64)
9852                     objfmt='ELF64'
9853                     ;;
9854                   *)
9855                     objfmt='ELF'
9856                     ;;
9857                 esac
9858               ;;
9859               kfreebsd* | freebsd* | netbsd* | openbsd*)
9860                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9861                   objfmt='BSD-a.out'
9862                 else
9863                   case "$host_cpu" in
9864                     x86_64 | amd64)
9865                       objfmt='ELF64'
9866                       ;;
9867                     *)
9868                       objfmt='ELF'
9869                       ;;
9870                   esac
9871                 fi
9872               ;;
9873               solaris* | sunos* | sysv* | sco*)
9874                 case "$host_cpu" in
9875                   x86_64)
9876                     objfmt='ELF64'
9877                     ;;
9878                   *)
9879                     objfmt='ELF'
9880                     ;;
9881                 esac
9882               ;;
9883               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9884                 case "$host_cpu" in
9885                   x86_64)
9886                     objfmt='Mach-O64'
9887                     ;;
9888                   *)
9889                     objfmt='Mach-O'
9890                     ;;
9891                 esac
9892               ;;
9893               *)
9894                 objfmt='ELF ?'
9895               ;;
9896             esac
9898             AC_MSG_RESULT([$objfmt])
9899             if test "$objfmt" = 'ELF ?'; then
9900               objfmt='ELF'
9901               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9902             fi
9904             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9905             case "$objfmt" in
9906               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9907               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9908               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9909               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9910               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9911               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9912               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9913               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9914               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9915               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9916               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9917             esac
9918             AC_MSG_RESULT([$NAFLAGS])
9920             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9921             cat > conftest.asm << EOF
9922             [%line __oline__ "configure"
9923                     section .text
9924                     global  _main,main
9925             _main:
9926             main:   xor     eax,eax
9927                     ret
9928             ]
9930             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9931             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9932               AC_MSG_RESULT(yes)
9933             else
9934               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9935               cat conftest.asm >&AS_MESSAGE_LOG_FD
9936               rm -rf conftest*
9937               AC_MSG_RESULT(no)
9938               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9939               NASM=""
9940             fi
9942         fi
9944         if test -z "$NASM"; then
9945 cat << _EOS
9946 ****************************************************************************
9947 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9948 To get one please:
9950 _EOS
9951             if test "$build_os" = "cygwin"; then
9952 cat << _EOS
9953 install a pre-compiled binary for Win32
9955 mkdir -p /opt/lo/bin
9956 cd /opt/lo/bin
9957 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9958 chmod +x nasm
9960 or get and install one from https://www.nasm.us/
9962 Then re-run autogen.sh
9964 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9965 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9967 _EOS
9968             else
9969 cat << _EOS
9970 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9972 _EOS
9973             fi
9974             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9975             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9976         fi
9977       ;;
9978     esac
9981 AC_SUBST(NASM)
9982 AC_SUBST(NAFLAGS)
9983 AC_SUBST(LIBJPEG_CFLAGS)
9984 AC_SUBST(LIBJPEG_LIBS)
9985 AC_SUBST(SYSTEM_LIBJPEG)
9987 dnl ===================================================================
9988 dnl Check for system clucene
9989 dnl ===================================================================
9990 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9991 if test "$SYSTEM_CLUCENE" = TRUE; then
9992     AC_LANG_PUSH([C++])
9993     save_CXXFLAGS=$CXXFLAGS
9994     save_CPPFLAGS=$CPPFLAGS
9995     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9996     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9997     dnl https://sourceforge.net/p/clucene/bugs/200/
9998     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9999     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
10000                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
10001     CXXFLAGS=$save_CXXFLAGS
10002     CPPFLAGS=$save_CPPFLAGS
10003     AC_LANG_POP([C++])
10004     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
10007 dnl ===================================================================
10008 dnl Check for system expat
10009 dnl ===================================================================
10010 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
10012 dnl ===================================================================
10013 dnl Check for system xmlsec
10014 dnl ===================================================================
10015 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
10017 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
10018 if test "$enable_eot" = "yes"; then
10019     ENABLE_EOT="TRUE"
10020     AC_DEFINE([ENABLE_EOT])
10021     AC_MSG_RESULT([yes])
10023     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
10024 else
10025     ENABLE_EOT=
10026     AC_MSG_RESULT([no])
10028 AC_SUBST([ENABLE_EOT])
10030 dnl ===================================================================
10031 dnl Check for DLP libs
10032 dnl ===================================================================
10033 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
10034 AS_IF([test "$COM" = "MSC"],
10035       [librevenge_libdir='$(gb_Library_DLLDIR)'],
10036       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
10038 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
10039 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
10041 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
10043 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
10045 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
10046 AS_IF([test "$COM" = "MSC"],
10047       [libwpd_libdir='$(gb_Library_DLLDIR)'],
10048       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
10050 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
10051 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
10053 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
10055 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
10056 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
10058 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
10060 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
10062 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
10064 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
10065 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
10067 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
10068 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
10070 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
10072 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
10073 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
10075 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
10077 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
10079 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
10081 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
10083 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
10084 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
10086 dnl ===================================================================
10087 dnl Check for system lcms2
10088 dnl ===================================================================
10089 if test "$with_system_lcms2" != "yes"; then
10090     SYSTEM_LCMS2=
10092 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
10093 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
10094 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
10095 if test "$GCC" = "yes"; then
10096     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
10098 if test "$COM" = "MSC"; then # override the above
10099     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
10102 dnl ===================================================================
10103 dnl Check for system cppunit
10104 dnl ===================================================================
10105 if test "$_os" != "Android" ; then
10106     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
10109 dnl ===================================================================
10110 dnl Check whether freetype is available
10112 dnl FreeType has 3 different kinds of versions
10113 dnl * release, like 2.4.10
10114 dnl * libtool, like 13.0.7 (this what pkg-config returns)
10115 dnl * soname
10116 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
10118 dnl 9.9.3 is 2.2.0
10119 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
10120 dnl ===================================================================
10121 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
10122 if test "x$ac_config_site_64bit_host" = xYES; then
10123     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
10124 else
10125     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
10127 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
10129 # ===================================================================
10130 # Check for system libxslt
10131 # to prevent incompatibilities between internal libxml2 and external libxslt,
10132 # or vice versa, use with_system_libxml here
10133 # ===================================================================
10134 if test "$with_system_libxml" = "auto"; then
10135     case "$_os" in
10136     WINNT|iOS|Android)
10137         with_system_libxml="$with_system_libs"
10138         ;;
10139     Emscripten)
10140         with_system_libxml=no
10141         ;;
10142     *)
10143         if test "$enable_fuzzers" != "yes"; then
10144             with_system_libxml=yes
10145         else
10146             with_system_libxml=no
10147         fi
10148         ;;
10149     esac
10152 AC_MSG_CHECKING([which libxslt to use])
10153 if test "$with_system_libxml" = "yes"; then
10154     AC_MSG_RESULT([external])
10155     SYSTEM_LIBXSLT=TRUE
10156     if test "$_os" = "Darwin"; then
10157         dnl make sure to use SDK path
10158         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
10159         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
10160         dnl omit -L/usr/lib
10161         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
10162         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
10163     else
10164         PKG_CHECK_MODULES(LIBXSLT, libxslt)
10165         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10166         FilterLibs "${LIBXSLT_LIBS}"
10167         LIBXSLT_LIBS="${filteredlibs}"
10168         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
10169         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10170         FilterLibs "${LIBEXSLT_LIBS}"
10171         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
10172     fi
10174     dnl Check for xsltproc
10175     AC_PATH_PROG(XSLTPROC, xsltproc, no)
10176     if test "$XSLTPROC" = "no"; then
10177         AC_MSG_ERROR([xsltproc is required])
10178     fi
10179 else
10180     AC_MSG_RESULT([internal])
10181     SYSTEM_LIBXSLT=
10182     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
10184 AC_SUBST(SYSTEM_LIBXSLT)
10185 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
10186     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
10188 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
10190 AC_SUBST(LIBEXSLT_CFLAGS)
10191 AC_SUBST(LIBEXSLT_LIBS)
10192 AC_SUBST(LIBXSLT_CFLAGS)
10193 AC_SUBST(LIBXSLT_LIBS)
10194 AC_SUBST(XSLTPROC)
10196 # ===================================================================
10197 # Check for system libxml
10198 # ===================================================================
10199 AC_MSG_CHECKING([which libxml to use])
10200 if test "$with_system_libxml" = "yes"; then
10201     AC_MSG_RESULT([external])
10202     SYSTEM_LIBXML=TRUE
10203     if test "$_os" = "Darwin"; then
10204         dnl make sure to use SDK path
10205         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
10206         dnl omit -L/usr/lib
10207         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
10208     elif test $_os = iOS; then
10209         dnl make sure to use SDK path
10210         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
10211         LIBXML_CFLAGS="-I$usr/include/libxml2"
10212         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
10213     else
10214         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
10215         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10216         FilterLibs "${LIBXML_LIBS}"
10217         LIBXML_LIBS="${filteredlibs}"
10218     fi
10220     dnl Check for xmllint
10221     AC_PATH_PROG(XMLLINT, xmllint, no)
10222     if test "$XMLLINT" = "no"; then
10223         AC_MSG_ERROR([xmllint is required])
10224     fi
10225 else
10226     AC_MSG_RESULT([internal])
10227     SYSTEM_LIBXML=
10228     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
10229     if test "$COM" = "MSC"; then
10230         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10231     fi
10232     if test "$COM" = "MSC"; then
10233         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
10234     else
10235         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10236         if test "$DISABLE_DYNLOADING" = TRUE; then
10237             LIBXML_LIBS="$LIBXML_LIBS -lm"
10238         fi
10239     fi
10240     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10242 AC_SUBST(SYSTEM_LIBXML)
10243 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10244     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10246 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10247 AC_SUBST(LIBXML_CFLAGS)
10248 AC_SUBST(LIBXML_LIBS)
10249 AC_SUBST(XMLLINT)
10251 # =====================================================================
10252 # Checking for a Python interpreter with version >= 3.3.
10253 # Optionally user can pass an option to configure, i. e.
10254 # ./configure PYTHON=/usr/bin/python
10255 # =====================================================================
10256 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10257     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10258     # unless PYTHON is defined as above which allows 'system'
10259     enable_python=internal
10261 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10262     if test -n "$PYTHON"; then
10263         PYTHON_FOR_BUILD=$PYTHON
10264     else
10265         # This allows a lack of system python with no error, we use internal one in that case.
10266         AM_PATH_PYTHON([3.3],, [:])
10267         # Clean PYTHON_VERSION checked below if cross-compiling
10268         PYTHON_VERSION=""
10269         if test "$PYTHON" != ":"; then
10270             PYTHON_FOR_BUILD=$PYTHON
10271         fi
10272     fi
10275 # Checks for Python to use for Pyuno
10276 AC_MSG_CHECKING([which Python to use for Pyuno])
10277 case "$enable_python" in
10278 no|disable)
10279     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10280         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10281         # requirement from the choice whether to include Python stuff in the installer, but why
10282         # bother?
10283         AC_MSG_ERROR([Python is required at build time.])
10284     fi
10285     enable_python=no
10286     AC_MSG_RESULT([none])
10287     ;;
10288 ""|yes|auto)
10289     if test "$DISABLE_SCRIPTING" = TRUE; then
10290         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10291             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10292         fi
10293         AC_MSG_RESULT([none, overridden by --disable-scripting])
10294         enable_python=no
10295     elif test $build_os = cygwin -o $build_os = wsl; then
10296         dnl When building on Windows we don't attempt to use any installed
10297         dnl "system"  Python.
10298         AC_MSG_RESULT([fully internal])
10299         enable_python=internal
10300     elif test "$cross_compiling" = yes; then
10301         AC_MSG_RESULT([system])
10302         enable_python=system
10303     else
10304         # Unset variables set by the above AM_PATH_PYTHON so that
10305         # we actually do check anew.
10306         AC_MSG_RESULT([])
10307         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
10308         AM_PATH_PYTHON([3.3],, [:])
10309         AC_MSG_CHECKING([which Python to use for Pyuno])
10310         if test "$PYTHON" = ":"; then
10311             if test -z "$PYTHON_FOR_BUILD"; then
10312                 AC_MSG_RESULT([fully internal])
10313             else
10314                 AC_MSG_RESULT([internal])
10315             fi
10316             enable_python=internal
10317         else
10318             AC_MSG_RESULT([system])
10319             enable_python=system
10320         fi
10321     fi
10322     ;;
10323 internal)
10324     AC_MSG_RESULT([internal])
10325     ;;
10326 fully-internal)
10327     AC_MSG_RESULT([fully internal])
10328     enable_python=internal
10329     ;;
10330 system)
10331     AC_MSG_RESULT([system])
10332     if test "$_os" = Darwin -a -z "$PYTHON"; then
10333         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10334     fi
10335     ;;
10337     AC_MSG_ERROR([Incorrect --enable-python option])
10338     ;;
10339 esac
10341 if test $enable_python != no; then
10342     BUILD_TYPE="$BUILD_TYPE PYUNO"
10345 if test $enable_python = system; then
10346     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10347         # Fallback: Accept these in the environment, or as set above
10348         # for MacOSX.
10349         :
10350     elif test "$cross_compiling" != yes; then
10351         # Unset variables set by the above AM_PATH_PYTHON so that
10352         # we actually do check anew.
10353         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
10354         # This causes an error if no python command is found
10355         AM_PATH_PYTHON([3.3])
10356         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10357         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10358         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10359         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10360         if test -z "$PKG_CONFIG"; then
10361             PYTHON_CFLAGS="-I$python_include"
10362             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10363         elif $PKG_CONFIG --exists python-$python_version-embed; then
10364             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10365             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10366         elif $PKG_CONFIG --exists python-$python_version; then
10367             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10368             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10369         else
10370             PYTHON_CFLAGS="-I$python_include"
10371             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10372         fi
10373         FilterLibs "${PYTHON_LIBS}"
10374         PYTHON_LIBS="${filteredlibs}"
10375     else
10376         dnl How to find out the cross-compilation Python installation path?
10377         AC_MSG_CHECKING([for python version])
10378         AS_IF([test -n "$PYTHON_VERSION"],
10379               [AC_MSG_RESULT([$PYTHON_VERSION])],
10380               [AC_MSG_RESULT([not found])
10381                AC_MSG_ERROR([no usable python found])])
10382         test -n "$PYTHON_CFLAGS" && break
10383     fi
10385     dnl Check if the headers really work
10386     save_CPPFLAGS="$CPPFLAGS"
10387     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10388     AC_CHECK_HEADER(Python.h)
10389     CPPFLAGS="$save_CPPFLAGS"
10391     # let the PYTHON_FOR_BUILD match the same python installation that
10392     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10393     # better for PythonTests.
10394     PYTHON_FOR_BUILD=$PYTHON
10397 if test "$with_lxml" != no; then
10398     if test -z "$PYTHON_FOR_BUILD"; then
10399         case $build_os in
10400             cygwin)
10401                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10402                 ;;
10403             *)
10404                 if test "$cross_compiling" != yes ; then
10405                     BUILD_TYPE="$BUILD_TYPE LXML"
10406                 fi
10407                 ;;
10408         esac
10409     else
10410         AC_MSG_CHECKING([for python lxml])
10411         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10412             AC_MSG_RESULT([yes])
10413         else
10414             case $build_os in
10415                 cygwin)
10416                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10417                     ;;
10418                 *)
10419                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10420                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10421                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10422                         else
10423                             BUILD_TYPE="$BUILD_TYPE LXML"
10424                             AC_MSG_RESULT([no, using internal lxml])
10425                         fi
10426                     else
10427                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10428                     fi
10429                     ;;
10430             esac
10431         fi
10432     fi
10435 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10436     SYSTEM_PYTHON=
10437     PYTHON_VERSION_MAJOR=3
10438     PYTHON_VERSION_MINOR=10
10439     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15
10440     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10441         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10442     fi
10443     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10445     # Embedded Python dies without Home set
10446     if test "$HOME" = ""; then
10447         export HOME=""
10448     fi
10451 dnl By now enable_python should be "system", "internal" or "no"
10452 case $enable_python in
10453 system)
10454     SYSTEM_PYTHON=TRUE
10456     if test "x$ac_cv_header_Python_h" != "xyes"; then
10457        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10458     fi
10460     AC_LANG_PUSH(C)
10461     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10462     AC_MSG_CHECKING([for correct python library version])
10463        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10464 #include <Python.h>
10466 int main(int argc, char **argv) {
10467    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10468    else return 1;
10470        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10471     AC_LANG_POP(C)
10473     dnl FIXME Check if the Python library can be linked with, too?
10474     ;;
10476 internal)
10477     BUILD_TYPE="$BUILD_TYPE PYTHON"
10478     if test "$OS" = LINUX -o "$OS" = WNT ; then
10479         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10480     fi
10481     ;;
10483     DISABLE_PYTHON=TRUE
10484     SYSTEM_PYTHON=
10485     ;;
10487     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10488     ;;
10489 esac
10491 AC_SUBST(DISABLE_PYTHON)
10492 AC_SUBST(SYSTEM_PYTHON)
10493 AC_SUBST(PYTHON_CFLAGS)
10494 AC_SUBST(PYTHON_FOR_BUILD)
10495 AC_SUBST(PYTHON_LIBS)
10496 AC_SUBST(PYTHON_VERSION)
10497 AC_SUBST(PYTHON_VERSION_MAJOR)
10498 AC_SUBST(PYTHON_VERSION_MINOR)
10500 AC_MSG_CHECKING([whether to build LibreLogo])
10501 case "$enable_python" in
10502 no|disable)
10503     AC_MSG_RESULT([no; Python disabled])
10504     ;;
10506     if test "${enable_librelogo}" = "no"; then
10507         AC_MSG_RESULT([no])
10508     else
10509         AC_MSG_RESULT([yes])
10510         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10511         AC_DEFINE([ENABLE_LIBRELOGO],1)
10512     fi
10513     ;;
10514 esac
10515 AC_SUBST(ENABLE_LIBRELOGO)
10517 ENABLE_MARIADBC=
10518 MARIADBC_MAJOR=1
10519 MARIADBC_MINOR=0
10520 MARIADBC_MICRO=2
10521 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10522 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10523     ENABLE_MARIADBC=TRUE
10524     AC_MSG_RESULT([yes])
10525     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10526 else
10527     AC_MSG_RESULT([no])
10529 AC_SUBST(ENABLE_MARIADBC)
10530 AC_SUBST(MARIADBC_MAJOR)
10531 AC_SUBST(MARIADBC_MINOR)
10532 AC_SUBST(MARIADBC_MICRO)
10534 if test "$ENABLE_MARIADBC" = "TRUE"; then
10535     dnl ===================================================================
10536     dnl Check for system MariaDB
10537     dnl ===================================================================
10539     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10540         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10541     fi
10543     AC_MSG_CHECKING([which MariaDB to use])
10544     if test "$with_system_mariadb" = "yes"; then
10545         AC_MSG_RESULT([external])
10546         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10547         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10548         if test -z "$MARIADBCONFIG"; then
10549             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10550             if test -z "$MARIADBCONFIG"; then
10551                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10552                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10553             fi
10554         fi
10555         AC_MSG_CHECKING([MariaDB version])
10556         MARIADB_VERSION=`$MARIADBCONFIG --version`
10557         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10558         if test "$MARIADB_MAJOR" -ge "5"; then
10559             AC_MSG_RESULT([OK])
10560         else
10561             AC_MSG_ERROR([too old, use 5.0.x or later])
10562         fi
10563         AC_MSG_CHECKING([for MariaDB Client library])
10564         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10565         if test "$COM_IS_CLANG" = TRUE; then
10566             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10567         fi
10568         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10569         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10570         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10571         dnl linux32:
10572         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10573             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10574             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10575                 | sed -e 's|/lib64/|/lib/|')
10576         fi
10577         FilterLibs "${MARIADB_LIBS}"
10578         MARIADB_LIBS="${filteredlibs}"
10579         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10580         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10581         if test "$enable_bundle_mariadb" = "yes"; then
10582             AC_MSG_RESULT([yes])
10583             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10584             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10586 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10588 /g' | grep -E '(mysqlclient|mariadb)')
10589             if test "$_os" = "Darwin"; then
10590                 LIBMARIADB=${LIBMARIADB}.dylib
10591                 if test "$with_gssapi" != "no"; then
10592                     WITH_GSSAPI=TRUE
10593                     save_LIBS=$LIBS
10594                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10595                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10596                     GSSAPI_LIBS=$LIBS
10597                     LIBS=$save_LIBS
10598                 fi
10599             elif test "$_os" = "WINNT"; then
10600                 LIBMARIADB=${LIBMARIADB}.dll
10601             else
10602                 LIBMARIADB=${LIBMARIADB}.so
10603                 if test "$with_gssapi" != "no"; then
10604                     WITH_GSSAPI=TRUE
10605                     save_LIBS=$LIBS
10606                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10607                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10608                     GSSAPI_LIBS=$LIBS
10609                     LIBS=$save_LIBS
10610                 fi
10611             fi
10612             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10613             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10614             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10615                 AC_MSG_RESULT([found.])
10616                 PathFormat "$LIBMARIADB_PATH"
10617                 LIBMARIADB_PATH="$formatted_path"
10618             else
10619                 AC_MSG_ERROR([not found.])
10620             fi
10621         else
10622             AC_MSG_RESULT([no])
10623             BUNDLE_MARIADB_CONNECTOR_C=
10624         fi
10625     else
10626         AC_MSG_RESULT([internal])
10627         SYSTEM_MARIADB_CONNECTOR_C=
10628         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10629         MARIADB_LIBS='-L$(gb_StaticLibrary_WORKDIR) -lmariadb-connector-c'
10630         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10631     fi
10633     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10634     AC_SUBST(MARIADB_CFLAGS)
10635     AC_SUBST(MARIADB_LIBS)
10636     AC_SUBST(LIBMARIADB)
10637     AC_SUBST(LIBMARIADB_PATH)
10638     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10641 dnl ===================================================================
10642 dnl Check for system hsqldb
10643 dnl ===================================================================
10644 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10645     AC_MSG_CHECKING([which hsqldb to use])
10646     if test "$with_system_hsqldb" = "yes"; then
10647         AC_MSG_RESULT([external])
10648         SYSTEM_HSQLDB=TRUE
10649         if test -z $HSQLDB_JAR; then
10650             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10651         fi
10652         if ! test -f $HSQLDB_JAR; then
10653                AC_MSG_ERROR(hsqldb.jar not found.)
10654         fi
10655         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10656         export HSQLDB_JAR
10657         if $PERL -e \
10658            'use Archive::Zip;
10659             my $file = "$ENV{'HSQLDB_JAR'}";
10660             my $zip = Archive::Zip->new( $file );
10661             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10662             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10663             {
10664                 push @l, split(/\n/, $mf);
10665                 foreach my $line (@l)
10666                 {
10667                     if ($line =~ m/Specification-Version:/)
10668                     {
10669                         ($t, $version) = split (/:/,$line);
10670                         $version =~ s/^\s//;
10671                         ($a, $b, $c, $d) = split (/\./,$version);
10672                         if ($c == "0" && $d > "8")
10673                         {
10674                             exit 0;
10675                         }
10676                         else
10677                         {
10678                             exit 1;
10679                         }
10680                     }
10681                 }
10682             }
10683             else
10684             {
10685                 exit 1;
10686             }'; then
10687             AC_MSG_RESULT([yes])
10688         else
10689             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10690         fi
10691     else
10692         AC_MSG_RESULT([internal])
10693         SYSTEM_HSQLDB=
10694         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10695         NEED_ANT=TRUE
10696     fi
10697 else
10698     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10699         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10700     fi
10702 AC_SUBST(SYSTEM_HSQLDB)
10703 AC_SUBST(HSQLDB_JAR)
10705 dnl ===================================================================
10706 dnl Check for PostgreSQL stuff
10707 dnl ===================================================================
10708 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10709 if test "x$enable_postgresql_sdbc" != "xno"; then
10710     AC_MSG_RESULT([yes])
10711     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10713     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10714         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10715     fi
10716     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10717         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10718     fi
10720     postgres_interface=""
10721     if test "$with_system_postgresql" = "yes"; then
10722         postgres_interface="external PostgreSQL"
10723         SYSTEM_POSTGRESQL=TRUE
10724         if test "$_os" = Darwin; then
10725             supp_path=''
10726             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10727                 pg_supp_path="$P_SEP$d$pg_supp_path"
10728             done
10729         fi
10730         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10731         if test -n "$PGCONFIG"; then
10732             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10733             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10734         else
10735             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10736               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10737               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10738             ],[
10739               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10740             ])
10741         fi
10742         FilterLibs "${POSTGRESQL_LIB}"
10743         POSTGRESQL_LIB="${filteredlibs}"
10744     else
10745         # if/when anything else than PostgreSQL uses Kerberos,
10746         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10747         WITH_KRB5=
10748         WITH_GSSAPI=
10749         case "$_os" in
10750         Darwin)
10751             # macOS has system MIT Kerberos 5 since 10.4
10752             if test "$with_krb5" != "no"; then
10753                 WITH_KRB5=TRUE
10754                 save_LIBS=$LIBS
10755                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10756                 # that the libraries where these functions are located on macOS will change, is it?
10757                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10758                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10759                 KRB5_LIBS=$LIBS
10760                 LIBS=$save_LIBS
10761                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10762                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10763                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10764                 LIBS=$save_LIBS
10765             fi
10766             if test "$with_gssapi" != "no"; then
10767                 WITH_GSSAPI=TRUE
10768                 save_LIBS=$LIBS
10769                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10770                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10771                 GSSAPI_LIBS=$LIBS
10772                 LIBS=$save_LIBS
10773             fi
10774             ;;
10775         WINNT)
10776             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10777                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10778             fi
10779             ;;
10780         Linux|GNU|*BSD|DragonFly)
10781             if test "$with_krb5" != "no"; then
10782                 WITH_KRB5=TRUE
10783                 save_LIBS=$LIBS
10784                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10785                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10786                 KRB5_LIBS=$LIBS
10787                 LIBS=$save_LIBS
10788                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10789                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10790                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10791                 LIBS=$save_LIBS
10792             fi
10793             if test "$with_gssapi" != "no"; then
10794                 WITH_GSSAPI=TRUE
10795                 save_LIBS=$LIBS
10796                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10797                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10798                 GSSAPI_LIBS=$LIBS
10799                 LIBS=$save_LIBS
10800             fi
10801             ;;
10802         *)
10803             if test "$with_krb5" = "yes"; then
10804                 WITH_KRB5=TRUE
10805                 save_LIBS=$LIBS
10806                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10807                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10808                 KRB5_LIBS=$LIBS
10809                 LIBS=$save_LIBS
10810                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10811                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10812                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10813                 LIBS=$save_LIBS
10814             fi
10815             if test "$with_gssapi" = "yes"; then
10816                 WITH_GSSAPI=TRUE
10817                 save_LIBS=$LIBS
10818                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10819                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10820                 LIBS=$save_LIBS
10821                 GSSAPI_LIBS=$LIBS
10822             fi
10823         esac
10825         if test -n "$with_libpq_path"; then
10826             SYSTEM_POSTGRESQL=TRUE
10827             postgres_interface="external libpq"
10828             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10829             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10830         else
10831             SYSTEM_POSTGRESQL=
10832             postgres_interface="internal"
10833             POSTGRESQL_LIB=""
10834             POSTGRESQL_INC="%OVERRIDE_ME%"
10835             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10836         fi
10837     fi
10839     AC_MSG_CHECKING([PostgreSQL C interface])
10840     AC_MSG_RESULT([$postgres_interface])
10842     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10843         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10844         save_CFLAGS=$CFLAGS
10845         save_CPPFLAGS=$CPPFLAGS
10846         save_LIBS=$LIBS
10847         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10848         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10849         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10850         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10851             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10852         CFLAGS=$save_CFLAGS
10853         CPPFLAGS=$save_CPPFLAGS
10854         LIBS=$save_LIBS
10855     fi
10856     BUILD_POSTGRESQL_SDBC=TRUE
10857 else
10858     AC_MSG_RESULT([no])
10860 AC_SUBST(WITH_KRB5)
10861 AC_SUBST(WITH_GSSAPI)
10862 AC_SUBST(GSSAPI_LIBS)
10863 AC_SUBST(KRB5_LIBS)
10864 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10865 AC_SUBST(SYSTEM_POSTGRESQL)
10866 AC_SUBST(POSTGRESQL_INC)
10867 AC_SUBST(POSTGRESQL_LIB)
10869 dnl ===================================================================
10870 dnl Check for Firebird stuff
10871 dnl ===================================================================
10872 ENABLE_FIREBIRD_SDBC=
10873 if test "$enable_firebird_sdbc" = "yes" ; then
10874     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10876     dnl ===================================================================
10877     dnl Check for system Firebird
10878     dnl ===================================================================
10879     AC_MSG_CHECKING([which Firebird to use])
10880     if test "$with_system_firebird" = "yes"; then
10881         AC_MSG_RESULT([external])
10882         SYSTEM_FIREBIRD=TRUE
10883         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10884         if test -z "$FIREBIRDCONFIG"; then
10885             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10886             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10887                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10888             ])
10889             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10890         else
10891             AC_MSG_NOTICE([fb_config found])
10892             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10893             AC_MSG_CHECKING([for Firebird Client library])
10894             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10895             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10896             FilterLibs "${FIREBIRD_LIBS}"
10897             FIREBIRD_LIBS="${filteredlibs}"
10898         fi
10899         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10900         AC_MSG_CHECKING([Firebird version])
10901         if test -n "${FIREBIRD_VERSION}"; then
10902             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10903             if test "$FIREBIRD_MAJOR" -ge "3"; then
10904                 AC_MSG_RESULT([OK])
10905             else
10906                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10907             fi
10908         else
10909             save_CFLAGS="${CFLAGS}"
10910             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10911             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10912 #if defined(FB_API_VER) && FB_API_VER == 30
10913 int fb_api_is_30(void) { return 0; }
10914 #else
10915 #error "Wrong Firebird API version"
10916 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10917             CFLAGS="$save_CFLAGS"
10918         fi
10919         ENABLE_FIREBIRD_SDBC=TRUE
10920         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10921     elif test "$enable_database_connectivity" = no; then
10922         AC_MSG_RESULT([none])
10923     elif test "$cross_compiling" = "yes"; then
10924         AC_MSG_RESULT([none])
10925     else
10926         dnl Embedded Firebird has version 3.0
10927         dnl We need libatomic_ops for any non X86/X64 system
10928         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10929             dnl ===================================================================
10930             dnl Check for system libatomic_ops
10931             dnl ===================================================================
10932             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10933             if test "$with_system_libatomic_ops" = "yes"; then
10934                 SYSTEM_LIBATOMIC_OPS=TRUE
10935                 AC_CHECK_HEADERS(atomic_ops.h, [],
10936                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10937             else
10938                 SYSTEM_LIBATOMIC_OPS=
10939                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10940                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10941                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10942             fi
10943         fi
10945         AC_MSG_RESULT([internal])
10946         SYSTEM_FIREBIRD=
10947         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10948         FIREBIRD_LIBS="-lfbclient"
10950         if test "$with_system_libtommath" = "yes"; then
10951             SYSTEM_LIBTOMMATH=TRUE
10952             dnl check for tommath presence
10953             save_LIBS=$LIBS
10954             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10955             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10956             LIBS=$save_LIBS
10957         else
10958             SYSTEM_LIBTOMMATH=
10959             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10960             LIBTOMMATH_LIBS="-ltommath"
10961             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10962         fi
10964         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10965         ENABLE_FIREBIRD_SDBC=TRUE
10966         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10967     fi
10969 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10970 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10971 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10972 AC_SUBST(LIBATOMIC_OPS_LIBS)
10973 AC_SUBST(SYSTEM_FIREBIRD)
10974 AC_SUBST(FIREBIRD_CFLAGS)
10975 AC_SUBST(FIREBIRD_LIBS)
10976 AC_SUBST(SYSTEM_LIBTOMMATH)
10977 AC_SUBST(LIBTOMMATH_CFLAGS)
10978 AC_SUBST(LIBTOMMATH_LIBS)
10980 dnl ===================================================================
10981 dnl Check for system curl
10982 dnl ===================================================================
10983 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10985 if test "$enable_curl" = "yes" -a "$with_system_curl" != "yes" -a "$with_gssapi" != "no"; then
10986     if test "$_os" != "WINNT"; then
10987         WITH_GSSAPI=TRUE
10988         save_LIBS=$LIBS
10989         AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10990             [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10991         GSSAPI_LIBS=$LIBS
10992         LIBS=$save_LIBS
10993     fi
10996 dnl ===================================================================
10997 dnl Check for system boost
10998 dnl ===================================================================
10999 AC_MSG_CHECKING([which boost to use])
11000 if test "$with_system_boost" = "yes"; then
11001     AC_MSG_RESULT([external])
11002     SYSTEM_BOOST=TRUE
11003     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
11004     AX_BOOST_DATE_TIME
11005     AX_BOOST_FILESYSTEM
11006     AX_BOOST_IOSTREAMS
11007     AX_BOOST_LOCALE
11008     AC_LANG_PUSH([C++])
11009     save_CXXFLAGS=$CXXFLAGS
11010     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
11011     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
11012        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
11013     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
11014        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
11015     CXXFLAGS=$save_CXXFLAGS
11016     AC_LANG_POP([C++])
11017     # this is in m4/ax_boost_base.m4
11018     FilterLibs "${BOOST_LDFLAGS}"
11019     BOOST_LDFLAGS="${filteredlibs}"
11020 else
11021     AC_MSG_RESULT([internal])
11022     BUILD_TYPE="$BUILD_TYPE BOOST"
11023     SYSTEM_BOOST=
11024     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
11025         # use warning-suppressing wrapper headers
11026         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
11027     else
11028         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
11029     fi
11031 AC_SUBST(SYSTEM_BOOST)
11033 dnl ===================================================================
11034 dnl Check for system mdds
11035 dnl ===================================================================
11036 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
11037 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
11039 dnl ===================================================================
11040 dnl Check for system dragonbox
11041 dnl ===================================================================
11042 AC_MSG_CHECKING([which dragonbox to use])
11043 if test "$with_system_dragonbox" = "yes"; then
11044     AC_MSG_RESULT([external])
11045     SYSTEM_DRAGONBOX=TRUE
11046     AC_LANG_PUSH([C++])
11047     save_CPPFLAGS=$CPPFLAGS
11048     # This is where upstream installs to, unfortunately no .pc or so...
11049     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
11050     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
11051     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
11052        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
11053     AC_LANG_POP([C++])
11054     CPPFLAGS=$save_CPPFLAGS
11055 else
11056     AC_MSG_RESULT([internal])
11057     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
11058     SYSTEM_DRAGONBOX=
11060 AC_SUBST([SYSTEM_DRAGONBOX])
11061 AC_SUBST([DRAGONBOX_CFLAGS])
11063 dnl ===================================================================
11064 dnl Check for system frozen
11065 dnl ===================================================================
11066 AC_MSG_CHECKING([which frozen to use])
11067 if test "$with_system_frozen" = "yes"; then
11068     AC_MSG_RESULT([external])
11069     SYSTEM_FROZEN=TRUE
11070     AC_LANG_PUSH([C++])
11071     save_CPPFLAGS=$CPPFLAGS
11072     AC_CHECK_HEADER([frozen/unordered_map.h], [],
11073        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
11074     AC_LANG_POP([C++])
11075     CPPFLAGS=$save_CPPFLAGS
11076 else
11077     AC_MSG_RESULT([internal])
11078     BUILD_TYPE="$BUILD_TYPE FROZEN"
11079     SYSTEM_FROZEN=
11081 AC_SUBST([SYSTEM_FROZEN])
11082 AC_SUBST([FROZEN_CFLAGS])
11084 dnl ===================================================================
11085 dnl Check for system libfixmath
11086 dnl ===================================================================
11087 AC_MSG_CHECKING([which libfixmath to use])
11088 if test "$with_system_libfixmath" = "yes"; then
11089     AC_MSG_RESULT([external])
11090     SYSTEM_LIBFIXMATH=TRUE
11091     AC_LANG_PUSH([C++])
11092     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
11093        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
11094     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
11095                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
11096                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
11097     AC_LANG_POP([C++])
11098 else
11099     AC_MSG_RESULT([internal])
11100     SYSTEM_LIBFIXMATH=
11101     LIBFIXMATH_LIBS=
11103 AC_SUBST([SYSTEM_LIBFIXMATH])
11104 AC_SUBST([LIBFIXMATH_LIBS])
11106 dnl ===================================================================
11107 dnl Check for system glm
11108 dnl ===================================================================
11109 AC_MSG_CHECKING([which glm to use])
11110 if test "$with_system_glm" = "yes"; then
11111     AC_MSG_RESULT([external])
11112     SYSTEM_GLM=TRUE
11113     AC_LANG_PUSH([C++])
11114     AC_CHECK_HEADER([glm/glm.hpp], [],
11115        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
11116     AC_LANG_POP([C++])
11117 else
11118     AC_MSG_RESULT([internal])
11119     BUILD_TYPE="$BUILD_TYPE GLM"
11120     SYSTEM_GLM=
11121     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
11123 AC_SUBST([GLM_CFLAGS])
11124 AC_SUBST([SYSTEM_GLM])
11126 dnl ===================================================================
11127 dnl Check for system odbc
11128 dnl ===================================================================
11129 AC_MSG_CHECKING([which odbc headers to use])
11130 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
11131     AC_MSG_RESULT([external])
11132     SYSTEM_ODBC_HEADERS=TRUE
11134     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
11135         save_CPPFLAGS=$CPPFLAGS
11136         find_winsdk
11137         PathFormat "$winsdktest"
11138         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"
11139         AC_CHECK_HEADER(sqlext.h, [],
11140             [AC_MSG_ERROR(odbc not found. install odbc)],
11141             [#include <windows.h>])
11142         CPPFLAGS=$save_CPPFLAGS
11143     else
11144         AC_CHECK_HEADER(sqlext.h, [],
11145             [AC_MSG_ERROR(odbc not found. install odbc)],[])
11146     fi
11147 elif test "$enable_database_connectivity" = no; then
11148     AC_MSG_RESULT([none])
11149 else
11150     AC_MSG_RESULT([internal])
11151     SYSTEM_ODBC_HEADERS=
11153 AC_SUBST(SYSTEM_ODBC_HEADERS)
11155 dnl ===================================================================
11156 dnl Check for system NSS
11157 dnl ===================================================================
11158 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
11159     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
11160     AC_DEFINE(HAVE_FEATURE_NSS)
11161     ENABLE_NSS=TRUE
11162 elif test $_os != iOS -a "$enable_openssl" != "no"; then
11163     with_tls=openssl
11165 AC_SUBST(ENABLE_NSS)
11167 dnl ===================================================================
11168 dnl Enable LDAP support
11169 dnl ===================================================================
11171 if test "$test_openldap" = yes; then
11172     AC_MSG_CHECKING([whether to enable LDAP support])
11173     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
11174         AC_MSG_RESULT([yes])
11175         ENABLE_LDAP=TRUE
11176     else
11177         if test "$enable_ldap" != "yes"; then
11178             AC_MSG_RESULT([no])
11179         else
11180             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
11181         fi
11182     fi
11184 dnl ===================================================================
11185 dnl Check for system openldap
11186 dnl ===================================================================
11188     if test "$ENABLE_LDAP" = TRUE; then
11189         AC_MSG_CHECKING([which openldap library to use])
11190         if test "$with_system_openldap" = yes; then
11191             AC_MSG_RESULT([external])
11192             SYSTEM_OPENLDAP=TRUE
11193             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
11194             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
11195             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
11196         else
11197             AC_MSG_RESULT([internal])
11198             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
11199         fi
11200     fi
11203 AC_SUBST(ENABLE_LDAP)
11204 AC_SUBST(SYSTEM_OPENLDAP)
11206 dnl ===================================================================
11207 dnl Check for TLS/SSL and cryptographic implementation to use
11208 dnl ===================================================================
11209 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
11210 if test -n "$with_tls"; then
11211     case $with_tls in
11212     openssl)
11213         AC_DEFINE(USE_TLS_OPENSSL)
11214         TLS=OPENSSL
11215         AC_MSG_RESULT([$TLS])
11217         if test "$enable_openssl" != "yes"; then
11218             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
11219         fi
11221         # warn that OpenSSL has been selected but not all TLS code has this option
11222         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
11223         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
11224         ;;
11225     nss)
11226         AC_DEFINE(USE_TLS_NSS)
11227         TLS=NSS
11228         AC_MSG_RESULT([$TLS])
11229         ;;
11230     no)
11231         AC_MSG_RESULT([none])
11232         AC_MSG_WARN([Skipping TLS/SSL])
11233         ;;
11234     *)
11235         AC_MSG_RESULT([])
11236         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
11237 openssl - OpenSSL
11238 nss - Mozilla's Network Security Services (NSS)
11239     ])
11240         ;;
11241     esac
11242 else
11243     # default to using NSS, it results in smaller oox lib
11244     AC_DEFINE(USE_TLS_NSS)
11245     TLS=NSS
11246     AC_MSG_RESULT([$TLS])
11248 AC_SUBST(TLS)
11250 dnl ===================================================================
11251 dnl Check for system sane
11252 dnl ===================================================================
11253 AC_MSG_CHECKING([which sane header to use])
11254 if test "$with_system_sane" = "yes"; then
11255     AC_MSG_RESULT([external])
11256     AC_CHECK_HEADER(sane/sane.h, [],
11257       [AC_MSG_ERROR(sane not found. install sane)], [])
11258 else
11259     AC_MSG_RESULT([internal])
11260     BUILD_TYPE="$BUILD_TYPE SANE"
11263 dnl ===================================================================
11264 dnl Check for system icu
11265 dnl ===================================================================
11266 ICU_MAJOR=75
11267 ICU_MINOR=1
11268 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11269 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib -licuuc"
11270 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11271 if test "$SYSTEM_ICU" = TRUE; then
11272     AC_LANG_PUSH([C++])
11273     AC_MSG_CHECKING([for unicode/rbbi.h])
11274     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11275     AC_LANG_POP([C++])
11277     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11278     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11279     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11281     if test "$CROSS_COMPILING" != TRUE; then
11282         # using the system icu tools can lead to version confusion, use the
11283         # ones from the build environment when cross-compiling
11284         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11285         if test -z "$SYSTEM_GENBRK"; then
11286             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11287         fi
11288         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11289         if test -z "$SYSTEM_GENCCODE"; then
11290             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11291         fi
11292         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11293         if test -z "$SYSTEM_GENCMN"; then
11294             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11295         fi
11296     fi
11299 AC_SUBST(SYSTEM_GENBRK)
11300 AC_SUBST(SYSTEM_GENCCODE)
11301 AC_SUBST(SYSTEM_GENCMN)
11302 AC_SUBST(ICU_MAJOR)
11303 AC_SUBST(ICU_MINOR)
11305 dnl ==================================================================
11306 dnl CURL
11307 dnl ==================================================================
11308 if test "$enable_curl" = "yes"; then
11309     AC_DEFINE([HAVE_FEATURE_CURL])
11312 dnl ==================================================================
11313 dnl Breakpad
11314 dnl ==================================================================
11315 DEFAULT_CRASHDUMP_VALUE="true"
11316 AC_MSG_CHECKING([whether to enable breakpad])
11317 if test "$enable_breakpad" != yes; then
11318     AC_MSG_RESULT([no])
11319 else
11320     if test "$enable_curl" != "yes"; then
11321         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11322     fi
11323     AC_MSG_RESULT([yes])
11324     ENABLE_BREAKPAD="TRUE"
11325     AC_DEFINE(ENABLE_BREAKPAD)
11326     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11327     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11329     AC_MSG_CHECKING([for disable crash dump])
11330     if test "$enable_crashdump" = no; then
11331         DEFAULT_CRASHDUMP_VALUE="false"
11332         AC_MSG_RESULT([yes])
11333     else
11334        AC_MSG_RESULT([no])
11335     fi
11337     AC_MSG_CHECKING([for crashreport config])
11338     if test "$with_symbol_config" = "no"; then
11339         BREAKPAD_SYMBOL_CONFIG="invalid"
11340         AC_MSG_RESULT([no])
11341     else
11342         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11343         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11344         AC_MSG_RESULT([yes])
11345     fi
11346     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11348 AC_SUBST(ENABLE_BREAKPAD)
11349 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11351 dnl ==================================================================
11352 dnl libcmis
11353 dnl ==================================================================
11354 if test "$enable_libcmis" = "yes"; then
11355     if test "$enable_curl" != "yes"; then
11356         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11357     fi
11360 dnl ===================================================================
11361 dnl Orcus
11362 dnl ===================================================================
11363 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11364 if test "$with_system_orcus" != "yes"; then
11365     if test "$SYSTEM_BOOST" = "TRUE"; then
11366         dnl Link with Boost.System
11367         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11368         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11369         dnl in documentation has no effect.
11370         AX_BOOST_SYSTEM
11371     fi
11373 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11374 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11375 AC_SUBST([BOOST_SYSTEM_LIB])
11376 AC_SUBST(SYSTEM_LIBORCUS)
11378 dnl ===================================================================
11379 dnl HarfBuzz
11380 dnl ===================================================================
11381 harfbuzz_required_version=5.1.0
11383 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11384 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11385 case "$_os" in
11386     Linux)
11387         GRAPHITE_LIBS_internal='$(gb_StaticLibrary_WORKDIR)/libgraphite.a'
11388         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11389         ;;
11390     *)
11391         GRAPHITE_LIBS_internal='-L$(gb_StaticLibrary_WORKDIR) -lgraphite'
11392         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11393         ;;
11394 esac
11395 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11396 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11398 if test "$COM" = "MSC"; then # override the above
11399     GRAPHITE_LIBS='$(gb_StaticLibrary_WORKDIR)/graphite.lib'
11400     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11403 if test "$with_system_harfbuzz" = "yes"; then
11404     if test "$with_system_graphite" = "no"; then
11405         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11406     fi
11407     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11408     save_LIBS="$LIBS"
11409     save_CFLAGS="$CFLAGS"
11410     LIBS="$LIBS $HARFBUZZ_LIBS"
11411     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11412     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11413     LIBS="$save_LIBS"
11414     CFLAGS="$save_CFLAGS"
11415 else
11416     if test "$with_system_graphite" = "yes"; then
11417         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11418     fi
11421 if test "$USING_X11" = TRUE; then
11422     AC_PATH_X
11423     AC_PATH_XTRA
11424     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11426     if test -z "$x_includes"; then
11427         x_includes="default_x_includes"
11428     fi
11429     if test -z "$x_libraries"; then
11430         x_libraries="default_x_libraries"
11431     fi
11432     CFLAGS="$CFLAGS $X_CFLAGS"
11433     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11434     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11435 else
11436     x_includes="no_x_includes"
11437     x_libraries="no_x_libraries"
11440 if test "$USING_X11" = TRUE; then
11441     dnl ===================================================================
11442     dnl Check for extension headers
11443     dnl ===================================================================
11444     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11445      [#include <X11/extensions/shape.h>])
11447     # vcl needs ICE and SM
11448     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11449     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11450         [AC_MSG_ERROR(ICE library not found)])
11451     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11452     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11453         [AC_MSG_ERROR(SM library not found)])
11456 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11457     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11458     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11461 dnl ===================================================================
11462 dnl Check for system Xrender
11463 dnl ===================================================================
11464 AC_MSG_CHECKING([whether to use Xrender])
11465 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11466     AC_MSG_RESULT([yes])
11467     PKG_CHECK_MODULES(XRENDER, xrender)
11468     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11469     FilterLibs "${XRENDER_LIBS}"
11470     XRENDER_LIBS="${filteredlibs}"
11471     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11472       [AC_MSG_ERROR(libXrender not found or functional)], [])
11473     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11474       [AC_MSG_ERROR(Xrender not found. install X)], [])
11475 else
11476     AC_MSG_RESULT([no])
11478 AC_SUBST(XRENDER_CFLAGS)
11479 AC_SUBST(XRENDER_LIBS)
11481 dnl ===================================================================
11482 dnl Check for XRandr
11483 dnl ===================================================================
11484 AC_MSG_CHECKING([whether to enable RandR support])
11485 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11486     AC_MSG_RESULT([yes])
11487     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11488     if test "$ENABLE_RANDR" != "TRUE"; then
11489         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11490                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11491         XRANDR_CFLAGS=" "
11492         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11493           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11494         XRANDR_LIBS="-lXrandr "
11495         ENABLE_RANDR="TRUE"
11496     fi
11497     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11498     FilterLibs "${XRANDR_LIBS}"
11499     XRANDR_LIBS="${filteredlibs}"
11500 else
11501     ENABLE_RANDR=""
11502     AC_MSG_RESULT([no])
11504 AC_SUBST(XRANDR_CFLAGS)
11505 AC_SUBST(XRANDR_LIBS)
11506 AC_SUBST(ENABLE_RANDR)
11508 if test -z "$with_webdav"; then
11509     with_webdav=$test_webdav
11512 AC_MSG_CHECKING([for WebDAV support])
11513 case "$with_webdav" in
11515     AC_MSG_RESULT([no])
11516     WITH_WEBDAV=""
11517     ;;
11519     AC_MSG_RESULT([yes])
11520     # curl is already mandatory (almost) and checked elsewhere
11521     if test "$enable_curl" = "no"; then
11522         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11523     fi
11524     WITH_WEBDAV=TRUE
11525     ;;
11526 esac
11527 AC_SUBST(WITH_WEBDAV)
11529 dnl ===================================================================
11530 dnl Check for disabling cve_tests
11531 dnl ===================================================================
11532 AC_MSG_CHECKING([whether to execute CVE tests])
11533 if test "$enable_cve_tests" = "no"; then
11534     AC_MSG_RESULT([no])
11535     DISABLE_CVE_TESTS=TRUE
11536     AC_SUBST(DISABLE_CVE_TESTS)
11537 else
11538     AC_MSG_RESULT([yes])
11541 dnl ===================================================================
11542 dnl Check for system openssl
11543 dnl ===================================================================
11544 ENABLE_OPENSSL=
11545 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11546 if test "$enable_openssl" = "yes"; then
11547     AC_MSG_RESULT([no])
11548     ENABLE_OPENSSL=TRUE
11549     if test "$_os" = Darwin ; then
11550         # OpenSSL is deprecated when building for 10.7 or later.
11551         #
11552         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11553         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11555         with_system_openssl=no
11556         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11557     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11558             && test "$with_system_openssl" != "no"; then
11559         with_system_openssl=yes
11560         SYSTEM_OPENSSL=TRUE
11561         OPENSSL_CFLAGS=
11562         OPENSSL_LIBS="-lssl -lcrypto"
11563     else
11564         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11565         if test -n "${SYSTEM_OPENSSL}"; then
11566             AC_DEFINE([SYSTEM_OPENSSL])
11567         fi
11568     fi
11569     if test "$with_system_openssl" = "yes"; then
11570         AC_MSG_CHECKING([whether openssl supports SHA512])
11571         AC_LANG_PUSH([C])
11572         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11573             SHA512_CTX context;
11574 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11575         AC_LANG_POP(C)
11576     fi
11577 else
11578     AC_MSG_RESULT([yes])
11580     # warn that although OpenSSL is disabled, system libraries may depend on it
11581     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11582     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11585 AC_SUBST([ENABLE_OPENSSL])
11587 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11588     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11589         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11590         enable_cipher_openssl_backend=no
11591     else
11592         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11593     fi
11595 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11596 ENABLE_CIPHER_OPENSSL_BACKEND=
11597 if test "$enable_cipher_openssl_backend" = yes; then
11598     AC_MSG_RESULT([yes])
11599     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11600 else
11601     AC_MSG_RESULT([no])
11603 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11605 dnl ===================================================================
11606 dnl Select the crypto backends used by LO
11607 dnl ===================================================================
11609 if test "$build_crypto" = yes; then
11610     if test "$OS" = WNT; then
11611         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11612         AC_DEFINE([USE_CRYPTO_MSCAPI])
11613     elif test "$ENABLE_NSS" = TRUE; then
11614         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11615         AC_DEFINE([USE_CRYPTO_NSS])
11616     fi
11619 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11620 if test "$COM" = "MSC"; then
11621     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11622 else
11623     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11625 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11627 dnl ===================================================================
11628 dnl Check for system redland
11629 dnl ===================================================================
11630 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11631 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11632 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11633 if test "$with_system_redland" = "yes"; then
11634     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11635             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11636 else
11637     RAPTOR_MAJOR="0"
11638     RASQAL_MAJOR="3"
11639     REDLAND_MAJOR="0"
11641 AC_SUBST(RAPTOR_MAJOR)
11642 AC_SUBST(RASQAL_MAJOR)
11643 AC_SUBST(REDLAND_MAJOR)
11645 dnl ===================================================================
11646 dnl Check for system hunspell
11647 dnl ===================================================================
11648 AC_MSG_CHECKING([which libhunspell to use])
11649 if test "$with_system_hunspell" = "yes"; then
11650     AC_MSG_RESULT([external])
11651     SYSTEM_HUNSPELL=TRUE
11652     AC_LANG_PUSH([C++])
11653     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11654     if test "$HUNSPELL_PC" != "TRUE"; then
11655         AC_CHECK_HEADER(hunspell.hxx, [],
11656             [
11657             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11658             [AC_MSG_ERROR(hunspell headers not found.)], [])
11659             ], [])
11660         AC_CHECK_LIB([hunspell], [main], [:],
11661            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11662         HUNSPELL_LIBS=-lhunspell
11663     fi
11664     AC_LANG_POP([C++])
11665     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11666     FilterLibs "${HUNSPELL_LIBS}"
11667     HUNSPELL_LIBS="${filteredlibs}"
11668 else
11669     AC_MSG_RESULT([internal])
11670     SYSTEM_HUNSPELL=
11671     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11672     if test "$COM" = "MSC"; then
11673         HUNSPELL_LIBS='$(gb_StaticLibrary_WORKDIR)/hunspell.lib'
11674     else
11675         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11676     fi
11677     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11679 AC_SUBST(SYSTEM_HUNSPELL)
11680 AC_SUBST(HUNSPELL_CFLAGS)
11681 AC_SUBST(HUNSPELL_LIBS)
11683 dnl ===================================================================
11684 dnl Check for system zxcvbn
11685 dnl ===================================================================
11686 AC_MSG_CHECKING([which zxcvbn to use])
11687 if test "$with_system_zxcvbn" = "yes"; then
11688     AC_MSG_RESULT([external])
11689     SYSTEM_ZXCVBN=TRUE
11690     AC_CHECK_HEADER(zxcvbn.h, [],
11691        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11692     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11693         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11694 else
11695    AC_MSG_RESULT([internal])
11696    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11697    SYSTEM_ZXCVBN=
11699 AC_SUBST(SYSTEM_ZXCVBN)
11701 dnl ===================================================================
11702 dnl Check for system zxing
11703 dnl ===================================================================
11704 AC_MSG_CHECKING([whether to use zxing])
11705 if test "$enable_zxing" = "no"; then
11706     AC_MSG_RESULT([no])
11707     ENABLE_ZXING=
11708     SYSTEM_ZXING=
11709 else
11710     AC_MSG_RESULT([yes])
11711     ENABLE_ZXING=TRUE
11712     AC_MSG_CHECKING([which libzxing to use])
11713     if test "$with_system_zxing" = "yes"; then
11714         AC_MSG_RESULT([external])
11715         SYSTEM_ZXING=TRUE
11716         ZXING_CFLAGS=
11717         AC_LANG_PUSH([C++])
11718         save_CXXFLAGS=$CXXFLAGS
11719         save_IFS=$IFS
11720         IFS=$P_SEP
11721         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11722             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11723             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11724             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11725             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11726             dnl unsetting IFS."):
11727             IFS=$save_IFS
11728             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11729             dnl ignore them here:
11730             if test -z "$i"; then
11731                 continue
11732             fi
11733             dnl TODO: White space in $i would cause problems:
11734             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11735             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11736                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11737         done
11738         CXXFLAGS=$save_CXXFLAGS
11739         if test -z "$ZXING_CFLAGS"; then
11740             AC_MSG_ERROR(zxing headers not found.)
11741         fi
11742         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11743             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11744             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11745         AC_LANG_POP([C++])
11746         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11747         FilterLibs "${ZXING_LIBS}"
11748         ZXING_LIBS="${filteredlibs}"
11749     else
11750         AC_MSG_RESULT([internal])
11751         SYSTEM_ZXING=
11752         BUILD_TYPE="$BUILD_TYPE ZXING"
11753         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11754     fi
11755     if test "$ENABLE_ZXING" = TRUE; then
11756         AC_DEFINE(ENABLE_ZXING)
11757     fi
11758     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11759     AC_LANG_PUSH([C++])
11760     save_CXXFLAGS=$CXXFLAGS
11761     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11762     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11763             #include <BitMatrix.h>
11764             #include <BitMatrixIO.h>
11765             int main(){
11766                 ZXing::BitMatrix matrix(1, 1);
11767                 matrix.set(0, 0, true);
11768                 ZXing::ToSVG(matrix);
11769                 return 0;
11770             }
11771         ])], [
11772             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11773             AC_MSG_RESULT([yes])
11774         ], [AC_MSG_RESULT([no])])
11775     CXXFLAGS=$save_CXXFLAGS
11776     AC_LANG_POP([C++])
11777     AC_SUBST(HAVE_ZXING_TOSVG)
11779 AC_SUBST(SYSTEM_ZXING)
11780 AC_SUBST(ENABLE_ZXING)
11781 AC_SUBST(ZXING_CFLAGS)
11782 AC_SUBST(ZXING_LIBS)
11784 dnl ===================================================================
11785 dnl Check for system box2d
11786 dnl ===================================================================
11787 AC_MSG_CHECKING([which box2d to use])
11788 if test "$with_system_box2d" = "yes"; then
11789     AC_MSG_RESULT([external])
11790     SYSTEM_BOX2D=TRUE
11791     AC_LANG_PUSH([C++])
11792     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11793         [BOX2D_H_FOUND='FALSE'])
11794     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11795         _BOX2D_LIB=box2d
11796         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11797     else
11798         # fail this. there's no other alternative to check when we are here.
11799         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11800             [AC_MSG_ERROR(box2d headers not found.)])
11801         _BOX2D_LIB=Box2D
11802         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11803     fi
11804     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11805         [ AC_MSG_ERROR(box2d library not found.) ], [])
11806     BOX2D_LIBS=-l$_BOX2D_LIB
11807     AC_LANG_POP([C++])
11808     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11809     FilterLibs "${BOX2D_LIBS}"
11810     BOX2D_LIBS="${filteredlibs}"
11811 else
11812     AC_MSG_RESULT([internal])
11813     SYSTEM_BOX2D=
11814     BUILD_TYPE="$BUILD_TYPE BOX2D"
11816 AC_SUBST(SYSTEM_BOX2D)
11817 AC_SUBST(BOX2D_CFLAGS)
11818 AC_SUBST(BOX2D_LIBS)
11820 dnl ===================================================================
11821 dnl Checking for altlinuxhyph
11822 dnl ===================================================================
11823 AC_MSG_CHECKING([which altlinuxhyph to use])
11824 if test "$with_system_altlinuxhyph" = "yes"; then
11825     AC_MSG_RESULT([external])
11826     SYSTEM_HYPH=TRUE
11827     AC_CHECK_HEADER(hyphen.h, [],
11828        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11829     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11830        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11831        [#include <hyphen.h>])
11832     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11833         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11834     if test -z "$HYPHEN_LIB"; then
11835         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11836            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11837     fi
11838     if test -z "$HYPHEN_LIB"; then
11839         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11840            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11841     fi
11842 else
11843     AC_MSG_RESULT([internal])
11844     SYSTEM_HYPH=
11845     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11846     if test "$COM" = "MSC"; then
11847         HYPHEN_LIB='$(gb_StaticLibrary_WORKDIR)/hyphen.lib'
11848     else
11849         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11850     fi
11852 AC_SUBST(SYSTEM_HYPH)
11853 AC_SUBST(HYPHEN_LIB)
11855 dnl ===================================================================
11856 dnl Checking for mythes
11857 dnl ===================================================================
11858 AC_MSG_CHECKING([which mythes to use])
11859 if test "$with_system_mythes" = "yes"; then
11860     AC_MSG_RESULT([external])
11861     SYSTEM_MYTHES=TRUE
11862     AC_LANG_PUSH([C++])
11863     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11864     if test "$MYTHES_PKGCONFIG" = "no"; then
11865         AC_CHECK_HEADER(mythes.hxx, [],
11866             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11867         AC_CHECK_LIB([mythes-1.2], [main], [:],
11868             [ MYTHES_FOUND=no], [])
11869     if test "$MYTHES_FOUND" = "no"; then
11870         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11871                 [ MYTHES_FOUND=no], [])
11872     fi
11873     if test "$MYTHES_FOUND" = "no"; then
11874         AC_MSG_ERROR([mythes library not found!.])
11875     fi
11876     fi
11877     AC_LANG_POP([C++])
11878     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11879     FilterLibs "${MYTHES_LIBS}"
11880     MYTHES_LIBS="${filteredlibs}"
11881 else
11882     AC_MSG_RESULT([internal])
11883     SYSTEM_MYTHES=
11884     BUILD_TYPE="$BUILD_TYPE MYTHES"
11885     if test "$COM" = "MSC"; then
11886         MYTHES_LIBS='$(gb_StaticLibrary_WORKDIR)/mythes.lib'
11887     else
11888         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11889     fi
11891 AC_SUBST(SYSTEM_MYTHES)
11892 AC_SUBST(MYTHES_CFLAGS)
11893 AC_SUBST(MYTHES_LIBS)
11895 dnl ===================================================================
11896 dnl How should we build the linear programming solver ?
11897 dnl ===================================================================
11899 ENABLE_COINMP=
11900 AC_MSG_CHECKING([whether to build with CoinMP])
11901 if test "$enable_coinmp" != "no"; then
11902     ENABLE_COINMP=TRUE
11903     AC_MSG_RESULT([yes])
11904     if test "$with_system_coinmp" = "yes"; then
11905         SYSTEM_COINMP=TRUE
11906         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11907         FilterLibs "${COINMP_LIBS}"
11908         COINMP_LIBS="${filteredlibs}"
11909     else
11910         BUILD_TYPE="$BUILD_TYPE COINMP"
11911     fi
11912 else
11913     AC_MSG_RESULT([no])
11915 AC_SUBST(ENABLE_COINMP)
11916 AC_SUBST(SYSTEM_COINMP)
11917 AC_SUBST(COINMP_CFLAGS)
11918 AC_SUBST(COINMP_LIBS)
11920 ENABLE_LPSOLVE=
11921 AC_MSG_CHECKING([whether to build with lpsolve])
11922 if test "$enable_lpsolve" != "no"; then
11923     ENABLE_LPSOLVE=TRUE
11924     AC_MSG_RESULT([yes])
11925 else
11926     AC_MSG_RESULT([no])
11928 AC_SUBST(ENABLE_LPSOLVE)
11930 if test "$ENABLE_LPSOLVE" = TRUE; then
11931     AC_MSG_CHECKING([which lpsolve to use])
11932     if test "$with_system_lpsolve" = "yes"; then
11933         AC_MSG_RESULT([external])
11934         SYSTEM_LPSOLVE=TRUE
11935         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11936            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11937         save_LIBS=$LIBS
11938         # some systems need this. Like Ubuntu...
11939         AC_CHECK_LIB(m, floor)
11940         AC_CHECK_LIB(dl, dlopen)
11941         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11942             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11943         LIBS=$save_LIBS
11944     else
11945         AC_MSG_RESULT([internal])
11946         SYSTEM_LPSOLVE=
11947         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11948     fi
11950 AC_SUBST(SYSTEM_LPSOLVE)
11952 dnl ===================================================================
11953 dnl Checking for libexttextcat
11954 dnl ===================================================================
11955 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11956 if test "$with_system_libexttextcat" = "yes"; then
11957     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11959 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11961 dnl ===================================================================
11962 dnl Checking for libnumbertext
11963 dnl ===================================================================
11964 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11965 if test "$with_system_libnumbertext" = "yes"; then
11966     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11967     SYSTEM_LIBNUMBERTEXT=YES
11968 else
11969     SYSTEM_LIBNUMBERTEXT=
11971 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11972 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11974 dnl ***************************************
11975 dnl testing libc version for Linux...
11976 dnl ***************************************
11977 if test "$_os" = "Linux"; then
11978     AC_MSG_CHECKING([whether the libc is recent enough])
11979     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11980     #include <features.h>
11981     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11982     #error glibc >= 2.1 is required
11983     #endif
11984     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11987 dnl =========================================
11988 dnl Check for uuidgen
11989 dnl =========================================
11990 if test "$_os" = "WINNT"; then
11991     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11992     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11993     UUIDGEN=uuidgen.exe
11994     AC_SUBST(UUIDGEN)
11995 else
11996     AC_PATH_PROG([UUIDGEN], [uuidgen])
11997     if test -z "$UUIDGEN"; then
11998         AC_MSG_WARN([uuid is needed for building installation sets])
11999     fi
12002 dnl ***************************************
12003 dnl Checking for bison and flex
12004 dnl ***************************************
12005 AC_PATH_PROG(BISON, bison)
12006 if test -z "$BISON"; then
12007     AC_MSG_ERROR([no bison found in \$PATH, install it])
12008 else
12009     AC_MSG_CHECKING([the bison version])
12010     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
12011     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
12012     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
12013     dnl cause
12014     dnl
12015     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]
12016     dnl   typedef union YYSTYPE
12017     dnl           ~~~~~~^~~~~~~
12018     dnl
12019     dnl while at least 3.4.1 is know to be good:
12020     if test "$COMPILER_PLUGINS" = TRUE; then
12021         if test "$_bison_longver" -lt 2004; then
12022             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
12023         fi
12024     else
12025         if test "$_bison_longver" -lt 2000; then
12026             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
12027         fi
12028     fi
12030 AC_SUBST([BISON])
12032 AC_PATH_PROG(FLEX, flex)
12033 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12034     FLEX=`cygpath -m $FLEX`
12036 if test -z "$FLEX"; then
12037     AC_MSG_ERROR([no flex found in \$PATH, install it])
12038 else
12039     AC_MSG_CHECKING([the flex version])
12040     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
12041     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
12042         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
12043     fi
12045 AC_SUBST([FLEX])
12047 AC_PATH_PROG(DIFF, diff)
12048 if test -z "$DIFF"; then
12049     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
12051 AC_SUBST([DIFF])
12053 AC_PATH_PROG(UNIQ, uniq)
12054 if test -z "$UNIQ"; then
12055     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
12057 AC_SUBST([UNIQ])
12059 dnl ***************************************
12060 dnl Checking for patch
12061 dnl ***************************************
12062 AC_PATH_PROG(PATCH, patch)
12063 if test -z "$PATCH"; then
12064     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
12067 dnl On Solaris or macOS, check if --with-gnu-patch was used
12068 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
12069     if test -z "$with_gnu_patch"; then
12070         GNUPATCH=$PATCH
12071     else
12072         if test -x "$with_gnu_patch"; then
12073             GNUPATCH=$with_gnu_patch
12074         else
12075             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
12076         fi
12077     fi
12079     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
12080     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
12081         AC_MSG_RESULT([yes])
12082     else
12083         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
12084             AC_MSG_RESULT([no, but accepted (Apple patch)])
12085             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
12086         else
12087             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
12088         fi
12089     fi
12090 else
12091     GNUPATCH=$PATCH
12094 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12095     GNUPATCH=`cygpath -m $GNUPATCH`
12098 dnl We also need to check for --with-gnu-cp
12100 if test -z "$with_gnu_cp"; then
12101     # check the place where the good stuff is hidden on Solaris...
12102     if test -x /usr/gnu/bin/cp; then
12103         GNUCP=/usr/gnu/bin/cp
12104     else
12105         AC_PATH_PROGS(GNUCP, gnucp cp)
12106     fi
12107     if test -z $GNUCP; then
12108         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
12109     fi
12110 else
12111     if test -x "$with_gnu_cp"; then
12112         GNUCP=$with_gnu_cp
12113     else
12114         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
12115     fi
12118 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12119     GNUCP=`cygpath -m $GNUCP`
12122 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
12123 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
12124     AC_MSG_RESULT([yes])
12125 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
12126     AC_MSG_RESULT([yes])
12127 else
12128     case "$build_os" in
12129     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
12130         x_GNUCP=[\#]
12131         GNUCP=''
12132         AC_MSG_RESULT([no gnucp found - using the system's cp command])
12133         ;;
12134     *)
12135         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
12136         ;;
12137     esac
12140 AC_SUBST(GNUPATCH)
12141 AC_SUBST(GNUCP)
12142 AC_SUBST(x_GNUCP)
12144 dnl ***************************************
12145 dnl testing assembler path
12146 dnl ***************************************
12147 ML_EXE=""
12148 if test "$_os" = "WINNT"; then
12149     case "$WIN_HOST_ARCH" in
12150     x86) assembler=ml.exe ;;
12151     x64) assembler=ml64.exe ;;
12152     arm64) assembler=armasm64.exe ;;
12153     esac
12155     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
12156     if test -f "$MSVC_HOST_PATH/$assembler"; then
12157         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
12158         AC_MSG_RESULT([$ML_EXE])
12159     else
12160         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
12161     fi
12164 AC_SUBST(ML_EXE)
12166 dnl ===================================================================
12167 dnl We need zip and unzip
12168 dnl ===================================================================
12169 AC_PATH_PROG(ZIP, zip)
12170 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
12171 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
12172     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],,)
12175 AC_PATH_PROG(UNZIP, unzip)
12176 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
12178 dnl ===================================================================
12179 dnl Zip must be a specific type for different build types.
12180 dnl ===================================================================
12181 if test $build_os = cygwin; then
12182     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
12183         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
12184     fi
12187 dnl ===================================================================
12188 dnl We need touch with -h option support.
12189 dnl ===================================================================
12190 AC_PATH_PROG(TOUCH, touch)
12191 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
12192 touch "$WARNINGS_FILE"
12193 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
12194     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],,)
12197 dnl ===================================================================
12198 dnl Check for system epoxy
12199 dnl ===================================================================
12200 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
12201 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
12203 dnl ===================================================================
12204 dnl Show which vclplugs will be built.
12205 dnl ===================================================================
12206 R=""
12208 libo_ENABLE_VCLPLUG([gen])
12209 libo_ENABLE_VCLPLUG([gtk3])
12210 libo_ENABLE_VCLPLUG([gtk3_kde5])
12211 libo_ENABLE_VCLPLUG([gtk4])
12212 libo_ENABLE_VCLPLUG([kf5])
12213 libo_ENABLE_VCLPLUG([kf6])
12214 libo_ENABLE_VCLPLUG([qt5])
12215 libo_ENABLE_VCLPLUG([qt6])
12217 if test "$_os" = "WINNT"; then
12218     R="$R win"
12219 elif test "$_os" = "Darwin"; then
12220     R="$R osx"
12221 elif test "$_os" = "iOS"; then
12222     R="ios"
12223 elif test "$_os" = Android; then
12224     R="android"
12227 build_vcl_plugins="$R"
12228 if test -z "$build_vcl_plugins"; then
12229     build_vcl_plugins=" none"
12231 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
12232 VCL_PLUGIN_INFO=$R
12233 AC_SUBST([VCL_PLUGIN_INFO])
12235 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
12236     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
12239 dnl ===================================================================
12240 dnl Check for GTK libraries
12241 dnl ===================================================================
12243 GTK3_CFLAGS=""
12244 GTK3_LIBS=""
12245 ENABLE_GTKTILEDVIEWER=""
12246 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12247     if test "$with_system_cairo" = no; then
12248         add_warning 'Non-system cairo combined with gtk3 is known to cause trouble (eg. broken image in the splashscreen). Use --with-system-cairo unless you know what you are doing.'
12249     fi
12250     : ${with_system_cairo:=yes}
12251     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 atk >= 2.28.1 cairo)
12252     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12253     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12254     FilterLibs "${GTK3_LIBS}"
12255     GTK3_LIBS="${filteredlibs}"
12257     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12258     if test "$with_system_epoxy" != "yes"; then
12259         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12260         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12261                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12262     fi
12263 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12264     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12265     if test "$build_os" = "cygwin"; then
12266         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12267         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12268     fi
12270     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12271     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12272     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12273     FilterLibs "${GTK3_LIBS}"
12274     GTK3_LIBS="${filteredlibs}"
12275     ENABLE_GTKTILEDVIEWER="yes"
12277 AC_SUBST(GTK3_LIBS)
12278 AC_SUBST(GTK3_CFLAGS)
12279 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12281 GTK4_CFLAGS=""
12282 GTK4_LIBS=""
12283 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12284     if test "$with_system_cairo" = no; then
12285         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12286     fi
12287     : ${with_system_cairo:=yes}
12288     PKG_CHECK_MODULES(GTK4, gtk4 >= 4.10 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12289     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12290     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12291     FilterLibs "${GTK4_LIBS}"
12292     GTK4_LIBS="${filteredlibs}"
12294     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12295     if test "$with_system_epoxy" != "yes"; then
12296         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12297         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12298                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12299     fi
12301 AC_SUBST(GTK4_LIBS)
12302 AC_SUBST(GTK4_CFLAGS)
12304 if test "$enable_introspection" = yes; then
12305     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12306         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12307     else
12308         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12309     fi
12312 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12313 if ! test "$ENABLE_GTK3" = TRUE; then
12314     if test "$enable_atspi_tests" = yes; then
12315         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12316     fi
12317     enable_atspi_tests=no
12319 if ! test "$enable_atspi_tests" = no; then
12320     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12321     if ! test "$XVFB_RUN" = no; then
12322         dnl make sure the found xvfb-run actually works
12323         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12324         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12325             AC_MSG_RESULT([yes])
12326         else
12327             AC_MSG_RESULT([no])
12328             XVFB_RUN=no
12329         fi
12330     fi
12331     if test "$XVFB_RUN" = no; then
12332         if test "$enable_atspi_tests" = yes; then
12333             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12334         fi
12335         enable_atspi_tests=no
12336     fi
12338 if ! test "$enable_atspi_tests" = no; then
12339     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12340     if test "$DBUS_LAUNCH" = no; then
12341         if test "$enable_atspi_tests" = yes; then
12342             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12343         fi
12344         enable_atspi_tests=no
12345     fi
12347 if ! test "$enable_atspi_tests" = no; then
12348     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12349                       [if test "$enable_atspi_tests" = yes; then
12350                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12351                        else
12352                            enable_atspi_tests=no
12353                        fi])
12355 if ! test "x$enable_atspi_tests" = xno; then
12356     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12357                       [have_atspi_scroll_to=1],
12358                       [have_atspi_scroll_to=0])
12359     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12360                        [Whether AT-SPI2 has the scrollTo API])
12362 ENABLE_ATSPI_TESTS=
12363 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12364 AC_SUBST([ENABLE_ATSPI_TESTS])
12366 dnl ===================================================================
12367 dnl check for dbus support
12368 dnl ===================================================================
12369 ENABLE_DBUS=""
12370 DBUS_CFLAGS=""
12371 DBUS_LIBS=""
12372 DBUS_GLIB_CFLAGS=""
12373 DBUS_GLIB_LIBS=""
12374 DBUS_HAVE_GLIB=""
12376 if test "$enable_dbus" = "no"; then
12377     test_dbus=no
12380 AC_MSG_CHECKING([whether to enable DBUS support])
12381 if test "$test_dbus" = "yes"; then
12382     ENABLE_DBUS="TRUE"
12383     AC_MSG_RESULT([yes])
12384     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12385     AC_DEFINE(ENABLE_DBUS)
12386     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12387     FilterLibs "${DBUS_LIBS}"
12388     DBUS_LIBS="${filteredlibs}"
12390     # Glib is needed for BluetoothServer
12391     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12392     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12393         [
12394             DBUS_HAVE_GLIB="TRUE"
12395             AC_DEFINE(DBUS_HAVE_GLIB,1)
12396         ],
12397         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12398     )
12399 else
12400     AC_MSG_RESULT([no])
12403 AC_SUBST(ENABLE_DBUS)
12404 AC_SUBST(DBUS_CFLAGS)
12405 AC_SUBST(DBUS_LIBS)
12406 AC_SUBST(DBUS_GLIB_CFLAGS)
12407 AC_SUBST(DBUS_GLIB_LIBS)
12408 AC_SUBST(DBUS_HAVE_GLIB)
12410 AC_MSG_CHECKING([whether to enable Impress remote control])
12411 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12412     AC_MSG_RESULT([yes])
12413     ENABLE_SDREMOTE=TRUE
12414     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12415         <true/>"
12416     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12418     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12419         # The Bluetooth code doesn't compile with macOS SDK 10.15
12420         if test "$enable_sdremote_bluetooth" = yes; then
12421             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12422         fi
12423         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12424         enable_sdremote_bluetooth=no
12425     fi
12426     # If not explicitly enabled or disabled, default
12427     if test -z "$enable_sdremote_bluetooth"; then
12428         case "$OS" in
12429         LINUX|MACOSX|WNT)
12430             # Default to yes for these
12431             enable_sdremote_bluetooth=yes
12432             ;;
12433         *)
12434             # otherwise no
12435             enable_sdremote_bluetooth=no
12436             ;;
12437         esac
12438     fi
12439     # $enable_sdremote_bluetooth is guaranteed non-empty now
12441     if test "$enable_sdremote_bluetooth" != "no"; then
12442         if test "$OS" = "LINUX"; then
12443             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12444                 AC_MSG_RESULT([yes])
12445                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12446                 dnl ===================================================================
12447                 dnl Check for system bluez
12448                 dnl ===================================================================
12449                 AC_MSG_CHECKING([which Bluetooth header to use])
12450                 if test "$with_system_bluez" = "yes"; then
12451                     AC_MSG_RESULT([external])
12452                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12453                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12454                     SYSTEM_BLUEZ=TRUE
12455                 else
12456                     AC_MSG_RESULT([internal])
12457                     SYSTEM_BLUEZ=
12458                 fi
12459             else
12460                 AC_MSG_RESULT([no, dbus disabled])
12461                 ENABLE_SDREMOTE_BLUETOOTH=
12462                 SYSTEM_BLUEZ=
12463             fi
12464         else
12465             AC_MSG_RESULT([yes])
12466             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12467             SYSTEM_BLUEZ=
12468             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12469         <key>com.apple.security.device.bluetooth</key>
12470         <true/>"
12471         fi
12472     else
12473         AC_MSG_RESULT([no])
12474         ENABLE_SDREMOTE_BLUETOOTH=
12475         SYSTEM_BLUEZ=
12476     fi
12477 else
12478     ENABLE_SDREMOTE=
12479     SYSTEM_BLUEZ=
12480     AC_MSG_RESULT([no])
12482 AC_SUBST(ENABLE_SDREMOTE)
12483 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12484 AC_SUBST(SDREMOTE_ENTITLEMENT)
12485 AC_SUBST(SYSTEM_BLUEZ)
12487 dnl ===================================================================
12488 dnl Check whether to enable GIO support
12489 dnl ===================================================================
12490 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12491     AC_MSG_CHECKING([whether to enable GIO support])
12492     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12493         dnl Need at least 2.26 for the dbus support.
12494         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12495                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12496         if test "$ENABLE_GIO" = "TRUE"; then
12497             AC_DEFINE(ENABLE_GIO)
12498             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12499             FilterLibs "${GIO_LIBS}"
12500             GIO_LIBS="${filteredlibs}"
12501         fi
12502     else
12503         AC_MSG_RESULT([no])
12504     fi
12506 AC_SUBST(ENABLE_GIO)
12507 AC_SUBST(GIO_CFLAGS)
12508 AC_SUBST(GIO_LIBS)
12511 dnl ===================================================================
12513 SPLIT_APP_MODULES=""
12514 if test "$enable_split_app_modules" = "yes"; then
12515     SPLIT_APP_MODULES="TRUE"
12517 AC_SUBST(SPLIT_APP_MODULES)
12519 SPLIT_OPT_FEATURES=""
12520 if test "$enable_split_opt_features" = "yes"; then
12521     SPLIT_OPT_FEATURES="TRUE"
12523 AC_SUBST(SPLIT_OPT_FEATURES)
12525 dnl ===================================================================
12526 dnl Check whether the GStreamer libraries are available.
12527 dnl ===================================================================
12529 ENABLE_GSTREAMER_1_0=""
12531 if test "$test_gstreamer_1_0" = yes; then
12533     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12534     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12535         ENABLE_GSTREAMER_1_0="TRUE"
12536         AC_MSG_RESULT([yes])
12537         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12538         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12539         FilterLibs "${GSTREAMER_1_0_LIBS}"
12540         GSTREAMER_1_0_LIBS="${filteredlibs}"
12541         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12542     else
12543         AC_MSG_RESULT([no])
12544     fi
12546 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12547 AC_SUBST(GSTREAMER_1_0_LIBS)
12548 AC_SUBST(ENABLE_GSTREAMER_1_0)
12550 ENABLE_OPENGL_TRANSITIONS=
12551 ENABLE_OPENGL_CANVAS=
12552 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12553    : # disable
12554 elif test "$_os" = "Darwin"; then
12555     # We use frameworks on macOS, no need for detail checks
12556     ENABLE_OPENGL_TRANSITIONS=TRUE
12557     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12558     ENABLE_OPENGL_CANVAS=TRUE
12559 elif test $_os = WINNT; then
12560     ENABLE_OPENGL_TRANSITIONS=TRUE
12561     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12562     ENABLE_OPENGL_CANVAS=TRUE
12563 else
12564     if test "$USING_X11" = TRUE; then
12565         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12566         ENABLE_OPENGL_TRANSITIONS=TRUE
12567         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12568         ENABLE_OPENGL_CANVAS=TRUE
12569     fi
12572 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12573 AC_SUBST(ENABLE_OPENGL_CANVAS)
12575 dnl =================================================
12576 dnl Check whether to build with OpenCL support.
12577 dnl =================================================
12579 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12580     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12581     # platform (optional at run-time, used through clew).
12582     BUILD_TYPE="$BUILD_TYPE OPENCL"
12583     AC_DEFINE(HAVE_FEATURE_OPENCL)
12586 dnl =================================================
12587 dnl Check whether to build with dconf support.
12588 dnl =================================================
12590 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12591     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12592         if test "$enable_dconf" = yes; then
12593             AC_MSG_ERROR([dconf not found])
12594         else
12595             enable_dconf=no
12596         fi])
12598 AC_MSG_CHECKING([whether to enable dconf])
12599 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12600     DCONF_CFLAGS=
12601     DCONF_LIBS=
12602     ENABLE_DCONF=
12603     AC_MSG_RESULT([no])
12604 else
12605     ENABLE_DCONF=TRUE
12606     AC_DEFINE(ENABLE_DCONF)
12607     AC_MSG_RESULT([yes])
12609 AC_SUBST([DCONF_CFLAGS])
12610 AC_SUBST([DCONF_LIBS])
12611 AC_SUBST([ENABLE_DCONF])
12613 # pdf import?
12614 AC_MSG_CHECKING([whether to build the PDF import feature])
12615 ENABLE_PDFIMPORT=
12616 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12617     AC_MSG_RESULT([yes])
12618     ENABLE_PDFIMPORT=TRUE
12619     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12620 else
12621     AC_MSG_RESULT([no])
12624 # Pdfium?
12625 AC_MSG_CHECKING([whether to build PDFium])
12626 ENABLE_PDFIUM=
12627 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12628     AC_MSG_RESULT([yes])
12629     ENABLE_PDFIUM=TRUE
12630     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12631 else
12632     AC_MSG_RESULT([no])
12634 AC_SUBST(ENABLE_PDFIUM)
12636 if test "$ENABLE_PDFIUM" = "TRUE"; then
12637     AC_MSG_CHECKING([which OpenJPEG library to use])
12638     if test "$with_system_openjpeg" = "yes"; then
12639         SYSTEM_OPENJPEG2=TRUE
12640         AC_MSG_RESULT([external])
12641         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12642         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12643         FilterLibs "${OPENJPEG2_LIBS}"
12644         OPENJPEG2_LIBS="${filteredlibs}"
12645     else
12646         SYSTEM_OPENJPEG2=FALSE
12647         AC_MSG_RESULT([internal])
12648     fi
12650     AC_MSG_CHECKING([which Abseil library to use])
12651     if test "$with_system_abseil" = "yes"; then
12652         AC_MSG_RESULT([external])
12653         SYSTEM_ABSEIL=TRUE
12654         AC_LANG_PUSH([C++])
12655         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12656         AC_LANG_POP([C++])
12657         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12658         FilterLibs "${ABSEIL_LIBS}"
12659         ABSEIL_LIBS="${filteredlibs}"
12660     else
12661         AC_MSG_RESULT([internal])
12662     fi
12664 AC_SUBST(SYSTEM_OPENJPEG2)
12665 AC_SUBST(SYSTEM_ABSEIL)
12666 AC_SUBST(ABSEIL_CFLAGS)
12667 AC_SUBST(ABSEIL_LIBS)
12669 dnl ===================================================================
12670 dnl Check for poppler
12671 dnl ===================================================================
12672 ENABLE_POPPLER=
12673 AC_MSG_CHECKING([whether to build Poppler])
12674 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12675     AC_MSG_RESULT([yes])
12676     ENABLE_POPPLER=TRUE
12677     AC_DEFINE(HAVE_FEATURE_POPPLER)
12678 else
12679     AC_MSG_RESULT([no])
12681 AC_SUBST(ENABLE_POPPLER)
12683 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12684     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12687 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12688     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12691 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12692     dnl ===================================================================
12693     dnl Check for system poppler
12694     dnl ===================================================================
12695     AC_MSG_CHECKING([which PDF import poppler to use])
12696     if test "$with_system_poppler" = "yes"; then
12697         AC_MSG_RESULT([external])
12698         SYSTEM_POPPLER=TRUE
12699         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12700         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12701         FilterLibs "${POPPLER_LIBS}"
12702         POPPLER_LIBS="${filteredlibs}"
12703     else
12704         AC_MSG_RESULT([internal])
12705         SYSTEM_POPPLER=
12706         BUILD_TYPE="$BUILD_TYPE POPPLER"
12707     fi
12708     AC_DEFINE([ENABLE_PDFIMPORT],1)
12710 AC_SUBST(ENABLE_PDFIMPORT)
12711 AC_SUBST(SYSTEM_POPPLER)
12712 AC_SUBST(POPPLER_CFLAGS)
12713 AC_SUBST(POPPLER_LIBS)
12715 # Skia?
12716 ENABLE_SKIA=
12717 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12718     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12719     if test "$SYSTEM_FREETYPE" = TRUE; then
12720         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12721             [skia_freetype_ok=yes],
12722             [skia_freetype_ok=no])
12723     else # internal is ok
12724         skia_freetype_ok=yes
12725     fi
12726     AC_MSG_CHECKING([whether to build Skia])
12727     if test "$skia_freetype_ok" = "yes"; then
12728         if test "$enable_skia" = "debug"; then
12729             AC_MSG_RESULT([yes (debug)])
12730             ENABLE_SKIA_DEBUG=TRUE
12731         else
12732             AC_MSG_RESULT([yes])
12733             ENABLE_SKIA_DEBUG=
12734         fi
12735         ENABLE_SKIA=TRUE
12736         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12737             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12738         fi
12740         AC_DEFINE(HAVE_FEATURE_SKIA)
12741         BUILD_TYPE="$BUILD_TYPE SKIA"
12743         if test "$OS" = "MACOSX"; then
12744             AC_DEFINE(SK_GANESH,1)
12745             AC_DEFINE(SK_METAL,1)
12746             SKIA_GPU=METAL
12747             AC_SUBST(SKIA_GPU)
12748         else
12749             AC_DEFINE(SK_GANESH,1)
12750             AC_DEFINE(SK_VULKAN,1)
12751             SKIA_GPU=VULKAN
12752             AC_SUBST(SKIA_GPU)
12753         fi
12754     else
12755         AC_MSG_RESULT([no (freetype too old)])
12756         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12757     fi
12759 else
12760     AC_MSG_CHECKING([whether to build Skia])
12761     AC_MSG_RESULT([no])
12763 AC_SUBST(ENABLE_SKIA)
12764 AC_SUBST(ENABLE_SKIA_DEBUG)
12766 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12767 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12768 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12769 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12770 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12771 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12772 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12773 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12774 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12775 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12776 LO_CLANG_VERSION=
12777 HAVE_LO_CLANG_DLLEXPORTINLINES=
12779 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12780     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12781         AC_MSG_CHECKING([for Clang])
12782         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12783     else
12784         if test "$_os" = "WINNT"; then
12785             AC_MSG_CHECKING([for clang-cl])
12786             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12787                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12788             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12789                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12790             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12791                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12792             fi
12793             if test -n "$LO_CLANG_CC"; then
12794                 dnl explicitly set -m32/-m64
12795                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12796                 LO_CLANG_CXX="$LO_CLANG_CC"
12797                 AC_MSG_RESULT([$LO_CLANG_CC])
12798             else
12799                 AC_MSG_RESULT([no])
12800             fi
12802             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12803             echo "#include <stdlib.h>" > conftest.c
12804             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12805                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12806             rm -f conftest.c conftest.obj
12807             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12808                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12809             else
12810                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12811             fi
12812         else
12813             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12814             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12815         fi
12816     fi
12817     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12818         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12819         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12820         if test "$LO_CLANG_VERSION" -lt 50002; then
12821             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12822             LO_CLANG_CC=
12823             LO_CLANG_CXX=
12824         fi
12825     fi
12826     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12827         save_CXX="$CXX"
12828         CXX="$LO_CLANG_CXX"
12829         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12830         AC_LANG_PUSH([C++])
12831         save_CXXFLAGS=$CXXFLAGS
12832         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12833         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12834                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12835                 AC_MSG_RESULT([yes])
12836             ], [AC_MSG_RESULT([no])])
12837         CXXFLAGS=$save_CXXFLAGS
12838         AC_LANG_POP([C++])
12839         CXX="$save_CXX"
12840         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12841             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.])
12842         fi
12843     fi
12844     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12845         # Skia is the default on Windows and Mac, so hard-require Clang.
12846         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12847         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12848             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12849         else
12850             AC_MSG_WARN([Clang compiler not found.])
12851         fi
12852     else
12854         save_CXX="$CXX"
12855         CXX="$LO_CLANG_CXX"
12856         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12857         flag_sse2=-msse2
12858         flag_ssse3=-mssse3
12859         flag_sse41=-msse4.1
12860         flag_sse42=-msse4.2
12861         flag_avx=-mavx
12862         flag_avx2=-mavx2
12863         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12864         flag_avx512f=-mavx512f
12865         flag_f16c=-mf16c
12866         flag_fma=-mfma
12868         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12869         AC_LANG_PUSH([C++])
12870         save_CXXFLAGS=$CXXFLAGS
12871         CXXFLAGS="$CXXFLAGS $flag_sse2"
12872         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12873             #include <emmintrin.h>
12874             int main () {
12875                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12876                 c = _mm_xor_si128 (a, b);
12877                 return 0;
12878             }
12879             ])],
12880             [can_compile_sse2=yes],
12881             [can_compile_sse2=no])
12882         AC_LANG_POP([C++])
12883         CXXFLAGS=$save_CXXFLAGS
12884         AC_MSG_RESULT([${can_compile_sse2}])
12885         if test "${can_compile_sse2}" = "yes" ; then
12886             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12887         fi
12889         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12890         AC_LANG_PUSH([C++])
12891         save_CXXFLAGS=$CXXFLAGS
12892         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12893         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12894             #include <tmmintrin.h>
12895             int main () {
12896                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12897                 c = _mm_maddubs_epi16 (a, b);
12898                 return 0;
12899             }
12900             ])],
12901             [can_compile_ssse3=yes],
12902             [can_compile_ssse3=no])
12903         AC_LANG_POP([C++])
12904         CXXFLAGS=$save_CXXFLAGS
12905         AC_MSG_RESULT([${can_compile_ssse3}])
12906         if test "${can_compile_ssse3}" = "yes" ; then
12907             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12908         fi
12910         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12911         AC_LANG_PUSH([C++])
12912         save_CXXFLAGS=$CXXFLAGS
12913         CXXFLAGS="$CXXFLAGS $flag_sse41"
12914         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12915             #include <smmintrin.h>
12916             int main () {
12917                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12918                 c = _mm_cmpeq_epi64 (a, b);
12919                 return 0;
12920             }
12921             ])],
12922             [can_compile_sse41=yes],
12923             [can_compile_sse41=no])
12924         AC_LANG_POP([C++])
12925         CXXFLAGS=$save_CXXFLAGS
12926         AC_MSG_RESULT([${can_compile_sse41}])
12927         if test "${can_compile_sse41}" = "yes" ; then
12928             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12929         fi
12931         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12932         AC_LANG_PUSH([C++])
12933         save_CXXFLAGS=$CXXFLAGS
12934         CXXFLAGS="$CXXFLAGS $flag_sse42"
12935         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12936             #include <nmmintrin.h>
12937             int main () {
12938                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12939                 c = _mm_cmpgt_epi64 (a, b);
12940                 return 0;
12941             }
12942             ])],
12943             [can_compile_sse42=yes],
12944             [can_compile_sse42=no])
12945         AC_LANG_POP([C++])
12946         CXXFLAGS=$save_CXXFLAGS
12947         AC_MSG_RESULT([${can_compile_sse42}])
12948         if test "${can_compile_sse42}" = "yes" ; then
12949             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12950         fi
12952         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12953         AC_LANG_PUSH([C++])
12954         save_CXXFLAGS=$CXXFLAGS
12955         CXXFLAGS="$CXXFLAGS $flag_avx"
12956         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12957             #include <immintrin.h>
12958             int main () {
12959                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12960                 c = _mm256_xor_ps(a, b);
12961                 return 0;
12962             }
12963             ])],
12964             [can_compile_avx=yes],
12965             [can_compile_avx=no])
12966         AC_LANG_POP([C++])
12967         CXXFLAGS=$save_CXXFLAGS
12968         AC_MSG_RESULT([${can_compile_avx}])
12969         if test "${can_compile_avx}" = "yes" ; then
12970             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12971         fi
12973         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12974         AC_LANG_PUSH([C++])
12975         save_CXXFLAGS=$CXXFLAGS
12976         CXXFLAGS="$CXXFLAGS $flag_avx2"
12977         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12978             #include <immintrin.h>
12979             int main () {
12980                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12981                 c = _mm256_maddubs_epi16(a, b);
12982                 return 0;
12983             }
12984             ])],
12985             [can_compile_avx2=yes],
12986             [can_compile_avx2=no])
12987         AC_LANG_POP([C++])
12988         CXXFLAGS=$save_CXXFLAGS
12989         AC_MSG_RESULT([${can_compile_avx2}])
12990         if test "${can_compile_avx2}" = "yes" ; then
12991             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12992         fi
12994         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12995         AC_LANG_PUSH([C++])
12996         save_CXXFLAGS=$CXXFLAGS
12997         CXXFLAGS="$CXXFLAGS $flag_avx512"
12998         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12999             #include <immintrin.h>
13000             int main () {
13001                 __m512i a = _mm512_loadu_si512(0);
13002                 __m512d v1 = _mm512_load_pd(0);
13003                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
13004                 __m512d v2 = _mm512_abs_pd(v1);
13005                 return 0;
13006             }
13007             ])],
13008             [can_compile_avx512=yes],
13009             [can_compile_avx512=no])
13010         AC_LANG_POP([C++])
13011         CXXFLAGS=$save_CXXFLAGS
13012         AC_MSG_RESULT([${can_compile_avx512}])
13013         if test "${can_compile_avx512}" = "yes" ; then
13014             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
13015             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
13016         fi
13018         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
13019         AC_LANG_PUSH([C++])
13020         save_CXXFLAGS=$CXXFLAGS
13021         CXXFLAGS="$CXXFLAGS $flag_f16c"
13022         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
13023             #include <immintrin.h>
13024             int main () {
13025                 __m128i a = _mm_set1_epi32 (0);
13026                 __m128 c;
13027                 c = _mm_cvtph_ps(a);
13028                 return 0;
13029             }
13030             ])],
13031             [can_compile_f16c=yes],
13032             [can_compile_f16c=no])
13033         AC_LANG_POP([C++])
13034         CXXFLAGS=$save_CXXFLAGS
13035         AC_MSG_RESULT([${can_compile_f16c}])
13036         if test "${can_compile_f16c}" = "yes" ; then
13037             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
13038         fi
13040         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
13041         AC_LANG_PUSH([C++])
13042         save_CXXFLAGS=$CXXFLAGS
13043         CXXFLAGS="$CXXFLAGS $flag_fma"
13044         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
13045             #include <immintrin.h>
13046             int main () {
13047                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
13048                 d = _mm256_fmadd_ps(a, b, c);
13049                 return 0;
13050             }
13051             ])],
13052             [can_compile_fma=yes],
13053             [can_compile_fma=no])
13054         AC_LANG_POP([C++])
13055         CXXFLAGS=$save_CXXFLAGS
13056         AC_MSG_RESULT([${can_compile_fma}])
13057         if test "${can_compile_fma}" = "yes" ; then
13058             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
13059         fi
13061         CXX="$save_CXX"
13062     fi
13065 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
13067 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
13068     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
13069     AC_LANG_PUSH([C])
13070     save_CC="$CC"
13071     CC="$LO_CLANG_CC"
13072     save_CFLAGS=$CFLAGS
13073     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
13074     dnl an empty program will do, we're checking the compiler flags
13075     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
13076                       [use_ccache=yes], [use_ccache=no])
13077     CFLAGS=$save_CFLAGS
13078     CC=$save_CC
13079     if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
13080         AC_MSG_RESULT([yes])
13081     else
13082         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
13083         AC_MSG_RESULT([no])
13084     fi
13085     AC_LANG_POP([C])
13087     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
13088     AC_LANG_PUSH([C++])
13089     save_CXX="$CXX"
13090     CXX="$LO_CLANG_CXX"
13091     save_CXXFLAGS=$CXXFLAGS
13092     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
13093     dnl an empty program will do, we're checking the compiler flags
13094     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
13095                       [use_ccache=yes], [use_ccache=no])
13096     if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
13097         AC_MSG_RESULT([yes])
13098     else
13099         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
13100         AC_MSG_RESULT([no])
13101     fi
13102     CXXFLAGS=$save_CXXFLAGS
13103     CXX=$save_CXX
13104     AC_LANG_POP([C++])
13107 AC_SUBST(LO_CLANG_CC)
13108 AC_SUBST(LO_CLANG_CXX)
13109 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
13110 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
13111 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
13112 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
13113 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
13114 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
13115 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
13116 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
13117 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
13118 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
13119 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
13120 AC_SUBST(LO_CLANG_VERSION)
13121 AC_SUBST(CLANG_USE_LD)
13122 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
13124 SYSTEM_GPGMEPP=
13126 AC_MSG_CHECKING([whether to enable gpgmepp])
13127 if test "$enable_gpgmepp" = no; then
13128     AC_MSG_RESULT([no])
13129 elif test "$enable_mpl_subset" = "yes"; then
13130     AC_MSG_RESULT([no (MPL only)])
13131 elif test "$enable_fuzzers" = "yes"; then
13132     AC_MSG_RESULT([no (oss-fuzz)])
13133 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
13134     AC_MSG_RESULT([yes])
13135     dnl ===================================================================
13136     dnl Check for system gpgme
13137     dnl ===================================================================
13138     AC_MSG_CHECKING([which gpgmepp to use])
13139     if test "$with_system_gpgmepp" = "yes"; then
13140         AC_MSG_RESULT([external])
13141         SYSTEM_GPGMEPP=TRUE
13143         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
13144         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
13145             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
13146         AC_CHECK_HEADER(gpgme.h, [],
13147             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
13148         AC_CHECK_LIB(gpgmepp, main, [],
13149             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
13150         GPGMEPP_LIBS=-lgpgmepp
13151     else
13152         AC_MSG_RESULT([internal])
13153         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
13155         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
13156         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
13157         if test "$_os" != "WINNT"; then
13158             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
13159             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
13160         fi
13161     fi
13162     ENABLE_GPGMEPP=TRUE
13163     AC_DEFINE([HAVE_FEATURE_GPGME])
13164     AC_PATH_PROG(GPG, gpg)
13165     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
13166     # so let's exclude that manually for the moment
13167     if test -n "$GPG" -a "$_os" != "WINNT"; then
13168         # make sure we not only have a working gpgme, but a full working
13169         # gpg installation to run OpenPGP signature verification
13170         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
13171     fi
13172     if test "$_os" = "Linux"; then
13173       uid=`id -u`
13174       AC_MSG_CHECKING([for /run/user/$uid])
13175       if test -d /run/user/$uid; then
13176         AC_MSG_RESULT([yes])
13177         AC_PATH_PROG(GPGCONF, gpgconf)
13179         # Older versions of gpgconf are not working as expected, since
13180         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
13181         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
13182         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
13183         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
13184         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
13185         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
13186         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
13187           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
13188           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
13189           if $GPGCONF --dump-options > /dev/null ; then
13190             if $GPGCONF --dump-options | grep -q create-socketdir ; then
13191               AC_MSG_RESULT([yes])
13192               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
13193               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
13194             else
13195               AC_MSG_RESULT([no])
13196             fi
13197           else
13198             AC_MSG_RESULT([no. missing or broken gpgconf?])
13199           fi
13200         else
13201           AC_MSG_RESULT([no, $GPGCONF_VERSION])
13202         fi
13203       else
13204         AC_MSG_RESULT([no])
13205      fi
13206    fi
13207 else
13208     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
13210 AC_SUBST(ENABLE_GPGMEPP)
13211 AC_SUBST(SYSTEM_GPGMEPP)
13212 AC_SUBST(GPG_ERROR_CFLAGS)
13213 AC_SUBST(GPG_ERROR_LIBS)
13214 AC_SUBST(LIBASSUAN_CFLAGS)
13215 AC_SUBST(LIBASSUAN_LIBS)
13216 AC_SUBST(GPGMEPP_CFLAGS)
13217 AC_SUBST(GPGMEPP_LIBS)
13219 AC_ARG_WITH(system-java-websocket,
13220     AS_HELP_STRING([--with-system-java-websocket],
13221         [Use Java-WebSocket already on system.]),,
13222     [with_system_java_websocket="$with_system_jars"])
13224 AC_ARG_WITH(java-websocket-jar,
13225     AS_HELP_STRING([--with-java-websocket-jar=JARFILE],
13226         [Specify path to jarfile manually.]),
13227     JAVA_WEBSOCKET_JAR=$withval)
13229 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
13230 if test "$with_java" != "no"; then
13231     AC_MSG_RESULT([yes])
13232     ENABLE_JAVA_WEBSOCKET=TRUE
13234     dnl ===================================================================
13235     dnl Check for system Java-WebSocket
13236     dnl ===================================================================
13237     AC_MSG_CHECKING([which Java-WebSocket to use])
13238     if test "$with_system_java_websocket" = "yes"; then
13239         AC_MSG_RESULT([external])
13240         SYSTEM_JAVA_WEBSOCKET=TRUE
13241         if test -z $JAVA_WEBSOCKET_JAR; then
13242             JAVA_WEBSOCKET_JAR=/usr/share/java/Java-WebSocket/Java-WebSocket.jar
13243         fi
13244         if ! test -f $JAVA_WEBSOCKET_JAR; then
13245             AC_MSG_ERROR(Java-WebSocket.jar not found.)
13246         fi
13247     else
13248         AC_MSG_RESULT([internal])
13249         SYSTEM_JAVA_WEBSOCKET=
13250         BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
13251         NEED_ANT=TRUE
13252     fi
13253 else
13254     AC_MSG_RESULT([no])
13255     ENABLE_JAVA_WEBSOCKET=
13257 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
13258 AC_SUBST(SYSTEM_JAVA_WEBSOCKET)
13259 AC_SUBST(JAVA_WEBSOCKET_JAR)
13261 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
13262 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
13263     AC_MSG_RESULT([yes])
13264     ENABLE_MEDIAWIKI=TRUE
13265     BUILD_TYPE="$BUILD_TYPE XSLTML"
13266     if test  "x$with_java" = "xno"; then
13267         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
13268     fi
13269 else
13270     AC_MSG_RESULT([no])
13271     ENABLE_MEDIAWIKI=
13272     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13274 AC_SUBST(ENABLE_MEDIAWIKI)
13276 AC_MSG_CHECKING([whether to build the Report Builder])
13277 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13278     AC_MSG_RESULT([yes])
13279     ENABLE_REPORTBUILDER=TRUE
13280     AC_MSG_CHECKING([which jfreereport libs to use])
13281     if test "$with_system_jfreereport" = "yes"; then
13282         SYSTEM_JFREEREPORT=TRUE
13283         AC_MSG_RESULT([external])
13284         if test -z $SAC_JAR; then
13285             SAC_JAR=/usr/share/java/sac.jar
13286         fi
13287         if ! test -f $SAC_JAR; then
13288              AC_MSG_ERROR(sac.jar not found.)
13289         fi
13291         if test -z $LIBXML_JAR; then
13292             if test -f /usr/share/java/libxml-1.0.0.jar; then
13293                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13294             elif test -f /usr/share/java/libxml.jar; then
13295                 LIBXML_JAR=/usr/share/java/libxml.jar
13296             else
13297                 AC_MSG_ERROR(libxml.jar replacement not found.)
13298             fi
13299         elif ! test -f $LIBXML_JAR; then
13300             AC_MSG_ERROR(libxml.jar not found.)
13301         fi
13303         if test -z $FLUTE_JAR; then
13304             if test -f /usr/share/java/flute-1.3.0.jar; then
13305                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13306             elif test -f /usr/share/java/flute.jar; then
13307                 FLUTE_JAR=/usr/share/java/flute.jar
13308             else
13309                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13310             fi
13311         elif ! test -f $FLUTE_JAR; then
13312             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13313         fi
13315         if test -z $JFREEREPORT_JAR; then
13316             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13317                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13318             elif test -f /usr/share/java/flow-engine.jar; then
13319                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13320             else
13321                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13322             fi
13323         elif ! test -f  $JFREEREPORT_JAR; then
13324                 AC_MSG_ERROR(jfreereport.jar not found.)
13325         fi
13327         if test -z $LIBLAYOUT_JAR; then
13328             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13329                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13330             elif test -f /usr/share/java/liblayout.jar; then
13331                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13332             else
13333                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13334             fi
13335         elif ! test -f $LIBLAYOUT_JAR; then
13336                 AC_MSG_ERROR(liblayout.jar not found.)
13337         fi
13339         if test -z $LIBLOADER_JAR; then
13340             if test -f /usr/share/java/libloader-1.0.0.jar; then
13341                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13342             elif test -f /usr/share/java/libloader.jar; then
13343                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13344             else
13345                 AC_MSG_ERROR(libloader.jar replacement not found.)
13346             fi
13347         elif ! test -f  $LIBLOADER_JAR; then
13348             AC_MSG_ERROR(libloader.jar not found.)
13349         fi
13351         if test -z $LIBFORMULA_JAR; then
13352             if test -f /usr/share/java/libformula-0.2.0.jar; then
13353                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13354             elif test -f /usr/share/java/libformula.jar; then
13355                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13356             else
13357                 AC_MSG_ERROR(libformula.jar replacement not found.)
13358             fi
13359         elif ! test -f $LIBFORMULA_JAR; then
13360                 AC_MSG_ERROR(libformula.jar not found.)
13361         fi
13363         if test -z $LIBREPOSITORY_JAR; then
13364             if test -f /usr/share/java/librepository-1.0.0.jar; then
13365                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13366             elif test -f /usr/share/java/librepository.jar; then
13367                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13368             else
13369                 AC_MSG_ERROR(librepository.jar replacement not found.)
13370             fi
13371         elif ! test -f $LIBREPOSITORY_JAR; then
13372             AC_MSG_ERROR(librepository.jar not found.)
13373         fi
13375         if test -z $LIBFONTS_JAR; then
13376             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13377                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13378             elif test -f /usr/share/java/libfonts.jar; then
13379                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13380             else
13381                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13382             fi
13383         elif ! test -f $LIBFONTS_JAR; then
13384                 AC_MSG_ERROR(libfonts.jar not found.)
13385         fi
13387         if test -z $LIBSERIALIZER_JAR; then
13388             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13389                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13390             elif test -f /usr/share/java/libserializer.jar; then
13391                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13392             else
13393                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13394             fi
13395         elif ! test -f $LIBSERIALIZER_JAR; then
13396                 AC_MSG_ERROR(libserializer.jar not found.)
13397         fi
13399         if test -z $LIBBASE_JAR; then
13400             if test -f /usr/share/java/libbase-1.0.0.jar; then
13401                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13402             elif test -f /usr/share/java/libbase.jar; then
13403                 LIBBASE_JAR=/usr/share/java/libbase.jar
13404             else
13405                 AC_MSG_ERROR(libbase.jar replacement not found.)
13406             fi
13407         elif ! test -f $LIBBASE_JAR; then
13408             AC_MSG_ERROR(libbase.jar not found.)
13409         fi
13411     else
13412         AC_MSG_RESULT([internal])
13413         SYSTEM_JFREEREPORT=
13414         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13415         NEED_ANT=TRUE
13416     fi
13417     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13418 else
13419     AC_MSG_RESULT([no])
13420     ENABLE_REPORTBUILDER=
13421     SYSTEM_JFREEREPORT=
13423 AC_SUBST(ENABLE_REPORTBUILDER)
13424 AC_SUBST(SYSTEM_JFREEREPORT)
13425 AC_SUBST(SAC_JAR)
13426 AC_SUBST(LIBXML_JAR)
13427 AC_SUBST(FLUTE_JAR)
13428 AC_SUBST(JFREEREPORT_JAR)
13429 AC_SUBST(LIBBASE_JAR)
13430 AC_SUBST(LIBLAYOUT_JAR)
13431 AC_SUBST(LIBLOADER_JAR)
13432 AC_SUBST(LIBFORMULA_JAR)
13433 AC_SUBST(LIBREPOSITORY_JAR)
13434 AC_SUBST(LIBFONTS_JAR)
13435 AC_SUBST(LIBSERIALIZER_JAR)
13437 # scripting provider for BeanShell?
13438 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13439 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13440     AC_MSG_RESULT([yes])
13441     ENABLE_SCRIPTING_BEANSHELL=TRUE
13443     dnl ===================================================================
13444     dnl Check for system beanshell
13445     dnl ===================================================================
13446     AC_MSG_CHECKING([which beanshell to use])
13447     if test "$with_system_beanshell" = "yes"; then
13448         AC_MSG_RESULT([external])
13449         SYSTEM_BSH=TRUE
13450         if test -z $BSH_JAR; then
13451             BSH_JAR=/usr/share/java/bsh.jar
13452         fi
13453         if ! test -f $BSH_JAR; then
13454             AC_MSG_ERROR(bsh.jar not found.)
13455         fi
13456     else
13457         AC_MSG_RESULT([internal])
13458         SYSTEM_BSH=
13459         BUILD_TYPE="$BUILD_TYPE BSH"
13460     fi
13461 else
13462     AC_MSG_RESULT([no])
13463     ENABLE_SCRIPTING_BEANSHELL=
13464     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13466 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13467 AC_SUBST(SYSTEM_BSH)
13468 AC_SUBST(BSH_JAR)
13470 # scripting provider for JavaScript?
13471 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13472 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13473     AC_MSG_RESULT([yes])
13474     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13476     dnl ===================================================================
13477     dnl Check for system rhino
13478     dnl ===================================================================
13479     AC_MSG_CHECKING([which rhino to use])
13480     if test "$with_system_rhino" = "yes"; then
13481         AC_MSG_RESULT([external])
13482         SYSTEM_RHINO=TRUE
13483         if test -z $RHINO_JAR; then
13484             RHINO_JAR=/usr/share/java/js.jar
13485         fi
13486         if ! test -f $RHINO_JAR; then
13487             AC_MSG_ERROR(js.jar not found.)
13488         fi
13489     else
13490         AC_MSG_RESULT([internal])
13491         SYSTEM_RHINO=
13492         BUILD_TYPE="$BUILD_TYPE RHINO"
13493         NEED_ANT=TRUE
13494     fi
13495 else
13496     AC_MSG_RESULT([no])
13497     ENABLE_SCRIPTING_JAVASCRIPT=
13498     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13500 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13501 AC_SUBST(SYSTEM_RHINO)
13502 AC_SUBST(RHINO_JAR)
13504 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13505 # paths should be added to library search path. So let's put all 64-bit
13506 # platforms there.
13507 supports_multilib=
13508 case "$host_cpu" in
13509 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13510     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13511         supports_multilib="yes"
13512     fi
13513     ;;
13515     ;;
13516 esac
13518 dnl ===================================================================
13519 dnl QT5 Integration
13520 dnl ===================================================================
13522 QT5_CFLAGS=""
13523 QT5_LIBS=""
13524 QT5_GOBJECT_CFLAGS=""
13525 QT5_GOBJECT_LIBS=""
13526 QT5_HAVE_GOBJECT=""
13527 QT5_PLATFORMS_SRCDIR=""
13528 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13529         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13530         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13531 then
13532     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13533     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13535     if test -n "$supports_multilib"; then
13536         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13537     fi
13539     qt5_test_include="QtWidgets/qapplication.h"
13540     if test "$_os" = "Emscripten"; then
13541         qt5_test_library="libQt5Widgets.a"
13542     else
13543         qt5_test_library="libQt5Widgets.so"
13544     fi
13546     dnl Check for qmake5
13547     if test -n "$QT5DIR"; then
13548         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13549     else
13550         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13551     fi
13552     if test "$QMAKE5" = "no"; then
13553         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13554     else
13555         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13556         if test -z "$qmake5_test_ver"; then
13557             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13558         fi
13559         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13560         qt5_minimal_minor="15"
13561         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13562             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13563         else
13564             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13565         fi
13566     fi
13568     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13569     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13570     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13571     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13573     AC_MSG_CHECKING([for Qt5 headers])
13574     qt5_incdir="no"
13575     for inc_dir in $qt5_incdirs; do
13576         if test -r "$inc_dir/$qt5_test_include"; then
13577             qt5_incdir="$inc_dir"
13578             break
13579         fi
13580     done
13581     AC_MSG_RESULT([$qt5_incdir])
13582     if test "x$qt5_incdir" = "xno"; then
13583         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13584     fi
13585     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13586     AC_LANG_PUSH([C++])
13587     save_CPPFLAGS=$CPPFLAGS
13588     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13589     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13590         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13591     CPPFLAGS=$save_CPPFLAGS
13592     AC_LANG_POP([C++])
13594     AC_MSG_CHECKING([for Qt5 libraries])
13595     qt5_libdir="no"
13596     for lib_dir in $qt5_libdirs; do
13597         if test -r "$lib_dir/$qt5_test_library"; then
13598             qt5_libdir="$lib_dir"
13599             break
13600         fi
13601     done
13602     AC_MSG_RESULT([$qt5_libdir])
13603     if test "x$qt5_libdir" = "xno"; then
13604         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13605     fi
13607     if test "$_os" = "Emscripten"; then
13608         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13609             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13610         fi
13611         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13612             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13613         fi
13615         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13616         if ! test -x "$EMSDK_LLVM_NM"; then
13617             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13618         fi
13619         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13620             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13621         fi
13622         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13623         if test -n "$QT5_WASM_SJLJ"; then
13624             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13625         fi
13626     fi
13628     QT5_CFLAGS="-I$qt5_incdir -DQT_NO_VERSION_TAGGING"
13629     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13630     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13631     if test "$_os" = "Emscripten"; then
13632         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13633     fi
13635     if test "$USING_X11" = TRUE; then
13636         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13637         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13638         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13639         QT5_USING_X11=1
13640         AC_DEFINE(QT5_USING_X11)
13641     fi
13643     dnl Check for Meta Object Compiler
13645     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13646     if test "$MOC5" = "no"; then
13647         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13648 the root of your Qt installation by exporting QT5DIR before running "configure".])
13649     fi
13651     if test "$test_gstreamer_1_0" = yes; then
13652         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13653                 QT5_HAVE_GOBJECT=1
13654                 AC_DEFINE(QT5_HAVE_GOBJECT)
13655             ],
13656             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13657         )
13658     fi
13660 AC_SUBST(QT5_CFLAGS)
13661 AC_SUBST(QT5_LIBS)
13662 AC_SUBST(MOC5)
13663 AC_SUBST(QT5_GOBJECT_CFLAGS)
13664 AC_SUBST(QT5_GOBJECT_LIBS)
13665 AC_SUBST(QT5_HAVE_GOBJECT)
13666 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13668 dnl ===================================================================
13669 dnl QT6 Integration
13670 dnl ===================================================================
13672 QT6_CFLAGS=""
13673 QT6_LIBS=""
13674 QT6_PLATFORMS_SRCDIR=""
13675 ENABLE_QT6_MULTIMEDIA=""
13676 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13677         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13678 then
13679     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13680     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13682     if test -n "$supports_multilib"; then
13683         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13684     fi
13686     qt6_test_include="QtWidgets/qapplication.h"
13687     if test "$_os" = "Emscripten"; then
13688         qt6_test_library="libQt6Widgets.a"
13689     else
13690         qt6_test_library="libQt6Widgets.so"
13691     fi
13693     dnl Check for qmake6
13694     if test -n "$QT6DIR"; then
13695         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13696     else
13697         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13698     fi
13699     if test "$QMAKE6" = "no"; then
13700         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13701     else
13702         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13703         if test -z "$qmake6_test_ver"; then
13704             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13705         fi
13706         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13707     fi
13709     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13710     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13711     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13712     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13714     AC_MSG_CHECKING([for Qt6 headers])
13715     qt6_incdir="no"
13716     for inc_dir in $qt6_incdirs; do
13717         if test -r "$inc_dir/$qt6_test_include"; then
13718             qt6_incdir="$inc_dir"
13719             break
13720         fi
13721     done
13722     AC_MSG_RESULT([$qt6_incdir])
13723     if test "x$qt6_incdir" = "xno"; then
13724         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13725     fi
13726     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13727     AC_LANG_PUSH([C++])
13728     save_CPPFLAGS=$CPPFLAGS
13729     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13730     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13731         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13732     CPPFLAGS=$save_CPPFLAGS
13733     AC_LANG_POP([C++])
13735     AC_MSG_CHECKING([for Qt6 libraries])
13736     qt6_libdir="no"
13737     for lib_dir in $qt6_libdirs; do
13738         if test -r "$lib_dir/$qt6_test_library"; then
13739             qt6_libdir="$lib_dir"
13740             break
13741         fi
13742     done
13743     AC_MSG_RESULT([$qt6_libdir])
13744     if test "x$qt6_libdir" = "xno"; then
13745         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13746     fi
13748     if test "$_os" = "Emscripten"; then
13749         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13750             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13751         fi
13752         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13753             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13754         fi
13755     fi
13757     QT6_CFLAGS="-I$qt6_incdir -DQT_NO_VERSION_TAGGING"
13758     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13759     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13760     if test "$_os" = "Emscripten"; then
13761         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13762     else
13763         if ! test "$enable_qt6_multimedia" = "no"; then
13764             if ! test -r "$qt6_incdir/QtMultimediaWidgets/QVideoWidget"; then
13765                 AC_MSG_ERROR([Qt 6 QMultimedia not found.])
13766                 break
13767             fi
13768             ENABLE_QT6_MULTIMEDIA=TRUE
13769             QT6_LIBS="$QT6_LIBS -lQt6Multimedia -lQt6MultimediaWidgets"
13770         fi
13771     fi
13773     if test "$USING_X11" = TRUE; then
13774         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13775         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13776         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13777         QT6_USING_X11=1
13778         AC_DEFINE(QT6_USING_X11)
13779     fi
13781     dnl Check for Meta Object Compiler
13783     for lib_dir in $qt6_libdirs; do
13784         if test -z "$qt6_libexec_dirs"; then
13785             qt6_libexec_dirs="$lib_dir/libexec"
13786         else
13787             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13788         fi
13789     done
13790     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$qt6_libexec_dirs:`echo $qt6_libdirs | $SED -e 's/ /:/g'`:$PATH])
13791     if test "$MOC6" = "no"; then
13792         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13793 the root of your Qt installation by exporting QT6DIR before running "configure".])
13794     else
13795         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13796         if test -z "$moc6_test_ver"; then
13797             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13798         fi
13799         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13800     fi
13802 AC_SUBST(QT6_CFLAGS)
13803 AC_SUBST(QT6_LIBS)
13804 AC_SUBST(MOC6)
13805 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13806 AC_SUBST(ENABLE_QT6_MULTIMEDIA)
13808 dnl ===================================================================
13809 dnl KF5 Integration
13810 dnl ===================================================================
13812 KF5_CFLAGS=""
13813 KF5_LIBS=""
13814 KF5_CONFIG="kf5-config"
13815 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13816         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13817 then
13818     if test "$OS" = "HAIKU"; then
13819         haiku_arch="`echo $RTL_ARCH | tr X x`"
13820         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13821         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13822     fi
13824     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13825     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13826     if test -n "$supports_multilib"; then
13827         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13828     fi
13830     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13831     kf5_test_library="libKF5KIOFileWidgets.so"
13832     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13834     dnl kf5 KDE4 support compatibility installed
13835     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13836     if test "$KF5_CONFIG" != "no"; then
13837         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13838         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13839     fi
13841     dnl Check for KF5 headers
13842     AC_MSG_CHECKING([for KF5 headers])
13843     kf5_incdir="no"
13844     for kf5_check in $kf5_incdirs; do
13845         if test -r "$kf5_check/$kf5_test_include"; then
13846             kf5_incdir="$kf5_check/KF5"
13847             break
13848         fi
13849     done
13850     AC_MSG_RESULT([$kf5_incdir])
13851     if test "x$kf5_incdir" = "xno"; then
13852         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13853     fi
13855     dnl Check for KF5 libraries
13856     AC_MSG_CHECKING([for KF5 libraries])
13857     kf5_libdir="no"
13858     for kf5_check in $kf5_libdirs; do
13859         if test -r "$kf5_check/$kf5_test_library"; then
13860             kf5_libdir="$kf5_check"
13861             break
13862         fi
13863     done
13865     AC_MSG_RESULT([$kf5_libdir])
13866     if test "x$kf5_libdir" = "xno"; then
13867         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13868     fi
13870     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_NO_VERSION_TAGGING"
13871     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13872     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13874     if test "$USING_X11" = TRUE; then
13875         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13876     fi
13878     AC_LANG_PUSH([C++])
13879     save_CXXFLAGS=$CXXFLAGS
13880     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13881     AC_MSG_CHECKING([whether KDE is >= 5.0])
13882        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
13883 #include <kcoreaddons_version.h>
13885 int main(int argc, char **argv) {
13886        static_assert(KCOREADDONS_VERSION_MAJOR == 5);
13887        return 0;
13889        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13890     CXXFLAGS=$save_CXXFLAGS
13891     AC_LANG_POP([C++])
13893 AC_SUBST(KF5_CFLAGS)
13894 AC_SUBST(KF5_LIBS)
13896 dnl ===================================================================
13897 dnl KF6 Integration
13898 dnl ===================================================================
13900 KF6_CFLAGS=""
13901 KF6_LIBS=""
13902 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13903 then
13904     if test "$OS" = "HAIKU"; then
13905         haiku_arch="`echo $RTL_ARCH | tr X x`"
13906         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13907         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13908     fi
13910     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13911     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13912     if test -n "$supports_multilib"; then
13913         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13914     fi
13916     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13917     kf6_test_library="libKF6KIOFileWidgets.so"
13918     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13920     dnl Check for KF6 headers
13921     AC_MSG_CHECKING([for KF6 headers])
13922     kf6_incdir="no"
13923     for kf6_check in $kf6_incdirs; do
13924         if test -r "$kf6_check/$kf6_test_include"; then
13925             kf6_incdir="$kf6_check/KF6"
13926             break
13927         fi
13928     done
13929     AC_MSG_RESULT([$kf6_incdir])
13930     if test "x$kf6_incdir" = "xno"; then
13931         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13932     fi
13934     dnl Check for KF6 libraries
13935     AC_MSG_CHECKING([for KF6 libraries])
13936     kf6_libdir="no"
13937     for kf6_check in $kf6_libdirs; do
13938         if test -r "$kf6_check/$kf6_test_library"; then
13939             kf6_libdir="$kf6_check"
13940             break
13941         fi
13942     done
13944     AC_MSG_RESULT([$kf6_libdir])
13945     if test "x$kf6_libdir" = "xno"; then
13946         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13947     fi
13949     KF6_CFLAGS="-I$kf6_incdir -I$kf6_incdir/KCoreAddons -I$kf6_incdir/KI18n -I$kf6_incdir/KConfig -I$kf6_incdir/KConfigCore -I$kf6_incdir/KWindowSystem -I$kf6_incdir/KIO -I$kf6_incdir/KIOCore -I$kf6_incdir/KIOWidgets -I$kf6_incdir/KIOFileWidgets -I$qt6_incdir -I$qt6_incdir/QtCore -I$qt6_incdir/QtGui -I$qt6_incdir/QtWidgets -I$qt6_incdir/QtNetwork -DQT_NO_VERSION_TAGGING"
13950     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13951     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13953     AC_LANG_PUSH([C++])
13954     save_CXXFLAGS=$CXXFLAGS
13955     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13956     dnl KF6 development version as of 2023-06 uses version number 5.240
13957     AC_MSG_CHECKING([whether KDE Frameworks version is >= 6.0])
13958        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
13959 #include <kcoreaddons_version.h>
13961 int main(int argc, char **argv) {
13962        static_assert(KCOREADDONS_VERSION_MAJOR == 6);
13963        return 0;
13965        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13966     CXXFLAGS=$save_CXXFLAGS
13967     AC_LANG_POP([C++])
13969 AC_SUBST(KF6_CFLAGS)
13970 AC_SUBST(KF6_LIBS)
13972 if test "$enable_qt6_multimedia" = "yes" -a "$ENABLE_QT6" != "TRUE"; then
13973     AC_MSG_ERROR([--enable-qt6-multimedia requires --enable-qt6 or --enable-kf6])
13976 dnl ===================================================================
13977 dnl Test whether to include Evolution 2 support
13978 dnl ===================================================================
13979 AC_MSG_CHECKING([whether to enable evolution 2 support])
13980 if test "$enable_evolution2" = yes; then
13981     AC_MSG_RESULT([yes])
13982     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13983     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13984     FilterLibs "${GOBJECT_LIBS}"
13985     GOBJECT_LIBS="${filteredlibs}"
13986     ENABLE_EVOAB2="TRUE"
13987 else
13988     AC_MSG_RESULT([no])
13990 AC_SUBST(ENABLE_EVOAB2)
13991 AC_SUBST(GOBJECT_CFLAGS)
13992 AC_SUBST(GOBJECT_LIBS)
13994 dnl ===================================================================
13995 dnl Test which themes to include
13996 dnl ===================================================================
13997 AC_MSG_CHECKING([which themes to include])
13998 # if none given use default subset of available themes
13999 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
14000     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg colibre_dark colibre_dark_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_dark sukapura_dark_svg sukapura_svg"
14003 WITH_THEMES=""
14004 if test "x$with_theme" != "xno"; then
14005     for theme in $with_theme; do
14006         case $theme in
14007         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|colibre_dark|colibre_dark_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_dark|sukapura_dark_svg|sukapura_svg) WITH_THEMES="${WITH_THEMES:+$WITH_THEMES }$theme" ;;
14008         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
14009         esac
14010     done
14012 AC_MSG_RESULT([$WITH_THEMES])
14013 AC_SUBST([WITH_THEMES])
14015 ###############################################################################
14016 # Extensions checking
14017 ###############################################################################
14018 AC_MSG_CHECKING([for extensions integration])
14019 if test "x$enable_extension_integration" != "xno"; then
14020     WITH_EXTENSION_INTEGRATION=TRUE
14021     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
14022     AC_MSG_RESULT([yes, use integration])
14023 else
14024     WITH_EXTENSION_INTEGRATION=
14025     AC_MSG_RESULT([no, do not integrate])
14027 AC_SUBST(WITH_EXTENSION_INTEGRATION)
14029 dnl Should any extra extensions be included?
14030 dnl There are standalone tests for each of these below.
14031 WITH_EXTRA_EXTENSIONS=
14032 AC_SUBST([WITH_EXTRA_EXTENSIONS])
14034 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
14035 if test "x$with_java" != "xno"; then
14036     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
14039 AC_MSG_CHECKING([whether to build opens___.ttf])
14040 if test "$enable_build_opensymbol" = "yes"; then
14041     AC_MSG_RESULT([yes])
14042     AC_PATH_PROG(FONTFORGE, fontforge)
14043     if test -z "$FONTFORGE"; then
14044         AC_MSG_ERROR([fontforge not installed])
14045     fi
14046 else
14047     AC_MSG_RESULT([no])
14048     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
14050 AC_SUBST(FONTFORGE)
14052 dnl ===================================================================
14053 dnl Test whether to include fonts
14054 dnl ===================================================================
14055 WITH_FONTS=
14056 WITH_DOCREPAIR_FONTS=
14057 AC_MSG_CHECKING([whether to include third-party fonts])
14058 if test "$with_fonts" != "no"; then
14059     AC_MSG_RESULT([yes])
14060     WITH_FONTS=TRUE
14061     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
14062     AC_DEFINE(HAVE_MORE_FONTS)
14063     AC_MSG_CHECKING([whether to include 'docrepair' fonts])
14064     if test "$with_docrepair_fonts" = "yes"; then
14065         AC_MSG_RESULT([yes])
14066         WITH_DOCREPAIR_FONTS=TRUE
14067     fi
14068 else
14069     AC_MSG_RESULT([no])
14070     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
14072 AC_SUBST(WITH_FONTS)
14073 AC_SUBST(WITH_DOCREPAIR_FONTS)
14075 dnl ===================================================================
14076 dnl Test whether to enable online update service
14077 dnl ===================================================================
14078 AC_MSG_CHECKING([whether to enable online update])
14079 ENABLE_ONLINE_UPDATE=
14080 if test "$enable_online_update" = ""; then
14081     AC_MSG_RESULT([no])
14082 else
14083     if test "$enable_online_update" = "mar"; then
14084         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
14085     elif test "$enable_online_update" = "yes"; then
14086         if test "$enable_curl" != "yes"; then
14087             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
14088         fi
14089         AC_MSG_RESULT([yes])
14090         ENABLE_ONLINE_UPDATE="TRUE"
14091     else
14092         AC_MSG_RESULT([no])
14093     fi
14095 AC_SUBST(ENABLE_ONLINE_UPDATE)
14098 dnl ===================================================================
14099 dnl Test whether to enable mar online update service
14100 dnl ===================================================================
14101 AC_MSG_CHECKING([whether to enable mar online update])
14102 ENABLE_ONLINE_UPDATE_MAR=
14103 if test "$enable_online_update_mar" = yes; then
14104     AC_MSG_RESULT([yes])
14105     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
14106     ENABLE_ONLINE_UPDATE_MAR="TRUE"
14107     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
14108 else
14109     AC_MSG_RESULT([no])
14111 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
14113 AC_MSG_CHECKING([for mar online update baseurl])
14114 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
14115 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
14116     AC_MSG_RESULT([yes])
14117 else
14118     AC_MSG_RESULT([no])
14120 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
14122 AC_MSG_CHECKING([for mar online update certificateder])
14123 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
14124 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
14125     AC_MSG_RESULT([yes])
14126 else
14127     AC_MSG_RESULT([no])
14129 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
14131 AC_MSG_CHECKING([for mar online update certificatename])
14132 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
14133 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
14134     AC_MSG_RESULT([yes])
14135 else
14136     AC_MSG_RESULT([no])
14138 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
14140 AC_MSG_CHECKING([for mar online update certificatepath])
14141 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
14142 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
14143     AC_MSG_RESULT([yes])
14144 else
14145     AC_MSG_RESULT([no])
14147 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
14150 PRIVACY_POLICY_URL="$with_privacy_policy_url"
14151 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
14152     if test "x$with_privacy_policy_url" = "xundefined"; then
14153         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
14154     fi
14156 AC_SUBST(PRIVACY_POLICY_URL)
14157 dnl ===================================================================
14158 dnl Test whether we need bzip2
14159 dnl ===================================================================
14160 SYSTEM_BZIP2=
14161 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
14162     AC_MSG_CHECKING([whether to use system bzip2])
14163     if test "$with_system_bzip2" = yes; then
14164         SYSTEM_BZIP2=TRUE
14165         AC_MSG_RESULT([yes])
14166         PKG_CHECK_MODULES(BZIP2, bzip2)
14167         FilterLibs "${BZIP2_LIBS}"
14168         BZIP2_LIBS="${filteredlibs}"
14169     else
14170         AC_MSG_RESULT([no])
14171         BUILD_TYPE="$BUILD_TYPE BZIP2"
14172     fi
14174 AC_SUBST(SYSTEM_BZIP2)
14175 AC_SUBST(BZIP2_CFLAGS)
14176 AC_SUBST(BZIP2_LIBS)
14178 dnl ===================================================================
14179 dnl Test whether to enable extension update
14180 dnl ===================================================================
14181 AC_MSG_CHECKING([whether to enable extension update])
14182 ENABLE_EXTENSION_UPDATE=
14183 if test "x$enable_extension_update" = "xno"; then
14184     AC_MSG_RESULT([no])
14185 else
14186     AC_MSG_RESULT([yes])
14187     ENABLE_EXTENSION_UPDATE="TRUE"
14188     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
14189     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
14191 AC_SUBST(ENABLE_EXTENSION_UPDATE)
14194 dnl ===================================================================
14195 dnl Test whether to create MSI with LIMITUI=1 (silent install)
14196 dnl ===================================================================
14197 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
14198 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
14199     AC_MSG_RESULT([no])
14200     ENABLE_SILENT_MSI=
14201 else
14202     AC_MSG_RESULT([yes])
14203     ENABLE_SILENT_MSI=TRUE
14204     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
14206 AC_SUBST(ENABLE_SILENT_MSI)
14208 dnl ===================================================================
14209 dnl Check for WiX tools.
14210 dnl ===================================================================
14211 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
14212     AC_MSG_RESULT([no])
14213     ENABLE_WIX=
14214 else
14215     AC_MSG_RESULT([yes])
14216     # FIXME: this should do proper detection, but the path is currently
14217     # hardcoded in msicreator/createmsi.py
14218     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
14219       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
14220     fi
14221     ENABLE_WIX=TRUE
14223 AC_SUBST(ENABLE_WIX)
14225 AC_MSG_CHECKING([whether and how to use Xinerama])
14226 if test "$USING_X11" = TRUE; then
14227     if test "$x_libraries" = "default_x_libraries"; then
14228         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
14229         if test "x$XINERAMALIB" = x; then
14230            XINERAMALIB="/usr/lib"
14231         fi
14232     else
14233         XINERAMALIB="$x_libraries"
14234     fi
14235     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
14236         # we have both versions, let the user decide but use the dynamic one
14237         # per default
14238         USE_XINERAMA=TRUE
14239         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
14240             XINERAMA_LINK=dynamic
14241         else
14242             XINERAMA_LINK=static
14243         fi
14244     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
14245         # we have only the dynamic version
14246         USE_XINERAMA=TRUE
14247         XINERAMA_LINK=dynamic
14248     elif test -e "$XINERAMALIB/libXinerama.a"; then
14249         # static version
14250         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
14251             USE_XINERAMA=TRUE
14252             XINERAMA_LINK=static
14253         else
14254             USE_XINERAMA=
14255             XINERAMA_LINK=none
14256         fi
14257     else
14258         # no Xinerama
14259         USE_XINERAMA=
14260         XINERAMA_LINK=none
14261     fi
14262     if test "$USE_XINERAMA" = "TRUE"; then
14263         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
14264         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
14265             [AC_MSG_ERROR(Xinerama header not found.)], [])
14266         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
14267         if test "x$XEXTLIB" = x; then
14268            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
14269         fi
14270         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
14271         if test "$_os" = "FreeBSD"; then
14272             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
14273         fi
14274         if test "$_os" = "Linux"; then
14275             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
14276         fi
14277         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
14278             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
14279     else
14280         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
14281     fi
14282 else
14283     USE_XINERAMA=
14284     XINERAMA_LINK=none
14285     AC_MSG_RESULT([no])
14287 AC_SUBST(XINERAMA_LINK)
14289 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14290 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14291     enable_cairo_rgba=yes
14293 if test "$enable_cairo_rgba" = yes; then
14294     AC_DEFINE(ENABLE_CAIRO_RGBA)
14295     ENABLE_CAIRO_RGBA=TRUE
14296     AC_MSG_RESULT([yes])
14297 else
14298     ENABLE_CAIRO_RGBA=
14299     AC_MSG_RESULT([no])
14301 AC_SUBST(ENABLE_CAIRO_RGBA)
14303 dnl ===================================================================
14304 dnl Test whether to build cairo or rely on the system version
14305 dnl ===================================================================
14307 if test "$test_cairo" = "yes"; then
14308     AC_MSG_CHECKING([whether to use the system cairo])
14310     : ${with_system_cairo:=$with_system_libs}
14311     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14312         SYSTEM_CAIRO=TRUE
14313         AC_MSG_RESULT([yes])
14315         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14316         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14317         FilterLibs "${CAIRO_LIBS}"
14318         CAIRO_LIBS="${filteredlibs}"
14320         if test "$test_xrender" = "yes"; then
14321             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14322             AC_LANG_PUSH([C])
14323             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14324 #ifdef PictStandardA8
14325 #else
14326       return fail;
14327 #endif
14328 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14330             AC_LANG_POP([C])
14331         fi
14332     else
14333         AC_MSG_RESULT([no])
14334         BUILD_TYPE="$BUILD_TYPE CAIRO"
14335     fi
14337     if test "$enable_cairo_canvas" != no; then
14338         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14339         ENABLE_CAIRO_CANVAS=TRUE
14340     fi
14343 AC_SUBST(CAIRO_CFLAGS)
14344 AC_SUBST(CAIRO_LIBS)
14345 AC_SUBST(ENABLE_CAIRO_CANVAS)
14346 AC_SUBST(SYSTEM_CAIRO)
14348 dnl ===================================================================
14349 dnl Test whether to use avahi
14350 dnl ===================================================================
14351 if test "$_os" = "WINNT"; then
14352     # Windows uses bundled mDNSResponder
14353     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14354 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14355     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14356                       [ENABLE_AVAHI="TRUE"])
14357     AC_DEFINE(HAVE_FEATURE_AVAHI)
14358     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14359     FilterLibs "${AVAHI_LIBS}"
14360     AVAHI_LIBS="${filteredlibs}"
14363 AC_SUBST(ENABLE_AVAHI)
14364 AC_SUBST(AVAHI_CFLAGS)
14365 AC_SUBST(AVAHI_LIBS)
14367 dnl ===================================================================
14368 dnl Test whether to use MSVC /analyze
14369 dnl ===================================================================
14370 ENABLE_MSVC_ANALYZE=
14371 AC_MSG_CHECKING([whether to use MSVC /analyze])
14372 if test -n "$enable_msvc_analyze" -a "$enable_msvc_analyze" != "no"; then
14373 if test "$_os" = "WINNT"; then
14374     ENABLE_MSVC_ANALYZE=Yes
14375     AC_MSG_RESULT([yes])
14376 else
14377    AC_MSG_ERROR([--enable-msvc-analyze is only supported on Windows])
14379 else
14380    AC_MSG_RESULT([no])
14383 AC_SUBST(ENABLE_MSVC_ANALYZE)
14385 dnl ===================================================================
14386 dnl Test whether to use liblangtag
14387 dnl ===================================================================
14388 SYSTEM_LIBLANGTAG=
14389 AC_MSG_CHECKING([whether to use system liblangtag])
14390 if test "$with_system_liblangtag" = yes; then
14391     SYSTEM_LIBLANGTAG=TRUE
14392     AC_MSG_RESULT([yes])
14393     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14394     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14395     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14396     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14397     FilterLibs "${LIBLANGTAG_LIBS}"
14398     LIBLANGTAG_LIBS="${filteredlibs}"
14399 else
14400     SYSTEM_LIBLANGTAG=
14401     AC_MSG_RESULT([no])
14402     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14403     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14404     if test "$COM" = "MSC"; then
14405         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14406     else
14407         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14408     fi
14410 AC_SUBST(SYSTEM_LIBLANGTAG)
14411 AC_SUBST(LIBLANGTAG_CFLAGS)
14412 AC_SUBST(LIBLANGTAG_LIBS)
14414 dnl ===================================================================
14415 dnl Test whether to build libpng or rely on the system version
14416 dnl ===================================================================
14418 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14419 LIBPNG_LIBS_internal='-L$(gb_StaticLibrary_WORKDIR) -llibpng'
14420 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14422 dnl ===================================================================
14423 dnl Test whether to build libtiff or rely on the system version
14424 dnl ===================================================================
14426 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14428 dnl ===================================================================
14429 dnl Test whether to build libwebp or rely on the system version
14430 dnl ===================================================================
14432 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14434 dnl ===================================================================
14435 dnl Check for runtime JVM search path
14436 dnl ===================================================================
14437 if test "$ENABLE_JAVA" != ""; then
14438     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14439     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14440         AC_MSG_RESULT([yes])
14441         if ! test -d "$with_jvm_path"; then
14442             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14443         fi
14444         if ! test -d "$with_jvm_path"jvm; then
14445             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14446         fi
14447         JVM_ONE_PATH_CHECK="$with_jvm_path"
14448         AC_SUBST(JVM_ONE_PATH_CHECK)
14449     else
14450         AC_MSG_RESULT([no])
14451     fi
14454 dnl ===================================================================
14455 dnl Test for the presence of Ant and that it works
14456 dnl ===================================================================
14458 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14459 # breaks filename decoding, so for the ant section, set it to LANG
14460 LC_ALL=$LANG
14461 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14462     ANT_HOME=; export ANT_HOME
14463     WITH_ANT_HOME=; export WITH_ANT_HOME
14464     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14465         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14466             if test "$_os" = "WINNT"; then
14467                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14468             else
14469                 with_ant_home="$LODE_HOME/opt/ant"
14470             fi
14471         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14472             with_ant_home="$LODE_HOME/opt/ant"
14473         fi
14474     fi
14475     if test -z "$with_ant_home"; then
14476         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14477     else
14478         if test "$_os" = "WINNT"; then
14479             # AC_PATH_PROGS needs unix path
14480             PathFormat "$with_ant_home"
14481             with_ant_home="$formatted_path_unix"
14482         fi
14483         AbsolutePath "$with_ant_home"
14484         with_ant_home=$absolute_path
14485         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14486         WITH_ANT_HOME=$with_ant_home
14487         ANT_HOME=$with_ant_home
14488     fi
14490     if test -z "$ANT"; then
14491         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14492     else
14493         # resolve relative or absolute symlink
14494         while test -h "$ANT"; do
14495             a_cwd=`pwd`
14496             a_basename=`basename "$ANT"`
14497             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14498             cd "`dirname "$ANT"`"
14499             cd "`dirname "$a_script"`"
14500             ANT="`pwd`"/"`basename "$a_script"`"
14501             cd "$a_cwd"
14502         done
14504         AC_MSG_CHECKING([if $ANT works])
14505         mkdir -p conftest.dir
14506         a_cwd=$(pwd)
14507         cd conftest.dir
14508         cat > conftest.java << EOF
14509         public class conftest {
14510             int testmethod(int a, int b) {
14511                     return a + b;
14512             }
14513         }
14516         cat > conftest.xml << EOF
14517         <project name="conftest" default="conftest">
14518         <target name="conftest">
14519             <javac srcdir="." includes="conftest.java">
14520             </javac>
14521         </target>
14522         </project>
14525         if test -n "$WSL_ONLY_AS_HELPER"; then
14526             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14527             export JAVACMD="$JAVAINTERPRETER"
14528             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14529             # building the classpath, but we need the windows-style one for the windows-java
14530             PathFormat "$ANT_HOME"
14531             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14532         fi
14533         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14534         if test $? = 0 -a -f ./conftest.class; then
14535             AC_MSG_RESULT([Ant works])
14536             if test -z "$WITH_ANT_HOME"; then
14537                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14538                 if test -z "$ANT_HOME"; then
14539                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14540                 fi
14541             else
14542                 ANT_HOME="$WITH_ANT_HOME"
14543             fi
14544         else
14545             echo "configure: Ant test failed" >&5
14546             cat conftest.java >&5
14547             cat conftest.xml >&5
14548             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14549         fi
14550         cd "$a_cwd"
14551         rm -fr conftest.dir
14552     fi
14553     if test -z "$ANT_HOME"; then
14554         ANT_HOME="NO_ANT_HOME"
14555     else
14556         PathFormat "$ANT_HOME"
14557         ANT_HOME="$formatted_path_unix"
14558         PathFormat "$ANT"
14559         ANT="$formatted_path_unix"
14560     fi
14562     dnl Checking for ant.jar
14563     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14564         AC_MSG_CHECKING([Ant lib directory])
14565         if test -f $ANT_HOME/lib/ant.jar; then
14566             ANT_LIB="$ANT_HOME/lib"
14567         else
14568             if test -f $ANT_HOME/ant.jar; then
14569                 ANT_LIB="$ANT_HOME"
14570             else
14571                 if test -f /usr/share/java/ant.jar; then
14572                     ANT_LIB=/usr/share/java
14573                 else
14574                     if test -f /usr/share/ant-core/lib/ant.jar; then
14575                         ANT_LIB=/usr/share/ant-core/lib
14576                     else
14577                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14578                             ANT_LIB="$ANT_HOME/lib/ant"
14579                         else
14580                             if test -f /usr/share/lib/ant/ant.jar; then
14581                                 ANT_LIB=/usr/share/lib/ant
14582                             else
14583                                 AC_MSG_ERROR([Ant libraries not found!])
14584                             fi
14585                         fi
14586                     fi
14587                 fi
14588             fi
14589         fi
14590         PathFormat "$ANT_LIB"
14591         ANT_LIB="$formatted_path"
14592         AC_MSG_RESULT([Ant lib directory found.])
14593     fi
14595     ant_minver=1.6.0
14596     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14598     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14599     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14600     ant_version_major=`echo $ant_version | cut -d. -f1`
14601     ant_version_minor=`echo $ant_version | cut -d. -f2`
14602     echo "configure: ant_version $ant_version " >&5
14603     echo "configure: ant_version_major $ant_version_major " >&5
14604     echo "configure: ant_version_minor $ant_version_minor " >&5
14605     if test "$ant_version_major" -ge "2"; then
14606         AC_MSG_RESULT([yes, $ant_version])
14607     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14608         AC_MSG_RESULT([yes, $ant_version])
14609     else
14610         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14611     fi
14613     rm -f conftest* core core.* *.core
14615 AC_SUBST(ANT)
14616 AC_SUBST(ANT_HOME)
14617 AC_SUBST(ANT_LIB)
14619 OOO_JUNIT_JAR=
14620 HAMCREST_JAR=
14621 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14622     AC_MSG_CHECKING([for JUnit 4])
14623     if test "$with_junit" = "yes"; then
14624         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14625             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14626         elif test -e /usr/share/java/junit4.jar; then
14627             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14628         else
14629            if test -e /usr/share/lib/java/junit.jar; then
14630               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14631            else
14632               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14633            fi
14634         fi
14635     else
14636         OOO_JUNIT_JAR=$with_junit
14637     fi
14638     if test "$_os" = "WINNT"; then
14639         PathFormat "$OOO_JUNIT_JAR"
14640         OOO_JUNIT_JAR="$formatted_path"
14641     fi
14642     printf 'import org.junit.Before;' > conftest.java
14643     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14644         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14645     else
14646         AC_MSG_ERROR(
14647 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14648  specify its pathname via --with-junit=..., or disable it via --without-junit])
14649     fi
14650     rm -f conftest.class conftest.java
14651     if test $OOO_JUNIT_JAR != ""; then
14652         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14653     fi
14655     AC_MSG_CHECKING([for included Hamcrest])
14656     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14657     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14658         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14659     else
14660         AC_MSG_RESULT([Not included])
14661         AC_MSG_CHECKING([for standalone hamcrest jar.])
14662         if test "$with_hamcrest" = "yes"; then
14663             if test -e /usr/share/lib/java/hamcrest.jar; then
14664                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14665             elif test -e /usr/share/java/hamcrest/core.jar; then
14666                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14667             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14668                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14669             else
14670                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14671             fi
14672         else
14673             HAMCREST_JAR=$with_hamcrest
14674         fi
14675         if test "$_os" = "WINNT"; then
14676             PathFormat "$HAMCREST_JAR"
14677             HAMCREST_JAR="$formatted_path"
14678         fi
14679         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14680             AC_MSG_RESULT([$HAMCREST_JAR])
14681         else
14682             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),
14683                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14684         fi
14685     fi
14686     rm -f conftest.class conftest.java
14688 AC_SUBST(OOO_JUNIT_JAR)
14689 AC_SUBST(HAMCREST_JAR)
14690 # set back LC_ALL to C after the java related tests...
14691 LC_ALL=C
14693 AC_SUBST(SCPDEFS)
14696 # check for wget and curl
14698 WGET=
14699 CURL=
14701 if test "$enable_fetch_external" != "no"; then
14703 CURL=`command -v curl`
14705 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14706     # wget new enough?
14707     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14708     if test $? -eq 0; then
14709         WGET=$i
14710         break
14711     fi
14712 done
14714 if test -z "$WGET" -a -z "$CURL"; then
14715     AC_MSG_ERROR([neither wget nor curl found!])
14720 AC_SUBST(WGET)
14721 AC_SUBST(CURL)
14724 # check for sha256sum
14726 SHA256SUM=
14728 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14729     eval "$i -a 256 --version" > /dev/null 2>&1
14730     ret=$?
14731     if test $ret -eq 0; then
14732         SHA256SUM="$i -a 256"
14733         break
14734     fi
14735 done
14737 if test -z "$SHA256SUM"; then
14738     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14739         eval "$i --version" > /dev/null 2>&1
14740         ret=$?
14741         if test $ret -eq 0; then
14742             SHA256SUM=$i
14743             break
14744         fi
14745     done
14748 if test -z "$SHA256SUM"; then
14749     AC_MSG_ERROR([no sha256sum found!])
14752 AC_SUBST(SHA256SUM)
14754 dnl ===================================================================
14755 dnl Dealing with l10n options
14756 dnl ===================================================================
14757 AC_MSG_CHECKING([which languages to be built])
14758 # get list of all languages
14759 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14760 # we want en-US at the beginning
14761 ALL_LANGS=$($GNUMAKE SRC_ROOT=$SRC_ROOT WITH_LANG="$with_lang" ENABLE_RELEASE_BUILD="$ENABLE_RELEASE_BUILD" -sr -f - <<'EOF' | tr -d '\r'
14762 include $(SRC_ROOT)/solenv/inc/langlist.mk
14763 all:
14764         $(info en-US $(filter-out en-US,$(sort $(completelangiso))))
14768 # check the configured localizations
14769 WITH_LANG="$with_lang"
14771 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14772 # (Norwegian is "nb" and "nn".)
14773 if test "$WITH_LANG" = "no"; then
14774     WITH_LANG=
14777 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14778     AC_MSG_RESULT([en-US])
14779 else
14780     AC_MSG_RESULT([$WITH_LANG])
14781     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14782     if test -z "$MSGFMT"; then
14783         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14784             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14785         elif test -x "/opt/lo/bin/msgfmt"; then
14786             MSGFMT="/opt/lo/bin/msgfmt"
14787         else
14788             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14789             if test -z "$MSGFMT"; then
14790                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14791             fi
14792         fi
14793     fi
14794     if test -z "$MSGUNIQ"; then
14795         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14796             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14797         elif test -x "/opt/lo/bin/msguniq"; then
14798             MSGUNIQ="/opt/lo/bin/msguniq"
14799         else
14800             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14801             if test -z "$MSGUNIQ"; then
14802                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14803             fi
14804         fi
14805     fi
14807 AC_SUBST(MSGFMT)
14808 AC_SUBST(MSGUNIQ)
14809 # check that the list is valid
14810 for lang in $WITH_LANG; do
14811     test "$lang" = "ALL" && continue
14812     # need to check for the exact string, so add space before and after the list of all languages
14813     for vl in $ALL_LANGS; do
14814         if test "$vl" = "$lang"; then
14815            break
14816         fi
14817     done
14818     if test "$vl" != "$lang"; then
14819         # if you're reading this - you prolly quoted your languages remove the quotes ...
14820         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14821     fi
14822 done
14823 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14824     echo $WITH_LANG | grep -q en-US
14825     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14827 # list with substituted ALL
14828 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14829 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14830 test "$WITH_LANG" = "en-US" && WITH_LANG=
14831 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14832     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14833     ALL_LANGS=`echo $ALL_LANGS qtz`
14835 AC_SUBST(ALL_LANGS)
14836 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14837 AC_SUBST(WITH_LANG)
14838 AC_SUBST(WITH_LANG_LIST)
14839 AC_SUBST(GIT_NEEDED_SUBMODULES)
14841 WITH_POOR_HELP_LOCALIZATIONS=
14842 if test -d "$SRC_ROOT/translations/source"; then
14843     for l in `ls -1 $SRC_ROOT/translations/source`; do
14844         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14845             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14846         fi
14847     done
14849 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14851 if test -n "$with_locales" -a "$with_locales" != ALL; then
14852     WITH_LOCALES="$with_locales"
14854     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14855     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14856     # config_host/config_locales.h.in
14857     for locale in $WITH_LOCALES; do
14858         lang=${locale%_*}
14860         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14862         case $lang in
14863         hi|mr*ne)
14864             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14865             ;;
14866         bg|ru)
14867             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14868             ;;
14869         esac
14870     done
14871 else
14872     AC_DEFINE(WITH_LOCALE_ALL)
14874 AC_SUBST(WITH_LOCALES)
14876 dnl git submodule update --reference
14877 dnl ===================================================================
14878 if test -n "${GIT_REFERENCE_SRC}"; then
14879     for repo in ${GIT_NEEDED_SUBMODULES}; do
14880         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14881             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14882         fi
14883     done
14885 AC_SUBST(GIT_REFERENCE_SRC)
14887 dnl git submodules linked dirs
14888 dnl ===================================================================
14889 if test -n "${GIT_LINK_SRC}"; then
14890     for repo in ${GIT_NEEDED_SUBMODULES}; do
14891         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14892             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14893         fi
14894     done
14896 AC_SUBST(GIT_LINK_SRC)
14898 dnl branding
14899 dnl ===================================================================
14900 AC_MSG_CHECKING([for alternative branding images directory])
14901 # initialize mapped arrays
14902 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14903 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14905 if test -z "$with_branding" -o "$with_branding" = "no"; then
14906     AC_MSG_RESULT([none])
14907     DEFAULT_BRAND_IMAGES="$brand_files"
14908 else
14909     if ! test -d $with_branding ; then
14910         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14911     else
14912         AC_MSG_RESULT([$with_branding])
14913         CUSTOM_BRAND_DIR="$with_branding"
14914         for lfile in $brand_files
14915         do
14916             if ! test -f $with_branding/$lfile ; then
14917                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14918                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14919             else
14920                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14921             fi
14922         done
14923         check_for_progress="yes"
14924     fi
14926 AC_SUBST([BRAND_INTRO_IMAGES])
14927 AC_SUBST([CUSTOM_BRAND_DIR])
14928 AC_SUBST([CUSTOM_BRAND_IMAGES])
14929 AC_SUBST([DEFAULT_BRAND_IMAGES])
14932 AC_MSG_CHECKING([for 'intro' progress settings])
14933 PROGRESSBARCOLOR=
14934 PROGRESSSIZE=
14935 PROGRESSPOSITION=
14936 PROGRESSFRAMECOLOR=
14937 PROGRESSTEXTCOLOR=
14938 PROGRESSTEXTBASELINE=
14940 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14941     source "$with_branding/progress.conf"
14942     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14943 else
14944     AC_MSG_RESULT([none])
14947 AC_SUBST(PROGRESSBARCOLOR)
14948 AC_SUBST(PROGRESSSIZE)
14949 AC_SUBST(PROGRESSPOSITION)
14950 AC_SUBST(PROGRESSFRAMECOLOR)
14951 AC_SUBST(PROGRESSTEXTCOLOR)
14952 AC_SUBST(PROGRESSTEXTBASELINE)
14955 dnl ===================================================================
14956 dnl Custom build version
14957 dnl ===================================================================
14958 AC_MSG_CHECKING([for extra build ID])
14959 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14960     EXTRA_BUILDID="$with_extra_buildid"
14962 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14963 if test -n "$EXTRA_BUILDID" ; then
14964     AC_MSG_RESULT([$EXTRA_BUILDID])
14965 else
14966     AC_MSG_RESULT([not set])
14968 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14970 OOO_VENDOR=
14971 AC_MSG_CHECKING([for vendor])
14972 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14973     OOO_VENDOR="$USERNAME"
14975     if test -z "$OOO_VENDOR"; then
14976         OOO_VENDOR="$USER"
14977     fi
14979     if test -z "$OOO_VENDOR"; then
14980         OOO_VENDOR="`id -u -n`"
14981     fi
14983     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14984 else
14985     OOO_VENDOR="$with_vendor"
14986     AC_MSG_RESULT([$OOO_VENDOR])
14988 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14989 AC_SUBST(OOO_VENDOR)
14991 if test "$_os" = "Android" ; then
14992     ANDROID_PACKAGE_NAME=
14993     AC_MSG_CHECKING([for Android package name])
14994     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14995         if test -n "$ENABLE_DEBUG"; then
14996             # Default to the package name that makes ndk-gdb happy.
14997             ANDROID_PACKAGE_NAME="org.libreoffice"
14998         else
14999             ANDROID_PACKAGE_NAME="org.example.libreoffice"
15000         fi
15002         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
15003     else
15004         ANDROID_PACKAGE_NAME="$with_android_package_name"
15005         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
15006     fi
15007     AC_SUBST(ANDROID_PACKAGE_NAME)
15010 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
15011 if test "$with_compat_oowrappers" = "yes"; then
15012     WITH_COMPAT_OOWRAPPERS=TRUE
15013     AC_MSG_RESULT(yes)
15014 else
15015     WITH_COMPAT_OOWRAPPERS=
15016     AC_MSG_RESULT(no)
15018 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
15020 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
15021 AC_MSG_CHECKING([for install dirname])
15022 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
15023     INSTALLDIRNAME="$with_install_dirname"
15025 AC_MSG_RESULT([$INSTALLDIRNAME])
15026 AC_SUBST(INSTALLDIRNAME)
15028 AC_MSG_CHECKING([for prefix])
15029 test "x$prefix" = xNONE && prefix=$ac_default_prefix
15030 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
15031 PREFIXDIR="$prefix"
15032 AC_MSG_RESULT([$PREFIXDIR])
15033 AC_SUBST(PREFIXDIR)
15035 LIBDIR=[$(eval echo $(eval echo $libdir))]
15036 AC_SUBST(LIBDIR)
15038 DATADIR=[$(eval echo $(eval echo $datadir))]
15039 AC_SUBST(DATADIR)
15041 MANDIR=[$(eval echo $(eval echo $mandir))]
15042 AC_SUBST(MANDIR)
15044 DOCDIR=[$(eval echo $(eval echo $docdir))]
15045 AC_SUBST(DOCDIR)
15047 BINDIR=[$(eval echo $(eval echo $bindir))]
15048 AC_SUBST(BINDIR)
15050 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
15051 AC_SUBST(INSTALLDIR)
15053 TESTINSTALLDIR="${BUILDDIR}/test-install"
15054 AC_SUBST(TESTINSTALLDIR)
15057 # ===================================================================
15058 # OAuth2 id and secrets
15059 # ===================================================================
15061 AC_MSG_CHECKING([for Google Drive client id and secret])
15062 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
15063     AC_MSG_RESULT([not set])
15064     GDRIVE_CLIENT_ID="\"\""
15065     GDRIVE_CLIENT_SECRET="\"\""
15066 else
15067     AC_MSG_RESULT([set])
15068     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
15069     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
15071 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
15072 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
15074 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
15075 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
15076     AC_MSG_RESULT([not set])
15077     ALFRESCO_CLOUD_CLIENT_ID="\"\""
15078     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
15079 else
15080     AC_MSG_RESULT([set])
15081     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
15082     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
15084 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
15085 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
15087 AC_MSG_CHECKING([for OneDrive client id and secret])
15088 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
15089     AC_MSG_RESULT([not set])
15090     ONEDRIVE_CLIENT_ID="\"\""
15091     ONEDRIVE_CLIENT_SECRET="\"\""
15092 else
15093     AC_MSG_RESULT([set])
15094     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
15095     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
15097 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
15098 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
15101 dnl ===================================================================
15102 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
15103 dnl --enable-dependency-tracking configure option
15104 dnl ===================================================================
15105 AC_MSG_CHECKING([whether to enable dependency tracking])
15106 if test "$enable_dependency_tracking" = "no"; then
15107     nodep=TRUE
15108     AC_MSG_RESULT([no])
15109 else
15110     AC_MSG_RESULT([yes])
15112 AC_SUBST(nodep)
15114 dnl ===================================================================
15115 dnl Number of CPUs to use during the build
15116 dnl ===================================================================
15117 AC_MSG_CHECKING([for number of processors to use])
15118 # plain --with-parallelism is just the default
15119 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
15120     if test "$with_parallelism" = "no"; then
15121         PARALLELISM=0
15122     else
15123         PARALLELISM=$with_parallelism
15124     fi
15125 else
15126     if test "$enable_icecream" = "yes"; then
15127         PARALLELISM="40"
15128     else
15129         case `uname -s` in
15131         Darwin|FreeBSD|NetBSD|OpenBSD)
15132             PARALLELISM=`sysctl -n hw.ncpu`
15133             ;;
15135         Linux)
15136             PARALLELISM=`getconf _NPROCESSORS_ONLN`
15137         ;;
15138         # what else than above does profit here *and* has /proc?
15139         *)
15140             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
15141             ;;
15142         esac
15144         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
15145         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
15146     fi
15149 if test $PARALLELISM -eq 0; then
15150     AC_MSG_RESULT([explicit make -j option needed])
15151 else
15152     AC_MSG_RESULT([$PARALLELISM])
15154 AC_SUBST(PARALLELISM)
15157 # Set up ILIB for MSVC build
15159 ILIB1=
15160 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
15161     ILIB="."
15162     if test -n "$JAVA_HOME"; then
15163         ILIB="$ILIB;$JAVA_HOME/lib"
15164     fi
15165     ILIB1=-link
15166     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
15167     ILIB="$ILIB;$formatted_path"
15168     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
15169     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
15170     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
15171     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
15172         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
15173         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
15174     fi
15175     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
15176     ucrtlibpath_formatted=$formatted_path
15177     ILIB="$ILIB;$ucrtlibpath_formatted"
15178     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
15179     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
15180         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
15181         ILIB="$ILIB;$formatted_path"
15182     else
15183         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
15184         ILIB="$ILIB;$formatted_path"
15185     fi
15187     if test "$cross_compiling" != "yes"; then
15188         ILIB_FOR_BUILD="$ILIB"
15189     fi
15191 AC_SUBST(ILIB)
15192 AC_SUBST(ILIB_FOR_BUILD)
15194 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
15195 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
15196 dnl from consteval constructor initializing const variable",
15197 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
15198 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
15199 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
15200 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
15201 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
15202 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
15203 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
15204 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
15205 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
15206 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
15207 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
15208 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
15209 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
15210 have_cpp_consteval=
15211 AC_LANG_PUSH([C++])
15212 save_CXX=$CXX
15213 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15214     CXX="env LIB=$ILIB $CXX"
15216 save_CXXFLAGS=$CXXFLAGS
15217 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15218 AC_RUN_IFELSE([AC_LANG_PROGRAM([
15219         struct S {
15220             consteval S() { i = 1; }
15221             int i = 0;
15222         };
15223         S const s;
15225         struct S1 {
15226              int a;
15227              consteval S1(int n): a(n) {}
15228         };
15229         struct S2 {
15230             S1 x;
15231             S2(): x(0) {}
15232         };
15234         struct S3 {
15235             consteval S3() {}
15236             union {
15237                 int a;
15238                 unsigned b = 0;
15239             };
15240         };
15241         void f() { S3(); }
15243         struct S4 { consteval S4() = default; };
15244         void f4(bool b) { b ? S4() : S4(); }
15246         struct S5 {
15247             consteval S5() { c = 0; }
15248             char * f() { return &c; }
15249             union {
15250                 char c;
15251                 int i;
15252             };
15253         };
15254         auto s5 = S5().f();
15256         struct S6 {
15257             consteval S6(char const (&lit)[[2]]) {
15258                 buf[[0]] = lit[[0]];
15259                 buf[[1]] = lit[[1]];
15260             }
15261             union {
15262                 int x;
15263                 char buf[[2]];
15264             };
15265         };
15266         void f6() { S6("a"); }
15267     ], [
15268         return (s.i == 1) ? 0 : 1;
15269     ])], [
15270         have_cpp_consteval=1
15271         AC_MSG_RESULT([yes])
15272     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
15273 CXX=$save_CXX
15274 CXXFLAGS=$save_CXXFLAGS
15275 AC_LANG_POP([C++])
15276 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
15277 then
15278     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
15279     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
15280     dnl reference to consteval constructor exported from module" (which also affects PCH, see
15281     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
15282     dnl --enable-pch setup is known broken"):
15283     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
15284     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
15285     rm conftest.cppm
15286     AC_LANG_PUSH([C++])
15287     save_CXXFLAGS=$CXXFLAGS
15288     save_LDFLAGS=$LDFLAGS
15289     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15290     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
15291     AC_LINK_IFELSE([AC_LANG_PROGRAM([
15292         import M;
15293     ], [
15294         struct S2 { S1 s = 0; };
15295         S2 s;
15296     ])], [
15297         AC_MSG_RESULT([yes])
15298     ], [
15299         have_cpp_consteval=
15300         AC_MSG_RESULT([no])])
15301     CXXFLAGS=$save_CXXFLAGS
15302     LDFLAGS=$save_LDFLAGS
15303     AC_LANG_POP([C++])
15304     rm conftest.pcm
15306 if test -n "$have_cpp_consteval"; then
15307     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15310 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15311 dnl ...which is known to not be implemented in libc++ prior to
15312 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15313 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15314 AC_LANG_PUSH([C++])
15315 save_CXX=$CXX
15316 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15317     CXX="env LIB=$ILIB $CXX"
15319 save_CXXFLAGS=$CXXFLAGS
15320 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15321 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15322         #include <compare>
15323     ], [
15324         (void) (std::strong_order(1.0, 2.0) < 0);
15325     ])], [
15326         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15327         AC_MSG_RESULT([yes])
15328     ], [AC_MSG_RESULT([no])])
15329 CXX=$save_CXX
15330 CXXFLAGS=$save_CXXFLAGS
15331 AC_LANG_POP([C++])
15333 # ===================================================================
15334 # Creating bigger shared library to link against
15335 # ===================================================================
15336 AC_MSG_CHECKING([whether to create huge library])
15337 MERGELIBS=
15338 MERGELIBS_MORE=
15340 if test $_os = iOS -o $_os = Android; then
15341     # Never any point in mergelibs for these as we build just static
15342     # libraries anyway...
15343     enable_mergelibs=no
15346 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15347     if test "$enable_mergelibs" = "more"; then
15348         MERGELIBS="TRUE"
15349         MERGELIBS_MORE="TRUE"
15350         AC_MSG_RESULT([yes (more)])
15351         AC_DEFINE(ENABLE_MERGELIBS)
15352         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15353     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15354         MERGELIBS="TRUE"
15355         AC_MSG_RESULT([yes])
15356         AC_DEFINE(ENABLE_MERGELIBS)
15357     else
15358         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15359     fi
15360 else
15361     AC_MSG_RESULT([no])
15363 AC_SUBST([MERGELIBS])
15364 AC_SUBST([MERGELIBS_MORE])
15366 dnl ===================================================================
15367 dnl icerun is a wrapper that stops us spawning tens of processes
15368 dnl locally - for tools that can't be executed on the compile cluster
15369 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15370 dnl ===================================================================
15371 AC_MSG_CHECKING([whether to use icerun wrapper])
15372 ICECREAM_RUN=
15373 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15374     ICECREAM_RUN=icerun
15375     AC_MSG_RESULT([yes])
15376 else
15377     AC_MSG_RESULT([no])
15379 AC_SUBST(ICECREAM_RUN)
15381 dnl ===================================================================
15382 dnl Setup the ICECC_VERSION for the build the same way it was set for
15383 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15384 dnl ===================================================================
15385 x_ICECC_VERSION=[\#]
15386 if test -n "$ICECC_VERSION" ; then
15387     x_ICECC_VERSION=
15389 AC_SUBST(x_ICECC_VERSION)
15390 AC_SUBST(ICECC_VERSION)
15392 dnl ===================================================================
15394 AC_MSG_CHECKING([MPL subset])
15395 MPL_SUBSET=
15396 LICENSE="LGPL"
15398 if test "$enable_mpl_subset" = "yes"; then
15399     mpl_error_string=
15400     newline=$'\n    *'
15401     warn_report=false
15402     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15403         warn_report=true
15404     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15405         warn_report=true
15406     fi
15407     if test "$warn_report" = "true"; then
15408         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15409     fi
15410     if test "x$enable_postgresql_sdbc" != "xno"; then
15411         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15412     fi
15413     if test "$enable_lotuswordpro" = "yes"; then
15414         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15415     fi
15416     if test -n "$ENABLE_POPPLER"; then
15417         if test "x$SYSTEM_POPPLER" = "x"; then
15418             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15419         fi
15420     fi
15421     # cf. m4/libo_check_extension.m4
15422     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15423         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15424     fi
15425     denied_themes=
15426     filtered_themes=
15427     for theme in $WITH_THEMES; do
15428         case $theme in
15429         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15430             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15431         *)
15432             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15433         esac
15434     done
15435     if test "x$denied_themes" != "x"; then
15436         if test "x$filtered_themes" == "x"; then
15437             filtered_themes="colibre"
15438         fi
15439         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15440     fi
15442     ENABLE_OPENGL_TRANSITIONS=
15444     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15445         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15446     fi
15448     if test "x$mpl_error_string" != "x"; then
15449         AC_MSG_ERROR([$mpl_error_string])
15450     fi
15452     MPL_SUBSET="TRUE"
15453     LICENSE="MPL-2.0"
15454     AC_DEFINE(MPL_HAVE_SUBSET)
15455     AC_MSG_RESULT([only])
15456 else
15457     AC_MSG_RESULT([no restrictions])
15459 AC_SUBST(MPL_SUBSET)
15460 AC_SUBST(LICENSE)
15462 dnl ===================================================================
15464 AC_MSG_CHECKING([formula logger])
15465 ENABLE_FORMULA_LOGGER=
15467 if test "x$enable_formula_logger" = "xyes"; then
15468     AC_MSG_RESULT([yes])
15469     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15470     ENABLE_FORMULA_LOGGER=TRUE
15471 elif test -n "$ENABLE_DBGUTIL" ; then
15472     AC_MSG_RESULT([yes])
15473     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15474     ENABLE_FORMULA_LOGGER=TRUE
15475 else
15476     AC_MSG_RESULT([no])
15479 AC_SUBST(ENABLE_FORMULA_LOGGER)
15481 dnl ===================================================================
15482 dnl Checking for active Antivirus software.
15483 dnl ===================================================================
15485 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15486     AC_MSG_CHECKING([for active Antivirus software])
15487     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15488     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15489     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15490         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15491             AC_MSG_RESULT([found])
15492             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15493             echo $EICAR_STRING > $SRC_ROOT/eicar
15494             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15495             rm $SRC_ROOT/eicar
15496             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15497                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15498             fi
15499             echo $EICAR_STRING > $BUILDDIR/eicar
15500             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15501             rm $BUILDDIR/eicar
15502             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15503                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15504             fi
15505             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"
15506         else
15507             AC_MSG_RESULT([not found])
15508         fi
15509     else
15510         AC_MSG_RESULT([n/a])
15511     fi
15514 dnl ===================================================================
15516 AC_MSG_CHECKING([for coredumpctl support])
15517 if test -z "$with_coredumpctl" && test $_os != Linux; then
15518     with_coredumpctl=no
15520 if test "$with_coredumpctl" = no; then
15521     WITH_COREDUMPCTL=
15522 else
15523     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15524     AC_PATH_PROG(JQ, jq)
15525     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15526     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15527     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15528         || test -z "$SYSTEMD_RUN"
15529     then
15530         if test -z "$with_coredumpctl"; then
15531             WITH_COREDUMPCTL=
15532         else
15533             if test -z "$COREDUMPCTL"; then
15534                 AC_MSG_ERROR([coredumpctl not found])
15535             fi
15536             if test -z "$JQ"; then
15537                 AC_MSG_ERROR([jq not found])
15538             fi
15539             if test -z "$SYSTEMD_ESCAPE"; then
15540                 AC_MSG_ERROR([systemd-escape not found])
15541             fi
15542             if test -z "$SYSTEMD_RUN"; then
15543                 AC_MSG_ERROR([systemd-run not found])
15544             fi
15545         fi
15546     else
15547         WITH_COREDUMPCTL=TRUE
15548     fi
15550 if test -z "$WITH_COREDUMPCTL"; then
15551     AC_MSG_RESULT([no])
15552 else
15553     AC_MSG_RESULT([yes])
15555 AC_SUBST(COREDUMPCTL)
15556 AC_SUBST(JQ)
15557 AC_SUBST(SYSTEMD_ESCAPE)
15558 AC_SUBST(SYSTEMD_RUN)
15559 AC_SUBST(WITH_COREDUMPCTL)
15561 dnl ===================================================================
15562 dnl Checking whether to use a keep-awake helper
15563 dnl ===================================================================
15565 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15566 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15567     AC_MSG_RESULT([no])
15568 elif test "$with_keep_awake" = "yes"; then
15569     AC_MSG_RESULT([yes (autodetect)])
15570     AC_MSG_CHECKING([for a suitable keep-awake command])
15571     if test "$_os" = "WINNT"; then
15572         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15573         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15574             AC_MSG_RESULT([using "Awake"])
15575             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15576             # make's PID and then use that to get the windows-PID.
15577             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15578             # much scarier looking than it actually is. Using make's shell instead of subshells in
15579             # the recipe to keep the command that's echoed by make short.
15580             KEEP_AWAKE_CMD=$formatted_path/PowerToys/PowerToys.Awake.exe' --display-on False --pid $(shell ps | awk '"'"'/^\s+'"'"'$$(ps | awk '"'"'/^\s+'"'"'$$$$'"'"'\s+/{print $$3}'"'"')'"'"'\s+/{print $$4}'"'"') &'
15581         else
15582             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15583         fi
15584     elif test "$_os" = "Darwin"; then
15585         AC_MSG_RESULT([using "caffeinate"])
15586         KEEP_AWAKE_CMD="caffeinate"
15587     else
15588         AC_MSG_ERROR([no default available for $_os, please specify manually])
15589     fi
15590 else
15591     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15593 AC_SUBST(KEEP_AWAKE_CMD)
15595 dnl ===================================================================
15596 dnl Setting up the environment.
15597 dnl ===================================================================
15598 AC_MSG_NOTICE([setting up the build environment variables...])
15600 AC_SUBST(COMPATH)
15602 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15603     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15604         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15605         ATL_INCLUDE="$COMPATH/atlmfc/include"
15606     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15607         ATL_LIB="$COMPATH/atlmfc/lib"
15608         ATL_INCLUDE="$COMPATH/atlmfc/include"
15609     else
15610         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15611         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15612     fi
15613     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15614     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15615     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15618 if test "$build_os" = "cygwin"; then
15619     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15620     PathFormat "/usr/bin/find.exe"
15621     FIND="$formatted_path"
15622     PathFormat "/usr/bin/sort.exe"
15623     SORT="$formatted_path"
15624     PathFormat "/usr/bin/grep.exe"
15625     WIN_GREP="$formatted_path"
15626     PathFormat "/usr/bin/ls.exe"
15627     WIN_LS="$formatted_path"
15628     PathFormat "/usr/bin/touch.exe"
15629     WIN_TOUCH="$formatted_path"
15630 else
15631     FIND=find
15632     SORT=sort
15635 AC_SUBST(ATL_INCLUDE)
15636 AC_SUBST(ATL_LIB)
15637 AC_SUBST(FIND)
15638 AC_SUBST(SORT)
15639 AC_SUBST(WIN_GREP)
15640 AC_SUBST(WIN_LS)
15641 AC_SUBST(WIN_TOUCH)
15643 AC_SUBST(BUILD_TYPE)
15645 AC_SUBST(SOLARINC)
15647 PathFormat "$PERL"
15648 PERL="$formatted_path"
15649 AC_SUBST(PERL)
15651 if test -n "$TMPDIR"; then
15652     TEMP_DIRECTORY="$TMPDIR"
15653     if test -n "$WSL_ONLY_AS_HELPER"; then
15654        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15655     fi
15656 else
15657     TEMP_DIRECTORY="/tmp"
15659 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15660 if test "$build_os" = "cygwin"; then
15661     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15662     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15664 AC_SUBST(TEMP_DIRECTORY)
15665 AC_SUBST(CYGWIN_BASH)
15667 # setup the PATH for the environment
15668 if test -n "$LO_PATH_FOR_BUILD"; then
15669     LO_PATH="$LO_PATH_FOR_BUILD"
15670     case "$host_os" in
15671     cygwin*|wsl*)
15672         pathmunge "$MSVC_HOST_PATH" "before"
15673         ;;
15674     esac
15675 else
15676     LO_PATH="$PATH"
15678     case "$host_os" in
15680     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15681         if test "$ENABLE_JAVA" != ""; then
15682             pathmunge "$JAVA_HOME/bin" "after"
15683         fi
15684         ;;
15686     cygwin*|wsl*)
15687         # Win32 make needs native paths
15688         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15689             LO_PATH=`cygpath -p -m "$PATH"`
15690         fi
15691         if test "$WIN_BUILD_ARCH" = "x64"; then
15692             # needed for msi packaging
15693             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15694         fi
15695         if test "$WIN_BUILD_ARCH" = "arm64"; then
15696             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15697             # the x86 ones probably would work just as well...
15698             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15699         fi
15700         # .NET 4.6 and higher don't have bin directory
15701         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15702             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15703         fi
15704         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15705         pathmunge "$CSC_PATH" "before"
15706         pathmunge "$MIDL_PATH" "before"
15707         pathmunge "$AL_PATH" "before"
15708         pathmunge "$MSVC_MULTI_PATH" "before"
15709         pathmunge "$MSVC_BUILD_PATH" "before"
15710         if test -n "$MSBUILD_PATH" ; then
15711             pathmunge "$MSBUILD_PATH" "before"
15712         fi
15713         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15714         if test "$ENABLE_JAVA" != ""; then
15715             if test -d "$JAVA_HOME/jre/bin/client"; then
15716                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15717             fi
15718             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15719                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15720             fi
15721             pathmunge "$JAVA_HOME/bin" "before"
15722         fi
15723         pathmunge "$MSVC_HOST_PATH" "before"
15724         ;;
15726     solaris*)
15727         pathmunge "/usr/css/bin" "before"
15728         if test "$ENABLE_JAVA" != ""; then
15729             pathmunge "$JAVA_HOME/bin" "after"
15730         fi
15731         ;;
15732     esac
15735 AC_SUBST(LO_PATH)
15737 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15738 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15739     x_LO_ELFCHECK_ALLOWLIST=
15740 else
15741     x_LO_ELFCHECK_ALLOWLIST=[\#]
15743 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15744 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15746 libo_FUZZ_SUMMARY
15748 # Generate a configuration sha256 we can use for deps
15749 if test -f config_host.mk; then
15750     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15752 if test -f config_host_lang.mk; then
15753     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15756 CFLAGS=$my_original_CFLAGS
15757 CXXFLAGS=$my_original_CXXFLAGS
15758 CPPFLAGS=$my_original_CPPFLAGS
15760 AC_CONFIG_LINKS([include:include])
15762 if test -n "$WSL_ONLY_AS_HELPER"; then
15763     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15764     build=$host
15765     PathFormat "$SRC_ROOT"
15766     SRC_ROOT="$formatted_path"
15767     PathFormat "$BUILDDIR"
15768     BUILDDIR="$formatted_path"
15769     # git-bash has (gnu) tar, curl and sha256sum
15770     CURL="curl.exe"
15771     WGET=
15772     GNUTAR="tar.exe"
15773     SHA256SUM="sha256sum.exe"
15774     # TODO: maybe switch to strawberry-perl right away?
15775     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15776     PERL="perl.exe"
15777     # use flex, gperf and nasm from wsl-container
15778     # if using absolute path, would need to use double-leading slash for the msys path mangling
15779     FLEX="$WSL $FLEX"
15780     NASM="$WSL $NASM"
15781     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15782     # with an absolute path/requires the value to begin with a slash
15783     GPERF="/c/Windows/system32/$WSL gperf"
15784     # append strawberry tools dir to PATH (for e.g. windres, ar)
15785     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15786     # temp-dir needs to be in windows realm, hardcode for now
15787     if test "$TEMP_DIRECTORY" = /tmp; then
15788         mkdir -p tmp
15789         TEMP_DIRECTORY="$BUILDDIR/tmp"
15790     fi
15793 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15794 # BUILD platform configuration] - otherwise breaks cross building
15795 AC_CONFIG_FILES([
15796                  config_host_lang.mk
15797                  Makefile
15798                  bin/bffvalidator.sh
15799                  bin/odfvalidator.sh
15800                  bin/officeotron.sh
15801                  instsetoo_native/util/openoffice.lst
15802                  sysui/desktop/macosx/Info.plist
15803                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15804                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15805                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15806 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15807 # easier to do it in a postprocessing command than to modify every single variable
15808 AC_CONFIG_FILES([config_host.mk], [
15809     if test -n "$WSL_ONLY_AS_HELPER"; then
15810         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15811     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15813 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15814 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15815 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15816 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15817 AC_CONFIG_HEADERS([config_host/config_clang.h])
15818 AC_CONFIG_HEADERS([config_host/config_cpdb.h])
15819 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15820 AC_CONFIG_HEADERS([config_host/config_cups.h])
15821 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15822 AC_CONFIG_HEADERS([config_host/config_eot.h])
15823 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15824 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15825 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15826 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15827 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15828 AC_CONFIG_HEADERS([config_host/config_emscripten.h])
15829 AC_CONFIG_HEADERS([config_host/config_features.h])
15830 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15831 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15832 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15833 AC_CONFIG_HEADERS([config_host/config_folders.h])
15834 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15835 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15836 AC_CONFIG_HEADERS([config_host/config_gio.h])
15837 AC_CONFIG_HEADERS([config_host/config_global.h])
15838 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15839 AC_CONFIG_HEADERS([config_host/config_java.h])
15840 AC_CONFIG_HEADERS([config_host/config_langs.h])
15841 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15842 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15843 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15844 AC_CONFIG_HEADERS([config_host/config_locales.h])
15845 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15846 AC_CONFIG_HEADERS([config_host/config_oox.h])
15847 AC_CONFIG_HEADERS([config_host/config_options.h])
15848 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15849 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15850 AC_CONFIG_HEADERS([config_host/config_skia.h])
15851 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15852 AC_CONFIG_HEADERS([config_host/config_validation.h])
15853 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15854 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15855 AC_CONFIG_HEADERS([config_host/config_version.h])
15856 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15857 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15858 AC_CONFIG_HEADERS([config_host/config_python.h])
15859 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15860 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15861 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15862 AC_OUTPUT
15864 if test "$CROSS_COMPILING" = TRUE; then
15865     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15868 # touch the config timestamp file
15869 if test ! -f config_host.mk.stamp; then
15870     echo > config_host.mk.stamp
15871 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15872     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15873 else
15874     echo > config_host.mk.stamp
15877 # touch the config lang timestamp file
15878 if test ! -f config_host_lang.mk.stamp; then
15879     echo > config_host_lang.mk.stamp
15880 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15881     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15882 else
15883     echo > config_host_lang.mk.stamp
15887 if test \( "$STALE_MAKE" = "TRUE" \) \
15888         -a "$build_os" = "cygwin"; then
15890 cat << _EOS
15891 ****************************************************************************
15892 WARNING:
15893 Your make version is known to be horribly slow, and hard to debug
15894 problems with. To get a reasonably functional make please do:
15896 to install a pre-compiled binary make for Win32
15898  mkdir -p /opt/lo/bin
15899  cd /opt/lo/bin
15900  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15901  cp make-4.2.1-msvc.exe make
15902  chmod +x make
15904 to install from source:
15905 place yourself in a working directory of you choice.
15907  git clone git://git.savannah.gnu.org/make.git
15909  [go to Start menu, open "Visual Studio 2019" or "Visual Studio 2022", and then click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
15910  set PATH=%PATH%;C:\Cygwin\bin
15911  [or Cygwin64, if that is what you have]
15912  cd path-to-make-repo-you-cloned-above
15913  build_w32.bat --without-guile
15915 should result in a WinRel/gnumake.exe.
15916 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15918 Then re-run autogen.sh
15920 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15921 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15923 _EOS
15927 cat << _EOF
15928 ****************************************************************************
15930 To show information on various make targets and make flags, run:
15931 $GNUMAKE help
15933 To just build, run:
15934 $GNUMAKE
15936 _EOF
15938 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15939     cat << _EOF
15940 After the build has finished successfully, you can immediately run what you built using the command:
15941 _EOF
15943     if test $_os = Darwin; then
15944         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15945     else
15946         echo instdir/program/soffice
15947     fi
15948     cat << _EOF
15950 If you want to run the unit tests, run:
15951 $GNUMAKE check
15953 _EOF
15956 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15957     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15958     cat "$WARNINGS_FILE_FOR_BUILD"
15959     echo
15962 if test -s "$WARNINGS_FILE"; then
15963     echo "HOST config ($WARNINGS_FILE)"
15964     cat "$WARNINGS_FILE"
15967 # Remove unneeded emconfigure artifacts
15968 rm -f a.out a.wasm a.out.js a.out.wasm
15970 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: