tdf#137335 calculate paragraph height in RTF/DOCX
[LibreOffice.git] / configure.ac
blob81dfe1a3b92490f00900e1b8c58a960f1a1c8e98
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 if test "$_os" = "Emscripten"; then
1444     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1445     if test -z "$EMSCRIPTEN_VERSION_H"; then
1446         AS_IF([test -z "$EMSDK"],
1447               [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1448         EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1449     fi
1450     if test -f "$EMSCRIPTEN_VERSION_H"; then
1451         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1452         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1453         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1454     else
1455         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1456         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1457         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1458         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1459     fi
1461     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1463     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1464     if test $? -eq 0; then
1465         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1466     else
1467         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1468     fi
1470     EMSCRIPTEN_ERROR=0
1471     if ! command -v emconfigure >/dev/null 2>&1; then
1472         AC_MSG_WARN([emconfigure must be in your \$PATH])
1473         EMSCRIPTEN_ERROR=1
1474     fi
1475     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1476         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1477         EMSCRIPTEN_ERROR=1
1478     fi
1479     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1480     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1481         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1482         EMSCRIPTEN_ERROR=1
1483     fi
1484     if test $EMSCRIPTEN_ERROR -ne 0; then
1485         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1486     fi
1488     dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
1489     BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
1491 AC_SUBST(EMSDK_FILE_PACKAGER)
1492 AC_SUBST(EMSCRIPTEN_EXTRA_SOFFICE_POST_JS)
1494 ###############################################################################
1495 # Extensions switches --enable/--disable
1496 ###############################################################################
1497 # By default these should be enabled unless having extra dependencies.
1498 # If there is extra dependency over configure options then the enable should
1499 # be automagic based on whether the requiring feature is enabled or not.
1500 # All this options change anything only with --enable-extension-integration.
1502 # The name of this option and its help string makes it sound as if
1503 # extensions are built anyway, just not integrated in the installer,
1504 # if you use --disable-extension-integration. Is that really the
1505 # case?
1507 AC_ARG_ENABLE(ios-simulator,
1508     AS_HELP_STRING([--enable-ios-simulator],
1509         [build for iOS simulator])
1512 libo_FUZZ_ARG_ENABLE(extension-integration,
1513     AS_HELP_STRING([--disable-extension-integration],
1514         [Disable integration of the built extensions in the installer of the
1515          product. Use this switch to disable the integration.])
1518 AC_ARG_ENABLE(avmedia,
1519     AS_HELP_STRING([--disable-avmedia],
1520         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1521 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1523 AC_ARG_ENABLE(database-connectivity,
1524     AS_HELP_STRING([--disable-database-connectivity],
1525         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1528 # This doesn't mean not building (or "integrating") extensions
1529 # (although it probably should; i.e. it should imply
1530 # --disable-extension-integration I guess), it means not supporting
1531 # any extension mechanism at all
1532 libo_FUZZ_ARG_ENABLE(extensions,
1533     AS_HELP_STRING([--disable-extensions],
1534         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1537 AC_ARG_ENABLE(scripting,
1538     AS_HELP_STRING([--disable-scripting],
1539         [Disable BASIC, Java, Python and .NET. Work in progress, use only if you are hacking on it.]),
1540 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1542 # This is mainly for Android and iOS, but could potentially be used in some
1543 # special case otherwise, too, so factored out as a separate setting
1545 AC_ARG_ENABLE(dynamic-loading,
1546     AS_HELP_STRING([--disable-dynamic-loading],
1547         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1550 libo_FUZZ_ARG_ENABLE(report-builder,
1551     AS_HELP_STRING([--disable-report-builder],
1552         [Disable the Report Builder.])
1555 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1556     AS_HELP_STRING([--enable-ext-wiki-publisher],
1557         [Enable the Wiki Publisher extension.])
1560 libo_FUZZ_ARG_ENABLE(lpsolve,
1561     AS_HELP_STRING([--disable-lpsolve],
1562         [Disable compilation of the lp solve solver ])
1564 libo_FUZZ_ARG_ENABLE(coinmp,
1565     AS_HELP_STRING([--disable-coinmp],
1566         [Disable compilation of the CoinMP solver ])
1569 libo_FUZZ_ARG_ENABLE(pdfimport,
1570     AS_HELP_STRING([--disable-pdfimport],
1571         [Disable building the PDF import feature.])
1574 libo_FUZZ_ARG_ENABLE(pdfium,
1575     AS_HELP_STRING([--disable-pdfium],
1576         [Disable building PDFium. Results in insecure PDF signature verification.])
1579 libo_FUZZ_ARG_ENABLE(skia,
1580     AS_HELP_STRING([--disable-skia],
1581         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1584 ###############################################################################
1586 dnl ---------- *** ----------
1588 libo_FUZZ_ARG_ENABLE(mergelibs,
1589     AS_HELP_STRING([--enable-mergelibs=yes/no/more],
1590         [Merge several of the smaller libraries into one big "merged" library.
1591          The "more" option will link even more of the smaller libraries.
1592          "more" not appropriate for distros which split up LibreOffice into multiple packages.
1593          It is only appropriate for situations where all of LO is delivered in a single install/package. ])
1596 libo_FUZZ_ARG_ENABLE(breakpad,
1597     AS_HELP_STRING([--enable-breakpad],
1598         [Enables breakpad for crash reporting.])
1601 libo_FUZZ_ARG_ENABLE(crashdump,
1602     AS_HELP_STRING([--disable-crashdump],
1603         [Disable dump.ini and dump-file, when --enable-breakpad])
1606 AC_ARG_ENABLE(fetch-external,
1607     AS_HELP_STRING([--disable-fetch-external],
1608         [Disables fetching external tarballs from web sources.])
1611 AC_ARG_ENABLE(fuzzers,
1612     AS_HELP_STRING([--enable-fuzzers],
1613         [Enables building libfuzzer targets for fuzz testing.])
1616 libo_FUZZ_ARG_ENABLE(pch,
1617     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1618         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1619          Using 'system' will include only external headers, 'base' will add also headers
1620          from base modules, 'normal' will also add all headers except from the module built,
1621          'full' will use all suitable headers even from a module itself.])
1624 libo_FUZZ_ARG_ENABLE(epm,
1625     AS_HELP_STRING([--enable-epm],
1626         [LibreOffice includes self-packaging code, that requires epm, however epm is
1627          useless for large scale package building.])
1630 libo_FUZZ_ARG_ENABLE(odk,
1631     AS_HELP_STRING([--enable-odk],
1632         [Enable building the Office Development Kit, the part that extensions need to build against])
1635 AC_ARG_ENABLE(mpl-subset,
1636     AS_HELP_STRING([--enable-mpl-subset],
1637         [Don't compile any pieces which are not MPL or more liberally licensed])
1640 libo_FUZZ_ARG_ENABLE(evolution2,
1641     AS_HELP_STRING([--enable-evolution2],
1642         [Allows the built-in evolution 2 addressbook connectivity build to be
1643          enabled.])
1646 AC_ARG_ENABLE(avahi,
1647     AS_HELP_STRING([--enable-avahi],
1648         [Determines whether to use Avahi to advertise Impress to remote controls.])
1651 AC_ARG_ENABLE(msvc-analyze,
1652     AS_HELP_STRING([--enable-msvc-analyze],
1653         [Determines whether to enable the Microsoft Visual Studio /analyze flag to provide additional warnings.])
1656 libo_FUZZ_ARG_ENABLE(werror,
1657     AS_HELP_STRING([--enable-werror],
1658         [Turn warnings to errors. (Has no effect in modules where the treating
1659          of warnings as errors is disabled explicitly.)]),
1662 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1663     AS_HELP_STRING([--enable-assert-always-abort],
1664         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1667 libo_FUZZ_ARG_ENABLE(dbgutil,
1668     AS_HELP_STRING([--enable-dbgutil],
1669         [Provide debugging support from --enable-debug and include additional debugging
1670          utilities such as object counting or more expensive checks.
1671          This is the recommended option for developers.
1672          Note that this makes the build ABI incompatible, it is not possible to mix object
1673          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1675 libo_FUZZ_ARG_ENABLE(debug,
1676     AS_HELP_STRING([--enable-debug],
1677         [Include debugging information, disable compiler optimization and inlining plus
1678          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1680 libo_FUZZ_ARG_ENABLE(split-debug,
1681     AS_HELP_STRING([--disable-split-debug],
1682         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1683          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1685 libo_FUZZ_ARG_ENABLE(gdb-index,
1686     AS_HELP_STRING([--disable-gdb-index],
1687         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1688          The feature requires a linker that supports the --gdb-index option.]))
1690 libo_FUZZ_ARG_ENABLE(sal-log,
1691     AS_HELP_STRING([--enable-sal-log],
1692         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1694 libo_FUZZ_ARG_ENABLE(symbols,
1695     AS_HELP_STRING([--enable-symbols],
1696         [Generate debug information.
1697          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1698          otherwise. It is possible to explicitly specify gbuild build targets
1699          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1700          everything in the directory; there is no ordering, more specific overrides
1701          more general, and disabling takes precedence).
1702          Example: --enable-symbols="all -sw/ -Library_sc".]))
1704 libo_FUZZ_ARG_ENABLE(optimized,
1705     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1706         [Whether to compile with optimization flags.
1707          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1708          otherwise. Using 'debug' will try to use only optimizations that should
1709          not interfere with debugging. For Emscripten we default to optimized (-O1)
1710          debug build, as otherwise binaries become too large.]))
1712 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1713     AS_HELP_STRING([--disable-runtime-optimizations],
1714         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1715          JVM JIT) that are known to interact badly with certain dynamic analysis
1716          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1717          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1718          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1720 AC_ARG_WITH(valgrind,
1721     AS_HELP_STRING([--with-valgrind],
1722         [Make availability of Valgrind headers a hard requirement.]))
1724 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1725     AS_HELP_STRING([--enable-compiler-plugins],
1726         [Enable compiler plugins that will perform additional checks during
1727          building. Enabled automatically by --enable-dbgutil.
1728          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1729 COMPILER_PLUGINS_DEBUG=
1730 if test "$enable_compiler_plugins" = debug; then
1731     enable_compiler_plugins=yes
1732     COMPILER_PLUGINS_DEBUG=TRUE
1735 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1736     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1737         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1738          relevant in the --disable-compiler-plugins case.]))
1740 libo_FUZZ_ARG_ENABLE(ooenv,
1741     AS_HELP_STRING([--enable-ooenv],
1742         [Enable ooenv for the instdir installation.]))
1744 AC_ARG_ENABLE(lto,
1745     AS_HELP_STRING([--enable-lto],
1746         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1747          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1748          linker.)]))
1750 AC_ARG_ENABLE(python,
1751     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1752         [Enables or disables Python support at run-time.
1753          Also specifies what Python to use at build-time.
1754          'fully-internal' even forces the internal version for uses of Python
1755          during the build.
1756          On macOS the only choices are
1757          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1758          ]))
1760 libo_FUZZ_ARG_ENABLE(gtk3,
1761     AS_HELP_STRING([--disable-gtk3],
1762         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1763 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1765 AC_ARG_ENABLE(gtk4,
1766     AS_HELP_STRING([--enable-gtk4],
1767         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1769 AC_ARG_ENABLE(atspi-tests,
1770     AS_HELP_STRING([--disable-atspi-tests],
1771         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1773 AC_ARG_ENABLE(introspection,
1774     AS_HELP_STRING([--enable-introspection],
1775         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1776          Linux distributions.)]))
1778 AC_ARG_ENABLE(split-app-modules,
1779     AS_HELP_STRING([--enable-split-app-modules],
1780         [Split file lists for app modules, e.g. base, calc.
1781          Has effect only with make distro-pack-install]),
1784 AC_ARG_ENABLE(split-opt-features,
1785     AS_HELP_STRING([--enable-split-opt-features],
1786         [Split file lists for some optional features, e.g. pyuno, testtool.
1787          Has effect only with make distro-pack-install]),
1790 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1791     AS_HELP_STRING([--disable-cairo-canvas],
1792         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1795 libo_FUZZ_ARG_ENABLE(dbus,
1796     AS_HELP_STRING([--disable-dbus],
1797         [Determines whether to enable features that depend on dbus.
1798          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1799 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1801 libo_FUZZ_ARG_ENABLE(sdremote,
1802     AS_HELP_STRING([--disable-sdremote],
1803         [Determines whether to enable Impress remote control (i.e. the server component).]),
1804 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1806 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1807     AS_HELP_STRING([--disable-sdremote-bluetooth],
1808         [Determines whether to build sdremote with bluetooth support.
1809          Requires dbus on Linux.]))
1811 libo_FUZZ_ARG_ENABLE(gio,
1812     AS_HELP_STRING([--disable-gio],
1813         [Determines whether to use the GIO support.]),
1814 ,test "${enable_gio+set}" = set || enable_gio=yes)
1816 AC_ARG_ENABLE(qt5,
1817     AS_HELP_STRING([--enable-qt5],
1818         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1819          available.]),
1822 AC_ARG_ENABLE(qt6,
1823     AS_HELP_STRING([--enable-qt6],
1824         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1825          available.]),
1828 AC_ARG_ENABLE(qt6-multimedia,
1829     AS_HELP_STRING([--disable-qt6-multimedia],
1830         [Determines whether to enable media playback using QtMultimedia when using the qt6/kf6 VCL plugins.]))
1832 AC_ARG_ENABLE(kf5,
1833     AS_HELP_STRING([--enable-kf5],
1834         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1835          KF5 are available.]),
1838 AC_ARG_ENABLE(kf6,
1839     AS_HELP_STRING([--enable-kf6],
1840         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1841          KF6 are available.]),
1845 AC_ARG_ENABLE(gtk3_kde5,
1846     AS_HELP_STRING([--enable-gtk3-kde5],
1847         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1848          platforms where Gtk3, Qt5 and Plasma is available.]),
1851 AC_ARG_ENABLE(gen,
1852     AS_HELP_STRING([--enable-gen],
1853         [To select the gen backend in case of --disable-dynamic-loading.
1854          Per default auto-enabled when X11 is used.]),
1855 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1857 AC_ARG_ENABLE(gui,
1858     AS_HELP_STRING([--disable-gui],
1859         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1860 ,enable_gui=yes)
1862 libo_FUZZ_ARG_ENABLE(randr,
1863     AS_HELP_STRING([--disable-randr],
1864         [Disable RandR support in the vcl project.]),
1865 ,test "${enable_randr+set}" = set || enable_randr=yes)
1867 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1868     AS_HELP_STRING([--disable-gstreamer-1-0],
1869         [Disable building with the gstreamer 1.0 avmedia backend.]),
1870 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1872 libo_FUZZ_ARG_ENABLE([eot],
1873     [AS_HELP_STRING([--enable-eot],
1874         [Enable support for Embedded OpenType fonts.])],
1875 ,test "${enable_eot+set}" = set || enable_eot=no)
1877 libo_FUZZ_ARG_ENABLE(cve-tests,
1878     AS_HELP_STRING([--disable-cve-tests],
1879         [Prevent CVE tests to be executed]),
1882 AC_ARG_ENABLE(build-opensymbol,
1883     AS_HELP_STRING([--enable-build-opensymbol],
1884         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1885          fontforge installed.]),
1888 AC_ARG_ENABLE(dependency-tracking,
1889     AS_HELP_STRING([--enable-dependency-tracking],
1890         [Do not reject slow dependency extractors.])[
1891   --disable-dependency-tracking
1892                           Disables generation of dependency information.
1893                           Speed up one-time builds.],
1896 AC_ARG_ENABLE(icecream,
1897     AS_HELP_STRING([--enable-icecream],
1898         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1899          It defaults to /opt/icecream for the location of the icecream gcc/g++
1900          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1903 AC_ARG_ENABLE(ld,
1904     AS_HELP_STRING([--enable-ld=<linker>],
1905         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1906          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1907          If <linker> contains any ':', the part before the first ':' is used as the value of
1908          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1909          needed for Clang 12).]),
1912 AC_ARG_ENABLE(cpdb,
1913     AS_HELP_STRING([--enable-cpdb],
1914         [Build CPDB (Common Print Dialog Backends) support.]),
1917 libo_FUZZ_ARG_ENABLE(cups,
1918     AS_HELP_STRING([--disable-cups],
1919         [Do not build cups support.])
1922 AC_ARG_ENABLE(ccache,
1923     AS_HELP_STRING([--disable-ccache],
1924         [Do not try to use ccache automatically.
1925          By default we will try to detect if ccache is available; in that case if
1926          CC/CXX are not yet set, and --enable-icecream is not given, we
1927          attempt to use ccache. --disable-ccache disables ccache completely.
1928          Additionally ccache's depend mode is enabled if possible,
1929          use --enable-ccache=nodepend to enable ccache without depend mode.
1933 AC_ARG_ENABLE(z7-debug,
1934     AS_HELP_STRING([--enable-z7-debug],
1935         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1936          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1937          Enabled by default if ccache is detected.]))
1939 libo_FUZZ_ARG_ENABLE(online-update,
1940     AS_HELP_STRING([--enable-online-update],
1941         [Enable the online update service that will check for new versions of
1942          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
1945 libo_FUZZ_ARG_ENABLE(online-update-mar,
1946     AS_HELP_STRING([--enable-online-update-mar],
1947         [Enable the experimental Mozilla-like online update service that will
1948          check for new versions of LibreOffice. Disabled by default.]),
1951 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1952     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1953         [Set the base URL value for --enable-online-update-mar.
1954          (Can be left off for debug purposes, even if that may render the feature
1955          non-functional.)]),
1958 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1959     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1960         [Set the certificate DER value for --enable-online-update-mar.
1961          (Can be left off for debug purposes, even if that may render the feature
1962          non-functional.)]),
1965 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1966     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1967         [Set the certificate name value for --enable-online-update-mar.
1968          (Can be left off for debug purposes, even if that may render the feature
1969          non-functional.)]),
1972 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1973     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1974         [Set the certificate path value for --enable-online-update-mar.
1975          (Can be left off for debug purposes, even if that may render the feature
1976          non-functional.)]),
1979 libo_FUZZ_ARG_ENABLE(extension-update,
1980     AS_HELP_STRING([--disable-extension-update],
1981         [Disable possibility to update installed extensions.]),
1984 libo_FUZZ_ARG_ENABLE(release-build,
1985     AS_HELP_STRING([--enable-release-build],
1986         [Enable release build. Note that the "release build" choice is orthogonal to
1987          whether symbols are present, debug info is generated, or optimization
1988          is done.
1989          See https://wiki.documentfoundation.org/Development/DevBuild]),
1992 libo_FUZZ_ARG_ENABLE(hardening-flags,
1993     AS_HELP_STRING([--enable-hardening-flags],
1994         [Enable automatically using hardening compiler flags. Distros typically
1995          instead use their default configuration via CXXFLAGS, etc. But this provides a
1996          convenient set of default hardening flags for non-distros]),
1999 AC_ARG_ENABLE(windows-build-signing,
2000     AS_HELP_STRING([--enable-windows-build-signing],
2001         [Enable signing of windows binaries (*.exe, *.dll)]),
2004 AC_ARG_ENABLE(silent-msi,
2005     AS_HELP_STRING([--enable-silent-msi],
2006         [Enable MSI with LIMITUI=1 (silent install).]),
2009 AC_ARG_ENABLE(wix,
2010     AS_HELP_STRING([--enable-wix],
2011         [Build Windows installer using WiX.]),
2014 AC_ARG_ENABLE(macosx-code-signing,
2015     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
2016         [Sign executables, dylibs, frameworks and the app bundle. If you
2017          don't provide an identity the first suitable certificate
2018          in your keychain is used.]),
2021 AC_ARG_ENABLE(macosx-package-signing,
2022     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2023         [Create a .pkg suitable for uploading to the Mac App Store and sign
2024          it. If you don't provide an identity the first suitable certificate
2025          in your keychain is used.]),
2028 AC_ARG_ENABLE(macosx-sandbox,
2029     AS_HELP_STRING([--enable-macosx-sandbox],
2030         [Make the app bundle run in a sandbox. Requires code signing.
2031          Is required by apps distributed in the Mac App Store, and implies
2032          adherence to App Store rules.]),
2035 AC_ARG_WITH(macosx-bundle-identifier,
2036     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2037         [Define the macOS bundle identifier. Default is the somewhat weird
2038          org.libreoffice.script ("script", huh?).]),
2039 ,with_macosx_bundle_identifier=org.libreoffice.script)
2041 AC_ARG_WITH(macosx-provisioning-profile,
2042     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2043         [Specify the path to a provisioning profile to use]),
2046 AC_ARG_WITH(product-name,
2047     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2048         [Define the product name. Default is AC_PACKAGE_NAME.]),
2049 ,with_product_name=$PRODUCTNAME)
2051 libo_FUZZ_ARG_ENABLE(community-flavor,
2052     AS_HELP_STRING([--disable-community-flavor],
2053         [Disable the Community branding.]),
2056 AC_ARG_WITH(package-version,
2057     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2058         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2061 libo_FUZZ_ARG_ENABLE(readonly-installset,
2062     AS_HELP_STRING([--enable-readonly-installset],
2063         [Prevents any attempts by LibreOffice to write into its installation. That means
2064          at least that no "system-wide" extensions can be added. Partly experimental work in
2065          progress, probably not fully implemented. Always enabled for macOS.]),
2068 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2069     AS_HELP_STRING([--disable-mariadb-sdbc],
2070         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2073 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2074     AS_HELP_STRING([--disable-postgresql-sdbc],
2075         [Disable the build of the PostgreSQL-SDBC driver.])
2078 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2079     AS_HELP_STRING([--disable-lotuswordpro],
2080         [Disable the build of the Lotus Word Pro filter.]),
2081 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2083 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2084     AS_HELP_STRING([--disable-firebird-sdbc],
2085         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2086 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2088 AC_ARG_ENABLE(bogus-pkg-config,
2089     AS_HELP_STRING([--enable-bogus-pkg-config],
2090         [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.]),
2093 AC_ARG_ENABLE(openssl,
2094     AS_HELP_STRING([--disable-openssl],
2095         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2096          components will use NSS. Work in progress,
2097          use only if you are hacking on it.]),
2098 ,enable_openssl=yes)
2100 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2101     AS_HELP_STRING([--enable-cipher-openssl-backend],
2102         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2103          Requires --enable-openssl.]))
2105 AC_ARG_ENABLE(nss,
2106     AS_HELP_STRING([--disable-nss],
2107         [Disable using NSS. If disabled,
2108          components will use openssl. Work in progress,
2109          use only if you are hacking on it.]),
2110 ,enable_nss=yes)
2112 AC_ARG_ENABLE(library-bin-tar,
2113     AS_HELP_STRING([--enable-library-bin-tar],
2114         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2115         Some libraries can save their build result in a tarball
2116         stored in TARFILE_LOCATION. That binary tarball is
2117         uniquely identified by the source tarball,
2118         the content of the config_host.mk file and the content
2119         of the top-level directory in core for that library
2120         If this option is enabled, then if such a tarfile exist, it will be untarred
2121         instead of the source tarfile, and the build step will be skipped for that
2122         library.
2123         If a proper tarfile does not exist, then the normal source-based
2124         build is done for that library and a proper binary tarfile is created
2125         for the next time.]),
2128 AC_ARG_ENABLE(dconf,
2129     AS_HELP_STRING([--disable-dconf],
2130         [Disable the dconf configuration backend (enabled by default where
2131          available).]))
2133 libo_FUZZ_ARG_ENABLE(formula-logger,
2134     AS_HELP_STRING(
2135         [--enable-formula-logger],
2136         [Enable formula logger for logging formula calculation flow in Calc.]
2137     )
2140 AC_ARG_ENABLE(ldap,
2141     AS_HELP_STRING([--disable-ldap],
2142         [Disable LDAP support.]),
2143 ,enable_ldap=yes)
2145 AC_ARG_ENABLE(opencl,
2146     AS_HELP_STRING([--disable-opencl],
2147         [Disable OpenCL support.]),
2148 ,enable_opencl=yes)
2150 libo_FUZZ_ARG_ENABLE(librelogo,
2151     AS_HELP_STRING([--disable-librelogo],
2152         [Do not build LibreLogo.]),
2153 ,enable_librelogo=yes)
2155 AC_ARG_ENABLE(wasm-strip,
2156     AS_HELP_STRING([--enable-wasm-strip],
2157         [Strip the static build like for WASM/emscripten platform.]),
2160 AC_ARG_WITH(main-module,
2161     AS_HELP_STRING([--with-main-module=<writer/calc>],
2162         [Specify which main module to build for wasm.
2163         Default value is 'writer'.]),
2166 AC_ARG_ENABLE(xmlhelp,
2167     AS_HELP_STRING([--disable-xmlhelp],
2168         [Disable XML help support]),
2169 ,enable_xmlhelp=yes)
2171 AC_ARG_ENABLE(customtarget-components,
2172     AS_HELP_STRING([--enable-customtarget-components],
2173         [Generates the static UNO object constructor mapping from the build.]))
2175 AC_ARG_ENABLE(cli,
2176     AS_HELP_STRING([--disable-cli],
2177         [Disable the generation of old CLI bindings.]),
2178 ,enable_cli=yes)
2180 AC_ARG_ENABLE(dotnet,
2181     AS_HELP_STRING([--enable-dotnet],
2182         [Enables or disables .NET 8.0 support and bindings generation.]))
2184 dnl ===================================================================
2185 dnl Optional Packages (--with/without-)
2186 dnl ===================================================================
2188 AC_ARG_WITH(gcc-home,
2189     AS_HELP_STRING([--with-gcc-home],
2190         [Specify the location of gcc/g++ manually. This can be used in conjunction
2191          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2192          non-default path.]),
2195 AC_ARG_WITH(gnu-patch,
2196     AS_HELP_STRING([--with-gnu-patch],
2197         [Specify location of GNU patch on Solaris or FreeBSD.]),
2200 AC_ARG_WITH(build-platform-configure-options,
2201     AS_HELP_STRING([--with-build-platform-configure-options],
2202         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2205 AC_ARG_WITH(gnu-cp,
2206     AS_HELP_STRING([--with-gnu-cp],
2207         [Specify location of GNU cp on Solaris or FreeBSD.]),
2210 AC_ARG_WITH(external-tar,
2211     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2212         [Specify an absolute path of where to find (and store) tarfiles.]),
2213     TARFILE_LOCATION=$withval ,
2216 AC_ARG_WITH(referenced-git,
2217     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2218         [Specify another checkout directory to reference. This makes use of
2219                  git submodule update --reference, and saves a lot of diskspace
2220                  when having multiple trees side-by-side.]),
2221     GIT_REFERENCE_SRC=$withval ,
2224 AC_ARG_WITH(linked-git,
2225     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2226         [Specify a directory where the repositories of submodules are located.
2227          This uses a method similar to git-new-workdir to get submodules.]),
2228     GIT_LINK_SRC=$withval ,
2231 AC_ARG_WITH(galleries,
2232     AS_HELP_STRING([--with-galleries],
2233         [Specify how galleries should be built. It is possible either to
2234          build these internally from source ("build"),
2235          or to disable them ("no")]),
2238 AC_ARG_WITH(templates,
2239     AS_HELP_STRING([--with-templates],
2240         [Specify we build with or without template files. It is possible either to
2241          build with templates ("yes"),
2242          or to disable them ("no")]),
2245 AC_ARG_WITH(theme,
2246     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2247         [Choose which themes to include. By default those themes with an '*' are included.
2248          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2249          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2250          *elementary, *elementary_svg,
2251          *karasa_jaga, *karasa_jaga_svg,
2252          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2253          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2256 libo_FUZZ_ARG_WITH(helppack-integration,
2257     AS_HELP_STRING([--without-helppack-integration],
2258         [It will not integrate the helppacks to the installer
2259          of the product. Please use this switch to use the online help
2260          or separate help packages.]),
2263 libo_FUZZ_ARG_WITH(fonts,
2264     AS_HELP_STRING([--without-fonts],
2265         [LibreOffice includes some third-party fonts to provide a reliable basis for
2266          help content, templates, samples, etc. When these fonts are already
2267          known to be available on the system then you should use this option.]),
2270 AC_ARG_WITH(epm,
2271     AS_HELP_STRING([--with-epm],
2272         [Decides which epm to use. Default is to use the one from the system if
2273          one is built. When either this is not there or you say =internal epm
2274          will be built.]),
2277 AC_ARG_WITH(package-format,
2278     AS_HELP_STRING([--with-package-format],
2279         [Specify package format(s) for LibreOffice installation sets. The
2280          implicit --without-package-format leads to no installation sets being
2281          generated. Possible values: archive, bsd, deb, dmg, emscripten,
2282          installed, msi, pkg, and rpm.
2283          Example: --with-package-format='deb rpm']),
2286 AC_ARG_WITH(tls,
2287     AS_HELP_STRING([--with-tls],
2288         [Decides which TLS/SSL and cryptographic implementations to use for
2289          LibreOffice's code. Default is to use NSS although OpenSSL is also
2290          possible. Notice that selecting NSS restricts the usage of OpenSSL
2291          in LO's code but selecting OpenSSL doesn't restrict by now the
2292          usage of NSS in LO's code. Possible values: openssl, nss.
2293          Example: --with-tls="nss"]),
2296 AC_ARG_WITH(system-libs,
2297     AS_HELP_STRING([--with-system-libs],
2298         [Use libraries already on system -- enables all --with-system-* flags.]),
2301 AC_ARG_WITH(system-bzip2,
2302     AS_HELP_STRING([--with-system-bzip2],
2303         [Use bzip2 already on system. Used when --enable-online-update-mar
2304         or --enable-python=internal]),,
2305     [with_system_bzip2="$with_system_libs"])
2307 AC_ARG_WITH(system-headers,
2308     AS_HELP_STRING([--with-system-headers],
2309         [Use headers already on system -- enables all --with-system-* flags for
2310          external packages whose headers are the only entities used i.e.
2311          boost/odbc/sane-header(s).]),,
2312     [with_system_headers="$with_system_libs"])
2314 AC_ARG_WITH(system-jars,
2315     AS_HELP_STRING([--without-system-jars],
2316         [When building with --with-system-libs, also the needed jars are expected
2317          on the system. Use this to disable that]),,
2318     [with_system_jars="$with_system_libs"])
2320 AC_ARG_WITH(system-cairo,
2321     AS_HELP_STRING([--with-system-cairo],
2322         [Use cairo libraries already on system.  Happens automatically for
2323          (implicit) --enable-gtk3.]))
2325 AC_ARG_WITH(system-epoxy,
2326     AS_HELP_STRING([--with-system-epoxy],
2327         [Use epoxy libraries already on system.  Happens automatically for
2328          (implicit) --enable-gtk3.]),,
2329        [with_system_epoxy="$with_system_libs"])
2331 AC_ARG_WITH(myspell-dicts,
2332     AS_HELP_STRING([--with-myspell-dicts],
2333         [Adds myspell dictionaries to the LibreOffice installation set]),
2336 AC_ARG_WITH(system-dicts,
2337     AS_HELP_STRING([--without-system-dicts],
2338         [Do not use dictionaries from system paths.]),
2341 AC_ARG_WITH(external-dict-dir,
2342     AS_HELP_STRING([--with-external-dict-dir],
2343         [Specify external dictionary dir.]),
2346 AC_ARG_WITH(external-hyph-dir,
2347     AS_HELP_STRING([--with-external-hyph-dir],
2348         [Specify external hyphenation pattern dir.]),
2351 AC_ARG_WITH(external-thes-dir,
2352     AS_HELP_STRING([--with-external-thes-dir],
2353         [Specify external thesaurus dir.]),
2356 AC_ARG_WITH(system-zlib,
2357     AS_HELP_STRING([--with-system-zlib],
2358         [Use zlib already on system.]),,
2359     [with_system_zlib=auto])
2361 AC_ARG_WITH(system-jpeg,
2362     AS_HELP_STRING([--with-system-jpeg],
2363         [Use jpeg already on system.]),,
2364     [with_system_jpeg="$with_system_libs"])
2366 AC_ARG_WITH(system-expat,
2367     AS_HELP_STRING([--with-system-expat],
2368         [Use expat already on system.]),,
2369     [with_system_expat="$with_system_libs"])
2371 AC_ARG_WITH(system-libxml,
2372     AS_HELP_STRING([--with-system-libxml],
2373         [Use libxml/libxslt already on system.]),,
2374     [with_system_libxml=auto])
2376 AC_ARG_WITH(system-openldap,
2377     AS_HELP_STRING([--with-system-openldap],
2378         [Use the OpenLDAP LDAP SDK already on system.]),,
2379     [with_system_openldap="$with_system_libs"])
2381 libo_FUZZ_ARG_ENABLE(poppler,
2382     AS_HELP_STRING([--disable-poppler],
2383         [Disable building Poppler.])
2386 AC_ARG_WITH(system-poppler,
2387     AS_HELP_STRING([--with-system-poppler],
2388         [Use system poppler (only needed for PDF import).]),,
2389     [with_system_poppler="$with_system_libs"])
2391 AC_ARG_WITH(system-abseil,
2392     AS_HELP_STRING([--with-system-abseil],
2393         [Use the abseil libraries already on system.]),,
2394     [with_system_abseil="$with_system_libs"])
2396 AC_ARG_WITH(system-openjpeg,
2397     AS_HELP_STRING([--with-system-openjpeg],
2398         [Use the OpenJPEG library already on system.]),,
2399     [with_system_openjpeg="$with_system_libs"])
2401 libo_FUZZ_ARG_ENABLE(gpgmepp,
2402     AS_HELP_STRING([--disable-gpgmepp],
2403         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2406 AC_ARG_WITH(system-gpgmepp,
2407     AS_HELP_STRING([--with-system-gpgmepp],
2408         [Use gpgmepp already on system]),,
2409     [with_system_gpgmepp="$with_system_libs"])
2411 AC_ARG_WITH(system-mariadb,
2412     AS_HELP_STRING([--with-system-mariadb],
2413         [Use MariaDB/MySQL libraries already on system.]),,
2414     [with_system_mariadb="$with_system_libs"])
2416 AC_ARG_ENABLE(bundle-mariadb,
2417     AS_HELP_STRING([--enable-bundle-mariadb],
2418         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2421 AC_ARG_WITH(system-postgresql,
2422     AS_HELP_STRING([--with-system-postgresql],
2423         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2424          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2425     [with_system_postgresql="$with_system_libs"])
2427 AC_ARG_WITH(libpq-path,
2428     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2429         [Use this PostgreSQL C interface (libpq) installation for building
2430          the PostgreSQL-SDBC extension.]),
2433 AC_ARG_WITH(system-firebird,
2434     AS_HELP_STRING([--with-system-firebird],
2435         [Use Firebird libraries already on system, for building the Firebird-SDBC
2436          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2437     [with_system_firebird="$with_system_libs"])
2439 AC_ARG_WITH(system-libtommath,
2440             AS_HELP_STRING([--with-system-libtommath],
2441                            [Use libtommath already on system]),,
2442             [with_system_libtommath="$with_system_libs"])
2444 AC_ARG_WITH(system-hsqldb,
2445     AS_HELP_STRING([--with-system-hsqldb],
2446         [Use hsqldb already on system.]))
2448 AC_ARG_WITH(hsqldb-jar,
2449     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2450         [Specify path to jarfile manually.]),
2451     HSQLDB_JAR=$withval)
2453 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2454     AS_HELP_STRING([--disable-scripting-beanshell],
2455         [Disable support for scripts in BeanShell.]),
2459 AC_ARG_WITH(system-beanshell,
2460     AS_HELP_STRING([--with-system-beanshell],
2461         [Use beanshell already on system.]),,
2462     [with_system_beanshell="$with_system_jars"])
2464 AC_ARG_WITH(beanshell-jar,
2465     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2466         [Specify path to jarfile manually.]),
2467     BSH_JAR=$withval)
2469 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2470     AS_HELP_STRING([--disable-scripting-javascript],
2471         [Disable support for scripts in JavaScript.]),
2475 AC_ARG_WITH(system-rhino,
2476     AS_HELP_STRING([--with-system-rhino],
2477         [Use rhino already on system.]),,
2478     [with_system_rhino="$with_system_jars"])
2480 AC_ARG_WITH(rhino-jar,
2481     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2482         [Specify path to jarfile manually.]),
2483     RHINO_JAR=$withval)
2485 AC_ARG_WITH(system-jfreereport,
2486     AS_HELP_STRING([--with-system-jfreereport],
2487         [Use JFreeReport already on system.]),,
2488     [with_system_jfreereport="$with_system_jars"])
2490 AC_ARG_WITH(sac-jar,
2491     AS_HELP_STRING([--with-sac-jar=JARFILE],
2492         [Specify path to jarfile manually.]),
2493     SAC_JAR=$withval)
2495 AC_ARG_WITH(libxml-jar,
2496     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2497         [Specify path to jarfile manually.]),
2498     LIBXML_JAR=$withval)
2500 AC_ARG_WITH(flute-jar,
2501     AS_HELP_STRING([--with-flute-jar=JARFILE],
2502         [Specify path to jarfile manually.]),
2503     FLUTE_JAR=$withval)
2505 AC_ARG_WITH(jfreereport-jar,
2506     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2507         [Specify path to jarfile manually.]),
2508     JFREEREPORT_JAR=$withval)
2510 AC_ARG_WITH(liblayout-jar,
2511     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2512         [Specify path to jarfile manually.]),
2513     LIBLAYOUT_JAR=$withval)
2515 AC_ARG_WITH(libloader-jar,
2516     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2517         [Specify path to jarfile manually.]),
2518     LIBLOADER_JAR=$withval)
2520 AC_ARG_WITH(libformula-jar,
2521     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2522         [Specify path to jarfile manually.]),
2523     LIBFORMULA_JAR=$withval)
2525 AC_ARG_WITH(librepository-jar,
2526     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2527         [Specify path to jarfile manually.]),
2528     LIBREPOSITORY_JAR=$withval)
2530 AC_ARG_WITH(libfonts-jar,
2531     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2532         [Specify path to jarfile manually.]),
2533     LIBFONTS_JAR=$withval)
2535 AC_ARG_WITH(libserializer-jar,
2536     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2537         [Specify path to jarfile manually.]),
2538     LIBSERIALIZER_JAR=$withval)
2540 AC_ARG_WITH(libbase-jar,
2541     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2542         [Specify path to jarfile manually.]),
2543     LIBBASE_JAR=$withval)
2545 AC_ARG_WITH(system-odbc,
2546     AS_HELP_STRING([--with-system-odbc],
2547         [Use the odbc headers already on system.]),,
2548     [with_system_odbc="auto"])
2550 AC_ARG_WITH(system-sane,
2551     AS_HELP_STRING([--with-system-sane],
2552         [Use sane.h already on system.]),,
2553     [with_system_sane="$with_system_headers"])
2555 AC_ARG_WITH(system-bluez,
2556     AS_HELP_STRING([--with-system-bluez],
2557         [Use bluetooth.h already on system.]),,
2558     [with_system_bluez="$with_system_headers"])
2560 AC_ARG_WITH(system-boost,
2561     AS_HELP_STRING([--with-system-boost],
2562         [Use boost already on system.]),,
2563     [with_system_boost="$with_system_headers"])
2565 AC_ARG_WITH(system-dragonbox,
2566     AS_HELP_STRING([--with-system-dragonbox],
2567         [Use dragonbox already on system.]),,
2568     [with_system_dragonbox="$with_system_headers"])
2570 AC_ARG_WITH(system-frozen,
2571     AS_HELP_STRING([--with-system-frozen],
2572         [Use frozen already on system.]),,
2573     [with_system_frozen="$with_system_headers"])
2575 AC_ARG_WITH(system-libfixmath,
2576     AS_HELP_STRING([--with-system-libfixmath],
2577         [Use libfixmath already on system.]),,
2578     [with_system_libfixmath="$with_system_libs"])
2580 AC_ARG_WITH(system-glm,
2581     AS_HELP_STRING([--with-system-glm],
2582         [Use glm already on system.]),,
2583     [with_system_glm="$with_system_headers"])
2585 AC_ARG_WITH(system-hunspell,
2586     AS_HELP_STRING([--with-system-hunspell],
2587         [Use libhunspell already on system.]),,
2588     [with_system_hunspell="$with_system_libs"])
2590 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2591     AS_HELP_STRING([--enable-cairo-rgba],
2592         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2594 libo_FUZZ_ARG_ENABLE(zxing,
2595     AS_HELP_STRING([--disable-zxing],
2596        [Disable use of zxing external library.]))
2598 AC_ARG_WITH(system-zxing,
2599     AS_HELP_STRING([--with-system-zxing],
2600         [Use libzxing already on system.]),,
2601     [with_system_zxing="$with_system_libs"])
2603 AC_ARG_WITH(system-zxcvbn,
2604     AS_HELP_STRING([--with-system-zxcvbn],
2605         [Use libzxcvbn already on system.]),,
2606     [with_system_zxcvbn="$with_system_libs"])
2608 AC_ARG_WITH(system-box2d,
2609     AS_HELP_STRING([--with-system-box2d],
2610         [Use box2d already on system.]),,
2611     [with_system_box2d="$with_system_libs"])
2613 AC_ARG_WITH(system-mythes,
2614     AS_HELP_STRING([--with-system-mythes],
2615         [Use mythes already on system.]),,
2616     [with_system_mythes="$with_system_libs"])
2618 AC_ARG_WITH(system-altlinuxhyph,
2619     AS_HELP_STRING([--with-system-altlinuxhyph],
2620         [Use ALTLinuxhyph already on system.]),,
2621     [with_system_altlinuxhyph="$with_system_libs"])
2623 AC_ARG_WITH(system-lpsolve,
2624     AS_HELP_STRING([--with-system-lpsolve],
2625         [Use lpsolve already on system.]),,
2626     [with_system_lpsolve="$with_system_libs"])
2628 AC_ARG_WITH(system-coinmp,
2629     AS_HELP_STRING([--with-system-coinmp],
2630         [Use CoinMP already on system.]),,
2631     [with_system_coinmp="$with_system_libs"])
2633 AC_ARG_WITH(system-liblangtag,
2634     AS_HELP_STRING([--with-system-liblangtag],
2635         [Use liblangtag library already on system.]),,
2636     [with_system_liblangtag="$with_system_libs"])
2638 AC_ARG_WITH(system-lockfile,
2639     AS_HELP_STRING([--with-system-lockfile[=file]],
2640         [Detect a system lockfile program or use the \$file argument.]))
2642 AC_ARG_WITH(webdav,
2643     AS_HELP_STRING([--without-webdav],
2644         [Disable WebDAV support in the UCB.]))
2646 AC_ARG_WITH(linker-hash-style,
2647     AS_HELP_STRING([--with-linker-hash-style],
2648         [Use linker with --hash-style=<style> when linking shared objects.
2649          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2650          if supported on the build system, and "sysv" otherwise.]))
2652 AC_ARG_WITH(jdk-home,
2653     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2654         [If you have installed JDK 8 or later on your system please supply the
2655          path here. Note that this is not the location of the java command but the
2656          location of the entire distribution. In case of cross-compiling, this
2657          is the JDK of the host os. Use --with-build-platform-configure-options
2658          to point to a different build platform JDK.]),
2661 AC_ARG_WITH(help,
2662     AS_HELP_STRING([--with-help],
2663         [Enable the build of help. There is a special parameter "common" that
2664          can be used to bundle only the common part, .e.g help-specific icons.
2665          This is useful when you build the helpcontent separately.])
2666     [
2667                           Usage:     --with-help    build the old local help
2668                                  --without-help     no local help (default)
2669                                  --with-help=html   build the new HTML local help
2670                                  --with-help=online build the new HTML online help
2671     ],
2674 AC_ARG_WITH(omindex,
2675    AS_HELP_STRING([--with-omindex],
2676         [Enable the support of xapian-omega index for online help.])
2677    [
2678                          Usage: --with-omindex=server prepare the pages for omindex
2679                                 but let xapian-omega be built in server.
2680                                 --with-omindex=noxap do not prepare online pages
2681                                 for xapian-omega
2682   ],
2685 libo_FUZZ_ARG_WITH(java,
2686     AS_HELP_STRING([--with-java=<java command>],
2687         [Specify the name of the Java interpreter command. Typically "java"
2688          which is the default.
2690          To build without support for Java components, applets, accessibility
2691          or the XML filters written in Java, use --without-java or --with-java=no.]),
2692     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2693     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2696 AC_ARG_WITH(jvm-path,
2697     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2698         [Use a specific JVM search path at runtime.
2699          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2702 AC_ARG_WITH(ant-home,
2703     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2704         [If you have installed Apache Ant on your system, please supply the path here.
2705          Note that this is not the location of the Ant binary but the location
2706          of the entire distribution.]),
2709 AC_ARG_WITH(symbol-config,
2710     AS_HELP_STRING([--with-symbol-config],
2711         [Configuration for the crashreport symbol upload]),
2712         [],
2713         [with_symbol_config=no])
2715 AC_ARG_WITH(export-validation,
2716     AS_HELP_STRING([--without-export-validation],
2717         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2718 ,with_export_validation=auto)
2720 AC_ARG_WITH(bffvalidator,
2721     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2722         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2723          Requires installed Microsoft Office Binary File Format Validator.
2724          Note: export-validation (--with-export-validation) is required to be turned on.
2725          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2726 ,with_bffvalidator=no)
2728 libo_FUZZ_ARG_WITH(junit,
2729     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2730         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2731          --without-junit disables those tests. Not relevant in the --without-java case.]),
2732 ,with_junit=yes)
2734 AC_ARG_WITH(hamcrest,
2735     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2736         [Specifies the hamcrest jar file to use for JUnit-based tests.
2737          --without-junit disables those tests. Not relevant in the --without-java case.]),
2738 ,with_hamcrest=yes)
2740 AC_ARG_WITH(perl-home,
2741     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2742         [If you have installed Perl 5 Distribution, on your system, please
2743          supply the path here. Note that this is not the location of the Perl
2744          binary but the location of the entire distribution.]),
2747 libo_FUZZ_ARG_WITH(doxygen,
2748     AS_HELP_STRING(
2749         [--with-doxygen=<absolute path to doxygen executable>],
2750         [Only relevant when --enable-odk is set. Specifies the doxygen
2751          executable to use when generating ODK C/C++ documentation.
2752          --without-doxygen disables generation of ODK C/C++ documentation.]),
2753 ,with_doxygen=yes)
2755 AC_ARG_WITH(visual-studio,
2756     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2757         [Specify which Visual Studio version to use in case several are
2758          installed. Currently 2019 (default) and 2022 are supported.]),
2761 AC_ARG_WITH(windows-sdk,
2762     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2763         [Specify which Windows SDK, or "Windows Kit", version to use
2764          in case the one that came with the selected Visual Studio
2765          is not what you want for some reason. Note that not all compiler/SDK
2766          combinations are supported. The intent is that this option should not
2767          be needed.]),
2770 AC_ARG_WITH(lang,
2771     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2772         [Use this option to build LibreOffice with additional UI language support.
2773          English (US) is always included by default.
2774          Separate multiple languages with space.
2775          For all languages, use --with-lang=ALL.]),
2778 AC_ARG_WITH(locales,
2779     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2780         [Use this option to limit the locale information built in.
2781          Separate multiple locales with space.
2782          Very experimental and might well break stuff.
2783          Just a desperate measure to shrink code and data size.
2784          By default all the locales available is included.
2785          Just works with --disable-dynloading. Defaults to "ALL".
2786          This option is completely unrelated to --with-lang.])
2787     [
2788                           Affects also our character encoding conversion
2789                           tables for encodings mainly targeted for a
2790                           particular locale, like EUC-CN and EUC-TW for
2791                           zh, ISO-2022-JP for ja.
2793                           Affects also our add-on break iterator data for
2794                           some languages.
2796                           For the default, all locales, don't use this switch at all.
2797                           Specifying just the language part of a locale means all matching
2798                           locales will be included.
2799     ],
2802 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2803 # and also by Mariadb/Mysql and libcurl since LibO 24.8
2804 libo_FUZZ_ARG_WITH(krb5,
2805     AS_HELP_STRING([--with-krb5],
2806         [Enable MIT Kerberos 5 support in modules that support it.
2807          By default automatically enabled on platforms
2808          where a good system Kerberos 5 is available.]),
2811 libo_FUZZ_ARG_WITH(gssapi,
2812     AS_HELP_STRING([--with-gssapi],
2813         [Enable GSSAPI support in modules that support it.
2814          By default automatically enabled on platforms
2815          where a good system GSSAPI is available.]),
2818 libo_FUZZ_ARG_WITH(lxml,
2819     AS_HELP_STRING([--without-lxml],
2820         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2821          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2822          report widget classes and ids.]),
2825 libo_FUZZ_ARG_WITH(latest-c++,
2826     AS_HELP_STRING([--with-latest-c++],
2827         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2828          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2829         [with_latest_c__=no])
2831 AC_ARG_WITH(gtk3-build,
2832     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2833         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2834          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2836 AC_ARG_WITH(keep-awake,
2837     AS_HELP_STRING([--with-keep-awake],
2838         [command to prefix make with in order to prevent the system from going to sleep/suspend
2839          while building.
2840          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2841          and caffeinate on macOS]))
2843 dnl ===================================================================
2844 dnl Branding
2845 dnl ===================================================================
2847 AC_ARG_WITH(branding,
2848     AS_HELP_STRING([--with-branding=/path/to/images],
2849         [Use given path to retrieve branding images set.])
2850     [
2851                           Search for intro.png about.svg and logo.svg.
2852                           If any is missing, default ones will be used instead.
2854                           Search also progress.conf for progress
2855                           settings on intro screen :
2857                           PROGRESSBARCOLOR="255,255,255" Set color of
2858                           progress bar. Comma separated RGB decimal values.
2859                           PROGRESSSIZE="407,6" Set size of progress bar.
2860                           Comma separated decimal values (width, height).
2861                           PROGRESSPOSITION="61,317" Set position of progress
2862                           bar from left,top. Comma separated decimal values.
2863                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2864                           bar frame. Comma separated RGB decimal values.
2865                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2866                           bar text. Comma separated RGB decimal values.
2867                           PROGRESSTEXTBASELINE="287" Set vertical position of
2868                           progress bar text from top. Decimal value.
2870                           Default values will be used if not found.
2871     ],
2875 AC_ARG_WITH(extra-buildid,
2876     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2877         [Show addition build identification in about dialog.]),
2881 AC_ARG_WITH(vendor,
2882     AS_HELP_STRING([--with-vendor="John the Builder"],
2883         [Set vendor of the build.]),
2886 AC_ARG_WITH(privacy-policy-url,
2887     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2888         [The URL to your privacy policy (needed when
2889          enabling online-update or crashreporting via breakpad)]),
2890         [if test "x$with_privacy_policy_url" = "xyes"; then
2891             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2892          elif test "x$with_privacy_policy_url" = "xno"; then
2893             with_privacy_policy_url="undefined"
2894          fi]
2895 ,[with_privacy_policy_url="undefined"])
2897 AC_ARG_WITH(android-package-name,
2898     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2899         [Set Android package name of the build.]),
2902 AC_ARG_WITH(compat-oowrappers,
2903     AS_HELP_STRING([--with-compat-oowrappers],
2904         [Install oo* wrappers in parallel with
2905          lo* ones to keep backward compatibility.
2906          Has effect only with make distro-pack-install]),
2909 AC_ARG_WITH(os-version,
2910     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2911         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2914 AC_ARG_WITH(parallelism,
2915     AS_HELP_STRING([--with-parallelism],
2916         [Number of jobs to run simultaneously during build. Parallel builds can
2917         save a lot of time on multi-cpu machines. Defaults to the number of
2918         CPUs on the machine, unless you configure --enable-icecream - then to
2919         40.]),
2922 AC_ARG_WITH(all-tarballs,
2923     AS_HELP_STRING([--with-all-tarballs],
2924         [Download all external tarballs unconditionally]))
2926 AC_ARG_WITH(gdrive-client-id,
2927     AS_HELP_STRING([--with-gdrive-client-id],
2928         [Provides the client id of the application for OAuth2 authentication
2929         on Google Drive. If either this or --with-gdrive-client-secret is
2930         empty, the feature will be disabled]),
2933 AC_ARG_WITH(gdrive-client-secret,
2934     AS_HELP_STRING([--with-gdrive-client-secret],
2935         [Provides the client secret of the application for OAuth2
2936         authentication on Google Drive. If either this or
2937         --with-gdrive-client-id is empty, the feature will be disabled]),
2940 AC_ARG_WITH(alfresco-cloud-client-id,
2941     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2942         [Provides the client id of the application for OAuth2 authentication
2943         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2944         empty, the feature will be disabled]),
2947 AC_ARG_WITH(alfresco-cloud-client-secret,
2948     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2949         [Provides the client secret of the application for OAuth2
2950         authentication on Alfresco Cloud. If either this or
2951         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2954 AC_ARG_WITH(onedrive-client-id,
2955     AS_HELP_STRING([--with-onedrive-client-id],
2956         [Provides the client id of the application for OAuth2 authentication
2957         on OneDrive. If either this or --with-onedrive-client-secret is
2958         empty, the feature will be disabled]),
2961 AC_ARG_WITH(onedrive-client-secret,
2962     AS_HELP_STRING([--with-onedrive-client-secret],
2963         [Provides the client secret of the application for OAuth2
2964         authentication on OneDrive. If either this or
2965         --with-onedrive-client-id is empty, the feature will be disabled]),
2968 dnl Check for coredumpctl support to present information about crashing test processes:
2969 AC_ARG_WITH(coredumpctl,
2970     AS_HELP_STRING([--with-coredumpctl],
2971         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2972         processes.]))
2974 AC_ARG_WITH(buildconfig-recorded,
2975     AS_HELP_STRING([--with-buildconfig-recorded],
2976         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2979 AC_MSG_CHECKING([whether to record build config])
2980 if test -z "$with_buildconfig_recorded"; then
2981     with_buildconfig_recorded=no
2983 if test "$with_buildconfig_recorded" = no; then
2984     AC_MSG_RESULT([no])
2985 else
2986     AC_MSG_RESULT([yes])
2987     # replace backslashes, to get a valid c++ string
2988     config_args=$(echo $ac_configure_args | tr '\\' '/')
2989     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2990     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2993 dnl ===================================================================
2994 dnl Do we want to use pre-build binary tarball for recompile
2995 dnl ===================================================================
2997 if test "$enable_library_bin_tar" = "yes" ; then
2998     USE_LIBRARY_BIN_TAR=TRUE
2999 else
3000     USE_LIBRARY_BIN_TAR=
3002 AC_SUBST(USE_LIBRARY_BIN_TAR)
3004 dnl ===================================================================
3005 dnl Test whether build target is Release Build
3006 dnl ===================================================================
3007 AC_MSG_CHECKING([whether build target is Release Build])
3008 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
3009     AC_MSG_RESULT([no])
3010     ENABLE_RELEASE_BUILD=
3011     dnl Pu the value on one line as make (at least on macOS) seems to ignore
3012     dnl the newlines and then complains about spaces.
3013     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/>'
3014 else
3015     AC_MSG_RESULT([yes])
3016     ENABLE_RELEASE_BUILD=TRUE
3017     GET_TASK_ALLOW_ENTITLEMENT=
3019 AC_SUBST(ENABLE_RELEASE_BUILD)
3020 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
3022 dnl ===================================================================
3023 dnl Test whether build should auto use hardening compiler flags
3024 dnl ===================================================================
3025 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3026 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3027     AC_MSG_RESULT([no])
3028     ENABLE_HARDENING_FLAGS=
3029 else
3030     AC_MSG_RESULT([yes])
3031     ENABLE_HARDENING_FLAGS=TRUE
3033 AC_SUBST(ENABLE_HARDENING_FLAGS)
3035 AC_MSG_CHECKING([whether to build a Community flavor])
3036 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3037     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3038     AC_MSG_RESULT([yes])
3039 else
3040     AC_MSG_RESULT([no])
3043 dnl ===================================================================
3044 dnl Test whether to sign Windows Build
3045 dnl ===================================================================
3046 AC_MSG_CHECKING([whether to sign windows build])
3047 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3048     AC_MSG_RESULT([yes])
3049     WINDOWS_BUILD_SIGNING="TRUE"
3050 else
3051     AC_MSG_RESULT([no])
3052     WINDOWS_BUILD_SIGNING="FALSE"
3054 AC_SUBST(WINDOWS_BUILD_SIGNING)
3056 dnl ===================================================================
3057 dnl MacOSX build and runtime environment options
3058 dnl ===================================================================
3060 AC_ARG_WITH(macosx-version-min-required,
3061     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3062         [set the minimum OS version needed to run the built LibreOffice])
3063     [
3064                           e. g.: --with-macosx-version-min-required=10.15
3065     ],
3068 dnl ===================================================================
3069 dnl Check for incompatible options set by fuzzing, and reset those
3070 dnl automatically to working combinations
3071 dnl ===================================================================
3073 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3074         "$enable_dbus" != "$enable_avahi"; then
3075     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3076     enable_avahi=$enable_dbus
3079 add_lopath_after ()
3081     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3082         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3083     fi
3086 add_lopath_before ()
3088     local IFS=${P_SEP}
3089     local path_cleanup
3090     local dir
3091     for dir in $LO_PATH ; do
3092         if test "$dir" != "$1" ; then
3093             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3094         fi
3095     done
3096     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3099 dnl ===================================================================
3100 dnl check for required programs (grep, awk, sed, bash)
3101 dnl ===================================================================
3103 pathmunge ()
3105     local new_path
3106     if test -n "$1"; then
3107         if test "$build_os" = "cygwin"; then
3108             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3109                 PathFormat "$1"
3110                 new_path=`cygpath -sm "$formatted_path"`
3111             else
3112                 PathFormat "$1"
3113                 new_path=`cygpath -u "$formatted_path"`
3114             fi
3115         else
3116             new_path="$1"
3117         fi
3118         if test "$2" = "after"; then
3119             add_lopath_after "$new_path"
3120         else
3121             add_lopath_before "$new_path"
3122         fi
3123     fi
3126 AC_PROG_AWK
3127 AC_PATH_PROG( AWK, $AWK)
3128 if test -z "$AWK"; then
3129     AC_MSG_ERROR([install awk to run this script])
3132 AC_PATH_PROG(BASH, bash)
3133 if test -z "$BASH"; then
3134     AC_MSG_ERROR([bash not found in \$PATH])
3136 AC_SUBST(BASH)
3138 # prefer parallel compression tools, if available
3139 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3140 if test -z "$COMPRESSIONTOOL"; then
3141     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3142     if test -z "$COMPRESSIONTOOL"; then
3143         AC_MSG_ERROR([gzip not found in \$PATH])
3144     fi
3146 AC_SUBST(COMPRESSIONTOOL)
3148 AC_MSG_CHECKING([for GNU or BSD tar])
3149 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3150     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3151     if test $? -eq 0;  then
3152         GNUTAR=$a
3153         break
3154     fi
3155 done
3156 AC_MSG_RESULT($GNUTAR)
3157 if test -z "$GNUTAR"; then
3158     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3160 AC_SUBST(GNUTAR)
3162 AC_MSG_CHECKING([for tar's option to strip components])
3163 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3164 if test $? -eq 0; then
3165     STRIP_COMPONENTS="--strip-components"
3166 else
3167     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3168     if test $? -eq 0; then
3169         STRIP_COMPONENTS="--strip-path"
3170     else
3171         STRIP_COMPONENTS="unsupported"
3172     fi
3174 AC_MSG_RESULT($STRIP_COMPONENTS)
3175 if test x$STRIP_COMPONENTS = xunsupported; then
3176     AC_MSG_ERROR([you need a tar that is able to strip components.])
3178 AC_SUBST(STRIP_COMPONENTS)
3180 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3181 dnl desktop OSes from "mobile" ones.
3183 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3184 dnl In other words, that when building for an OS that is not a
3185 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3187 dnl Note the direction of the implication; there is no assumption that
3188 dnl cross-compiling would imply a non-desktop OS.
3190 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3191     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3192     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3193     if test "$_os" != Emscripten; then
3194         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3195     fi
3198 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3199 # also work with the default gtk3 plugin.
3200 if test "$enable_wasm_strip" = "yes"; then
3201     enable_avmedia=no
3202     enable_libcmis=no
3203     enable_coinmp=no
3204     enable_cups=no
3205     test "$_os" = Emscripten && enable_curl=no
3206     enable_database_connectivity=no
3207     enable_dbus=no
3208     enable_dconf=no
3209     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3210     enable_extension_integration=no
3211     enable_extensions=no
3212     enable_extension_update=no
3213     enable_gio=no
3214     enable_gpgmepp=no
3215     enable_ldap=no
3216     enable_lotuswordpro=no
3217     enable_lpsolve=no
3218     enable_nss=no
3219     enable_odk=no
3220     enable_online_update=no
3221     enable_opencl=no
3222     enable_pdfimport=no
3223     enable_randr=no
3224     enable_report_builder=no
3225     enable_scripting=no
3226     enable_sdremote_bluetooth=no
3227     enable_skia=no
3228     enable_xmlhelp=no
3229     enable_zxing=no
3230     test_libepubgen=no
3231     test_libcdr=no
3232     test_libcmis=no
3233     test_libetonyek=no
3234     test_libfreehand=no
3235     test_libmspub=no
3236     test_libpagemaker=no
3237     test_libqxp=no
3238     test_libvisio=no
3239     test_libzmf=no
3240     test_webdav=no
3241     with_galleries=no
3242     with_templates=no
3243     with_webdav=no
3244     with_x=no
3246     test "${with_fonts+set}" = set || with_fonts=yes
3247     test "${with_locales+set}" = set || with_locales=en
3249     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3250     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3251     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3252     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3253 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3254     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3255     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3256     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3257     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3258 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3259     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3260     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3261     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3262     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3263     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3264     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3265     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3266     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3269 # Whether to build "avmedia" functionality or not.
3271 if test "$enable_avmedia" = yes; then
3272     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3273     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3274 else
3275     test_gstreamer_1_0=no
3278 # Decide whether to build database connectivity stuff (including Base) or not.
3279 if test "$enable_database_connectivity" != no; then
3280     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3281     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3282 else
3283     if test "$_os" = iOS; then
3284         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3285     fi
3286     disable_database_connectivity_dependencies
3289 if test -z "$enable_extensions"; then
3290     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3291     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3292         enable_extensions=yes
3293     fi
3296 DISABLE_SCRIPTING=''
3297 if test "$enable_scripting" = yes; then
3298     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3299     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3300 else
3301     DISABLE_SCRIPTING='TRUE'
3302     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3305 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3306     # Disable dynamic_loading always for iOS and Android
3307     enable_dynamic_loading=no
3308 elif test -z "$enable_dynamic_loading"; then
3309     # Otherwise enable it unless specifically disabled
3310     enable_dynamic_loading=yes
3313 DISABLE_DYNLOADING=''
3314 if test "$enable_dynamic_loading" = yes; then
3315     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3316 else
3317     DISABLE_DYNLOADING='TRUE'
3318     if test $_os != iOS -a $_os != Android; then
3319         enable_database_connectivity=no
3320         enable_nss=no
3321         enable_odk=no
3322         enable_python=no
3323         enable_skia=no
3324         with_java=no
3325     fi
3327 AC_SUBST(DISABLE_DYNLOADING)
3329 ENABLE_CUSTOMTARGET_COMPONENTS=
3330 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3331     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3332     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3333         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3334     fi
3336 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3338 if test "$enable_extensions" = yes; then
3339     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3340     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3341 else
3342     enable_extension_integration=no
3343     enable_extension_update=no
3346 # remember SYSBASE value
3347 AC_SUBST(SYSBASE)
3349 dnl ===================================================================
3350 dnl  Sort out various gallery compilation options
3351 dnl ===================================================================
3352 WITH_GALLERY_BUILD=TRUE
3353 AC_MSG_CHECKING([how to build and package galleries])
3354 if test -n "${with_galleries}"; then
3355     if test "$with_galleries" = "build"; then
3356         if test "$enable_database_connectivity" = no; then
3357             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3358         fi
3359         AC_MSG_RESULT([build from source images internally])
3360     elif test "$with_galleries" = "no"; then
3361         WITH_GALLERY_BUILD=
3362         AC_MSG_RESULT([disable non-internal gallery build])
3363     else
3364         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3365     fi
3366 else
3367     if test $_os != iOS -a $_os != Android; then
3368         AC_MSG_RESULT([internal src images for desktop])
3369     else
3370         WITH_GALLERY_BUILD=
3371         AC_MSG_RESULT([disable src image build])
3372     fi
3374 AC_SUBST(WITH_GALLERY_BUILD)
3376 dnl ===================================================================
3377 dnl  Sort out various templates compilation options
3378 dnl ===================================================================
3379 WITH_TEMPLATES=TRUE
3380 AC_MSG_CHECKING([build with or without template files])
3381 if test -n "${with_templates}"; then
3382     if test "$with_templates" = "yes"; then
3383         AC_MSG_RESULT([enable all templates])
3384     elif test "$with_templates" = "no"; then
3385         WITH_TEMPLATES=
3386         AC_MSG_RESULT([disable non-internal templates])
3387     else
3388         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3389     fi
3390 else
3391     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3392         AC_MSG_RESULT([enable all templates])
3393     else
3394         WITH_TEMPLATES=
3395         AC_MSG_RESULT([disable non-internal templates])
3396     fi
3398 AC_SUBST(WITH_TEMPLATES)
3400 dnl ===================================================================
3401 dnl  Checks if ccache is available
3402 dnl ===================================================================
3403 CCACHE_DEPEND_MODE=
3404 if test "$enable_ccache" = "no"; then
3405     CCACHE=""
3406 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3407     case "%$CC%$CXX%" in
3408     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3409     # assume that's good then
3410     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3411         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3412         CCACHE_DEPEND_MODE=1
3413         ;;
3414     *)
3415         # try to use our own ccache if it is available and CCACHE was not already defined
3416         if test -z "$CCACHE"; then
3417             if test "$_os" = "WINNT"; then
3418                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3419             fi
3420             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3421                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3422             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3423                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3424             fi
3425         fi
3426         AC_PATH_PROG([CCACHE],[ccache],[not found])
3427         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3428             CCACHE=`win_short_path_for_make "$CCACHE"`
3429             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3430             rm -f conftest.txt
3431             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3432             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3433             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3434                 AC_MSG_RESULT(yes)
3435             else
3436                 AC_MSG_RESULT(no)
3437                 CCACHE="not found"
3438             fi
3439             rm -f conftest.txt
3440         fi
3441         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3442             # on windows/VC perhaps sccache is around?
3443             case "%$CC%$CXX%" in
3444             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3445             # assume that's good then
3446             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3447                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3448                 CCACHE_DEPEND_MODE=1
3449                 SCCACHE=1
3450                 ;;
3451             *)
3452                 # for sharing code below, reuse CCACHE env var
3453                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3454                 if test "$CCACHE" != "not found"; then
3455                     CCACHE=`win_short_path_for_make "$CCACHE"`
3456                     SCCACHE=1
3457                     CCACHE_DEPEND_MODE=1
3458                 fi
3459                 ;;
3460             esac
3461         fi
3462         if test "$CCACHE" = "not found"; then
3463             CCACHE=""
3464         fi
3465         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3466             CCACHE_DEPEND_MODE=1
3467             # Need to check for ccache version: otherwise prevents
3468             # caching of the results (like "-x objective-c++" for Mac)
3469             if test $_os = Darwin -o $_os = iOS; then
3470                 # Check ccache version
3471                 AC_MSG_CHECKING([whether version of ccache is suitable])
3472                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3473                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3474                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3475                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3476                 else
3477                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3478                     CCACHE=""
3479                     CCACHE_DEPEND_MODE=
3480                 fi
3481             fi
3482         fi
3483         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3484             AC_MSG_ERROR([No suitable ccache found])
3485         fi
3486         ;;
3487     esac
3488 else
3489     CCACHE=""
3491 if test "$enable_ccache" = "nodepend"; then
3492     CCACHE_DEPEND_MODE=""
3494 AC_SUBST(CCACHE_DEPEND_MODE)
3496 # sccache defaults are good enough
3497 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3498     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3499     # or (...) max_size = 20.0 G
3500     # -p works with both 4.2 and 4.4
3501     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3502     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3503     if test "$ccache_size" = ""; then
3504         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3505         if test "$ccache_size" = ""; then
3506             ccache_size=0
3507         fi
3508         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3509         if test $ccache_size -lt 1024; then
3510             CCACHE=""
3511             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3512             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3513         else
3514             # warn that ccache may be too small for debug build
3515             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3516             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3517         fi
3518     else
3519         if test $ccache_size -lt 5; then
3520             #warn that ccache may be too small for debug build
3521             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3522             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3523         fi
3524     fi
3527 ENABLE_Z7_DEBUG=
3528 if test "$enable_z7_debug" != no; then
3529     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3530         ENABLE_Z7_DEBUG=TRUE
3531     fi
3532 else
3533     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3534     add_warning "ccache will not work with --disable-z7-debug"
3536 AC_SUBST(ENABLE_Z7_DEBUG)
3538 dnl ===================================================================
3539 dnl  Checks for C compiler,
3540 dnl  The check for the C++ compiler is later on.
3541 dnl ===================================================================
3542 if test "$_os" != "WINNT"; then
3543     GCC_HOME_SET="true"
3544     AC_MSG_CHECKING([gcc home])
3545     if test -z "$with_gcc_home"; then
3546         if test "$enable_icecream" = "yes"; then
3547             if test -d "/usr/lib/icecc/bin"; then
3548                 GCC_HOME="/usr/lib/icecc/"
3549             elif test -d "/usr/libexec/icecc/bin"; then
3550                 GCC_HOME="/usr/libexec/icecc/"
3551             elif test -d "/opt/icecream/bin"; then
3552                 GCC_HOME="/opt/icecream/"
3553             else
3554                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3556             fi
3557         else
3558             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3559             GCC_HOME_SET="false"
3560         fi
3561     else
3562         GCC_HOME="$with_gcc_home"
3563     fi
3564     AC_MSG_RESULT($GCC_HOME)
3565     AC_SUBST(GCC_HOME)
3567     if test "$GCC_HOME_SET" = "true"; then
3568         if test -z "$CC"; then
3569             CC="$GCC_HOME/bin/gcc"
3570             CC_BASE="gcc"
3571         fi
3572         if test -z "$CXX"; then
3573             CXX="$GCC_HOME/bin/g++"
3574             CXX_BASE="g++"
3575         fi
3576     fi
3579 COMPATH=`dirname "$CC"`
3580 if test "$COMPATH" = "."; then
3581     AC_PATH_PROGS(COMPATH, $CC)
3582     dnl double square bracket to get single because of M4 quote...
3583     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3585 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3587 dnl ===================================================================
3588 dnl .NET support
3589 dnl ===================================================================
3590 AC_MSG_CHECKING([whether to build with .NET support])
3591 if test "$enable_dotnet" != "no"; then
3592     if test "$DISABLE_SCRIPTING" = TRUE; then
3593         AC_MSG_RESULT([no, overridden by --disable-scripting])
3594         ENABLE_DOTNET=""
3595         enable_dotnet=no
3596     else
3597         AC_MSG_RESULT([yes])
3598         ENABLE_DOTNET="TRUE"
3599     fi
3600 else
3601     AC_MSG_RESULT([no])
3602     ENABLE_DOTNET=""
3605 if test "$ENABLE_DOTNET" = TRUE; then
3606     AC_PATH_PROG(DOTNET, dotnet)
3607     if test "$DOTNET" != ""; then
3608         AC_MSG_CHECKING([whether .NET SDK is installed])
3609         DOTNET_SDK_VERSION=`dotnet --list-sdks`
3610         if test "$DOTNET_SDK_VERSION" != ""; then
3611             AC_MSG_RESULT([yes])
3612             AC_DEFINE(HAVE_FEATURE_DOTNET)
3613         else
3614             AC_MSG_RESULT([no])
3615             ENABLE_DOTNET=""
3616         fi
3617     else
3618         ENABLE_DOTNET=""
3619     fi
3622 AC_SUBST(ENABLE_DOTNET)
3624 dnl set ENABLE_DOTNET="TRUE" for build-time and run-time .NET support
3625 dnl set ENABLE_DOTNET="" for no .NET support at all
3627 dnl ===================================================================
3628 dnl Java support
3629 dnl ===================================================================
3630 AC_MSG_CHECKING([whether to build with Java support])
3631 javacompiler="javac"
3632 javadoc="javadoc"
3633 if test "$with_java" != "no"; then
3634     if test "$DISABLE_SCRIPTING" = TRUE; then
3635         AC_MSG_RESULT([no, overridden by --disable-scripting])
3636         ENABLE_JAVA=""
3637         with_java=no
3638     else
3639         AC_MSG_RESULT([yes])
3640         ENABLE_JAVA="TRUE"
3641         AC_DEFINE(HAVE_FEATURE_JAVA)
3642     fi
3643 else
3644     AC_MSG_RESULT([no])
3645     ENABLE_JAVA=""
3648 AC_SUBST(ENABLE_JAVA)
3650 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3652 dnl ENABLE_JAVA="" indicate no Java support at all
3654 dnl ===================================================================
3655 dnl Check macOS SDK and compiler
3656 dnl ===================================================================
3658 if test $_os = Darwin; then
3660     # The SDK in the currently selected Xcode should be found.
3662     AC_MSG_CHECKING([what macOS SDK to use])
3663     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3664     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3665     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3666     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3667     # problems that existed in the PPC days with target versions not being respected or random
3668     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3669     # SDK version is enough, no need to do both...
3670     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3671     if test ! -d "$MACOSX_SDK_PATH"; then
3672         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3673     fi
3674     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3675     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3676     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3677     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3678     # 10.10.2 is 101002
3679     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3680     # correct version in case such an old SDK is specified, it will be rejected later anyway
3681     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3682     if test $MACOSX_SDK_VERSION -lt 101500; then
3683         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3684     fi
3685     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3686         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3687     fi
3688     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3690     AC_MSG_CHECKING([what minimum version of macOS to require])
3691     if test "$with_macosx_version_min_required" = "" ; then
3692         if test "$host_cpu" = x86_64; then
3693             with_macosx_version_min_required="10.15";
3694         else
3695             with_macosx_version_min_required="11.0";
3696         fi
3697     fi
3698     # see same notes about MACOSX_SDK_VERSION above
3699     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3700     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3701         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3702     fi
3703     AC_MSG_RESULT([$with_macosx_version_min_required])
3705     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3706     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3707         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3708     else
3709         AC_MSG_RESULT([yes])
3710     fi
3712     # export this so that "xcrun" invocations later return matching values
3713     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3714     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3715     export DEVELOPER_DIR
3716     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3717     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3719     AC_MSG_CHECKING([whether Xcode is new enough])
3720     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3721     my_xcode_ver2=${my_xcode_ver1#Xcode }
3722     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3723     if test "$my_xcode_ver3" -ge 1205; then
3724         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3725         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3726             if test "$my_xcode_ver3" -eq 1500; then
3727                 dnl the bug was already fixed on 15.1 and 15.2 still has the same OS requirements as 15.0
3728                 dnl in other words all affected users could update to a working Xcode version
3729                 AC_MSG_WARN([Use a current version of XCode or bump the minimum deployment target])
3730                 AC_MSG_WARN([[see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking]])
3731                 AC_MSG_ERROR([Xcode 15.0 has a bug in the new linker that causes runtime crashes on macOS 11 - aborting])
3732             fi
3733         fi
3734     else
3735         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3736     fi
3738     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3739     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3741     LIBTOOL=/usr/bin/libtool
3742     INSTALL_NAME_TOOL=install_name_tool
3743     if test -z "$save_CC"; then
3744         stdlib=-stdlib=libc++
3746         AC_MSG_CHECKING([what C compiler to use])
3747         CC="`xcrun -find clang`"
3748         CC_BASE=`first_arg_basename "$CC"`
3749         if test "$host_cpu" = x86_64; then
3750             CC+=" -target x86_64-apple-macos"
3751         else
3752             CC+=" -target arm64-apple-macos"
3753         fi
3754         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3755         AC_MSG_RESULT([$CC])
3757         AC_MSG_CHECKING([what C++ compiler to use])
3758         CXX="`xcrun -find clang++`"
3759         CXX_BASE=`first_arg_basename "$CXX"`
3760         if test "$host_cpu" = x86_64; then
3761             CXX+=" -target x86_64-apple-macos"
3762         else
3763             CXX+=" -target arm64-apple-macos"
3764         fi
3765         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3766         AC_MSG_RESULT([$CXX])
3768         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3769         AR=`xcrun -find ar`
3770         NM=`xcrun -find nm`
3771         STRIP=`xcrun -find strip`
3772         LIBTOOL=`xcrun -find libtool`
3773         RANLIB=`xcrun -find ranlib`
3774     fi
3776     AC_MSG_CHECKING([whether to do code signing])
3778     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3779         AC_MSG_RESULT([no])
3780     else
3781         if test "$enable_macosx_code_signing" = yes; then
3782             # By default use the first suitable certificate (?).
3784             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3785             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3786             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3787             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3788             # "Developer ID Application" one.
3789             identity="Developer ID Application:"
3790         else
3791             identity=$enable_macosx_code_signing
3792         fi
3793         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3794         if test -n "$identity"; then
3795             MACOSX_CODESIGNING_IDENTITY=$identity
3796             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3797             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3798         else
3799             AC_MSG_ERROR([cannot determine identity to use])
3800         fi
3801     fi
3803     AC_MSG_CHECKING([whether to create a Mac App Store package])
3805     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3806         AC_MSG_RESULT([no])
3807     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3808         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3809     else
3810         if test "$enable_macosx_package_signing" = yes; then
3811             # By default use the first suitable certificate.
3812             # It should be a "3rd Party Mac Developer Installer" one
3813             identity="3rd Party Mac Developer Installer:"
3814         else
3815             identity=$enable_macosx_package_signing
3816         fi
3817         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3818         if test -n "$identity"; then
3819             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3820             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3821             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3822         else
3823             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3824         fi
3825     fi
3827     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3828         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3829     fi
3831     AC_MSG_CHECKING([whether to sandbox the application])
3833     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3834         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3835     elif test "$enable_macosx_sandbox" = yes; then
3836         ENABLE_MACOSX_SANDBOX=TRUE
3837         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3838         AC_MSG_RESULT([yes])
3839     else
3840         AC_MSG_RESULT([no])
3841     fi
3843     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3844     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3845     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3847     if test -n "$with_macosx_provisioning_profile" ; then
3848         if test ! -f "$with_macosx_provisioning_profile"; then
3849             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3850         else
3851             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3852             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3853                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3854                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3855                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3856         fi
3857     fi
3859 AC_SUBST(MACOSX_SDK_PATH)
3860 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3861 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3862 AC_SUBST(INSTALL_NAME_TOOL)
3863 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3864 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3865 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3866 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3867 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3868 AC_SUBST(MACOSX_PROVISIONING_INFO)
3869 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3870 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3871 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3873 dnl ===================================================================
3874 dnl Check iOS SDK and compiler
3875 dnl ===================================================================
3877 if test $_os = iOS; then
3878     AC_MSG_CHECKING([what iOS SDK to use])
3880     if test "$enable_ios_simulator" = "yes"; then
3881         platformlc=iphonesimulator
3882         versionmin=-mios-simulator-version-min=14.5
3883     else
3884         platformlc=iphoneos
3885         versionmin=-miphoneos-version-min=14.5
3886     fi
3888     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3890     if ! test -d "$sysroot"; then
3891         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3892     fi
3894     AC_MSG_RESULT($sysroot)
3896     stdlib="-stdlib=libc++"
3898     AC_MSG_CHECKING([what C compiler to use])
3899     CC="`xcrun -find clang`"
3900     CC_BASE=`first_arg_basename "$CC"`
3901     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3902     AC_MSG_RESULT([$CC])
3904     AC_MSG_CHECKING([what C++ compiler to use])
3905     CXX="`xcrun -find clang++`"
3906     CXX_BASE=`first_arg_basename "$CXX"`
3907     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3908     AC_MSG_RESULT([$CXX])
3910     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3911     AR=`xcrun -find ar`
3912     NM=`xcrun -find nm`
3913     STRIP=`xcrun -find strip`
3914     LIBTOOL=`xcrun -find libtool`
3915     RANLIB=`xcrun -find ranlib`
3918 AC_MSG_CHECKING([whether to treat the installation as read-only])
3920 if test $_os = Darwin; then
3921     enable_readonly_installset=yes
3922 elif test "$enable_extensions" != yes; then
3923     enable_readonly_installset=yes
3925 if test "$enable_readonly_installset" = yes; then
3926     AC_MSG_RESULT([yes])
3927     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3928 else
3929     AC_MSG_RESULT([no])
3932 dnl ===================================================================
3933 dnl Structure of install set
3934 dnl ===================================================================
3936 if test $_os = Darwin; then
3937     LIBO_BIN_FOLDER=MacOS
3938     LIBO_ETC_FOLDER=Resources
3939     LIBO_LIBEXEC_FOLDER=MacOS
3940     LIBO_LIB_FOLDER=Frameworks
3941     LIBO_LIB_PYUNO_FOLDER=Resources
3942     LIBO_SHARE_FOLDER=Resources
3943     LIBO_SHARE_HELP_FOLDER=Resources/help
3944     LIBO_SHARE_JAVA_FOLDER=Resources/java
3945     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3946     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3947     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3948     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3949     LIBO_URE_BIN_FOLDER=MacOS
3950     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3951     LIBO_URE_LIB_FOLDER=Frameworks
3952     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3953     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3954 elif test $_os = WINNT; then
3955     LIBO_BIN_FOLDER=program
3956     LIBO_ETC_FOLDER=program
3957     LIBO_LIBEXEC_FOLDER=program
3958     LIBO_LIB_FOLDER=program
3959     LIBO_LIB_PYUNO_FOLDER=program
3960     LIBO_SHARE_FOLDER=share
3961     LIBO_SHARE_HELP_FOLDER=help
3962     LIBO_SHARE_JAVA_FOLDER=program/classes
3963     LIBO_SHARE_PRESETS_FOLDER=presets
3964     LIBO_SHARE_READMES_FOLDER=readmes
3965     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3966     LIBO_SHARE_SHELL_FOLDER=program/shell
3967     LIBO_URE_BIN_FOLDER=program
3968     LIBO_URE_ETC_FOLDER=program
3969     LIBO_URE_LIB_FOLDER=program
3970     LIBO_URE_MISC_FOLDER=program
3971     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3972 else
3973     LIBO_BIN_FOLDER=program
3974     LIBO_ETC_FOLDER=program
3975     LIBO_LIBEXEC_FOLDER=program
3976     LIBO_LIB_FOLDER=program
3977     LIBO_LIB_PYUNO_FOLDER=program
3978     LIBO_SHARE_FOLDER=share
3979     LIBO_SHARE_HELP_FOLDER=help
3980     LIBO_SHARE_JAVA_FOLDER=program/classes
3981     LIBO_SHARE_PRESETS_FOLDER=presets
3982     LIBO_SHARE_READMES_FOLDER=readmes
3983     if test "$enable_fuzzers" != yes; then
3984         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3985     else
3986         LIBO_SHARE_RESOURCE_FOLDER=resource
3987     fi
3988     LIBO_SHARE_SHELL_FOLDER=program/shell
3989     LIBO_URE_BIN_FOLDER=program
3990     LIBO_URE_ETC_FOLDER=program
3991     LIBO_URE_LIB_FOLDER=program
3992     LIBO_URE_MISC_FOLDER=program
3993     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3995 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3996 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3997 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3998 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3999 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
4000 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
4001 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
4002 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
4003 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
4004 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
4005 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
4006 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
4007 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
4008 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
4009 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
4010 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
4012 # Not all of them needed in config_host.mk, add more if need arises
4013 AC_SUBST(LIBO_BIN_FOLDER)
4014 AC_SUBST(LIBO_ETC_FOLDER)
4015 AC_SUBST(LIBO_LIB_FOLDER)
4016 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
4017 AC_SUBST(LIBO_SHARE_FOLDER)
4018 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
4019 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
4020 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
4021 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
4022 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
4023 AC_SUBST(LIBO_URE_BIN_FOLDER)
4024 AC_SUBST(LIBO_URE_ETC_FOLDER)
4025 AC_SUBST(LIBO_URE_LIB_FOLDER)
4026 AC_SUBST(LIBO_URE_MISC_FOLDER)
4027 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
4029 dnl ===================================================================
4030 dnl Windows specific tests and stuff
4031 dnl ===================================================================
4033 reg_get_value()
4035     # Return value: $regvalue
4036     unset regvalue
4038     if test "$build_os" = "wsl"; then
4039         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
4040         return
4041     elif test -n "$WSL_ONLY_AS_HELPER"; then
4042         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
4043         return
4044     fi
4046     local _regentry="/proc/registry${1}/${2}/${3}"
4047     if test -f "$_regentry"; then
4048         # Stop bash complaining about \0 bytes in input, as it can't handle them.
4049         # Registry keys read via /proc/registry* are always \0 terminated!
4050         local _regvalue=$(tr -d '\0' < "$_regentry")
4051         if test $? -eq 0; then
4052             regvalue=$_regvalue
4053         fi
4054     fi
4057 # Get a value from the 32-bit side of the Registry
4058 reg_get_value_32()
4060     reg_get_value "32" "$1" "$2"
4063 # Get a value from the 64-bit side of the Registry
4064 reg_get_value_64()
4066     reg_get_value "64" "$1" "$2"
4069 reg_list_values()
4071     # Return value: $reglist
4072     unset reglist
4074     if test "$build_os" = "wsl"; then
4075         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4076         return
4077     fi
4079     reglist=$(ls "/proc/registry${1}/${2}")
4082 # List values from the 32-bit side of the Registry
4083 reg_list_values_32()
4085     reg_list_values "32" "$1"
4088 # List values from the 64-bit side of the Registry
4089 reg_list_values_64()
4091     reg_list_values "64" "$1"
4094 case "$host_os" in
4095 cygwin*|wsl*)
4096     COM=MSC
4097     OS=WNT
4098     RTL_OS=Windows
4099     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4100         P_SEP=";"
4101     else
4102         P_SEP=:
4103     fi
4104     case "$host_cpu" in
4105     x86_64)
4106         CPUNAME=X86_64
4107         RTL_ARCH=X86_64
4108         PLATFORMID=windows_x86_64
4109         WINDOWS_X64=1
4110         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4111         WIN_HOST_ARCH="x64"
4112         WIN_MULTI_ARCH="x86"
4113         WIN_HOST_BITS=64
4114         ;;
4115     i*86)
4116         CPUNAME=INTEL
4117         RTL_ARCH=x86
4118         PLATFORMID=windows_x86
4119         WIN_HOST_ARCH="x86"
4120         WIN_HOST_BITS=32
4121         WIN_OTHER_ARCH="x64"
4122         ;;
4123     aarch64)
4124         CPUNAME=AARCH64
4125         RTL_ARCH=AARCH64
4126         PLATFORMID=windows_aarch64
4127         WINDOWS_X64=1
4128         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4129         WIN_HOST_ARCH="arm64"
4130         WIN_HOST_BITS=64
4131         with_ucrt_dir=no
4132         ;;
4133     *)
4134         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4135         ;;
4136     esac
4138     case "$build_cpu" in
4139     x86_64) WIN_BUILD_ARCH="x64" ;;
4140     i*86) WIN_BUILD_ARCH="x86" ;;
4141     aarch64) WIN_BUILD_ARCH="arm64" ;;
4142     *)
4143         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4144         ;;
4145     esac
4147     SCPDEFS="$SCPDEFS -D_MSC_VER"
4148     ;;
4149 esac
4151 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4152 # other-arch won't, but wouldn't break the build (x64 on x86).
4153 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4154     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4158 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4159     # To allow building Windows multi-arch releases without cross-tooling
4160     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4161         cross_compiling="yes"
4162     fi
4165 if test "$cross_compiling" = "yes"; then
4166     export CROSS_COMPILING=TRUE
4167     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4168         ENABLE_WASM_STRIP=TRUE
4169     fi
4170     if test "$_os" = "Emscripten"; then
4171         if test "$with_main_module" = "calc"; then
4172             ENABLE_WASM_STRIP_WRITER=TRUE
4173         elif test "$with_main_module" = "writer"; then
4174             ENABLE_WASM_STRIP_CALC=TRUE
4175         fi
4176     fi
4177 else
4178     CROSS_COMPILING=
4179     BUILD_TYPE="$BUILD_TYPE NATIVE"
4181 AC_SUBST(CROSS_COMPILING)
4182 AC_SUBST(ENABLE_WASM_STRIP)
4183 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4184 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4186 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4187 # NOTE: must _not_ be used for bundled external libraries!
4188 ISYSTEM=
4189 if test "$GCC" = "yes"; then
4190     AC_MSG_CHECKING( for -isystem )
4191     save_CFLAGS=$CFLAGS
4192     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4193     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4194     CFLAGS=$save_CFLAGS
4195     if test -n "$ISYSTEM"; then
4196         AC_MSG_RESULT(yes)
4197     else
4198         AC_MSG_RESULT(no)
4199     fi
4201 if test -z "$ISYSTEM"; then
4202     # fall back to using -I
4203     ISYSTEM=-I
4205 AC_SUBST(ISYSTEM)
4207 dnl ===================================================================
4208 dnl  Check which Visual Studio compiler is used
4209 dnl ===================================================================
4211 map_vs_year_to_version()
4213     # Return value: $vsversion
4215     unset vsversion
4217     case $1 in
4218     2019)
4219         vsversion=16;;
4220     2022)
4221         vsversion=17;;
4222     2022preview)
4223         vsversion=17.11;;
4224     *)
4225         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4226     esac
4229 vs_versions_to_check()
4231     # Args: $1 (optional) : versions to check, in the order of preference
4232     # Return value: $vsversions
4234     unset vsversions
4236     if test -n "$1"; then
4237         map_vs_year_to_version "$1"
4238         vsversions=$vsversion
4239     else
4240         # Default version is 2019
4241         vsversions="16"
4242     fi
4245 win_get_env_from_vsdevcmdbat()
4247     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4248     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4249     PathFormat "$VC_PRODUCT_DIR"
4250     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4251     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4252     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4253     local result
4254     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4255         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4256     else
4257         chmod +x $WRAPPERBATCHFILEPATH
4258         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4259     fi
4260     rm -f $WRAPPERBATCHFILEPATH
4261     printf '%s' "$result"
4264 find_ucrt()
4266     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4267     if test -n "$regvalue"; then
4268         PathFormat "$regvalue"
4269         UCRTSDKDIR=$formatted_path_unix
4270         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4271         if test -n "$regvalue"; then
4272             UCRTVERSION="$regvalue".0
4273         fi
4275         # Rest if not exist
4276         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4277           UCRTSDKDIR=
4278         fi
4279     fi
4280     if test -z "$UCRTSDKDIR"; then
4281         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4282         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4283         if test -f "$ide_env_file"; then
4284             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4285             UCRTSDKDIR=$formatted_path_unix
4286             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4287             dnl Hack needed at least by tml:
4288             if test "$UCRTVERSION" = 10.0.15063.0 \
4289                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4290                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4291             then
4292                 UCRTVERSION=10.0.14393.0
4293             fi
4294         else
4295           AC_MSG_ERROR([No UCRT found])
4296         fi
4297     fi
4300 find_msvc()
4302     # Find Visual C++
4303     # Args: $1 (optional) : The VS version year
4304     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4306     unset vctest vctoolset vcnumwithdot vcbuildnumber
4308     vs_versions_to_check "$1"
4309     if test "$build_os" = wsl; then
4310         vswhere="$PROGRAMFILESX86"
4311         if test -z "$vswhere"; then
4312             vswhere="c:\\Program Files (x86)"
4313         fi
4314     elif test -n "$WSL_ONLY_AS_HELPER"; then
4315         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4316     else
4317         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4318     fi
4319     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4320     PathFormat "$vswhere"
4321     vswhere=$formatted_path_unix
4322     for ver in $vsversions; do
4323         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4324         if test -z "$vswhereoutput"; then
4325             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4326         fi
4327         # Fall back to all MS products (this includes VC++ Build Tools)
4328         if ! test -n "$vswhereoutput"; then
4329             AC_MSG_CHECKING([VC++ Build Tools and similar])
4330             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4331         fi
4332         if test -n "$vswhereoutput"; then
4333             PathFormat "$vswhereoutput"
4334             vctest=$formatted_path_unix
4335             break
4336         fi
4337     done
4339     if test -n "$vctest"; then
4340         vcnumwithdot="$ver"
4341         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4342             vcnumwithdot=$vcnumwithdot.0
4343         fi
4344         case "$vcnumwithdot" in
4345         16.0)
4346             vcyear=2019
4347             vctoolset=v142
4348             ;;
4349         17.0 | 17.11)
4350             vcyear=2022
4351             vctoolset=v143
4352             ;;
4353         esac
4354         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4356     fi
4359 test_cl_exe()
4361     AC_MSG_CHECKING([$1 compiler])
4363     CL_EXE_PATH="$2/cl.exe"
4365     if test ! -f "$CL_EXE_PATH"; then
4366         if test "$1" = "multi-arch"; then
4367             AC_MSG_WARN([no compiler (cl.exe) in $2])
4368             return 1
4369         else
4370             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4371         fi
4372     fi
4374     dnl ===========================================================
4375     dnl  Check for the corresponding mspdb*.dll
4376     dnl ===========================================================
4378     # MSVC 15.0 has libraries from 14.0?
4379     mspdbnum="140"
4381     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4382         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4383     fi
4385     # The compiles has to find its shared libraries
4386     OLD_PATH="$PATH"
4387     TEMP_PATH=`cygpath -d "$2"`
4388     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4390     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4391         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4392     fi
4394     PATH="$OLD_PATH"
4396     AC_MSG_RESULT([$CL_EXE_PATH])
4399 SOLARINC=
4400 MSBUILD_PATH=
4401 DEVENV=
4402 if test "$_os" = "WINNT"; then
4403     AC_MSG_CHECKING([Visual C++])
4404     find_msvc "$with_visual_studio"
4405     if test -z "$vctest"; then
4406         if test -n "$with_visual_studio"; then
4407             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4408         else
4409             AC_MSG_ERROR([no Visual Studio installation found])
4410         fi
4411     fi
4412     AC_MSG_RESULT([])
4414     VC_PRODUCT_DIR="$vctest/VC"
4415     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4417     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4418     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4419         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4420         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4421         if test $? -ne 0; then
4422             WIN_MULTI_ARCH=""
4423             WIN_OTHER_ARCH=""
4424         fi
4425     fi
4427     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4428         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4429         test_cl_exe "build" "$MSVC_BUILD_PATH"
4430     fi
4432     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4433         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4434         test_cl_exe "host" "$MSVC_HOST_PATH"
4435     else
4436         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4437     fi
4439     AC_MSG_CHECKING([for short pathname of VC product directory])
4440     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4441     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4443     UCRTSDKDIR=
4444     UCRTVERSION=
4446     AC_MSG_CHECKING([for UCRT location])
4447     find_ucrt
4448     # find_ucrt errors out if it doesn't find it
4449     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4450     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4451     ucrtincpath_formatted=$formatted_path
4452     # SOLARINC is used for external modules and must be set too.
4453     # And no, it's not sufficient to set SOLARINC only, as configure
4454     # itself doesn't honour it.
4455     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4456     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4457     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4458     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4460     AC_SUBST(UCRTSDKDIR)
4461     AC_SUBST(UCRTVERSION)
4463     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4464     # Find the proper version of MSBuild.exe to use based on the VS version
4465     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4466     if test -z "$regvalue" ; then
4467         if test "$WIN_BUILD_ARCH" != "x64"; then
4468             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4469         else
4470             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4471         fi
4472     fi
4473     if test -d "$regvalue" ; then
4474         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4475         AC_MSG_RESULT([$regvalue])
4476     else
4477         AC_MSG_ERROR([MSBuild.exe location not found])
4478     fi
4480     # Find the version of devenv.exe
4481     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4482     DEVENV="$formatted_path"
4483     DEVENV_unix="$formatted_path_unix"
4484     if test ! -e "$DEVENV_unix"; then
4485         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4486     fi
4488     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4489     dnl needed when building CLR code:
4490     if test -z "$MSVC_CXX"; then
4491         # This gives us a posix path with 8.3 filename restrictions
4492         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4493     fi
4495     if test -z "$CC"; then
4496         CC=$MSVC_CXX
4497         CC_BASE=`first_arg_basename "$CC"`
4498     fi
4499     if test -z "$CXX"; then
4500         CXX=$MSVC_CXX
4501         CXX_BASE=`first_arg_basename "$CXX"`
4502     fi
4504     if test -n "$CC"; then
4505         # Remove /cl.exe from CC case insensitive
4506         AC_MSG_NOTICE([found Visual C++ $vcyear])
4508         PathFormat "$COMPATH"
4509         COMPATH="$formatted_path"
4510         COMPATH_unix="$formatted_path_unix"
4511         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4513         VCVER=$vcnumwithdot
4514         VCTOOLSET=$vctoolset
4516         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4517         # are always "better", we list them in reverse chronological order.
4519         case "$vcnumwithdot" in
4520         16.0 | 17.0 | 17.11)
4521             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4522             ;;
4523         esac
4525         # The expectation is that --with-windows-sdk should not need to be used
4526         if test -n "$with_windows_sdk"; then
4527             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4528             *" "$with_windows_sdk" "*)
4529                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4530                 ;;
4531             *)
4532                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4533                 ;;
4534             esac
4535         fi
4537         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4538         ac_objext=obj
4539         ac_exeext=exe
4541     else
4542         AC_MSG_ERROR([Visual C++ not found after all, huh])
4543     fi
4545     # ERROR if VS version < 16.5
4546     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4547     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4548         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4549         // between Visual Studio versions and _MSC_VER:
4550         #if _MSC_VER < 1925
4551         #error
4552         #endif
4553     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4555     # WARN if VS version < 16.10
4556     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4557     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4558         #if _MSC_VER < 1929
4559         #error
4560         #endif
4561     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4563     if test $vs2019_recommended_version = yes; then
4564         AC_MSG_RESULT([yes])
4565     else
4566         AC_MSG_WARN([no])
4567         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."
4568     fi
4570     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4571     # version of the Explorer extension (and maybe other small
4572     # bits, too) needed when installing a 32-bit LibreOffice on a
4573     # 64-bit OS. The 64-bit Explorer extension is a feature that
4574     # has been present since long in OOo. Don't confuse it with
4575     # building LibreOffice itself as 64-bit code.
4577     BUILD_X64=
4578     CXX_X64_BINARY=
4580     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4581         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4582         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4583              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4584         then
4585             BUILD_X64=TRUE
4586             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4587             AC_MSG_RESULT([found])
4588         else
4589             AC_MSG_RESULT([not found])
4590             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4591         fi
4592     elif test "$WIN_HOST_ARCH" = "x64"; then
4593         CXX_X64_BINARY=$CXX
4594     fi
4595     AC_SUBST(BUILD_X64)
4597     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4598     AC_SUBST(CXX_X64_BINARY)
4600     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4601     # needed to support TWAIN scan on both 32- and 64-bit systems
4603     case "$WIN_HOST_ARCH" in
4604     x64)
4605         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4606         if test -n "$CXX_X86_BINARY"; then
4607             BUILD_X86=TRUE
4608             AC_MSG_RESULT([preset])
4609         elif test -n "$WIN_MULTI_ARCH"; then
4610             BUILD_X86=TRUE
4611             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4612             AC_MSG_RESULT([found])
4613         else
4614             AC_MSG_RESULT([not found])
4615             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4616         fi
4617         ;;
4618     x86)
4619         BUILD_X86=TRUE
4620         CXX_X86_BINARY=$MSVC_CXX
4621         ;;
4622     esac
4623     AC_SUBST(BUILD_X86)
4624     AC_SUBST(CXX_X86_BINARY)
4626 AC_SUBST(VCVER)
4627 AC_SUBST(VCTOOLSET)
4628 AC_SUBST(DEVENV)
4629 AC_SUBST(MSVC_CXX)
4631 COM_IS_CLANG=
4632 AC_MSG_CHECKING([whether the compiler is actually Clang])
4633 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4634     #ifndef __clang__
4635     you lose
4636     #endif
4637     int foo=42;
4638     ]])],
4639     [AC_MSG_RESULT([yes])
4640      COM_IS_CLANG=TRUE],
4641     [AC_MSG_RESULT([no])])
4642 AC_SUBST(COM_IS_CLANG)
4644 CLANGVER=
4645 if test "$COM_IS_CLANG" = TRUE; then
4646     AC_MSG_CHECKING([whether Clang is new enough])
4647     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4648         #if !defined __apple_build_version__
4649         #error
4650         #endif
4651         ]])],
4652         [my_apple_clang=yes],[my_apple_clang=])
4653     if test "$my_apple_clang" = yes; then
4654         AC_MSG_RESULT([assumed yes (Apple Clang)])
4655     elif test "$_os" = Emscripten; then
4656         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4657     else
4658         if test "$_os" = WINNT; then
4659             dnl In which case, assume clang-cl:
4660             my_args="/EP /TC"
4661         else
4662             my_args="-E -P"
4663         fi
4664         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4665         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4666         CLANGVER=`echo $clang_version \
4667             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4668         if test "$CLANGVER" -ge 120000; then
4669             AC_MSG_RESULT([yes ($clang_version)])
4670         else
4671             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4672         fi
4673         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4674         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4675     fi
4678 SHOWINCLUDES_PREFIX=
4679 if test "$_os" = WINNT; then
4680     dnl We need to guess the prefix of the -showIncludes output, it can be
4681     dnl localized
4682     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4683     echo "#include <stdlib.h>" > conftest.c
4684     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4685         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4686     rm -f conftest.c conftest.obj
4687     if test -z "$SHOWINCLUDES_PREFIX"; then
4688         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4689     else
4690         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4691     fi
4693 AC_SUBST(SHOWINCLUDES_PREFIX)
4696 # prefix C with ccache if needed
4698 if test "$CCACHE" != ""; then
4699     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4701     AC_LANG_PUSH([C])
4702     save_CFLAGS=$CFLAGS
4703     CFLAGS="$CFLAGS --ccache-skip -O2"
4704     # msvc does not fail on unknown options, check stdout
4705     if test "$COM" = MSC; then
4706         CFLAGS="$CFLAGS -nologo"
4707     fi
4708     save_ac_c_werror_flag=$ac_c_werror_flag
4709     ac_c_werror_flag=yes
4710     dnl an empty program will do, we're checking the compiler flags
4711     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4712                       [use_ccache=yes], [use_ccache=no])
4713     CFLAGS=$save_CFLAGS
4714     ac_c_werror_flag=$save_ac_c_werror_flag
4715     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4716         AC_MSG_RESULT([yes])
4717     else
4718         CC="$CCACHE $CC"
4719         CC_BASE="ccache $CC_BASE"
4720         AC_MSG_RESULT([no])
4721     fi
4722     AC_LANG_POP([C])
4725 # ===================================================================
4726 # check various GCC options that Clang does not support now but maybe
4727 # will somewhen in the future, check them even for GCC, so that the
4728 # flags are set
4729 # ===================================================================
4731 HAVE_GCC_GGDB2=
4732 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4733     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4734     save_CFLAGS=$CFLAGS
4735     CFLAGS="$CFLAGS -Werror -ggdb2"
4736     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4737     CFLAGS=$save_CFLAGS
4738     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4739         AC_MSG_RESULT([yes])
4740     else
4741         AC_MSG_RESULT([no])
4742     fi
4744     if test "$host_cpu" = "m68k"; then
4745         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4746         save_CFLAGS=$CFLAGS
4747         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4748         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4749         CFLAGS=$save_CFLAGS
4750         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4751             AC_MSG_RESULT([yes])
4752         else
4753             AC_MSG_ERROR([no])
4754         fi
4755     fi
4757 AC_SUBST(HAVE_GCC_GGDB2)
4759 dnl ===================================================================
4760 dnl  Test the gcc version
4761 dnl ===================================================================
4762 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4763     AC_MSG_CHECKING([the GCC version])
4764     _gcc_version=`$CC -dumpfullversion`
4765     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4766         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4767     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4769     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4771     if test "$gcc_full_version" -lt 120000; then
4772         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4773     fi
4774 else
4775     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4776     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4777     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4778     # (which reports itself as GCC 4.2.1).
4779     GCC_VERSION=
4781 AC_SUBST(GCC_VERSION)
4783 dnl Set the ENABLE_DBGUTIL variable
4784 dnl ===================================================================
4785 AC_MSG_CHECKING([whether to build with additional debug utilities])
4786 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4787     ENABLE_DBGUTIL="TRUE"
4788     # this is an extra var so it can have different default on different MSVC
4789     # versions (in case there are version specific problems with it)
4790     MSVC_USE_DEBUG_RUNTIME="TRUE"
4792     AC_MSG_RESULT([yes])
4793     # cppunit and graphite expose STL in public headers
4794     if test "$with_system_cppunit" = "yes"; then
4795         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4796     else
4797         with_system_cppunit=no
4798     fi
4799     if test "$with_system_graphite" = "yes"; then
4800         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4801     else
4802         with_system_graphite=no
4803     fi
4804     if test "$with_system_orcus" = "yes"; then
4805         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4806     else
4807         with_system_orcus=no
4808     fi
4809     if test "$with_system_libcmis" = "yes"; then
4810         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4811     else
4812         with_system_libcmis=no
4813     fi
4814     if test "$with_system_hunspell" = "yes"; then
4815         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4816     else
4817         with_system_hunspell=no
4818     fi
4819     if test "$with_system_gpgmepp" = "yes"; then
4820         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4821     else
4822         with_system_gpgmepp=no
4823     fi
4824     if test "$with_system_zxing" = "yes"; then
4825         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4826     else
4827         with_system_zxing=no
4828     fi
4829     if test "$with_system_poppler" = "yes"; then
4830         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4831     else
4832         with_system_poppler=no
4833     fi
4834     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4835     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4836     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4837     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4838     # of those two is using the system variant:
4839     if test "$with_system_libnumbertext" = "yes"; then
4840         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4841     else
4842         with_system_libnumbertext=no
4843     fi
4844     if test "$with_system_libwps" = "yes"; then
4845         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4846     else
4847         with_system_libwps=no
4848     fi
4849 else
4850     ENABLE_DBGUTIL=""
4851     MSVC_USE_DEBUG_RUNTIME=""
4852     AC_MSG_RESULT([no])
4854 AC_SUBST(ENABLE_DBGUTIL)
4855 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4857 dnl Set the ENABLE_DEBUG variable.
4858 dnl ===================================================================
4859 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4860     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4862 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4863     if test -z "$libo_fuzzed_enable_debug"; then
4864         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4865     else
4866         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4867         enable_debug=yes
4868     fi
4871 AC_MSG_CHECKING([whether to do a debug build])
4872 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4873     ENABLE_DEBUG="TRUE"
4874     if test -n "$ENABLE_DBGUTIL" ; then
4875         AC_MSG_RESULT([yes (dbgutil)])
4876     else
4877         AC_MSG_RESULT([yes])
4878     fi
4879 else
4880     ENABLE_DEBUG=""
4881     AC_MSG_RESULT([no])
4883 AC_SUBST(ENABLE_DEBUG)
4885 dnl ===================================================================
4886 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4887 dnl This is done only after compiler checks (need to know if Clang is
4888 dnl used, for different defaults) and after checking if a debug build
4889 dnl is wanted (non-debug builds get the default linker if not explicitly
4890 dnl specified otherwise).
4891 dnl All checks for linker features/options should come after this.
4892 dnl ===================================================================
4893 check_use_ld()
4895     use_ld=-fuse-ld=${1%%:*}
4896     use_ld_path=${1#*:}
4897     if test "$use_ld_path" != "$1"; then
4898         if test "$COM_IS_CLANG" = TRUE; then
4899             if test "$CLANGVER" -ge 120000; then
4900                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4901             else
4902                 use_ld="-fuse-ld=${use_ld_path}"
4903             fi
4904         else
4905             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4906             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4907             # pickup the alternative linker, when called by libtool for linking.
4908             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4909             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4910         fi
4911     fi
4912     use_ld_fail_if_error=$2
4913     use_ld_ok=
4914     AC_MSG_CHECKING([for $use_ld linker support])
4915     use_ld_ldflags_save="$LDFLAGS"
4916     LDFLAGS="$LDFLAGS $use_ld"
4917     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4918 #include <stdio.h>
4919         ],[
4920 printf ("hello world\n");
4921         ])], USE_LD=$use_ld, [])
4922     if test -n "$USE_LD"; then
4923         AC_MSG_RESULT( yes )
4924         use_ld_ok=yes
4925     else
4926         if test -n "$use_ld_fail_if_error"; then
4927             AC_MSG_ERROR( no )
4928         else
4929             AC_MSG_RESULT( no )
4930         fi
4931     fi
4932     if test -n "$use_ld_ok"; then
4933         dnl keep the value of LDFLAGS
4934         return 0
4935     fi
4936     LDFLAGS="$use_ld_ldflags_save"
4937     return 1
4939 USE_LD=
4940 if test "$enable_ld" != "no"; then
4941     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4942         if test -n "$enable_ld"; then
4943             check_use_ld "$enable_ld" fail_if_error
4944         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4945             dnl non-debug builds default to the default linker
4946             true
4947         elif test -n "$COM_IS_CLANG"; then
4948             check_use_ld lld
4949             if test $? -ne 0; then
4950                 check_use_ld gold
4951                 if test $? -ne 0; then
4952                     check_use_ld mold
4953                 fi
4954             fi
4955         else
4956             # For gcc first try gold, new versions also support lld/mold.
4957             check_use_ld gold
4958             if test $? -ne 0; then
4959                 check_use_ld lld
4960                 if test $? -ne 0; then
4961                     check_use_ld mold
4962                 fi
4963             fi
4964         fi
4965         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4966         rm conftest.out
4967         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4968         if test -z "$ld_used"; then
4969             ld_used="unknown"
4970         fi
4971         AC_MSG_CHECKING([for linker that is used])
4972         AC_MSG_RESULT([$ld_used])
4973         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4974             if echo "$ld_used" | grep -q "^GNU ld"; then
4975                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4976                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4977             fi
4978         fi
4979     else
4980         if test "$enable_ld" = "yes"; then
4981             AC_MSG_ERROR([--enable-ld not supported])
4982         fi
4983     fi
4985 AC_SUBST(USE_LD)
4986 AC_SUBST(LD)
4988 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4989 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4990     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4991     bsymbolic_functions_ldflags_save=$LDFLAGS
4992     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4993     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4994 #include <stdio.h>
4995         ],[
4996 printf ("hello world\n");
4997         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4998     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4999         AC_MSG_RESULT( found )
5000     else
5001         AC_MSG_RESULT( not found )
5002     fi
5003     LDFLAGS=$bsymbolic_functions_ldflags_save
5005 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
5007 LD_GC_SECTIONS=
5008 if test "$GCC" = "yes"; then
5009     for flag in "--gc-sections" "-dead_strip"; do
5010         AC_MSG_CHECKING([for $flag linker support])
5011         ldflags_save=$LDFLAGS
5012         LDFLAGS="$LDFLAGS -Wl,$flag"
5013         AC_LINK_IFELSE([AC_LANG_PROGRAM([
5014 #include <stdio.h>
5015             ],[
5016 printf ("hello world\n");
5017             ])],[
5018             LD_GC_SECTIONS="-Wl,$flag"
5019             AC_MSG_RESULT( found )
5020             ], [
5021             AC_MSG_RESULT( not found )
5022             ])
5023         LDFLAGS=$ldflags_save
5024         if test -n "$LD_GC_SECTIONS"; then
5025             break
5026         fi
5027     done
5029 AC_SUBST(LD_GC_SECTIONS)
5031 HAVE_EXTERNAL_DWARF=
5032 if test "$enable_split_debug" != no; then
5033     use_split_debug=
5034     if test -n "$ENABLE_LTO"; then
5035         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
5036     elif test "$enable_split_debug" = yes; then
5037         use_split_debug=1
5038     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
5039     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5040         use_split_debug=1
5041     fi
5042     if test -n "$use_split_debug"; then
5043         if test "$_os" = "Emscripten"; then
5044             TEST_CC_FLAG=-gsplit-dwarf -gpubnames
5045         else
5046             TEST_CC_FLAG=-gsplit-dwarf
5047         fi
5048         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
5049         save_CFLAGS=$CFLAGS
5050         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
5051         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
5052         CFLAGS=$save_CFLAGS
5053         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
5054             AC_MSG_RESULT([yes])
5055         else
5056             if test "$enable_split_debug" = yes; then
5057                 AC_MSG_ERROR([no])
5058             else
5059                 AC_MSG_RESULT([no])
5060             fi
5061         fi
5062     fi
5063     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5064         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5065         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5066     fi
5068 AC_SUBST(HAVE_EXTERNAL_DWARF)
5070 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5071 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5072 save_CFLAGS=$CFLAGS
5073 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5074 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5075 CFLAGS=$save_CFLAGS
5076 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5077     AC_MSG_RESULT([yes])
5078 else
5079     AC_MSG_RESULT([no])
5081 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5083 ENABLE_GDB_INDEX=
5084 if test "$enable_gdb_index" != "no"; then
5085     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5086     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5087         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5088         save_CFLAGS=$CFLAGS
5089         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5090         have_ggnu_pubnames=
5091         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5092         if test "$have_ggnu_pubnames" != "TRUE"; then
5093             if test "$enable_gdb_index" = "yes"; then
5094                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5095             else
5096                 AC_MSG_RESULT( no )
5097             fi
5098         else
5099             AC_MSG_RESULT( yes )
5100             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5101             ldflags_save=$LDFLAGS
5102             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5103             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5104 #include <stdio.h>
5105                 ],[
5106 printf ("hello world\n");
5107                 ])], ENABLE_GDB_INDEX=TRUE, [])
5108             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5109                 AC_MSG_RESULT( yes )
5110             else
5111                 if test "$enable_gdb_index" = "yes"; then
5112                     AC_MSG_ERROR( no )
5113                 else
5114                     AC_MSG_RESULT( no )
5115                 fi
5116             fi
5117             LDFLAGS=$ldflags_save
5118         fi
5119         CFLAGS=$save_CFLAGS
5120         fi
5121     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5122         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5123         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5124     fi
5126 AC_SUBST(ENABLE_GDB_INDEX)
5128 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5129     enable_sal_log=yes
5131 if test "$enable_sal_log" = yes; then
5132     ENABLE_SAL_LOG=TRUE
5134 AC_SUBST(ENABLE_SAL_LOG)
5136 dnl Check for enable symbols option
5137 dnl ===================================================================
5138 AC_MSG_CHECKING([whether to generate debug information])
5139 if test -z "$enable_symbols"; then
5140     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5141         enable_symbols=yes
5142     else
5143         enable_symbols=no
5144     fi
5146 if test "$enable_symbols" = yes; then
5147     ENABLE_SYMBOLS_FOR=all
5148     AC_MSG_RESULT([yes])
5149 elif test "$enable_symbols" = no; then
5150     ENABLE_SYMBOLS_FOR=
5151     AC_MSG_RESULT([no])
5152 else
5153     # Selective debuginfo.
5154     ENABLE_SYMBOLS_FOR="$enable_symbols"
5155     AC_MSG_RESULT([for "$enable_symbols"])
5157 AC_SUBST(ENABLE_SYMBOLS_FOR)
5159 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5160     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5161     AC_MSG_CHECKING([whether enough memory is available for linking])
5162     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5163     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5164     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5165         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5166     else
5167         AC_MSG_RESULT([yes])
5168     fi
5171 ENABLE_OPTIMIZED=
5172 ENABLE_OPTIMIZED_DEBUG=
5173 AC_MSG_CHECKING([whether to compile with optimization flags])
5174 if test -z "$enable_optimized"; then
5175     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5176         enable_optimized=no
5177     else
5178         enable_optimized=yes
5179     fi
5181 if test "$enable_optimized" = yes; then
5182     ENABLE_OPTIMIZED=TRUE
5183     AC_MSG_RESULT([yes])
5184 elif test "$enable_optimized" = debug; then
5185     ENABLE_OPTIMIZED_DEBUG=TRUE
5186     AC_MSG_RESULT([yes (debug)])
5187     HAVE_GCC_OG=
5188     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5189         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5190         save_CFLAGS=$CFLAGS
5191         CFLAGS="$CFLAGS -Werror -Og"
5192         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5193         CFLAGS=$save_CFLAGS
5194         if test "$HAVE_GCC_OG" = "TRUE"; then
5195             AC_MSG_RESULT([yes])
5196         else
5197             AC_MSG_RESULT([no])
5198         fi
5199     fi
5200     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5201         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5202     fi
5203 else
5204     AC_MSG_RESULT([no])
5206 AC_SUBST(ENABLE_OPTIMIZED)
5207 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5210 # determine CPUNAME, OS, ...
5212 case "$host_os" in
5214 cygwin*|wsl*)
5215     # Already handled
5216     ;;
5218 darwin*)
5219     COM=GCC
5220     OS=MACOSX
5221     RTL_OS=MacOSX
5222     P_SEP=:
5224     case "$host_cpu" in
5225     aarch64|arm64)
5226         if test "$enable_ios_simulator" = "yes"; then
5227             OS=iOS
5228         else
5229             CPUNAME=AARCH64
5230             RTL_ARCH=AARCH64
5231             PLATFORMID=macosx_aarch64
5232         fi
5233         ;;
5234     x86_64)
5235         if test "$enable_ios_simulator" = "yes"; then
5236             OS=iOS
5237         fi
5238         CPUNAME=X86_64
5239         RTL_ARCH=X86_64
5240         PLATFORMID=macosx_x86_64
5241         ;;
5242     *)
5243         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5244         ;;
5245     esac
5246     ;;
5248 ios*)
5249     COM=GCC
5250     OS=iOS
5251     RTL_OS=iOS
5252     P_SEP=:
5254     case "$host_cpu" in
5255     aarch64|arm64)
5256         if test "$enable_ios_simulator" = "yes"; then
5257             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5258         fi
5259         ;;
5260     *)
5261         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5262         ;;
5263     esac
5264     CPUNAME=AARCH64
5265     RTL_ARCH=AARCH64
5266     PLATFORMID=ios_arm64
5267     ;;
5269 dragonfly*)
5270     COM=GCC
5271     OS=DRAGONFLY
5272     RTL_OS=DragonFly
5273     P_SEP=:
5275     case "$host_cpu" in
5276     i*86)
5277         CPUNAME=INTEL
5278         RTL_ARCH=x86
5279         PLATFORMID=dragonfly_x86
5280         ;;
5281     x86_64)
5282         CPUNAME=X86_64
5283         RTL_ARCH=X86_64
5284         PLATFORMID=dragonfly_x86_64
5285         ;;
5286     *)
5287         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5288         ;;
5289     esac
5290     ;;
5292 freebsd*)
5293     COM=GCC
5294     RTL_OS=FreeBSD
5295     OS=FREEBSD
5296     P_SEP=:
5298     case "$host_cpu" in
5299     aarch64)
5300         CPUNAME=AARCH64
5301         PLATFORMID=freebsd_aarch64
5302         RTL_ARCH=AARCH64
5303         ;;
5304     i*86)
5305         CPUNAME=INTEL
5306         RTL_ARCH=x86
5307         PLATFORMID=freebsd_x86
5308         ;;
5309     x86_64|amd64)
5310         CPUNAME=X86_64
5311         RTL_ARCH=X86_64
5312         PLATFORMID=freebsd_x86_64
5313         ;;
5314     powerpc64)
5315         CPUNAME=POWERPC64
5316         RTL_ARCH=PowerPC_64
5317         PLATFORMID=freebsd_powerpc64
5318         ;;
5319     powerpc|powerpcspe)
5320         CPUNAME=POWERPC
5321         RTL_ARCH=PowerPC
5322         PLATFORMID=freebsd_powerpc
5323         ;;
5324     *)
5325         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5326         ;;
5327     esac
5328     ;;
5330 haiku*)
5331     COM=GCC
5332     GUIBASE=haiku
5333     RTL_OS=Haiku
5334     OS=HAIKU
5335     P_SEP=:
5337     case "$host_cpu" in
5338     i*86)
5339         CPUNAME=INTEL
5340         RTL_ARCH=x86
5341         PLATFORMID=haiku_x86
5342         ;;
5343     x86_64|amd64)
5344         CPUNAME=X86_64
5345         RTL_ARCH=X86_64
5346         PLATFORMID=haiku_x86_64
5347         ;;
5348     *)
5349         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5350         ;;
5351     esac
5352     ;;
5354 kfreebsd*)
5355     COM=GCC
5356     OS=LINUX
5357     RTL_OS=kFreeBSD
5358     P_SEP=:
5360     case "$host_cpu" in
5362     i*86)
5363         CPUNAME=INTEL
5364         RTL_ARCH=x86
5365         PLATFORMID=kfreebsd_x86
5366         ;;
5367     x86_64)
5368         CPUNAME=X86_64
5369         RTL_ARCH=X86_64
5370         PLATFORMID=kfreebsd_x86_64
5371         ;;
5372     *)
5373         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5374         ;;
5375     esac
5376     ;;
5378 linux-gnu*|linux-musl*)
5379     COM=GCC
5380     OS=LINUX
5381     RTL_OS=Linux
5382     P_SEP=:
5384     case "$host_cpu" in
5386     aarch64)
5387         CPUNAME=AARCH64
5388         PLATFORMID=linux_aarch64
5389         RTL_ARCH=AARCH64
5390         EPM_FLAGS="-a arm64"
5391         ;;
5392     alpha)
5393         CPUNAME=AXP
5394         RTL_ARCH=ALPHA
5395         PLATFORMID=linux_alpha
5396         ;;
5397     arm*)
5398         CPUNAME=ARM
5399         EPM_FLAGS="-a arm"
5400         RTL_ARCH=ARM_EABI
5401         PLATFORMID=linux_arm_eabi
5402         case "$host_cpu" in
5403         arm*-linux)
5404             RTL_ARCH=ARM_OABI
5405             PLATFORMID=linux_arm_oabi
5406             ;;
5407         esac
5408         ;;
5409     hppa)
5410         CPUNAME=HPPA
5411         RTL_ARCH=HPPA
5412         EPM_FLAGS="-a hppa"
5413         PLATFORMID=linux_hppa
5414         ;;
5415     i*86)
5416         CPUNAME=INTEL
5417         RTL_ARCH=x86
5418         PLATFORMID=linux_x86
5419         ;;
5420     ia64)
5421         CPUNAME=IA64
5422         RTL_ARCH=IA64
5423         PLATFORMID=linux_ia64
5424         ;;
5425     mips)
5426         CPUNAME=MIPS
5427         RTL_ARCH=MIPS_EB
5428         EPM_FLAGS="-a mips"
5429         PLATFORMID=linux_mips_eb
5430         ;;
5431     mips64)
5432         CPUNAME=MIPS64
5433         RTL_ARCH=MIPS64_EB
5434         EPM_FLAGS="-a mips64"
5435         PLATFORMID=linux_mips64_eb
5436         ;;
5437     mips64el)
5438         CPUNAME=MIPS64
5439         RTL_ARCH=MIPS64_EL
5440         EPM_FLAGS="-a mips64el"
5441         PLATFORMID=linux_mips64_el
5442         ;;
5443     mipsel)
5444         CPUNAME=MIPS
5445         RTL_ARCH=MIPS_EL
5446         EPM_FLAGS="-a mipsel"
5447         PLATFORMID=linux_mips_el
5448         ;;
5449     riscv64)
5450         CPUNAME=RISCV64
5451         RTL_ARCH=RISCV64
5452         EPM_FLAGS="-a riscv64"
5453         PLATFORMID=linux_riscv64
5454         ;;
5455     m68k)
5456         CPUNAME=M68K
5457         RTL_ARCH=M68K
5458         PLATFORMID=linux_m68k
5459         ;;
5460     powerpc)
5461         CPUNAME=POWERPC
5462         RTL_ARCH=PowerPC
5463         PLATFORMID=linux_powerpc
5464         ;;
5465     powerpc64)
5466         CPUNAME=POWERPC64
5467         RTL_ARCH=PowerPC_64
5468         PLATFORMID=linux_powerpc64
5469         ;;
5470     powerpc64le)
5471         CPUNAME=POWERPC64
5472         RTL_ARCH=PowerPC_64_LE
5473         PLATFORMID=linux_powerpc64_le
5474         ;;
5475     sparc)
5476         CPUNAME=SPARC
5477         RTL_ARCH=SPARC
5478         PLATFORMID=linux_sparc
5479         ;;
5480     sparc64)
5481         CPUNAME=SPARC64
5482         RTL_ARCH=SPARC64
5483         PLATFORMID=linux_sparc64
5484         ;;
5485     s390x)
5486         CPUNAME=S390X
5487         RTL_ARCH=S390x
5488         PLATFORMID=linux_s390x
5489         ;;
5490     x86_64)
5491         CPUNAME=X86_64
5492         RTL_ARCH=X86_64
5493         PLATFORMID=linux_x86_64
5494         ;;
5495     loongarch64)
5496         CPUNAME=LOONGARCH64
5497         RTL_ARCH=LOONGARCH64
5498         PLATFORMID=linux_loongarch64
5499         ;;
5500     *)
5501         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5502         ;;
5503     esac
5504     ;;
5506 linux-android*)
5507     COM=GCC
5508     OS=ANDROID
5509     RTL_OS=Android
5510     P_SEP=:
5512     case "$host_cpu" in
5514     arm|armel)
5515         CPUNAME=ARM
5516         RTL_ARCH=ARM_EABI
5517         PLATFORMID=android_arm_eabi
5518         ;;
5519     aarch64)
5520         CPUNAME=AARCH64
5521         RTL_ARCH=AARCH64
5522         PLATFORMID=android_aarch64
5523         ;;
5524     i*86)
5525         CPUNAME=INTEL
5526         RTL_ARCH=x86
5527         PLATFORMID=android_x86
5528         ;;
5529     x86_64)
5530         CPUNAME=X86_64
5531         RTL_ARCH=X86_64
5532         PLATFORMID=android_x86_64
5533         ;;
5534     *)
5535         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5536         ;;
5537     esac
5538     ;;
5540 *netbsd*)
5541     COM=GCC
5542     OS=NETBSD
5543     RTL_OS=NetBSD
5544     P_SEP=:
5546     case "$host_cpu" in
5547     i*86)
5548         CPUNAME=INTEL
5549         RTL_ARCH=x86
5550         PLATFORMID=netbsd_x86
5551         ;;
5552     powerpc)
5553         CPUNAME=POWERPC
5554         RTL_ARCH=PowerPC
5555         PLATFORMID=netbsd_powerpc
5556         ;;
5557     sparc)
5558         CPUNAME=SPARC
5559         RTL_ARCH=SPARC
5560         PLATFORMID=netbsd_sparc
5561         ;;
5562     x86_64)
5563         CPUNAME=X86_64
5564         RTL_ARCH=X86_64
5565         PLATFORMID=netbsd_x86_64
5566         ;;
5567     *)
5568         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5569         ;;
5570     esac
5571     ;;
5573 openbsd*)
5574     COM=GCC
5575     OS=OPENBSD
5576     RTL_OS=OpenBSD
5577     P_SEP=:
5579     case "$host_cpu" in
5580     i*86)
5581         CPUNAME=INTEL
5582         RTL_ARCH=x86
5583         PLATFORMID=openbsd_x86
5584         ;;
5585     x86_64)
5586         CPUNAME=X86_64
5587         RTL_ARCH=X86_64
5588         PLATFORMID=openbsd_x86_64
5589         ;;
5590     *)
5591         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5592         ;;
5593     esac
5594     SOLARINC="$SOLARINC -I/usr/local/include"
5595     ;;
5597 solaris*)
5598     COM=GCC
5599     OS=SOLARIS
5600     RTL_OS=Solaris
5601     P_SEP=:
5603     case "$host_cpu" in
5604     i*86)
5605         CPUNAME=INTEL
5606         RTL_ARCH=x86
5607         PLATFORMID=solaris_x86
5608         ;;
5609     sparc)
5610         CPUNAME=SPARC
5611         RTL_ARCH=SPARC
5612         PLATFORMID=solaris_sparc
5613         ;;
5614     sparc64)
5615         CPUNAME=SPARC64
5616         RTL_ARCH=SPARC64
5617         PLATFORMID=solaris_sparc64
5618         ;;
5619     *)
5620         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5621         ;;
5622     esac
5623     SOLARINC="$SOLARINC -I/usr/local/include"
5624     ;;
5626 emscripten*)
5627     COM=GCC
5628     OS=EMSCRIPTEN
5629     RTL_OS=Emscripten
5630     P_SEP=:
5632     case "$host_cpu" in
5633     wasm32|wasm64)
5634         ;;
5635     *)
5636         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5637         ;;
5638     esac
5639     CPUNAME=INTEL
5640     RTL_ARCH=x86
5641     PLATFORMID=linux_x86
5642     ;;
5645     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5646     ;;
5647 esac
5649 DISABLE_GUI=""
5650 if test "$enable_gui" = "no"; then
5651     if test "$using_x11" != yes; then
5652         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5653     fi
5654     USING_X11=
5655     DISABLE_GUI=TRUE
5656     test_epoxy=no
5657 else
5658     AC_DEFINE(HAVE_FEATURE_UI)
5660 AC_SUBST(DISABLE_GUI)
5662 if test "$with_x" = "no"; then
5663     USING_X11=
5666 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5667     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5670 if test "$using_x11" = yes; then
5671     if test "$USING_X11" = TRUE; then
5672         AC_DEFINE(USING_X11)
5673     else
5674         disable_x11_tests
5675         if test "$DISABLE_DYNLOADING" = TRUE; then
5676             test_qt5=yes
5677             test_qt6=yes
5678         fi
5679     fi
5680 else
5681     if test "$USING_X11" = TRUE; then
5682         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5683     fi
5686 WORKDIR="${BUILDDIR}/workdir"
5687 INSTDIR="${BUILDDIR}/instdir"
5688 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5689 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5690 AC_SUBST(COM)
5691 AC_SUBST(CPUNAME)
5692 AC_SUBST(RTL_OS)
5693 AC_SUBST(RTL_ARCH)
5694 AC_SUBST(EPM_FLAGS)
5695 AC_SUBST(USING_X11)
5696 AC_SUBST([INSTDIR])
5697 AC_SUBST([INSTROOT])
5698 AC_SUBST([INSTROOTBASE])
5699 AC_SUBST(OS)
5700 AC_SUBST(P_SEP)
5701 AC_SUBST(WORKDIR)
5702 AC_SUBST(PLATFORMID)
5703 AC_SUBST(WINDOWS_X64)
5704 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5705 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5707 if test "$OS" = WNT -a "$COM" = MSC; then
5708     case "$CPUNAME" in
5709     INTEL) CPPU_ENV=msci ;;
5710     X86_64) CPPU_ENV=mscx ;;
5711     AARCH64) CPPU_ENV=msca ;;
5712     *)
5713         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5714         ;;
5715     esac
5716 else
5717     CPPU_ENV=gcc3
5719 AC_SUBST(CPPU_ENV)
5721 dnl ===================================================================
5722 dnl Test which package format to use
5723 dnl ===================================================================
5724 AC_MSG_CHECKING([which package format to use])
5725 if test -n "$with_package_format" -a "$with_package_format" != no; then
5726     for i in $with_package_format; do
5727         case "$i" in
5728         bsd | deb | pkg | rpm | archive | dmg | installed | msi | emscripten)
5729             ;;
5730         *)
5731             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5732 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5733 deb - Debian software distribution
5734 pkg - Solaris software distribution
5735 rpm - RedHat software distribution
5737 LibreOffice additionally supports:
5738 archive - .tar.gz or .zip
5739 dmg - macOS .dmg
5740 emscripten - directory with qt_soffice.html etc.
5741 installed - installation tree
5742 msi - Windows .msi
5743         ])
5744             ;;
5745         esac
5746     done
5747     # fakeroot is needed to ensure correct file ownerships/permissions
5748     # inside deb packages and tar archives created on Linux and Solaris.
5749     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5750         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5751         if test "$FAKEROOT" = "no"; then
5752             AC_MSG_ERROR(
5753                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5754         fi
5755     fi
5756     PKGFORMAT="$with_package_format"
5757     AC_MSG_RESULT([$PKGFORMAT])
5758 else
5759     PKGFORMAT=
5760     AC_MSG_RESULT([none])
5762 AC_SUBST(PKGFORMAT)
5764 dnl ===================================================================
5765 dnl handle help related options
5767 dnl If you change help related options, please update README.help
5768 dnl ===================================================================
5770 ENABLE_HTMLHELP=
5771 HELP_OMINDEX_PAGE=
5772 HELP_ONLINE=
5773 WITH_HELPPACKS=
5775 AC_MSG_CHECKING([which help to build])
5776 if test -n "$with_help" -a "$with_help" != "no"; then
5777     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5778     BUILD_TYPE="$BUILD_TYPE HELP"
5779     case "$with_help" in
5780     "html")
5781         ENABLE_HTMLHELP=TRUE
5782         WITH_HELPPACKS=TRUE
5783         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5784         AC_MSG_RESULT([HTML (local)])
5785         ;;
5786     "online")
5787         ENABLE_HTMLHELP=TRUE
5788         HELP_ONLINE=TRUE
5789         AC_MSG_RESULT([HTML (online)])
5790         ;;
5791     yes)
5792         WITH_HELPPACKS=TRUE
5793         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5794         AC_MSG_RESULT([XML (local)])
5795         ;;
5796     *)
5797         AC_MSG_ERROR([Unknown --with-help=$with_help])
5798         ;;
5799     esac
5800 else
5801     AC_MSG_RESULT([no])
5804 AC_MSG_CHECKING([if we need to build the help index tooling])
5805 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5806     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5807     test_clucene=yes
5808     AC_MSG_RESULT([yes])
5809 else
5810     AC_MSG_RESULT([no])
5813 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5814 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5815     if test "$HELP_ONLINE" != TRUE; then
5816         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5817     fi
5818     case "$with_omindex" in
5819     "server")
5820         HELP_OMINDEX_PAGE=TRUE
5821         AC_MSG_RESULT([SERVER])
5822         ;;
5823     "noxap")
5824         AC_MSG_RESULT([NOXAP])
5825         ;;
5826     *)
5827         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5828         ;;
5829     esac
5830 else
5831     AC_MSG_RESULT([no])
5834 AC_MSG_CHECKING([whether to include the XML-help support])
5835 if test "$enable_xmlhelp" = yes; then
5836     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5837     test_clucene=yes
5838     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5839     AC_MSG_RESULT([yes])
5840 else
5841     if test "$with_help" = yes; then
5842         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5843     fi
5844     AC_MSG_RESULT([no])
5847 dnl Test whether to integrate helppacks into the product's installer
5848 AC_MSG_CHECKING([for helppack integration])
5849 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5850     AC_MSG_RESULT([no integration])
5851 else
5852     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5853     AC_MSG_RESULT([integration])
5856 AC_SUBST([ENABLE_HTMLHELP])
5857 AC_SUBST([HELP_OMINDEX_PAGE])
5858 AC_SUBST([HELP_ONLINE])
5859 # WITH_HELPPACKS is used only in configure
5861 dnl ===================================================================
5862 dnl Set up a different compiler to produce tools to run on the build
5863 dnl machine when doing cross-compilation
5864 dnl ===================================================================
5866 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5867 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5868 if test "$cross_compiling" = "yes"; then
5869     AC_MSG_CHECKING([for BUILD platform configuration])
5870     echo
5871     rm -rf CONF-FOR-BUILD config_build.mk
5872     mkdir CONF-FOR-BUILD
5873     # Here must be listed all files needed when running the configure script. In particular, also
5874     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5875     # keep them in the same order as there.
5876     (cd $SRC_ROOT && tar cf - \
5877         config.guess \
5878         bin/get_config_variables \
5879         solenv/bin/getcompver.awk \
5880         solenv/inc/langlist.mk \
5881         download.lst \
5882         config_host.mk.in \
5883         config_host_lang.mk.in \
5884         Makefile.in \
5885         bin/bffvalidator.sh.in \
5886         bin/odfvalidator.sh.in \
5887         bin/officeotron.sh.in \
5888         instsetoo_native/util/openoffice.lst.in \
5889         config_host/*.in \
5890         sysui/desktop/macosx/Info.plist.in \
5891         sysui/desktop/macosx/hardened_runtime.xcent.in \
5892         sysui/desktop/macosx/lo.xcent.in \
5893         .vscode/vs-code-template.code-workspace.in \
5894         solenv/lockfile/autoconf.h.in \
5895         ) \
5896     | (cd CONF-FOR-BUILD && tar xf -)
5897     cp configure CONF-FOR-BUILD
5898     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5899     (
5900     unset COM USING_X11 OS CPUNAME
5901     unset CC CXX SYSBASE CFLAGS
5902     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5903     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5904     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5905     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5906     if test -n "$CC_FOR_BUILD"; then
5907         export CC="$CC_FOR_BUILD"
5908         CC_BASE=`first_arg_basename "$CC"`
5909     fi
5910     if test -n "$CXX_FOR_BUILD"; then
5911         export CXX="$CXX_FOR_BUILD"
5912         CXX_BASE=`first_arg_basename "$CXX"`
5913     fi
5914     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5915     cd CONF-FOR-BUILD
5917     # Handle host configuration, which affects the cross-toolset too
5918     sub_conf_opts=""
5919     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5920     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5921     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5922     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5923     if test -n "$ENABLE_JAVA"; then
5924         case "$_os" in
5925         Android)
5926             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5927             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5928             ;;
5929         *)
5930             if test -z "$with_jdk_home"; then
5931                 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.])
5932             fi
5933             ;;
5934         esac
5935     else
5936         sub_conf_opts="$sub_conf_opts --without-java"
5937     fi
5938     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5939     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5940     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5941     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5942     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5943     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5944     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5945     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5946     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5947     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5948     if test "$_os" = "Emscripten"; then
5949         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5950         if test "${with_main_module+set}" = set; then
5951             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5952         else
5953             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5954         fi
5955     fi
5956     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5957     # when cross-compiling for aarch64, overriding the defaults below
5958     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5960     # Don't bother having configure look for stuff not needed for the build platform anyway
5961     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5962     sub_conf_defaults=" \
5963         --build="$build_alias" \
5964         --disable-cairo-canvas \
5965         --disable-cups \
5966         --disable-customtarget-components \
5967         --disable-firebird-sdbc \
5968         --disable-gpgmepp \
5969         --disable-gstreamer-1-0 \
5970         --disable-gtk3 \
5971         --disable-gtk4 \
5972         --disable-libcmis \
5973         --disable-mariadb-sdbc \
5974         --disable-nss \
5975         --disable-online-update \
5976         --disable-opencl \
5977         --disable-openssl \
5978         --disable-pdfimport \
5979         --disable-postgresql-sdbc \
5980         --disable-skia \
5981         --disable-xmlhelp \
5982         --enable-dynamic-loading \
5983         --enable-icecream="$enable_icecream" \
5984         --without-gssapi \
5985         --without-doxygen \
5986         --without-tls \
5987         --without-webdav \
5988         --without-x \
5990     # single quotes added for better readability in case of spaces
5991     echo "    Running CONF-FOR-BUILD/configure" \
5992         $sub_conf_defaults \
5993         --with-parallelism="'$with_parallelism'" \
5994         --with-theme="'$with_theme'" \
5995         --with-vendor="'$with_vendor'" \
5996         $sub_conf_opts \
5997         $with_build_platform_configure_options \
5998         --srcdir=$srcdir
6000     ./configure \
6001         $sub_conf_defaults \
6002         --with-parallelism="$with_parallelism" \
6003         --with-theme="$with_theme" \
6004         "--with-vendor=$with_vendor" \
6005         $sub_conf_opts \
6006         $with_build_platform_configure_options \
6007         --srcdir=$srcdir \
6008         2>&1 | sed -e 's/^/    /'
6009     if test [${PIPESTATUS[0]}] -ne 0; then
6010         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
6011     fi
6013     # filter permitted build targets
6014     PERMITTED_BUILD_TARGETS="
6015         ARGON2
6016         AVMEDIA
6017         BOOST
6018         BZIP2
6019         CAIRO
6020         CLUCENE
6021         CURL
6022         DBCONNECTIVITY
6023         DESKTOP
6024         DRAGONBOX
6025         DYNLOADING
6026         EPOXY
6027         EXPAT
6028         FROZEN
6029         GLM
6030         GRAPHITE
6031         HARFBUZZ
6032         HELPTOOLS
6033         ICU
6034         LCMS2
6035         LIBJPEG_TURBO
6036         LIBLANGTAG
6037         LibO
6038         LIBFFI
6039         LIBPN
6040         LIBTIFF
6041         LIBWEBP
6042         LIBXML2
6043         LIBXSLT
6044         MDDS
6045         NATIVE
6046         OPENSSL
6047         ORCUS
6048         PYTHON
6049         REPORTBUILDER
6050         SCRIPTING
6051         ZLIB
6052         ZXCVBN
6054     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
6055     # newlined lists, to use grep as a filter
6056     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
6057     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
6058     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
6059     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
6061     cp config_host.mk ../config_build.mk
6062     cp config_host_lang.mk ../config_build_lang.mk
6063     mv config.log ../config.Build.log
6064     mkdir -p ../config_build
6065     mv config_host/*.h ../config_build
6066     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6068     # all these will get a _FOR_BUILD postfix
6069     DIRECT_FOR_BUILD_SETTINGS="
6070         CC
6071         CPPU_ENV
6072         CXX
6073         ILIB
6074         JAVA_HOME
6075         JAVAIFLAGS
6076         JDK
6077         JDK_SECURITYMANAGER_DISALLOWED
6078         LIBO_BIN_FOLDER
6079         LIBO_LIB_FOLDER
6080         LIBO_URE_LIB_FOLDER
6081         LIBO_URE_MISC_FOLDER
6082         OS
6083         SDKDIRNAME
6084         SYSTEM_LIBXML
6085         SYSTEM_LIBXSLT
6087     # these overwrite host config with build config
6088     OVERWRITING_SETTINGS="
6089         ANT
6090         ANT_HOME
6091         ANT_LIB
6092         JAVA_SOURCE_VER
6093         JAVA_TARGET_VER
6094         JAVACFLAGS
6095         JAVACOMPILER
6096         JAVADOC
6097         JAVADOCISGJDOC
6098         LOCKFILE
6099         SYSTEM_GENBRK
6100         SYSTEM_GENCCODE
6101         SYSTEM_GENCMN
6103     # these need some special handling
6104     EXTRA_HANDLED_SETTINGS="
6105         INSTDIR
6106         INSTROOT
6107         PATH
6108         WORKDIR
6110     OLD_PATH=$PATH
6111     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6112     BUILD_PATH=$PATH
6113     PATH=$OLD_PATH
6115     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6116     echo "$line" >>build-config
6118     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6119         VV='$'$V
6120         VV=`eval "echo $VV"`
6121         if test -n "$VV"; then
6122             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6123             echo "$line" >>build-config
6124         fi
6125     done
6127     for V in $OVERWRITING_SETTINGS; do
6128         VV='$'$V
6129         VV=`eval "echo $VV"`
6130         if test -n "$VV"; then
6131             line=${V}='${'${V}:-$VV'}'
6132             echo "$line" >>build-config
6133         fi
6134     done
6136     for V in INSTDIR INSTROOT WORKDIR; do
6137         VV='$'$V
6138         VV=`eval "echo $VV"`
6139         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6140         if test -n "$VV"; then
6141             line="${V}_FOR_BUILD='$VV'"
6142             echo "$line" >>build-config
6143         fi
6144     done
6146     )
6147     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6148     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])
6149     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6150              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6152     eval `cat CONF-FOR-BUILD/build-config`
6154     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6156     rm -rf CONF-FOR-BUILD
6157 else
6158     OS_FOR_BUILD="$OS"
6159     CC_FOR_BUILD="$CC"
6160     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6161     CXX_FOR_BUILD="$CXX"
6162     INSTDIR_FOR_BUILD="$INSTDIR"
6163     INSTROOT_FOR_BUILD="$INSTROOT"
6164     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6165     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6166     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6167     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6168     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6169     WORKDIR_FOR_BUILD="$WORKDIR"
6171 AC_SUBST(OS_FOR_BUILD)
6172 AC_SUBST(INSTDIR_FOR_BUILD)
6173 AC_SUBST(INSTROOT_FOR_BUILD)
6174 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6175 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6176 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6177 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6178 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6179 AC_SUBST(WORKDIR_FOR_BUILD)
6180 AC_SUBST(CC_FOR_BUILD)
6181 AC_SUBST(CXX_FOR_BUILD)
6182 AC_SUBST(CPPU_ENV_FOR_BUILD)
6184 dnl ===================================================================
6185 dnl Check for lockfile deps
6186 dnl ===================================================================
6187 if test -z "$CROSS_COMPILING"; then
6188     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6189     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6190     AC_MSG_CHECKING([which lockfile binary to use])
6191     case "$with_system_lockfile" in
6192     yes)
6193         AC_MSG_RESULT([external])
6194         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6195         ;;
6196     no)
6197         AC_MSG_RESULT([internal])
6198         ;;
6199     *)
6200         if test -x "$with_system_lockfile"; then
6201             LOCKFILE="$with_system_lockfile"
6202         else
6203             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6204         fi
6205         AC_MSG_RESULT([$with_system_lockfile])
6206         ;;
6207     esac
6210 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6211     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6214 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6215 AC_CHECK_FUNCS([utime utimes])
6216 AC_SUBST(LOCKFILE)
6218 dnl ===================================================================
6219 dnl Check for syslog header
6220 dnl ===================================================================
6221 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6223 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6224 dnl ===================================================================
6225 AC_MSG_CHECKING([whether to turn warnings to errors])
6226 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6227     ENABLE_WERROR="TRUE"
6228     PYTHONWARNINGS="error"
6229     AC_MSG_RESULT([yes])
6230 else
6231     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6232         ENABLE_WERROR="TRUE"
6233         PYTHONWARNINGS="error"
6234         AC_MSG_RESULT([yes])
6235     else
6236         AC_MSG_RESULT([no])
6237     fi
6239 AC_SUBST(ENABLE_WERROR)
6240 AC_SUBST(PYTHONWARNINGS)
6242 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6243 dnl ===================================================================
6244 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6245 if test -z "$enable_assert_always_abort"; then
6246    if test "$ENABLE_DEBUG" = TRUE; then
6247        enable_assert_always_abort=yes
6248    else
6249        enable_assert_always_abort=no
6250    fi
6252 if test "$enable_assert_always_abort" = "yes"; then
6253     ASSERT_ALWAYS_ABORT="TRUE"
6254     AC_MSG_RESULT([yes])
6255 else
6256     ASSERT_ALWAYS_ABORT="FALSE"
6257     AC_MSG_RESULT([no])
6259 AC_SUBST(ASSERT_ALWAYS_ABORT)
6261 # Determine whether to use ooenv for the instdir installation
6262 # ===================================================================
6263 if test $_os != "WINNT" -a $_os != "Darwin"; then
6264     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6265     if test -z "$enable_ooenv"; then
6266         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6267             enable_ooenv=yes
6268         else
6269             enable_ooenv=no
6270         fi
6271     fi
6272     if test "$enable_ooenv" = "no"; then
6273         AC_MSG_RESULT([no])
6274     else
6275         ENABLE_OOENV="TRUE"
6276         AC_MSG_RESULT([yes])
6277     fi
6279 AC_SUBST(ENABLE_OOENV)
6281 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6282     if test "$enable_qt5" = "no"; then
6283         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6284     else
6285         enable_qt5=yes
6286     fi
6289 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6290     if test "$enable_qt6" = "no"; then
6291         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6292     else
6293         enable_qt6=yes
6294     fi
6298 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6299 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6300     AC_MSG_RESULT([yes])
6301     ENABLE_PAGEIN=TRUE
6302     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6303 else
6304     AC_MSG_RESULT([no])
6306 AC_SUBST(ENABLE_PAGEIN)
6309 AC_MSG_CHECKING([whether to enable CPDB support])
6310 ENABLE_CPDB=""
6311 CPDB_CFLAGS=""
6312 CPDB_LIBS=""
6313 if test "$test_cpdb" = yes -a "x$enable_cpdb" = "xyes"; then
6314     ENABLE_CPDB="TRUE"
6315     AC_MSG_RESULT([yes])
6316     PKG_CHECK_MODULES(CPDB, cpdb-frontend)
6317     CPDB_CFLAGS=$(printf '%s' "$CPDB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
6318     FilterLibs "${CPDB_LIBS}"
6319     CPDB_LIBS="${filteredlibs}"
6320     AC_DEFINE([ENABLE_CPDB],[1])
6321 else
6322     AC_MSG_RESULT([no])
6324 AC_SUBST(ENABLE_CPDB)
6325 AC_SUBST(CPDB_LIBS)
6326 AC_SUBST(CPDB_CFLAGS)
6328 dnl ===================================================================
6329 dnl check for cups support
6330 dnl ===================================================================
6332 AC_MSG_CHECKING([whether to enable CUPS support])
6333 if test "$test_cups" = yes -a "$enable_cups" != no; then
6334     ENABLE_CUPS=TRUE
6335     AC_MSG_RESULT([yes])
6337     AC_MSG_CHECKING([whether cups support is present])
6338     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6339     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6340     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6341         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6342     fi
6343 else
6344     AC_MSG_RESULT([no])
6347 AC_SUBST(ENABLE_CUPS)
6349 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6351 dnl whether to find & fetch external tarballs?
6352 dnl ===================================================================
6353 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6354    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6355        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6356    else
6357        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6358    fi
6360 if test -z "$TARFILE_LOCATION"; then
6361     if test -d "$SRC_ROOT/src" ; then
6362         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6363         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6364     fi
6365     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6366 else
6367     AbsolutePath "$TARFILE_LOCATION"
6368     PathFormat "${absolute_path}"
6369     TARFILE_LOCATION="${formatted_path_unix}"
6371 PathFormat "$TARFILE_LOCATION"
6372 TARFILE_LOCATION_NATIVE="$formatted_path"
6373 AC_SUBST(TARFILE_LOCATION)
6374 AC_SUBST(TARFILE_LOCATION_NATIVE)
6376 AC_MSG_CHECKING([whether we want to fetch tarballs])
6377 if test "$enable_fetch_external" != "no"; then
6378     if test "$with_all_tarballs" = "yes"; then
6379         AC_MSG_RESULT([yes, all of them])
6380         DO_FETCH_TARBALLS="ALL"
6381     else
6382         AC_MSG_RESULT([yes, if we use them])
6383         DO_FETCH_TARBALLS="TRUE"
6384     fi
6385 else
6386     AC_MSG_RESULT([no])
6387     DO_FETCH_TARBALLS=
6389 AC_SUBST(DO_FETCH_TARBALLS)
6391 dnl Test whether to include MySpell dictionaries
6392 dnl ===================================================================
6393 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6394 if test "$with_myspell_dicts" = "yes"; then
6395     AC_MSG_RESULT([yes])
6396     WITH_MYSPELL_DICTS=TRUE
6397     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6398     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6399 else
6400     AC_MSG_RESULT([no])
6401     WITH_MYSPELL_DICTS=
6403 AC_SUBST(WITH_MYSPELL_DICTS)
6405 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6406 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6407     if test "$with_system_dicts" = yes; then
6408         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6409     fi
6410     with_system_dicts=no
6413 AC_MSG_CHECKING([whether to use dicts from external paths])
6414 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6415     AC_MSG_RESULT([yes])
6416     SYSTEM_DICTS=TRUE
6417     AC_MSG_CHECKING([for spelling dictionary directory])
6418     if test -n "$with_external_dict_dir"; then
6419         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6420     else
6421         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6422         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6423             DICT_SYSTEM_DIR=file:///usr/share/myspell
6424         fi
6425     fi
6426     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6427     AC_MSG_CHECKING([for hyphenation patterns directory])
6428     if test -n "$with_external_hyph_dir"; then
6429         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6430     else
6431         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6432     fi
6433     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6434     AC_MSG_CHECKING([for thesaurus directory])
6435     if test -n "$with_external_thes_dir"; then
6436         THES_SYSTEM_DIR=file://$with_external_thes_dir
6437     else
6438         THES_SYSTEM_DIR=file:///usr/share/mythes
6439     fi
6440     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6441 else
6442     AC_MSG_RESULT([no])
6443     SYSTEM_DICTS=
6445 AC_SUBST(SYSTEM_DICTS)
6446 AC_SUBST(DICT_SYSTEM_DIR)
6447 AC_SUBST(HYPH_SYSTEM_DIR)
6448 AC_SUBST(THES_SYSTEM_DIR)
6450 dnl ===================================================================
6451 dnl Precompiled headers.
6452 ENABLE_PCH=""
6453 AC_MSG_CHECKING([whether to enable pch feature])
6454 if test -z "$enable_pch"; then
6455     if test "$_os" = "WINNT"; then
6456         # Enabled by default on Windows.
6457         enable_pch=yes
6458         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6459         if test -z "$enable_ccache" -a "$SCCACHE"; then
6460             CCACHE=""
6461         fi
6462     else
6463         enable_pch=no
6464     fi
6466 if test "$enable_pch" != no -a "$_os" = Emscripten; then
6467     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6469 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6470     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6472 if test "$enable_pch" = "system"; then
6473     ENABLE_PCH="1"
6474     AC_MSG_RESULT([yes (system headers)])
6475 elif test "$enable_pch" = "base"; then
6476     ENABLE_PCH="2"
6477     AC_MSG_RESULT([yes (system and base headers)])
6478 elif test "$enable_pch" = "normal"; then
6479     ENABLE_PCH="3"
6480     AC_MSG_RESULT([yes (normal)])
6481 elif test "$enable_pch" = "full"; then
6482     ENABLE_PCH="4"
6483     AC_MSG_RESULT([yes (full)])
6484 elif test "$enable_pch" = "yes"; then
6485     # Pick a suitable default.
6486     if test "$GCC" = "yes"; then
6487         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6488         # while making the PCHs larger and rebuilds more likely.
6489         ENABLE_PCH="2"
6490         AC_MSG_RESULT([yes (system and base headers)])
6491     else
6492         # With MSVC the highest level makes a significant difference,
6493         # and it was the default when there used to be no PCH levels.
6494         ENABLE_PCH="4"
6495         AC_MSG_RESULT([yes (full)])
6496     fi
6497 elif test "$enable_pch" = "no"; then
6498     AC_MSG_RESULT([no])
6499 else
6500     AC_MSG_ERROR([Unknown value for --enable-pch])
6502 AC_SUBST(ENABLE_PCH)
6503 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6504 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6505     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6506     if test "$CCACHE_BIN" != "not found"; then
6507         AC_MSG_CHECKING([ccache version])
6508         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6509         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6510         AC_MSG_RESULT([$CCACHE_VERSION])
6511         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6512         if test "$CCACHE_NUMVER" -gt "030701"; then
6513             AC_MSG_RESULT([yes])
6514         else
6515             AC_MSG_RESULT([no (not newer than 3.7.1)])
6516             CCACHE_DEPEND_MODE=
6517         fi
6518     fi
6521 PCH_INSTANTIATE_TEMPLATES=
6522 if test -n "$ENABLE_PCH"; then
6523     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6524     save_CFLAGS=$CFLAGS
6525     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6526     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6527     CFLAGS=$save_CFLAGS
6528     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6529         AC_MSG_RESULT(yes)
6530     else
6531         AC_MSG_RESULT(no)
6532     fi
6534 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6536 BUILDING_PCH_WITH_OBJ=
6537 if test -n "$ENABLE_PCH"; then
6538     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6539     save_CFLAGS=$CFLAGS
6540     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6541     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6542     CFLAGS=$save_CFLAGS
6543     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6544         AC_MSG_RESULT(yes)
6545     else
6546         AC_MSG_RESULT(no)
6547     fi
6549 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6551 PCH_CODEGEN=
6552 PCH_NO_CODEGEN=
6553 fpch_prefix=
6554 if test "$COM" = MSC; then
6555     fpch_prefix="-Xclang "
6557 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6558     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6559     save_CFLAGS=$CFLAGS
6560     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6561     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6562         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6563     CFLAGS=$save_CFLAGS
6564     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6565     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6566         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6567     CFLAGS=$save_CFLAGS
6568     if test -n "$PCH_CODEGEN"; then
6569         AC_MSG_RESULT(yes)
6570     else
6571         AC_MSG_RESULT(no)
6572     fi
6574 AC_SUBST(PCH_CODEGEN)
6575 AC_SUBST(PCH_NO_CODEGEN)
6576 PCH_DEBUGINFO=
6577 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6578     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6579     save_CFLAGS=$CFLAGS
6580     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6581     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6582     CFLAGS=$save_CFLAGS
6583     if test -n "$PCH_DEBUGINFO"; then
6584         AC_MSG_RESULT(yes)
6585     else
6586         AC_MSG_RESULT(no)
6587     fi
6589 AC_SUBST(PCH_DEBUGINFO)
6591 TAB=`printf '\t'`
6593 AC_MSG_CHECKING([the GNU Make version])
6594 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6595 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6596 if test "$_make_longver" -ge "040000"; then
6597     AC_MSG_RESULT([$GNUMAKE $_make_version])
6598 else
6599     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6602 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6603 STALE_MAKE=
6604 if test "$_make_ver_check" = ""; then
6605    STALE_MAKE=TRUE
6608 HAVE_LD_HASH_STYLE=FALSE
6609 WITH_LINKER_HASH_STYLE=
6610 AC_MSG_CHECKING([for --hash-style gcc linker support])
6611 if test "$GCC" = "yes"; then
6612     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6613         hash_styles="gnu sysv"
6614     elif test "$with_linker_hash_style" = "no"; then
6615         hash_styles=
6616     else
6617         hash_styles="$with_linker_hash_style"
6618     fi
6620     for hash_style in $hash_styles; do
6621         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6622         hash_style_ldflags_save=$LDFLAGS
6623         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6625         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6626             [
6627 #include <stdio.h>
6628             ],[
6629 printf ("");
6630             ])],
6631             [
6632                   HAVE_LD_HASH_STYLE=TRUE
6633                   WITH_LINKER_HASH_STYLE=$hash_style
6634             ],
6635             [HAVE_LD_HASH_STYLE=FALSE],
6636             [HAVE_LD_HASH_STYLE=FALSE])
6637         LDFLAGS=$hash_style_ldflags_save
6638     done
6640     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6641         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6642     else
6643         AC_MSG_RESULT( no )
6644     fi
6645     LDFLAGS=$hash_style_ldflags_save
6646 else
6647     AC_MSG_RESULT( no )
6649 AC_SUBST(HAVE_LD_HASH_STYLE)
6650 AC_SUBST(WITH_LINKER_HASH_STYLE)
6652 dnl ===================================================================
6653 dnl Check whether there's a Perl version available.
6654 dnl ===================================================================
6655 if test -z "$with_perl_home"; then
6656     AC_PATH_PROG(PERL, perl)
6657 else
6658     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6659     _perl_path="$with_perl_home/bin/perl"
6660     if test -x "$_perl_path"; then
6661         PERL=$_perl_path
6662     else
6663         AC_MSG_ERROR([$_perl_path not found])
6664     fi
6667 dnl ===================================================================
6668 dnl Testing for Perl version 5 or greater.
6669 dnl $] is the Perl version variable, it is returned as an integer
6670 dnl ===================================================================
6671 if test "$PERL"; then
6672     AC_MSG_CHECKING([the Perl version])
6673     ${PERL} -e "exit($]);"
6674     _perl_version=$?
6675     if test "$_perl_version" -lt 5; then
6676         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6677     fi
6678     AC_MSG_RESULT([Perl $_perl_version])
6679 else
6680     AC_MSG_ERROR([Perl not found, install Perl 5])
6683 dnl ===================================================================
6684 dnl Testing for required Perl modules
6685 dnl ===================================================================
6687 AC_MSG_CHECKING([for required Perl modules])
6688 perl_use_string="use Cwd ; use Digest::MD5"
6689 if test "$_os" = "WINNT"; then
6690     if test -n "$PKGFORMAT"; then
6691         for i in $PKGFORMAT; do
6692             case "$i" in
6693             msi)
6694                 # for getting fonts versions to use in MSI
6695                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6696                 ;;
6697             esac
6698         done
6699     fi
6701 if test "$with_system_hsqldb" = "yes"; then
6702     perl_use_string="$perl_use_string ; use Archive::Zip"
6704 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6705     # OpenSSL needs that to build
6706     perl_use_string="$perl_use_string ; use FindBin"
6708 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6709     AC_MSG_RESULT([all modules found])
6710 else
6711     AC_MSG_RESULT([failed to find some modules])
6712     # Find out which modules are missing.
6713     for i in $perl_use_string; do
6714         if test "$i" != "use" -a "$i" != ";"; then
6715             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6716                 missing_perl_modules="$missing_perl_modules $i"
6717             fi
6718         fi
6719     done
6720     AC_MSG_ERROR([
6721     The missing Perl modules are: $missing_perl_modules
6722     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6725 dnl ===================================================================
6726 dnl Check for pkg-config
6727 dnl ===================================================================
6728 if test "$_os" != "WINNT"; then
6729     PKG_PROG_PKG_CONFIG
6731 AC_SUBST(PKG_CONFIG)
6732 AC_SUBST(PKG_CONFIG_PATH)
6733 AC_SUBST(PKG_CONFIG_LIBDIR)
6735 if test "$_os" != "WINNT"; then
6737     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6738     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6739     # explicitly. Or put /path/to/compiler in PATH yourself.
6741     toolprefix=gcc
6742     if test "$COM_IS_CLANG" = "TRUE"; then
6743         toolprefix=llvm
6744     fi
6745     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6746     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6747     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6748     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6749     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6750     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6752 AC_SUBST(AR)
6753 AC_SUBST(NM)
6754 AC_SUBST(OBJDUMP)
6755 AC_SUBST(RANLIB)
6756 AC_SUBST(READELF)
6757 AC_SUBST(STRIP)
6759 dnl ===================================================================
6760 dnl pkg-config checks on macOS
6761 dnl ===================================================================
6763 if test $_os = Darwin; then
6764     AC_MSG_CHECKING([for bogus pkg-config])
6765     if test -n "$PKG_CONFIG"; then
6766         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6767             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6768         else
6769             if test "$enable_bogus_pkg_config" = "yes"; then
6770                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6771             else
6772                 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.])
6773             fi
6774         fi
6775     else
6776         AC_MSG_RESULT([no, good])
6777     fi
6780 find_csc()
6782     # Return value: $csctest
6784     unset csctest
6786     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6787     if test -n "$regvalue"; then
6788         csctest=$regvalue
6789         return
6790     fi
6793 find_al()
6795     # Return value: $altest
6797     unset altest
6799     # We need this check to detect 4.6.1 or above.
6800     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6801         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6802         PathFormat "$regvalue"
6803         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6804             altest=$regvalue
6805             return
6806         fi
6807     done
6809     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6810     for x in $reglist; do
6811         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6812         PathFormat "$regvalue"
6813         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6814             altest=$regvalue
6815             return
6816         fi
6817     done
6820 find_dotnetsdk()
6822     unset frametest
6824     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
6825         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6826         if test -n "$regvalue"; then
6827             frametest=$regvalue
6828             return
6829         fi
6830     done
6831     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6834 find_winsdk_version()
6836     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6837     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6839     unset winsdktest winsdkbinsubdir winsdklibsubdir
6841     case "$1" in
6842     8.0|8.0A)
6843         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6844         if test -n "$regvalue"; then
6845             winsdktest=$regvalue
6846             winsdklibsubdir=win8
6847             return
6848         fi
6849         ;;
6850     8.1|8.1A)
6851         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6852         if test -n "$regvalue"; then
6853             winsdktest=$regvalue
6854             winsdklibsubdir=winv6.3
6855             return
6856         fi
6857         ;;
6858     10.0)
6859         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
6860         if test -n "$regvalue"; then
6861             winsdktest=$regvalue
6862             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
6863             if test -n "$regvalue"; then
6864                 winsdkbinsubdir="$regvalue".0
6865                 winsdklibsubdir=$winsdkbinsubdir
6866                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6867                 PathFormat "$tmppath"
6868                 local tmppath_unix=$formatted_path_unix
6869                 # test exist the SDK path
6870                 if test ! -d "$tmppath_unix"; then
6871                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6872                 fi
6873             fi
6874             return
6875         fi
6876         ;;
6877     esac
6880 find_winsdk()
6882     # Return value: From find_winsdk_version
6884     unset winsdktest
6886     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6887         find_winsdk_version $ver
6888         if test -n "$winsdktest"; then
6889             return
6890         fi
6891     done
6894 find_msms()
6896     # Return value: $msmdir
6897     local version="$1"
6899     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6900     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6901     local my_msm_dir
6903     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6905     msmdir=
6906     case "$VCVER" in
6907     16.0 | 17.0 | 17.11)
6908         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6909             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6910             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6911             if test -e "$my_msm_dir${my_msm_file}"; then
6912                 msmdir=$my_msm_dir
6913             fi
6914         done
6915         ;;
6916     esac
6918     if test -n "$msmdir"; then
6919         msmdir=`cygpath -m "$msmdir"`
6920         AC_MSG_RESULT([$msmdir])
6921     else
6922         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6923             AC_MSG_FAILURE([not found])
6924         else
6925             AC_MSG_WARN([not found (check config.log)])
6926             add_warning "MSM ${my_msm_file} not found"
6927         fi
6928     fi
6931 find_msvc_x64_dlls()
6933     # Return value: $msvcdllpath, $msvcdlls
6935     AC_MSG_CHECKING([for MSVC x64 DLL path])
6937     dnl Order crtver in increasing order. Then check the directories returned by
6938     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6939     dnl the result will be the highest CRT version found in the highest directory.
6941     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6942     case "$VCVER" in
6943     16.0 | 17.0 | 17.11)
6944         for crtver in 141 142 143; do
6945             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6946                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6947                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6948                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6949                 fi
6950             done
6951         done
6952         ;;
6953     esac
6954     AC_MSG_RESULT([$msvcdllpath])
6955     AC_MSG_CHECKING([for MSVC x64 DLLs])
6956     msvcdlls="msvcp140.dll vcruntime140.dll"
6957     for dll in $msvcdlls; do
6958         if ! test -f "$msvcdllpath/$dll"; then
6959             AC_MSG_FAILURE([missing $dll])
6960         fi
6961     done
6962     AC_MSG_RESULT([found all ($msvcdlls)])
6965 dnl =========================================
6966 dnl Check for the Windows  SDK.
6967 dnl =========================================
6968 if test "$_os" = "WINNT"; then
6969     AC_MSG_CHECKING([for Windows SDK])
6970     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6971         find_winsdk
6972         WINDOWS_SDK_HOME=$winsdktest
6974         # normalize if found
6975         if test -n "$WINDOWS_SDK_HOME"; then
6976             PathFormat "$WINDOWS_SDK_HOME"
6977             WINDOWS_SDK_HOME=$formatted_path_unix
6978         fi
6980         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6981         # The variable also contains the Windows SDK version
6982         echo $WINDOWS_SDK_LIB_SUBDIR
6983         IFS='.' read -r SDK_v1 SDK_v2 SDK_v3 SDK_v4 <<< "$WINDOWS_SDK_LIB_SUBDIR"
6984         # Assuming maximum of 5 digits for each part and ignoring last part
6985         SDK_NORMALIZED_VER=$((SDK_v1 * 10000000000 + SDK_v2 * 100000 + SDK_v3))
6986         # 10.0.20348.0 is the minimum required version
6987         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
6988             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
6989         fi
6990     fi
6992     if test -n "$WINDOWS_SDK_HOME"; then
6993         # Remove a possible trailing backslash
6994         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6996         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6997              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6998              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6999             have_windows_sdk_headers=yes
7000         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
7001              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
7002              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
7003             have_windows_sdk_headers=yes
7004         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
7005              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
7006              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
7007             have_windows_sdk_headers=yes
7008         else
7009             have_windows_sdk_headers=no
7010         fi
7012         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
7013             have_windows_sdk_libs=yes
7014         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
7015             have_windows_sdk_libs=yes
7016         else
7017             have_windows_sdk_libs=no
7018         fi
7020         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
7021             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
7022 the  Windows SDK are installed.])
7023         fi
7024     fi
7026     if test -z "$WINDOWS_SDK_HOME"; then
7027         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
7028     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
7029         WINDOWS_SDK_VERSION=80
7030         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
7031     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
7032         WINDOWS_SDK_VERSION=81
7033         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
7034     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
7035         WINDOWS_SDK_VERSION=10
7036         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
7037     else
7038         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
7039     fi
7040     PathFormat "$WINDOWS_SDK_HOME"
7041     WINDOWS_SDK_HOME="$formatted_path"
7042     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
7043     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7044         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
7045         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
7046             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
7047         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
7048             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
7049         fi
7050     fi
7052     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
7053     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
7054     dnl but not in v8.0), so allow this to be overridden with a
7055     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
7056     dnl and configuration error if no WiLangId.vbs is found would arguably be
7057     dnl better, but I do not know under which conditions exactly it is needed by
7058     dnl msiglobal.pm:
7059     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
7060         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
7061         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7062             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
7063         fi
7064         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7065             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
7066         fi
7067         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7068             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
7069         fi
7070         PathFormat "$WINDOWS_SDK_WILANGID_unix"
7071         WINDOWS_SDK_WILANGID="$formatted_path"
7072     fi
7073     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
7074         if test -n "$with_package_format" -a "$with_package_format" != no; then
7075             for i in "$with_package_format"; do
7076                 if test "$i" = "msi"; then
7077                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7078                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
7079                     fi
7080                 fi
7081             done
7082         fi
7083     fi
7085 AC_SUBST(WINDOWS_SDK_HOME)
7086 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7087 AC_SUBST(WINDOWS_SDK_VERSION)
7088 AC_SUBST(WINDOWS_SDK_WILANGID)
7090 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7091     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7092     dnl dir, it also determines that dir's path w/o an arch segment if any,
7093     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7094     AC_MSG_CHECKING([for midl.exe])
7096     find_winsdk
7097     PathFormat "$winsdktest"
7098     winsdktest_unix="$formatted_path_unix"
7100     if test -n "$winsdkbinsubdir" \
7101         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7102     then
7103         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7104         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7105     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7106         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7107         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7108     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7109         MIDL_PATH=$winsdktest_unix/Bin
7110         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7111     fi
7112     PathFormat "$MIDL_PATH"
7113     if test ! -f "$formatted_path_unix/midl.exe"; then
7114         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7115     else
7116         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7117     fi
7119     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7120     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7122     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7123          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7124          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7125          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7126     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7127          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7128          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7129          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7130     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7131          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7132          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7133          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7134     else
7135         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7136     fi
7138     PathFormat "$MIDL_PATH"
7139     MIDL_PATH="$formatted_path"
7141     if test "$enable_cli" = yes; then
7142         dnl Check csc.exe
7143         AC_MSG_CHECKING([for csc.exe])
7144         find_csc
7145         PathFormat "$csctest"
7146         csctest_unix="$formatted_path_unix"
7147         if test -f "$csctest_unix/csc.exe"; then
7148             CSC_PATH="$csctest"
7149         fi
7150         if test ! -f "$csctest_unix/csc.exe"; then
7151             AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7152         else
7153             AC_MSG_RESULT([$CSC_PATH/csc.exe])
7154         fi
7155     
7156         CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7157     
7158         dnl Check al.exe
7159         AC_MSG_CHECKING([for al.exe])
7160         if test -n "$winsdkbinsubdir" \
7161             -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7162         then
7163             AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7164         elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7165             AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7166         elif test -f "$winsdktest_unix/Bin/al.exe"; then
7167             AL_PATH="$winsdktest/Bin"
7168         fi
7169     
7170         if test -z "$AL_PATH"; then
7171             find_al
7172             PathFormat "$altest"
7173             altest_unix="$formatted_path_unix"
7174             if test -f "$altest_unix/bin/al.exe"; then
7175                 AL_PATH="$altest/bin"
7176             elif test -f "$altest_unix/al.exe"; then
7177                 AL_PATH="$altest"
7178             fi
7179         fi
7180         PathFormat "$AL_PATH"
7181         if test ! -f "$formatted_path_unix/al.exe"; then
7182             AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7183         else
7184             AC_MSG_RESULT([$AL_PATH/al.exe])
7185         fi
7186     
7187         AL_PATH=`win_short_path_for_make "$AL_PATH"`
7188     
7189         dnl Check mscoree.lib / .NET Framework dir
7190         AC_MSG_CHECKING(.NET Framework)
7191         find_dotnetsdk
7192         PathFormat "$frametest"
7193         frametest="$formatted_path_unix"
7194         if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7195             DOTNET_FRAMEWORK_HOME="$frametest"
7196         else
7197             if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7198                 DOTNET_FRAMEWORK_HOME="$winsdktest"
7199             fi
7200         fi
7201         PathFormat "$DOTNET_FRAMEWORK_HOME"
7202         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
7203             AC_MSG_ERROR([mscoree.lib not found])
7204         fi
7205         AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7206     
7207         PathFormat "$AL_PATH"
7208         AL_PATH="$formatted_path"
7209     
7210         PathFormat "$DOTNET_FRAMEWORK_HOME"
7211         DOTNET_FRAMEWORK_HOME="$formatted_path"
7212     
7213         PathFormat "$CSC_PATH"
7214         CSC_PATH="$formatted_path"
7216         ENABLE_CLI="TRUE"
7217     else
7218         ENABLE_CLI=""
7219     fi
7220 else
7221     ENABLE_CLI=""
7223 AC_SUBST(ENABLE_CLI)
7225 dnl ===================================================================
7226 dnl Testing for C++ compiler and version...
7227 dnl ===================================================================
7229 if test "$_os" != "WINNT"; then
7230     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7231     # see AC_PROG_CC above):
7232     save_CXXFLAGS=$CXXFLAGS
7233     CXXFLAGS=-g
7234     AC_PROG_CXX
7235     CXXFLAGS=$save_CXXFLAGS
7236     if test -z "$CXX_BASE"; then
7237         CXX_BASE=`first_arg_basename "$CXX"`
7238     fi
7241 dnl check for GNU C++ compiler version
7242 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7243     AC_MSG_CHECKING([the GNU C++ compiler version])
7245     _gpp_version=`$CXX -dumpversion`
7246     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7248     if test "$_gpp_majmin" -lt "700"; then
7249         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7250     else
7251         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7252     fi
7254     dnl see https://issuetracker.google.com/issues/36962819
7255         glibcxx_threads=no
7256         AC_LANG_PUSH([C++])
7257         AC_REQUIRE_CPP
7258         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7259         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7260             #include <bits/c++config.h>]],[[
7261             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7262             && !defined(_GLIBCXX__PTHREADS) \
7263             && !defined(_GLIBCXX_HAS_GTHREADS)
7264             choke me
7265             #endif
7266         ]])],[AC_MSG_RESULT([yes])
7267         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7268         AC_LANG_POP([C++])
7269         if test $glibcxx_threads = yes; then
7270             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7271         fi
7273 AC_SUBST(BOOST_CXXFLAGS)
7276 # prefx CXX with ccache if needed
7278 if test "$CCACHE" != ""; then
7279     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7280     AC_LANG_PUSH([C++])
7281     save_CXXFLAGS=$CXXFLAGS
7282     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7283     # msvc does not fail on unknown options, check stdout
7284     if test "$COM" = MSC; then
7285         CXXFLAGS="$CXXFLAGS -nologo"
7286     fi
7287     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7288     ac_cxx_werror_flag=yes
7289     dnl an empty program will do, we're checking the compiler flags
7290     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7291                       [use_ccache=yes], [use_ccache=no])
7292     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7293         AC_MSG_RESULT([yes])
7294     else
7295         CXX="$CCACHE $CXX"
7296         CXX_BASE="ccache $CXX_BASE"
7297         AC_MSG_RESULT([no])
7298     fi
7299     CXXFLAGS=$save_CXXFLAGS
7300     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7301     AC_LANG_POP([C++])
7304 dnl ===================================================================
7305 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7306 dnl ===================================================================
7308 if test "$_os" != "WINNT"; then
7309     AC_PROG_CXXCPP
7311     dnl Check whether there's a C pre-processor.
7312     AC_PROG_CPP
7316 dnl ===================================================================
7317 dnl Find integral type sizes and alignments
7318 dnl ===================================================================
7320 if test "$_os" != "WINNT"; then
7322     AC_CHECK_SIZEOF(long)
7323     AC_CHECK_SIZEOF(short)
7324     AC_CHECK_SIZEOF(int)
7325     AC_CHECK_SIZEOF(long long)
7326     AC_CHECK_SIZEOF(double)
7327     AC_CHECK_SIZEOF(void*)
7328     AC_CHECK_SIZEOF(size_t)
7330     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7331     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7332     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7333     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7334     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7335     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7337     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7338     m4_pattern_allow([AC_CHECK_ALIGNOF])
7339     m4_ifdef([AC_CHECK_ALIGNOF],
7340         [
7341             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7342             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7343             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7344             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7345         ],
7346         [
7347             case "$_os-$host_cpu" in
7348             Linux-i686)
7349                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7350                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7351                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7352                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7353                 ;;
7354             Linux-x86_64)
7355                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7356                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7357                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7358                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7359                 ;;
7360             *)
7361                 if test -z "$ac_cv_alignof_short" -o \
7362                         -z "$ac_cv_alignof_int" -o \
7363                         -z "$ac_cv_alignof_long" -o \
7364                         -z "$ac_cv_alignof_double"; then
7365                    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.])
7366                 fi
7367                 ;;
7368             esac
7369         ])
7371     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7372     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7373     if test $ac_cv_sizeof_long -eq 8; then
7374         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7375     elif test $ac_cv_sizeof_double -eq 8; then
7376         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7377     else
7378         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7379     fi
7381     dnl Check for large file support
7382     AC_SYS_LARGEFILE
7383     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
7384         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7385     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7386         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7387     fi
7388     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7389         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7390     fi
7391 else
7392     # Hardcode for MSVC
7393     SAL_TYPES_SIZEOFSHORT=2
7394     SAL_TYPES_SIZEOFINT=4
7395     SAL_TYPES_SIZEOFLONG=4
7396     SAL_TYPES_SIZEOFLONGLONG=8
7397     if test $WIN_HOST_BITS -eq 32; then
7398         SAL_TYPES_SIZEOFPOINTER=4
7399         SIZEOF_SIZE_T=4
7400     else
7401         SAL_TYPES_SIZEOFPOINTER=8
7402         SIZEOF_SIZE_T=8
7403     fi
7404     SAL_TYPES_ALIGNMENT2=2
7405     SAL_TYPES_ALIGNMENT4=4
7406     SAL_TYPES_ALIGNMENT8=8
7407     LFS_CFLAGS=''
7409 AC_SUBST(LFS_CFLAGS)
7410 AC_SUBST(SIZEOF_SIZE_T)
7412 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7413 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7414 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7415 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7416 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7417 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7418 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7419 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7421 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7422 AC_MSG_CHECKING([whether jumbo sheets are supported])
7423 if test "$_os" != "WINNT"; then
7424     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7425         AC_MSG_RESULT([yes])
7426         ENABLE_JUMBO_SHEETS=TRUE
7427         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7428     else
7429         AC_MSG_RESULT([no])
7430     fi
7431 else
7432     if test $WIN_HOST_BITS -gt 32; then
7433         # 64bit windows is special-cased for tools::Long because long is 32bit
7434         AC_MSG_RESULT([yes])
7435         ENABLE_JUMBO_SHEETS=TRUE
7436         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7437     else
7438         AC_MSG_RESULT([no])
7439     fi
7441 AC_SUBST(ENABLE_JUMBO_SHEETS)
7443 dnl ===================================================================
7444 dnl Check whether to enable runtime optimizations
7445 dnl ===================================================================
7446 ENABLE_RUNTIME_OPTIMIZATIONS=
7447 AC_MSG_CHECKING([whether to enable runtime optimizations])
7448 if test -z "$enable_runtime_optimizations"; then
7449     for i in $CC; do
7450         case $i in
7451         -fsanitize=*)
7452             enable_runtime_optimizations=no
7453             break
7454             ;;
7455         esac
7456     done
7458 if test "$enable_runtime_optimizations" != no; then
7459     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7460     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7461     AC_MSG_RESULT([yes])
7462 else
7463     AC_MSG_RESULT([no])
7465 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7467 dnl ===================================================================
7468 dnl Check if valgrind headers are available
7469 dnl ===================================================================
7470 ENABLE_VALGRIND=
7471 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7472     prev_cppflags=$CPPFLAGS
7473     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7474     # or where does it come from?
7475     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7476     AC_CHECK_HEADER([valgrind/valgrind.h],
7477         [ENABLE_VALGRIND=TRUE])
7478     CPPFLAGS=$prev_cppflags
7480 AC_SUBST([ENABLE_VALGRIND])
7481 if test -z "$ENABLE_VALGRIND"; then
7482     if test "$with_valgrind" = yes; then
7483         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7484     fi
7485     VALGRIND_CFLAGS=
7487 AC_SUBST([VALGRIND_CFLAGS])
7490 dnl ===================================================================
7491 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7492 dnl ===================================================================
7494 # We need at least the sys/sdt.h include header.
7495 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7496 if test "$SDT_H_FOUND" = "TRUE"; then
7497     # Found sys/sdt.h header, now make sure the c++ compiler works.
7498     # Old g++ versions had problems with probes in constructors/destructors.
7499     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7500     AC_LANG_PUSH([C++])
7501     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7502     #include <sys/sdt.h>
7503     class ProbeClass
7504     {
7505     private:
7506       int& ref;
7507       const char *name;
7509     public:
7510       ProbeClass(int& v, const char *n) : ref(v), name(n)
7511       {
7512         DTRACE_PROBE2(_test_, cons, name, ref);
7513       }
7515       void method(int min)
7516       {
7517         DTRACE_PROBE3(_test_, meth, name, ref, min);
7518         ref -= min;
7519       }
7521       ~ProbeClass()
7522       {
7523         DTRACE_PROBE2(_test_, dest, name, ref);
7524       }
7525     };
7526     ]],[[
7527     int i = 64;
7528     DTRACE_PROBE1(_test_, call, i);
7529     ProbeClass inst = ProbeClass(i, "call");
7530     inst.method(24);
7531     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7532           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7533     AC_LANG_POP([C++])
7535 AC_CONFIG_HEADERS([config_host/config_probes.h])
7537 dnl ===================================================================
7538 dnl GCC features
7539 dnl ===================================================================
7540 HAVE_GCC_STACK_CLASH_PROTECTION=
7541 HARDENING_CFLAGS=
7542 HARDENING_OPT_CFLAGS=
7543 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7544     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7545     save_CFLAGS=$CFLAGS
7546     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7547     AC_LINK_IFELSE(
7548         [AC_LANG_PROGRAM(, [[return 0;]])],
7549         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7550         [AC_MSG_RESULT([no])])
7551     CFLAGS=$save_CFLAGS
7553     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7554     save_CFLAGS=$CFLAGS
7555     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7556     if test "$ENABLE_OPTIMIZED" = TRUE; then
7557         CFLAGS="$CFLAGS -O2"
7558     fi
7559     AC_LINK_IFELSE(
7560         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7561         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7562         [AC_MSG_RESULT([no])])
7563     CFLAGS=$save_CFLAGS
7565     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7566     save_CFLAGS=$CFLAGS
7567     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7568     AC_LINK_IFELSE(
7569         [AC_LANG_PROGRAM(, [[return 0;]])],
7570         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7571         [AC_MSG_RESULT([no])])
7572     CFLAGS=$save_CFLAGS
7574     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7575     save_CFLAGS=$CFLAGS
7576     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7577     AC_LINK_IFELSE(
7578         [AC_LANG_PROGRAM(, [[return 0;]])],
7579         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7580         [AC_MSG_RESULT([no])])
7581     CFLAGS=$save_CFLAGS
7583     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7584     save_CFLAGS=$CFLAGS
7585     CFLAGS="$CFLAGS -Werror -fcf-protection"
7586     AC_LINK_IFELSE(
7587         [AC_LANG_PROGRAM(, [[return 0;]])],
7588         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7589         [AC_MSG_RESULT([no])])
7590     CFLAGS=$save_CFLAGS
7592     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7593     save_CFLAGS=$CFLAGS
7594     CFLAGS="$CFLAGS -Werror -mno-avx"
7595     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7596     CFLAGS=$save_CFLAGS
7597     if test "$HAVE_GCC_AVX" = "TRUE"; then
7598         AC_MSG_RESULT([yes])
7599     else
7600         AC_MSG_RESULT([no])
7601     fi
7603     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7604     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7605     int v = 0;
7606     if (__sync_add_and_fetch(&v, 1) != 1 ||
7607         __sync_sub_and_fetch(&v, 1) != 0)
7608         return 1;
7609     __sync_synchronize();
7610     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7611         v != 1)
7612         return 1;
7613     return 0;
7614 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7615     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7616         AC_MSG_RESULT([yes])
7617         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7618     else
7619         AC_MSG_RESULT([no])
7620     fi
7622     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7623     AC_LANG_PUSH([C++])
7624     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7625             #include <cstddef>
7626             #include <cxxabi.h>
7627             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7628         ])], [
7629             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7630             AC_MSG_RESULT([yes])
7631         ], [AC_MSG_RESULT([no])])
7632     AC_LANG_POP([C++])
7634     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7635     AC_LANG_PUSH([C++])
7636     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7637             #include <cstddef>
7638             #include <cxxabi.h>
7639             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7640         ])], [
7641             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7642             AC_MSG_RESULT([yes])
7643         ], [AC_MSG_RESULT([no])])
7644     AC_LANG_POP([C++])
7646     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7647     AC_LANG_PUSH([C++])
7648     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7649             #include <cxxabi.h>
7650             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7651         ])], [
7652             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7653             AC_MSG_RESULT([yes])
7654         ], [AC_MSG_RESULT([no])])
7655     AC_LANG_POP([C++])
7657     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7658     AC_LANG_PUSH([C++])
7659     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7660             #include <cstddef>
7661             #include <cxxabi.h>
7662             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7663         ])], [
7664             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7665             AC_MSG_RESULT([yes])
7666         ], [AC_MSG_RESULT([no])])
7667     AC_LANG_POP([C++])
7669     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7670     AC_LANG_PUSH([C++])
7671     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7672             #include <cstddef>
7673             #include <cxxabi.h>
7674             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7675         ])], [
7676             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7677             AC_MSG_RESULT([yes])
7678         ], [AC_MSG_RESULT([no])])
7679     AC_LANG_POP([C++])
7681     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7682     AC_LANG_PUSH([C++])
7683     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7684             #include <cxxabi.h>
7685             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7686         ])], [
7687             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7688             AC_MSG_RESULT([yes])
7689         ], [AC_MSG_RESULT([no])])
7690     AC_LANG_POP([C++])
7692     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7693     AC_LANG_PUSH([C++])
7694     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7695             #include <cxxabi.h>
7696             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7697         ])], [
7698             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7699             AC_MSG_RESULT([yes])
7700         ], [AC_MSG_RESULT([no])])
7701     AC_LANG_POP([C++])
7703     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7704     AC_LANG_PUSH([C++])
7705     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7706             #include <cxxabi.h>
7707             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7708         ])], [
7709             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7710             AC_MSG_RESULT([yes])
7711         ], [AC_MSG_RESULT([no])])
7712     AC_LANG_POP([C++])
7714     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7715     AC_LANG_PUSH([C++])
7716     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7717             #include <cstddef>
7718             #include <cxxabi.h>
7719             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7720         ])], [
7721             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7722             AC_MSG_RESULT([yes])
7723         ], [AC_MSG_RESULT([no])])
7724     AC_LANG_POP([C++])
7726     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7727     AC_LANG_PUSH([C++])
7728     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7729             #include <cstddef>
7730             #include <cxxabi.h>
7731             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7732         ])], [
7733             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7734             AC_MSG_RESULT([yes])
7735         ], [AC_MSG_RESULT([no])])
7736     AC_LANG_POP([C++])
7739 AC_SUBST(HAVE_GCC_AVX)
7740 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7741 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7742 AC_SUBST(HARDENING_CFLAGS)
7743 AC_SUBST(HARDENING_OPT_CFLAGS)
7745 dnl ===================================================================
7746 dnl Identify the C++ library
7747 dnl ===================================================================
7749 AC_MSG_CHECKING([what the C++ library is])
7750 HAVE_LIBSTDCPP=
7751 HAVE_LIBCPP=
7752 AC_LANG_PUSH([C++])
7753 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7754 #include <utility>
7755 #ifndef __GLIBCXX__
7756 foo bar
7757 #endif
7758 ]])],
7759     [CPP_LIBRARY=GLIBCXX
7760      cpp_library_name="GNU libstdc++"
7761      HAVE_LIBSTDCPP=TRUE
7762     ],
7763     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7764 #include <utility>
7765 #ifndef _LIBCPP_VERSION
7766 foo bar
7767 #endif
7768 ]])],
7769     [CPP_LIBRARY=LIBCPP
7770      cpp_library_name="LLVM libc++"
7771      AC_DEFINE([HAVE_LIBCPP])
7772      HAVE_LIBCPP=TRUE
7773     ],
7774     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7775 #include <utility>
7776 #ifndef _MSC_VER
7777 foo bar
7778 #endif
7779 ]])],
7780     [CPP_LIBRARY=MSVCRT
7781      cpp_library_name="Microsoft"
7782     ],
7783     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7784 AC_MSG_RESULT([$cpp_library_name])
7785 AC_LANG_POP([C++])
7786 AC_SUBST([HAVE_LIBSTDCPP])
7787 AC_SUBST([HAVE_LIBCPP])
7789 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7790 then
7791     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7792     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7793     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7794     # although there will be backwards compatibility).
7795     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7796     # and there would be undefined references to debug functions.
7797     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7798     # So check if debug mode can be used and disable or downgrade it to assertions
7799     # if needed.
7800     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7801     AC_LANG_PUSH([C++])
7802     libcpp_debug_links=
7803     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7804 #define _LIBCPP_DEBUG 0 // only assertions
7805 #include <vector>
7806 int main()
7808     std::vector<int> v;
7809     v.push_back( 1 );
7810     return v[ 3 ];
7812 ]])], [libcpp_debug_links=1])
7813     if test -n "$libcpp_debug_links"; then
7814         # we can use at least assertions, check if debug mode works
7815         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7816 #define _LIBCPP_DEBUG 1 // debug mode
7817 #include <string>
7818 #include <vector>
7819 int foo(const std::vector<int>& v) { return *v.begin(); }
7820 int main()
7822     std::vector<int> v;
7823     v.push_back( 1 );
7824     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7825     return (foo(v) + s.size()) != 0 ? 0 : 1;
7827 ]])],
7828         [AC_MSG_RESULT(yes)
7829          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7830         ],
7831         [AC_MSG_RESULT(no, using only assertions)
7832          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7833         ]
7834         )
7835     else
7836         AC_MSG_RESULT(no)
7837     fi
7838     AC_LANG_POP([C++])
7840 AC_SUBST([LIBCPP_DEBUG])
7842 dnl ===================================================================
7843 dnl Check for gperf
7844 dnl ===================================================================
7845 AC_PATH_PROG(GPERF, gperf)
7846 if test -z "$GPERF"; then
7847     AC_MSG_ERROR([gperf not found but needed. Install it.])
7849 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7850     GPERF=`cygpath -m $GPERF`
7852 AC_MSG_CHECKING([whether gperf is new enough])
7853 my_gperf_ver1=$($GPERF --version | head -n 1)
7854 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7855 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7856 if test "$my_gperf_ver3" -ge 301; then
7857     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7858 else
7859     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7861 AC_SUBST(GPERF)
7863 dnl ===================================================================
7864 dnl Check for system libcmis
7865 dnl ===================================================================
7866 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7868 dnl ===================================================================
7869 dnl C++11
7870 dnl ===================================================================
7872 if test -z "${CXXFLAGS_CXX11+x}"; then
7873     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7874     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7875         if test "$with_latest_c__" = yes; then
7876             CXXFLAGS_CXX11=-std:c++latest
7877         else
7878             CXXFLAGS_CXX11=-std:c++20
7879         fi
7880         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7881     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7882         my_flags='-std=c++20 -std=c++2a'
7883         if test "$with_latest_c__" = yes; then
7884             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7885         fi
7886         for flag in $my_flags; do
7887             if test "$COM" = MSC; then
7888                 flag="-Xclang $flag"
7889             fi
7890             save_CXXFLAGS=$CXXFLAGS
7891             CXXFLAGS="$CXXFLAGS $flag -Werror"
7892             AC_LANG_PUSH([C++])
7893             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7894                 #include <algorithm>
7895                 #include <functional>
7896                 #include <vector>
7898                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7899                     std::sort(v.begin(), v.end(), fn);
7900                 }
7901                 ]])],[CXXFLAGS_CXX11=$flag])
7902             AC_LANG_POP([C++])
7903             CXXFLAGS=$save_CXXFLAGS
7904             if test -n "$CXXFLAGS_CXX11"; then
7905                 break
7906             fi
7907         done
7908     fi
7909     if test -n "$CXXFLAGS_CXX11"; then
7910         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7911     else
7912         AC_MSG_ERROR(no)
7913     fi
7915 AC_SUBST(CXXFLAGS_CXX11)
7917 if test "$GCC" = "yes"; then
7918     save_CXXFLAGS=$CXXFLAGS
7919     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7920     CHECK_L_ATOMIC
7921     CXXFLAGS=$save_CXXFLAGS
7922     AC_SUBST(ATOMIC_LIB)
7925 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7926 save_CXXFLAGS=$CXXFLAGS
7927 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7928 AC_LANG_PUSH([C++])
7930 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7931 #include <stddef.h>
7933 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7935 namespace
7937         struct b
7938         {
7939                 int i;
7940                 int j;
7941         };
7943 ]], [[
7944 struct a
7946         int i;
7947         int j;
7949 a thinga[]={{0,0}, {1,1}};
7950 b thingb[]={{0,0}, {1,1}};
7951 size_t i = sizeof(sal_n_array_size(thinga));
7952 size_t j = sizeof(sal_n_array_size(thingb));
7953 return !(i != 0 && j != 0);
7955     ], [ AC_MSG_RESULT(yes) ],
7956     [ AC_MSG_ERROR(no)])
7957 AC_LANG_POP([C++])
7958 CXXFLAGS=$save_CXXFLAGS
7960 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7961 if test "$GCC" = yes; then
7962     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7963     AC_LANG_PUSH([C++])
7964     save_CXXFLAGS=$CXXFLAGS
7965     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7966     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7967     CXXFLAGS=$save_CXXFLAGS
7968     AC_LANG_POP([C++])
7969     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7970         AC_MSG_RESULT([yes])
7971     else
7972         AC_MSG_RESULT([no])
7973     fi
7975 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7977 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7978 AC_LANG_PUSH([C++])
7979 save_CXXFLAGS=$CXXFLAGS
7980 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7981 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7982         #include <algorithm>
7983         #include <initializer_list>
7984         #include <vector>
7985         template<typename T> class S {
7986         private:
7987             std::vector<T> v_;
7988         public:
7989             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7990         };
7991         constinit S<int> s{3, 2, 1};
7992     ])], [
7993         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7994         AC_MSG_RESULT([yes])
7995     ], [AC_MSG_RESULT([no])])
7996 CXXFLAGS=$save_CXXFLAGS
7997 AC_LANG_POP([C++])
7999 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
8000 AC_LANG_PUSH([C++])
8001 save_CXXFLAGS=$CXXFLAGS
8002 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8003 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8004         struct S1 { S1(S1 &&); };
8005         struct S2: S1 {};
8006         S1 f(S2 s) { return s; }
8007     ])], [
8008         AC_DEFINE([HAVE_P1155R3],[1])
8009         AC_MSG_RESULT([yes])
8010     ], [AC_MSG_RESULT([no])])
8011 CXXFLAGS=$save_CXXFLAGS
8012 AC_LANG_POP([C++])
8014 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
8015 HAVE_CXX20_ATOMIC_REF=
8016 AC_LANG_PUSH([C++])
8017 save_CXXFLAGS=$CXXFLAGS
8018 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
8019 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8020         #include <atomic>
8021         int x;
8022         std::atomic_ref<int> y(x);
8023     ])], [
8024         HAVE_CXX20_ATOMIC_REF=TRUE
8025         AC_MSG_RESULT([yes])
8026     ], [AC_MSG_RESULT([no])])
8027 CXXFLAGS=$save_CXXFLAGS
8028 AC_LANG_POP([C++])
8029 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
8031 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
8032 dnl which is included in -Wextra anyway):
8033 HAVE_WDEPRECATED_COPY_DTOR=
8034 if test "$GCC" = yes; then
8035     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
8036     AC_LANG_PUSH([C++])
8037     save_CXXFLAGS=$CXXFLAGS
8038     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
8039     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8040             HAVE_WDEPRECATED_COPY_DTOR=TRUE
8041             AC_MSG_RESULT([yes])
8042         ], [AC_MSG_RESULT([no])])
8043     CXXFLAGS=$save_CXXFLAGS
8044     AC_LANG_POP([C++])
8046 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
8048 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
8049 dnl uninitialized warning for code like
8051 dnl   OString f();
8052 dnl   boost::optional<OString> * g(bool b) {
8053 dnl       boost::optional<OString> o;
8054 dnl       if (b) o = f();
8055 dnl       return new boost::optional<OString>(o);
8056 dnl   }
8058 dnl (as is e.g. present, in a slightly more elaborate form, in
8059 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
8060 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
8061 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
8062 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8063     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
8064     AC_LANG_PUSH([C++])
8065     save_CXXFLAGS=$CXXFLAGS
8066     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
8067     if test "$ENABLE_OPTIMIZED" = TRUE; then
8068         CXXFLAGS="$CXXFLAGS -O2"
8069     else
8070         CXXFLAGS="$CXXFLAGS -O0"
8071     fi
8072     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8073             #include <new>
8074             void f1(int);
8075             struct S1 {
8076                 ~S1() { f1(n); }
8077                 int n = 0;
8078             };
8079             struct S2 {
8080                 S2() {}
8081                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
8082                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
8083                 void set(S1 s) {
8084                     new (stg) S1(s);
8085                     init = true;
8086                 }
8087                 bool init = false;
8088                 char stg[sizeof (S1)];
8089             } ;
8090             S1 f2();
8091             S2 * f3(bool b) {
8092                 S2 o;
8093                 if (b) o.set(f2());
8094                 return new S2(o);
8095             }
8096         ]])], [AC_MSG_RESULT([no])], [
8097             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8098             AC_MSG_RESULT([yes])
8099         ])
8100     CXXFLAGS=$save_CXXFLAGS
8101     AC_LANG_POP([C++])
8103 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8105 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8106 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8107 dnl hits us e.g. with GCC 10 and --enable-optimized at
8109 dnl   In file included from include/rtl/string.hxx:49,
8110 dnl                    from include/rtl/ustring.hxx:43,
8111 dnl                    from include/osl/file.hxx:35,
8112 dnl                    from include/codemaker/global.hxx:28,
8113 dnl                    from include/codemaker/options.hxx:23,
8114 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8115 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8116 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,
8117 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,
8118 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,
8119 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8120 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8121 dnl      78 |         memcpy( buffer, data, length );
8122 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8123 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8124 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8125     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8126     AC_LANG_PUSH([C++])
8127     save_CXXFLAGS=$CXXFLAGS
8128     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8129     if test "$ENABLE_OPTIMIZED" = TRUE; then
8130         CXXFLAGS="$CXXFLAGS -O2"
8131     else
8132         CXXFLAGS="$CXXFLAGS -O0"
8133     fi
8134     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8135     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8136             void fill(char const * begin, char const * end, char c);
8137             struct q {
8138                 char ids[4];
8139                 char username[6];
8140             };
8141             void test(q & c) {
8142                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8143                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8144             }
8145         ]])], [AC_MSG_RESULT([no])], [
8146             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8147             AC_MSG_RESULT([yes])
8148         ])
8149     CXXFLAGS=$save_CXXFLAGS
8150     AC_LANG_POP([C++])
8152 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8154 HAVE_DLLEXPORTINLINES=
8155 if test "$_os" = "WINNT"; then
8156     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8157     AC_LANG_PUSH([C++])
8158     save_CXXFLAGS=$CXXFLAGS
8159     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8160     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8161             HAVE_DLLEXPORTINLINES=TRUE
8162             AC_MSG_RESULT([yes])
8163         ], [AC_MSG_RESULT([no])])
8164     CXXFLAGS=$save_CXXFLAGS
8165     AC_LANG_POP([C++])
8167 AC_SUBST([HAVE_DLLEXPORTINLINES])
8169 dnl ===================================================================
8170 dnl CPU Intrinsics support - SSE, AVX
8171 dnl ===================================================================
8173 CXXFLAGS_INTRINSICS_SSE2=
8174 CXXFLAGS_INTRINSICS_SSSE3=
8175 CXXFLAGS_INTRINSICS_SSE41=
8176 CXXFLAGS_INTRINSICS_SSE42=
8177 CXXFLAGS_INTRINSICS_AVX=
8178 CXXFLAGS_INTRINSICS_AVX2=
8179 CXXFLAGS_INTRINSICS_AVX512=
8180 CXXFLAGS_INTRINSICS_AVX512F=
8181 CXXFLAGS_INTRINSICS_F16C=
8182 CXXFLAGS_INTRINSICS_FMA=
8184 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8185     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8186     flag_sse2=-msse2
8187     flag_ssse3=-mssse3
8188     flag_sse41=-msse4.1
8189     flag_sse42=-msse4.2
8190     flag_avx=-mavx
8191     flag_avx2=-mavx2
8192     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8193     flag_avx512f=-mavx512f
8194     flag_f16c=-mf16c
8195     flag_fma=-mfma
8196 else
8197     # With MSVC using -arch is in fact not necessary for being able
8198     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8199     # even if compiled with -arch:AVX, the -arch option really only affects
8200     # instructions generated for C/C++ code.
8201     # So use the matching same (or lower) -arch options, but only in order
8202     # to generate the best matching instructions for the C++ code surrounding
8203     # the intrinsics.
8204     # SSE2 is the default for x86/x64, so no need to specify the option.
8205     flag_sse2=
8206     # No specific options for these, use the next lower.
8207     flag_ssse3="$flag_sse2"
8208     flag_sse41="$flag_sse2"
8209     flag_sse42="$flag_sse2"
8210     flag_avx=-arch:AVX
8211     flag_avx2=-arch:AVX2
8212     flag_avx512=-arch:AVX512
8213     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8214     flag_avx512f=-arch:AVX2
8215     # No MSVC options for these.
8216     flag_f16c="$flag_sse2"
8217     flag_fma="$flag_sse2"
8220 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8221 AC_LANG_PUSH([C++])
8222 save_CXXFLAGS=$CXXFLAGS
8223 CXXFLAGS="$CXXFLAGS $flag_sse2"
8224 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8225     #include <emmintrin.h>
8226     int main () {
8227         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8228         c = _mm_xor_si128 (a, b);
8229         return 0;
8230     }
8231     ])],
8232     [can_compile_sse2=yes],
8233     [can_compile_sse2=no])
8234 AC_LANG_POP([C++])
8235 CXXFLAGS=$save_CXXFLAGS
8236 AC_MSG_RESULT([${can_compile_sse2}])
8237 if test "${can_compile_sse2}" = "yes" ; then
8238     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8241 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8242 AC_LANG_PUSH([C++])
8243 save_CXXFLAGS=$CXXFLAGS
8244 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8245 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8246     #include <tmmintrin.h>
8247     int main () {
8248         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8249         c = _mm_maddubs_epi16 (a, b);
8250         return 0;
8251     }
8252     ])],
8253     [can_compile_ssse3=yes],
8254     [can_compile_ssse3=no])
8255 AC_LANG_POP([C++])
8256 CXXFLAGS=$save_CXXFLAGS
8257 AC_MSG_RESULT([${can_compile_ssse3}])
8258 if test "${can_compile_ssse3}" = "yes" ; then
8259     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8262 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8263 AC_LANG_PUSH([C++])
8264 save_CXXFLAGS=$CXXFLAGS
8265 CXXFLAGS="$CXXFLAGS $flag_sse41"
8266 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8267     #include <smmintrin.h>
8268     int main () {
8269         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8270         c = _mm_cmpeq_epi64 (a, b);
8271         return 0;
8272     }
8273     ])],
8274     [can_compile_sse41=yes],
8275     [can_compile_sse41=no])
8276 AC_LANG_POP([C++])
8277 CXXFLAGS=$save_CXXFLAGS
8278 AC_MSG_RESULT([${can_compile_sse41}])
8279 if test "${can_compile_sse41}" = "yes" ; then
8280     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8283 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8284 AC_LANG_PUSH([C++])
8285 save_CXXFLAGS=$CXXFLAGS
8286 CXXFLAGS="$CXXFLAGS $flag_sse42"
8287 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8288     #include <nmmintrin.h>
8289     int main () {
8290         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8291         c = _mm_cmpgt_epi64 (a, b);
8292         return 0;
8293     }
8294     ])],
8295     [can_compile_sse42=yes],
8296     [can_compile_sse42=no])
8297 AC_LANG_POP([C++])
8298 CXXFLAGS=$save_CXXFLAGS
8299 AC_MSG_RESULT([${can_compile_sse42}])
8300 if test "${can_compile_sse42}" = "yes" ; then
8301     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8304 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8305 AC_LANG_PUSH([C++])
8306 save_CXXFLAGS=$CXXFLAGS
8307 CXXFLAGS="$CXXFLAGS $flag_avx"
8308 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8309     #include <immintrin.h>
8310     int main () {
8311         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8312         c = _mm256_xor_ps(a, b);
8313         return 0;
8314     }
8315     ])],
8316     [can_compile_avx=yes],
8317     [can_compile_avx=no])
8318 AC_LANG_POP([C++])
8319 CXXFLAGS=$save_CXXFLAGS
8320 AC_MSG_RESULT([${can_compile_avx}])
8321 if test "${can_compile_avx}" = "yes" ; then
8322     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8325 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8326 AC_LANG_PUSH([C++])
8327 save_CXXFLAGS=$CXXFLAGS
8328 CXXFLAGS="$CXXFLAGS $flag_avx2"
8329 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8330     #include <immintrin.h>
8331     int main () {
8332         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8333         c = _mm256_maddubs_epi16(a, b);
8334         return 0;
8335     }
8336     ])],
8337     [can_compile_avx2=yes],
8338     [can_compile_avx2=no])
8339 AC_LANG_POP([C++])
8340 CXXFLAGS=$save_CXXFLAGS
8341 AC_MSG_RESULT([${can_compile_avx2}])
8342 if test "${can_compile_avx2}" = "yes" ; then
8343     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8346 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8347 AC_LANG_PUSH([C++])
8348 save_CXXFLAGS=$CXXFLAGS
8349 CXXFLAGS="$CXXFLAGS $flag_avx512"
8350 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8351     #include <immintrin.h>
8352     int main () {
8353         __m512i a = _mm512_loadu_si512(0);
8354         __m512d v1 = _mm512_load_pd(0);
8355         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8356         __m512d v2 = _mm512_abs_pd(v1);
8357         return 0;
8358     }
8359     ])],
8360     [can_compile_avx512=yes],
8361     [can_compile_avx512=no])
8362 AC_LANG_POP([C++])
8363 CXXFLAGS=$save_CXXFLAGS
8364 AC_MSG_RESULT([${can_compile_avx512}])
8365 if test "${can_compile_avx512}" = "yes" ; then
8366     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8367     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8370 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8371 AC_LANG_PUSH([C++])
8372 save_CXXFLAGS=$CXXFLAGS
8373 CXXFLAGS="$CXXFLAGS $flag_f16c"
8374 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8375     #include <immintrin.h>
8376     int main () {
8377         __m128i a = _mm_set1_epi32 (0);
8378         __m128 c;
8379         c = _mm_cvtph_ps(a);
8380         return 0;
8381     }
8382     ])],
8383     [can_compile_f16c=yes],
8384     [can_compile_f16c=no])
8385 AC_LANG_POP([C++])
8386 CXXFLAGS=$save_CXXFLAGS
8387 AC_MSG_RESULT([${can_compile_f16c}])
8388 if test "${can_compile_f16c}" = "yes" ; then
8389     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8392 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8393 AC_LANG_PUSH([C++])
8394 save_CXXFLAGS=$CXXFLAGS
8395 CXXFLAGS="$CXXFLAGS $flag_fma"
8396 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8397     #include <immintrin.h>
8398     int main () {
8399         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8400         d = _mm256_fmadd_ps(a, b, c);
8401         return 0;
8402     }
8403     ])],
8404     [can_compile_fma=yes],
8405     [can_compile_fma=no])
8406 AC_LANG_POP([C++])
8407 CXXFLAGS=$save_CXXFLAGS
8408 AC_MSG_RESULT([${can_compile_fma}])
8409 if test "${can_compile_fma}" = "yes" ; then
8410     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8413 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8414 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8415 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8416 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8417 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8418 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8419 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8420 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8421 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8422 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8424 dnl ===================================================================
8425 dnl system stl sanity tests
8426 dnl ===================================================================
8427 if test "$_os" != "WINNT"; then
8429     AC_LANG_PUSH([C++])
8431     save_CPPFLAGS="$CPPFLAGS"
8432     if test -n "$MACOSX_SDK_PATH"; then
8433         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8434     fi
8436     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8437     # only.
8438     if test "$CPP_LIBRARY" = GLIBCXX; then
8439         dnl gcc#19664, gcc#22482, rhbz#162935
8440         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8441         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8442         AC_MSG_RESULT([$stlvisok])
8443         if test "$stlvisok" = "no"; then
8444             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8445         fi
8446     fi
8448     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8449     # when we don't make any dynamic libraries?
8450     if test "$DISABLE_DYNLOADING" = ""; then
8451         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8452         cat > conftestlib1.cc <<_ACEOF
8453 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8454 struct S2: S1<int> { virtual ~S2(); };
8455 S2::~S2() {}
8456 _ACEOF
8457         cat > conftestlib2.cc <<_ACEOF
8458 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8459 struct S2: S1<int> { virtual ~S2(); };
8460 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8461 _ACEOF
8462         gccvisinlineshiddenok=yes
8463         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8464             gccvisinlineshiddenok=no
8465         else
8466             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8467             dnl known to not work with -z defs (unsetting which makes the test
8468             dnl moot, though):
8469             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8470             if test "$COM_IS_CLANG" = TRUE; then
8471                 for i in $CXX $CXXFLAGS; do
8472                     case $i in
8473                     -fsanitize=*)
8474                         my_linkflagsnoundefs=
8475                         break
8476                         ;;
8477                     esac
8478                 done
8479             fi
8480             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8481                 gccvisinlineshiddenok=no
8482             fi
8483         fi
8485         rm -fr libconftest*
8486         AC_MSG_RESULT([$gccvisinlineshiddenok])
8487         if test "$gccvisinlineshiddenok" = "no"; then
8488             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8489         fi
8490     fi
8492    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8493     cat >visibility.cxx <<_ACEOF
8494 #pragma GCC visibility push(hidden)
8495 struct __attribute__ ((visibility ("default"))) TestStruct {
8496   static void Init();
8498 __attribute__ ((visibility ("default"))) void TestFunc() {
8499   TestStruct::Init();
8501 _ACEOF
8502     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8503         gccvisbroken=yes
8504     else
8505         case "$host_cpu" in
8506         i?86|x86_64)
8507             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8508                 gccvisbroken=no
8509             else
8510                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8511                     gccvisbroken=no
8512                 else
8513                     gccvisbroken=yes
8514                 fi
8515             fi
8516             ;;
8517         *)
8518             gccvisbroken=no
8519             ;;
8520         esac
8521     fi
8522     rm -f visibility.s visibility.cxx
8524     AC_MSG_RESULT([$gccvisbroken])
8525     if test "$gccvisbroken" = "yes"; then
8526         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8527     fi
8529     CPPFLAGS="$save_CPPFLAGS"
8531     AC_MSG_CHECKING([if CET endbranch is recognized])
8532 cat > endbr.s <<_ACEOF
8533 endbr32
8534 _ACEOF
8535     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8536     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8537         AC_MSG_RESULT([yes])
8538         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8539     else
8540         AC_MSG_RESULT([no])
8541     fi
8542     rm -f endbr.s endbr.o
8543     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8545     AC_LANG_POP([C++])
8548 dnl ===================================================================
8549 dnl  Clang++ tests
8550 dnl ===================================================================
8552 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8553 if test "$GCC" = "yes"; then
8554     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8555     AC_LANG_PUSH([C++])
8556     save_CXXFLAGS=$CXXFLAGS
8557     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8558     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8559     CXXFLAGS=$save_CXXFLAGS
8560     AC_LANG_POP([C++])
8561     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8562         AC_MSG_RESULT([yes])
8563     else
8564         AC_MSG_RESULT([no])
8565     fi
8567 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8569 dnl ===================================================================
8570 dnl Compiler plugins
8571 dnl ===================================================================
8573 COMPILER_PLUGINS=
8574 # currently only Clang
8576 if test "$COM_IS_CLANG" != "TRUE"; then
8577     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8578         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8579         enable_compiler_plugins=no
8580     fi
8583 COMPILER_PLUGINS_COM_IS_CLANG=
8584 if test "$COM_IS_CLANG" = "TRUE"; then
8585     if test -n "$enable_compiler_plugins"; then
8586         compiler_plugins="$enable_compiler_plugins"
8587     elif test -n "$ENABLE_DBGUTIL"; then
8588         compiler_plugins=test
8589     else
8590         compiler_plugins=no
8591     fi
8592     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8593         if test "$CLANGVER" -lt 120001; then
8594             if test "$compiler_plugins" = yes; then
8595                 AC_MSG_ERROR(
8596                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8597             else
8598                 compiler_plugins=no
8599             fi
8600         fi
8601     fi
8602     if test "$compiler_plugins" != "no"; then
8603         dnl The prefix where Clang resides, override to where Clang resides if
8604         dnl using a source build:
8605         if test -z "$CLANGDIR"; then
8606             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8607         fi
8608         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8609         if test -z "$COMPILER_PLUGINS_CXX"; then
8610             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8611         fi
8612         clangbindir=$CLANGDIR/bin
8613         if test "$build_os" = "cygwin"; then
8614             clangbindir=$(cygpath -u "$clangbindir")
8615         fi
8616         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8617         if test -n "$LLVM_CONFIG"; then
8618             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8619             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8620             if test -z "$CLANGLIBDIR"; then
8621                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8622             fi
8623             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8624             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8625             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8626                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8627                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8628                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8629                 fi
8630             fi
8631             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8632             clangobjdir=$($LLVM_CONFIG --obj-root)
8633             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8634                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8635             fi
8636         fi
8637         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8638         AC_LANG_PUSH([C++])
8639         save_CXX=$CXX
8640         save_CXXCPP=$CXXCPP
8641         save_CPPFLAGS=$CPPFLAGS
8642         save_CXXFLAGS=$CXXFLAGS
8643         save_LDFLAGS=$LDFLAGS
8644         save_LIBS=$LIBS
8645         CXX=$COMPILER_PLUGINS_CXX
8646         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8647         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8648         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8649         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8650             [COMPILER_PLUGINS=TRUE],
8651             [
8652             if test "$compiler_plugins" = "yes"; then
8653                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8654             else
8655                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8656                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8657             fi
8658             ])
8659         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8660         dnl comment in compilerplugins/Makefile-clang.mk:
8661         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8662             LDFLAGS=""
8663             AC_MSG_CHECKING([for clang libraries to use])
8664             if test -z "$CLANGTOOLLIBS"; then
8665                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8666                 AC_LINK_IFELSE([
8667                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8668                         [[ clang::FullSourceLoc().dump(); ]])
8669                 ],[CLANGTOOLLIBS="$LIBS"],[])
8670             fi
8671             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8672             dnl list of individual -lclang* (but note that that list can become outdated over time,
8673             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8674             dnl needs to include -lclangSupport now"):
8675             if test -z "$CLANGTOOLLIBS"; then
8676                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8677  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8678                 AC_LINK_IFELSE([
8679                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8680                         [[ clang::FullSourceLoc().dump(); ]])
8681                 ],[CLANGTOOLLIBS="$LIBS"],[])
8682             fi
8683             AC_MSG_RESULT([$CLANGTOOLLIBS])
8684             if test -z "$CLANGTOOLLIBS"; then
8685                 if test "$compiler_plugins" = "yes"; then
8686                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8687                 else
8688                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8689                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8690                 fi
8691                 COMPILER_PLUGINS=
8692             fi
8693             if test -n "$COMPILER_PLUGINS"; then
8694                 if test -z "$CLANGSYSINCLUDE"; then
8695                     if test -n "$LLVM_CONFIG"; then
8696                         # Path to the clang system headers (no idea if there's a better way to get it).
8697                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8698                     fi
8699                 fi
8700             fi
8701         fi
8702         CXX=$save_CXX
8703         CXXCPP=$save_CXXCPP
8704         CPPFLAGS=$save_CPPFLAGS
8705         CXXFLAGS=$save_CXXFLAGS
8706         LDFLAGS=$save_LDFLAGS
8707         LIBS="$save_LIBS"
8708         AC_LANG_POP([C++])
8710         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8711         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8712             #ifndef __clang__
8713             you lose
8714             #endif
8715             int foo=42;
8716             ]])],
8717             [AC_MSG_RESULT([yes])
8718              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8719             [AC_MSG_RESULT([no])])
8720         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8721     fi
8722 else
8723     if test "$enable_compiler_plugins" = "yes"; then
8724         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8725     fi
8727 COMPILER_PLUGINS_ANALYZER_PCH=
8728 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8729     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8731 AC_SUBST(COMPILER_PLUGINS)
8732 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8733 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8734 AC_SUBST(COMPILER_PLUGINS_CXX)
8735 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8736 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8737 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8738 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8739 AC_SUBST(CLANGDIR)
8740 AC_SUBST(CLANGLIBDIR)
8741 AC_SUBST(CLANGTOOLLIBS)
8742 AC_SUBST(CLANGSYSINCLUDE)
8744 # Plugin to help linker.
8745 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8746 # This makes --enable-lto build with clang work.
8747 AC_SUBST(LD_PLUGIN)
8749 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8750 AC_SUBST(HAVE_POSIX_FALLOCATE)
8752 JITC_PROCESSOR_TYPE=""
8753 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8754     # IBMs JDK needs this...
8755     JITC_PROCESSOR_TYPE=6
8756     export JITC_PROCESSOR_TYPE
8758 AC_SUBST([JITC_PROCESSOR_TYPE])
8760 # Misc Windows Stuff
8761 AC_ARG_WITH(ucrt-dir,
8762     AS_HELP_STRING([--with-ucrt-dir],
8763         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8764         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8765         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8766             Windows6.1-KB2999226-x64.msu
8767             Windows6.1-KB2999226-x86.msu
8768             Windows8.1-KB2999226-x64.msu
8769             Windows8.1-KB2999226-x86.msu
8770             Windows8-RT-KB2999226-x64.msu
8771             Windows8-RT-KB2999226-x86.msu
8772         A zip archive including those files is available from Microsoft site:
8773         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8776 UCRT_REDISTDIR="$with_ucrt_dir"
8777 if test $_os = "WINNT"; then
8778     find_msvc_x64_dlls
8779     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8780     MSVC_DLLS="$msvcdlls"
8781     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8782         with_redist=143
8783     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8784         with_redist=142
8785     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8786         with_redist=141
8787     fi
8788     for i in $PKGFORMAT; do
8789         if test "$i" = msi; then
8790             find_msms "$with_redist"
8791             if test -n "$msmdir"; then
8792                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8793                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8794             fi
8795             break
8796         fi
8797     done
8799     if test "$UCRT_REDISTDIR" = "no"; then
8800         dnl explicitly disabled
8801         UCRT_REDISTDIR=""
8802     else
8803         PathFormat "$UCRT_REDISTDIR"
8804         UCRT_REDISTDIR="$formatted_path"
8805         UCRT_REDISTDIR_unix="$formatted_path_unix"
8806         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8807                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8808                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8809                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8810                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8811                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8812             UCRT_REDISTDIR=""
8813             if test -n "$PKGFORMAT"; then
8814                for i in $PKGFORMAT; do
8815                    case "$i" in
8816                    msi)
8817                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8818                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8819                        ;;
8820                    esac
8821                done
8822             fi
8823         fi
8824     fi
8827 AC_SUBST(UCRT_REDISTDIR)
8828 AC_SUBST(MSVC_DLL_PATH)
8829 AC_SUBST(MSVC_DLLS)
8830 AC_SUBST(MSM_PATH)
8833 dnl ===================================================================
8834 dnl Checks for Java
8835 dnl ===================================================================
8836 if test "$ENABLE_JAVA" != ""; then
8838     # Windows-specific tests
8839     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8840         if test -z "$with_jdk_home"; then
8841             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8842             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8843             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8844             if test -n "$regvalue"; then
8845                 ver=$regvalue
8846                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8847                 with_jdk_home=$regvalue
8848             fi
8849             howfound="found automatically"
8850         else
8851             howfound="you passed"
8852         fi
8853         PathFormat "$with_jdk_home"
8854         with_jdk_home="$formatted_path_unix"
8856         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8857             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])
8858         fi
8859         with_java="java.exe"
8860         javacompiler="javac.exe"
8861         javadoc="javadoc.exe"
8862     fi
8864     # 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.
8865     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8866     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8867         with_jdk_home=`/usr/libexec/java_home`
8868     fi
8870     JAVA_HOME=; export JAVA_HOME
8871     if test -z "$with_jdk_home"; then
8872         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8873     else
8874         _java_path="$with_jdk_home/bin/$with_java"
8875         dnl Check if there is a Java interpreter at all.
8876         if test -x "$_java_path"; then
8877             JAVAINTERPRETER=$_java_path
8878         else
8879             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8880         fi
8881     fi
8883     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8884     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8885     dnl loaded by java to run JunitTests:
8886     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8887         shortjdkhome=`cygpath -d "$with_jdk_home"`
8888         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
8889             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8890             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8891         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
8892             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8893             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8894         fi
8896         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8897             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8898         fi
8899         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8900     elif test "$cross_compiling" != "yes"; then
8901         case $CPUNAME in
8902             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8903                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8904                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8905                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8906                 fi
8907                 ;;
8908             *) # assumption: everything else 32-bit
8909                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8910                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8911                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8912                 fi
8913                 ;;
8914         esac
8915     fi
8918 dnl ===================================================================
8919 dnl Checks for JDK.
8920 dnl ===================================================================
8922 # Whether all the complexity here actually is needed any more or not, no idea.
8924 JDK_SECURITYMANAGER_DISALLOWED=
8925 MODULAR_JAVA=
8926 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8927     _gij_longver=0
8928     AC_MSG_CHECKING([the installed JDK])
8929     if test -n "$JAVAINTERPRETER"; then
8930         dnl java -version sends output to stderr!
8931         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8932             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8933         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8934             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8935         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8936             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8937         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8938             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8939         else
8940             JDK=sun
8942             dnl Sun JDK specific tests
8943             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8944             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8946             if test "$_jdk_ver" -lt 10800; then
8947                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
8948             fi
8949             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8950             dnl completely removed in some Java version > 18 (see
8951             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8952             if test "$_jdk_ver" -ge 180000; then
8953                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8954             fi
8956             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8957             if test "$_os" = "WINNT"; then
8958                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8959             fi
8960             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8962             dnl Check whether the build Java supports modules
8963             if test "$_jdk_ver" -ge 90000; then
8964                 MODULAR_JAVA=TRUE
8965             else
8966                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
8967                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
8968             fi
8970             # set to limit VM usage for JunitTests
8971             JAVAIFLAGS=-Xmx64M
8972             # set to limit VM usage for javac
8973             JAVACFLAGS=-J-Xmx128M
8974         fi
8975     else
8976         AC_MSG_ERROR([Java not found. You need at least JDK 8])
8977     fi
8978 else
8979     if test -z "$ENABLE_JAVA"; then
8980         dnl Java disabled
8981         JAVA_HOME=
8982         export JAVA_HOME
8983     elif test "$cross_compiling" = "yes"; then
8984         # Just assume compatibility of build and host JDK
8985         JDK=$JDK_FOR_BUILD
8986         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8987     fi
8990 dnl ===================================================================
8991 dnl Checks for javac
8992 dnl ===================================================================
8993 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8994     : ${JAVA_SOURCE_VER=8}
8995     : ${JAVA_TARGET_VER=8}
8996     if test -z "$with_jdk_home"; then
8997         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8998     else
8999         _javac_path="$with_jdk_home/bin/$javacompiler"
9000         dnl Check if there is a Java compiler at all.
9001         if test -x "$_javac_path"; then
9002             JAVACOMPILER=$_javac_path
9003         fi
9004     fi
9005     if test -z "$JAVACOMPILER"; then
9006         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
9007     fi
9008     if test "$build_os" = "cygwin"; then
9009         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
9010             JAVACOMPILER="${JAVACOMPILER}.exe"
9011         fi
9012         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
9013     fi
9016 dnl ===================================================================
9017 dnl Checks for javadoc
9018 dnl ===================================================================
9019 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9020     if test -z "$with_jdk_home"; then
9021         AC_PATH_PROG(JAVADOC, $javadoc)
9022     else
9023         _javadoc_path="$with_jdk_home/bin/$javadoc"
9024         dnl Check if there is a javadoc at all.
9025         if test -x "$_javadoc_path"; then
9026             JAVADOC=$_javadoc_path
9027         else
9028             AC_PATH_PROG(JAVADOC, $javadoc)
9029         fi
9030     fi
9031     if test -z "$JAVADOC"; then
9032         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
9033     fi
9034     if test "$build_os" = "cygwin"; then
9035         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
9036             JAVADOC="${JAVADOC}.exe"
9037         fi
9038         JAVADOC=`win_short_path_for_make "$JAVADOC"`
9039     fi
9041     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
9042     JAVADOCISGJDOC="yes"
9043     fi
9045 AC_SUBST(JAVADOC)
9046 AC_SUBST(JAVADOCISGJDOC)
9048 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
9049     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
9050     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
9051         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
9052            # try to recover first by looking whether we have an alternative
9053            # system as in Debian or newer SuSEs where following /usr/bin/javac
9054            # over /etc/alternatives/javac leads to the right bindir where we
9055            # just need to strip a bit away to get a valid JAVA_HOME
9056            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
9057         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
9058             # maybe only one level of symlink (e.g. on Mac)
9059             JAVA_HOME=$(readlink $JAVACOMPILER)
9060             if test "$(dirname $JAVA_HOME)" = "."; then
9061                 # we've got no path to trim back
9062                 JAVA_HOME=""
9063             fi
9064         else
9065             # else warn
9066             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
9067             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
9068             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
9069             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
9070         fi
9071         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
9072         if test "$JAVA_HOME" != "/usr"; then
9073             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9074                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
9075                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
9076                 dnl Tiger already returns a JDK path...
9077                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
9078             else
9079                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
9080                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
9081                 dnl that checks which version to run
9082                 if test -f "$JAVA_HOME"; then
9083                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
9084                 fi
9085             fi
9086         fi
9087     fi
9088     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
9090     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9091     if test -z "$JAVA_HOME"; then
9092         if test "x$with_jdk_home" = "x"; then
9093             cat > findhome.java <<_ACEOF
9094 [import java.io.File;
9096 class findhome
9098     public static void main(String args[])
9099     {
9100         String jrelocation = System.getProperty("java.home");
9101         File jre = new File(jrelocation);
9102         System.out.println(jre.getParent());
9103     }
9105 _ACEOF
9106             AC_MSG_CHECKING([if javac works])
9107             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9108             AC_TRY_EVAL(javac_cmd)
9109             if test $? = 0 -a -f ./findhome.class; then
9110                 AC_MSG_RESULT([javac works])
9111             else
9112                 echo "configure: javac test failed" >&5
9113                 cat findhome.java >&5
9114                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9115             fi
9116             AC_MSG_CHECKING([if gij knows its java.home])
9117             JAVA_HOME=`$JAVAINTERPRETER findhome`
9118             if test $? = 0 -a "$JAVA_HOME" != ""; then
9119                 AC_MSG_RESULT([$JAVA_HOME])
9120             else
9121                 echo "configure: java test failed" >&5
9122                 cat findhome.java >&5
9123                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9124             fi
9125             # clean-up after ourselves
9126             rm -f ./findhome.java ./findhome.class
9127         else
9128             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9129         fi
9130     fi
9132     # now check if $JAVA_HOME is really valid
9133     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9134         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9135             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9136             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9137             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9138             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9139             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9140             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9141         fi
9142     fi
9143     PathFormat "$JAVA_HOME"
9144     JAVA_HOME="$formatted_path_unix"
9147 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9148     "$_os" != Darwin
9149 then
9150     AC_MSG_CHECKING([for JAWT lib])
9151     if test "$_os" = WINNT; then
9152         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9153         JAWTLIB=jawt.lib
9154     else
9155         case "$host_cpu" in
9156         arm*)
9157             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9158             JAVA_ARCH=$my_java_arch
9159             ;;
9160         i*86)
9161             my_java_arch=i386
9162             ;;
9163         m68k)
9164             my_java_arch=m68k
9165             ;;
9166         powerpc)
9167             my_java_arch=ppc
9168             ;;
9169         powerpc64)
9170             my_java_arch=ppc64
9171             ;;
9172         powerpc64le)
9173             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9174             JAVA_ARCH=$my_java_arch
9175             ;;
9176         sparc64)
9177             my_java_arch=sparcv9
9178             ;;
9179         x86_64)
9180             my_java_arch=amd64
9181             ;;
9182         *)
9183             my_java_arch=$host_cpu
9184             ;;
9185         esac
9186         # This is where JDK9 puts the library
9187         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9188             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9189         else
9190             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9191         fi
9192         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9193     fi
9194     AC_MSG_RESULT([$JAWTLIB])
9196 AC_SUBST(JAWTLIB)
9198 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9199     case "$host_os" in
9201     cygwin*|wsl*)
9202         JAVAINC="-I$JAVA_HOME/include/win32"
9203         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9204         ;;
9206     darwin*)
9207         if test -d "$JAVA_HOME/include/darwin"; then
9208             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9209         else
9210             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9211         fi
9212         ;;
9214     dragonfly*)
9215         JAVAINC="-I$JAVA_HOME/include"
9216         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9217         ;;
9219     freebsd*)
9220         JAVAINC="-I$JAVA_HOME/include"
9221         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9222         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9223         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9224         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9225         ;;
9227     k*bsd*-gnu*)
9228         JAVAINC="-I$JAVA_HOME/include"
9229         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9230         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9231         ;;
9233     linux-gnu*)
9234         JAVAINC="-I$JAVA_HOME/include"
9235         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9236         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9237         ;;
9239     *netbsd*)
9240         JAVAINC="-I$JAVA_HOME/include"
9241         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9242         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9243        ;;
9245     openbsd*)
9246         JAVAINC="-I$JAVA_HOME/include"
9247         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9248         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9249         ;;
9251     solaris*)
9252         JAVAINC="-I$JAVA_HOME/include"
9253         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9254         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9255         ;;
9256     esac
9258 SOLARINC="$SOLARINC $JAVAINC"
9260 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9261     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9262     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9263     JDK_FOR_BUILD=$JDK
9264     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9267 AC_SUBST(JAVACFLAGS)
9268 AC_SUBST(JAVACOMPILER)
9269 AC_SUBST(JAVAINTERPRETER)
9270 AC_SUBST(JAVAIFLAGS)
9271 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9272 AC_SUBST(JAVA_HOME)
9273 AC_SUBST(JAVA_HOME_FOR_BUILD)
9274 AC_SUBST(JDK)
9275 AC_SUBST(JDK_FOR_BUILD)
9276 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9277 AC_SUBST(JAVA_SOURCE_VER)
9278 AC_SUBST(JAVA_TARGET_VER)
9279 AC_SUBST(MODULAR_JAVA)
9282 dnl ===================================================================
9283 dnl Export file validation
9284 dnl ===================================================================
9285 AC_MSG_CHECKING([whether to enable export file validation])
9286 if test "$with_export_validation" != "no"; then
9287     if test -z "$ENABLE_JAVA"; then
9288         if test "$with_export_validation" = "yes"; then
9289             AC_MSG_ERROR([requested, but Java is disabled])
9290         else
9291             AC_MSG_RESULT([no, as Java is disabled])
9292         fi
9293     elif ! test -d "${SRC_ROOT}/schema"; then
9294         if test "$with_export_validation" = "yes"; then
9295             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9296         else
9297             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9298         fi
9299     else
9300         AC_MSG_RESULT([yes])
9301         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9303         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9304         if test -z "$ODFVALIDATOR"; then
9305             # remember to download the ODF toolkit with validator later
9306             AC_MSG_NOTICE([no odfvalidator found, will download it])
9307             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9308             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9310             # and fetch name of odfvalidator jar name from download.lst
9311             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9312             AC_SUBST(ODFVALIDATOR_JAR)
9314             if test -z "$ODFVALIDATOR_JAR"; then
9315                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9316             fi
9317         fi
9318         if test "$build_os" = "cygwin"; then
9319             # In case of Cygwin it will be executed from Windows,
9320             # so we need to run bash and absolute path to validator
9321             # so instead of "odfvalidator" it will be
9322             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9323             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9324         else
9325             ODFVALIDATOR="sh $ODFVALIDATOR"
9326         fi
9327         AC_SUBST(ODFVALIDATOR)
9330         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9331         if test -z "$OFFICEOTRON"; then
9332             # remember to download the officeotron with validator later
9333             AC_MSG_NOTICE([no officeotron found, will download it])
9334             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9335             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9337             # and fetch name of officeotron jar name from download.lst
9338             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9339             AC_SUBST(OFFICEOTRON_JAR)
9341             if test -z "$OFFICEOTRON_JAR"; then
9342                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9343             fi
9344         else
9345             # check version of existing officeotron
9346             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9347             if test 0"$OFFICEOTRON_VER" -lt 704; then
9348                 AC_MSG_ERROR([officeotron too old])
9349             fi
9350         fi
9351         if test "$build_os" = "cygwin"; then
9352             # In case of Cygwin it will be executed from Windows,
9353             # so we need to run bash and absolute path to validator
9354             # so instead of "odfvalidator" it will be
9355             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9356             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9357         else
9358             OFFICEOTRON="sh $OFFICEOTRON"
9359         fi
9360     fi
9361     AC_SUBST(OFFICEOTRON)
9362 else
9363     AC_MSG_RESULT([no])
9366 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9367 if test "$with_bffvalidator" != "no"; then
9368     AC_DEFINE(HAVE_BFFVALIDATOR)
9370     if test "$with_export_validation" = "no"; then
9371         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9372     fi
9374     if test "$with_bffvalidator" = "yes"; then
9375         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9376     else
9377         BFFVALIDATOR="$with_bffvalidator"
9378     fi
9380     if test "$build_os" = "cygwin"; then
9381         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9382             AC_MSG_RESULT($BFFVALIDATOR)
9383         else
9384             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9385         fi
9386     elif test -n "$BFFVALIDATOR"; then
9387         # We are not in Cygwin but need to run Windows binary with wine
9388         AC_PATH_PROGS(WINE, wine)
9390         # so swap in a shell wrapper that converts paths transparently
9391         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9392         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9393         AC_SUBST(BFFVALIDATOR_EXE)
9394         AC_MSG_RESULT($BFFVALIDATOR)
9395     else
9396         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9397     fi
9398     AC_SUBST(BFFVALIDATOR)
9399 else
9400     AC_MSG_RESULT([no])
9403 dnl ===================================================================
9404 dnl Check for epm (not needed for Windows)
9405 dnl ===================================================================
9406 AC_MSG_CHECKING([whether to enable EPM for packing])
9407 if test "$enable_epm" = "yes"; then
9408     AC_MSG_RESULT([yes])
9409     if test "$_os" != "WINNT"; then
9410         if test $_os = Darwin; then
9411             EPM=internal
9412         elif test -n "$with_epm"; then
9413             EPM=$with_epm
9414         else
9415             AC_PATH_PROG(EPM, epm, no)
9416         fi
9417         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9418             AC_MSG_NOTICE([EPM will be built.])
9419             BUILD_TYPE="$BUILD_TYPE EPM"
9420             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9421         else
9422             # Gentoo has some epm which is something different...
9423             AC_MSG_CHECKING([whether the found epm is the right epm])
9424             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9425                 AC_MSG_RESULT([yes])
9426             else
9427                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9428             fi
9429             AC_MSG_CHECKING([epm version])
9430             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9431             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9432                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9433                 AC_MSG_RESULT([OK, >= 3.7])
9434             else
9435                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9436                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9437             fi
9438         fi
9439     fi
9441     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9442         AC_MSG_CHECKING([for rpm])
9443         for a in "$RPM" rpmbuild rpm; do
9444             $a --usage >/dev/null 2> /dev/null
9445             if test $? -eq 0; then
9446                 RPM=$a
9447                 break
9448             else
9449                 $a --version >/dev/null 2> /dev/null
9450                 if test $? -eq 0; then
9451                     RPM=$a
9452                     break
9453                 fi
9454             fi
9455         done
9456         if test -z "$RPM"; then
9457             AC_MSG_ERROR([not found])
9458         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9459             RPM_PATH=`command -v $RPM`
9460             AC_MSG_RESULT([$RPM_PATH])
9461             SCPDEFS="$SCPDEFS -DWITH_RPM"
9462         else
9463             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9464         fi
9465     fi
9466     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9467         AC_PATH_PROG(DPKG, dpkg, no)
9468         if test "$DPKG" = "no"; then
9469             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9470         fi
9471     fi
9472     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9473        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9474         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9475             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9476                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9477                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9478                     AC_MSG_RESULT([yes])
9479                 else
9480                     AC_MSG_RESULT([no])
9481                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9482                         _pt="rpm"
9483                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9484                         add_warning "the rpms will need to be installed with --nodeps"
9485                     else
9486                         _pt="pkg"
9487                     fi
9488                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9489                     add_warning "the ${_pt}s will not be relocatable"
9490                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9491                                  relocation will work, you need to patch your epm with the
9492                                  patch in epm/epm-3.7.patch or build with
9493                                  --with-epm=internal which will build a suitable epm])
9494                 fi
9495             fi
9496         fi
9497     fi
9498     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9499         AC_PATH_PROG(PKGMK, pkgmk, no)
9500         if test "$PKGMK" = "no"; then
9501             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9502         fi
9503     fi
9504     AC_SUBST(RPM)
9505     AC_SUBST(DPKG)
9506     AC_SUBST(PKGMK)
9507 else
9508     for i in $PKGFORMAT; do
9509         case "$i" in
9510         bsd | deb | pkg | rpm | native | portable)
9511             AC_MSG_ERROR(
9512                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9513             ;;
9514         esac
9515     done
9516     AC_MSG_RESULT([no])
9517     EPM=NO
9519 AC_SUBST(EPM)
9521 ENABLE_LWP=
9522 if test "$enable_lotuswordpro" = "yes"; then
9523     ENABLE_LWP="TRUE"
9525 AC_SUBST(ENABLE_LWP)
9527 dnl ===================================================================
9528 dnl Check for building ODK
9529 dnl ===================================================================
9530 AC_MSG_CHECKING([whether to build the ODK])
9531 if test "$enable_odk" = yes; then
9532     if test "$DISABLE_DYNLOADING" = TRUE; then
9533         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9534     fi
9535     AC_MSG_RESULT([yes])
9536     BUILD_TYPE="$BUILD_TYPE ODK"
9537 else
9538     AC_MSG_RESULT([no])
9541 if test "$enable_odk" != yes; then
9542     unset DOXYGEN
9543 else
9544     if test "$with_doxygen" = no; then
9545         AC_MSG_CHECKING([for doxygen])
9546         unset DOXYGEN
9547         AC_MSG_RESULT([no])
9548     else
9549         if test "$with_doxygen" = yes; then
9550             AC_PATH_PROG([DOXYGEN], [doxygen])
9551             if test -z "$DOXYGEN"; then
9552                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9553             fi
9554             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9555                 if ! dot -V 2>/dev/null; then
9556                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9557                 fi
9558             fi
9559         else
9560             AC_MSG_CHECKING([for doxygen])
9561             PathFormat "$with_doxygen"
9562             DOXYGEN="$formatted_path_unix"
9563             AC_MSG_RESULT([$formatted_path])
9564         fi
9565         if test -n "$DOXYGEN"; then
9566             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9567             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9568             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9569                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9570             fi
9571         fi
9572         if test -n "$WSL_ONLY_AS_HELPER"; then
9573             dnl what really should be tested is whether it is doxygen from windows-realm
9574             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9575             dnl using doxygen from wsl container would be possible, but there's a performance
9576             dnl penalty when accessing the files outside the container
9577             AC_MSG_CHECKING([whether doxygen is a windows executable])
9578             if $(file "$DOXYGEN" | grep -q "PE32"); then
9579                 AC_MSG_RESULT([yes])
9580             else
9581                 AC_MSG_RESULT([no])
9582                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9583             fi
9584         fi
9585     fi
9587 AC_SUBST([DOXYGEN])
9589 dnl ==================================================================
9590 dnl libfuzzer
9591 dnl ==================================================================
9592 AC_MSG_CHECKING([whether to enable fuzzers])
9593 if test "$enable_fuzzers" != yes; then
9594     AC_MSG_RESULT([no])
9595 else
9596     if test -z $LIB_FUZZING_ENGINE; then
9597       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9598     fi
9599     AC_MSG_RESULT([yes])
9600     ENABLE_FUZZERS="TRUE"
9601     AC_DEFINE([ENABLE_FUZZERS],1)
9602     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9604 AC_SUBST(LIB_FUZZING_ENGINE)
9606 dnl ===================================================================
9607 dnl Check for system zlib
9608 dnl ===================================================================
9609 if test "$with_system_zlib" = "auto"; then
9610     case "$_os" in
9611     WINNT)
9612         with_system_zlib="$with_system_libs"
9613         ;;
9614     *)
9615         if test "$enable_fuzzers" != "yes"; then
9616             with_system_zlib=yes
9617         else
9618             with_system_zlib=no
9619         fi
9620         ;;
9621     esac
9624 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9625 dnl and has no pkg-config for it at least on some tinderboxes,
9626 dnl so leaving that out for now
9627 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9628 AC_MSG_CHECKING([which zlib to use])
9629 if test "$with_system_zlib" = "yes"; then
9630     AC_MSG_RESULT([external])
9631     SYSTEM_ZLIB=TRUE
9632     AC_CHECK_HEADER(zlib.h, [],
9633         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9634     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9635         [AC_MSG_ERROR(zlib not found or functional)], [])
9636 else
9637     AC_MSG_RESULT([internal])
9638     SYSTEM_ZLIB=
9639     BUILD_TYPE="$BUILD_TYPE ZLIB"
9640     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9641     if test "$COM" = "MSC"; then
9642         ZLIB_LIBS='$(gb_StaticLibrary_WORKDIR)/zlib.lib'
9643     else
9644         ZLIB_LIBS='-L$(gb_StaticLibrary_WORKDIR) -lzlib'
9645     fi
9647 AC_SUBST(ZLIB_CFLAGS)
9648 AC_SUBST(ZLIB_LIBS)
9649 AC_SUBST(SYSTEM_ZLIB)
9651 dnl ===================================================================
9652 dnl Check for system jpeg
9653 dnl ===================================================================
9654 AC_MSG_CHECKING([which libjpeg to use])
9655 if test "$with_system_jpeg" = "yes"; then
9656     AC_MSG_RESULT([external])
9657     SYSTEM_LIBJPEG=TRUE
9658     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9659         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9660     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9661         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9662 else
9663     SYSTEM_LIBJPEG=
9664     AC_MSG_RESULT([internal, libjpeg-turbo])
9665     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9667     case "$host_cpu" in
9668     x86_64 | amd64 | i*86 | x86 | ia32)
9669         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9670         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9671             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9672                 NASM="$LODE_HOME/opt/bin/nasm"
9673             elif test -x "/opt/lo/bin/nasm"; then
9674                 NASM="/opt/lo/bin/nasm"
9675             fi
9676         fi
9678         if test -n "$NASM"; then
9679             AC_MSG_CHECKING([for object file format of host system])
9680             case "$host_os" in
9681               cygwin* | mingw* | pw32* | wsl*)
9682                 case "$host_cpu" in
9683                   x86_64)
9684                     objfmt='Win64-COFF'
9685                     ;;
9686                   *)
9687                     objfmt='Win32-COFF'
9688                     ;;
9689                 esac
9690               ;;
9691               msdosdjgpp* | go32*)
9692                 objfmt='COFF'
9693               ;;
9694               os2-emx*) # not tested
9695                 objfmt='MSOMF' # obj
9696               ;;
9697               linux*coff* | linux*oldld*)
9698                 objfmt='COFF' # ???
9699               ;;
9700               linux*aout*)
9701                 objfmt='a.out'
9702               ;;
9703               linux*)
9704                 case "$host_cpu" in
9705                   x86_64)
9706                     objfmt='ELF64'
9707                     ;;
9708                   *)
9709                     objfmt='ELF'
9710                     ;;
9711                 esac
9712               ;;
9713               kfreebsd* | freebsd* | netbsd* | openbsd*)
9714                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9715                   objfmt='BSD-a.out'
9716                 else
9717                   case "$host_cpu" in
9718                     x86_64 | amd64)
9719                       objfmt='ELF64'
9720                       ;;
9721                     *)
9722                       objfmt='ELF'
9723                       ;;
9724                   esac
9725                 fi
9726               ;;
9727               solaris* | sunos* | sysv* | sco*)
9728                 case "$host_cpu" in
9729                   x86_64)
9730                     objfmt='ELF64'
9731                     ;;
9732                   *)
9733                     objfmt='ELF'
9734                     ;;
9735                 esac
9736               ;;
9737               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9738                 case "$host_cpu" in
9739                   x86_64)
9740                     objfmt='Mach-O64'
9741                     ;;
9742                   *)
9743                     objfmt='Mach-O'
9744                     ;;
9745                 esac
9746               ;;
9747               *)
9748                 objfmt='ELF ?'
9749               ;;
9750             esac
9752             AC_MSG_RESULT([$objfmt])
9753             if test "$objfmt" = 'ELF ?'; then
9754               objfmt='ELF'
9755               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9756             fi
9758             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9759             case "$objfmt" in
9760               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9761               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9762               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9763               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9764               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9765               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9766               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9767               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9768               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9769               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9770               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9771             esac
9772             AC_MSG_RESULT([$NAFLAGS])
9774             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9775             cat > conftest.asm << EOF
9776             [%line __oline__ "configure"
9777                     section .text
9778                     global  _main,main
9779             _main:
9780             main:   xor     eax,eax
9781                     ret
9782             ]
9784             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9785             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9786               AC_MSG_RESULT(yes)
9787             else
9788               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9789               cat conftest.asm >&AS_MESSAGE_LOG_FD
9790               rm -rf conftest*
9791               AC_MSG_RESULT(no)
9792               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9793               NASM=""
9794             fi
9796         fi
9798         if test -z "$NASM"; then
9799 cat << _EOS
9800 ****************************************************************************
9801 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9802 To get one please:
9804 _EOS
9805             if test "$build_os" = "cygwin"; then
9806 cat << _EOS
9807 install a pre-compiled binary for Win32
9809 mkdir -p /opt/lo/bin
9810 cd /opt/lo/bin
9811 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9812 chmod +x nasm
9814 or get and install one from https://www.nasm.us/
9816 Then re-run autogen.sh
9818 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9819 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9821 _EOS
9822             else
9823 cat << _EOS
9824 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9826 _EOS
9827             fi
9828             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9829             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9830         fi
9831       ;;
9832     esac
9835 AC_SUBST(NASM)
9836 AC_SUBST(NAFLAGS)
9837 AC_SUBST(LIBJPEG_CFLAGS)
9838 AC_SUBST(LIBJPEG_LIBS)
9839 AC_SUBST(SYSTEM_LIBJPEG)
9841 dnl ===================================================================
9842 dnl Check for system clucene
9843 dnl ===================================================================
9844 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9845 if test "$SYSTEM_CLUCENE" = TRUE; then
9846     AC_LANG_PUSH([C++])
9847     save_CXXFLAGS=$CXXFLAGS
9848     save_CPPFLAGS=$CPPFLAGS
9849     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9850     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9851     dnl https://sourceforge.net/p/clucene/bugs/200/
9852     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9853     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9854                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9855     CXXFLAGS=$save_CXXFLAGS
9856     CPPFLAGS=$save_CPPFLAGS
9857     AC_LANG_POP([C++])
9858     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9861 dnl ===================================================================
9862 dnl Check for system expat
9863 dnl ===================================================================
9864 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9866 dnl ===================================================================
9867 dnl Check for system xmlsec
9868 dnl ===================================================================
9869 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9871 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9872 if test "$enable_eot" = "yes"; then
9873     ENABLE_EOT="TRUE"
9874     AC_DEFINE([ENABLE_EOT])
9875     AC_MSG_RESULT([yes])
9877     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9878 else
9879     ENABLE_EOT=
9880     AC_MSG_RESULT([no])
9882 AC_SUBST([ENABLE_EOT])
9884 dnl ===================================================================
9885 dnl Check for DLP libs
9886 dnl ===================================================================
9887 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9888 AS_IF([test "$COM" = "MSC"],
9889       [librevenge_libdir='$(gb_Library_DLLDIR)'],
9890       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9892 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9893 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9895 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9897 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9899 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9900 AS_IF([test "$COM" = "MSC"],
9901       [libwpd_libdir='$(gb_Library_DLLDIR)'],
9902       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9904 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9905 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9907 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9909 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9910 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9912 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9914 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9916 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9918 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9919 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9921 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9922 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9924 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9926 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9927 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9929 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9931 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9933 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9935 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9937 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9938 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9940 dnl ===================================================================
9941 dnl Check for system lcms2
9942 dnl ===================================================================
9943 if test "$with_system_lcms2" != "yes"; then
9944     SYSTEM_LCMS2=
9946 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9947 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9948 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9949 if test "$GCC" = "yes"; then
9950     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9952 if test "$COM" = "MSC"; then # override the above
9953     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9956 dnl ===================================================================
9957 dnl Check for system cppunit
9958 dnl ===================================================================
9959 if test "$_os" != "Android" ; then
9960     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9963 dnl ===================================================================
9964 dnl Check whether freetype is available
9966 dnl FreeType has 3 different kinds of versions
9967 dnl * release, like 2.4.10
9968 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9969 dnl * soname
9970 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9972 dnl 9.9.3 is 2.2.0
9973 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9974 dnl ===================================================================
9975 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9976 if test "x$ac_config_site_64bit_host" = xYES; then
9977     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9978 else
9979     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9981 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9983 # ===================================================================
9984 # Check for system libxslt
9985 # to prevent incompatibilities between internal libxml2 and external libxslt,
9986 # or vice versa, use with_system_libxml here
9987 # ===================================================================
9988 if test "$with_system_libxml" = "auto"; then
9989     case "$_os" in
9990     WINNT|iOS|Android)
9991         with_system_libxml="$with_system_libs"
9992         ;;
9993     Emscripten)
9994         with_system_libxml=no
9995         ;;
9996     *)
9997         if test "$enable_fuzzers" != "yes"; then
9998             with_system_libxml=yes
9999         else
10000             with_system_libxml=no
10001         fi
10002         ;;
10003     esac
10006 AC_MSG_CHECKING([which libxslt to use])
10007 if test "$with_system_libxml" = "yes"; then
10008     AC_MSG_RESULT([external])
10009     SYSTEM_LIBXSLT=TRUE
10010     if test "$_os" = "Darwin"; then
10011         dnl make sure to use SDK path
10012         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
10013         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
10014         dnl omit -L/usr/lib
10015         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
10016         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
10017     else
10018         PKG_CHECK_MODULES(LIBXSLT, libxslt)
10019         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10020         FilterLibs "${LIBXSLT_LIBS}"
10021         LIBXSLT_LIBS="${filteredlibs}"
10022         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
10023         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10024         FilterLibs "${LIBEXSLT_LIBS}"
10025         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
10026     fi
10028     dnl Check for xsltproc
10029     AC_PATH_PROG(XSLTPROC, xsltproc, no)
10030     if test "$XSLTPROC" = "no"; then
10031         AC_MSG_ERROR([xsltproc is required])
10032     fi
10033 else
10034     AC_MSG_RESULT([internal])
10035     SYSTEM_LIBXSLT=
10036     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
10038 AC_SUBST(SYSTEM_LIBXSLT)
10039 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
10040     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
10042 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
10044 AC_SUBST(LIBEXSLT_CFLAGS)
10045 AC_SUBST(LIBEXSLT_LIBS)
10046 AC_SUBST(LIBXSLT_CFLAGS)
10047 AC_SUBST(LIBXSLT_LIBS)
10048 AC_SUBST(XSLTPROC)
10050 # ===================================================================
10051 # Check for system libxml
10052 # ===================================================================
10053 AC_MSG_CHECKING([which libxml to use])
10054 if test "$with_system_libxml" = "yes"; then
10055     AC_MSG_RESULT([external])
10056     SYSTEM_LIBXML=TRUE
10057     if test "$_os" = "Darwin"; then
10058         dnl make sure to use SDK path
10059         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
10060         dnl omit -L/usr/lib
10061         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
10062     elif test $_os = iOS; then
10063         dnl make sure to use SDK path
10064         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
10065         LIBXML_CFLAGS="-I$usr/include/libxml2"
10066         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
10067     else
10068         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
10069         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10070         FilterLibs "${LIBXML_LIBS}"
10071         LIBXML_LIBS="${filteredlibs}"
10072     fi
10074     dnl Check for xmllint
10075     AC_PATH_PROG(XMLLINT, xmllint, no)
10076     if test "$XMLLINT" = "no"; then
10077         AC_MSG_ERROR([xmllint is required])
10078     fi
10079 else
10080     AC_MSG_RESULT([internal])
10081     SYSTEM_LIBXML=
10082     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
10083     if test "$COM" = "MSC"; then
10084         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10085     fi
10086     if test "$COM" = "MSC"; then
10087         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
10088     else
10089         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10090         if test "$DISABLE_DYNLOADING" = TRUE; then
10091             LIBXML_LIBS="$LIBXML_LIBS -lm"
10092         fi
10093     fi
10094     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10096 AC_SUBST(SYSTEM_LIBXML)
10097 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10098     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10100 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10101 AC_SUBST(LIBXML_CFLAGS)
10102 AC_SUBST(LIBXML_LIBS)
10103 AC_SUBST(XMLLINT)
10105 # =====================================================================
10106 # Checking for a Python interpreter with version >= 3.3.
10107 # Optionally user can pass an option to configure, i. e.
10108 # ./configure PYTHON=/usr/bin/python
10109 # =====================================================================
10110 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10111     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10112     # unless PYTHON is defined as above which allows 'system'
10113     enable_python=internal
10115 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10116     if test -n "$PYTHON"; then
10117         PYTHON_FOR_BUILD=$PYTHON
10118     else
10119         # This allows a lack of system python with no error, we use internal one in that case.
10120         AM_PATH_PYTHON([3.3],, [:])
10121         # Clean PYTHON_VERSION checked below if cross-compiling
10122         PYTHON_VERSION=""
10123         if test "$PYTHON" != ":"; then
10124             PYTHON_FOR_BUILD=$PYTHON
10125         fi
10126     fi
10129 # Checks for Python to use for Pyuno
10130 AC_MSG_CHECKING([which Python to use for Pyuno])
10131 case "$enable_python" in
10132 no|disable)
10133     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10134         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10135         # requirement from the choice whether to include Python stuff in the installer, but why
10136         # bother?
10137         AC_MSG_ERROR([Python is required at build time.])
10138     fi
10139     enable_python=no
10140     AC_MSG_RESULT([none])
10141     ;;
10142 ""|yes|auto)
10143     if test "$DISABLE_SCRIPTING" = TRUE; then
10144         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10145             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10146         fi
10147         AC_MSG_RESULT([none, overridden by --disable-scripting])
10148         enable_python=no
10149     elif test $build_os = cygwin -o $build_os = wsl; then
10150         dnl When building on Windows we don't attempt to use any installed
10151         dnl "system"  Python.
10152         AC_MSG_RESULT([fully internal])
10153         enable_python=internal
10154     elif test "$cross_compiling" = yes; then
10155         AC_MSG_RESULT([system])
10156         enable_python=system
10157     else
10158         # Unset variables set by the above AM_PATH_PYTHON so that
10159         # we actually do check anew.
10160         AC_MSG_RESULT([])
10161         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
10162         AM_PATH_PYTHON([3.3],, [:])
10163         AC_MSG_CHECKING([which Python to use for Pyuno])
10164         if test "$PYTHON" = ":"; then
10165             if test -z "$PYTHON_FOR_BUILD"; then
10166                 AC_MSG_RESULT([fully internal])
10167             else
10168                 AC_MSG_RESULT([internal])
10169             fi
10170             enable_python=internal
10171         else
10172             AC_MSG_RESULT([system])
10173             enable_python=system
10174         fi
10175     fi
10176     ;;
10177 internal)
10178     AC_MSG_RESULT([internal])
10179     ;;
10180 fully-internal)
10181     AC_MSG_RESULT([fully internal])
10182     enable_python=internal
10183     ;;
10184 system)
10185     AC_MSG_RESULT([system])
10186     if test "$_os" = Darwin -a -z "$PYTHON"; then
10187         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10188     fi
10189     ;;
10191     AC_MSG_ERROR([Incorrect --enable-python option])
10192     ;;
10193 esac
10195 if test $enable_python != no; then
10196     BUILD_TYPE="$BUILD_TYPE PYUNO"
10199 if test $enable_python = system; then
10200     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10201         # Fallback: Accept these in the environment, or as set above
10202         # for MacOSX.
10203         :
10204     elif test "$cross_compiling" != yes; then
10205         # Unset variables set by the above AM_PATH_PYTHON so that
10206         # we actually do check anew.
10207         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
10208         # This causes an error if no python command is found
10209         AM_PATH_PYTHON([3.3])
10210         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10211         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10212         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10213         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10214         if test -z "$PKG_CONFIG"; then
10215             PYTHON_CFLAGS="-I$python_include"
10216             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10217         elif $PKG_CONFIG --exists python-$python_version-embed; then
10218             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10219             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10220         elif $PKG_CONFIG --exists python-$python_version; then
10221             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10222             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10223         else
10224             PYTHON_CFLAGS="-I$python_include"
10225             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10226         fi
10227         FilterLibs "${PYTHON_LIBS}"
10228         PYTHON_LIBS="${filteredlibs}"
10229     else
10230         dnl How to find out the cross-compilation Python installation path?
10231         AC_MSG_CHECKING([for python version])
10232         AS_IF([test -n "$PYTHON_VERSION"],
10233               [AC_MSG_RESULT([$PYTHON_VERSION])],
10234               [AC_MSG_RESULT([not found])
10235                AC_MSG_ERROR([no usable python found])])
10236         test -n "$PYTHON_CFLAGS" && break
10237     fi
10239     dnl Check if the headers really work
10240     save_CPPFLAGS="$CPPFLAGS"
10241     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10242     AC_CHECK_HEADER(Python.h)
10243     CPPFLAGS="$save_CPPFLAGS"
10245     # let the PYTHON_FOR_BUILD match the same python installation that
10246     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10247     # better for PythonTests.
10248     PYTHON_FOR_BUILD=$PYTHON
10251 if test "$with_lxml" != no; then
10252     if test -z "$PYTHON_FOR_BUILD"; then
10253         case $build_os in
10254             cygwin)
10255                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10256                 ;;
10257             *)
10258                 if test "$cross_compiling" != yes ; then
10259                     BUILD_TYPE="$BUILD_TYPE LXML"
10260                 fi
10261                 ;;
10262         esac
10263     else
10264         AC_MSG_CHECKING([for python lxml])
10265         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10266             AC_MSG_RESULT([yes])
10267         else
10268             case $build_os in
10269                 cygwin)
10270                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10271                     ;;
10272                 *)
10273                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10274                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10275                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10276                         else
10277                             BUILD_TYPE="$BUILD_TYPE LXML"
10278                             AC_MSG_RESULT([no, using internal lxml])
10279                         fi
10280                     else
10281                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10282                     fi
10283                     ;;
10284             esac
10285         fi
10286     fi
10289 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10290     SYSTEM_PYTHON=
10291     PYTHON_VERSION_MAJOR=3
10292     PYTHON_VERSION_MINOR=10
10293     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.14
10294     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10295         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10296     fi
10297     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10299     # Embedded Python dies without Home set
10300     if test "$HOME" = ""; then
10301         export HOME=""
10302     fi
10305 dnl By now enable_python should be "system", "internal" or "no"
10306 case $enable_python in
10307 system)
10308     SYSTEM_PYTHON=TRUE
10310     if test "x$ac_cv_header_Python_h" != "xyes"; then
10311        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10312     fi
10314     AC_LANG_PUSH(C)
10315     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10316     AC_MSG_CHECKING([for correct python library version])
10317        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10318 #include <Python.h>
10320 int main(int argc, char **argv) {
10321    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10322    else return 1;
10324        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10325     AC_LANG_POP(C)
10327     dnl FIXME Check if the Python library can be linked with, too?
10328     ;;
10330 internal)
10331     BUILD_TYPE="$BUILD_TYPE PYTHON"
10332     if test "$OS" = LINUX -o "$OS" = WNT ; then
10333         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10334     fi
10335     ;;
10337     DISABLE_PYTHON=TRUE
10338     SYSTEM_PYTHON=
10339     ;;
10341     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10342     ;;
10343 esac
10345 AC_SUBST(DISABLE_PYTHON)
10346 AC_SUBST(SYSTEM_PYTHON)
10347 AC_SUBST(PYTHON_CFLAGS)
10348 AC_SUBST(PYTHON_FOR_BUILD)
10349 AC_SUBST(PYTHON_LIBS)
10350 AC_SUBST(PYTHON_VERSION)
10351 AC_SUBST(PYTHON_VERSION_MAJOR)
10352 AC_SUBST(PYTHON_VERSION_MINOR)
10354 AC_MSG_CHECKING([whether to build LibreLogo])
10355 case "$enable_python" in
10356 no|disable)
10357     AC_MSG_RESULT([no; Python disabled])
10358     ;;
10360     if test "${enable_librelogo}" = "no"; then
10361         AC_MSG_RESULT([no])
10362     else
10363         AC_MSG_RESULT([yes])
10364         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10365         AC_DEFINE([ENABLE_LIBRELOGO],1)
10366     fi
10367     ;;
10368 esac
10369 AC_SUBST(ENABLE_LIBRELOGO)
10371 ENABLE_MARIADBC=
10372 MARIADBC_MAJOR=1
10373 MARIADBC_MINOR=0
10374 MARIADBC_MICRO=2
10375 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10376 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10377     ENABLE_MARIADBC=TRUE
10378     AC_MSG_RESULT([yes])
10379     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10380 else
10381     AC_MSG_RESULT([no])
10383 AC_SUBST(ENABLE_MARIADBC)
10384 AC_SUBST(MARIADBC_MAJOR)
10385 AC_SUBST(MARIADBC_MINOR)
10386 AC_SUBST(MARIADBC_MICRO)
10388 if test "$ENABLE_MARIADBC" = "TRUE"; then
10389     dnl ===================================================================
10390     dnl Check for system MariaDB
10391     dnl ===================================================================
10393     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10394         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10395     fi
10397     AC_MSG_CHECKING([which MariaDB to use])
10398     if test "$with_system_mariadb" = "yes"; then
10399         AC_MSG_RESULT([external])
10400         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10401         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10402         if test -z "$MARIADBCONFIG"; then
10403             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10404             if test -z "$MARIADBCONFIG"; then
10405                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10406                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10407             fi
10408         fi
10409         AC_MSG_CHECKING([MariaDB version])
10410         MARIADB_VERSION=`$MARIADBCONFIG --version`
10411         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10412         if test "$MARIADB_MAJOR" -ge "5"; then
10413             AC_MSG_RESULT([OK])
10414         else
10415             AC_MSG_ERROR([too old, use 5.0.x or later])
10416         fi
10417         AC_MSG_CHECKING([for MariaDB Client library])
10418         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10419         if test "$COM_IS_CLANG" = TRUE; then
10420             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10421         fi
10422         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10423         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10424         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10425         dnl linux32:
10426         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10427             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10428             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10429                 | sed -e 's|/lib64/|/lib/|')
10430         fi
10431         FilterLibs "${MARIADB_LIBS}"
10432         MARIADB_LIBS="${filteredlibs}"
10433         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10434         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10435         if test "$enable_bundle_mariadb" = "yes"; then
10436             AC_MSG_RESULT([yes])
10437             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10438             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10440 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10442 /g' | grep -E '(mysqlclient|mariadb)')
10443             if test "$_os" = "Darwin"; then
10444                 LIBMARIADB=${LIBMARIADB}.dylib
10445                 if test "$with_gssapi" != "no"; then
10446                     WITH_GSSAPI=TRUE
10447                     save_LIBS=$LIBS
10448                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10449                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10450                     GSSAPI_LIBS=$LIBS
10451                     LIBS=$save_LIBS
10452                 fi
10453             elif test "$_os" = "WINNT"; then
10454                 LIBMARIADB=${LIBMARIADB}.dll
10455             else
10456                 LIBMARIADB=${LIBMARIADB}.so
10457                 if test "$with_gssapi" != "no"; then
10458                     WITH_GSSAPI=TRUE
10459                     save_LIBS=$LIBS
10460                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10461                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10462                     GSSAPI_LIBS=$LIBS
10463                     LIBS=$save_LIBS
10464                 fi
10465             fi
10466             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10467             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10468             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10469                 AC_MSG_RESULT([found.])
10470                 PathFormat "$LIBMARIADB_PATH"
10471                 LIBMARIADB_PATH="$formatted_path"
10472             else
10473                 AC_MSG_ERROR([not found.])
10474             fi
10475         else
10476             AC_MSG_RESULT([no])
10477             BUNDLE_MARIADB_CONNECTOR_C=
10478         fi
10479     else
10480         AC_MSG_RESULT([internal])
10481         SYSTEM_MARIADB_CONNECTOR_C=
10482         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10483         MARIADB_LIBS='-L$(gb_StaticLibrary_WORKDIR) -lmariadb-connector-c'
10484         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10485     fi
10487     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10488     AC_SUBST(MARIADB_CFLAGS)
10489     AC_SUBST(MARIADB_LIBS)
10490     AC_SUBST(LIBMARIADB)
10491     AC_SUBST(LIBMARIADB_PATH)
10492     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10495 dnl ===================================================================
10496 dnl Check for system hsqldb
10497 dnl ===================================================================
10498 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10499     AC_MSG_CHECKING([which hsqldb to use])
10500     if test "$with_system_hsqldb" = "yes"; then
10501         AC_MSG_RESULT([external])
10502         SYSTEM_HSQLDB=TRUE
10503         if test -z $HSQLDB_JAR; then
10504             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10505         fi
10506         if ! test -f $HSQLDB_JAR; then
10507                AC_MSG_ERROR(hsqldb.jar not found.)
10508         fi
10509         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10510         export HSQLDB_JAR
10511         if $PERL -e \
10512            'use Archive::Zip;
10513             my $file = "$ENV{'HSQLDB_JAR'}";
10514             my $zip = Archive::Zip->new( $file );
10515             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10516             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10517             {
10518                 push @l, split(/\n/, $mf);
10519                 foreach my $line (@l)
10520                 {
10521                     if ($line =~ m/Specification-Version:/)
10522                     {
10523                         ($t, $version) = split (/:/,$line);
10524                         $version =~ s/^\s//;
10525                         ($a, $b, $c, $d) = split (/\./,$version);
10526                         if ($c == "0" && $d > "8")
10527                         {
10528                             exit 0;
10529                         }
10530                         else
10531                         {
10532                             exit 1;
10533                         }
10534                     }
10535                 }
10536             }
10537             else
10538             {
10539                 exit 1;
10540             }'; then
10541             AC_MSG_RESULT([yes])
10542         else
10543             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10544         fi
10545     else
10546         AC_MSG_RESULT([internal])
10547         SYSTEM_HSQLDB=
10548         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10549         NEED_ANT=TRUE
10550     fi
10551 else
10552     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10553         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10554     fi
10556 AC_SUBST(SYSTEM_HSQLDB)
10557 AC_SUBST(HSQLDB_JAR)
10559 dnl ===================================================================
10560 dnl Check for PostgreSQL stuff
10561 dnl ===================================================================
10562 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10563 if test "x$enable_postgresql_sdbc" != "xno"; then
10564     AC_MSG_RESULT([yes])
10565     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10567     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10568         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10569     fi
10570     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10571         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10572     fi
10574     postgres_interface=""
10575     if test "$with_system_postgresql" = "yes"; then
10576         postgres_interface="external PostgreSQL"
10577         SYSTEM_POSTGRESQL=TRUE
10578         if test "$_os" = Darwin; then
10579             supp_path=''
10580             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10581                 pg_supp_path="$P_SEP$d$pg_supp_path"
10582             done
10583         fi
10584         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10585         if test -n "$PGCONFIG"; then
10586             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10587             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10588         else
10589             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10590               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10591               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10592             ],[
10593               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10594             ])
10595         fi
10596         FilterLibs "${POSTGRESQL_LIB}"
10597         POSTGRESQL_LIB="${filteredlibs}"
10598     else
10599         # if/when anything else than PostgreSQL uses Kerberos,
10600         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10601         WITH_KRB5=
10602         WITH_GSSAPI=
10603         case "$_os" in
10604         Darwin)
10605             # macOS has system MIT Kerberos 5 since 10.4
10606             if test "$with_krb5" != "no"; then
10607                 WITH_KRB5=TRUE
10608                 save_LIBS=$LIBS
10609                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10610                 # that the libraries where these functions are located on macOS will change, is it?
10611                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10612                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10613                 KRB5_LIBS=$LIBS
10614                 LIBS=$save_LIBS
10615                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10616                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10617                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10618                 LIBS=$save_LIBS
10619             fi
10620             if test "$with_gssapi" != "no"; then
10621                 WITH_GSSAPI=TRUE
10622                 save_LIBS=$LIBS
10623                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10624                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10625                 GSSAPI_LIBS=$LIBS
10626                 LIBS=$save_LIBS
10627             fi
10628             ;;
10629         WINNT)
10630             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10631                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10632             fi
10633             ;;
10634         Linux|GNU|*BSD|DragonFly)
10635             if test "$with_krb5" != "no"; then
10636                 WITH_KRB5=TRUE
10637                 save_LIBS=$LIBS
10638                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10639                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10640                 KRB5_LIBS=$LIBS
10641                 LIBS=$save_LIBS
10642                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10643                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10644                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10645                 LIBS=$save_LIBS
10646             fi
10647             if test "$with_gssapi" != "no"; then
10648                 WITH_GSSAPI=TRUE
10649                 save_LIBS=$LIBS
10650                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10651                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10652                 GSSAPI_LIBS=$LIBS
10653                 LIBS=$save_LIBS
10654             fi
10655             ;;
10656         *)
10657             if test "$with_krb5" = "yes"; then
10658                 WITH_KRB5=TRUE
10659                 save_LIBS=$LIBS
10660                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10661                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10662                 KRB5_LIBS=$LIBS
10663                 LIBS=$save_LIBS
10664                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10665                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10666                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10667                 LIBS=$save_LIBS
10668             fi
10669             if test "$with_gssapi" = "yes"; then
10670                 WITH_GSSAPI=TRUE
10671                 save_LIBS=$LIBS
10672                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10673                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10674                 LIBS=$save_LIBS
10675                 GSSAPI_LIBS=$LIBS
10676             fi
10677         esac
10679         if test -n "$with_libpq_path"; then
10680             SYSTEM_POSTGRESQL=TRUE
10681             postgres_interface="external libpq"
10682             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10683             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10684         else
10685             SYSTEM_POSTGRESQL=
10686             postgres_interface="internal"
10687             POSTGRESQL_LIB=""
10688             POSTGRESQL_INC="%OVERRIDE_ME%"
10689             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10690         fi
10691     fi
10693     AC_MSG_CHECKING([PostgreSQL C interface])
10694     AC_MSG_RESULT([$postgres_interface])
10696     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10697         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10698         save_CFLAGS=$CFLAGS
10699         save_CPPFLAGS=$CPPFLAGS
10700         save_LIBS=$LIBS
10701         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10702         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10703         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10704         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10705             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10706         CFLAGS=$save_CFLAGS
10707         CPPFLAGS=$save_CPPFLAGS
10708         LIBS=$save_LIBS
10709     fi
10710     BUILD_POSTGRESQL_SDBC=TRUE
10711 else
10712     AC_MSG_RESULT([no])
10714 AC_SUBST(WITH_KRB5)
10715 AC_SUBST(WITH_GSSAPI)
10716 AC_SUBST(GSSAPI_LIBS)
10717 AC_SUBST(KRB5_LIBS)
10718 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10719 AC_SUBST(SYSTEM_POSTGRESQL)
10720 AC_SUBST(POSTGRESQL_INC)
10721 AC_SUBST(POSTGRESQL_LIB)
10723 dnl ===================================================================
10724 dnl Check for Firebird stuff
10725 dnl ===================================================================
10726 ENABLE_FIREBIRD_SDBC=
10727 if test "$enable_firebird_sdbc" = "yes" ; then
10728     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10730     dnl ===================================================================
10731     dnl Check for system Firebird
10732     dnl ===================================================================
10733     AC_MSG_CHECKING([which Firebird to use])
10734     if test "$with_system_firebird" = "yes"; then
10735         AC_MSG_RESULT([external])
10736         SYSTEM_FIREBIRD=TRUE
10737         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10738         if test -z "$FIREBIRDCONFIG"; then
10739             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10740             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10741                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10742             ])
10743             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10744         else
10745             AC_MSG_NOTICE([fb_config found])
10746             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10747             AC_MSG_CHECKING([for Firebird Client library])
10748             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10749             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10750             FilterLibs "${FIREBIRD_LIBS}"
10751             FIREBIRD_LIBS="${filteredlibs}"
10752         fi
10753         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10754         AC_MSG_CHECKING([Firebird version])
10755         if test -n "${FIREBIRD_VERSION}"; then
10756             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10757             if test "$FIREBIRD_MAJOR" -ge "3"; then
10758                 AC_MSG_RESULT([OK])
10759             else
10760                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10761             fi
10762         else
10763             save_CFLAGS="${CFLAGS}"
10764             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10765             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10766 #if defined(FB_API_VER) && FB_API_VER == 30
10767 int fb_api_is_30(void) { return 0; }
10768 #else
10769 #error "Wrong Firebird API version"
10770 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10771             CFLAGS="$save_CFLAGS"
10772         fi
10773         ENABLE_FIREBIRD_SDBC=TRUE
10774         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10775     elif test "$enable_database_connectivity" = no; then
10776         AC_MSG_RESULT([none])
10777     elif test "$cross_compiling" = "yes"; then
10778         AC_MSG_RESULT([none])
10779     else
10780         dnl Embedded Firebird has version 3.0
10781         dnl We need libatomic_ops for any non X86/X64 system
10782         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10783             dnl ===================================================================
10784             dnl Check for system libatomic_ops
10785             dnl ===================================================================
10786             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10787             if test "$with_system_libatomic_ops" = "yes"; then
10788                 SYSTEM_LIBATOMIC_OPS=TRUE
10789                 AC_CHECK_HEADERS(atomic_ops.h, [],
10790                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10791             else
10792                 SYSTEM_LIBATOMIC_OPS=
10793                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10794                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10795                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10796             fi
10797         fi
10799         AC_MSG_RESULT([internal])
10800         SYSTEM_FIREBIRD=
10801         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10802         FIREBIRD_LIBS="-lfbclient"
10804         if test "$with_system_libtommath" = "yes"; then
10805             SYSTEM_LIBTOMMATH=TRUE
10806             dnl check for tommath presence
10807             save_LIBS=$LIBS
10808             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10809             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10810             LIBS=$save_LIBS
10811         else
10812             SYSTEM_LIBTOMMATH=
10813             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10814             LIBTOMMATH_LIBS="-ltommath"
10815             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10816         fi
10818         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10819         ENABLE_FIREBIRD_SDBC=TRUE
10820         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10821     fi
10823 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10824 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10825 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10826 AC_SUBST(LIBATOMIC_OPS_LIBS)
10827 AC_SUBST(SYSTEM_FIREBIRD)
10828 AC_SUBST(FIREBIRD_CFLAGS)
10829 AC_SUBST(FIREBIRD_LIBS)
10830 AC_SUBST(SYSTEM_LIBTOMMATH)
10831 AC_SUBST(LIBTOMMATH_CFLAGS)
10832 AC_SUBST(LIBTOMMATH_LIBS)
10834 dnl ===================================================================
10835 dnl Check for system curl
10836 dnl ===================================================================
10837 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10839 if test "$enable_curl" = "yes" -a "$with_system_curl" != "yes" -a "$with_gssapi" != "no"; then
10840     if test "$_os" != "WINNT"; then
10841         WITH_GSSAPI=TRUE
10842         save_LIBS=$LIBS
10843         AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10844             [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10845         GSSAPI_LIBS=$LIBS
10846         LIBS=$save_LIBS
10847     fi
10850 dnl ===================================================================
10851 dnl Check for system boost
10852 dnl ===================================================================
10853 AC_MSG_CHECKING([which boost to use])
10854 if test "$with_system_boost" = "yes"; then
10855     AC_MSG_RESULT([external])
10856     SYSTEM_BOOST=TRUE
10857     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10858     AX_BOOST_DATE_TIME
10859     AX_BOOST_FILESYSTEM
10860     AX_BOOST_IOSTREAMS
10861     AX_BOOST_LOCALE
10862     AC_LANG_PUSH([C++])
10863     save_CXXFLAGS=$CXXFLAGS
10864     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10865     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10866        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10867     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10868        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10869     CXXFLAGS=$save_CXXFLAGS
10870     AC_LANG_POP([C++])
10871     # this is in m4/ax_boost_base.m4
10872     FilterLibs "${BOOST_LDFLAGS}"
10873     BOOST_LDFLAGS="${filteredlibs}"
10874 else
10875     AC_MSG_RESULT([internal])
10876     BUILD_TYPE="$BUILD_TYPE BOOST"
10877     SYSTEM_BOOST=
10878     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10879         # use warning-suppressing wrapper headers
10880         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10881     else
10882         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10883     fi
10885 AC_SUBST(SYSTEM_BOOST)
10887 dnl ===================================================================
10888 dnl Check for system mdds
10889 dnl ===================================================================
10890 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10891 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10893 dnl ===================================================================
10894 dnl Check for system dragonbox
10895 dnl ===================================================================
10896 AC_MSG_CHECKING([which dragonbox to use])
10897 if test "$with_system_dragonbox" = "yes"; then
10898     AC_MSG_RESULT([external])
10899     SYSTEM_DRAGONBOX=TRUE
10900     AC_LANG_PUSH([C++])
10901     save_CPPFLAGS=$CPPFLAGS
10902     # This is where upstream installs to, unfortunately no .pc or so...
10903     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10904     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10905     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10906        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10907     AC_LANG_POP([C++])
10908     CPPFLAGS=$save_CPPFLAGS
10909 else
10910     AC_MSG_RESULT([internal])
10911     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10912     SYSTEM_DRAGONBOX=
10914 AC_SUBST([SYSTEM_DRAGONBOX])
10915 AC_SUBST([DRAGONBOX_CFLAGS])
10917 dnl ===================================================================
10918 dnl Check for system frozen
10919 dnl ===================================================================
10920 AC_MSG_CHECKING([which frozen to use])
10921 if test "$with_system_frozen" = "yes"; then
10922     AC_MSG_RESULT([external])
10923     SYSTEM_FROZEN=TRUE
10924     AC_LANG_PUSH([C++])
10925     save_CPPFLAGS=$CPPFLAGS
10926     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10927        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10928     AC_LANG_POP([C++])
10929     CPPFLAGS=$save_CPPFLAGS
10930 else
10931     AC_MSG_RESULT([internal])
10932     BUILD_TYPE="$BUILD_TYPE FROZEN"
10933     SYSTEM_FROZEN=
10935 AC_SUBST([SYSTEM_FROZEN])
10936 AC_SUBST([FROZEN_CFLAGS])
10938 dnl ===================================================================
10939 dnl Check for system libfixmath
10940 dnl ===================================================================
10941 AC_MSG_CHECKING([which libfixmath to use])
10942 if test "$with_system_libfixmath" = "yes"; then
10943     AC_MSG_RESULT([external])
10944     SYSTEM_LIBFIXMATH=TRUE
10945     AC_LANG_PUSH([C++])
10946     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10947        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10948     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10949                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10950                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10951     AC_LANG_POP([C++])
10952 else
10953     AC_MSG_RESULT([internal])
10954     SYSTEM_LIBFIXMATH=
10955     LIBFIXMATH_LIBS=
10957 AC_SUBST([SYSTEM_LIBFIXMATH])
10958 AC_SUBST([LIBFIXMATH_LIBS])
10960 dnl ===================================================================
10961 dnl Check for system glm
10962 dnl ===================================================================
10963 AC_MSG_CHECKING([which glm to use])
10964 if test "$with_system_glm" = "yes"; then
10965     AC_MSG_RESULT([external])
10966     SYSTEM_GLM=TRUE
10967     AC_LANG_PUSH([C++])
10968     AC_CHECK_HEADER([glm/glm.hpp], [],
10969        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10970     AC_LANG_POP([C++])
10971 else
10972     AC_MSG_RESULT([internal])
10973     BUILD_TYPE="$BUILD_TYPE GLM"
10974     SYSTEM_GLM=
10975     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10977 AC_SUBST([GLM_CFLAGS])
10978 AC_SUBST([SYSTEM_GLM])
10980 dnl ===================================================================
10981 dnl Check for system odbc
10982 dnl ===================================================================
10983 AC_MSG_CHECKING([which odbc headers to use])
10984 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
10985     AC_MSG_RESULT([external])
10986     SYSTEM_ODBC_HEADERS=TRUE
10988     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10989         save_CPPFLAGS=$CPPFLAGS
10990         find_winsdk
10991         PathFormat "$winsdktest"
10992         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"
10993         AC_CHECK_HEADER(sqlext.h, [],
10994             [AC_MSG_ERROR(odbc not found. install odbc)],
10995             [#include <windows.h>])
10996         CPPFLAGS=$save_CPPFLAGS
10997     else
10998         AC_CHECK_HEADER(sqlext.h, [],
10999             [AC_MSG_ERROR(odbc not found. install odbc)],[])
11000     fi
11001 elif test "$enable_database_connectivity" = no; then
11002     AC_MSG_RESULT([none])
11003 else
11004     AC_MSG_RESULT([internal])
11005     SYSTEM_ODBC_HEADERS=
11007 AC_SUBST(SYSTEM_ODBC_HEADERS)
11009 dnl ===================================================================
11010 dnl Check for system NSS
11011 dnl ===================================================================
11012 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
11013     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
11014     AC_DEFINE(HAVE_FEATURE_NSS)
11015     ENABLE_NSS=TRUE
11016 elif test $_os != iOS -a "$enable_openssl" != "no"; then
11017     with_tls=openssl
11019 AC_SUBST(ENABLE_NSS)
11021 dnl ===================================================================
11022 dnl Enable LDAP support
11023 dnl ===================================================================
11025 if test "$test_openldap" = yes; then
11026     AC_MSG_CHECKING([whether to enable LDAP support])
11027     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
11028         AC_MSG_RESULT([yes])
11029         ENABLE_LDAP=TRUE
11030     else
11031         if test "$enable_ldap" != "yes"; then
11032             AC_MSG_RESULT([no])
11033         else
11034             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
11035         fi
11036     fi
11038 dnl ===================================================================
11039 dnl Check for system openldap
11040 dnl ===================================================================
11042     if test "$ENABLE_LDAP" = TRUE; then
11043         AC_MSG_CHECKING([which openldap library to use])
11044         if test "$with_system_openldap" = yes; then
11045             AC_MSG_RESULT([external])
11046             SYSTEM_OPENLDAP=TRUE
11047             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
11048             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
11049             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
11050         else
11051             AC_MSG_RESULT([internal])
11052             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
11053         fi
11054     fi
11057 AC_SUBST(ENABLE_LDAP)
11058 AC_SUBST(SYSTEM_OPENLDAP)
11060 dnl ===================================================================
11061 dnl Check for TLS/SSL and cryptographic implementation to use
11062 dnl ===================================================================
11063 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
11064 if test -n "$with_tls"; then
11065     case $with_tls in
11066     openssl)
11067         AC_DEFINE(USE_TLS_OPENSSL)
11068         TLS=OPENSSL
11069         AC_MSG_RESULT([$TLS])
11071         if test "$enable_openssl" != "yes"; then
11072             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
11073         fi
11075         # warn that OpenSSL has been selected but not all TLS code has this option
11076         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
11077         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
11078         ;;
11079     nss)
11080         AC_DEFINE(USE_TLS_NSS)
11081         TLS=NSS
11082         AC_MSG_RESULT([$TLS])
11083         ;;
11084     no)
11085         AC_MSG_RESULT([none])
11086         AC_MSG_WARN([Skipping TLS/SSL])
11087         ;;
11088     *)
11089         AC_MSG_RESULT([])
11090         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
11091 openssl - OpenSSL
11092 nss - Mozilla's Network Security Services (NSS)
11093     ])
11094         ;;
11095     esac
11096 else
11097     # default to using NSS, it results in smaller oox lib
11098     AC_DEFINE(USE_TLS_NSS)
11099     TLS=NSS
11100     AC_MSG_RESULT([$TLS])
11102 AC_SUBST(TLS)
11104 dnl ===================================================================
11105 dnl Check for system sane
11106 dnl ===================================================================
11107 AC_MSG_CHECKING([which sane header to use])
11108 if test "$with_system_sane" = "yes"; then
11109     AC_MSG_RESULT([external])
11110     AC_CHECK_HEADER(sane/sane.h, [],
11111       [AC_MSG_ERROR(sane not found. install sane)], [])
11112 else
11113     AC_MSG_RESULT([internal])
11114     BUILD_TYPE="$BUILD_TYPE SANE"
11117 dnl ===================================================================
11118 dnl Check for system icu
11119 dnl ===================================================================
11120 ICU_MAJOR=74
11121 ICU_MINOR=2
11122 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11123 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib -licuuc"
11124 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11125 if test "$SYSTEM_ICU" = TRUE; then
11126     AC_LANG_PUSH([C++])
11127     AC_MSG_CHECKING([for unicode/rbbi.h])
11128     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11129     AC_LANG_POP([C++])
11131     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11132     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11133     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11135     if test "$CROSS_COMPILING" != TRUE; then
11136         # using the system icu tools can lead to version confusion, use the
11137         # ones from the build environment when cross-compiling
11138         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11139         if test -z "$SYSTEM_GENBRK"; then
11140             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11141         fi
11142         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11143         if test -z "$SYSTEM_GENCCODE"; then
11144             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11145         fi
11146         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11147         if test -z "$SYSTEM_GENCMN"; then
11148             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11149         fi
11150     fi
11153 AC_SUBST(SYSTEM_GENBRK)
11154 AC_SUBST(SYSTEM_GENCCODE)
11155 AC_SUBST(SYSTEM_GENCMN)
11156 AC_SUBST(ICU_MAJOR)
11157 AC_SUBST(ICU_MINOR)
11159 dnl ==================================================================
11160 dnl CURL
11161 dnl ==================================================================
11162 if test "$enable_curl" = "yes"; then
11163     AC_DEFINE([HAVE_FEATURE_CURL])
11166 dnl ==================================================================
11167 dnl Breakpad
11168 dnl ==================================================================
11169 DEFAULT_CRASHDUMP_VALUE="true"
11170 AC_MSG_CHECKING([whether to enable breakpad])
11171 if test "$enable_breakpad" != yes; then
11172     AC_MSG_RESULT([no])
11173 else
11174     if test "$enable_curl" != "yes"; then
11175         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11176     fi
11177     AC_MSG_RESULT([yes])
11178     ENABLE_BREAKPAD="TRUE"
11179     AC_DEFINE(ENABLE_BREAKPAD)
11180     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11181     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11183     AC_MSG_CHECKING([for disable crash dump])
11184     if test "$enable_crashdump" = no; then
11185         DEFAULT_CRASHDUMP_VALUE="false"
11186         AC_MSG_RESULT([yes])
11187     else
11188        AC_MSG_RESULT([no])
11189     fi
11191     AC_MSG_CHECKING([for crashreport config])
11192     if test "$with_symbol_config" = "no"; then
11193         BREAKPAD_SYMBOL_CONFIG="invalid"
11194         AC_MSG_RESULT([no])
11195     else
11196         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11197         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11198         AC_MSG_RESULT([yes])
11199     fi
11200     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11202 AC_SUBST(ENABLE_BREAKPAD)
11203 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11205 dnl ==================================================================
11206 dnl libcmis
11207 dnl ==================================================================
11208 if test "$enable_libcmis" = "yes"; then
11209     if test "$enable_curl" != "yes"; then
11210         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11211     fi
11214 dnl ===================================================================
11215 dnl Orcus
11216 dnl ===================================================================
11217 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11218 if test "$with_system_orcus" != "yes"; then
11219     if test "$SYSTEM_BOOST" = "TRUE"; then
11220         dnl Link with Boost.System
11221         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11222         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11223         dnl in documentation has no effect.
11224         AX_BOOST_SYSTEM
11225     fi
11227 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11228 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11229 AC_SUBST([BOOST_SYSTEM_LIB])
11230 AC_SUBST(SYSTEM_LIBORCUS)
11232 dnl ===================================================================
11233 dnl HarfBuzz
11234 dnl ===================================================================
11235 harfbuzz_required_version=5.1.0
11237 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11238 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11239 case "$_os" in
11240     Linux)
11241         GRAPHITE_LIBS_internal='$(gb_StaticLibrary_WORKDIR)/libgraphite.a'
11242         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11243         ;;
11244     *)
11245         GRAPHITE_LIBS_internal='-L$(gb_StaticLibrary_WORKDIR) -lgraphite'
11246         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11247         ;;
11248 esac
11249 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11250 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11252 if test "$COM" = "MSC"; then # override the above
11253     GRAPHITE_LIBS='$(gb_StaticLibrary_WORKDIR)/graphite.lib'
11254     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11257 if test "$with_system_harfbuzz" = "yes"; then
11258     if test "$with_system_graphite" = "no"; then
11259         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11260     fi
11261     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11262     save_LIBS="$LIBS"
11263     save_CFLAGS="$CFLAGS"
11264     LIBS="$LIBS $HARFBUZZ_LIBS"
11265     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11266     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11267     LIBS="$save_LIBS"
11268     CFLAGS="$save_CFLAGS"
11269 else
11270     if test "$with_system_graphite" = "yes"; then
11271         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11272     fi
11275 if test "$USING_X11" = TRUE; then
11276     AC_PATH_X
11277     AC_PATH_XTRA
11278     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11280     if test -z "$x_includes"; then
11281         x_includes="default_x_includes"
11282     fi
11283     if test -z "$x_libraries"; then
11284         x_libraries="default_x_libraries"
11285     fi
11286     CFLAGS="$CFLAGS $X_CFLAGS"
11287     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11288     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11289 else
11290     x_includes="no_x_includes"
11291     x_libraries="no_x_libraries"
11294 if test "$USING_X11" = TRUE; then
11295     dnl ===================================================================
11296     dnl Check for extension headers
11297     dnl ===================================================================
11298     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11299      [#include <X11/extensions/shape.h>])
11301     # vcl needs ICE and SM
11302     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11303     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11304         [AC_MSG_ERROR(ICE library not found)])
11305     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11306     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11307         [AC_MSG_ERROR(SM library not found)])
11310 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11311     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11312     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11315 dnl ===================================================================
11316 dnl Check for system Xrender
11317 dnl ===================================================================
11318 AC_MSG_CHECKING([whether to use Xrender])
11319 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11320     AC_MSG_RESULT([yes])
11321     PKG_CHECK_MODULES(XRENDER, xrender)
11322     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11323     FilterLibs "${XRENDER_LIBS}"
11324     XRENDER_LIBS="${filteredlibs}"
11325     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11326       [AC_MSG_ERROR(libXrender not found or functional)], [])
11327     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11328       [AC_MSG_ERROR(Xrender not found. install X)], [])
11329 else
11330     AC_MSG_RESULT([no])
11332 AC_SUBST(XRENDER_CFLAGS)
11333 AC_SUBST(XRENDER_LIBS)
11335 dnl ===================================================================
11336 dnl Check for XRandr
11337 dnl ===================================================================
11338 AC_MSG_CHECKING([whether to enable RandR support])
11339 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11340     AC_MSG_RESULT([yes])
11341     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11342     if test "$ENABLE_RANDR" != "TRUE"; then
11343         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11344                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11345         XRANDR_CFLAGS=" "
11346         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11347           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11348         XRANDR_LIBS="-lXrandr "
11349         ENABLE_RANDR="TRUE"
11350     fi
11351     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11352     FilterLibs "${XRANDR_LIBS}"
11353     XRANDR_LIBS="${filteredlibs}"
11354 else
11355     ENABLE_RANDR=""
11356     AC_MSG_RESULT([no])
11358 AC_SUBST(XRANDR_CFLAGS)
11359 AC_SUBST(XRANDR_LIBS)
11360 AC_SUBST(ENABLE_RANDR)
11362 if test -z "$with_webdav"; then
11363     with_webdav=$test_webdav
11366 AC_MSG_CHECKING([for WebDAV support])
11367 case "$with_webdav" in
11369     AC_MSG_RESULT([no])
11370     WITH_WEBDAV=""
11371     ;;
11373     AC_MSG_RESULT([yes])
11374     # curl is already mandatory (almost) and checked elsewhere
11375     if test "$enable_curl" = "no"; then
11376         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11377     fi
11378     WITH_WEBDAV=TRUE
11379     ;;
11380 esac
11381 AC_SUBST(WITH_WEBDAV)
11383 dnl ===================================================================
11384 dnl Check for disabling cve_tests
11385 dnl ===================================================================
11386 AC_MSG_CHECKING([whether to execute CVE tests])
11387 if test "$enable_cve_tests" = "no"; then
11388     AC_MSG_RESULT([no])
11389     DISABLE_CVE_TESTS=TRUE
11390     AC_SUBST(DISABLE_CVE_TESTS)
11391 else
11392     AC_MSG_RESULT([yes])
11395 dnl ===================================================================
11396 dnl Check for system openssl
11397 dnl ===================================================================
11398 ENABLE_OPENSSL=
11399 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11400 if test "$enable_openssl" = "yes"; then
11401     AC_MSG_RESULT([no])
11402     ENABLE_OPENSSL=TRUE
11403     if test "$_os" = Darwin ; then
11404         # OpenSSL is deprecated when building for 10.7 or later.
11405         #
11406         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11407         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11409         with_system_openssl=no
11410         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11411     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11412             && test "$with_system_openssl" != "no"; then
11413         with_system_openssl=yes
11414         SYSTEM_OPENSSL=TRUE
11415         OPENSSL_CFLAGS=
11416         OPENSSL_LIBS="-lssl -lcrypto"
11417     else
11418         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11419         if test -n "${SYSTEM_OPENSSL}"; then
11420             AC_DEFINE([SYSTEM_OPENSSL])
11421         fi
11422     fi
11423     if test "$with_system_openssl" = "yes"; then
11424         AC_MSG_CHECKING([whether openssl supports SHA512])
11425         AC_LANG_PUSH([C])
11426         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11427             SHA512_CTX context;
11428 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11429         AC_LANG_POP(C)
11430     fi
11431 else
11432     AC_MSG_RESULT([yes])
11434     # warn that although OpenSSL is disabled, system libraries may depend on it
11435     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11436     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11439 AC_SUBST([ENABLE_OPENSSL])
11441 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11442     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11443         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11444         enable_cipher_openssl_backend=no
11445     else
11446         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11447     fi
11449 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11450 ENABLE_CIPHER_OPENSSL_BACKEND=
11451 if test "$enable_cipher_openssl_backend" = yes; then
11452     AC_MSG_RESULT([yes])
11453     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11454 else
11455     AC_MSG_RESULT([no])
11457 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11459 dnl ===================================================================
11460 dnl Select the crypto backends used by LO
11461 dnl ===================================================================
11463 if test "$build_crypto" = yes; then
11464     if test "$OS" = WNT; then
11465         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11466         AC_DEFINE([USE_CRYPTO_MSCAPI])
11467     elif test "$ENABLE_NSS" = TRUE; then
11468         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11469         AC_DEFINE([USE_CRYPTO_NSS])
11470     fi
11473 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11474 if test "$COM" = "MSC"; then
11475     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11476 else
11477     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11479 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11481 dnl ===================================================================
11482 dnl Check for system redland
11483 dnl ===================================================================
11484 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11485 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11486 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11487 if test "$with_system_redland" = "yes"; then
11488     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11489             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11490 else
11491     RAPTOR_MAJOR="0"
11492     RASQAL_MAJOR="3"
11493     REDLAND_MAJOR="0"
11495 AC_SUBST(RAPTOR_MAJOR)
11496 AC_SUBST(RASQAL_MAJOR)
11497 AC_SUBST(REDLAND_MAJOR)
11499 dnl ===================================================================
11500 dnl Check for system hunspell
11501 dnl ===================================================================
11502 AC_MSG_CHECKING([which libhunspell to use])
11503 if test "$with_system_hunspell" = "yes"; then
11504     AC_MSG_RESULT([external])
11505     SYSTEM_HUNSPELL=TRUE
11506     AC_LANG_PUSH([C++])
11507     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11508     if test "$HUNSPELL_PC" != "TRUE"; then
11509         AC_CHECK_HEADER(hunspell.hxx, [],
11510             [
11511             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11512             [AC_MSG_ERROR(hunspell headers not found.)], [])
11513             ], [])
11514         AC_CHECK_LIB([hunspell], [main], [:],
11515            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11516         HUNSPELL_LIBS=-lhunspell
11517     fi
11518     AC_LANG_POP([C++])
11519     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11520     FilterLibs "${HUNSPELL_LIBS}"
11521     HUNSPELL_LIBS="${filteredlibs}"
11522 else
11523     AC_MSG_RESULT([internal])
11524     SYSTEM_HUNSPELL=
11525     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11526     if test "$COM" = "MSC"; then
11527         HUNSPELL_LIBS='$(gb_StaticLibrary_WORKDIR)/hunspell.lib'
11528     else
11529         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11530     fi
11531     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11533 AC_SUBST(SYSTEM_HUNSPELL)
11534 AC_SUBST(HUNSPELL_CFLAGS)
11535 AC_SUBST(HUNSPELL_LIBS)
11537 dnl ===================================================================
11538 dnl Check for system zxcvbn
11539 dnl ===================================================================
11540 AC_MSG_CHECKING([which zxcvbn to use])
11541 if test "$with_system_zxcvbn" = "yes"; then
11542     AC_MSG_RESULT([external])
11543     SYSTEM_ZXCVBN=TRUE
11544     AC_CHECK_HEADER(zxcvbn.h, [],
11545        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11546     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11547         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11548 else
11549    AC_MSG_RESULT([internal])
11550    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11551    SYSTEM_ZXCVBN=
11553 AC_SUBST(SYSTEM_ZXCVBN)
11555 dnl ===================================================================
11556 dnl Check for system zxing
11557 dnl ===================================================================
11558 AC_MSG_CHECKING([whether to use zxing])
11559 if test "$enable_zxing" = "no"; then
11560     AC_MSG_RESULT([no])
11561     ENABLE_ZXING=
11562     SYSTEM_ZXING=
11563 else
11564     AC_MSG_RESULT([yes])
11565     ENABLE_ZXING=TRUE
11566     AC_MSG_CHECKING([which libzxing to use])
11567     if test "$with_system_zxing" = "yes"; then
11568         AC_MSG_RESULT([external])
11569         SYSTEM_ZXING=TRUE
11570         ZXING_CFLAGS=
11571         AC_LANG_PUSH([C++])
11572         save_CXXFLAGS=$CXXFLAGS
11573         save_IFS=$IFS
11574         IFS=$P_SEP
11575         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11576             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11577             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11578             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11579             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11580             dnl unsetting IFS."):
11581             IFS=$save_IFS
11582             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11583             dnl ignore them here:
11584             if test -z "$i"; then
11585                 continue
11586             fi
11587             dnl TODO: White space in $i would cause problems:
11588             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11589             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11590                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11591         done
11592         CXXFLAGS=$save_CXXFLAGS
11593         if test -z "$ZXING_CFLAGS"; then
11594             AC_MSG_ERROR(zxing headers not found.)
11595         fi
11596         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11597             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11598             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11599         AC_LANG_POP([C++])
11600         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11601         FilterLibs "${ZXING_LIBS}"
11602         ZXING_LIBS="${filteredlibs}"
11603     else
11604         AC_MSG_RESULT([internal])
11605         SYSTEM_ZXING=
11606         BUILD_TYPE="$BUILD_TYPE ZXING"
11607         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11608     fi
11609     if test "$ENABLE_ZXING" = TRUE; then
11610         AC_DEFINE(ENABLE_ZXING)
11611     fi
11612     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11613     AC_LANG_PUSH([C++])
11614     save_CXXFLAGS=$CXXFLAGS
11615     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11616     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11617             #include <BitMatrix.h>
11618             #include <BitMatrixIO.h>
11619             int main(){
11620                 ZXing::BitMatrix matrix(1, 1);
11621                 matrix.set(0, 0, true);
11622                 ZXing::ToSVG(matrix);
11623                 return 0;
11624             }
11625         ])], [
11626             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11627             AC_MSG_RESULT([yes])
11628         ], [AC_MSG_RESULT([no])])
11629     CXXFLAGS=$save_CXXFLAGS
11630     AC_LANG_POP([C++])
11631     AC_SUBST(HAVE_ZXING_TOSVG)
11633 AC_SUBST(SYSTEM_ZXING)
11634 AC_SUBST(ENABLE_ZXING)
11635 AC_SUBST(ZXING_CFLAGS)
11636 AC_SUBST(ZXING_LIBS)
11638 dnl ===================================================================
11639 dnl Check for system box2d
11640 dnl ===================================================================
11641 AC_MSG_CHECKING([which box2d to use])
11642 if test "$with_system_box2d" = "yes"; then
11643     AC_MSG_RESULT([external])
11644     SYSTEM_BOX2D=TRUE
11645     AC_LANG_PUSH([C++])
11646     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11647         [BOX2D_H_FOUND='FALSE'])
11648     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11649         _BOX2D_LIB=box2d
11650         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11651     else
11652         # fail this. there's no other alternative to check when we are here.
11653         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11654             [AC_MSG_ERROR(box2d headers not found.)])
11655         _BOX2D_LIB=Box2D
11656         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11657     fi
11658     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11659         [ AC_MSG_ERROR(box2d library not found.) ], [])
11660     BOX2D_LIBS=-l$_BOX2D_LIB
11661     AC_LANG_POP([C++])
11662     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11663     FilterLibs "${BOX2D_LIBS}"
11664     BOX2D_LIBS="${filteredlibs}"
11665 else
11666     AC_MSG_RESULT([internal])
11667     SYSTEM_BOX2D=
11668     BUILD_TYPE="$BUILD_TYPE BOX2D"
11670 AC_SUBST(SYSTEM_BOX2D)
11671 AC_SUBST(BOX2D_CFLAGS)
11672 AC_SUBST(BOX2D_LIBS)
11674 dnl ===================================================================
11675 dnl Checking for altlinuxhyph
11676 dnl ===================================================================
11677 AC_MSG_CHECKING([which altlinuxhyph to use])
11678 if test "$with_system_altlinuxhyph" = "yes"; then
11679     AC_MSG_RESULT([external])
11680     SYSTEM_HYPH=TRUE
11681     AC_CHECK_HEADER(hyphen.h, [],
11682        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11683     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11684        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11685        [#include <hyphen.h>])
11686     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11687         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11688     if test -z "$HYPHEN_LIB"; then
11689         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11690            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11691     fi
11692     if test -z "$HYPHEN_LIB"; then
11693         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11694            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11695     fi
11696 else
11697     AC_MSG_RESULT([internal])
11698     SYSTEM_HYPH=
11699     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11700     if test "$COM" = "MSC"; then
11701         HYPHEN_LIB='$(gb_StaticLibrary_WORKDIR)/hyphen.lib'
11702     else
11703         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11704     fi
11706 AC_SUBST(SYSTEM_HYPH)
11707 AC_SUBST(HYPHEN_LIB)
11709 dnl ===================================================================
11710 dnl Checking for mythes
11711 dnl ===================================================================
11712 AC_MSG_CHECKING([which mythes to use])
11713 if test "$with_system_mythes" = "yes"; then
11714     AC_MSG_RESULT([external])
11715     SYSTEM_MYTHES=TRUE
11716     AC_LANG_PUSH([C++])
11717     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11718     if test "$MYTHES_PKGCONFIG" = "no"; then
11719         AC_CHECK_HEADER(mythes.hxx, [],
11720             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11721         AC_CHECK_LIB([mythes-1.2], [main], [:],
11722             [ MYTHES_FOUND=no], [])
11723     if test "$MYTHES_FOUND" = "no"; then
11724         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11725                 [ MYTHES_FOUND=no], [])
11726     fi
11727     if test "$MYTHES_FOUND" = "no"; then
11728         AC_MSG_ERROR([mythes library not found!.])
11729     fi
11730     fi
11731     AC_LANG_POP([C++])
11732     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11733     FilterLibs "${MYTHES_LIBS}"
11734     MYTHES_LIBS="${filteredlibs}"
11735 else
11736     AC_MSG_RESULT([internal])
11737     SYSTEM_MYTHES=
11738     BUILD_TYPE="$BUILD_TYPE MYTHES"
11739     if test "$COM" = "MSC"; then
11740         MYTHES_LIBS='$(gb_StaticLibrary_WORKDIR)/mythes.lib'
11741     else
11742         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11743     fi
11745 AC_SUBST(SYSTEM_MYTHES)
11746 AC_SUBST(MYTHES_CFLAGS)
11747 AC_SUBST(MYTHES_LIBS)
11749 dnl ===================================================================
11750 dnl How should we build the linear programming solver ?
11751 dnl ===================================================================
11753 ENABLE_COINMP=
11754 AC_MSG_CHECKING([whether to build with CoinMP])
11755 if test "$enable_coinmp" != "no"; then
11756     ENABLE_COINMP=TRUE
11757     AC_MSG_RESULT([yes])
11758     if test "$with_system_coinmp" = "yes"; then
11759         SYSTEM_COINMP=TRUE
11760         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11761         FilterLibs "${COINMP_LIBS}"
11762         COINMP_LIBS="${filteredlibs}"
11763     else
11764         BUILD_TYPE="$BUILD_TYPE COINMP"
11765     fi
11766 else
11767     AC_MSG_RESULT([no])
11769 AC_SUBST(ENABLE_COINMP)
11770 AC_SUBST(SYSTEM_COINMP)
11771 AC_SUBST(COINMP_CFLAGS)
11772 AC_SUBST(COINMP_LIBS)
11774 ENABLE_LPSOLVE=
11775 AC_MSG_CHECKING([whether to build with lpsolve])
11776 if test "$enable_lpsolve" != "no"; then
11777     ENABLE_LPSOLVE=TRUE
11778     AC_MSG_RESULT([yes])
11779 else
11780     AC_MSG_RESULT([no])
11782 AC_SUBST(ENABLE_LPSOLVE)
11784 if test "$ENABLE_LPSOLVE" = TRUE; then
11785     AC_MSG_CHECKING([which lpsolve to use])
11786     if test "$with_system_lpsolve" = "yes"; then
11787         AC_MSG_RESULT([external])
11788         SYSTEM_LPSOLVE=TRUE
11789         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11790            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11791         save_LIBS=$LIBS
11792         # some systems need this. Like Ubuntu...
11793         AC_CHECK_LIB(m, floor)
11794         AC_CHECK_LIB(dl, dlopen)
11795         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11796             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11797         LIBS=$save_LIBS
11798     else
11799         AC_MSG_RESULT([internal])
11800         SYSTEM_LPSOLVE=
11801         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11802     fi
11804 AC_SUBST(SYSTEM_LPSOLVE)
11806 dnl ===================================================================
11807 dnl Checking for libexttextcat
11808 dnl ===================================================================
11809 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11810 if test "$with_system_libexttextcat" = "yes"; then
11811     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11813 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11815 dnl ===================================================================
11816 dnl Checking for libnumbertext
11817 dnl ===================================================================
11818 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11819 if test "$with_system_libnumbertext" = "yes"; then
11820     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11821     SYSTEM_LIBNUMBERTEXT=YES
11822 else
11823     SYSTEM_LIBNUMBERTEXT=
11825 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11826 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11828 dnl ***************************************
11829 dnl testing libc version for Linux...
11830 dnl ***************************************
11831 if test "$_os" = "Linux"; then
11832     AC_MSG_CHECKING([whether the libc is recent enough])
11833     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11834     #include <features.h>
11835     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11836     #error glibc >= 2.1 is required
11837     #endif
11838     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11841 dnl =========================================
11842 dnl Check for uuidgen
11843 dnl =========================================
11844 if test "$_os" = "WINNT"; then
11845     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11846     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11847     UUIDGEN=uuidgen.exe
11848     AC_SUBST(UUIDGEN)
11849 else
11850     AC_PATH_PROG([UUIDGEN], [uuidgen])
11851     if test -z "$UUIDGEN"; then
11852         AC_MSG_WARN([uuid is needed for building installation sets])
11853     fi
11856 dnl ***************************************
11857 dnl Checking for bison and flex
11858 dnl ***************************************
11859 AC_PATH_PROG(BISON, bison)
11860 if test -z "$BISON"; then
11861     AC_MSG_ERROR([no bison found in \$PATH, install it])
11862 else
11863     AC_MSG_CHECKING([the bison version])
11864     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11865     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11866     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11867     dnl cause
11868     dnl
11869     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]
11870     dnl   typedef union YYSTYPE
11871     dnl           ~~~~~~^~~~~~~
11872     dnl
11873     dnl while at least 3.4.1 is know to be good:
11874     if test "$COMPILER_PLUGINS" = TRUE; then
11875         if test "$_bison_longver" -lt 2004; then
11876             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11877         fi
11878     else
11879         if test "$_bison_longver" -lt 2000; then
11880             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11881         fi
11882     fi
11884 AC_SUBST([BISON])
11886 AC_PATH_PROG(FLEX, flex)
11887 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11888     FLEX=`cygpath -m $FLEX`
11890 if test -z "$FLEX"; then
11891     AC_MSG_ERROR([no flex found in \$PATH, install it])
11892 else
11893     AC_MSG_CHECKING([the flex version])
11894     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11895     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11896         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11897     fi
11899 AC_SUBST([FLEX])
11901 AC_PATH_PROG(DIFF, diff)
11902 if test -z "$DIFF"; then
11903     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11905 AC_SUBST([DIFF])
11907 AC_PATH_PROG(UNIQ, uniq)
11908 if test -z "$UNIQ"; then
11909     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11911 AC_SUBST([UNIQ])
11913 dnl ***************************************
11914 dnl Checking for patch
11915 dnl ***************************************
11916 AC_PATH_PROG(PATCH, patch)
11917 if test -z "$PATCH"; then
11918     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11921 dnl On Solaris or macOS, check if --with-gnu-patch was used
11922 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11923     if test -z "$with_gnu_patch"; then
11924         GNUPATCH=$PATCH
11925     else
11926         if test -x "$with_gnu_patch"; then
11927             GNUPATCH=$with_gnu_patch
11928         else
11929             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11930         fi
11931     fi
11933     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11934     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11935         AC_MSG_RESULT([yes])
11936     else
11937         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11938             AC_MSG_RESULT([no, but accepted (Apple patch)])
11939             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11940         else
11941             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11942         fi
11943     fi
11944 else
11945     GNUPATCH=$PATCH
11948 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11949     GNUPATCH=`cygpath -m $GNUPATCH`
11952 dnl We also need to check for --with-gnu-cp
11954 if test -z "$with_gnu_cp"; then
11955     # check the place where the good stuff is hidden on Solaris...
11956     if test -x /usr/gnu/bin/cp; then
11957         GNUCP=/usr/gnu/bin/cp
11958     else
11959         AC_PATH_PROGS(GNUCP, gnucp cp)
11960     fi
11961     if test -z $GNUCP; then
11962         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11963     fi
11964 else
11965     if test -x "$with_gnu_cp"; then
11966         GNUCP=$with_gnu_cp
11967     else
11968         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11969     fi
11972 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11973     GNUCP=`cygpath -m $GNUCP`
11976 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11977 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11978     AC_MSG_RESULT([yes])
11979 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11980     AC_MSG_RESULT([yes])
11981 else
11982     case "$build_os" in
11983     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11984         x_GNUCP=[\#]
11985         GNUCP=''
11986         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11987         ;;
11988     *)
11989         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11990         ;;
11991     esac
11994 AC_SUBST(GNUPATCH)
11995 AC_SUBST(GNUCP)
11996 AC_SUBST(x_GNUCP)
11998 dnl ***************************************
11999 dnl testing assembler path
12000 dnl ***************************************
12001 ML_EXE=""
12002 if test "$_os" = "WINNT"; then
12003     case "$WIN_HOST_ARCH" in
12004     x86) assembler=ml.exe ;;
12005     x64) assembler=ml64.exe ;;
12006     arm64) assembler=armasm64.exe ;;
12007     esac
12009     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
12010     if test -f "$MSVC_HOST_PATH/$assembler"; then
12011         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
12012         AC_MSG_RESULT([$ML_EXE])
12013     else
12014         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
12015     fi
12018 AC_SUBST(ML_EXE)
12020 dnl ===================================================================
12021 dnl We need zip and unzip
12022 dnl ===================================================================
12023 AC_PATH_PROG(ZIP, zip)
12024 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
12025 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
12026     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],,)
12029 AC_PATH_PROG(UNZIP, unzip)
12030 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
12032 dnl ===================================================================
12033 dnl Zip must be a specific type for different build types.
12034 dnl ===================================================================
12035 if test $build_os = cygwin; then
12036     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
12037         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
12038     fi
12041 dnl ===================================================================
12042 dnl We need touch with -h option support.
12043 dnl ===================================================================
12044 AC_PATH_PROG(TOUCH, touch)
12045 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
12046 touch "$WARNINGS_FILE"
12047 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
12048     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],,)
12051 dnl ===================================================================
12052 dnl Check for system epoxy
12053 dnl ===================================================================
12054 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
12055 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
12057 dnl ===================================================================
12058 dnl Show which vclplugs will be built.
12059 dnl ===================================================================
12060 R=""
12062 libo_ENABLE_VCLPLUG([gen])
12063 libo_ENABLE_VCLPLUG([gtk3])
12064 libo_ENABLE_VCLPLUG([gtk3_kde5])
12065 libo_ENABLE_VCLPLUG([gtk4])
12066 libo_ENABLE_VCLPLUG([kf5])
12067 libo_ENABLE_VCLPLUG([kf6])
12068 libo_ENABLE_VCLPLUG([qt5])
12069 libo_ENABLE_VCLPLUG([qt6])
12071 if test "$_os" = "WINNT"; then
12072     R="$R win"
12073 elif test "$_os" = "Darwin"; then
12074     R="$R osx"
12075 elif test "$_os" = "iOS"; then
12076     R="ios"
12077 elif test "$_os" = Android; then
12078     R="android"
12081 build_vcl_plugins="$R"
12082 if test -z "$build_vcl_plugins"; then
12083     build_vcl_plugins=" none"
12085 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
12086 VCL_PLUGIN_INFO=$R
12087 AC_SUBST([VCL_PLUGIN_INFO])
12089 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
12090     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
12093 dnl ===================================================================
12094 dnl Check for GTK libraries
12095 dnl ===================================================================
12097 GTK3_CFLAGS=""
12098 GTK3_LIBS=""
12099 ENABLE_GTKTILEDVIEWER=""
12100 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12101     if test "$with_system_cairo" = no; then
12102         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.'
12103     fi
12104     : ${with_system_cairo:=yes}
12105     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)
12106     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12107     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12108     FilterLibs "${GTK3_LIBS}"
12109     GTK3_LIBS="${filteredlibs}"
12111     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12112     if test "$with_system_epoxy" != "yes"; then
12113         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12114         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12115                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12116     fi
12117 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12118     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12119     if test "$build_os" = "cygwin"; then
12120         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12121         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12122     fi
12124     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12125     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12126     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12127     FilterLibs "${GTK3_LIBS}"
12128     GTK3_LIBS="${filteredlibs}"
12129     ENABLE_GTKTILEDVIEWER="yes"
12131 AC_SUBST(GTK3_LIBS)
12132 AC_SUBST(GTK3_CFLAGS)
12133 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12135 GTK4_CFLAGS=""
12136 GTK4_LIBS=""
12137 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12138     if test "$with_system_cairo" = no; then
12139         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12140     fi
12141     : ${with_system_cairo:=yes}
12142     PKG_CHECK_MODULES(GTK4, gtk4 >= 4.10 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12143     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12144     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12145     FilterLibs "${GTK4_LIBS}"
12146     GTK4_LIBS="${filteredlibs}"
12148     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12149     if test "$with_system_epoxy" != "yes"; then
12150         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12151         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12152                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12153     fi
12155 AC_SUBST(GTK4_LIBS)
12156 AC_SUBST(GTK4_CFLAGS)
12158 if test "$enable_introspection" = yes; then
12159     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12160         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12161     else
12162         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12163     fi
12166 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12167 if ! test "$ENABLE_GTK3" = TRUE; then
12168     if test "$enable_atspi_tests" = yes; then
12169         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12170     fi
12171     enable_atspi_tests=no
12173 if ! test "$enable_atspi_tests" = no; then
12174     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12175     if ! test "$XVFB_RUN" = no; then
12176         dnl make sure the found xvfb-run actually works
12177         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12178         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12179             AC_MSG_RESULT([yes])
12180         else
12181             AC_MSG_RESULT([no])
12182             XVFB_RUN=no
12183         fi
12184     fi
12185     if test "$XVFB_RUN" = no; then
12186         if test "$enable_atspi_tests" = yes; then
12187             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12188         fi
12189         enable_atspi_tests=no
12190     fi
12192 if ! test "$enable_atspi_tests" = no; then
12193     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12194     if test "$DBUS_LAUNCH" = no; then
12195         if test "$enable_atspi_tests" = yes; then
12196             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12197         fi
12198         enable_atspi_tests=no
12199     fi
12201 if ! test "$enable_atspi_tests" = no; then
12202     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12203                       [if test "$enable_atspi_tests" = yes; then
12204                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12205                        else
12206                            enable_atspi_tests=no
12207                        fi])
12209 if ! test "x$enable_atspi_tests" = xno; then
12210     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12211                       [have_atspi_scroll_to=1],
12212                       [have_atspi_scroll_to=0])
12213     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12214                        [Whether AT-SPI2 has the scrollTo API])
12216 ENABLE_ATSPI_TESTS=
12217 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12218 AC_SUBST([ENABLE_ATSPI_TESTS])
12220 dnl ===================================================================
12221 dnl check for dbus support
12222 dnl ===================================================================
12223 ENABLE_DBUS=""
12224 DBUS_CFLAGS=""
12225 DBUS_LIBS=""
12226 DBUS_GLIB_CFLAGS=""
12227 DBUS_GLIB_LIBS=""
12228 DBUS_HAVE_GLIB=""
12230 if test "$enable_dbus" = "no"; then
12231     test_dbus=no
12234 AC_MSG_CHECKING([whether to enable DBUS support])
12235 if test "$test_dbus" = "yes"; then
12236     ENABLE_DBUS="TRUE"
12237     AC_MSG_RESULT([yes])
12238     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12239     AC_DEFINE(ENABLE_DBUS)
12240     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12241     FilterLibs "${DBUS_LIBS}"
12242     DBUS_LIBS="${filteredlibs}"
12244     # Glib is needed for BluetoothServer
12245     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12246     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12247         [
12248             DBUS_HAVE_GLIB="TRUE"
12249             AC_DEFINE(DBUS_HAVE_GLIB,1)
12250         ],
12251         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12252     )
12253 else
12254     AC_MSG_RESULT([no])
12257 AC_SUBST(ENABLE_DBUS)
12258 AC_SUBST(DBUS_CFLAGS)
12259 AC_SUBST(DBUS_LIBS)
12260 AC_SUBST(DBUS_GLIB_CFLAGS)
12261 AC_SUBST(DBUS_GLIB_LIBS)
12262 AC_SUBST(DBUS_HAVE_GLIB)
12264 AC_MSG_CHECKING([whether to enable Impress remote control])
12265 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12266     AC_MSG_RESULT([yes])
12267     ENABLE_SDREMOTE=TRUE
12268     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12269         <true/>"
12270     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12272     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12273         # The Bluetooth code doesn't compile with macOS SDK 10.15
12274         if test "$enable_sdremote_bluetooth" = yes; then
12275             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12276         fi
12277         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12278         enable_sdremote_bluetooth=no
12279     fi
12280     # If not explicitly enabled or disabled, default
12281     if test -z "$enable_sdremote_bluetooth"; then
12282         case "$OS" in
12283         LINUX|MACOSX|WNT)
12284             # Default to yes for these
12285             enable_sdremote_bluetooth=yes
12286             ;;
12287         *)
12288             # otherwise no
12289             enable_sdremote_bluetooth=no
12290             ;;
12291         esac
12292     fi
12293     # $enable_sdremote_bluetooth is guaranteed non-empty now
12295     if test "$enable_sdremote_bluetooth" != "no"; then
12296         if test "$OS" = "LINUX"; then
12297             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12298                 AC_MSG_RESULT([yes])
12299                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12300                 dnl ===================================================================
12301                 dnl Check for system bluez
12302                 dnl ===================================================================
12303                 AC_MSG_CHECKING([which Bluetooth header to use])
12304                 if test "$with_system_bluez" = "yes"; then
12305                     AC_MSG_RESULT([external])
12306                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12307                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12308                     SYSTEM_BLUEZ=TRUE
12309                 else
12310                     AC_MSG_RESULT([internal])
12311                     SYSTEM_BLUEZ=
12312                 fi
12313             else
12314                 AC_MSG_RESULT([no, dbus disabled])
12315                 ENABLE_SDREMOTE_BLUETOOTH=
12316                 SYSTEM_BLUEZ=
12317             fi
12318         else
12319             AC_MSG_RESULT([yes])
12320             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12321             SYSTEM_BLUEZ=
12322             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12323         <key>com.apple.security.device.bluetooth</key>
12324         <true/>"
12325         fi
12326     else
12327         AC_MSG_RESULT([no])
12328         ENABLE_SDREMOTE_BLUETOOTH=
12329         SYSTEM_BLUEZ=
12330     fi
12331 else
12332     ENABLE_SDREMOTE=
12333     SYSTEM_BLUEZ=
12334     AC_MSG_RESULT([no])
12336 AC_SUBST(ENABLE_SDREMOTE)
12337 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12338 AC_SUBST(SDREMOTE_ENTITLEMENT)
12339 AC_SUBST(SYSTEM_BLUEZ)
12341 dnl ===================================================================
12342 dnl Check whether to enable GIO support
12343 dnl ===================================================================
12344 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12345     AC_MSG_CHECKING([whether to enable GIO support])
12346     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12347         dnl Need at least 2.26 for the dbus support.
12348         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12349                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12350         if test "$ENABLE_GIO" = "TRUE"; then
12351             AC_DEFINE(ENABLE_GIO)
12352             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12353             FilterLibs "${GIO_LIBS}"
12354             GIO_LIBS="${filteredlibs}"
12355         fi
12356     else
12357         AC_MSG_RESULT([no])
12358     fi
12360 AC_SUBST(ENABLE_GIO)
12361 AC_SUBST(GIO_CFLAGS)
12362 AC_SUBST(GIO_LIBS)
12365 dnl ===================================================================
12367 SPLIT_APP_MODULES=""
12368 if test "$enable_split_app_modules" = "yes"; then
12369     SPLIT_APP_MODULES="TRUE"
12371 AC_SUBST(SPLIT_APP_MODULES)
12373 SPLIT_OPT_FEATURES=""
12374 if test "$enable_split_opt_features" = "yes"; then
12375     SPLIT_OPT_FEATURES="TRUE"
12377 AC_SUBST(SPLIT_OPT_FEATURES)
12379 dnl ===================================================================
12380 dnl Check whether the GStreamer libraries are available.
12381 dnl ===================================================================
12383 ENABLE_GSTREAMER_1_0=""
12385 if test "$test_gstreamer_1_0" = yes; then
12387     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12388     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12389         ENABLE_GSTREAMER_1_0="TRUE"
12390         AC_MSG_RESULT([yes])
12391         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12392         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12393         FilterLibs "${GSTREAMER_1_0_LIBS}"
12394         GSTREAMER_1_0_LIBS="${filteredlibs}"
12395         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12396     else
12397         AC_MSG_RESULT([no])
12398     fi
12400 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12401 AC_SUBST(GSTREAMER_1_0_LIBS)
12402 AC_SUBST(ENABLE_GSTREAMER_1_0)
12404 ENABLE_OPENGL_TRANSITIONS=
12405 ENABLE_OPENGL_CANVAS=
12406 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12407    : # disable
12408 elif test "$_os" = "Darwin"; then
12409     # We use frameworks on macOS, no need for detail checks
12410     ENABLE_OPENGL_TRANSITIONS=TRUE
12411     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12412     ENABLE_OPENGL_CANVAS=TRUE
12413 elif test $_os = WINNT; then
12414     ENABLE_OPENGL_TRANSITIONS=TRUE
12415     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12416     ENABLE_OPENGL_CANVAS=TRUE
12417 else
12418     if test "$USING_X11" = TRUE; then
12419         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12420         ENABLE_OPENGL_TRANSITIONS=TRUE
12421         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12422         ENABLE_OPENGL_CANVAS=TRUE
12423     fi
12426 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12427 AC_SUBST(ENABLE_OPENGL_CANVAS)
12429 dnl =================================================
12430 dnl Check whether to build with OpenCL support.
12431 dnl =================================================
12433 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12434     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12435     # platform (optional at run-time, used through clew).
12436     BUILD_TYPE="$BUILD_TYPE OPENCL"
12437     AC_DEFINE(HAVE_FEATURE_OPENCL)
12440 dnl =================================================
12441 dnl Check whether to build with dconf support.
12442 dnl =================================================
12444 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12445     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12446         if test "$enable_dconf" = yes; then
12447             AC_MSG_ERROR([dconf not found])
12448         else
12449             enable_dconf=no
12450         fi])
12452 AC_MSG_CHECKING([whether to enable dconf])
12453 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12454     DCONF_CFLAGS=
12455     DCONF_LIBS=
12456     ENABLE_DCONF=
12457     AC_MSG_RESULT([no])
12458 else
12459     ENABLE_DCONF=TRUE
12460     AC_DEFINE(ENABLE_DCONF)
12461     AC_MSG_RESULT([yes])
12463 AC_SUBST([DCONF_CFLAGS])
12464 AC_SUBST([DCONF_LIBS])
12465 AC_SUBST([ENABLE_DCONF])
12467 # pdf import?
12468 AC_MSG_CHECKING([whether to build the PDF import feature])
12469 ENABLE_PDFIMPORT=
12470 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12471     AC_MSG_RESULT([yes])
12472     ENABLE_PDFIMPORT=TRUE
12473     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12474 else
12475     AC_MSG_RESULT([no])
12478 # Pdfium?
12479 AC_MSG_CHECKING([whether to build PDFium])
12480 ENABLE_PDFIUM=
12481 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12482     AC_MSG_RESULT([yes])
12483     ENABLE_PDFIUM=TRUE
12484     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12485 else
12486     AC_MSG_RESULT([no])
12488 AC_SUBST(ENABLE_PDFIUM)
12490 if test "$ENABLE_PDFIUM" = "TRUE"; then
12491     AC_MSG_CHECKING([which OpenJPEG library to use])
12492     if test "$with_system_openjpeg" = "yes"; then
12493         SYSTEM_OPENJPEG2=TRUE
12494         AC_MSG_RESULT([external])
12495         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12496         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12497         FilterLibs "${OPENJPEG2_LIBS}"
12498         OPENJPEG2_LIBS="${filteredlibs}"
12499     else
12500         SYSTEM_OPENJPEG2=FALSE
12501         AC_MSG_RESULT([internal])
12502     fi
12504     AC_MSG_CHECKING([which Abseil library to use])
12505     if test "$with_system_abseil" = "yes"; then
12506         AC_MSG_RESULT([external])
12507         SYSTEM_ABSEIL=TRUE
12508         AC_LANG_PUSH([C++])
12509         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12510         AC_LANG_POP([C++])
12511         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12512         FilterLibs "${ABSEIL_LIBS}"
12513         ABSEIL_LIBS="${filteredlibs}"
12514     else
12515         AC_MSG_RESULT([internal])
12516     fi
12518 AC_SUBST(SYSTEM_OPENJPEG2)
12519 AC_SUBST(SYSTEM_ABSEIL)
12520 AC_SUBST(ABSEIL_CFLAGS)
12521 AC_SUBST(ABSEIL_LIBS)
12523 dnl ===================================================================
12524 dnl Check for poppler
12525 dnl ===================================================================
12526 ENABLE_POPPLER=
12527 AC_MSG_CHECKING([whether to build Poppler])
12528 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12529     AC_MSG_RESULT([yes])
12530     ENABLE_POPPLER=TRUE
12531     AC_DEFINE(HAVE_FEATURE_POPPLER)
12532 else
12533     AC_MSG_RESULT([no])
12535 AC_SUBST(ENABLE_POPPLER)
12537 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12538     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12541 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12542     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12545 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12546     dnl ===================================================================
12547     dnl Check for system poppler
12548     dnl ===================================================================
12549     AC_MSG_CHECKING([which PDF import poppler to use])
12550     if test "$with_system_poppler" = "yes"; then
12551         AC_MSG_RESULT([external])
12552         SYSTEM_POPPLER=TRUE
12553         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12554         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12555         FilterLibs "${POPPLER_LIBS}"
12556         POPPLER_LIBS="${filteredlibs}"
12557     else
12558         AC_MSG_RESULT([internal])
12559         SYSTEM_POPPLER=
12560         BUILD_TYPE="$BUILD_TYPE POPPLER"
12561     fi
12562     AC_DEFINE([ENABLE_PDFIMPORT],1)
12564 AC_SUBST(ENABLE_PDFIMPORT)
12565 AC_SUBST(SYSTEM_POPPLER)
12566 AC_SUBST(POPPLER_CFLAGS)
12567 AC_SUBST(POPPLER_LIBS)
12569 # Skia?
12570 ENABLE_SKIA=
12571 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12572     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12573     if test "$SYSTEM_FREETYPE" = TRUE; then
12574         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12575             [skia_freetype_ok=yes],
12576             [skia_freetype_ok=no])
12577     else # internal is ok
12578         skia_freetype_ok=yes
12579     fi
12580     AC_MSG_CHECKING([whether to build Skia])
12581     if test "$skia_freetype_ok" = "yes"; then
12582         if test "$enable_skia" = "debug"; then
12583             AC_MSG_RESULT([yes (debug)])
12584             ENABLE_SKIA_DEBUG=TRUE
12585         else
12586             AC_MSG_RESULT([yes])
12587             ENABLE_SKIA_DEBUG=
12588         fi
12589         ENABLE_SKIA=TRUE
12590         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12591             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12592         fi
12594         AC_DEFINE(HAVE_FEATURE_SKIA)
12595         BUILD_TYPE="$BUILD_TYPE SKIA"
12597         if test "$OS" = "MACOSX"; then
12598             AC_DEFINE(SK_GANESH,1)
12599             AC_DEFINE(SK_METAL,1)
12600             SKIA_GPU=METAL
12601             AC_SUBST(SKIA_GPU)
12602         else
12603             AC_DEFINE(SK_GANESH,1)
12604             AC_DEFINE(SK_VULKAN,1)
12605             SKIA_GPU=VULKAN
12606             AC_SUBST(SKIA_GPU)
12607         fi
12608     else
12609         AC_MSG_RESULT([no (freetype too old)])
12610         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12611     fi
12613 else
12614     AC_MSG_CHECKING([whether to build Skia])
12615     AC_MSG_RESULT([no])
12617 AC_SUBST(ENABLE_SKIA)
12618 AC_SUBST(ENABLE_SKIA_DEBUG)
12620 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12621 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12622 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12623 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12624 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12625 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12626 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12627 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12628 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12629 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12630 LO_CLANG_VERSION=
12631 HAVE_LO_CLANG_DLLEXPORTINLINES=
12633 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12634     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12635         AC_MSG_CHECKING([for Clang])
12636         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12637     else
12638         if test "$_os" = "WINNT"; then
12639             AC_MSG_CHECKING([for clang-cl])
12640             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12641                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12642             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12643                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12644             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12645                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12646             fi
12647             if test -n "$LO_CLANG_CC"; then
12648                 dnl explicitly set -m32/-m64
12649                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12650                 LO_CLANG_CXX="$LO_CLANG_CC"
12651                 AC_MSG_RESULT([$LO_CLANG_CC])
12652             else
12653                 AC_MSG_RESULT([no])
12654             fi
12656             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12657             echo "#include <stdlib.h>" > conftest.c
12658             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12659                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12660             rm -f conftest.c conftest.obj
12661             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12662                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12663             else
12664                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12665             fi
12666         else
12667             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12668             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12669         fi
12670     fi
12671     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12672         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12673         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12674         if test "$LO_CLANG_VERSION" -lt 50002; then
12675             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12676             LO_CLANG_CC=
12677             LO_CLANG_CXX=
12678         fi
12679     fi
12680     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12681         save_CXX="$CXX"
12682         CXX="$LO_CLANG_CXX"
12683         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12684         AC_LANG_PUSH([C++])
12685         save_CXXFLAGS=$CXXFLAGS
12686         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12687         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12688                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12689                 AC_MSG_RESULT([yes])
12690             ], [AC_MSG_RESULT([no])])
12691         CXXFLAGS=$save_CXXFLAGS
12692         AC_LANG_POP([C++])
12693         CXX="$save_CXX"
12694         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12695             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.])
12696         fi
12697     fi
12698     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12699         # Skia is the default on Windows and Mac, so hard-require Clang.
12700         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12701         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12702             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12703         else
12704             AC_MSG_WARN([Clang compiler not found.])
12705         fi
12706     else
12708         save_CXX="$CXX"
12709         CXX="$LO_CLANG_CXX"
12710         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12711         flag_sse2=-msse2
12712         flag_ssse3=-mssse3
12713         flag_sse41=-msse4.1
12714         flag_sse42=-msse4.2
12715         flag_avx=-mavx
12716         flag_avx2=-mavx2
12717         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12718         flag_avx512f=-mavx512f
12719         flag_f16c=-mf16c
12720         flag_fma=-mfma
12722         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12723         AC_LANG_PUSH([C++])
12724         save_CXXFLAGS=$CXXFLAGS
12725         CXXFLAGS="$CXXFLAGS $flag_sse2"
12726         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12727             #include <emmintrin.h>
12728             int main () {
12729                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12730                 c = _mm_xor_si128 (a, b);
12731                 return 0;
12732             }
12733             ])],
12734             [can_compile_sse2=yes],
12735             [can_compile_sse2=no])
12736         AC_LANG_POP([C++])
12737         CXXFLAGS=$save_CXXFLAGS
12738         AC_MSG_RESULT([${can_compile_sse2}])
12739         if test "${can_compile_sse2}" = "yes" ; then
12740             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12741         fi
12743         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12744         AC_LANG_PUSH([C++])
12745         save_CXXFLAGS=$CXXFLAGS
12746         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12747         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12748             #include <tmmintrin.h>
12749             int main () {
12750                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12751                 c = _mm_maddubs_epi16 (a, b);
12752                 return 0;
12753             }
12754             ])],
12755             [can_compile_ssse3=yes],
12756             [can_compile_ssse3=no])
12757         AC_LANG_POP([C++])
12758         CXXFLAGS=$save_CXXFLAGS
12759         AC_MSG_RESULT([${can_compile_ssse3}])
12760         if test "${can_compile_ssse3}" = "yes" ; then
12761             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12762         fi
12764         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12765         AC_LANG_PUSH([C++])
12766         save_CXXFLAGS=$CXXFLAGS
12767         CXXFLAGS="$CXXFLAGS $flag_sse41"
12768         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12769             #include <smmintrin.h>
12770             int main () {
12771                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12772                 c = _mm_cmpeq_epi64 (a, b);
12773                 return 0;
12774             }
12775             ])],
12776             [can_compile_sse41=yes],
12777             [can_compile_sse41=no])
12778         AC_LANG_POP([C++])
12779         CXXFLAGS=$save_CXXFLAGS
12780         AC_MSG_RESULT([${can_compile_sse41}])
12781         if test "${can_compile_sse41}" = "yes" ; then
12782             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12783         fi
12785         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12786         AC_LANG_PUSH([C++])
12787         save_CXXFLAGS=$CXXFLAGS
12788         CXXFLAGS="$CXXFLAGS $flag_sse42"
12789         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12790             #include <nmmintrin.h>
12791             int main () {
12792                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12793                 c = _mm_cmpgt_epi64 (a, b);
12794                 return 0;
12795             }
12796             ])],
12797             [can_compile_sse42=yes],
12798             [can_compile_sse42=no])
12799         AC_LANG_POP([C++])
12800         CXXFLAGS=$save_CXXFLAGS
12801         AC_MSG_RESULT([${can_compile_sse42}])
12802         if test "${can_compile_sse42}" = "yes" ; then
12803             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12804         fi
12806         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12807         AC_LANG_PUSH([C++])
12808         save_CXXFLAGS=$CXXFLAGS
12809         CXXFLAGS="$CXXFLAGS $flag_avx"
12810         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12811             #include <immintrin.h>
12812             int main () {
12813                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12814                 c = _mm256_xor_ps(a, b);
12815                 return 0;
12816             }
12817             ])],
12818             [can_compile_avx=yes],
12819             [can_compile_avx=no])
12820         AC_LANG_POP([C++])
12821         CXXFLAGS=$save_CXXFLAGS
12822         AC_MSG_RESULT([${can_compile_avx}])
12823         if test "${can_compile_avx}" = "yes" ; then
12824             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12825         fi
12827         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12828         AC_LANG_PUSH([C++])
12829         save_CXXFLAGS=$CXXFLAGS
12830         CXXFLAGS="$CXXFLAGS $flag_avx2"
12831         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12832             #include <immintrin.h>
12833             int main () {
12834                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12835                 c = _mm256_maddubs_epi16(a, b);
12836                 return 0;
12837             }
12838             ])],
12839             [can_compile_avx2=yes],
12840             [can_compile_avx2=no])
12841         AC_LANG_POP([C++])
12842         CXXFLAGS=$save_CXXFLAGS
12843         AC_MSG_RESULT([${can_compile_avx2}])
12844         if test "${can_compile_avx2}" = "yes" ; then
12845             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12846         fi
12848         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12849         AC_LANG_PUSH([C++])
12850         save_CXXFLAGS=$CXXFLAGS
12851         CXXFLAGS="$CXXFLAGS $flag_avx512"
12852         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12853             #include <immintrin.h>
12854             int main () {
12855                 __m512i a = _mm512_loadu_si512(0);
12856                 __m512d v1 = _mm512_load_pd(0);
12857                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12858                 __m512d v2 = _mm512_abs_pd(v1);
12859                 return 0;
12860             }
12861             ])],
12862             [can_compile_avx512=yes],
12863             [can_compile_avx512=no])
12864         AC_LANG_POP([C++])
12865         CXXFLAGS=$save_CXXFLAGS
12866         AC_MSG_RESULT([${can_compile_avx512}])
12867         if test "${can_compile_avx512}" = "yes" ; then
12868             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12869             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12870         fi
12872         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12873         AC_LANG_PUSH([C++])
12874         save_CXXFLAGS=$CXXFLAGS
12875         CXXFLAGS="$CXXFLAGS $flag_f16c"
12876         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12877             #include <immintrin.h>
12878             int main () {
12879                 __m128i a = _mm_set1_epi32 (0);
12880                 __m128 c;
12881                 c = _mm_cvtph_ps(a);
12882                 return 0;
12883             }
12884             ])],
12885             [can_compile_f16c=yes],
12886             [can_compile_f16c=no])
12887         AC_LANG_POP([C++])
12888         CXXFLAGS=$save_CXXFLAGS
12889         AC_MSG_RESULT([${can_compile_f16c}])
12890         if test "${can_compile_f16c}" = "yes" ; then
12891             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12892         fi
12894         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12895         AC_LANG_PUSH([C++])
12896         save_CXXFLAGS=$CXXFLAGS
12897         CXXFLAGS="$CXXFLAGS $flag_fma"
12898         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12899             #include <immintrin.h>
12900             int main () {
12901                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12902                 d = _mm256_fmadd_ps(a, b, c);
12903                 return 0;
12904             }
12905             ])],
12906             [can_compile_fma=yes],
12907             [can_compile_fma=no])
12908         AC_LANG_POP([C++])
12909         CXXFLAGS=$save_CXXFLAGS
12910         AC_MSG_RESULT([${can_compile_fma}])
12911         if test "${can_compile_fma}" = "yes" ; then
12912             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12913         fi
12915         CXX="$save_CXX"
12916     fi
12919 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12921 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12922     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12923     AC_LANG_PUSH([C])
12924     save_CC="$CC"
12925     CC="$LO_CLANG_CC"
12926     save_CFLAGS=$CFLAGS
12927     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12928     dnl an empty program will do, we're checking the compiler flags
12929     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12930                       [use_ccache=yes], [use_ccache=no])
12931     CFLAGS=$save_CFLAGS
12932     CC=$save_CC
12933     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12934         AC_MSG_RESULT([yes])
12935     else
12936         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12937         AC_MSG_RESULT([no])
12938     fi
12939     AC_LANG_POP([C])
12941     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12942     AC_LANG_PUSH([C++])
12943     save_CXX="$CXX"
12944     CXX="$LO_CLANG_CXX"
12945     save_CXXFLAGS=$CXXFLAGS
12946     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12947     dnl an empty program will do, we're checking the compiler flags
12948     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12949                       [use_ccache=yes], [use_ccache=no])
12950     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12951         AC_MSG_RESULT([yes])
12952     else
12953         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12954         AC_MSG_RESULT([no])
12955     fi
12956     CXXFLAGS=$save_CXXFLAGS
12957     CXX=$save_CXX
12958     AC_LANG_POP([C++])
12961 AC_SUBST(LO_CLANG_CC)
12962 AC_SUBST(LO_CLANG_CXX)
12963 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12964 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12965 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12966 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12967 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12968 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12969 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12970 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12971 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12972 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12973 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12974 AC_SUBST(LO_CLANG_VERSION)
12975 AC_SUBST(CLANG_USE_LD)
12976 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12978 SYSTEM_GPGMEPP=
12980 AC_MSG_CHECKING([whether to enable gpgmepp])
12981 if test "$enable_gpgmepp" = no; then
12982     AC_MSG_RESULT([no])
12983 elif test "$enable_mpl_subset" = "yes"; then
12984     AC_MSG_RESULT([no (MPL only)])
12985 elif test "$enable_fuzzers" = "yes"; then
12986     AC_MSG_RESULT([no (oss-fuzz)])
12987 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12988     AC_MSG_RESULT([yes])
12989     dnl ===================================================================
12990     dnl Check for system gpgme
12991     dnl ===================================================================
12992     AC_MSG_CHECKING([which gpgmepp to use])
12993     if test "$with_system_gpgmepp" = "yes"; then
12994         AC_MSG_RESULT([external])
12995         SYSTEM_GPGMEPP=TRUE
12997         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12998         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12999             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
13000         AC_CHECK_HEADER(gpgme.h, [],
13001             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
13002         AC_CHECK_LIB(gpgmepp, main, [],
13003             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
13004         GPGMEPP_LIBS=-lgpgmepp
13005     else
13006         AC_MSG_RESULT([internal])
13007         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
13009         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
13010         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
13011         if test "$_os" != "WINNT"; then
13012             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
13013             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
13014         fi
13015     fi
13016     ENABLE_GPGMEPP=TRUE
13017     AC_DEFINE([HAVE_FEATURE_GPGME])
13018     AC_PATH_PROG(GPG, gpg)
13019     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
13020     # so let's exclude that manually for the moment
13021     if test -n "$GPG" -a "$_os" != "WINNT"; then
13022         # make sure we not only have a working gpgme, but a full working
13023         # gpg installation to run OpenPGP signature verification
13024         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
13025     fi
13026     if test "$_os" = "Linux"; then
13027       uid=`id -u`
13028       AC_MSG_CHECKING([for /run/user/$uid])
13029       if test -d /run/user/$uid; then
13030         AC_MSG_RESULT([yes])
13031         AC_PATH_PROG(GPGCONF, gpgconf)
13033         # Older versions of gpgconf are not working as expected, since
13034         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
13035         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
13036         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
13037         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
13038         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
13039         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
13040         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
13041           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
13042           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
13043           if $GPGCONF --dump-options > /dev/null ; then
13044             if $GPGCONF --dump-options | grep -q create-socketdir ; then
13045               AC_MSG_RESULT([yes])
13046               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
13047               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
13048             else
13049               AC_MSG_RESULT([no])
13050             fi
13051           else
13052             AC_MSG_RESULT([no. missing or broken gpgconf?])
13053           fi
13054         else
13055           AC_MSG_RESULT([no, $GPGCONF_VERSION])
13056         fi
13057       else
13058         AC_MSG_RESULT([no])
13059      fi
13060    fi
13061 else
13062     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
13064 AC_SUBST(ENABLE_GPGMEPP)
13065 AC_SUBST(SYSTEM_GPGMEPP)
13066 AC_SUBST(GPG_ERROR_CFLAGS)
13067 AC_SUBST(GPG_ERROR_LIBS)
13068 AC_SUBST(LIBASSUAN_CFLAGS)
13069 AC_SUBST(LIBASSUAN_LIBS)
13070 AC_SUBST(GPGMEPP_CFLAGS)
13071 AC_SUBST(GPGMEPP_LIBS)
13073 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
13074 if test "$with_java" != "no"; then
13075     AC_MSG_RESULT([yes])
13076     ENABLE_JAVA_WEBSOCKET=TRUE
13077     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
13078     NEED_ANT=TRUE
13079 else
13080     AC_MSG_RESULT([no])
13081     ENABLE_JAVA_WEBSOCKET=
13083 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
13085 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
13086 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
13087     AC_MSG_RESULT([yes])
13088     ENABLE_MEDIAWIKI=TRUE
13089     BUILD_TYPE="$BUILD_TYPE XSLTML"
13090     if test  "x$with_java" = "xno"; then
13091         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
13092     fi
13093 else
13094     AC_MSG_RESULT([no])
13095     ENABLE_MEDIAWIKI=
13096     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13098 AC_SUBST(ENABLE_MEDIAWIKI)
13100 AC_MSG_CHECKING([whether to build the Report Builder])
13101 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13102     AC_MSG_RESULT([yes])
13103     ENABLE_REPORTBUILDER=TRUE
13104     AC_MSG_CHECKING([which jfreereport libs to use])
13105     if test "$with_system_jfreereport" = "yes"; then
13106         SYSTEM_JFREEREPORT=TRUE
13107         AC_MSG_RESULT([external])
13108         if test -z $SAC_JAR; then
13109             SAC_JAR=/usr/share/java/sac.jar
13110         fi
13111         if ! test -f $SAC_JAR; then
13112              AC_MSG_ERROR(sac.jar not found.)
13113         fi
13115         if test -z $LIBXML_JAR; then
13116             if test -f /usr/share/java/libxml-1.0.0.jar; then
13117                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13118             elif test -f /usr/share/java/libxml.jar; then
13119                 LIBXML_JAR=/usr/share/java/libxml.jar
13120             else
13121                 AC_MSG_ERROR(libxml.jar replacement not found.)
13122             fi
13123         elif ! test -f $LIBXML_JAR; then
13124             AC_MSG_ERROR(libxml.jar not found.)
13125         fi
13127         if test -z $FLUTE_JAR; then
13128             if test -f /usr/share/java/flute-1.3.0.jar; then
13129                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13130             elif test -f /usr/share/java/flute.jar; then
13131                 FLUTE_JAR=/usr/share/java/flute.jar
13132             else
13133                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13134             fi
13135         elif ! test -f $FLUTE_JAR; then
13136             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13137         fi
13139         if test -z $JFREEREPORT_JAR; then
13140             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13141                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13142             elif test -f /usr/share/java/flow-engine.jar; then
13143                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13144             else
13145                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13146             fi
13147         elif ! test -f  $JFREEREPORT_JAR; then
13148                 AC_MSG_ERROR(jfreereport.jar not found.)
13149         fi
13151         if test -z $LIBLAYOUT_JAR; then
13152             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13153                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13154             elif test -f /usr/share/java/liblayout.jar; then
13155                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13156             else
13157                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13158             fi
13159         elif ! test -f $LIBLAYOUT_JAR; then
13160                 AC_MSG_ERROR(liblayout.jar not found.)
13161         fi
13163         if test -z $LIBLOADER_JAR; then
13164             if test -f /usr/share/java/libloader-1.0.0.jar; then
13165                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13166             elif test -f /usr/share/java/libloader.jar; then
13167                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13168             else
13169                 AC_MSG_ERROR(libloader.jar replacement not found.)
13170             fi
13171         elif ! test -f  $LIBLOADER_JAR; then
13172             AC_MSG_ERROR(libloader.jar not found.)
13173         fi
13175         if test -z $LIBFORMULA_JAR; then
13176             if test -f /usr/share/java/libformula-0.2.0.jar; then
13177                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13178             elif test -f /usr/share/java/libformula.jar; then
13179                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13180             else
13181                 AC_MSG_ERROR(libformula.jar replacement not found.)
13182             fi
13183         elif ! test -f $LIBFORMULA_JAR; then
13184                 AC_MSG_ERROR(libformula.jar not found.)
13185         fi
13187         if test -z $LIBREPOSITORY_JAR; then
13188             if test -f /usr/share/java/librepository-1.0.0.jar; then
13189                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13190             elif test -f /usr/share/java/librepository.jar; then
13191                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13192             else
13193                 AC_MSG_ERROR(librepository.jar replacement not found.)
13194             fi
13195         elif ! test -f $LIBREPOSITORY_JAR; then
13196             AC_MSG_ERROR(librepository.jar not found.)
13197         fi
13199         if test -z $LIBFONTS_JAR; then
13200             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13201                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13202             elif test -f /usr/share/java/libfonts.jar; then
13203                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13204             else
13205                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13206             fi
13207         elif ! test -f $LIBFONTS_JAR; then
13208                 AC_MSG_ERROR(libfonts.jar not found.)
13209         fi
13211         if test -z $LIBSERIALIZER_JAR; then
13212             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13213                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13214             elif test -f /usr/share/java/libserializer.jar; then
13215                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13216             else
13217                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13218             fi
13219         elif ! test -f $LIBSERIALIZER_JAR; then
13220                 AC_MSG_ERROR(libserializer.jar not found.)
13221         fi
13223         if test -z $LIBBASE_JAR; then
13224             if test -f /usr/share/java/libbase-1.0.0.jar; then
13225                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13226             elif test -f /usr/share/java/libbase.jar; then
13227                 LIBBASE_JAR=/usr/share/java/libbase.jar
13228             else
13229                 AC_MSG_ERROR(libbase.jar replacement not found.)
13230             fi
13231         elif ! test -f $LIBBASE_JAR; then
13232             AC_MSG_ERROR(libbase.jar not found.)
13233         fi
13235     else
13236         AC_MSG_RESULT([internal])
13237         SYSTEM_JFREEREPORT=
13238         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13239         NEED_ANT=TRUE
13240     fi
13241     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13242 else
13243     AC_MSG_RESULT([no])
13244     ENABLE_REPORTBUILDER=
13245     SYSTEM_JFREEREPORT=
13247 AC_SUBST(ENABLE_REPORTBUILDER)
13248 AC_SUBST(SYSTEM_JFREEREPORT)
13249 AC_SUBST(SAC_JAR)
13250 AC_SUBST(LIBXML_JAR)
13251 AC_SUBST(FLUTE_JAR)
13252 AC_SUBST(JFREEREPORT_JAR)
13253 AC_SUBST(LIBBASE_JAR)
13254 AC_SUBST(LIBLAYOUT_JAR)
13255 AC_SUBST(LIBLOADER_JAR)
13256 AC_SUBST(LIBFORMULA_JAR)
13257 AC_SUBST(LIBREPOSITORY_JAR)
13258 AC_SUBST(LIBFONTS_JAR)
13259 AC_SUBST(LIBSERIALIZER_JAR)
13261 # scripting provider for BeanShell?
13262 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13263 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13264     AC_MSG_RESULT([yes])
13265     ENABLE_SCRIPTING_BEANSHELL=TRUE
13267     dnl ===================================================================
13268     dnl Check for system beanshell
13269     dnl ===================================================================
13270     AC_MSG_CHECKING([which beanshell to use])
13271     if test "$with_system_beanshell" = "yes"; then
13272         AC_MSG_RESULT([external])
13273         SYSTEM_BSH=TRUE
13274         if test -z $BSH_JAR; then
13275             BSH_JAR=/usr/share/java/bsh.jar
13276         fi
13277         if ! test -f $BSH_JAR; then
13278             AC_MSG_ERROR(bsh.jar not found.)
13279         fi
13280     else
13281         AC_MSG_RESULT([internal])
13282         SYSTEM_BSH=
13283         BUILD_TYPE="$BUILD_TYPE BSH"
13284     fi
13285 else
13286     AC_MSG_RESULT([no])
13287     ENABLE_SCRIPTING_BEANSHELL=
13288     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13290 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13291 AC_SUBST(SYSTEM_BSH)
13292 AC_SUBST(BSH_JAR)
13294 # scripting provider for JavaScript?
13295 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13296 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13297     AC_MSG_RESULT([yes])
13298     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13300     dnl ===================================================================
13301     dnl Check for system rhino
13302     dnl ===================================================================
13303     AC_MSG_CHECKING([which rhino to use])
13304     if test "$with_system_rhino" = "yes"; then
13305         AC_MSG_RESULT([external])
13306         SYSTEM_RHINO=TRUE
13307         if test -z $RHINO_JAR; then
13308             RHINO_JAR=/usr/share/java/js.jar
13309         fi
13310         if ! test -f $RHINO_JAR; then
13311             AC_MSG_ERROR(js.jar not found.)
13312         fi
13313     else
13314         AC_MSG_RESULT([internal])
13315         SYSTEM_RHINO=
13316         BUILD_TYPE="$BUILD_TYPE RHINO"
13317         NEED_ANT=TRUE
13318     fi
13319 else
13320     AC_MSG_RESULT([no])
13321     ENABLE_SCRIPTING_JAVASCRIPT=
13322     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13324 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13325 AC_SUBST(SYSTEM_RHINO)
13326 AC_SUBST(RHINO_JAR)
13328 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13329 # paths should be added to library search path. So let's put all 64-bit
13330 # platforms there.
13331 supports_multilib=
13332 case "$host_cpu" in
13333 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13334     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13335         supports_multilib="yes"
13336     fi
13337     ;;
13339     ;;
13340 esac
13342 dnl ===================================================================
13343 dnl QT5 Integration
13344 dnl ===================================================================
13346 QT5_CFLAGS=""
13347 QT5_LIBS=""
13348 QT5_GOBJECT_CFLAGS=""
13349 QT5_GOBJECT_LIBS=""
13350 QT5_HAVE_GOBJECT=""
13351 QT5_PLATFORMS_SRCDIR=""
13352 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13353         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13354         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13355 then
13356     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13357     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13359     if test -n "$supports_multilib"; then
13360         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13361     fi
13363     qt5_test_include="QtWidgets/qapplication.h"
13364     if test "$_os" = "Emscripten"; then
13365         qt5_test_library="libQt5Widgets.a"
13366     else
13367         qt5_test_library="libQt5Widgets.so"
13368     fi
13370     dnl Check for qmake5
13371     if test -n "$QT5DIR"; then
13372         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13373     else
13374         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13375     fi
13376     if test "$QMAKE5" = "no"; then
13377         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13378     else
13379         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13380         if test -z "$qmake5_test_ver"; then
13381             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13382         fi
13383         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13384         qt5_minimal_minor="15"
13385         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13386             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13387         else
13388             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13389         fi
13390     fi
13392     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13393     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13394     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13395     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13397     AC_MSG_CHECKING([for Qt5 headers])
13398     qt5_incdir="no"
13399     for inc_dir in $qt5_incdirs; do
13400         if test -r "$inc_dir/$qt5_test_include"; then
13401             qt5_incdir="$inc_dir"
13402             break
13403         fi
13404     done
13405     AC_MSG_RESULT([$qt5_incdir])
13406     if test "x$qt5_incdir" = "xno"; then
13407         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13408     fi
13409     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13410     AC_LANG_PUSH([C++])
13411     save_CPPFLAGS=$CPPFLAGS
13412     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13413     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13414         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13415     CPPFLAGS=$save_CPPFLAGS
13416     AC_LANG_POP([C++])
13418     AC_MSG_CHECKING([for Qt5 libraries])
13419     qt5_libdir="no"
13420     for lib_dir in $qt5_libdirs; do
13421         if test -r "$lib_dir/$qt5_test_library"; then
13422             qt5_libdir="$lib_dir"
13423             break
13424         fi
13425     done
13426     AC_MSG_RESULT([$qt5_libdir])
13427     if test "x$qt5_libdir" = "xno"; then
13428         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13429     fi
13431     if test "$_os" = "Emscripten"; then
13432         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13433             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13434         fi
13435         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13436             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13437         fi
13439         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13440         if ! test -x "$EMSDK_LLVM_NM"; then
13441             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13442         fi
13443         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13444             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13445         fi
13446         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13447         if test -n "$QT5_WASM_SJLJ"; then
13448             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13449         fi
13450     fi
13452     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13453     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13454     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13455     if test "$_os" = "Emscripten"; then
13456         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13457     fi
13459     if test "$USING_X11" = TRUE; then
13460         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13461         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13462         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13463         QT5_USING_X11=1
13464         AC_DEFINE(QT5_USING_X11)
13465     fi
13467     dnl Check for Meta Object Compiler
13469     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13470     if test "$MOC5" = "no"; then
13471         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13472 the root of your Qt installation by exporting QT5DIR before running "configure".])
13473     fi
13475     if test "$test_gstreamer_1_0" = yes; then
13476         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13477                 QT5_HAVE_GOBJECT=1
13478                 AC_DEFINE(QT5_HAVE_GOBJECT)
13479             ],
13480             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13481         )
13482     fi
13484 AC_SUBST(QT5_CFLAGS)
13485 AC_SUBST(QT5_LIBS)
13486 AC_SUBST(MOC5)
13487 AC_SUBST(QT5_GOBJECT_CFLAGS)
13488 AC_SUBST(QT5_GOBJECT_LIBS)
13489 AC_SUBST(QT5_HAVE_GOBJECT)
13490 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13492 dnl ===================================================================
13493 dnl QT6 Integration
13494 dnl ===================================================================
13496 QT6_CFLAGS=""
13497 QT6_LIBS=""
13498 QT6_PLATFORMS_SRCDIR=""
13499 ENABLE_QT6_MULTIMEDIA=""
13500 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13501         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13502 then
13503     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13504     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13506     if test -n "$supports_multilib"; then
13507         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13508     fi
13510     qt6_test_include="QtWidgets/qapplication.h"
13511     if test "$_os" = "Emscripten"; then
13512         qt6_test_library="libQt6Widgets.a"
13513     else
13514         qt6_test_library="libQt6Widgets.so"
13515     fi
13517     dnl Check for qmake6
13518     if test -n "$QT6DIR"; then
13519         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13520     else
13521         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13522     fi
13523     if test "$QMAKE6" = "no"; then
13524         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13525     else
13526         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13527         if test -z "$qmake6_test_ver"; then
13528             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13529         fi
13530         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13531     fi
13533     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13534     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13535     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13536     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13538     AC_MSG_CHECKING([for Qt6 headers])
13539     qt6_incdir="no"
13540     for inc_dir in $qt6_incdirs; do
13541         if test -r "$inc_dir/$qt6_test_include"; then
13542             qt6_incdir="$inc_dir"
13543             break
13544         fi
13545     done
13546     AC_MSG_RESULT([$qt6_incdir])
13547     if test "x$qt6_incdir" = "xno"; then
13548         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13549     fi
13550     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13551     AC_LANG_PUSH([C++])
13552     save_CPPFLAGS=$CPPFLAGS
13553     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13554     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13555         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13556     CPPFLAGS=$save_CPPFLAGS
13557     AC_LANG_POP([C++])
13559     AC_MSG_CHECKING([for Qt6 libraries])
13560     qt6_libdir="no"
13561     for lib_dir in $qt6_libdirs; do
13562         if test -r "$lib_dir/$qt6_test_library"; then
13563             qt6_libdir="$lib_dir"
13564             break
13565         fi
13566     done
13567     AC_MSG_RESULT([$qt6_libdir])
13568     if test "x$qt6_libdir" = "xno"; then
13569         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13570     fi
13572     if test "$_os" = "Emscripten"; then
13573         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13574             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13575         fi
13576         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13577             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13578         fi
13579     fi
13581     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13582     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13583     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13584     if test "$_os" = "Emscripten"; then
13585         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13586     else
13587         if ! test "$enable_qt6_multimedia" = "no"; then
13588             if ! test -r "$qt6_incdir/QtMultimediaWidgets/QVideoWidget"; then
13589                 AC_MSG_ERROR([Qt 6 QMultimedia not found.])
13590                 break
13591             fi
13592             ENABLE_QT6_MULTIMEDIA=TRUE
13593             QT6_LIBS="$QT6_LIBS -lQt6Multimedia -lQt6MultimediaWidgets"
13594         fi
13595     fi
13597     if test "$USING_X11" = TRUE; then
13598         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13599         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13600         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13601         QT6_USING_X11=1
13602         AC_DEFINE(QT6_USING_X11)
13603     fi
13605     dnl Check for Meta Object Compiler
13607     for lib_dir in $qt6_libdirs; do
13608         if test -z "$qt6_libexec_dirs"; then
13609             qt6_libexec_dirs="$lib_dir/libexec"
13610         else
13611             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13612         fi
13613     done
13614     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])
13615     if test "$MOC6" = "no"; then
13616         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13617 the root of your Qt installation by exporting QT6DIR before running "configure".])
13618     else
13619         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13620         if test -z "$moc6_test_ver"; then
13621             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13622         fi
13623         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13624     fi
13626 AC_SUBST(QT6_CFLAGS)
13627 AC_SUBST(QT6_LIBS)
13628 AC_SUBST(MOC6)
13629 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13630 AC_SUBST(ENABLE_QT6_MULTIMEDIA)
13632 dnl ===================================================================
13633 dnl KF5 Integration
13634 dnl ===================================================================
13636 KF5_CFLAGS=""
13637 KF5_LIBS=""
13638 KF5_CONFIG="kf5-config"
13639 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13640         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13641 then
13642     if test "$OS" = "HAIKU"; then
13643         haiku_arch="`echo $RTL_ARCH | tr X x`"
13644         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13645         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13646     fi
13648     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13649     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13650     if test -n "$supports_multilib"; then
13651         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13652     fi
13654     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13655     kf5_test_library="libKF5KIOFileWidgets.so"
13656     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13658     dnl kf5 KDE4 support compatibility installed
13659     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13660     if test "$KF5_CONFIG" != "no"; then
13661         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13662         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13663     fi
13665     dnl Check for KF5 headers
13666     AC_MSG_CHECKING([for KF5 headers])
13667     kf5_incdir="no"
13668     for kf5_check in $kf5_incdirs; do
13669         if test -r "$kf5_check/$kf5_test_include"; then
13670             kf5_incdir="$kf5_check/KF5"
13671             break
13672         fi
13673     done
13674     AC_MSG_RESULT([$kf5_incdir])
13675     if test "x$kf5_incdir" = "xno"; then
13676         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13677     fi
13679     dnl Check for KF5 libraries
13680     AC_MSG_CHECKING([for KF5 libraries])
13681     kf5_libdir="no"
13682     for kf5_check in $kf5_libdirs; do
13683         if test -r "$kf5_check/$kf5_test_library"; then
13684             kf5_libdir="$kf5_check"
13685             break
13686         fi
13687     done
13689     AC_MSG_RESULT([$kf5_libdir])
13690     if test "x$kf5_libdir" = "xno"; then
13691         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13692     fi
13694     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13695     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13696     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13698     if test "$USING_X11" = TRUE; then
13699         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13700     fi
13702     AC_LANG_PUSH([C++])
13703     save_CXXFLAGS=$CXXFLAGS
13704     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13705     AC_MSG_CHECKING([whether KDE is >= 5.0])
13706        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13707 #include <kcoreaddons_version.h>
13709 int main(int argc, char **argv) {
13710        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13711        else return 1;
13713        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13714     CXXFLAGS=$save_CXXFLAGS
13715     AC_LANG_POP([C++])
13717 AC_SUBST(KF5_CFLAGS)
13718 AC_SUBST(KF5_LIBS)
13720 dnl ===================================================================
13721 dnl KF6 Integration
13722 dnl ===================================================================
13724 KF6_CFLAGS=""
13725 KF6_LIBS=""
13726 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13727 then
13728     if test "$OS" = "HAIKU"; then
13729         haiku_arch="`echo $RTL_ARCH | tr X x`"
13730         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13731         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13732     fi
13734     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13735     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13736     if test -n "$supports_multilib"; then
13737         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13738     fi
13740     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13741     kf6_test_library="libKF6KIOFileWidgets.so"
13742     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13744     dnl Check for KF6 headers
13745     AC_MSG_CHECKING([for KF6 headers])
13746     kf6_incdir="no"
13747     for kf6_check in $kf6_incdirs; do
13748         if test -r "$kf6_check/$kf6_test_include"; then
13749             kf6_incdir="$kf6_check/KF6"
13750             break
13751         fi
13752     done
13753     AC_MSG_RESULT([$kf6_incdir])
13754     if test "x$kf6_incdir" = "xno"; then
13755         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13756     fi
13758     dnl Check for KF6 libraries
13759     AC_MSG_CHECKING([for KF6 libraries])
13760     kf6_libdir="no"
13761     for kf6_check in $kf6_libdirs; do
13762         if test -r "$kf6_check/$kf6_test_library"; then
13763             kf6_libdir="$kf6_check"
13764             break
13765         fi
13766     done
13768     AC_MSG_RESULT([$kf6_libdir])
13769     if test "x$kf6_libdir" = "xno"; then
13770         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13771     fi
13773     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_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13774     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13775     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13777     AC_LANG_PUSH([C++])
13778     save_CXXFLAGS=$CXXFLAGS
13779     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13780     dnl KF6 development version as of 2023-06 uses version number 5.240
13781     AC_MSG_CHECKING([whether KDE is >= 5.240])
13782        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13783 #include <kcoreaddons_version.h>
13785 int main(int argc, char **argv) {
13786        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13787        else return 1;
13789        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13790     CXXFLAGS=$save_CXXFLAGS
13791     AC_LANG_POP([C++])
13793 AC_SUBST(KF6_CFLAGS)
13794 AC_SUBST(KF6_LIBS)
13796 if test "$enable_qt6_multimedia" = "yes" -a "$ENABLE_QT6" != "TRUE"; then
13797     AC_MSG_ERROR([--enable-qt6-multimedia requires --enable-qt6 or --enable-kf6])
13800 dnl ===================================================================
13801 dnl Test whether to include Evolution 2 support
13802 dnl ===================================================================
13803 AC_MSG_CHECKING([whether to enable evolution 2 support])
13804 if test "$enable_evolution2" = yes; then
13805     AC_MSG_RESULT([yes])
13806     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13807     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13808     FilterLibs "${GOBJECT_LIBS}"
13809     GOBJECT_LIBS="${filteredlibs}"
13810     ENABLE_EVOAB2="TRUE"
13811 else
13812     AC_MSG_RESULT([no])
13814 AC_SUBST(ENABLE_EVOAB2)
13815 AC_SUBST(GOBJECT_CFLAGS)
13816 AC_SUBST(GOBJECT_LIBS)
13818 dnl ===================================================================
13819 dnl Test which themes to include
13820 dnl ===================================================================
13821 AC_MSG_CHECKING([which themes to include])
13822 # if none given use default subset of available themes
13823 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13824     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"
13827 WITH_THEMES=""
13828 if test "x$with_theme" != "xno"; then
13829     for theme in $with_theme; do
13830         case $theme in
13831         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" ;;
13832         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13833         esac
13834     done
13836 AC_MSG_RESULT([$WITH_THEMES])
13837 AC_SUBST([WITH_THEMES])
13839 ###############################################################################
13840 # Extensions checking
13841 ###############################################################################
13842 AC_MSG_CHECKING([for extensions integration])
13843 if test "x$enable_extension_integration" != "xno"; then
13844     WITH_EXTENSION_INTEGRATION=TRUE
13845     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13846     AC_MSG_RESULT([yes, use integration])
13847 else
13848     WITH_EXTENSION_INTEGRATION=
13849     AC_MSG_RESULT([no, do not integrate])
13851 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13853 dnl Should any extra extensions be included?
13854 dnl There are standalone tests for each of these below.
13855 WITH_EXTRA_EXTENSIONS=
13856 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13858 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13859 if test "x$with_java" != "xno"; then
13860     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13863 AC_MSG_CHECKING([whether to build opens___.ttf])
13864 if test "$enable_build_opensymbol" = "yes"; then
13865     AC_MSG_RESULT([yes])
13866     AC_PATH_PROG(FONTFORGE, fontforge)
13867     if test -z "$FONTFORGE"; then
13868         AC_MSG_ERROR([fontforge not installed])
13869     fi
13870 else
13871     AC_MSG_RESULT([no])
13872     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13874 AC_SUBST(FONTFORGE)
13876 dnl ===================================================================
13877 dnl Test whether to include fonts
13878 dnl ===================================================================
13879 AC_MSG_CHECKING([whether to include third-party fonts])
13880 if test "$with_fonts" != "no"; then
13881     AC_MSG_RESULT([yes])
13882     WITH_FONTS=TRUE
13883     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13884     AC_DEFINE(HAVE_MORE_FONTS)
13885 else
13886     AC_MSG_RESULT([no])
13887     WITH_FONTS=
13888     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13890 AC_SUBST(WITH_FONTS)
13893 dnl ===================================================================
13894 dnl Test whether to enable online update service
13895 dnl ===================================================================
13896 AC_MSG_CHECKING([whether to enable online update])
13897 ENABLE_ONLINE_UPDATE=
13898 if test "$enable_online_update" = ""; then
13899     AC_MSG_RESULT([no])
13900 else
13901     if test "$enable_online_update" = "mar"; then
13902         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13903     elif test "$enable_online_update" = "yes"; then
13904         if test "$enable_curl" != "yes"; then
13905             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13906         fi
13907         AC_MSG_RESULT([yes])
13908         ENABLE_ONLINE_UPDATE="TRUE"
13909     else
13910         AC_MSG_RESULT([no])
13911     fi
13913 AC_SUBST(ENABLE_ONLINE_UPDATE)
13916 dnl ===================================================================
13917 dnl Test whether to enable mar online update service
13918 dnl ===================================================================
13919 AC_MSG_CHECKING([whether to enable mar online update])
13920 ENABLE_ONLINE_UPDATE_MAR=
13921 if test "$enable_online_update_mar" = yes; then
13922     AC_MSG_RESULT([yes])
13923     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13924     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13925     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13926 else
13927     AC_MSG_RESULT([no])
13929 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13931 AC_MSG_CHECKING([for mar online update baseurl])
13932 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13933 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13934     AC_MSG_RESULT([yes])
13935 else
13936     AC_MSG_RESULT([no])
13938 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13940 AC_MSG_CHECKING([for mar online update certificateder])
13941 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13942 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13943     AC_MSG_RESULT([yes])
13944 else
13945     AC_MSG_RESULT([no])
13947 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13949 AC_MSG_CHECKING([for mar online update certificatename])
13950 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13951 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13952     AC_MSG_RESULT([yes])
13953 else
13954     AC_MSG_RESULT([no])
13956 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13958 AC_MSG_CHECKING([for mar online update certificatepath])
13959 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13960 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13961     AC_MSG_RESULT([yes])
13962 else
13963     AC_MSG_RESULT([no])
13965 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13968 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13969 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13970     if test "x$with_privacy_policy_url" = "xundefined"; then
13971         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13972     fi
13974 AC_SUBST(PRIVACY_POLICY_URL)
13975 dnl ===================================================================
13976 dnl Test whether we need bzip2
13977 dnl ===================================================================
13978 SYSTEM_BZIP2=
13979 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13980     AC_MSG_CHECKING([whether to use system bzip2])
13981     if test "$with_system_bzip2" = yes; then
13982         SYSTEM_BZIP2=TRUE
13983         AC_MSG_RESULT([yes])
13984         PKG_CHECK_MODULES(BZIP2, bzip2)
13985         FilterLibs "${BZIP2_LIBS}"
13986         BZIP2_LIBS="${filteredlibs}"
13987     else
13988         AC_MSG_RESULT([no])
13989         BUILD_TYPE="$BUILD_TYPE BZIP2"
13990     fi
13992 AC_SUBST(SYSTEM_BZIP2)
13993 AC_SUBST(BZIP2_CFLAGS)
13994 AC_SUBST(BZIP2_LIBS)
13996 dnl ===================================================================
13997 dnl Test whether to enable extension update
13998 dnl ===================================================================
13999 AC_MSG_CHECKING([whether to enable extension update])
14000 ENABLE_EXTENSION_UPDATE=
14001 if test "x$enable_extension_update" = "xno"; then
14002     AC_MSG_RESULT([no])
14003 else
14004     AC_MSG_RESULT([yes])
14005     ENABLE_EXTENSION_UPDATE="TRUE"
14006     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
14007     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
14009 AC_SUBST(ENABLE_EXTENSION_UPDATE)
14012 dnl ===================================================================
14013 dnl Test whether to create MSI with LIMITUI=1 (silent install)
14014 dnl ===================================================================
14015 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
14016 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
14017     AC_MSG_RESULT([no])
14018     ENABLE_SILENT_MSI=
14019 else
14020     AC_MSG_RESULT([yes])
14021     ENABLE_SILENT_MSI=TRUE
14022     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
14024 AC_SUBST(ENABLE_SILENT_MSI)
14026 dnl ===================================================================
14027 dnl Check for WiX tools.
14028 dnl ===================================================================
14029 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
14030     AC_MSG_RESULT([no])
14031     ENABLE_WIX=
14032 else
14033     AC_MSG_RESULT([yes])
14034     # FIXME: this should do proper detection, but the path is currently
14035     # hardcoded in msicreator/createmsi.py
14036     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
14037       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
14038     fi
14039     ENABLE_WIX=TRUE
14041 AC_SUBST(ENABLE_WIX)
14043 AC_MSG_CHECKING([whether and how to use Xinerama])
14044 if test "$USING_X11" = TRUE; then
14045     if test "$x_libraries" = "default_x_libraries"; then
14046         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
14047         if test "x$XINERAMALIB" = x; then
14048            XINERAMALIB="/usr/lib"
14049         fi
14050     else
14051         XINERAMALIB="$x_libraries"
14052     fi
14053     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
14054         # we have both versions, let the user decide but use the dynamic one
14055         # per default
14056         USE_XINERAMA=TRUE
14057         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
14058             XINERAMA_LINK=dynamic
14059         else
14060             XINERAMA_LINK=static
14061         fi
14062     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
14063         # we have only the dynamic version
14064         USE_XINERAMA=TRUE
14065         XINERAMA_LINK=dynamic
14066     elif test -e "$XINERAMALIB/libXinerama.a"; then
14067         # static version
14068         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
14069             USE_XINERAMA=TRUE
14070             XINERAMA_LINK=static
14071         else
14072             USE_XINERAMA=
14073             XINERAMA_LINK=none
14074         fi
14075     else
14076         # no Xinerama
14077         USE_XINERAMA=
14078         XINERAMA_LINK=none
14079     fi
14080     if test "$USE_XINERAMA" = "TRUE"; then
14081         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
14082         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
14083             [AC_MSG_ERROR(Xinerama header not found.)], [])
14084         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
14085         if test "x$XEXTLIB" = x; then
14086            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
14087         fi
14088         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
14089         if test "$_os" = "FreeBSD"; then
14090             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
14091         fi
14092         if test "$_os" = "Linux"; then
14093             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
14094         fi
14095         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
14096             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
14097     else
14098         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
14099     fi
14100 else
14101     USE_XINERAMA=
14102     XINERAMA_LINK=none
14103     AC_MSG_RESULT([no])
14105 AC_SUBST(XINERAMA_LINK)
14107 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14108 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14109     enable_cairo_rgba=yes
14111 if test "$enable_cairo_rgba" = yes; then
14112     AC_DEFINE(ENABLE_CAIRO_RGBA)
14113     ENABLE_CAIRO_RGBA=TRUE
14114     AC_MSG_RESULT([yes])
14115 else
14116     ENABLE_CAIRO_RGBA=
14117     AC_MSG_RESULT([no])
14119 AC_SUBST(ENABLE_CAIRO_RGBA)
14121 dnl ===================================================================
14122 dnl Test whether to build cairo or rely on the system version
14123 dnl ===================================================================
14125 if test "$test_cairo" = "yes"; then
14126     AC_MSG_CHECKING([whether to use the system cairo])
14128     : ${with_system_cairo:=$with_system_libs}
14129     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14130         SYSTEM_CAIRO=TRUE
14131         AC_MSG_RESULT([yes])
14133         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14134         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14135         FilterLibs "${CAIRO_LIBS}"
14136         CAIRO_LIBS="${filteredlibs}"
14138         if test "$test_xrender" = "yes"; then
14139             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14140             AC_LANG_PUSH([C])
14141             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14142 #ifdef PictStandardA8
14143 #else
14144       return fail;
14145 #endif
14146 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14148             AC_LANG_POP([C])
14149         fi
14150     else
14151         AC_MSG_RESULT([no])
14152         BUILD_TYPE="$BUILD_TYPE CAIRO"
14153     fi
14155     if test "$enable_cairo_canvas" != no; then
14156         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14157         ENABLE_CAIRO_CANVAS=TRUE
14158     fi
14161 AC_SUBST(CAIRO_CFLAGS)
14162 AC_SUBST(CAIRO_LIBS)
14163 AC_SUBST(ENABLE_CAIRO_CANVAS)
14164 AC_SUBST(SYSTEM_CAIRO)
14166 dnl ===================================================================
14167 dnl Test whether to use avahi
14168 dnl ===================================================================
14169 if test "$_os" = "WINNT"; then
14170     # Windows uses bundled mDNSResponder
14171     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14172 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14173     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14174                       [ENABLE_AVAHI="TRUE"])
14175     AC_DEFINE(HAVE_FEATURE_AVAHI)
14176     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14177     FilterLibs "${AVAHI_LIBS}"
14178     AVAHI_LIBS="${filteredlibs}"
14181 AC_SUBST(ENABLE_AVAHI)
14182 AC_SUBST(AVAHI_CFLAGS)
14183 AC_SUBST(AVAHI_LIBS)
14185 dnl ===================================================================
14186 dnl Test whether to use MSVC /analyze
14187 dnl ===================================================================
14188 ENABLE_MSVC_ANALYZE=
14189 AC_MSG_CHECKING([whether to use MSVC /analyze])
14190 if test -n "$enable_msvc_analyze" -a "$enable_msvc_analyze" != "no"; then
14191 if test "$_os" = "WINNT"; then
14192     ENABLE_MSVC_ANALYZE=Yes
14193     AC_MSG_RESULT([yes])
14194 else
14195    AC_MSG_ERROR([--enable-msvc-analyze is only supported on Windows])
14197 else
14198    AC_MSG_RESULT([no])
14201 AC_SUBST(ENABLE_MSVC_ANALYZE)
14203 dnl ===================================================================
14204 dnl Test whether to use liblangtag
14205 dnl ===================================================================
14206 SYSTEM_LIBLANGTAG=
14207 AC_MSG_CHECKING([whether to use system liblangtag])
14208 if test "$with_system_liblangtag" = yes; then
14209     SYSTEM_LIBLANGTAG=TRUE
14210     AC_MSG_RESULT([yes])
14211     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14212     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14213     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14214     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14215     FilterLibs "${LIBLANGTAG_LIBS}"
14216     LIBLANGTAG_LIBS="${filteredlibs}"
14217 else
14218     SYSTEM_LIBLANGTAG=
14219     AC_MSG_RESULT([no])
14220     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14221     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14222     if test "$COM" = "MSC"; then
14223         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14224     else
14225         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14226     fi
14228 AC_SUBST(SYSTEM_LIBLANGTAG)
14229 AC_SUBST(LIBLANGTAG_CFLAGS)
14230 AC_SUBST(LIBLANGTAG_LIBS)
14232 dnl ===================================================================
14233 dnl Test whether to build libpng or rely on the system version
14234 dnl ===================================================================
14236 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14237 LIBPNG_LIBS_internal='-L$(gb_StaticLibrary_WORKDIR) -llibpng'
14238 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14240 dnl ===================================================================
14241 dnl Test whether to build libtiff or rely on the system version
14242 dnl ===================================================================
14244 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14246 dnl ===================================================================
14247 dnl Test whether to build libwebp or rely on the system version
14248 dnl ===================================================================
14250 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14252 dnl ===================================================================
14253 dnl Check for runtime JVM search path
14254 dnl ===================================================================
14255 if test "$ENABLE_JAVA" != ""; then
14256     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14257     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14258         AC_MSG_RESULT([yes])
14259         if ! test -d "$with_jvm_path"; then
14260             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14261         fi
14262         if ! test -d "$with_jvm_path"jvm; then
14263             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14264         fi
14265         JVM_ONE_PATH_CHECK="$with_jvm_path"
14266         AC_SUBST(JVM_ONE_PATH_CHECK)
14267     else
14268         AC_MSG_RESULT([no])
14269     fi
14272 dnl ===================================================================
14273 dnl Test for the presence of Ant and that it works
14274 dnl ===================================================================
14276 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14277 # breaks filename decoding, so for the ant section, set it to LANG
14278 LC_ALL=$LANG
14279 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14280     ANT_HOME=; export ANT_HOME
14281     WITH_ANT_HOME=; export WITH_ANT_HOME
14282     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14283         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14284             if test "$_os" = "WINNT"; then
14285                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14286             else
14287                 with_ant_home="$LODE_HOME/opt/ant"
14288             fi
14289         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14290             with_ant_home="$LODE_HOME/opt/ant"
14291         fi
14292     fi
14293     if test -z "$with_ant_home"; then
14294         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14295     else
14296         if test "$_os" = "WINNT"; then
14297             # AC_PATH_PROGS needs unix path
14298             PathFormat "$with_ant_home"
14299             with_ant_home="$formatted_path_unix"
14300         fi
14301         AbsolutePath "$with_ant_home"
14302         with_ant_home=$absolute_path
14303         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14304         WITH_ANT_HOME=$with_ant_home
14305         ANT_HOME=$with_ant_home
14306     fi
14308     if test -z "$ANT"; then
14309         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14310     else
14311         # resolve relative or absolute symlink
14312         while test -h "$ANT"; do
14313             a_cwd=`pwd`
14314             a_basename=`basename "$ANT"`
14315             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14316             cd "`dirname "$ANT"`"
14317             cd "`dirname "$a_script"`"
14318             ANT="`pwd`"/"`basename "$a_script"`"
14319             cd "$a_cwd"
14320         done
14322         AC_MSG_CHECKING([if $ANT works])
14323         mkdir -p conftest.dir
14324         a_cwd=$(pwd)
14325         cd conftest.dir
14326         cat > conftest.java << EOF
14327         public class conftest {
14328             int testmethod(int a, int b) {
14329                     return a + b;
14330             }
14331         }
14334         cat > conftest.xml << EOF
14335         <project name="conftest" default="conftest">
14336         <target name="conftest">
14337             <javac srcdir="." includes="conftest.java">
14338             </javac>
14339         </target>
14340         </project>
14343         if test -n "$WSL_ONLY_AS_HELPER"; then
14344             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14345             export JAVACMD="$JAVAINTERPRETER"
14346             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14347             # building the classpath, but we need the windows-style one for the windows-java
14348             PathFormat "$ANT_HOME"
14349             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14350         fi
14351         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14352         if test $? = 0 -a -f ./conftest.class; then
14353             AC_MSG_RESULT([Ant works])
14354             if test -z "$WITH_ANT_HOME"; then
14355                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14356                 if test -z "$ANT_HOME"; then
14357                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14358                 fi
14359             else
14360                 ANT_HOME="$WITH_ANT_HOME"
14361             fi
14362         else
14363             echo "configure: Ant test failed" >&5
14364             cat conftest.java >&5
14365             cat conftest.xml >&5
14366             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14367         fi
14368         cd "$a_cwd"
14369         rm -fr conftest.dir
14370     fi
14371     if test -z "$ANT_HOME"; then
14372         ANT_HOME="NO_ANT_HOME"
14373     else
14374         PathFormat "$ANT_HOME"
14375         ANT_HOME="$formatted_path_unix"
14376         PathFormat "$ANT"
14377         ANT="$formatted_path_unix"
14378     fi
14380     dnl Checking for ant.jar
14381     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14382         AC_MSG_CHECKING([Ant lib directory])
14383         if test -f $ANT_HOME/lib/ant.jar; then
14384             ANT_LIB="$ANT_HOME/lib"
14385         else
14386             if test -f $ANT_HOME/ant.jar; then
14387                 ANT_LIB="$ANT_HOME"
14388             else
14389                 if test -f /usr/share/java/ant.jar; then
14390                     ANT_LIB=/usr/share/java
14391                 else
14392                     if test -f /usr/share/ant-core/lib/ant.jar; then
14393                         ANT_LIB=/usr/share/ant-core/lib
14394                     else
14395                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14396                             ANT_LIB="$ANT_HOME/lib/ant"
14397                         else
14398                             if test -f /usr/share/lib/ant/ant.jar; then
14399                                 ANT_LIB=/usr/share/lib/ant
14400                             else
14401                                 AC_MSG_ERROR([Ant libraries not found!])
14402                             fi
14403                         fi
14404                     fi
14405                 fi
14406             fi
14407         fi
14408         PathFormat "$ANT_LIB"
14409         ANT_LIB="$formatted_path"
14410         AC_MSG_RESULT([Ant lib directory found.])
14411     fi
14413     ant_minver=1.6.0
14414     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14416     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14417     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14418     ant_version_major=`echo $ant_version | cut -d. -f1`
14419     ant_version_minor=`echo $ant_version | cut -d. -f2`
14420     echo "configure: ant_version $ant_version " >&5
14421     echo "configure: ant_version_major $ant_version_major " >&5
14422     echo "configure: ant_version_minor $ant_version_minor " >&5
14423     if test "$ant_version_major" -ge "2"; then
14424         AC_MSG_RESULT([yes, $ant_version])
14425     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14426         AC_MSG_RESULT([yes, $ant_version])
14427     else
14428         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14429     fi
14431     rm -f conftest* core core.* *.core
14433 AC_SUBST(ANT)
14434 AC_SUBST(ANT_HOME)
14435 AC_SUBST(ANT_LIB)
14437 OOO_JUNIT_JAR=
14438 HAMCREST_JAR=
14439 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14440     AC_MSG_CHECKING([for JUnit 4])
14441     if test "$with_junit" = "yes"; then
14442         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14443             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14444         elif test -e /usr/share/java/junit4.jar; then
14445             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14446         else
14447            if test -e /usr/share/lib/java/junit.jar; then
14448               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14449            else
14450               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14451            fi
14452         fi
14453     else
14454         OOO_JUNIT_JAR=$with_junit
14455     fi
14456     if test "$_os" = "WINNT"; then
14457         PathFormat "$OOO_JUNIT_JAR"
14458         OOO_JUNIT_JAR="$formatted_path"
14459     fi
14460     printf 'import org.junit.Before;' > conftest.java
14461     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14462         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14463     else
14464         AC_MSG_ERROR(
14465 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14466  specify its pathname via --with-junit=..., or disable it via --without-junit])
14467     fi
14468     rm -f conftest.class conftest.java
14469     if test $OOO_JUNIT_JAR != ""; then
14470         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14471     fi
14473     AC_MSG_CHECKING([for included Hamcrest])
14474     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14475     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14476         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14477     else
14478         AC_MSG_RESULT([Not included])
14479         AC_MSG_CHECKING([for standalone hamcrest jar.])
14480         if test "$with_hamcrest" = "yes"; then
14481             if test -e /usr/share/lib/java/hamcrest.jar; then
14482                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14483             elif test -e /usr/share/java/hamcrest/core.jar; then
14484                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14485             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14486                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14487             else
14488                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14489             fi
14490         else
14491             HAMCREST_JAR=$with_hamcrest
14492         fi
14493         if test "$_os" = "WINNT"; then
14494             PathFormat "$HAMCREST_JAR"
14495             HAMCREST_JAR="$formatted_path"
14496         fi
14497         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14498             AC_MSG_RESULT([$HAMCREST_JAR])
14499         else
14500             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),
14501                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14502         fi
14503     fi
14504     rm -f conftest.class conftest.java
14506 AC_SUBST(OOO_JUNIT_JAR)
14507 AC_SUBST(HAMCREST_JAR)
14508 # set back LC_ALL to C after the java related tests...
14509 LC_ALL=C
14511 AC_SUBST(SCPDEFS)
14514 # check for wget and curl
14516 WGET=
14517 CURL=
14519 if test "$enable_fetch_external" != "no"; then
14521 CURL=`command -v curl`
14523 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14524     # wget new enough?
14525     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14526     if test $? -eq 0; then
14527         WGET=$i
14528         break
14529     fi
14530 done
14532 if test -z "$WGET" -a -z "$CURL"; then
14533     AC_MSG_ERROR([neither wget nor curl found!])
14538 AC_SUBST(WGET)
14539 AC_SUBST(CURL)
14542 # check for sha256sum
14544 SHA256SUM=
14546 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14547     eval "$i -a 256 --version" > /dev/null 2>&1
14548     ret=$?
14549     if test $ret -eq 0; then
14550         SHA256SUM="$i -a 256"
14551         break
14552     fi
14553 done
14555 if test -z "$SHA256SUM"; then
14556     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14557         eval "$i --version" > /dev/null 2>&1
14558         ret=$?
14559         if test $ret -eq 0; then
14560             SHA256SUM=$i
14561             break
14562         fi
14563     done
14566 if test -z "$SHA256SUM"; then
14567     AC_MSG_ERROR([no sha256sum found!])
14570 AC_SUBST(SHA256SUM)
14572 dnl ===================================================================
14573 dnl Dealing with l10n options
14574 dnl ===================================================================
14575 AC_MSG_CHECKING([which languages to be built])
14576 # get list of all languages
14577 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14578 # we want en-US at the beginning
14579 ALL_LANGS=$($GNUMAKE SRC_ROOT=$SRC_ROOT WITH_LANG="$with_lang" ENABLE_RELEASE_BUILD="$ENABLE_RELEASE_BUILD" -sr -f - <<'EOF' | tr -d '\r'
14580 include $(SRC_ROOT)/solenv/inc/langlist.mk
14581 all:
14582         $(info en-US $(filter-out en-US,$(sort $(completelangiso))))
14586 # check the configured localizations
14587 WITH_LANG="$with_lang"
14589 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14590 # (Norwegian is "nb" and "nn".)
14591 if test "$WITH_LANG" = "no"; then
14592     WITH_LANG=
14595 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14596     AC_MSG_RESULT([en-US])
14597 else
14598     AC_MSG_RESULT([$WITH_LANG])
14599     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14600     if test -z "$MSGFMT"; then
14601         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14602             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14603         elif test -x "/opt/lo/bin/msgfmt"; then
14604             MSGFMT="/opt/lo/bin/msgfmt"
14605         else
14606             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14607             if test -z "$MSGFMT"; then
14608                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14609             fi
14610         fi
14611     fi
14612     if test -z "$MSGUNIQ"; then
14613         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14614             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14615         elif test -x "/opt/lo/bin/msguniq"; then
14616             MSGUNIQ="/opt/lo/bin/msguniq"
14617         else
14618             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14619             if test -z "$MSGUNIQ"; then
14620                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14621             fi
14622         fi
14623     fi
14625 AC_SUBST(MSGFMT)
14626 AC_SUBST(MSGUNIQ)
14627 # check that the list is valid
14628 for lang in $WITH_LANG; do
14629     test "$lang" = "ALL" && continue
14630     # need to check for the exact string, so add space before and after the list of all languages
14631     for vl in $ALL_LANGS; do
14632         if test "$vl" = "$lang"; then
14633            break
14634         fi
14635     done
14636     if test "$vl" != "$lang"; then
14637         # if you're reading this - you prolly quoted your languages remove the quotes ...
14638         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14639     fi
14640 done
14641 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14642     echo $WITH_LANG | grep -q en-US
14643     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14645 # list with substituted ALL
14646 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14647 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14648 test "$WITH_LANG" = "en-US" && WITH_LANG=
14649 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14650     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14651     ALL_LANGS=`echo $ALL_LANGS qtz`
14653 AC_SUBST(ALL_LANGS)
14654 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14655 AC_SUBST(WITH_LANG)
14656 AC_SUBST(WITH_LANG_LIST)
14657 AC_SUBST(GIT_NEEDED_SUBMODULES)
14659 WITH_POOR_HELP_LOCALIZATIONS=
14660 if test -d "$SRC_ROOT/translations/source"; then
14661     for l in `ls -1 $SRC_ROOT/translations/source`; do
14662         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14663             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14664         fi
14665     done
14667 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14669 if test -n "$with_locales" -a "$with_locales" != ALL; then
14670     WITH_LOCALES="$with_locales"
14672     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14673     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14674     # config_host/config_locales.h.in
14675     for locale in $WITH_LOCALES; do
14676         lang=${locale%_*}
14678         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14680         case $lang in
14681         hi|mr*ne)
14682             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14683             ;;
14684         bg|ru)
14685             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14686             ;;
14687         esac
14688     done
14689 else
14690     AC_DEFINE(WITH_LOCALE_ALL)
14692 AC_SUBST(WITH_LOCALES)
14694 dnl git submodule update --reference
14695 dnl ===================================================================
14696 if test -n "${GIT_REFERENCE_SRC}"; then
14697     for repo in ${GIT_NEEDED_SUBMODULES}; do
14698         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14699             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14700         fi
14701     done
14703 AC_SUBST(GIT_REFERENCE_SRC)
14705 dnl git submodules linked dirs
14706 dnl ===================================================================
14707 if test -n "${GIT_LINK_SRC}"; then
14708     for repo in ${GIT_NEEDED_SUBMODULES}; do
14709         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14710             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14711         fi
14712     done
14714 AC_SUBST(GIT_LINK_SRC)
14716 dnl branding
14717 dnl ===================================================================
14718 AC_MSG_CHECKING([for alternative branding images directory])
14719 # initialize mapped arrays
14720 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14721 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14723 if test -z "$with_branding" -o "$with_branding" = "no"; then
14724     AC_MSG_RESULT([none])
14725     DEFAULT_BRAND_IMAGES="$brand_files"
14726 else
14727     if ! test -d $with_branding ; then
14728         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14729     else
14730         AC_MSG_RESULT([$with_branding])
14731         CUSTOM_BRAND_DIR="$with_branding"
14732         for lfile in $brand_files
14733         do
14734             if ! test -f $with_branding/$lfile ; then
14735                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14736                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14737             else
14738                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14739             fi
14740         done
14741         check_for_progress="yes"
14742     fi
14744 AC_SUBST([BRAND_INTRO_IMAGES])
14745 AC_SUBST([CUSTOM_BRAND_DIR])
14746 AC_SUBST([CUSTOM_BRAND_IMAGES])
14747 AC_SUBST([DEFAULT_BRAND_IMAGES])
14750 AC_MSG_CHECKING([for 'intro' progress settings])
14751 PROGRESSBARCOLOR=
14752 PROGRESSSIZE=
14753 PROGRESSPOSITION=
14754 PROGRESSFRAMECOLOR=
14755 PROGRESSTEXTCOLOR=
14756 PROGRESSTEXTBASELINE=
14758 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14759     source "$with_branding/progress.conf"
14760     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14761 else
14762     AC_MSG_RESULT([none])
14765 AC_SUBST(PROGRESSBARCOLOR)
14766 AC_SUBST(PROGRESSSIZE)
14767 AC_SUBST(PROGRESSPOSITION)
14768 AC_SUBST(PROGRESSFRAMECOLOR)
14769 AC_SUBST(PROGRESSTEXTCOLOR)
14770 AC_SUBST(PROGRESSTEXTBASELINE)
14773 dnl ===================================================================
14774 dnl Custom build version
14775 dnl ===================================================================
14776 AC_MSG_CHECKING([for extra build ID])
14777 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14778     EXTRA_BUILDID="$with_extra_buildid"
14780 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14781 if test -n "$EXTRA_BUILDID" ; then
14782     AC_MSG_RESULT([$EXTRA_BUILDID])
14783 else
14784     AC_MSG_RESULT([not set])
14786 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14788 OOO_VENDOR=
14789 AC_MSG_CHECKING([for vendor])
14790 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14791     OOO_VENDOR="$USERNAME"
14793     if test -z "$OOO_VENDOR"; then
14794         OOO_VENDOR="$USER"
14795     fi
14797     if test -z "$OOO_VENDOR"; then
14798         OOO_VENDOR="`id -u -n`"
14799     fi
14801     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14802 else
14803     OOO_VENDOR="$with_vendor"
14804     AC_MSG_RESULT([$OOO_VENDOR])
14806 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14807 AC_SUBST(OOO_VENDOR)
14809 if test "$_os" = "Android" ; then
14810     ANDROID_PACKAGE_NAME=
14811     AC_MSG_CHECKING([for Android package name])
14812     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14813         if test -n "$ENABLE_DEBUG"; then
14814             # Default to the package name that makes ndk-gdb happy.
14815             ANDROID_PACKAGE_NAME="org.libreoffice"
14816         else
14817             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14818         fi
14820         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14821     else
14822         ANDROID_PACKAGE_NAME="$with_android_package_name"
14823         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14824     fi
14825     AC_SUBST(ANDROID_PACKAGE_NAME)
14828 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14829 if test "$with_compat_oowrappers" = "yes"; then
14830     WITH_COMPAT_OOWRAPPERS=TRUE
14831     AC_MSG_RESULT(yes)
14832 else
14833     WITH_COMPAT_OOWRAPPERS=
14834     AC_MSG_RESULT(no)
14836 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14838 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14839 AC_MSG_CHECKING([for install dirname])
14840 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14841     INSTALLDIRNAME="$with_install_dirname"
14843 AC_MSG_RESULT([$INSTALLDIRNAME])
14844 AC_SUBST(INSTALLDIRNAME)
14846 AC_MSG_CHECKING([for prefix])
14847 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14848 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14849 PREFIXDIR="$prefix"
14850 AC_MSG_RESULT([$PREFIXDIR])
14851 AC_SUBST(PREFIXDIR)
14853 LIBDIR=[$(eval echo $(eval echo $libdir))]
14854 AC_SUBST(LIBDIR)
14856 DATADIR=[$(eval echo $(eval echo $datadir))]
14857 AC_SUBST(DATADIR)
14859 MANDIR=[$(eval echo $(eval echo $mandir))]
14860 AC_SUBST(MANDIR)
14862 DOCDIR=[$(eval echo $(eval echo $docdir))]
14863 AC_SUBST(DOCDIR)
14865 BINDIR=[$(eval echo $(eval echo $bindir))]
14866 AC_SUBST(BINDIR)
14868 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14869 AC_SUBST(INSTALLDIR)
14871 TESTINSTALLDIR="${BUILDDIR}/test-install"
14872 AC_SUBST(TESTINSTALLDIR)
14875 # ===================================================================
14876 # OAuth2 id and secrets
14877 # ===================================================================
14879 AC_MSG_CHECKING([for Google Drive client id and secret])
14880 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14881     AC_MSG_RESULT([not set])
14882     GDRIVE_CLIENT_ID="\"\""
14883     GDRIVE_CLIENT_SECRET="\"\""
14884 else
14885     AC_MSG_RESULT([set])
14886     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14887     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14889 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14890 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14892 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14893 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14894     AC_MSG_RESULT([not set])
14895     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14896     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14897 else
14898     AC_MSG_RESULT([set])
14899     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14900     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14902 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14903 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14905 AC_MSG_CHECKING([for OneDrive client id and secret])
14906 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14907     AC_MSG_RESULT([not set])
14908     ONEDRIVE_CLIENT_ID="\"\""
14909     ONEDRIVE_CLIENT_SECRET="\"\""
14910 else
14911     AC_MSG_RESULT([set])
14912     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14913     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14915 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14916 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14919 dnl ===================================================================
14920 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14921 dnl --enable-dependency-tracking configure option
14922 dnl ===================================================================
14923 AC_MSG_CHECKING([whether to enable dependency tracking])
14924 if test "$enable_dependency_tracking" = "no"; then
14925     nodep=TRUE
14926     AC_MSG_RESULT([no])
14927 else
14928     AC_MSG_RESULT([yes])
14930 AC_SUBST(nodep)
14932 dnl ===================================================================
14933 dnl Number of CPUs to use during the build
14934 dnl ===================================================================
14935 AC_MSG_CHECKING([for number of processors to use])
14936 # plain --with-parallelism is just the default
14937 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14938     if test "$with_parallelism" = "no"; then
14939         PARALLELISM=0
14940     else
14941         PARALLELISM=$with_parallelism
14942     fi
14943 else
14944     if test "$enable_icecream" = "yes"; then
14945         PARALLELISM="40"
14946     else
14947         case `uname -s` in
14949         Darwin|FreeBSD|NetBSD|OpenBSD)
14950             PARALLELISM=`sysctl -n hw.ncpu`
14951             ;;
14953         Linux)
14954             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14955         ;;
14956         # what else than above does profit here *and* has /proc?
14957         *)
14958             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14959             ;;
14960         esac
14962         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14963         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14964     fi
14967 if test $PARALLELISM -eq 0; then
14968     AC_MSG_RESULT([explicit make -j option needed])
14969 else
14970     AC_MSG_RESULT([$PARALLELISM])
14972 AC_SUBST(PARALLELISM)
14975 # Set up ILIB for MSVC build
14977 ILIB1=
14978 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14979     ILIB="."
14980     if test -n "$JAVA_HOME"; then
14981         ILIB="$ILIB;$JAVA_HOME/lib"
14982     fi
14983     ILIB1=-link
14984     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14985     ILIB="$ILIB;$formatted_path"
14986     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14987     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14988     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14989     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14990         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14991         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14992     fi
14993     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14994     ucrtlibpath_formatted=$formatted_path
14995     ILIB="$ILIB;$ucrtlibpath_formatted"
14996     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14997     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14998         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14999         ILIB="$ILIB;$formatted_path"
15000     else
15001         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
15002         ILIB="$ILIB;$formatted_path"
15003     fi
15005     if test "$cross_compiling" != "yes"; then
15006         ILIB_FOR_BUILD="$ILIB"
15007     fi
15009 AC_SUBST(ILIB)
15010 AC_SUBST(ILIB_FOR_BUILD)
15012 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
15013 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
15014 dnl from consteval constructor initializing const variable",
15015 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
15016 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
15017 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
15018 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
15019 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
15020 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
15021 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
15022 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
15023 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
15024 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
15025 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
15026 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
15027 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
15028 have_cpp_consteval=
15029 AC_LANG_PUSH([C++])
15030 save_CXX=$CXX
15031 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15032     CXX="env LIB=$ILIB $CXX"
15034 save_CXXFLAGS=$CXXFLAGS
15035 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15036 AC_RUN_IFELSE([AC_LANG_PROGRAM([
15037         struct S {
15038             consteval S() { i = 1; }
15039             int i = 0;
15040         };
15041         S const s;
15043         struct S1 {
15044              int a;
15045              consteval S1(int n): a(n) {}
15046         };
15047         struct S2 {
15048             S1 x;
15049             S2(): x(0) {}
15050         };
15052         struct S3 {
15053             consteval S3() {}
15054             union {
15055                 int a;
15056                 unsigned b = 0;
15057             };
15058         };
15059         void f() { S3(); }
15061         struct S4 { consteval S4() = default; };
15062         void f4(bool b) { b ? S4() : S4(); }
15064         struct S5 {
15065             consteval S5() { c = 0; }
15066             char * f() { return &c; }
15067             union {
15068                 char c;
15069                 int i;
15070             };
15071         };
15072         auto s5 = S5().f();
15074         struct S6 {
15075             consteval S6(char const (&lit)[[2]]) {
15076                 buf[[0]] = lit[[0]];
15077                 buf[[1]] = lit[[1]];
15078             }
15079             union {
15080                 int x;
15081                 char buf[[2]];
15082             };
15083         };
15084         void f6() { S6("a"); }
15085     ], [
15086         return (s.i == 1) ? 0 : 1;
15087     ])], [
15088         have_cpp_consteval=1
15089         AC_MSG_RESULT([yes])
15090     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
15091 CXX=$save_CXX
15092 CXXFLAGS=$save_CXXFLAGS
15093 AC_LANG_POP([C++])
15094 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
15095 then
15096     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
15097     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
15098     dnl reference to consteval constructor exported from module" (which also affects PCH, see
15099     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
15100     dnl --enable-pch setup is known broken"):
15101     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
15102     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
15103     rm conftest.cppm
15104     AC_LANG_PUSH([C++])
15105     save_CXXFLAGS=$CXXFLAGS
15106     save_LDFLAGS=$LDFLAGS
15107     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15108     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
15109     AC_LINK_IFELSE([AC_LANG_PROGRAM([
15110         import M;
15111     ], [
15112         struct S2 { S1 s = 0; };
15113         S2 s;
15114     ])], [
15115         AC_MSG_RESULT([yes])
15116     ], [
15117         have_cpp_consteval=
15118         AC_MSG_RESULT([no])])
15119     CXXFLAGS=$save_CXXFLAGS
15120     LDFLAGS=$save_LDFLAGS
15121     AC_LANG_POP([C++])
15122     rm conftest.pcm
15124 if test -n "$have_cpp_consteval"; then
15125     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15128 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15129 dnl ...which is known to not be implemented in libc++ prior to
15130 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15131 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15132 AC_LANG_PUSH([C++])
15133 save_CXX=$CXX
15134 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15135     CXX="env LIB=$ILIB $CXX"
15137 save_CXXFLAGS=$CXXFLAGS
15138 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15139 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15140         #include <compare>
15141     ], [
15142         (void) (std::strong_order(1.0, 2.0) < 0);
15143     ])], [
15144         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15145         AC_MSG_RESULT([yes])
15146     ], [AC_MSG_RESULT([no])])
15147 CXX=$save_CXX
15148 CXXFLAGS=$save_CXXFLAGS
15149 AC_LANG_POP([C++])
15151 # ===================================================================
15152 # Creating bigger shared library to link against
15153 # ===================================================================
15154 AC_MSG_CHECKING([whether to create huge library])
15155 MERGELIBS=
15156 MERGELIBS_MORE=
15158 if test $_os = iOS -o $_os = Android; then
15159     # Never any point in mergelibs for these as we build just static
15160     # libraries anyway...
15161     enable_mergelibs=no
15164 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15165     if test "$enable_mergelibs" = "more"; then
15166         MERGELIBS="TRUE"
15167         MERGELIBS_MORE="TRUE"
15168         AC_MSG_RESULT([yes (more)])
15169         AC_DEFINE(ENABLE_MERGELIBS)
15170         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15171     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15172         MERGELIBS="TRUE"
15173         AC_MSG_RESULT([yes])
15174         AC_DEFINE(ENABLE_MERGELIBS)
15175     else
15176         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15177     fi
15178 else
15179     AC_MSG_RESULT([no])
15181 AC_SUBST([MERGELIBS])
15182 AC_SUBST([MERGELIBS_MORE])
15184 dnl ===================================================================
15185 dnl icerun is a wrapper that stops us spawning tens of processes
15186 dnl locally - for tools that can't be executed on the compile cluster
15187 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15188 dnl ===================================================================
15189 AC_MSG_CHECKING([whether to use icerun wrapper])
15190 ICECREAM_RUN=
15191 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15192     ICECREAM_RUN=icerun
15193     AC_MSG_RESULT([yes])
15194 else
15195     AC_MSG_RESULT([no])
15197 AC_SUBST(ICECREAM_RUN)
15199 dnl ===================================================================
15200 dnl Setup the ICECC_VERSION for the build the same way it was set for
15201 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15202 dnl ===================================================================
15203 x_ICECC_VERSION=[\#]
15204 if test -n "$ICECC_VERSION" ; then
15205     x_ICECC_VERSION=
15207 AC_SUBST(x_ICECC_VERSION)
15208 AC_SUBST(ICECC_VERSION)
15210 dnl ===================================================================
15212 AC_MSG_CHECKING([MPL subset])
15213 MPL_SUBSET=
15214 LICENSE="LGPL"
15216 if test "$enable_mpl_subset" = "yes"; then
15217     mpl_error_string=
15218     newline=$'\n    *'
15219     warn_report=false
15220     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15221         warn_report=true
15222     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15223         warn_report=true
15224     fi
15225     if test "$warn_report" = "true"; then
15226         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15227     fi
15228     if test "x$enable_postgresql_sdbc" != "xno"; then
15229         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15230     fi
15231     if test "$enable_lotuswordpro" = "yes"; then
15232         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15233     fi
15234     if test -n "$ENABLE_POPPLER"; then
15235         if test "x$SYSTEM_POPPLER" = "x"; then
15236             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15237         fi
15238     fi
15239     # cf. m4/libo_check_extension.m4
15240     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15241         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15242     fi
15243     denied_themes=
15244     filtered_themes=
15245     for theme in $WITH_THEMES; do
15246         case $theme in
15247         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15248             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15249         *)
15250             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15251         esac
15252     done
15253     if test "x$denied_themes" != "x"; then
15254         if test "x$filtered_themes" == "x"; then
15255             filtered_themes="colibre"
15256         fi
15257         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15258     fi
15260     ENABLE_OPENGL_TRANSITIONS=
15262     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15263         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15264     fi
15266     if test "x$mpl_error_string" != "x"; then
15267         AC_MSG_ERROR([$mpl_error_string])
15268     fi
15270     MPL_SUBSET="TRUE"
15271     LICENSE="MPL-2.0"
15272     AC_DEFINE(MPL_HAVE_SUBSET)
15273     AC_MSG_RESULT([only])
15274 else
15275     AC_MSG_RESULT([no restrictions])
15277 AC_SUBST(MPL_SUBSET)
15278 AC_SUBST(LICENSE)
15280 dnl ===================================================================
15282 AC_MSG_CHECKING([formula logger])
15283 ENABLE_FORMULA_LOGGER=
15285 if test "x$enable_formula_logger" = "xyes"; then
15286     AC_MSG_RESULT([yes])
15287     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15288     ENABLE_FORMULA_LOGGER=TRUE
15289 elif test -n "$ENABLE_DBGUTIL" ; then
15290     AC_MSG_RESULT([yes])
15291     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15292     ENABLE_FORMULA_LOGGER=TRUE
15293 else
15294     AC_MSG_RESULT([no])
15297 AC_SUBST(ENABLE_FORMULA_LOGGER)
15299 dnl ===================================================================
15300 dnl Checking for active Antivirus software.
15301 dnl ===================================================================
15303 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15304     AC_MSG_CHECKING([for active Antivirus software])
15305     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15306     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15307     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15308         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15309             AC_MSG_RESULT([found])
15310             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15311             echo $EICAR_STRING > $SRC_ROOT/eicar
15312             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15313             rm $SRC_ROOT/eicar
15314             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15315                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15316             fi
15317             echo $EICAR_STRING > $BUILDDIR/eicar
15318             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15319             rm $BUILDDIR/eicar
15320             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15321                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15322             fi
15323             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"
15324         else
15325             AC_MSG_RESULT([not found])
15326         fi
15327     else
15328         AC_MSG_RESULT([n/a])
15329     fi
15332 dnl ===================================================================
15334 AC_MSG_CHECKING([for coredumpctl support])
15335 if test -z "$with_coredumpctl" && test $_os != Linux; then
15336     with_coredumpctl=no
15338 if test "$with_coredumpctl" = no; then
15339     WITH_COREDUMPCTL=
15340 else
15341     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15342     AC_PATH_PROG(JQ, jq)
15343     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15344     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15345     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15346         || test -z "$SYSTEMD_RUN"
15347     then
15348         if test -z "$with_coredumpctl"; then
15349             WITH_COREDUMPCTL=
15350         else
15351             if test -z "$COREDUMPCTL"; then
15352                 AC_MSG_ERROR([coredumpctl not found])
15353             fi
15354             if test -z "$JQ"; then
15355                 AC_MSG_ERROR([jq not found])
15356             fi
15357             if test -z "$SYSTEMD_ESCAPE"; then
15358                 AC_MSG_ERROR([systemd-escape not found])
15359             fi
15360             if test -z "$SYSTEMD_RUN"; then
15361                 AC_MSG_ERROR([systemd-run not found])
15362             fi
15363         fi
15364     else
15365         WITH_COREDUMPCTL=TRUE
15366     fi
15368 if test -z "$WITH_COREDUMPCTL"; then
15369     AC_MSG_RESULT([no])
15370 else
15371     AC_MSG_RESULT([yes])
15373 AC_SUBST(COREDUMPCTL)
15374 AC_SUBST(JQ)
15375 AC_SUBST(SYSTEMD_ESCAPE)
15376 AC_SUBST(SYSTEMD_RUN)
15377 AC_SUBST(WITH_COREDUMPCTL)
15379 dnl ===================================================================
15380 dnl Checking whether to use a keep-awake helper
15381 dnl ===================================================================
15383 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15384 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15385     AC_MSG_RESULT([no])
15386 elif test "$with_keep_awake" = "yes"; then
15387     AC_MSG_RESULT([yes (autodetect)])
15388     AC_MSG_CHECKING([for a suitable keep-awake command])
15389     if test "$_os" = "WINNT"; then
15390         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15391         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15392             AC_MSG_RESULT([using "Awake"])
15393             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15394             # make's PID and then use that to get the windows-PID.
15395             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15396             # much scarier looking than it actually is. Using make's shell instead of subshells in
15397             # the recipe to keep the command that's echoed by make short.
15398             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}'"'"') &'
15399         else
15400             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15401         fi
15402     elif test "$_os" = "Darwin"; then
15403         AC_MSG_RESULT([using "caffeinate"])
15404         KEEP_AWAKE_CMD="caffeinate"
15405     else
15406         AC_MSG_ERROR([no default available for $_os, please specify manually])
15407     fi
15408 else
15409     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15411 AC_SUBST(KEEP_AWAKE_CMD)
15413 dnl ===================================================================
15414 dnl Setting up the environment.
15415 dnl ===================================================================
15416 AC_MSG_NOTICE([setting up the build environment variables...])
15418 AC_SUBST(COMPATH)
15420 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15421     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15422         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15423         ATL_INCLUDE="$COMPATH/atlmfc/include"
15424     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15425         ATL_LIB="$COMPATH/atlmfc/lib"
15426         ATL_INCLUDE="$COMPATH/atlmfc/include"
15427     else
15428         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15429         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15430     fi
15431     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15432     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15433     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15436 if test "$build_os" = "cygwin"; then
15437     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15438     PathFormat "/usr/bin/find.exe"
15439     FIND="$formatted_path"
15440     PathFormat "/usr/bin/sort.exe"
15441     SORT="$formatted_path"
15442     PathFormat "/usr/bin/grep.exe"
15443     WIN_GREP="$formatted_path"
15444     PathFormat "/usr/bin/ls.exe"
15445     WIN_LS="$formatted_path"
15446     PathFormat "/usr/bin/touch.exe"
15447     WIN_TOUCH="$formatted_path"
15448 else
15449     FIND=find
15450     SORT=sort
15453 AC_SUBST(ATL_INCLUDE)
15454 AC_SUBST(ATL_LIB)
15455 AC_SUBST(FIND)
15456 AC_SUBST(SORT)
15457 AC_SUBST(WIN_GREP)
15458 AC_SUBST(WIN_LS)
15459 AC_SUBST(WIN_TOUCH)
15461 AC_SUBST(BUILD_TYPE)
15463 AC_SUBST(SOLARINC)
15465 PathFormat "$PERL"
15466 PERL="$formatted_path"
15467 AC_SUBST(PERL)
15469 if test -n "$TMPDIR"; then
15470     TEMP_DIRECTORY="$TMPDIR"
15471     if test -n "$WSL_ONLY_AS_HELPER"; then
15472        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15473     fi
15474 else
15475     TEMP_DIRECTORY="/tmp"
15477 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15478 if test "$build_os" = "cygwin"; then
15479     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15480     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15482 AC_SUBST(TEMP_DIRECTORY)
15483 AC_SUBST(CYGWIN_BASH)
15485 # setup the PATH for the environment
15486 if test -n "$LO_PATH_FOR_BUILD"; then
15487     LO_PATH="$LO_PATH_FOR_BUILD"
15488     case "$host_os" in
15489     cygwin*|wsl*)
15490         pathmunge "$MSVC_HOST_PATH" "before"
15491         ;;
15492     esac
15493 else
15494     LO_PATH="$PATH"
15496     case "$host_os" in
15498     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15499         if test "$ENABLE_JAVA" != ""; then
15500             pathmunge "$JAVA_HOME/bin" "after"
15501         fi
15502         ;;
15504     cygwin*|wsl*)
15505         # Win32 make needs native paths
15506         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15507             LO_PATH=`cygpath -p -m "$PATH"`
15508         fi
15509         if test "$WIN_BUILD_ARCH" = "x64"; then
15510             # needed for msi packaging
15511             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15512         fi
15513         if test "$WIN_BUILD_ARCH" = "arm64"; then
15514             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15515             # the x86 ones probably would work just as well...
15516             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15517         fi
15518         # .NET 4.6 and higher don't have bin directory
15519         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15520             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15521         fi
15522         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15523         pathmunge "$CSC_PATH" "before"
15524         pathmunge "$MIDL_PATH" "before"
15525         pathmunge "$AL_PATH" "before"
15526         pathmunge "$MSVC_MULTI_PATH" "before"
15527         pathmunge "$MSVC_BUILD_PATH" "before"
15528         if test -n "$MSBUILD_PATH" ; then
15529             pathmunge "$MSBUILD_PATH" "before"
15530         fi
15531         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15532         if test "$ENABLE_JAVA" != ""; then
15533             if test -d "$JAVA_HOME/jre/bin/client"; then
15534                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15535             fi
15536             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15537                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15538             fi
15539             pathmunge "$JAVA_HOME/bin" "before"
15540         fi
15541         pathmunge "$MSVC_HOST_PATH" "before"
15542         ;;
15544     solaris*)
15545         pathmunge "/usr/css/bin" "before"
15546         if test "$ENABLE_JAVA" != ""; then
15547             pathmunge "$JAVA_HOME/bin" "after"
15548         fi
15549         ;;
15550     esac
15553 AC_SUBST(LO_PATH)
15555 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15556 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15557     x_LO_ELFCHECK_ALLOWLIST=
15558 else
15559     x_LO_ELFCHECK_ALLOWLIST=[\#]
15561 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15562 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15564 libo_FUZZ_SUMMARY
15566 # Generate a configuration sha256 we can use for deps
15567 if test -f config_host.mk; then
15568     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15570 if test -f config_host_lang.mk; then
15571     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15574 CFLAGS=$my_original_CFLAGS
15575 CXXFLAGS=$my_original_CXXFLAGS
15576 CPPFLAGS=$my_original_CPPFLAGS
15578 AC_CONFIG_LINKS([include:include])
15580 if test -n "$WSL_ONLY_AS_HELPER"; then
15581     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15582     build=$host
15583     PathFormat "$SRC_ROOT"
15584     SRC_ROOT="$formatted_path"
15585     PathFormat "$BUILDDIR"
15586     BUILDDIR="$formatted_path"
15587     # git-bash has (gnu) tar, curl and sha256sum
15588     CURL="curl.exe"
15589     WGET=
15590     GNUTAR="tar.exe"
15591     SHA256SUM="sha256sum.exe"
15592     # TODO: maybe switch to strawberry-perl right away?
15593     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15594     PERL="perl.exe"
15595     # use flex, gperf and nasm from wsl-container
15596     # if using absolute path, would need to use double-leading slash for the msys path mangling
15597     FLEX="$WSL $FLEX"
15598     NASM="$WSL $NASM"
15599     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15600     # with an absolute path/requires the value to begin with a slash
15601     GPERF="/c/Windows/system32/$WSL gperf"
15602     # append strawberry tools dir to PATH (for e.g. windres, ar)
15603     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15604     # temp-dir needs to be in windows realm, hardcode for now
15605     if test "$TEMP_DIRECTORY" = /tmp; then
15606         mkdir -p tmp
15607         TEMP_DIRECTORY="$BUILDDIR/tmp"
15608     fi
15611 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15612 # BUILD platform configuration] - otherwise breaks cross building
15613 AC_CONFIG_FILES([
15614                  config_host_lang.mk
15615                  Makefile
15616                  bin/bffvalidator.sh
15617                  bin/odfvalidator.sh
15618                  bin/officeotron.sh
15619                  instsetoo_native/util/openoffice.lst
15620                  sysui/desktop/macosx/Info.plist
15621                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15622                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15623                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15624 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15625 # easier to do it in a postprocessing command than to modify every single variable
15626 AC_CONFIG_FILES([config_host.mk], [
15627     if test -n "$WSL_ONLY_AS_HELPER"; then
15628         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15629     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15631 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15632 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15633 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15634 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15635 AC_CONFIG_HEADERS([config_host/config_clang.h])
15636 AC_CONFIG_HEADERS([config_host/config_cpdb.h])
15637 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15638 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15639 AC_CONFIG_HEADERS([config_host/config_eot.h])
15640 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15641 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15642 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15643 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15644 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15645 AC_CONFIG_HEADERS([config_host/config_features.h])
15646 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15647 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15648 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15649 AC_CONFIG_HEADERS([config_host/config_folders.h])
15650 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15651 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15652 AC_CONFIG_HEADERS([config_host/config_gio.h])
15653 AC_CONFIG_HEADERS([config_host/config_global.h])
15654 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15655 AC_CONFIG_HEADERS([config_host/config_java.h])
15656 AC_CONFIG_HEADERS([config_host/config_langs.h])
15657 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15658 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15659 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15660 AC_CONFIG_HEADERS([config_host/config_locales.h])
15661 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15662 AC_CONFIG_HEADERS([config_host/config_oox.h])
15663 AC_CONFIG_HEADERS([config_host/config_options.h])
15664 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15665 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15666 AC_CONFIG_HEADERS([config_host/config_skia.h])
15667 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15668 AC_CONFIG_HEADERS([config_host/config_validation.h])
15669 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15670 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15671 AC_CONFIG_HEADERS([config_host/config_version.h])
15672 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15673 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15674 AC_CONFIG_HEADERS([config_host/config_python.h])
15675 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15676 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15677 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15678 AC_OUTPUT
15680 if test "$CROSS_COMPILING" = TRUE; then
15681     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15684 # touch the config timestamp file
15685 if test ! -f config_host.mk.stamp; then
15686     echo > config_host.mk.stamp
15687 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15688     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15689 else
15690     echo > config_host.mk.stamp
15693 # touch the config lang timestamp file
15694 if test ! -f config_host_lang.mk.stamp; then
15695     echo > config_host_lang.mk.stamp
15696 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15697     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15698 else
15699     echo > config_host_lang.mk.stamp
15703 if test \( "$STALE_MAKE" = "TRUE" \) \
15704         -a "$build_os" = "cygwin"; then
15706 cat << _EOS
15707 ****************************************************************************
15708 WARNING:
15709 Your make version is known to be horribly slow, and hard to debug
15710 problems with. To get a reasonably functional make please do:
15712 to install a pre-compiled binary make for Win32
15714  mkdir -p /opt/lo/bin
15715  cd /opt/lo/bin
15716  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15717  cp make-4.2.1-msvc.exe make
15718  chmod +x make
15720 to install from source:
15721 place yourself in a working directory of you choice.
15723  git clone git://git.savannah.gnu.org/make.git
15725  [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"]
15726  set PATH=%PATH%;C:\Cygwin\bin
15727  [or Cygwin64, if that is what you have]
15728  cd path-to-make-repo-you-cloned-above
15729  build_w32.bat --without-guile
15731 should result in a WinRel/gnumake.exe.
15732 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15734 Then re-run autogen.sh
15736 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15737 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15739 _EOS
15743 cat << _EOF
15744 ****************************************************************************
15746 To show information on various make targets and make flags, run:
15747 $GNUMAKE help
15749 To just build, run:
15750 $GNUMAKE
15752 _EOF
15754 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15755     cat << _EOF
15756 After the build has finished successfully, you can immediately run what you built using the command:
15757 _EOF
15759     if test $_os = Darwin; then
15760         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15761     else
15762         echo instdir/program/soffice
15763     fi
15764     cat << _EOF
15766 If you want to run the unit tests, run:
15767 $GNUMAKE check
15769 _EOF
15772 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15773     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15774     cat "$WARNINGS_FILE_FOR_BUILD"
15775     echo
15778 if test -s "$WARNINGS_FILE"; then
15779     echo "HOST config ($WARNINGS_FILE)"
15780     cat "$WARNINGS_FILE"
15783 # Remove unneeded emconfigure artifacts
15784 rm -f a.out a.wasm a.out.js a.out.wasm
15786 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: