Branch libreoffice-24-8-3
[LibreOffice.git] / configure.ac
blob8fbfd8aa4d302f8b5306e9b09bd53965d51886bd
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],[24.8.3.0.0+],[],[],[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_cups+set}" = set || test_cups="$using_x11"
1221 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1222 test "${test_gen+set}" = set || test_gen="$using_x11"
1223 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1224 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1225 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1226 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1227 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1228 # don't handle test_qt5, so it can disable test_kf5 later
1229 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1230 test "${test_randr+set}" = set || test_randr="$using_x11"
1231 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1232 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1234 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1235 # Make sure fontconfig and freetype test both either system or not
1236 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1237 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1239 # convenience / platform overriding "fixes"
1240 # Don't sort!
1241 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1242 test "$test_kf5" = yes && test_qt5=yes
1243 test "$test_gtk3" != yes && enable_gtk3=no
1244 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1245 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1246 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1248 # Keep in sync with the above $using_x11 depending test default list
1249 disable_x11_tests()
1251     test_cups=no
1252     test_dbus=no
1253     test_gen=no
1254     test_gstreamer_1_0=no
1255     test_gtk3_kde5=no
1256     test_gtk3=no
1257     test_gtk4=no
1258     test_kf5=no
1259     test_kf6=no
1260     test_qt5=no
1261     test_qt6=no
1262     test_randr=no
1263     test_xrender=no
1266 test "$using_x11" = yes && USING_X11=TRUE
1268 if test "$using_freetype_fontconfig" = yes; then
1269     AC_DEFINE(USE_HEADLESS_CODE)
1270     USE_HEADLESS_CODE=TRUE
1271     if test "$using_headless_plugin" = yes; then
1272         AC_DEFINE(ENABLE_HEADLESS)
1273         ENABLE_HEADLESS=TRUE
1274     fi
1275 else
1276     test_fontconfig=no
1277     test_freetype=no
1280 AC_SUBST(ENABLE_HEADLESS)
1281 AC_SUBST(USE_HEADLESS_CODE)
1283 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1284 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1285 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1286 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1288 # ===================================================================
1290 # End initial platform setup
1292 # ===================================================================
1294 if test "$_os" = "Android" ; then
1295     # Verify that the NDK and SDK options are proper
1296     if test -z "$with_android_ndk"; then
1297         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1298     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1299         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1300     fi
1302     if test -z "$ANDROID_SDK_DIR"; then
1303         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1304     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1305         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1306     fi
1309 AC_SUBST(SDKDIRNAME)
1311 AC_SUBST(PTHREAD_CFLAGS)
1312 AC_SUBST(PTHREAD_LIBS)
1314 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1315 # By default use the ones specified by our build system,
1316 # but explicit override is possible.
1317 AC_MSG_CHECKING(for explicit AFLAGS)
1318 if test -n "$AFLAGS"; then
1319     AC_MSG_RESULT([$AFLAGS])
1320     x_AFLAGS=
1321 else
1322     AC_MSG_RESULT(no)
1323     x_AFLAGS=[\#]
1325 AC_MSG_CHECKING(for explicit CFLAGS)
1326 if test -n "$CFLAGS"; then
1327     AC_MSG_RESULT([$CFLAGS])
1328     x_CFLAGS=
1329 else
1330     AC_MSG_RESULT(no)
1331     x_CFLAGS=[\#]
1333 AC_MSG_CHECKING(for explicit CXXFLAGS)
1334 if test -n "$CXXFLAGS"; then
1335     AC_MSG_RESULT([$CXXFLAGS])
1336     x_CXXFLAGS=
1337 else
1338     AC_MSG_RESULT(no)
1339     x_CXXFLAGS=[\#]
1341 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1342 if test -n "$OBJCFLAGS"; then
1343     AC_MSG_RESULT([$OBJCFLAGS])
1344     x_OBJCFLAGS=
1345 else
1346     AC_MSG_RESULT(no)
1347     x_OBJCFLAGS=[\#]
1349 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1350 if test -n "$OBJCXXFLAGS"; then
1351     AC_MSG_RESULT([$OBJCXXFLAGS])
1352     x_OBJCXXFLAGS=
1353 else
1354     AC_MSG_RESULT(no)
1355     x_OBJCXXFLAGS=[\#]
1357 AC_MSG_CHECKING(for explicit LDFLAGS)
1358 if test -n "$LDFLAGS"; then
1359     AC_MSG_RESULT([$LDFLAGS])
1360     x_LDFLAGS=
1361 else
1362     AC_MSG_RESULT(no)
1363     x_LDFLAGS=[\#]
1365 AC_SUBST(AFLAGS)
1366 AC_SUBST(CFLAGS)
1367 AC_SUBST(CXXFLAGS)
1368 AC_SUBST(OBJCFLAGS)
1369 AC_SUBST(OBJCXXFLAGS)
1370 AC_SUBST(LDFLAGS)
1371 AC_SUBST(x_AFLAGS)
1372 AC_SUBST(x_CFLAGS)
1373 AC_SUBST(x_CXXFLAGS)
1374 AC_SUBST(x_OBJCFLAGS)
1375 AC_SUBST(x_OBJCXXFLAGS)
1376 AC_SUBST(x_LDFLAGS)
1378 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1379 my_original_CFLAGS=$CFLAGS
1380 my_original_CXXFLAGS=$CXXFLAGS
1381 my_original_CPPFLAGS=$CPPFLAGS
1383 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1384 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1385 dnl AC_PROG_CC internally.
1386 if test "$_os" != "WINNT"; then
1387     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CC,
1388     # Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
1389     save_CFLAGS=$CFLAGS
1390     CFLAGS=-g
1391     AC_PROG_CC
1392     CFLAGS=$save_CFLAGS
1393     if test -z "$CC_BASE"; then
1394         CC_BASE=`first_arg_basename "$CC"`
1395     fi
1398 if test "$_os" != "WINNT"; then
1399     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1400 else
1401     ENDIANNESS=little
1403 AC_SUBST(ENDIANNESS)
1405 if test "$usable_dlapi" != no; then
1406     AC_DEFINE([HAVE_DLAPI])
1407     if test "$test_unix_dlapi" != no; then
1408         save_LIBS="$LIBS"
1409         AC_SEARCH_LIBS([dlsym], [dl],
1410             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1411             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1412         LIBS="$save_LIBS"
1413         AC_DEFINE([HAVE_UNIX_DLAPI])
1414     fi
1416 AC_SUBST(UNIX_DLAPI_LIBS)
1418 # Check for a (GNU) backtrace implementation
1419 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1420 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1421 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1422     save_LIBS="$LIBS"
1423     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1424         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1425         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1426     LIBS="$save_LIBS"
1428 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1429     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1432 dnl ===================================================================
1433 dnl Sanity checks for Emscripten SDK setup
1434 dnl ===================================================================
1436 EMSCRIPTEN_MIN_MAJOR=3
1437 EMSCRIPTEN_MIN_MINOR=1
1438 EMSCRIPTEN_MIN_TINY=3
1439 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1441 if test "$_os" = "Emscripten"; then
1442     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1443     if test -z "$EMSCRIPTEN_VERSION_H"; then
1444         AS_IF([test -z "$EMSDK"],
1445               [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1446         EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1447     fi
1448     if test -f "$EMSCRIPTEN_VERSION_H"; then
1449         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1450         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1451         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1452     else
1453         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1454         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1455         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1456         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1457     fi
1459     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1461     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1462     if test $? -eq 0; then
1463         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1464     else
1465         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1466     fi
1468     EMSCRIPTEN_ERROR=0
1469     if ! command -v emconfigure >/dev/null 2>&1; then
1470         AC_MSG_WARN([emconfigure must be in your \$PATH])
1471         EMSCRIPTEN_ERROR=1
1472     fi
1473     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1474         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1475         EMSCRIPTEN_ERROR=1
1476     fi
1477     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1478     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1479         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1480         EMSCRIPTEN_ERROR=1
1481     fi
1482     if test $EMSCRIPTEN_ERROR -ne 0; then
1483         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1484     fi
1486     dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
1487     BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
1489 AC_SUBST(EMSDK_FILE_PACKAGER)
1490 AC_SUBST(EMSCRIPTEN_EXTRA_SOFFICE_POST_JS)
1492 ###############################################################################
1493 # Extensions switches --enable/--disable
1494 ###############################################################################
1495 # By default these should be enabled unless having extra dependencies.
1496 # If there is extra dependency over configure options then the enable should
1497 # be automagic based on whether the requiring feature is enabled or not.
1498 # All this options change anything only with --enable-extension-integration.
1500 # The name of this option and its help string makes it sound as if
1501 # extensions are built anyway, just not integrated in the installer,
1502 # if you use --disable-extension-integration. Is that really the
1503 # case?
1505 AC_ARG_ENABLE(ios-simulator,
1506     AS_HELP_STRING([--enable-ios-simulator],
1507         [build for iOS simulator])
1510 libo_FUZZ_ARG_ENABLE(extension-integration,
1511     AS_HELP_STRING([--disable-extension-integration],
1512         [Disable integration of the built extensions in the installer of the
1513          product. Use this switch to disable the integration.])
1516 AC_ARG_ENABLE(avmedia,
1517     AS_HELP_STRING([--disable-avmedia],
1518         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1519 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1521 AC_ARG_ENABLE(database-connectivity,
1522     AS_HELP_STRING([--disable-database-connectivity],
1523         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1526 # This doesn't mean not building (or "integrating") extensions
1527 # (although it probably should; i.e. it should imply
1528 # --disable-extension-integration I guess), it means not supporting
1529 # any extension mechanism at all
1530 libo_FUZZ_ARG_ENABLE(extensions,
1531     AS_HELP_STRING([--disable-extensions],
1532         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1535 AC_ARG_ENABLE(scripting,
1536     AS_HELP_STRING([--disable-scripting],
1537         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1538 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1540 # This is mainly for Android and iOS, but could potentially be used in some
1541 # special case otherwise, too, so factored out as a separate setting
1543 AC_ARG_ENABLE(dynamic-loading,
1544     AS_HELP_STRING([--disable-dynamic-loading],
1545         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1548 libo_FUZZ_ARG_ENABLE(report-builder,
1549     AS_HELP_STRING([--disable-report-builder],
1550         [Disable the Report Builder.])
1553 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1554     AS_HELP_STRING([--enable-ext-wiki-publisher],
1555         [Enable the Wiki Publisher extension.])
1558 libo_FUZZ_ARG_ENABLE(lpsolve,
1559     AS_HELP_STRING([--disable-lpsolve],
1560         [Disable compilation of the lp solve solver ])
1562 libo_FUZZ_ARG_ENABLE(coinmp,
1563     AS_HELP_STRING([--disable-coinmp],
1564         [Disable compilation of the CoinMP solver ])
1567 libo_FUZZ_ARG_ENABLE(pdfimport,
1568     AS_HELP_STRING([--disable-pdfimport],
1569         [Disable building the PDF import feature.])
1572 libo_FUZZ_ARG_ENABLE(pdfium,
1573     AS_HELP_STRING([--disable-pdfium],
1574         [Disable building PDFium. Results in insecure PDF signature verification.])
1577 libo_FUZZ_ARG_ENABLE(skia,
1578     AS_HELP_STRING([--disable-skia],
1579         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1582 ###############################################################################
1584 dnl ---------- *** ----------
1586 libo_FUZZ_ARG_ENABLE(mergelibs,
1587     AS_HELP_STRING([--enable-mergelibs=yes/no/more],
1588         [Merge several of the smaller libraries into one big "merged" library.
1589          The "more" option will link even more of the smaller libraries.
1590          "more" not appropriate for distros which split up LibreOffice into multiple packages.
1591          It is only appropriate for situations where all of LO is delivered in a single install/package. ])
1594 libo_FUZZ_ARG_ENABLE(breakpad,
1595     AS_HELP_STRING([--enable-breakpad],
1596         [Enables breakpad for crash reporting.])
1599 libo_FUZZ_ARG_ENABLE(crashdump,
1600     AS_HELP_STRING([--disable-crashdump],
1601         [Disable dump.ini and dump-file, when --enable-breakpad])
1604 AC_ARG_ENABLE(fetch-external,
1605     AS_HELP_STRING([--disable-fetch-external],
1606         [Disables fetching external tarballs from web sources.])
1609 AC_ARG_ENABLE(fuzzers,
1610     AS_HELP_STRING([--enable-fuzzers],
1611         [Enables building libfuzzer targets for fuzz testing.])
1614 libo_FUZZ_ARG_ENABLE(pch,
1615     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1616         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1617          Using 'system' will include only external headers, 'base' will add also headers
1618          from base modules, 'normal' will also add all headers except from the module built,
1619          'full' will use all suitable headers even from a module itself.])
1622 libo_FUZZ_ARG_ENABLE(epm,
1623     AS_HELP_STRING([--enable-epm],
1624         [LibreOffice includes self-packaging code, that requires epm, however epm is
1625          useless for large scale package building.])
1628 libo_FUZZ_ARG_ENABLE(odk,
1629     AS_HELP_STRING([--enable-odk],
1630         [Enable building the Office Development Kit, the part that extensions need to build against])
1633 AC_ARG_ENABLE(mpl-subset,
1634     AS_HELP_STRING([--enable-mpl-subset],
1635         [Don't compile any pieces which are not MPL or more liberally licensed])
1638 libo_FUZZ_ARG_ENABLE(evolution2,
1639     AS_HELP_STRING([--enable-evolution2],
1640         [Allows the built-in evolution 2 addressbook connectivity build to be
1641          enabled.])
1644 AC_ARG_ENABLE(avahi,
1645     AS_HELP_STRING([--enable-avahi],
1646         [Determines whether to use Avahi to advertise Impress to remote controls.])
1649 libo_FUZZ_ARG_ENABLE(werror,
1650     AS_HELP_STRING([--enable-werror],
1651         [Turn warnings to errors. (Has no effect in modules where the treating
1652          of warnings as errors is disabled explicitly.)]),
1655 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1656     AS_HELP_STRING([--enable-assert-always-abort],
1657         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1660 libo_FUZZ_ARG_ENABLE(dbgutil,
1661     AS_HELP_STRING([--enable-dbgutil],
1662         [Provide debugging support from --enable-debug and include additional debugging
1663          utilities such as object counting or more expensive checks.
1664          This is the recommended option for developers.
1665          Note that this makes the build ABI incompatible, it is not possible to mix object
1666          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1668 libo_FUZZ_ARG_ENABLE(debug,
1669     AS_HELP_STRING([--enable-debug],
1670         [Include debugging information, disable compiler optimization and inlining plus
1671          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1673 libo_FUZZ_ARG_ENABLE(split-debug,
1674     AS_HELP_STRING([--disable-split-debug],
1675         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1676          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1678 libo_FUZZ_ARG_ENABLE(gdb-index,
1679     AS_HELP_STRING([--disable-gdb-index],
1680         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1681          The feature requires a linker that supports the --gdb-index option.]))
1683 libo_FUZZ_ARG_ENABLE(sal-log,
1684     AS_HELP_STRING([--enable-sal-log],
1685         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1687 libo_FUZZ_ARG_ENABLE(symbols,
1688     AS_HELP_STRING([--enable-symbols],
1689         [Generate debug information.
1690          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1691          otherwise. It is possible to explicitly specify gbuild build targets
1692          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1693          everything in the directory; there is no ordering, more specific overrides
1694          more general, and disabling takes precedence).
1695          Example: --enable-symbols="all -sw/ -Library_sc".]))
1697 libo_FUZZ_ARG_ENABLE(optimized,
1698     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1699         [Whether to compile with optimization flags.
1700          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1701          otherwise. Using 'debug' will try to use only optimizations that should
1702          not interfere with debugging. For Emscripten we default to optimized (-O1)
1703          debug build, as otherwise binaries become too large.]))
1705 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1706     AS_HELP_STRING([--disable-runtime-optimizations],
1707         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1708          JVM JIT) that are known to interact badly with certain dynamic analysis
1709          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1710          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1711          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1713 AC_ARG_WITH(valgrind,
1714     AS_HELP_STRING([--with-valgrind],
1715         [Make availability of Valgrind headers a hard requirement.]))
1717 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1718     AS_HELP_STRING([--enable-compiler-plugins],
1719         [Enable compiler plugins that will perform additional checks during
1720          building. Enabled automatically by --enable-dbgutil.
1721          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1722 COMPILER_PLUGINS_DEBUG=
1723 if test "$enable_compiler_plugins" = debug; then
1724     enable_compiler_plugins=yes
1725     COMPILER_PLUGINS_DEBUG=TRUE
1728 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1729     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1730         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1731          relevant in the --disable-compiler-plugins case.]))
1733 libo_FUZZ_ARG_ENABLE(ooenv,
1734     AS_HELP_STRING([--enable-ooenv],
1735         [Enable ooenv for the instdir installation.]))
1737 AC_ARG_ENABLE(lto,
1738     AS_HELP_STRING([--enable-lto],
1739         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1740          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1741          linker.)]))
1743 AC_ARG_ENABLE(python,
1744     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1745         [Enables or disables Python support at run-time.
1746          Also specifies what Python to use at build-time.
1747          'fully-internal' even forces the internal version for uses of Python
1748          during the build.
1749          On macOS the only choices are
1750          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1751          ]))
1753 libo_FUZZ_ARG_ENABLE(gtk3,
1754     AS_HELP_STRING([--disable-gtk3],
1755         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1756 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1758 AC_ARG_ENABLE(gtk4,
1759     AS_HELP_STRING([--enable-gtk4],
1760         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1762 AC_ARG_ENABLE(atspi-tests,
1763     AS_HELP_STRING([--disable-atspi-tests],
1764         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1766 AC_ARG_ENABLE(introspection,
1767     AS_HELP_STRING([--enable-introspection],
1768         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1769          Linux distributions.)]))
1771 AC_ARG_ENABLE(split-app-modules,
1772     AS_HELP_STRING([--enable-split-app-modules],
1773         [Split file lists for app modules, e.g. base, calc.
1774          Has effect only with make distro-pack-install]),
1777 AC_ARG_ENABLE(split-opt-features,
1778     AS_HELP_STRING([--enable-split-opt-features],
1779         [Split file lists for some optional features, e.g. pyuno, testtool.
1780          Has effect only with make distro-pack-install]),
1783 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1784     AS_HELP_STRING([--disable-cairo-canvas],
1785         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1788 libo_FUZZ_ARG_ENABLE(dbus,
1789     AS_HELP_STRING([--disable-dbus],
1790         [Determines whether to enable features that depend on dbus.
1791          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1792 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1794 libo_FUZZ_ARG_ENABLE(sdremote,
1795     AS_HELP_STRING([--disable-sdremote],
1796         [Determines whether to enable Impress remote control (i.e. the server component).]),
1797 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1799 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1800     AS_HELP_STRING([--disable-sdremote-bluetooth],
1801         [Determines whether to build sdremote with bluetooth support.
1802          Requires dbus on Linux.]))
1804 libo_FUZZ_ARG_ENABLE(gio,
1805     AS_HELP_STRING([--disable-gio],
1806         [Determines whether to use the GIO support.]),
1807 ,test "${enable_gio+set}" = set || enable_gio=yes)
1809 AC_ARG_ENABLE(qt5,
1810     AS_HELP_STRING([--enable-qt5],
1811         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1812          available.]),
1815 AC_ARG_ENABLE(qt6,
1816     AS_HELP_STRING([--enable-qt6],
1817         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1818          available.]),
1821 AC_ARG_ENABLE(qt6-multimedia,
1822     AS_HELP_STRING([--disable-qt6-multimedia],
1823         [Determines whether to enable media playback using QtMultimedia when using the qt6/kf6 VCL plugins.]))
1825 AC_ARG_ENABLE(kf5,
1826     AS_HELP_STRING([--enable-kf5],
1827         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1828          KF5 are available.]),
1831 AC_ARG_ENABLE(kf6,
1832     AS_HELP_STRING([--enable-kf6],
1833         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1834          KF6 are available.]),
1838 AC_ARG_ENABLE(gtk3_kde5,
1839     AS_HELP_STRING([--enable-gtk3-kde5],
1840         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1841          platforms where Gtk3, Qt5 and Plasma is available.]),
1844 AC_ARG_ENABLE(gen,
1845     AS_HELP_STRING([--enable-gen],
1846         [To select the gen backend in case of --disable-dynamic-loading.
1847          Per default auto-enabled when X11 is used.]),
1848 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1850 AC_ARG_ENABLE(gui,
1851     AS_HELP_STRING([--disable-gui],
1852         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1853 ,enable_gui=yes)
1855 libo_FUZZ_ARG_ENABLE(randr,
1856     AS_HELP_STRING([--disable-randr],
1857         [Disable RandR support in the vcl project.]),
1858 ,test "${enable_randr+set}" = set || enable_randr=yes)
1860 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1861     AS_HELP_STRING([--disable-gstreamer-1-0],
1862         [Disable building with the gstreamer 1.0 avmedia backend.]),
1863 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1865 libo_FUZZ_ARG_ENABLE([eot],
1866     [AS_HELP_STRING([--enable-eot],
1867         [Enable support for Embedded OpenType fonts.])],
1868 ,test "${enable_eot+set}" = set || enable_eot=no)
1870 libo_FUZZ_ARG_ENABLE(cve-tests,
1871     AS_HELP_STRING([--disable-cve-tests],
1872         [Prevent CVE tests to be executed]),
1875 AC_ARG_ENABLE(build-opensymbol,
1876     AS_HELP_STRING([--enable-build-opensymbol],
1877         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1878          fontforge installed.]),
1881 AC_ARG_ENABLE(dependency-tracking,
1882     AS_HELP_STRING([--enable-dependency-tracking],
1883         [Do not reject slow dependency extractors.])[
1884   --disable-dependency-tracking
1885                           Disables generation of dependency information.
1886                           Speed up one-time builds.],
1889 AC_ARG_ENABLE(icecream,
1890     AS_HELP_STRING([--enable-icecream],
1891         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1892          It defaults to /opt/icecream for the location of the icecream gcc/g++
1893          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1896 AC_ARG_ENABLE(ld,
1897     AS_HELP_STRING([--enable-ld=<linker>],
1898         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1899          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1900          If <linker> contains any ':', the part before the first ':' is used as the value of
1901          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1902          needed for Clang 12).]),
1905 libo_FUZZ_ARG_ENABLE(cups,
1906     AS_HELP_STRING([--disable-cups],
1907         [Do not build cups support.])
1910 AC_ARG_ENABLE(ccache,
1911     AS_HELP_STRING([--disable-ccache],
1912         [Do not try to use ccache automatically.
1913          By default we will try to detect if ccache is available; in that case if
1914          CC/CXX are not yet set, and --enable-icecream is not given, we
1915          attempt to use ccache. --disable-ccache disables ccache completely.
1916          Additionally ccache's depend mode is enabled if possible,
1917          use --enable-ccache=nodepend to enable ccache without depend mode.
1921 AC_ARG_ENABLE(z7-debug,
1922     AS_HELP_STRING([--enable-z7-debug],
1923         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1924          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1925          Enabled by default if ccache is detected.]))
1927 libo_FUZZ_ARG_ENABLE(online-update,
1928     AS_HELP_STRING([--enable-online-update],
1929         [Enable the online update service that will check for new versions of
1930          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
1933 libo_FUZZ_ARG_ENABLE(online-update-mar,
1934     AS_HELP_STRING([--enable-online-update-mar],
1935         [Enable the Mozilla-like online update service that will
1936          check for new versions of LibreOffice. Currently only works for
1937          Windows and Linux. Disabled by default.]),
1940 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1941     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1942         [Set the base URL value for --enable-online-update-mar.
1943          (Can be left off for debug purposes, even if that may render the feature
1944          non-functional.)]),
1947 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1948     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1949         [Set the certificate DER value for --enable-online-update-mar.
1950          (Can be left off for debug purposes, even if that may render the feature
1951          non-functional.)]),
1954 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1955     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1956         [Set the certificate name value for --enable-online-update-mar.
1957          (Can be left off for debug purposes, even if that may render the feature
1958          non-functional.)]),
1961 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1962     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1963         [Set the certificate path value for --enable-online-update-mar.
1964          (Can be left off for debug purposes, even if that may render the feature
1965          non-functional.)]),
1968 libo_FUZZ_ARG_ENABLE(extension-update,
1969     AS_HELP_STRING([--disable-extension-update],
1970         [Disable possibility to update installed extensions.]),
1973 libo_FUZZ_ARG_ENABLE(release-build,
1974     AS_HELP_STRING([--enable-release-build],
1975         [Enable release build. Note that the "release build" choice is orthogonal to
1976          whether symbols are present, debug info is generated, or optimization
1977          is done.
1978          See https://wiki.documentfoundation.org/Development/DevBuild]),
1981 libo_FUZZ_ARG_ENABLE(hardening-flags,
1982     AS_HELP_STRING([--enable-hardening-flags],
1983         [Enable automatically using hardening compiler flags. Distros typically
1984          instead use their default configuration via CXXFLAGS, etc. But this provides a
1985          convenient set of default hardening flags for non-distros]),
1988 AC_ARG_ENABLE(windows-build-signing,
1989     AS_HELP_STRING([--enable-windows-build-signing],
1990         [Enable signing of windows binaries (*.exe, *.dll)]),
1993 AC_ARG_ENABLE(silent-msi,
1994     AS_HELP_STRING([--enable-silent-msi],
1995         [Enable MSI with LIMITUI=1 (silent install).]),
1998 AC_ARG_ENABLE(wix,
1999     AS_HELP_STRING([--enable-wix],
2000         [Build Windows installer using WiX.]),
2003 AC_ARG_ENABLE(macosx-code-signing,
2004     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
2005         [Sign executables, dylibs, frameworks and the app bundle. If you
2006          don't provide an identity the first suitable certificate
2007          in your keychain is used.]),
2010 AC_ARG_ENABLE(macosx-package-signing,
2011     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2012         [Create a .pkg suitable for uploading to the Mac App Store and sign
2013          it. If you don't provide an identity the first suitable certificate
2014          in your keychain is used.]),
2017 AC_ARG_ENABLE(macosx-sandbox,
2018     AS_HELP_STRING([--enable-macosx-sandbox],
2019         [Make the app bundle run in a sandbox. Requires code signing.
2020          Is required by apps distributed in the Mac App Store, and implies
2021          adherence to App Store rules.]),
2024 AC_ARG_WITH(macosx-bundle-identifier,
2025     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2026         [Define the macOS bundle identifier. Default is the somewhat weird
2027          org.libreoffice.script ("script", huh?).]),
2028 ,with_macosx_bundle_identifier=org.libreoffice.script)
2030 AC_ARG_WITH(macosx-provisioning-profile,
2031     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2032         [Specify the path to a provisioning profile to use]),
2035 AC_ARG_WITH(product-name,
2036     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2037         [Define the product name. Default is AC_PACKAGE_NAME.]),
2038 ,with_product_name=$PRODUCTNAME)
2040 libo_FUZZ_ARG_ENABLE(community-flavor,
2041     AS_HELP_STRING([--disable-community-flavor],
2042         [Disable the Community branding.]),
2045 AC_ARG_WITH(package-version,
2046     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2047         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2050 libo_FUZZ_ARG_ENABLE(readonly-installset,
2051     AS_HELP_STRING([--enable-readonly-installset],
2052         [Prevents any attempts by LibreOffice to write into its installation. That means
2053          at least that no "system-wide" extensions can be added. Partly experimental work in
2054          progress, probably not fully implemented. Always enabled for macOS.]),
2057 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2058     AS_HELP_STRING([--disable-mariadb-sdbc],
2059         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2062 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2063     AS_HELP_STRING([--disable-postgresql-sdbc],
2064         [Disable the build of the PostgreSQL-SDBC driver.])
2067 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2068     AS_HELP_STRING([--disable-lotuswordpro],
2069         [Disable the build of the Lotus Word Pro filter.]),
2070 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2072 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2073     AS_HELP_STRING([--disable-firebird-sdbc],
2074         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2075 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2077 AC_ARG_ENABLE(bogus-pkg-config,
2078     AS_HELP_STRING([--enable-bogus-pkg-config],
2079         [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.]),
2082 AC_ARG_ENABLE(openssl,
2083     AS_HELP_STRING([--disable-openssl],
2084         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2085          components will use NSS. Work in progress,
2086          use only if you are hacking on it.]),
2087 ,enable_openssl=yes)
2089 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2090     AS_HELP_STRING([--enable-cipher-openssl-backend],
2091         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2092          Requires --enable-openssl.]))
2094 AC_ARG_ENABLE(nss,
2095     AS_HELP_STRING([--disable-nss],
2096         [Disable using NSS. If disabled,
2097          components will use openssl. Work in progress,
2098          use only if you are hacking on it.]),
2099 ,enable_nss=yes)
2101 AC_ARG_ENABLE(library-bin-tar,
2102     AS_HELP_STRING([--enable-library-bin-tar],
2103         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2104         Some libraries can save their build result in a tarball
2105         stored in TARFILE_LOCATION. That binary tarball is
2106         uniquely identified by the source tarball,
2107         the content of the config_host.mk file and the content
2108         of the top-level directory in core for that library
2109         If this option is enabled, then if such a tarfile exist, it will be untarred
2110         instead of the source tarfile, and the build step will be skipped for that
2111         library.
2112         If a proper tarfile does not exist, then the normal source-based
2113         build is done for that library and a proper binary tarfile is created
2114         for the next time.]),
2117 AC_ARG_ENABLE(dconf,
2118     AS_HELP_STRING([--disable-dconf],
2119         [Disable the dconf configuration backend (enabled by default where
2120          available).]))
2122 libo_FUZZ_ARG_ENABLE(formula-logger,
2123     AS_HELP_STRING(
2124         [--enable-formula-logger],
2125         [Enable formula logger for logging formula calculation flow in Calc.]
2126     )
2129 AC_ARG_ENABLE(ldap,
2130     AS_HELP_STRING([--disable-ldap],
2131         [Disable LDAP support.]),
2132 ,enable_ldap=yes)
2134 AC_ARG_ENABLE(opencl,
2135     AS_HELP_STRING([--disable-opencl],
2136         [Disable OpenCL support.]),
2137 ,enable_opencl=yes)
2139 libo_FUZZ_ARG_ENABLE(librelogo,
2140     AS_HELP_STRING([--disable-librelogo],
2141         [Do not build LibreLogo.]),
2142 ,enable_librelogo=yes)
2144 AC_ARG_ENABLE(wasm-strip,
2145     AS_HELP_STRING([--enable-wasm-strip],
2146         [Strip the static build like for WASM/emscripten platform.]),
2149 AC_ARG_WITH(main-module,
2150     AS_HELP_STRING([--with-main-module=<writer/calc>],
2151         [Specify which main module to build for wasm.
2152         Default value is 'writer'.]),
2155 AC_ARG_ENABLE(xmlhelp,
2156     AS_HELP_STRING([--disable-xmlhelp],
2157         [Disable XML help support]),
2158 ,enable_xmlhelp=yes)
2160 AC_ARG_ENABLE(customtarget-components,
2161     AS_HELP_STRING([--enable-customtarget-components],
2162         [Generates the static UNO object constructor mapping from the build.]))
2164 dnl ===================================================================
2165 dnl Optional Packages (--with/without-)
2166 dnl ===================================================================
2168 AC_ARG_WITH(gcc-home,
2169     AS_HELP_STRING([--with-gcc-home],
2170         [Specify the location of gcc/g++ manually. This can be used in conjunction
2171          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2172          non-default path.]),
2175 AC_ARG_WITH(gnu-patch,
2176     AS_HELP_STRING([--with-gnu-patch],
2177         [Specify location of GNU patch on Solaris or FreeBSD.]),
2180 AC_ARG_WITH(build-platform-configure-options,
2181     AS_HELP_STRING([--with-build-platform-configure-options],
2182         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2185 AC_ARG_WITH(gnu-cp,
2186     AS_HELP_STRING([--with-gnu-cp],
2187         [Specify location of GNU cp on Solaris or FreeBSD.]),
2190 AC_ARG_WITH(external-tar,
2191     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2192         [Specify an absolute path of where to find (and store) tarfiles.]),
2193     TARFILE_LOCATION=$withval ,
2196 AC_ARG_WITH(referenced-git,
2197     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2198         [Specify another checkout directory to reference. This makes use of
2199                  git submodule update --reference, and saves a lot of diskspace
2200                  when having multiple trees side-by-side.]),
2201     GIT_REFERENCE_SRC=$withval ,
2204 AC_ARG_WITH(linked-git,
2205     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2206         [Specify a directory where the repositories of submodules are located.
2207          This uses a method similar to git-new-workdir to get submodules.]),
2208     GIT_LINK_SRC=$withval ,
2211 AC_ARG_WITH(galleries,
2212     AS_HELP_STRING([--with-galleries],
2213         [Specify how galleries should be built. It is possible either to
2214          build these internally from source ("build"),
2215          or to disable them ("no")]),
2218 AC_ARG_WITH(templates,
2219     AS_HELP_STRING([--with-templates],
2220         [Specify we build with or without template files. It is possible either to
2221          build with templates ("yes"),
2222          or to disable them ("no")]),
2225 AC_ARG_WITH(theme,
2226     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2227         [Choose which themes to include. By default those themes with an '*' are included.
2228          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2229          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2230          *elementary, *elementary_svg,
2231          *karasa_jaga, *karasa_jaga_svg,
2232          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2233          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2236 libo_FUZZ_ARG_WITH(helppack-integration,
2237     AS_HELP_STRING([--without-helppack-integration],
2238         [It will not integrate the helppacks to the installer
2239          of the product. Please use this switch to use the online help
2240          or separate help packages.]),
2243 libo_FUZZ_ARG_WITH(fonts,
2244     AS_HELP_STRING([--without-fonts],
2245         [LibreOffice includes some third-party fonts to provide a reliable basis for
2246          help content, templates, samples, etc. When these fonts are already
2247          known to be available on the system then you should use this option.]),
2250 AC_ARG_WITH(epm,
2251     AS_HELP_STRING([--with-epm],
2252         [Decides which epm to use. Default is to use the one from the system if
2253          one is built. When either this is not there or you say =internal epm
2254          will be built.]),
2257 AC_ARG_WITH(package-format,
2258     AS_HELP_STRING([--with-package-format],
2259         [Specify package format(s) for LibreOffice installation sets. The
2260          implicit --without-package-format leads to no installation sets being
2261          generated. Possible values: archive, bsd, deb, dmg,
2262          installed, msi, pkg, and rpm.
2263          Example: --with-package-format='deb rpm']),
2266 AC_ARG_WITH(tls,
2267     AS_HELP_STRING([--with-tls],
2268         [Decides which TLS/SSL and cryptographic implementations to use for
2269          LibreOffice's code. Default is to use NSS although OpenSSL is also
2270          possible. Notice that selecting NSS restricts the usage of OpenSSL
2271          in LO's code but selecting OpenSSL doesn't restrict by now the
2272          usage of NSS in LO's code. Possible values: openssl, nss.
2273          Example: --with-tls="nss"]),
2276 AC_ARG_WITH(system-libs,
2277     AS_HELP_STRING([--with-system-libs],
2278         [Use libraries already on system -- enables all --with-system-* flags.]),
2281 AC_ARG_WITH(system-bzip2,
2282     AS_HELP_STRING([--with-system-bzip2],
2283         [Use bzip2 already on system. Used when --enable-online-update-mar
2284         or --enable-python=internal]),,
2285     [with_system_bzip2="$with_system_libs"])
2287 AC_ARG_WITH(system-headers,
2288     AS_HELP_STRING([--with-system-headers],
2289         [Use headers already on system -- enables all --with-system-* flags for
2290          external packages whose headers are the only entities used i.e.
2291          boost/odbc/sane-header(s).]),,
2292     [with_system_headers="$with_system_libs"])
2294 AC_ARG_WITH(system-jars,
2295     AS_HELP_STRING([--without-system-jars],
2296         [When building with --with-system-libs, also the needed jars are expected
2297          on the system. Use this to disable that]),,
2298     [with_system_jars="$with_system_libs"])
2300 AC_ARG_WITH(system-cairo,
2301     AS_HELP_STRING([--with-system-cairo],
2302         [Use cairo libraries already on system.  Happens automatically for
2303          (implicit) --enable-gtk3.]))
2305 AC_ARG_WITH(system-epoxy,
2306     AS_HELP_STRING([--with-system-epoxy],
2307         [Use epoxy libraries already on system.  Happens automatically for
2308          (implicit) --enable-gtk3.]),,
2309        [with_system_epoxy="$with_system_libs"])
2311 AC_ARG_WITH(myspell-dicts,
2312     AS_HELP_STRING([--with-myspell-dicts],
2313         [Adds myspell dictionaries to the LibreOffice installation set]),
2316 AC_ARG_WITH(system-dicts,
2317     AS_HELP_STRING([--without-system-dicts],
2318         [Do not use dictionaries from system paths.]),
2321 AC_ARG_WITH(external-dict-dir,
2322     AS_HELP_STRING([--with-external-dict-dir],
2323         [Specify external dictionary dir.]),
2326 AC_ARG_WITH(external-hyph-dir,
2327     AS_HELP_STRING([--with-external-hyph-dir],
2328         [Specify external hyphenation pattern dir.]),
2331 AC_ARG_WITH(external-thes-dir,
2332     AS_HELP_STRING([--with-external-thes-dir],
2333         [Specify external thesaurus dir.]),
2336 AC_ARG_WITH(system-zlib,
2337     AS_HELP_STRING([--with-system-zlib],
2338         [Use zlib already on system.]),,
2339     [with_system_zlib=auto])
2341 AC_ARG_WITH(system-jpeg,
2342     AS_HELP_STRING([--with-system-jpeg],
2343         [Use jpeg already on system.]),,
2344     [with_system_jpeg="$with_system_libs"])
2346 AC_ARG_WITH(system-expat,
2347     AS_HELP_STRING([--with-system-expat],
2348         [Use expat already on system.]),,
2349     [with_system_expat="$with_system_libs"])
2351 AC_ARG_WITH(system-libxml,
2352     AS_HELP_STRING([--with-system-libxml],
2353         [Use libxml/libxslt already on system.]),,
2354     [with_system_libxml=auto])
2356 AC_ARG_WITH(system-openldap,
2357     AS_HELP_STRING([--with-system-openldap],
2358         [Use the OpenLDAP LDAP SDK already on system.]),,
2359     [with_system_openldap="$with_system_libs"])
2361 libo_FUZZ_ARG_ENABLE(poppler,
2362     AS_HELP_STRING([--disable-poppler],
2363         [Disable building Poppler.])
2366 AC_ARG_WITH(system-poppler,
2367     AS_HELP_STRING([--with-system-poppler],
2368         [Use system poppler (only needed for PDF import).]),,
2369     [with_system_poppler="$with_system_libs"])
2371 AC_ARG_WITH(system-abseil,
2372     AS_HELP_STRING([--with-system-abseil],
2373         [Use the abseil libraries already on system.]),,
2374     [with_system_abseil="$with_system_libs"])
2376 AC_ARG_WITH(system-openjpeg,
2377     AS_HELP_STRING([--with-system-openjpeg],
2378         [Use the OpenJPEG library already on system.]),,
2379     [with_system_openjpeg="$with_system_libs"])
2381 libo_FUZZ_ARG_ENABLE(gpgmepp,
2382     AS_HELP_STRING([--disable-gpgmepp],
2383         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2386 AC_ARG_WITH(system-gpgmepp,
2387     AS_HELP_STRING([--with-system-gpgmepp],
2388         [Use gpgmepp already on system]),,
2389     [with_system_gpgmepp="$with_system_libs"])
2391 AC_ARG_WITH(system-mariadb,
2392     AS_HELP_STRING([--with-system-mariadb],
2393         [Use MariaDB/MySQL libraries already on system.]),,
2394     [with_system_mariadb="$with_system_libs"])
2396 AC_ARG_ENABLE(bundle-mariadb,
2397     AS_HELP_STRING([--enable-bundle-mariadb],
2398         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2401 AC_ARG_WITH(system-postgresql,
2402     AS_HELP_STRING([--with-system-postgresql],
2403         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2404          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2405     [with_system_postgresql="$with_system_libs"])
2407 AC_ARG_WITH(libpq-path,
2408     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2409         [Use this PostgreSQL C interface (libpq) installation for building
2410          the PostgreSQL-SDBC extension.]),
2413 AC_ARG_WITH(system-firebird,
2414     AS_HELP_STRING([--with-system-firebird],
2415         [Use Firebird libraries already on system, for building the Firebird-SDBC
2416          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2417     [with_system_firebird="$with_system_libs"])
2419 AC_ARG_WITH(system-libtommath,
2420             AS_HELP_STRING([--with-system-libtommath],
2421                            [Use libtommath already on system]),,
2422             [with_system_libtommath="$with_system_libs"])
2424 AC_ARG_WITH(system-hsqldb,
2425     AS_HELP_STRING([--with-system-hsqldb],
2426         [Use hsqldb already on system.]))
2428 AC_ARG_WITH(hsqldb-jar,
2429     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2430         [Specify path to jarfile manually.]),
2431     HSQLDB_JAR=$withval)
2433 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2434     AS_HELP_STRING([--disable-scripting-beanshell],
2435         [Disable support for scripts in BeanShell.]),
2439 AC_ARG_WITH(system-beanshell,
2440     AS_HELP_STRING([--with-system-beanshell],
2441         [Use beanshell already on system.]),,
2442     [with_system_beanshell="$with_system_jars"])
2444 AC_ARG_WITH(beanshell-jar,
2445     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2446         [Specify path to jarfile manually.]),
2447     BSH_JAR=$withval)
2449 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2450     AS_HELP_STRING([--disable-scripting-javascript],
2451         [Disable support for scripts in JavaScript.]),
2455 AC_ARG_WITH(system-rhino,
2456     AS_HELP_STRING([--with-system-rhino],
2457         [Use rhino already on system.]),,
2458     [with_system_rhino="$with_system_jars"])
2460 AC_ARG_WITH(rhino-jar,
2461     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2462         [Specify path to jarfile manually.]),
2463     RHINO_JAR=$withval)
2465 AC_ARG_WITH(system-jfreereport,
2466     AS_HELP_STRING([--with-system-jfreereport],
2467         [Use JFreeReport already on system.]),,
2468     [with_system_jfreereport="$with_system_jars"])
2470 AC_ARG_WITH(sac-jar,
2471     AS_HELP_STRING([--with-sac-jar=JARFILE],
2472         [Specify path to jarfile manually.]),
2473     SAC_JAR=$withval)
2475 AC_ARG_WITH(libxml-jar,
2476     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2477         [Specify path to jarfile manually.]),
2478     LIBXML_JAR=$withval)
2480 AC_ARG_WITH(flute-jar,
2481     AS_HELP_STRING([--with-flute-jar=JARFILE],
2482         [Specify path to jarfile manually.]),
2483     FLUTE_JAR=$withval)
2485 AC_ARG_WITH(jfreereport-jar,
2486     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2487         [Specify path to jarfile manually.]),
2488     JFREEREPORT_JAR=$withval)
2490 AC_ARG_WITH(liblayout-jar,
2491     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2492         [Specify path to jarfile manually.]),
2493     LIBLAYOUT_JAR=$withval)
2495 AC_ARG_WITH(libloader-jar,
2496     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2497         [Specify path to jarfile manually.]),
2498     LIBLOADER_JAR=$withval)
2500 AC_ARG_WITH(libformula-jar,
2501     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2502         [Specify path to jarfile manually.]),
2503     LIBFORMULA_JAR=$withval)
2505 AC_ARG_WITH(librepository-jar,
2506     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2507         [Specify path to jarfile manually.]),
2508     LIBREPOSITORY_JAR=$withval)
2510 AC_ARG_WITH(libfonts-jar,
2511     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2512         [Specify path to jarfile manually.]),
2513     LIBFONTS_JAR=$withval)
2515 AC_ARG_WITH(libserializer-jar,
2516     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2517         [Specify path to jarfile manually.]),
2518     LIBSERIALIZER_JAR=$withval)
2520 AC_ARG_WITH(libbase-jar,
2521     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2522         [Specify path to jarfile manually.]),
2523     LIBBASE_JAR=$withval)
2525 AC_ARG_WITH(system-odbc,
2526     AS_HELP_STRING([--with-system-odbc],
2527         [Use the odbc headers already on system.]),,
2528     [with_system_odbc="auto"])
2530 AC_ARG_WITH(system-sane,
2531     AS_HELP_STRING([--with-system-sane],
2532         [Use sane.h already on system.]),,
2533     [with_system_sane="$with_system_headers"])
2535 AC_ARG_WITH(system-bluez,
2536     AS_HELP_STRING([--with-system-bluez],
2537         [Use bluetooth.h already on system.]),,
2538     [with_system_bluez="$with_system_headers"])
2540 AC_ARG_WITH(system-boost,
2541     AS_HELP_STRING([--with-system-boost],
2542         [Use boost already on system.]),,
2543     [with_system_boost="$with_system_headers"])
2545 AC_ARG_WITH(system-dragonbox,
2546     AS_HELP_STRING([--with-system-dragonbox],
2547         [Use dragonbox already on system.]),,
2548     [with_system_dragonbox="$with_system_headers"])
2550 AC_ARG_WITH(system-frozen,
2551     AS_HELP_STRING([--with-system-frozen],
2552         [Use frozen already on system.]),,
2553     [with_system_frozen="$with_system_headers"])
2555 AC_ARG_WITH(system-libfixmath,
2556     AS_HELP_STRING([--with-system-libfixmath],
2557         [Use libfixmath already on system.]),,
2558     [with_system_libfixmath="$with_system_libs"])
2560 AC_ARG_WITH(system-glm,
2561     AS_HELP_STRING([--with-system-glm],
2562         [Use glm already on system.]),,
2563     [with_system_glm="$with_system_headers"])
2565 AC_ARG_WITH(system-hunspell,
2566     AS_HELP_STRING([--with-system-hunspell],
2567         [Use libhunspell already on system.]),,
2568     [with_system_hunspell="$with_system_libs"])
2570 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2571     AS_HELP_STRING([--enable-cairo-rgba],
2572         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2574 libo_FUZZ_ARG_ENABLE(zxing,
2575     AS_HELP_STRING([--disable-zxing],
2576        [Disable use of zxing external library.]))
2578 AC_ARG_WITH(system-zxing,
2579     AS_HELP_STRING([--with-system-zxing],
2580         [Use libzxing already on system.]),,
2581     [with_system_zxing="$with_system_libs"])
2583 AC_ARG_WITH(system-zxcvbn,
2584     AS_HELP_STRING([--with-system-zxcvbn],
2585         [Use libzxcvbn already on system.]),,
2586     [with_system_zxcvbn="$with_system_libs"])
2588 AC_ARG_WITH(system-box2d,
2589     AS_HELP_STRING([--with-system-box2d],
2590         [Use box2d already on system.]),,
2591     [with_system_box2d="$with_system_libs"])
2593 AC_ARG_WITH(system-mythes,
2594     AS_HELP_STRING([--with-system-mythes],
2595         [Use mythes already on system.]),,
2596     [with_system_mythes="$with_system_libs"])
2598 AC_ARG_WITH(system-altlinuxhyph,
2599     AS_HELP_STRING([--with-system-altlinuxhyph],
2600         [Use ALTLinuxhyph already on system.]),,
2601     [with_system_altlinuxhyph="$with_system_libs"])
2603 AC_ARG_WITH(system-lpsolve,
2604     AS_HELP_STRING([--with-system-lpsolve],
2605         [Use lpsolve already on system.]),,
2606     [with_system_lpsolve="$with_system_libs"])
2608 AC_ARG_WITH(system-coinmp,
2609     AS_HELP_STRING([--with-system-coinmp],
2610         [Use CoinMP already on system.]),,
2611     [with_system_coinmp="$with_system_libs"])
2613 AC_ARG_WITH(system-liblangtag,
2614     AS_HELP_STRING([--with-system-liblangtag],
2615         [Use liblangtag library already on system.]),,
2616     [with_system_liblangtag="$with_system_libs"])
2618 AC_ARG_WITH(system-lockfile,
2619     AS_HELP_STRING([--with-system-lockfile[=file]],
2620         [Detect a system lockfile program or use the \$file argument.]))
2622 AC_ARG_WITH(webdav,
2623     AS_HELP_STRING([--without-webdav],
2624         [Disable WebDAV support in the UCB.]))
2626 AC_ARG_WITH(linker-hash-style,
2627     AS_HELP_STRING([--with-linker-hash-style],
2628         [Use linker with --hash-style=<style> when linking shared objects.
2629          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2630          if supported on the build system, and "sysv" otherwise.]))
2632 AC_ARG_WITH(jdk-home,
2633     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2634         [If you have installed JDK 8 or later on your system please supply the
2635          path here. Note that this is not the location of the java command but the
2636          location of the entire distribution. In case of cross-compiling, this
2637          is the JDK of the host os. Use --with-build-platform-configure-options
2638          to point to a different build platform JDK.]),
2641 AC_ARG_WITH(help,
2642     AS_HELP_STRING([--with-help],
2643         [Enable the build of help. There is a special parameter "common" that
2644          can be used to bundle only the common part, .e.g help-specific icons.
2645          This is useful when you build the helpcontent separately.])
2646     [
2647                           Usage:     --with-help    build the old local help
2648                                  --without-help     no local help (default)
2649                                  --with-help=html   build the new HTML local help
2650                                  --with-help=online build the new HTML online help
2651     ],
2654 AC_ARG_WITH(omindex,
2655    AS_HELP_STRING([--with-omindex],
2656         [Enable the support of xapian-omega index for online help.])
2657    [
2658                          Usage: --with-omindex=server prepare the pages for omindex
2659                                 but let xapian-omega be built in server.
2660                                 --with-omindex=noxap do not prepare online pages
2661                                 for xapian-omega
2662   ],
2665 libo_FUZZ_ARG_WITH(java,
2666     AS_HELP_STRING([--with-java=<java command>],
2667         [Specify the name of the Java interpreter command. Typically "java"
2668          which is the default.
2670          To build without support for Java components, applets, accessibility
2671          or the XML filters written in Java, use --without-java or --with-java=no.]),
2672     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2673     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2676 AC_ARG_WITH(jvm-path,
2677     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2678         [Use a specific JVM search path at runtime.
2679          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2682 AC_ARG_WITH(ant-home,
2683     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2684         [If you have installed Apache Ant on your system, please supply the path here.
2685          Note that this is not the location of the Ant binary but the location
2686          of the entire distribution.]),
2689 AC_ARG_WITH(symbol-config,
2690     AS_HELP_STRING([--with-symbol-config],
2691         [Configuration for the crashreport symbol upload]),
2692         [],
2693         [with_symbol_config=no])
2695 AC_ARG_WITH(export-validation,
2696     AS_HELP_STRING([--without-export-validation],
2697         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2698 ,with_export_validation=auto)
2700 AC_ARG_WITH(bffvalidator,
2701     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2702         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2703          Requires installed Microsoft Office Binary File Format Validator.
2704          Note: export-validation (--with-export-validation) is required to be turned on.
2705          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2706 ,with_bffvalidator=no)
2708 libo_FUZZ_ARG_WITH(junit,
2709     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2710         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2711          --without-junit disables those tests. Not relevant in the --without-java case.]),
2712 ,with_junit=yes)
2714 AC_ARG_WITH(hamcrest,
2715     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2716         [Specifies the hamcrest jar file to use for JUnit-based tests.
2717          --without-junit disables those tests. Not relevant in the --without-java case.]),
2718 ,with_hamcrest=yes)
2720 AC_ARG_WITH(perl-home,
2721     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2722         [If you have installed Perl 5 Distribution, on your system, please
2723          supply the path here. Note that this is not the location of the Perl
2724          binary but the location of the entire distribution.]),
2727 libo_FUZZ_ARG_WITH(doxygen,
2728     AS_HELP_STRING(
2729         [--with-doxygen=<absolute path to doxygen executable>],
2730         [Specifies the doxygen executable to use when generating ODK C/C++
2731          documentation. --without-doxygen disables generation of ODK C/C++
2732          documentation. Not relevant in the --disable-odk case.]),
2733 ,with_doxygen=yes)
2735 AC_ARG_WITH(visual-studio,
2736     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2737         [Specify which Visual Studio version to use in case several are
2738          installed. Currently 2019 (default) and 2022 are supported.]),
2741 AC_ARG_WITH(windows-sdk,
2742     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2743         [Specify which Windows SDK, or "Windows Kit", version to use
2744          in case the one that came with the selected Visual Studio
2745          is not what you want for some reason. Note that not all compiler/SDK
2746          combinations are supported. The intent is that this option should not
2747          be needed.]),
2750 AC_ARG_WITH(lang,
2751     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2752         [Use this option to build LibreOffice with additional UI language support.
2753          English (US) is always included by default.
2754          Separate multiple languages with space.
2755          For all languages, use --with-lang=ALL.]),
2758 AC_ARG_WITH(locales,
2759     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2760         [Use this option to limit the locale information built in.
2761          Separate multiple locales with space.
2762          Very experimental and might well break stuff.
2763          Just a desperate measure to shrink code and data size.
2764          By default all the locales available is included.
2765          Just works with --disable-dynloading. Defaults to "ALL".
2766          This option is completely unrelated to --with-lang.])
2767     [
2768                           Affects also our character encoding conversion
2769                           tables for encodings mainly targeted for a
2770                           particular locale, like EUC-CN and EUC-TW for
2771                           zh, ISO-2022-JP for ja.
2773                           Affects also our add-on break iterator data for
2774                           some languages.
2776                           For the default, all locales, don't use this switch at all.
2777                           Specifying just the language part of a locale means all matching
2778                           locales will be included.
2779     ],
2782 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2783 # and also by Mariadb/Mysql and libcurl since LibO 24.8
2784 libo_FUZZ_ARG_WITH(krb5,
2785     AS_HELP_STRING([--with-krb5],
2786         [Enable MIT Kerberos 5 support in modules that support it.
2787          By default automatically enabled on platforms
2788          where a good system Kerberos 5 is available.]),
2791 libo_FUZZ_ARG_WITH(gssapi,
2792     AS_HELP_STRING([--with-gssapi],
2793         [Enable GSSAPI support in modules that support it.
2794          By default automatically enabled on platforms
2795          where a good system GSSAPI is available.]),
2798 libo_FUZZ_ARG_WITH(lxml,
2799     AS_HELP_STRING([--without-lxml],
2800         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2801          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2802          report widget classes and ids.]),
2805 libo_FUZZ_ARG_WITH(latest-c++,
2806     AS_HELP_STRING([--with-latest-c++],
2807         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2808          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2809         [with_latest_c__=no])
2811 AC_ARG_WITH(gtk3-build,
2812     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2813         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2814          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2816 AC_ARG_WITH(keep-awake,
2817     AS_HELP_STRING([--with-keep-awake],
2818         [command to prefix make with in order to prevent the system from going to sleep/suspend
2819          while building.
2820          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2821          and caffeinate on macOS]))
2823 dnl ===================================================================
2824 dnl Branding
2825 dnl ===================================================================
2827 AC_ARG_WITH(branding,
2828     AS_HELP_STRING([--with-branding=/path/to/images],
2829         [Use given path to retrieve branding images set.])
2830     [
2831                           Search for intro.png about.svg and logo.svg.
2832                           If any is missing, default ones will be used instead.
2834                           Search also progress.conf for progress
2835                           settings on intro screen :
2837                           PROGRESSBARCOLOR="255,255,255" Set color of
2838                           progress bar. Comma separated RGB decimal values.
2839                           PROGRESSSIZE="407,6" Set size of progress bar.
2840                           Comma separated decimal values (width, height).
2841                           PROGRESSPOSITION="61,317" Set position of progress
2842                           bar from left,top. Comma separated decimal values.
2843                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2844                           bar frame. Comma separated RGB decimal values.
2845                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2846                           bar text. Comma separated RGB decimal values.
2847                           PROGRESSTEXTBASELINE="287" Set vertical position of
2848                           progress bar text from top. Decimal value.
2850                           Default values will be used if not found.
2851     ],
2855 AC_ARG_WITH(extra-buildid,
2856     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2857         [Show addition build identification in about dialog.]),
2861 AC_ARG_WITH(vendor,
2862     AS_HELP_STRING([--with-vendor="John the Builder"],
2863         [Set vendor of the build.]),
2866 AC_ARG_WITH(privacy-policy-url,
2867     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2868         [The URL to your privacy policy (needed when
2869          enabling online-update or crashreporting via breakpad)]),
2870         [if test "x$with_privacy_policy_url" = "xyes"; then
2871             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2872          elif test "x$with_privacy_policy_url" = "xno"; then
2873             with_privacy_policy_url="undefined"
2874          fi]
2875 ,[with_privacy_policy_url="undefined"])
2877 AC_ARG_WITH(android-package-name,
2878     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2879         [Set Android package name of the build.]),
2882 AC_ARG_WITH(compat-oowrappers,
2883     AS_HELP_STRING([--with-compat-oowrappers],
2884         [Install oo* wrappers in parallel with
2885          lo* ones to keep backward compatibility.
2886          Has effect only with make distro-pack-install]),
2889 AC_ARG_WITH(os-version,
2890     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2891         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2894 AC_ARG_WITH(parallelism,
2895     AS_HELP_STRING([--with-parallelism],
2896         [Number of jobs to run simultaneously during build. Parallel builds can
2897         save a lot of time on multi-cpu machines. Defaults to the number of
2898         CPUs on the machine, unless you configure --enable-icecream - then to
2899         40.]),
2902 AC_ARG_WITH(all-tarballs,
2903     AS_HELP_STRING([--with-all-tarballs],
2904         [Download all external tarballs unconditionally]))
2906 AC_ARG_WITH(gdrive-client-id,
2907     AS_HELP_STRING([--with-gdrive-client-id],
2908         [Provides the client id of the application for OAuth2 authentication
2909         on Google Drive. If either this or --with-gdrive-client-secret is
2910         empty, the feature will be disabled]),
2913 AC_ARG_WITH(gdrive-client-secret,
2914     AS_HELP_STRING([--with-gdrive-client-secret],
2915         [Provides the client secret of the application for OAuth2
2916         authentication on Google Drive. If either this or
2917         --with-gdrive-client-id is empty, the feature will be disabled]),
2920 AC_ARG_WITH(alfresco-cloud-client-id,
2921     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2922         [Provides the client id of the application for OAuth2 authentication
2923         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2924         empty, the feature will be disabled]),
2927 AC_ARG_WITH(alfresco-cloud-client-secret,
2928     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2929         [Provides the client secret of the application for OAuth2
2930         authentication on Alfresco Cloud. If either this or
2931         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2934 AC_ARG_WITH(onedrive-client-id,
2935     AS_HELP_STRING([--with-onedrive-client-id],
2936         [Provides the client id of the application for OAuth2 authentication
2937         on OneDrive. If either this or --with-onedrive-client-secret is
2938         empty, the feature will be disabled]),
2941 AC_ARG_WITH(onedrive-client-secret,
2942     AS_HELP_STRING([--with-onedrive-client-secret],
2943         [Provides the client secret of the application for OAuth2
2944         authentication on OneDrive. If either this or
2945         --with-onedrive-client-id is empty, the feature will be disabled]),
2948 dnl Check for coredumpctl support to present information about crashing test processes:
2949 AC_ARG_WITH(coredumpctl,
2950     AS_HELP_STRING([--with-coredumpctl],
2951         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2952         processes.]))
2954 AC_ARG_WITH(buildconfig-recorded,
2955     AS_HELP_STRING([--with-buildconfig-recorded],
2956         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2959 AC_MSG_CHECKING([whether to record build config])
2960 if test -z "$with_buildconfig_recorded"; then
2961     with_buildconfig_recorded=no
2963 if test "$with_buildconfig_recorded" = no; then
2964     AC_MSG_RESULT([no])
2965 else
2966     AC_MSG_RESULT([yes])
2967     # replace backslashes, to get a valid c++ string
2968     config_args=$(echo $ac_configure_args | tr '\\' '/')
2969     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2970     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2973 dnl ===================================================================
2974 dnl Do we want to use pre-build binary tarball for recompile
2975 dnl ===================================================================
2977 if test "$enable_library_bin_tar" = "yes" ; then
2978     USE_LIBRARY_BIN_TAR=TRUE
2979 else
2980     USE_LIBRARY_BIN_TAR=
2982 AC_SUBST(USE_LIBRARY_BIN_TAR)
2984 dnl ===================================================================
2985 dnl Test whether build target is Release Build
2986 dnl ===================================================================
2987 AC_MSG_CHECKING([whether build target is Release Build])
2988 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2989     AC_MSG_RESULT([no])
2990     ENABLE_RELEASE_BUILD=
2991     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2992     dnl the newlines and then complains about spaces.
2993     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/>'
2994 else
2995     AC_MSG_RESULT([yes])
2996     ENABLE_RELEASE_BUILD=TRUE
2997     GET_TASK_ALLOW_ENTITLEMENT=
2999 AC_SUBST(ENABLE_RELEASE_BUILD)
3000 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
3002 dnl ===================================================================
3003 dnl Test whether build should auto use hardening compiler flags
3004 dnl ===================================================================
3005 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3006 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3007     AC_MSG_RESULT([no])
3008     ENABLE_HARDENING_FLAGS=
3009 else
3010     AC_MSG_RESULT([yes])
3011     ENABLE_HARDENING_FLAGS=TRUE
3013 AC_SUBST(ENABLE_HARDENING_FLAGS)
3015 AC_MSG_CHECKING([whether to build a Community flavor])
3016 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3017     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3018     AC_MSG_RESULT([yes])
3019 else
3020     AC_MSG_RESULT([no])
3023 dnl ===================================================================
3024 dnl Test whether to sign Windows Build
3025 dnl ===================================================================
3026 AC_MSG_CHECKING([whether to sign windows build])
3027 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3028     AC_MSG_RESULT([yes])
3029     WINDOWS_BUILD_SIGNING="TRUE"
3030 else
3031     AC_MSG_RESULT([no])
3032     WINDOWS_BUILD_SIGNING="FALSE"
3034 AC_SUBST(WINDOWS_BUILD_SIGNING)
3036 dnl ===================================================================
3037 dnl MacOSX build and runtime environment options
3038 dnl ===================================================================
3040 AC_ARG_WITH(macosx-version-min-required,
3041     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3042         [set the minimum OS version needed to run the built LibreOffice])
3043     [
3044                           e. g.: --with-macosx-version-min-required=10.15
3045     ],
3048 dnl ===================================================================
3049 dnl Check for incompatible options set by fuzzing, and reset those
3050 dnl automatically to working combinations
3051 dnl ===================================================================
3053 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3054         "$enable_dbus" != "$enable_avahi"; then
3055     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3056     enable_avahi=$enable_dbus
3059 add_lopath_after ()
3061     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3062         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3063     fi
3066 add_lopath_before ()
3068     local IFS=${P_SEP}
3069     local path_cleanup
3070     local dir
3071     for dir in $LO_PATH ; do
3072         if test "$dir" != "$1" ; then
3073             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3074         fi
3075     done
3076     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3079 dnl ===================================================================
3080 dnl check for required programs (grep, awk, sed, bash)
3081 dnl ===================================================================
3083 pathmunge ()
3085     local new_path
3086     if test -n "$1"; then
3087         if test "$build_os" = "cygwin"; then
3088             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3089                 PathFormat "$1"
3090                 new_path=`cygpath -sm "$formatted_path"`
3091             else
3092                 PathFormat "$1"
3093                 new_path=`cygpath -u "$formatted_path"`
3094             fi
3095         else
3096             new_path="$1"
3097         fi
3098         if test "$2" = "after"; then
3099             add_lopath_after "$new_path"
3100         else
3101             add_lopath_before "$new_path"
3102         fi
3103     fi
3106 AC_PROG_AWK
3107 AC_PATH_PROG( AWK, $AWK)
3108 if test -z "$AWK"; then
3109     AC_MSG_ERROR([install awk to run this script])
3112 AC_PATH_PROG(BASH, bash)
3113 if test -z "$BASH"; then
3114     AC_MSG_ERROR([bash not found in \$PATH])
3116 AC_SUBST(BASH)
3118 # prefer parallel compression tools, if available
3119 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3120 if test -z "$COMPRESSIONTOOL"; then
3121     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3122     if test -z "$COMPRESSIONTOOL"; then
3123         AC_MSG_ERROR([gzip not found in \$PATH])
3124     fi
3126 AC_SUBST(COMPRESSIONTOOL)
3128 AC_MSG_CHECKING([for GNU or BSD tar])
3129 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3130     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3131     if test $? -eq 0;  then
3132         GNUTAR=$a
3133         break
3134     fi
3135 done
3136 AC_MSG_RESULT($GNUTAR)
3137 if test -z "$GNUTAR"; then
3138     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3140 AC_SUBST(GNUTAR)
3142 AC_MSG_CHECKING([for tar's option to strip components])
3143 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3144 if test $? -eq 0; then
3145     STRIP_COMPONENTS="--strip-components"
3146 else
3147     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3148     if test $? -eq 0; then
3149         STRIP_COMPONENTS="--strip-path"
3150     else
3151         STRIP_COMPONENTS="unsupported"
3152     fi
3154 AC_MSG_RESULT($STRIP_COMPONENTS)
3155 if test x$STRIP_COMPONENTS = xunsupported; then
3156     AC_MSG_ERROR([you need a tar that is able to strip components.])
3158 AC_SUBST(STRIP_COMPONENTS)
3160 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3161 dnl desktop OSes from "mobile" ones.
3163 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3164 dnl In other words, that when building for an OS that is not a
3165 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3167 dnl Note the direction of the implication; there is no assumption that
3168 dnl cross-compiling would imply a non-desktop OS.
3170 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3171     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3172     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3173     if test "$_os" != Emscripten; then
3174         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3175     fi
3178 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3179 # also work with the default gtk3 plugin.
3180 if test "$enable_wasm_strip" = "yes"; then
3181     enable_avmedia=no
3182     enable_libcmis=no
3183     enable_coinmp=no
3184     enable_cups=no
3185     test "$_os" = Emscripten && enable_curl=no
3186     enable_database_connectivity=no
3187     enable_dbus=no
3188     enable_dconf=no
3189     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3190     enable_extension_integration=no
3191     enable_extensions=no
3192     enable_extension_update=no
3193     enable_gio=no
3194     enable_gpgmepp=no
3195     enable_ldap=no
3196     enable_lotuswordpro=no
3197     enable_lpsolve=no
3198     enable_nss=no
3199     enable_odk=no
3200     enable_online_update=no
3201     enable_opencl=no
3202     enable_pdfimport=no
3203     enable_randr=no
3204     enable_report_builder=no
3205     enable_scripting=no
3206     enable_sdremote_bluetooth=no
3207     enable_skia=no
3208     enable_xmlhelp=no
3209     enable_zxing=no
3210     test_libepubgen=no
3211     test_libcdr=no
3212     test_libcmis=no
3213     test_libetonyek=no
3214     test_libfreehand=no
3215     test_libmspub=no
3216     test_libpagemaker=no
3217     test_libqxp=no
3218     test_libvisio=no
3219     test_libzmf=no
3220     test_webdav=no
3221     with_galleries=no
3222     with_templates=no
3223     with_webdav=no
3224     with_x=no
3226     test "${with_fonts+set}" = set || with_fonts=yes
3227     test "${with_locales+set}" = set || with_locales=en
3229     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3230     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3231     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3232     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3233 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3234     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3235     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3236     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3237     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3238 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3239     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3240     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3241     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3242     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3243     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3244     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3245     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3246     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3249 # Whether to build "avmedia" functionality or not.
3251 if test "$enable_avmedia" = yes; then
3252     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3253     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3254 else
3255     test_gstreamer_1_0=no
3258 # Decide whether to build database connectivity stuff (including Base) or not.
3259 if test "$enable_database_connectivity" != no; then
3260     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3261     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3262 else
3263     if test "$_os" = iOS; then
3264         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3265     fi
3266     disable_database_connectivity_dependencies
3269 if test -z "$enable_extensions"; then
3270     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3271     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3272         enable_extensions=yes
3273     fi
3276 DISABLE_SCRIPTING=''
3277 if test "$enable_scripting" = yes; then
3278     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3279     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3280 else
3281     DISABLE_SCRIPTING='TRUE'
3282     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3285 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3286     # Disable dynamic_loading always for iOS and Android
3287     enable_dynamic_loading=no
3288 elif test -z "$enable_dynamic_loading"; then
3289     # Otherwise enable it unless specifically disabled
3290     enable_dynamic_loading=yes
3293 DISABLE_DYNLOADING=''
3294 if test "$enable_dynamic_loading" = yes; then
3295     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3296 else
3297     DISABLE_DYNLOADING='TRUE'
3298     if test $_os != iOS -a $_os != Android; then
3299         enable_database_connectivity=no
3300         enable_nss=no
3301         enable_odk=no
3302         enable_python=no
3303         enable_skia=no
3304         with_java=no
3305     fi
3307 AC_SUBST(DISABLE_DYNLOADING)
3309 ENABLE_CUSTOMTARGET_COMPONENTS=
3310 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3311     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3312     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3313         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3314     fi
3316 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3318 if test "$enable_extensions" = yes; then
3319     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3320     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3321 else
3322     enable_extension_integration=no
3323     enable_extension_update=no
3326 # remember SYSBASE value
3327 AC_SUBST(SYSBASE)
3329 dnl ===================================================================
3330 dnl  Sort out various gallery compilation options
3331 dnl ===================================================================
3332 WITH_GALLERY_BUILD=TRUE
3333 AC_MSG_CHECKING([how to build and package galleries])
3334 if test -n "${with_galleries}"; then
3335     if test "$with_galleries" = "build"; then
3336         if test "$enable_database_connectivity" = no; then
3337             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3338         fi
3339         AC_MSG_RESULT([build from source images internally])
3340     elif test "$with_galleries" = "no"; then
3341         WITH_GALLERY_BUILD=
3342         AC_MSG_RESULT([disable non-internal gallery build])
3343     else
3344         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3345     fi
3346 else
3347     if test $_os != iOS -a $_os != Android; then
3348         AC_MSG_RESULT([internal src images for desktop])
3349     else
3350         WITH_GALLERY_BUILD=
3351         AC_MSG_RESULT([disable src image build])
3352     fi
3354 AC_SUBST(WITH_GALLERY_BUILD)
3356 dnl ===================================================================
3357 dnl  Sort out various templates compilation options
3358 dnl ===================================================================
3359 WITH_TEMPLATES=TRUE
3360 AC_MSG_CHECKING([build with or without template files])
3361 if test -n "${with_templates}"; then
3362     if test "$with_templates" = "yes"; then
3363         AC_MSG_RESULT([enable all templates])
3364     elif test "$with_templates" = "no"; then
3365         WITH_TEMPLATES=
3366         AC_MSG_RESULT([disable non-internal templates])
3367     else
3368         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3369     fi
3370 else
3371     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3372         AC_MSG_RESULT([enable all templates])
3373     else
3374         WITH_TEMPLATES=
3375         AC_MSG_RESULT([disable non-internal templates])
3376     fi
3378 AC_SUBST(WITH_TEMPLATES)
3380 dnl ===================================================================
3381 dnl  Checks if ccache is available
3382 dnl ===================================================================
3383 CCACHE_DEPEND_MODE=
3384 if test "$enable_ccache" = "no"; then
3385     CCACHE=""
3386 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3387     case "%$CC%$CXX%" in
3388     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3389     # assume that's good then
3390     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3391         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3392         CCACHE_DEPEND_MODE=1
3393         ;;
3394     *)
3395         # try to use our own ccache if it is available and CCACHE was not already defined
3396         if test -z "$CCACHE"; then
3397             if test "$_os" = "WINNT"; then
3398                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3399             fi
3400             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3401                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3402             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3403                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3404             fi
3405         fi
3406         AC_PATH_PROG([CCACHE],[ccache],[not found])
3407         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3408             CCACHE=`win_short_path_for_make "$CCACHE"`
3409             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3410             rm -f conftest.txt
3411             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3412             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3413             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3414                 AC_MSG_RESULT(yes)
3415             else
3416                 AC_MSG_RESULT(no)
3417                 CCACHE="not found"
3418             fi
3419             rm -f conftest.txt
3420         fi
3421         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3422             # on windows/VC perhaps sccache is around?
3423             case "%$CC%$CXX%" in
3424             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3425             # assume that's good then
3426             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3427                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3428                 CCACHE_DEPEND_MODE=1
3429                 SCCACHE=1
3430                 ;;
3431             *)
3432                 # for sharing code below, reuse CCACHE env var
3433                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3434                 if test "$CCACHE" != "not found"; then
3435                     CCACHE=`win_short_path_for_make "$CCACHE"`
3436                     SCCACHE=1
3437                     CCACHE_DEPEND_MODE=1
3438                 fi
3439                 ;;
3440             esac
3441         fi
3442         if test "$CCACHE" = "not found"; then
3443             CCACHE=""
3444         fi
3445         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3446             CCACHE_DEPEND_MODE=1
3447             # Need to check for ccache version: otherwise prevents
3448             # caching of the results (like "-x objective-c++" for Mac)
3449             if test $_os = Darwin -o $_os = iOS; then
3450                 # Check ccache version
3451                 AC_MSG_CHECKING([whether version of ccache is suitable])
3452                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3453                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3454                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3455                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3456                 else
3457                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3458                     CCACHE=""
3459                     CCACHE_DEPEND_MODE=
3460                 fi
3461             fi
3462         fi
3463         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3464             AC_MSG_ERROR([No suitable ccache found])
3465         fi
3466         ;;
3467     esac
3468 else
3469     CCACHE=""
3471 if test "$enable_ccache" = "nodepend"; then
3472     CCACHE_DEPEND_MODE=""
3474 AC_SUBST(CCACHE_DEPEND_MODE)
3476 # sccache defaults are good enough
3477 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3478     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3479     # or (...) max_size = 20.0 G
3480     # -p works with both 4.2 and 4.4
3481     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3482     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3483     if test "$ccache_size" = ""; then
3484         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3485         if test "$ccache_size" = ""; then
3486             ccache_size=0
3487         fi
3488         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3489         if test $ccache_size -lt 1024; then
3490             CCACHE=""
3491             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3492             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3493         else
3494             # warn that ccache may be too small for debug build
3495             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3496             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3497         fi
3498     else
3499         if test $ccache_size -lt 5; then
3500             #warn that ccache may be too small for debug build
3501             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3502             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3503         fi
3504     fi
3507 ENABLE_Z7_DEBUG=
3508 if test "$enable_z7_debug" != no; then
3509     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3510         ENABLE_Z7_DEBUG=TRUE
3511     fi
3512 else
3513     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3514     add_warning "ccache will not work with --disable-z7-debug"
3516 AC_SUBST(ENABLE_Z7_DEBUG)
3518 dnl ===================================================================
3519 dnl  Checks for C compiler,
3520 dnl  The check for the C++ compiler is later on.
3521 dnl ===================================================================
3522 if test "$_os" != "WINNT"; then
3523     GCC_HOME_SET="true"
3524     AC_MSG_CHECKING([gcc home])
3525     if test -z "$with_gcc_home"; then
3526         if test "$enable_icecream" = "yes"; then
3527             if test -d "/usr/lib/icecc/bin"; then
3528                 GCC_HOME="/usr/lib/icecc/"
3529             elif test -d "/usr/libexec/icecc/bin"; then
3530                 GCC_HOME="/usr/libexec/icecc/"
3531             elif test -d "/opt/icecream/bin"; then
3532                 GCC_HOME="/opt/icecream/"
3533             else
3534                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3536             fi
3537         else
3538             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3539             GCC_HOME_SET="false"
3540         fi
3541     else
3542         GCC_HOME="$with_gcc_home"
3543     fi
3544     AC_MSG_RESULT($GCC_HOME)
3545     AC_SUBST(GCC_HOME)
3547     if test "$GCC_HOME_SET" = "true"; then
3548         if test -z "$CC"; then
3549             CC="$GCC_HOME/bin/gcc"
3550             CC_BASE="gcc"
3551         fi
3552         if test -z "$CXX"; then
3553             CXX="$GCC_HOME/bin/g++"
3554             CXX_BASE="g++"
3555         fi
3556     fi
3559 COMPATH=`dirname "$CC"`
3560 if test "$COMPATH" = "."; then
3561     AC_PATH_PROGS(COMPATH, $CC)
3562     dnl double square bracket to get single because of M4 quote...
3563     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3565 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3567 dnl ===================================================================
3568 dnl Java support
3569 dnl ===================================================================
3570 AC_MSG_CHECKING([whether to build with Java support])
3571 javacompiler="javac"
3572 javadoc="javadoc"
3573 if test "$with_java" != "no"; then
3574     if test "$DISABLE_SCRIPTING" = TRUE; then
3575         AC_MSG_RESULT([no, overridden by --disable-scripting])
3576         ENABLE_JAVA=""
3577         with_java=no
3578     else
3579         AC_MSG_RESULT([yes])
3580         ENABLE_JAVA="TRUE"
3581         AC_DEFINE(HAVE_FEATURE_JAVA)
3582     fi
3583 else
3584     AC_MSG_RESULT([no])
3585     ENABLE_JAVA=""
3588 AC_SUBST(ENABLE_JAVA)
3590 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3592 dnl ENABLE_JAVA="" indicate no Java support at all
3594 dnl ===================================================================
3595 dnl Check macOS SDK and compiler
3596 dnl ===================================================================
3598 if test $_os = Darwin; then
3600     # The SDK in the currently selected Xcode should be found.
3602     AC_MSG_CHECKING([what macOS SDK to use])
3603     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3604     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3605     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3606     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3607     # problems that existed in the PPC days with target versions not being respected or random
3608     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3609     # SDK version is enough, no need to do both...
3610     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3611     if test ! -d "$MACOSX_SDK_PATH"; then
3612         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3613     fi
3614     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3615     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3616     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3617     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3618     # 10.10.2 is 101002
3619     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3620     # correct version in case such an old SDK is specified, it will be rejected later anyway
3621     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3622     if test $MACOSX_SDK_VERSION -lt 101500; then
3623         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3624     fi
3625     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3626         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3627     fi
3628     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3630     AC_MSG_CHECKING([what minimum version of macOS to require])
3631     if test "$with_macosx_version_min_required" = "" ; then
3632         if test "$host_cpu" = x86_64; then
3633             with_macosx_version_min_required="10.15";
3634         else
3635             with_macosx_version_min_required="11.0";
3636         fi
3637     fi
3638     # see same notes about MACOSX_SDK_VERSION above
3639     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3640     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3641         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3642     fi
3643     AC_MSG_RESULT([$with_macosx_version_min_required])
3645     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3646     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3647         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3648     else
3649         AC_MSG_RESULT([yes])
3650     fi
3652     # export this so that "xcrun" invocations later return matching values
3653     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3654     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3655     export DEVELOPER_DIR
3656     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3657     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3659     AC_MSG_CHECKING([whether Xcode is new enough])
3660     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3661     my_xcode_ver2=${my_xcode_ver1#Xcode }
3662     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3663     if test "$my_xcode_ver3" -ge 1205; then
3664         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3665         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3666             if test "$my_xcode_ver3" -eq 1500; then
3667                 dnl the bug was aleady fixed on 15.1 and 15.2 still has the same OS requirements as 15.0
3668                 dnl in other words all affected users could update to a working Xcode version
3669                 AC_MSG_WARN([Use a current version of XCode or bump the minimum deployment target])
3670                 AC_MSG_WARN([[see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking]])
3671                 AC_MSG_ERROR([Xcode 15.0 has a bug in the new linker that causes runtime crashes on macOS 11 - aborting])
3672             fi
3673         fi
3674     else
3675         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3676     fi
3678     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3679     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3681     LIBTOOL=/usr/bin/libtool
3682     INSTALL_NAME_TOOL=install_name_tool
3683     if test -z "$save_CC"; then
3684         stdlib=-stdlib=libc++
3686         AC_MSG_CHECKING([what C compiler to use])
3687         CC="`xcrun -find clang`"
3688         CC_BASE=`first_arg_basename "$CC"`
3689         if test "$host_cpu" = x86_64; then
3690             CC+=" -target x86_64-apple-macos"
3691         else
3692             CC+=" -target arm64-apple-macos"
3693         fi
3694         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3695         AC_MSG_RESULT([$CC])
3697         AC_MSG_CHECKING([what C++ compiler to use])
3698         CXX="`xcrun -find clang++`"
3699         CXX_BASE=`first_arg_basename "$CXX"`
3700         if test "$host_cpu" = x86_64; then
3701             CXX+=" -target x86_64-apple-macos"
3702         else
3703             CXX+=" -target arm64-apple-macos"
3704         fi
3705         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3706         AC_MSG_RESULT([$CXX])
3708         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3709         AR=`xcrun -find ar`
3710         NM=`xcrun -find nm`
3711         STRIP=`xcrun -find strip`
3712         LIBTOOL=`xcrun -find libtool`
3713         RANLIB=`xcrun -find ranlib`
3714     fi
3716     AC_MSG_CHECKING([whether to do code signing])
3718     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3719         AC_MSG_RESULT([no])
3720     else
3721         if test "$enable_macosx_code_signing" = yes; then
3722             # By default use the first suitable certificate (?).
3724             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3725             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3726             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3727             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3728             # "Developer ID Application" one.
3729             identity="Developer ID Application:"
3730         else
3731             identity=$enable_macosx_code_signing
3732         fi
3733         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3734         if test -n "$identity"; then
3735             MACOSX_CODESIGNING_IDENTITY=$identity
3736             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3737             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3738         else
3739             AC_MSG_ERROR([cannot determine identity to use])
3740         fi
3741     fi
3743     AC_MSG_CHECKING([whether to create a Mac App Store package])
3745     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3746         AC_MSG_RESULT([no])
3747     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3748         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3749     else
3750         if test "$enable_macosx_package_signing" = yes; then
3751             # By default use the first suitable certificate.
3752             # It should be a "3rd Party Mac Developer Installer" one
3753             identity="3rd Party Mac Developer Installer:"
3754         else
3755             identity=$enable_macosx_package_signing
3756         fi
3757         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3758         if test -n "$identity"; then
3759             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3760             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3761             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3762         else
3763             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3764         fi
3765     fi
3767     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3768         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3769     fi
3771     AC_MSG_CHECKING([whether to sandbox the application])
3773     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3774         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3775     elif test "$enable_macosx_sandbox" = yes; then
3776         ENABLE_MACOSX_SANDBOX=TRUE
3777         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3778         AC_MSG_RESULT([yes])
3779     else
3780         AC_MSG_RESULT([no])
3781     fi
3783     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3784     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3785     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3787     if test -n "$with_macosx_provisioning_profile" ; then
3788         if test ! -f "$with_macosx_provisioning_profile"; then
3789             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3790         else
3791             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3792             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3793                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3794                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3795                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3796         fi
3797     fi
3799 AC_SUBST(MACOSX_SDK_PATH)
3800 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3801 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3802 AC_SUBST(INSTALL_NAME_TOOL)
3803 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3804 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3805 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3806 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3807 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3808 AC_SUBST(MACOSX_PROVISIONING_INFO)
3809 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3810 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3811 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3813 dnl ===================================================================
3814 dnl Check iOS SDK and compiler
3815 dnl ===================================================================
3817 if test $_os = iOS; then
3818     AC_MSG_CHECKING([what iOS SDK to use])
3820     if test "$enable_ios_simulator" = "yes"; then
3821         platformlc=iphonesimulator
3822         versionmin=-mios-simulator-version-min=14.5
3823     else
3824         platformlc=iphoneos
3825         versionmin=-miphoneos-version-min=14.5
3826     fi
3828     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3830     if ! test -d "$sysroot"; then
3831         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3832     fi
3834     AC_MSG_RESULT($sysroot)
3836     stdlib="-stdlib=libc++"
3838     AC_MSG_CHECKING([what C compiler to use])
3839     CC="`xcrun -find clang`"
3840     CC_BASE=`first_arg_basename "$CC"`
3841     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3842     AC_MSG_RESULT([$CC])
3844     AC_MSG_CHECKING([what C++ compiler to use])
3845     CXX="`xcrun -find clang++`"
3846     CXX_BASE=`first_arg_basename "$CXX"`
3847     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3848     AC_MSG_RESULT([$CXX])
3850     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3851     AR=`xcrun -find ar`
3852     NM=`xcrun -find nm`
3853     STRIP=`xcrun -find strip`
3854     LIBTOOL=`xcrun -find libtool`
3855     RANLIB=`xcrun -find ranlib`
3858 AC_MSG_CHECKING([whether to treat the installation as read-only])
3860 if test $_os = Darwin; then
3861     enable_readonly_installset=yes
3862 elif test "$enable_extensions" != yes; then
3863     enable_readonly_installset=yes
3865 if test "$enable_readonly_installset" = yes; then
3866     AC_MSG_RESULT([yes])
3867     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3868 else
3869     AC_MSG_RESULT([no])
3872 dnl ===================================================================
3873 dnl Structure of install set
3874 dnl ===================================================================
3876 if test $_os = Darwin; then
3877     LIBO_BIN_FOLDER=MacOS
3878     LIBO_ETC_FOLDER=Resources
3879     LIBO_LIBEXEC_FOLDER=MacOS
3880     LIBO_LIB_FOLDER=Frameworks
3881     LIBO_LIB_PYUNO_FOLDER=Resources
3882     LIBO_SHARE_FOLDER=Resources
3883     LIBO_SHARE_HELP_FOLDER=Resources/help
3884     LIBO_SHARE_JAVA_FOLDER=Resources/java
3885     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3886     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3887     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3888     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3889     LIBO_URE_BIN_FOLDER=MacOS
3890     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3891     LIBO_URE_LIB_FOLDER=Frameworks
3892     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3893     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3894 elif test $_os = WINNT; then
3895     LIBO_BIN_FOLDER=program
3896     LIBO_ETC_FOLDER=program
3897     LIBO_LIBEXEC_FOLDER=program
3898     LIBO_LIB_FOLDER=program
3899     LIBO_LIB_PYUNO_FOLDER=program
3900     LIBO_SHARE_FOLDER=share
3901     LIBO_SHARE_HELP_FOLDER=help
3902     LIBO_SHARE_JAVA_FOLDER=program/classes
3903     LIBO_SHARE_PRESETS_FOLDER=presets
3904     LIBO_SHARE_READMES_FOLDER=readmes
3905     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3906     LIBO_SHARE_SHELL_FOLDER=program/shell
3907     LIBO_URE_BIN_FOLDER=program
3908     LIBO_URE_ETC_FOLDER=program
3909     LIBO_URE_LIB_FOLDER=program
3910     LIBO_URE_MISC_FOLDER=program
3911     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3912 else
3913     LIBO_BIN_FOLDER=program
3914     LIBO_ETC_FOLDER=program
3915     LIBO_LIBEXEC_FOLDER=program
3916     LIBO_LIB_FOLDER=program
3917     LIBO_LIB_PYUNO_FOLDER=program
3918     LIBO_SHARE_FOLDER=share
3919     LIBO_SHARE_HELP_FOLDER=help
3920     LIBO_SHARE_JAVA_FOLDER=program/classes
3921     LIBO_SHARE_PRESETS_FOLDER=presets
3922     LIBO_SHARE_READMES_FOLDER=readmes
3923     if test "$enable_fuzzers" != yes; then
3924         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3925     else
3926         LIBO_SHARE_RESOURCE_FOLDER=resource
3927     fi
3928     LIBO_SHARE_SHELL_FOLDER=program/shell
3929     LIBO_URE_BIN_FOLDER=program
3930     LIBO_URE_ETC_FOLDER=program
3931     LIBO_URE_LIB_FOLDER=program
3932     LIBO_URE_MISC_FOLDER=program
3933     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3935 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3936 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3937 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3938 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3939 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3940 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3941 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3942 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3943 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3944 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3945 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3946 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3947 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3948 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3949 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3950 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3952 # Not all of them needed in config_host.mk, add more if need arises
3953 AC_SUBST(LIBO_BIN_FOLDER)
3954 AC_SUBST(LIBO_ETC_FOLDER)
3955 AC_SUBST(LIBO_LIB_FOLDER)
3956 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3957 AC_SUBST(LIBO_SHARE_FOLDER)
3958 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3959 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3960 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3961 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3962 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3963 AC_SUBST(LIBO_URE_BIN_FOLDER)
3964 AC_SUBST(LIBO_URE_ETC_FOLDER)
3965 AC_SUBST(LIBO_URE_LIB_FOLDER)
3966 AC_SUBST(LIBO_URE_MISC_FOLDER)
3967 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3969 dnl ===================================================================
3970 dnl Windows specific tests and stuff
3971 dnl ===================================================================
3973 reg_get_value()
3975     # Return value: $regvalue
3976     unset regvalue
3978     if test "$build_os" = "wsl"; then
3979         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
3980         return
3981     elif test -n "$WSL_ONLY_AS_HELPER"; then
3982         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
3983         return
3984     fi
3986     local _regentry="/proc/registry${1}/${2}/${3}"
3987     if test -f "$_regentry"; then
3988         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3989         # Registry keys read via /proc/registry* are always \0 terminated!
3990         local _regvalue=$(tr -d '\0' < "$_regentry")
3991         if test $? -eq 0; then
3992             regvalue=$_regvalue
3993         fi
3994     fi
3997 # Get a value from the 32-bit side of the Registry
3998 reg_get_value_32()
4000     reg_get_value "32" "$1" "$2"
4003 # Get a value from the 64-bit side of the Registry
4004 reg_get_value_64()
4006     reg_get_value "64" "$1" "$2"
4009 reg_list_values()
4011     # Return value: $reglist
4012     unset reglist
4014     if test "$build_os" = "wsl"; then
4015         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4016         return
4017     fi
4019     reglist=$(ls "/proc/registry${1}/${2}")
4022 # List values from the 32-bit side of the Registry
4023 reg_list_values_32()
4025     reg_list_values "32" "$1"
4028 # List values from the 64-bit side of the Registry
4029 reg_list_values_64()
4031     reg_list_values "64" "$1"
4034 case "$host_os" in
4035 cygwin*|wsl*)
4036     COM=MSC
4037     OS=WNT
4038     RTL_OS=Windows
4039     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4040         P_SEP=";"
4041     else
4042         P_SEP=:
4043     fi
4044     case "$host_cpu" in
4045     x86_64)
4046         CPUNAME=X86_64
4047         RTL_ARCH=X86_64
4048         PLATFORMID=windows_x86_64
4049         WINDOWS_X64=1
4050         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4051         WIN_HOST_ARCH="x64"
4052         WIN_MULTI_ARCH="x86"
4053         WIN_HOST_BITS=64
4054         ;;
4055     i*86)
4056         CPUNAME=INTEL
4057         RTL_ARCH=x86
4058         PLATFORMID=windows_x86
4059         WIN_HOST_ARCH="x86"
4060         WIN_HOST_BITS=32
4061         WIN_OTHER_ARCH="x64"
4062         ;;
4063     aarch64)
4064         CPUNAME=AARCH64
4065         RTL_ARCH=AARCH64
4066         PLATFORMID=windows_aarch64
4067         WINDOWS_X64=1
4068         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4069         WIN_HOST_ARCH="arm64"
4070         WIN_HOST_BITS=64
4071         with_ucrt_dir=no
4072         ;;
4073     *)
4074         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4075         ;;
4076     esac
4078     case "$build_cpu" in
4079     x86_64) WIN_BUILD_ARCH="x64" ;;
4080     i*86) WIN_BUILD_ARCH="x86" ;;
4081     aarch64) WIN_BUILD_ARCH="arm64" ;;
4082     *)
4083         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4084         ;;
4085     esac
4087     SCPDEFS="$SCPDEFS -D_MSC_VER"
4088     ;;
4089 esac
4091 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4092 # other-arch won't, but wouldn't break the build (x64 on x86).
4093 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4094     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4098 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4099     # To allow building Windows multi-arch releases without cross-tooling
4100     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4101         cross_compiling="yes"
4102     fi
4105 if test "$cross_compiling" = "yes"; then
4106     export CROSS_COMPILING=TRUE
4107     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4108         ENABLE_WASM_STRIP=TRUE
4109     fi
4110     if test "$_os" = "Emscripten"; then
4111         if test "$with_main_module" = "calc"; then
4112             ENABLE_WASM_STRIP_WRITER=TRUE
4113         elif test "$with_main_module" = "writer"; then
4114             ENABLE_WASM_STRIP_CALC=TRUE
4115         fi
4116     fi
4117 else
4118     CROSS_COMPILING=
4119     BUILD_TYPE="$BUILD_TYPE NATIVE"
4121 AC_SUBST(CROSS_COMPILING)
4122 AC_SUBST(ENABLE_WASM_STRIP)
4123 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4124 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4126 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4127 # NOTE: must _not_ be used for bundled external libraries!
4128 ISYSTEM=
4129 if test "$GCC" = "yes"; then
4130     AC_MSG_CHECKING( for -isystem )
4131     save_CFLAGS=$CFLAGS
4132     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4133     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4134     CFLAGS=$save_CFLAGS
4135     if test -n "$ISYSTEM"; then
4136         AC_MSG_RESULT(yes)
4137     else
4138         AC_MSG_RESULT(no)
4139     fi
4141 if test -z "$ISYSTEM"; then
4142     # fall back to using -I
4143     ISYSTEM=-I
4145 AC_SUBST(ISYSTEM)
4147 dnl ===================================================================
4148 dnl  Check which Visual Studio compiler is used
4149 dnl ===================================================================
4151 map_vs_year_to_version()
4153     # Return value: $vsversion
4155     unset vsversion
4157     case $1 in
4158     2019)
4159         vsversion=16;;
4160     2022)
4161         vsversion=17;;
4162     2022preview)
4163         vsversion=17.11;;
4164     *)
4165         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4166     esac
4169 vs_versions_to_check()
4171     # Args: $1 (optional) : versions to check, in the order of preference
4172     # Return value: $vsversions
4174     unset vsversions
4176     if test -n "$1"; then
4177         map_vs_year_to_version "$1"
4178         vsversions=$vsversion
4179     else
4180         # Default version is 2019
4181         vsversions="16"
4182     fi
4185 win_get_env_from_vsdevcmdbat()
4187     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4188     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4189     PathFormat "$VC_PRODUCT_DIR"
4190     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4191     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4192     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4193     local result
4194     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4195         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4196     else
4197         chmod +x $WRAPPERBATCHFILEPATH
4198         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4199     fi
4200     rm -f $WRAPPERBATCHFILEPATH
4201     printf '%s' "$result"
4204 find_ucrt()
4206     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4207     if test -n "$regvalue"; then
4208         PathFormat "$regvalue"
4209         UCRTSDKDIR=$formatted_path_unix
4210         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4211         if test -n "$regvalue"; then
4212             UCRTVERSION="$regvalue".0
4213         fi
4215         # Rest if not exist
4216         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4217           UCRTSDKDIR=
4218         fi
4219     fi
4220     if test -z "$UCRTSDKDIR"; then
4221         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4222         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4223         if test -f "$ide_env_file"; then
4224             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4225             UCRTSDKDIR=$formatted_path_unix
4226             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4227             dnl Hack needed at least by tml:
4228             if test "$UCRTVERSION" = 10.0.15063.0 \
4229                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4230                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4231             then
4232                 UCRTVERSION=10.0.14393.0
4233             fi
4234         else
4235           AC_MSG_ERROR([No UCRT found])
4236         fi
4237     fi
4240 find_msvc()
4242     # Find Visual C++
4243     # Args: $1 (optional) : The VS version year
4244     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4246     unset vctest vctoolset vcnumwithdot vcbuildnumber
4248     vs_versions_to_check "$1"
4249     if test "$build_os" = wsl; then
4250         vswhere="$PROGRAMFILESX86"
4251         if test -z "$vswhere"; then
4252             vswhere="c:\\Program Files (x86)"
4253         fi
4254     elif test -n "$WSL_ONLY_AS_HELPER"; then
4255         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4256     else
4257         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4258     fi
4259     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4260     PathFormat "$vswhere"
4261     vswhere=$formatted_path_unix
4262     for ver in $vsversions; do
4263         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4264         if test -z "$vswhereoutput"; then
4265             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4266         fi
4267         # Fall back to all MS products (this includes VC++ Build Tools)
4268         if ! test -n "$vswhereoutput"; then
4269             AC_MSG_CHECKING([VC++ Build Tools and similar])
4270             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4271         fi
4272         if test -n "$vswhereoutput"; then
4273             PathFormat "$vswhereoutput"
4274             vctest=$formatted_path_unix
4275             break
4276         fi
4277     done
4279     if test -n "$vctest"; then
4280         vcnumwithdot="$ver"
4281         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4282             vcnumwithdot=$vcnumwithdot.0
4283         fi
4284         case "$vcnumwithdot" in
4285         16.0)
4286             vcyear=2019
4287             vctoolset=v142
4288             ;;
4289         17.0 | 17.11)
4290             vcyear=2022
4291             vctoolset=v143
4292             ;;
4293         esac
4294         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4296     fi
4299 test_cl_exe()
4301     AC_MSG_CHECKING([$1 compiler])
4303     CL_EXE_PATH="$2/cl.exe"
4305     if test ! -f "$CL_EXE_PATH"; then
4306         if test "$1" = "multi-arch"; then
4307             AC_MSG_WARN([no compiler (cl.exe) in $2])
4308             return 1
4309         else
4310             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4311         fi
4312     fi
4314     dnl ===========================================================
4315     dnl  Check for the corresponding mspdb*.dll
4316     dnl ===========================================================
4318     # MSVC 15.0 has libraries from 14.0?
4319     mspdbnum="140"
4321     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4322         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4323     fi
4325     # The compiles has to find its shared libraries
4326     OLD_PATH="$PATH"
4327     TEMP_PATH=`cygpath -d "$2"`
4328     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4330     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4331         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4332     fi
4334     PATH="$OLD_PATH"
4336     AC_MSG_RESULT([$CL_EXE_PATH])
4339 SOLARINC=
4340 MSBUILD_PATH=
4341 DEVENV=
4342 if test "$_os" = "WINNT"; then
4343     AC_MSG_CHECKING([Visual C++])
4344     find_msvc "$with_visual_studio"
4345     if test -z "$vctest"; then
4346         if test -n "$with_visual_studio"; then
4347             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4348         else
4349             AC_MSG_ERROR([no Visual Studio installation found])
4350         fi
4351     fi
4352     AC_MSG_RESULT([])
4354     VC_PRODUCT_DIR="$vctest/VC"
4355     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4357     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4358     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4359         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4360         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4361         if test $? -ne 0; then
4362             WIN_MULTI_ARCH=""
4363             WIN_OTHER_ARCH=""
4364         fi
4365     fi
4367     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4368         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4369         test_cl_exe "build" "$MSVC_BUILD_PATH"
4370     fi
4372     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4373         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4374         test_cl_exe "host" "$MSVC_HOST_PATH"
4375     else
4376         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4377     fi
4379     AC_MSG_CHECKING([for short pathname of VC product directory])
4380     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4381     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4383     UCRTSDKDIR=
4384     UCRTVERSION=
4386     AC_MSG_CHECKING([for UCRT location])
4387     find_ucrt
4388     # find_ucrt errors out if it doesn't find it
4389     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4390     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4391     ucrtincpath_formatted=$formatted_path
4392     # SOLARINC is used for external modules and must be set too.
4393     # And no, it's not sufficient to set SOLARINC only, as configure
4394     # itself doesn't honour it.
4395     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4396     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4397     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4398     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4400     AC_SUBST(UCRTSDKDIR)
4401     AC_SUBST(UCRTVERSION)
4403     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4404     # Find the proper version of MSBuild.exe to use based on the VS version
4405     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4406     if test -z "$regvalue" ; then
4407         if test "$WIN_BUILD_ARCH" != "x64"; then
4408             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4409         else
4410             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4411         fi
4412     fi
4413     if test -d "$regvalue" ; then
4414         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4415         AC_MSG_RESULT([$regvalue])
4416     else
4417         AC_MSG_ERROR([MSBuild.exe location not found])
4418     fi
4420     # Find the version of devenv.exe
4421     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4422     DEVENV="$formatted_path"
4423     DEVENV_unix="$formatted_path_unix"
4424     if test ! -e "$DEVENV_unix"; then
4425         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4426     fi
4428     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4429     dnl needed when building CLR code:
4430     if test -z "$MSVC_CXX"; then
4431         # This gives us a posix path with 8.3 filename restrictions
4432         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4433     fi
4435     if test -z "$CC"; then
4436         CC=$MSVC_CXX
4437         CC_BASE=`first_arg_basename "$CC"`
4438     fi
4439     if test -z "$CXX"; then
4440         CXX=$MSVC_CXX
4441         CXX_BASE=`first_arg_basename "$CXX"`
4442     fi
4444     if test -n "$CC"; then
4445         # Remove /cl.exe from CC case insensitive
4446         AC_MSG_NOTICE([found Visual C++ $vcyear])
4448         PathFormat "$COMPATH"
4449         COMPATH="$formatted_path"
4450         COMPATH_unix="$formatted_path_unix"
4451         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4453         VCVER=$vcnumwithdot
4454         VCTOOLSET=$vctoolset
4456         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4457         # are always "better", we list them in reverse chronological order.
4459         case "$vcnumwithdot" in
4460         16.0 | 17.0 | 17.11)
4461             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4462             ;;
4463         esac
4465         # The expectation is that --with-windows-sdk should not need to be used
4466         if test -n "$with_windows_sdk"; then
4467             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4468             *" "$with_windows_sdk" "*)
4469                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4470                 ;;
4471             *)
4472                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4473                 ;;
4474             esac
4475         fi
4477         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4478         ac_objext=obj
4479         ac_exeext=exe
4481     else
4482         AC_MSG_ERROR([Visual C++ not found after all, huh])
4483     fi
4485     # ERROR if VS version < 16.5
4486     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4487     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4488         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4489         // between Visual Studio versions and _MSC_VER:
4490         #if _MSC_VER < 1925
4491         #error
4492         #endif
4493     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4495     # WARN if VS version < 16.10
4496     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4497     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4498         #if _MSC_VER < 1929
4499         #error
4500         #endif
4501     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4503     if test $vs2019_recommended_version = yes; then
4504         AC_MSG_RESULT([yes])
4505     else
4506         AC_MSG_WARN([no])
4507         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."
4508     fi
4510     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4511     # version of the Explorer extension (and maybe other small
4512     # bits, too) needed when installing a 32-bit LibreOffice on a
4513     # 64-bit OS. The 64-bit Explorer extension is a feature that
4514     # has been present since long in OOo. Don't confuse it with
4515     # building LibreOffice itself as 64-bit code.
4517     BUILD_X64=
4518     CXX_X64_BINARY=
4520     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4521         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4522         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4523              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4524         then
4525             BUILD_X64=TRUE
4526             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4527             AC_MSG_RESULT([found])
4528         else
4529             AC_MSG_RESULT([not found])
4530             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4531         fi
4532     elif test "$WIN_HOST_ARCH" = "x64"; then
4533         CXX_X64_BINARY=$CXX
4534     fi
4535     AC_SUBST(BUILD_X64)
4537     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4538     AC_SUBST(CXX_X64_BINARY)
4540     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4541     # needed to support TWAIN scan on both 32- and 64-bit systems
4543     case "$WIN_HOST_ARCH" in
4544     x64)
4545         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4546         if test -n "$CXX_X86_BINARY"; then
4547             BUILD_X86=TRUE
4548             AC_MSG_RESULT([preset])
4549         elif test -n "$WIN_MULTI_ARCH"; then
4550             BUILD_X86=TRUE
4551             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4552             AC_MSG_RESULT([found])
4553         else
4554             AC_MSG_RESULT([not found])
4555             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4556         fi
4557         ;;
4558     x86)
4559         BUILD_X86=TRUE
4560         CXX_X86_BINARY=$MSVC_CXX
4561         ;;
4562     esac
4563     AC_SUBST(BUILD_X86)
4564     AC_SUBST(CXX_X86_BINARY)
4566 AC_SUBST(VCVER)
4567 AC_SUBST(VCTOOLSET)
4568 AC_SUBST(DEVENV)
4569 AC_SUBST(MSVC_CXX)
4571 COM_IS_CLANG=
4572 AC_MSG_CHECKING([whether the compiler is actually Clang])
4573 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4574     #ifndef __clang__
4575     you lose
4576     #endif
4577     int foo=42;
4578     ]])],
4579     [AC_MSG_RESULT([yes])
4580      COM_IS_CLANG=TRUE],
4581     [AC_MSG_RESULT([no])])
4582 AC_SUBST(COM_IS_CLANG)
4584 CLANGVER=
4585 if test "$COM_IS_CLANG" = TRUE; then
4586     AC_MSG_CHECKING([whether Clang is new enough])
4587     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4588         #if !defined __apple_build_version__
4589         #error
4590         #endif
4591         ]])],
4592         [my_apple_clang=yes],[my_apple_clang=])
4593     if test "$my_apple_clang" = yes; then
4594         AC_MSG_RESULT([assumed yes (Apple Clang)])
4595     elif test "$_os" = Emscripten; then
4596         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4597     else
4598         if test "$_os" = WINNT; then
4599             dnl In which case, assume clang-cl:
4600             my_args="/EP /TC"
4601         else
4602             my_args="-E -P"
4603         fi
4604         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4605         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4606         CLANGVER=`echo $clang_version \
4607             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4608         if test "$CLANGVER" -ge 120000; then
4609             AC_MSG_RESULT([yes ($clang_version)])
4610         else
4611             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4612         fi
4613         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4614         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4615     fi
4618 SHOWINCLUDES_PREFIX=
4619 if test "$_os" = WINNT; then
4620     dnl We need to guess the prefix of the -showIncludes output, it can be
4621     dnl localized
4622     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4623     echo "#include <stdlib.h>" > conftest.c
4624     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4625         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4626     rm -f conftest.c conftest.obj
4627     if test -z "$SHOWINCLUDES_PREFIX"; then
4628         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4629     else
4630         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4631     fi
4633 AC_SUBST(SHOWINCLUDES_PREFIX)
4636 # prefix C with ccache if needed
4638 if test "$CCACHE" != ""; then
4639     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4641     AC_LANG_PUSH([C])
4642     save_CFLAGS=$CFLAGS
4643     CFLAGS="$CFLAGS --ccache-skip -O2"
4644     # msvc does not fail on unknown options, check stdout
4645     if test "$COM" = MSC; then
4646         CFLAGS="$CFLAGS -nologo"
4647     fi
4648     save_ac_c_werror_flag=$ac_c_werror_flag
4649     ac_c_werror_flag=yes
4650     dnl an empty program will do, we're checking the compiler flags
4651     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4652                       [use_ccache=yes], [use_ccache=no])
4653     CFLAGS=$save_CFLAGS
4654     ac_c_werror_flag=$save_ac_c_werror_flag
4655     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4656         AC_MSG_RESULT([yes])
4657     else
4658         CC="$CCACHE $CC"
4659         CC_BASE="ccache $CC_BASE"
4660         AC_MSG_RESULT([no])
4661     fi
4662     AC_LANG_POP([C])
4665 # ===================================================================
4666 # check various GCC options that Clang does not support now but maybe
4667 # will somewhen in the future, check them even for GCC, so that the
4668 # flags are set
4669 # ===================================================================
4671 HAVE_GCC_GGDB2=
4672 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4673     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4674     save_CFLAGS=$CFLAGS
4675     CFLAGS="$CFLAGS -Werror -ggdb2"
4676     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4677     CFLAGS=$save_CFLAGS
4678     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4679         AC_MSG_RESULT([yes])
4680     else
4681         AC_MSG_RESULT([no])
4682     fi
4684     if test "$host_cpu" = "m68k"; then
4685         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4686         save_CFLAGS=$CFLAGS
4687         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4688         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4689         CFLAGS=$save_CFLAGS
4690         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4691             AC_MSG_RESULT([yes])
4692         else
4693             AC_MSG_ERROR([no])
4694         fi
4695     fi
4697 AC_SUBST(HAVE_GCC_GGDB2)
4699 dnl ===================================================================
4700 dnl  Test the gcc version
4701 dnl ===================================================================
4702 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4703     AC_MSG_CHECKING([the GCC version])
4704     _gcc_version=`$CC -dumpfullversion`
4705     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4706         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4707     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4709     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4711     if test "$gcc_full_version" -lt 120000; then
4712         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4713     fi
4714 else
4715     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4716     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4717     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4718     # (which reports itself as GCC 4.2.1).
4719     GCC_VERSION=
4721 AC_SUBST(GCC_VERSION)
4723 dnl Set the ENABLE_DBGUTIL variable
4724 dnl ===================================================================
4725 AC_MSG_CHECKING([whether to build with additional debug utilities])
4726 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4727     ENABLE_DBGUTIL="TRUE"
4728     # this is an extra var so it can have different default on different MSVC
4729     # versions (in case there are version specific problems with it)
4730     MSVC_USE_DEBUG_RUNTIME="TRUE"
4732     AC_MSG_RESULT([yes])
4733     # cppunit and graphite expose STL in public headers
4734     if test "$with_system_cppunit" = "yes"; then
4735         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4736     else
4737         with_system_cppunit=no
4738     fi
4739     if test "$with_system_graphite" = "yes"; then
4740         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4741     else
4742         with_system_graphite=no
4743     fi
4744     if test "$with_system_orcus" = "yes"; then
4745         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4746     else
4747         with_system_orcus=no
4748     fi
4749     if test "$with_system_libcmis" = "yes"; then
4750         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4751     else
4752         with_system_libcmis=no
4753     fi
4754     if test "$with_system_hunspell" = "yes"; then
4755         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4756     else
4757         with_system_hunspell=no
4758     fi
4759     if test "$with_system_gpgmepp" = "yes"; then
4760         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4761     else
4762         with_system_gpgmepp=no
4763     fi
4764     if test "$with_system_zxing" = "yes"; then
4765         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4766     else
4767         with_system_zxing=no
4768     fi
4769     if test "$with_system_poppler" = "yes"; then
4770         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4771     else
4772         with_system_poppler=no
4773     fi
4774     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4775     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4776     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4777     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4778     # of those two is using the system variant:
4779     if test "$with_system_libnumbertext" = "yes"; then
4780         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4781     else
4782         with_system_libnumbertext=no
4783     fi
4784     if test "$with_system_libwps" = "yes"; then
4785         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4786     else
4787         with_system_libwps=no
4788     fi
4789 else
4790     ENABLE_DBGUTIL=""
4791     MSVC_USE_DEBUG_RUNTIME=""
4792     AC_MSG_RESULT([no])
4794 AC_SUBST(ENABLE_DBGUTIL)
4795 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4797 dnl Set the ENABLE_DEBUG variable.
4798 dnl ===================================================================
4799 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4800     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4802 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4803     if test -z "$libo_fuzzed_enable_debug"; then
4804         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4805     else
4806         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4807         enable_debug=yes
4808     fi
4811 AC_MSG_CHECKING([whether to do a debug build])
4812 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4813     ENABLE_DEBUG="TRUE"
4814     if test -n "$ENABLE_DBGUTIL" ; then
4815         AC_MSG_RESULT([yes (dbgutil)])
4816     else
4817         AC_MSG_RESULT([yes])
4818     fi
4819 else
4820     ENABLE_DEBUG=""
4821     AC_MSG_RESULT([no])
4823 AC_SUBST(ENABLE_DEBUG)
4825 dnl ===================================================================
4826 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4827 dnl This is done only after compiler checks (need to know if Clang is
4828 dnl used, for different defaults) and after checking if a debug build
4829 dnl is wanted (non-debug builds get the default linker if not explicitly
4830 dnl specified otherwise).
4831 dnl All checks for linker features/options should come after this.
4832 dnl ===================================================================
4833 check_use_ld()
4835     use_ld=-fuse-ld=${1%%:*}
4836     use_ld_path=${1#*:}
4837     if test "$use_ld_path" != "$1"; then
4838         if test "$COM_IS_CLANG" = TRUE; then
4839             if test "$CLANGVER" -ge 120000; then
4840                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4841             else
4842                 use_ld="-fuse-ld=${use_ld_path}"
4843             fi
4844         else
4845             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4846             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4847             # pickup the alternative linker, when called by libtool for linking.
4848             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4849             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4850         fi
4851     fi
4852     use_ld_fail_if_error=$2
4853     use_ld_ok=
4854     AC_MSG_CHECKING([for $use_ld linker support])
4855     use_ld_ldflags_save="$LDFLAGS"
4856     LDFLAGS="$LDFLAGS $use_ld"
4857     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4858 #include <stdio.h>
4859         ],[
4860 printf ("hello world\n");
4861         ])], USE_LD=$use_ld, [])
4862     if test -n "$USE_LD"; then
4863         AC_MSG_RESULT( yes )
4864         use_ld_ok=yes
4865     else
4866         if test -n "$use_ld_fail_if_error"; then
4867             AC_MSG_ERROR( no )
4868         else
4869             AC_MSG_RESULT( no )
4870         fi
4871     fi
4872     if test -n "$use_ld_ok"; then
4873         dnl keep the value of LDFLAGS
4874         return 0
4875     fi
4876     LDFLAGS="$use_ld_ldflags_save"
4877     return 1
4879 USE_LD=
4880 if test "$enable_ld" != "no"; then
4881     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4882         if test -n "$enable_ld"; then
4883             check_use_ld "$enable_ld" fail_if_error
4884         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4885             dnl non-debug builds default to the default linker
4886             true
4887         elif test -n "$COM_IS_CLANG"; then
4888             check_use_ld lld
4889             if test $? -ne 0; then
4890                 check_use_ld gold
4891                 if test $? -ne 0; then
4892                     check_use_ld mold
4893                 fi
4894             fi
4895         else
4896             # For gcc first try gold, new versions also support lld/mold.
4897             check_use_ld gold
4898             if test $? -ne 0; then
4899                 check_use_ld lld
4900                 if test $? -ne 0; then
4901                     check_use_ld mold
4902                 fi
4903             fi
4904         fi
4905         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4906         rm conftest.out
4907         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4908         if test -z "$ld_used"; then
4909             ld_used="unknown"
4910         fi
4911         AC_MSG_CHECKING([for linker that is used])
4912         AC_MSG_RESULT([$ld_used])
4913         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4914             if echo "$ld_used" | grep -q "^GNU ld"; then
4915                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4916                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4917             fi
4918         fi
4919     else
4920         if test "$enable_ld" = "yes"; then
4921             AC_MSG_ERROR([--enable-ld not supported])
4922         fi
4923     fi
4925 AC_SUBST(USE_LD)
4926 AC_SUBST(LD)
4928 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4929 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4930     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4931     bsymbolic_functions_ldflags_save=$LDFLAGS
4932     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4933     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4934 #include <stdio.h>
4935         ],[
4936 printf ("hello world\n");
4937         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4938     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4939         AC_MSG_RESULT( found )
4940     else
4941         AC_MSG_RESULT( not found )
4942     fi
4943     LDFLAGS=$bsymbolic_functions_ldflags_save
4945 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4947 LD_GC_SECTIONS=
4948 if test "$GCC" = "yes"; then
4949     for flag in "--gc-sections" "-dead_strip"; do
4950         AC_MSG_CHECKING([for $flag linker support])
4951         ldflags_save=$LDFLAGS
4952         LDFLAGS="$LDFLAGS -Wl,$flag"
4953         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4954 #include <stdio.h>
4955             ],[
4956 printf ("hello world\n");
4957             ])],[
4958             LD_GC_SECTIONS="-Wl,$flag"
4959             AC_MSG_RESULT( found )
4960             ], [
4961             AC_MSG_RESULT( not found )
4962             ])
4963         LDFLAGS=$ldflags_save
4964         if test -n "$LD_GC_SECTIONS"; then
4965             break
4966         fi
4967     done
4969 AC_SUBST(LD_GC_SECTIONS)
4971 HAVE_EXTERNAL_DWARF=
4972 if test "$enable_split_debug" != no; then
4973     use_split_debug=
4974     if test -n "$ENABLE_LTO"; then
4975         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4976     elif test "$enable_split_debug" = yes; then
4977         use_split_debug=1
4978     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4979     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4980         use_split_debug=1
4981     fi
4982     if test -n "$use_split_debug"; then
4983         if test "$_os" = "Emscripten"; then
4984             TEST_CC_FLAG=-gsplit-dwarf -gpubnames
4985         else
4986             TEST_CC_FLAG=-gsplit-dwarf
4987         fi
4988         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4989         save_CFLAGS=$CFLAGS
4990         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4991         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4992         CFLAGS=$save_CFLAGS
4993         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4994             AC_MSG_RESULT([yes])
4995         else
4996             if test "$enable_split_debug" = yes; then
4997                 AC_MSG_ERROR([no])
4998             else
4999                 AC_MSG_RESULT([no])
5000             fi
5001         fi
5002     fi
5003     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5004         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5005         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5006     fi
5008 AC_SUBST(HAVE_EXTERNAL_DWARF)
5010 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5011 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5012 save_CFLAGS=$CFLAGS
5013 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5014 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5015 CFLAGS=$save_CFLAGS
5016 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5017     AC_MSG_RESULT([yes])
5018 else
5019     AC_MSG_RESULT([no])
5021 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5023 ENABLE_GDB_INDEX=
5024 if test "$enable_gdb_index" != "no"; then
5025     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5026     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5027         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5028         save_CFLAGS=$CFLAGS
5029         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5030         have_ggnu_pubnames=
5031         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5032         if test "$have_ggnu_pubnames" != "TRUE"; then
5033             if test "$enable_gdb_index" = "yes"; then
5034                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5035             else
5036                 AC_MSG_RESULT( no )
5037             fi
5038         else
5039             AC_MSG_RESULT( yes )
5040             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5041             ldflags_save=$LDFLAGS
5042             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5043             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5044 #include <stdio.h>
5045                 ],[
5046 printf ("hello world\n");
5047                 ])], ENABLE_GDB_INDEX=TRUE, [])
5048             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5049                 AC_MSG_RESULT( yes )
5050             else
5051                 if test "$enable_gdb_index" = "yes"; then
5052                     AC_MSG_ERROR( no )
5053                 else
5054                     AC_MSG_RESULT( no )
5055                 fi
5056             fi
5057             LDFLAGS=$ldflags_save
5058         fi
5059         CFLAGS=$save_CFLAGS
5060         fi
5061     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5062         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5063         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5064     fi
5066 AC_SUBST(ENABLE_GDB_INDEX)
5068 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5069     enable_sal_log=yes
5071 if test "$enable_sal_log" = yes; then
5072     ENABLE_SAL_LOG=TRUE
5074 AC_SUBST(ENABLE_SAL_LOG)
5076 dnl Check for enable symbols option
5077 dnl ===================================================================
5078 AC_MSG_CHECKING([whether to generate debug information])
5079 if test -z "$enable_symbols"; then
5080     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5081         enable_symbols=yes
5082     else
5083         enable_symbols=no
5084     fi
5086 if test "$enable_symbols" = yes; then
5087     ENABLE_SYMBOLS_FOR=all
5088     AC_MSG_RESULT([yes])
5089 elif test "$enable_symbols" = no; then
5090     ENABLE_SYMBOLS_FOR=
5091     AC_MSG_RESULT([no])
5092 else
5093     # Selective debuginfo.
5094     ENABLE_SYMBOLS_FOR="$enable_symbols"
5095     AC_MSG_RESULT([for "$enable_symbols"])
5097 AC_SUBST(ENABLE_SYMBOLS_FOR)
5099 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5100     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5101     AC_MSG_CHECKING([whether enough memory is available for linking])
5102     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5103     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5104     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5105         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5106     else
5107         AC_MSG_RESULT([yes])
5108     fi
5111 ENABLE_OPTIMIZED=
5112 ENABLE_OPTIMIZED_DEBUG=
5113 AC_MSG_CHECKING([whether to compile with optimization flags])
5114 if test -z "$enable_optimized"; then
5115     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5116         enable_optimized=no
5117     else
5118         enable_optimized=yes
5119     fi
5121 if test "$enable_optimized" = yes; then
5122     ENABLE_OPTIMIZED=TRUE
5123     AC_MSG_RESULT([yes])
5124 elif test "$enable_optimized" = debug; then
5125     ENABLE_OPTIMIZED_DEBUG=TRUE
5126     AC_MSG_RESULT([yes (debug)])
5127     HAVE_GCC_OG=
5128     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5129         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5130         save_CFLAGS=$CFLAGS
5131         CFLAGS="$CFLAGS -Werror -Og"
5132         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5133         CFLAGS=$save_CFLAGS
5134         if test "$HAVE_GCC_OG" = "TRUE"; then
5135             AC_MSG_RESULT([yes])
5136         else
5137             AC_MSG_RESULT([no])
5138         fi
5139     fi
5140     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5141         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5142     fi
5143 else
5144     AC_MSG_RESULT([no])
5146 AC_SUBST(ENABLE_OPTIMIZED)
5147 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5150 # determine CPUNAME, OS, ...
5152 case "$host_os" in
5154 cygwin*|wsl*)
5155     # Already handled
5156     ;;
5158 darwin*)
5159     COM=GCC
5160     OS=MACOSX
5161     RTL_OS=MacOSX
5162     P_SEP=:
5164     case "$host_cpu" in
5165     aarch64|arm64)
5166         if test "$enable_ios_simulator" = "yes"; then
5167             OS=iOS
5168         else
5169             CPUNAME=AARCH64
5170             RTL_ARCH=AARCH64
5171             PLATFORMID=macosx_aarch64
5172         fi
5173         ;;
5174     x86_64)
5175         if test "$enable_ios_simulator" = "yes"; then
5176             OS=iOS
5177         fi
5178         CPUNAME=X86_64
5179         RTL_ARCH=X86_64
5180         PLATFORMID=macosx_x86_64
5181         ;;
5182     *)
5183         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5184         ;;
5185     esac
5186     ;;
5188 ios*)
5189     COM=GCC
5190     OS=iOS
5191     RTL_OS=iOS
5192     P_SEP=:
5194     case "$host_cpu" in
5195     aarch64|arm64)
5196         if test "$enable_ios_simulator" = "yes"; then
5197             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5198         fi
5199         ;;
5200     *)
5201         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5202         ;;
5203     esac
5204     CPUNAME=AARCH64
5205     RTL_ARCH=AARCH64
5206     PLATFORMID=ios_arm64
5207     ;;
5209 dragonfly*)
5210     COM=GCC
5211     OS=DRAGONFLY
5212     RTL_OS=DragonFly
5213     P_SEP=:
5215     case "$host_cpu" in
5216     i*86)
5217         CPUNAME=INTEL
5218         RTL_ARCH=x86
5219         PLATFORMID=dragonfly_x86
5220         ;;
5221     x86_64)
5222         CPUNAME=X86_64
5223         RTL_ARCH=X86_64
5224         PLATFORMID=dragonfly_x86_64
5225         ;;
5226     *)
5227         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5228         ;;
5229     esac
5230     ;;
5232 freebsd*)
5233     COM=GCC
5234     RTL_OS=FreeBSD
5235     OS=FREEBSD
5236     P_SEP=:
5238     case "$host_cpu" in
5239     aarch64)
5240         CPUNAME=AARCH64
5241         PLATFORMID=freebsd_aarch64
5242         RTL_ARCH=AARCH64
5243         ;;
5244     i*86)
5245         CPUNAME=INTEL
5246         RTL_ARCH=x86
5247         PLATFORMID=freebsd_x86
5248         ;;
5249     x86_64|amd64)
5250         CPUNAME=X86_64
5251         RTL_ARCH=X86_64
5252         PLATFORMID=freebsd_x86_64
5253         ;;
5254     powerpc64)
5255         CPUNAME=POWERPC64
5256         RTL_ARCH=PowerPC_64
5257         PLATFORMID=freebsd_powerpc64
5258         ;;
5259     powerpc|powerpcspe)
5260         CPUNAME=POWERPC
5261         RTL_ARCH=PowerPC
5262         PLATFORMID=freebsd_powerpc
5263         ;;
5264     *)
5265         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5266         ;;
5267     esac
5268     ;;
5270 haiku*)
5271     COM=GCC
5272     GUIBASE=haiku
5273     RTL_OS=Haiku
5274     OS=HAIKU
5275     P_SEP=:
5277     case "$host_cpu" in
5278     i*86)
5279         CPUNAME=INTEL
5280         RTL_ARCH=x86
5281         PLATFORMID=haiku_x86
5282         ;;
5283     x86_64|amd64)
5284         CPUNAME=X86_64
5285         RTL_ARCH=X86_64
5286         PLATFORMID=haiku_x86_64
5287         ;;
5288     *)
5289         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5290         ;;
5291     esac
5292     ;;
5294 kfreebsd*)
5295     COM=GCC
5296     OS=LINUX
5297     RTL_OS=kFreeBSD
5298     P_SEP=:
5300     case "$host_cpu" in
5302     i*86)
5303         CPUNAME=INTEL
5304         RTL_ARCH=x86
5305         PLATFORMID=kfreebsd_x86
5306         ;;
5307     x86_64)
5308         CPUNAME=X86_64
5309         RTL_ARCH=X86_64
5310         PLATFORMID=kfreebsd_x86_64
5311         ;;
5312     *)
5313         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5314         ;;
5315     esac
5316     ;;
5318 linux-gnu*|linux-musl*)
5319     COM=GCC
5320     OS=LINUX
5321     RTL_OS=Linux
5322     P_SEP=:
5324     case "$host_cpu" in
5326     aarch64)
5327         CPUNAME=AARCH64
5328         PLATFORMID=linux_aarch64
5329         RTL_ARCH=AARCH64
5330         EPM_FLAGS="-a arm64"
5331         ;;
5332     alpha)
5333         CPUNAME=AXP
5334         RTL_ARCH=ALPHA
5335         PLATFORMID=linux_alpha
5336         ;;
5337     arm*)
5338         CPUNAME=ARM
5339         EPM_FLAGS="-a arm"
5340         RTL_ARCH=ARM_EABI
5341         PLATFORMID=linux_arm_eabi
5342         case "$host_cpu" in
5343         arm*-linux)
5344             RTL_ARCH=ARM_OABI
5345             PLATFORMID=linux_arm_oabi
5346             ;;
5347         esac
5348         ;;
5349     hppa)
5350         CPUNAME=HPPA
5351         RTL_ARCH=HPPA
5352         EPM_FLAGS="-a hppa"
5353         PLATFORMID=linux_hppa
5354         ;;
5355     i*86)
5356         CPUNAME=INTEL
5357         RTL_ARCH=x86
5358         PLATFORMID=linux_x86
5359         ;;
5360     ia64)
5361         CPUNAME=IA64
5362         RTL_ARCH=IA64
5363         PLATFORMID=linux_ia64
5364         ;;
5365     mips)
5366         CPUNAME=MIPS
5367         RTL_ARCH=MIPS_EB
5368         EPM_FLAGS="-a mips"
5369         PLATFORMID=linux_mips_eb
5370         ;;
5371     mips64)
5372         CPUNAME=MIPS64
5373         RTL_ARCH=MIPS64_EB
5374         EPM_FLAGS="-a mips64"
5375         PLATFORMID=linux_mips64_eb
5376         ;;
5377     mips64el)
5378         CPUNAME=MIPS64
5379         RTL_ARCH=MIPS64_EL
5380         EPM_FLAGS="-a mips64el"
5381         PLATFORMID=linux_mips64_el
5382         ;;
5383     mipsel)
5384         CPUNAME=MIPS
5385         RTL_ARCH=MIPS_EL
5386         EPM_FLAGS="-a mipsel"
5387         PLATFORMID=linux_mips_el
5388         ;;
5389     riscv64)
5390         CPUNAME=RISCV64
5391         RTL_ARCH=RISCV64
5392         EPM_FLAGS="-a riscv64"
5393         PLATFORMID=linux_riscv64
5394         ;;
5395     m68k)
5396         CPUNAME=M68K
5397         RTL_ARCH=M68K
5398         PLATFORMID=linux_m68k
5399         ;;
5400     powerpc)
5401         CPUNAME=POWERPC
5402         RTL_ARCH=PowerPC
5403         PLATFORMID=linux_powerpc
5404         ;;
5405     powerpc64)
5406         CPUNAME=POWERPC64
5407         RTL_ARCH=PowerPC_64
5408         PLATFORMID=linux_powerpc64
5409         ;;
5410     powerpc64le)
5411         CPUNAME=POWERPC64
5412         RTL_ARCH=PowerPC_64_LE
5413         PLATFORMID=linux_powerpc64_le
5414         ;;
5415     sparc)
5416         CPUNAME=SPARC
5417         RTL_ARCH=SPARC
5418         PLATFORMID=linux_sparc
5419         ;;
5420     sparc64)
5421         CPUNAME=SPARC64
5422         RTL_ARCH=SPARC64
5423         PLATFORMID=linux_sparc64
5424         ;;
5425     s390x)
5426         CPUNAME=S390X
5427         RTL_ARCH=S390x
5428         PLATFORMID=linux_s390x
5429         ;;
5430     x86_64)
5431         CPUNAME=X86_64
5432         RTL_ARCH=X86_64
5433         PLATFORMID=linux_x86_64
5434         ;;
5435     loongarch64)
5436         CPUNAME=LOONGARCH64
5437         RTL_ARCH=LOONGARCH64
5438         PLATFORMID=linux_loongarch64
5439         ;;
5440     *)
5441         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5442         ;;
5443     esac
5444     ;;
5446 linux-android*)
5447     COM=GCC
5448     OS=ANDROID
5449     RTL_OS=Android
5450     P_SEP=:
5452     case "$host_cpu" in
5454     arm|armel)
5455         CPUNAME=ARM
5456         RTL_ARCH=ARM_EABI
5457         PLATFORMID=android_arm_eabi
5458         ;;
5459     aarch64)
5460         CPUNAME=AARCH64
5461         RTL_ARCH=AARCH64
5462         PLATFORMID=android_aarch64
5463         ;;
5464     i*86)
5465         CPUNAME=INTEL
5466         RTL_ARCH=x86
5467         PLATFORMID=android_x86
5468         ;;
5469     x86_64)
5470         CPUNAME=X86_64
5471         RTL_ARCH=X86_64
5472         PLATFORMID=android_x86_64
5473         ;;
5474     *)
5475         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5476         ;;
5477     esac
5478     ;;
5480 *netbsd*)
5481     COM=GCC
5482     OS=NETBSD
5483     RTL_OS=NetBSD
5484     P_SEP=:
5486     case "$host_cpu" in
5487     i*86)
5488         CPUNAME=INTEL
5489         RTL_ARCH=x86
5490         PLATFORMID=netbsd_x86
5491         ;;
5492     powerpc)
5493         CPUNAME=POWERPC
5494         RTL_ARCH=PowerPC
5495         PLATFORMID=netbsd_powerpc
5496         ;;
5497     sparc)
5498         CPUNAME=SPARC
5499         RTL_ARCH=SPARC
5500         PLATFORMID=netbsd_sparc
5501         ;;
5502     x86_64)
5503         CPUNAME=X86_64
5504         RTL_ARCH=X86_64
5505         PLATFORMID=netbsd_x86_64
5506         ;;
5507     *)
5508         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5509         ;;
5510     esac
5511     ;;
5513 openbsd*)
5514     COM=GCC
5515     OS=OPENBSD
5516     RTL_OS=OpenBSD
5517     P_SEP=:
5519     case "$host_cpu" in
5520     i*86)
5521         CPUNAME=INTEL
5522         RTL_ARCH=x86
5523         PLATFORMID=openbsd_x86
5524         ;;
5525     x86_64)
5526         CPUNAME=X86_64
5527         RTL_ARCH=X86_64
5528         PLATFORMID=openbsd_x86_64
5529         ;;
5530     *)
5531         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5532         ;;
5533     esac
5534     SOLARINC="$SOLARINC -I/usr/local/include"
5535     ;;
5537 solaris*)
5538     COM=GCC
5539     OS=SOLARIS
5540     RTL_OS=Solaris
5541     P_SEP=:
5543     case "$host_cpu" in
5544     i*86)
5545         CPUNAME=INTEL
5546         RTL_ARCH=x86
5547         PLATFORMID=solaris_x86
5548         ;;
5549     sparc)
5550         CPUNAME=SPARC
5551         RTL_ARCH=SPARC
5552         PLATFORMID=solaris_sparc
5553         ;;
5554     sparc64)
5555         CPUNAME=SPARC64
5556         RTL_ARCH=SPARC64
5557         PLATFORMID=solaris_sparc64
5558         ;;
5559     *)
5560         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5561         ;;
5562     esac
5563     SOLARINC="$SOLARINC -I/usr/local/include"
5564     ;;
5566 emscripten*)
5567     COM=GCC
5568     OS=EMSCRIPTEN
5569     RTL_OS=Emscripten
5570     P_SEP=:
5572     case "$host_cpu" in
5573     wasm32|wasm64)
5574         ;;
5575     *)
5576         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5577         ;;
5578     esac
5579     CPUNAME=INTEL
5580     RTL_ARCH=x86
5581     PLATFORMID=linux_x86
5582     ;;
5585     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5586     ;;
5587 esac
5589 DISABLE_GUI=""
5590 if test "$enable_gui" = "no"; then
5591     if test "$using_x11" != yes; then
5592         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5593     fi
5594     USING_X11=
5595     DISABLE_GUI=TRUE
5596     test_epoxy=no
5597 else
5598     AC_DEFINE(HAVE_FEATURE_UI)
5600 AC_SUBST(DISABLE_GUI)
5602 if test "$with_x" = "no"; then
5603     USING_X11=
5606 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5607     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5610 if test "$using_x11" = yes; then
5611     if test "$USING_X11" = TRUE; then
5612         AC_DEFINE(USING_X11)
5613     else
5614         disable_x11_tests
5615         if test "$DISABLE_DYNLOADING" = TRUE; then
5616             test_qt5=yes
5617             test_qt6=yes
5618         fi
5619     fi
5620 else
5621     if test "$USING_X11" = TRUE; then
5622         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5623     fi
5626 WORKDIR="${BUILDDIR}/workdir"
5627 INSTDIR="${BUILDDIR}/instdir"
5628 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5629 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5630 AC_SUBST(COM)
5631 AC_SUBST(CPUNAME)
5632 AC_SUBST(RTL_OS)
5633 AC_SUBST(RTL_ARCH)
5634 AC_SUBST(EPM_FLAGS)
5635 AC_SUBST(USING_X11)
5636 AC_SUBST([INSTDIR])
5637 AC_SUBST([INSTROOT])
5638 AC_SUBST([INSTROOTBASE])
5639 AC_SUBST(OS)
5640 AC_SUBST(P_SEP)
5641 AC_SUBST(WORKDIR)
5642 AC_SUBST(PLATFORMID)
5643 AC_SUBST(WINDOWS_X64)
5644 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5645 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5647 if test "$OS" = WNT -a "$COM" = MSC; then
5648     case "$CPUNAME" in
5649     INTEL) CPPU_ENV=msci ;;
5650     X86_64) CPPU_ENV=mscx ;;
5651     AARCH64) CPPU_ENV=msca ;;
5652     *)
5653         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5654         ;;
5655     esac
5656 else
5657     CPPU_ENV=gcc3
5659 AC_SUBST(CPPU_ENV)
5661 dnl ===================================================================
5662 dnl Test which package format to use
5663 dnl ===================================================================
5664 AC_MSG_CHECKING([which package format to use])
5665 if test -n "$with_package_format" -a "$with_package_format" != no; then
5666     for i in $with_package_format; do
5667         case "$i" in
5668         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5669             ;;
5670         *)
5671             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5672 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5673 deb - Debian software distribution
5674 pkg - Solaris software distribution
5675 rpm - RedHat software distribution
5677 LibreOffice additionally supports:
5678 archive - .tar.gz or .zip
5679 dmg - macOS .dmg
5680 installed - installation tree
5681 msi - Windows .msi
5682         ])
5683             ;;
5684         esac
5685     done
5686     # fakeroot is needed to ensure correct file ownerships/permissions
5687     # inside deb packages and tar archives created on Linux and Solaris.
5688     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5689         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5690         if test "$FAKEROOT" = "no"; then
5691             AC_MSG_ERROR(
5692                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5693         fi
5694     fi
5695     PKGFORMAT="$with_package_format"
5696     AC_MSG_RESULT([$PKGFORMAT])
5697 else
5698     PKGFORMAT=
5699     AC_MSG_RESULT([none])
5701 AC_SUBST(PKGFORMAT)
5703 dnl ===================================================================
5704 dnl handle help related options
5706 dnl If you change help related options, please update README.help
5707 dnl ===================================================================
5709 ENABLE_HTMLHELP=
5710 HELP_OMINDEX_PAGE=
5711 HELP_ONLINE=
5712 WITH_HELPPACKS=
5714 AC_MSG_CHECKING([which help to build])
5715 if test -n "$with_help" -a "$with_help" != "no"; then
5716     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5717     BUILD_TYPE="$BUILD_TYPE HELP"
5718     case "$with_help" in
5719     "html")
5720         ENABLE_HTMLHELP=TRUE
5721         WITH_HELPPACKS=TRUE
5722         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5723         AC_MSG_RESULT([HTML (local)])
5724         ;;
5725     "online")
5726         ENABLE_HTMLHELP=TRUE
5727         HELP_ONLINE=TRUE
5728         AC_MSG_RESULT([HTML (online)])
5729         ;;
5730     yes)
5731         WITH_HELPPACKS=TRUE
5732         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5733         AC_MSG_RESULT([XML (local)])
5734         ;;
5735     *)
5736         AC_MSG_ERROR([Unknown --with-help=$with_help])
5737         ;;
5738     esac
5739 else
5740     AC_MSG_RESULT([no])
5743 AC_MSG_CHECKING([if we need to build the help index tooling])
5744 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5745     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5746     test_clucene=yes
5747     AC_MSG_RESULT([yes])
5748 else
5749     AC_MSG_RESULT([no])
5752 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5753 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5754     if test "$HELP_ONLINE" != TRUE; then
5755         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5756     fi
5757     case "$with_omindex" in
5758     "server")
5759         HELP_OMINDEX_PAGE=TRUE
5760         AC_MSG_RESULT([SERVER])
5761         ;;
5762     "noxap")
5763         AC_MSG_RESULT([NOXAP])
5764         ;;
5765     *)
5766         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5767         ;;
5768     esac
5769 else
5770     AC_MSG_RESULT([no])
5773 AC_MSG_CHECKING([whether to include the XML-help support])
5774 if test "$enable_xmlhelp" = yes; then
5775     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5776     test_clucene=yes
5777     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5778     AC_MSG_RESULT([yes])
5779 else
5780     if test "$with_help" = yes; then
5781         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5782     fi
5783     AC_MSG_RESULT([no])
5786 dnl Test whether to integrate helppacks into the product's installer
5787 AC_MSG_CHECKING([for helppack integration])
5788 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5789     AC_MSG_RESULT([no integration])
5790 else
5791     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5792     AC_MSG_RESULT([integration])
5795 AC_SUBST([ENABLE_HTMLHELP])
5796 AC_SUBST([HELP_OMINDEX_PAGE])
5797 AC_SUBST([HELP_ONLINE])
5798 # WITH_HELPPACKS is used only in configure
5800 dnl ===================================================================
5801 dnl Set up a different compiler to produce tools to run on the build
5802 dnl machine when doing cross-compilation
5803 dnl ===================================================================
5805 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5806 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5807 if test "$cross_compiling" = "yes"; then
5808     AC_MSG_CHECKING([for BUILD platform configuration])
5809     echo
5810     rm -rf CONF-FOR-BUILD config_build.mk
5811     mkdir CONF-FOR-BUILD
5812     # Here must be listed all files needed when running the configure script. In particular, also
5813     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5814     # keep them in the same order as there.
5815     (cd $SRC_ROOT && tar cf - \
5816         config.guess \
5817         bin/get_config_variables \
5818         solenv/bin/getcompver.awk \
5819         solenv/inc/langlist.mk \
5820         download.lst \
5821         config_host.mk.in \
5822         config_host_lang.mk.in \
5823         Makefile.in \
5824         bin/bffvalidator.sh.in \
5825         bin/odfvalidator.sh.in \
5826         bin/officeotron.sh.in \
5827         instsetoo_native/util/openoffice.lst.in \
5828         config_host/*.in \
5829         sysui/desktop/macosx/Info.plist.in \
5830         sysui/desktop/macosx/hardened_runtime.xcent.in \
5831         sysui/desktop/macosx/lo.xcent.in \
5832         .vscode/vs-code-template.code-workspace.in \
5833         solenv/lockfile/autoconf.h.in \
5834         ) \
5835     | (cd CONF-FOR-BUILD && tar xf -)
5836     cp configure CONF-FOR-BUILD
5837     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5838     (
5839     unset COM USING_X11 OS CPUNAME
5840     unset CC CXX SYSBASE CFLAGS
5841     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5842     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5843     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5844     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5845     if test -n "$CC_FOR_BUILD"; then
5846         export CC="$CC_FOR_BUILD"
5847         CC_BASE=`first_arg_basename "$CC"`
5848     fi
5849     if test -n "$CXX_FOR_BUILD"; then
5850         export CXX="$CXX_FOR_BUILD"
5851         CXX_BASE=`first_arg_basename "$CXX"`
5852     fi
5853     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5854     cd CONF-FOR-BUILD
5856     # Handle host configuration, which affects the cross-toolset too
5857     sub_conf_opts=""
5858     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5859     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5860     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5861     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5862     if test -n "$ENABLE_JAVA"; then
5863         case "$_os" in
5864         Android)
5865             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5866             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5867             ;;
5868         *)
5869             if test -z "$with_jdk_home"; then
5870                 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.])
5871             fi
5872             ;;
5873         esac
5874     else
5875         sub_conf_opts="$sub_conf_opts --without-java"
5876     fi
5877     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5878     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5879     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5880     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5881     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5882     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5883     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5884     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5885     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5886     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5887     if test "$_os" = "Emscripten"; then
5888         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5889         if test "${with_main_module+set}" = set; then
5890             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5891         else
5892             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5893         fi
5894     fi
5895     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5896     # when cross-compiling for aarch64, overriding the defaults below
5897     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5899     # Don't bother having configure look for stuff not needed for the build platform anyway
5900     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5901     sub_conf_defaults=" \
5902         --build="$build_alias" \
5903         --disable-cairo-canvas \
5904         --disable-cups \
5905         --disable-customtarget-components \
5906         --disable-firebird-sdbc \
5907         --disable-gpgmepp \
5908         --disable-gstreamer-1-0 \
5909         --disable-gtk3 \
5910         --disable-gtk4 \
5911         --disable-libcmis \
5912         --disable-mariadb-sdbc \
5913         --disable-nss \
5914         --disable-online-update \
5915         --disable-opencl \
5916         --disable-openssl \
5917         --disable-pdfimport \
5918         --disable-postgresql-sdbc \
5919         --disable-skia \
5920         --disable-xmlhelp \
5921         --enable-dynamic-loading \
5922         --enable-icecream="$enable_icecream" \
5923         --without-gssapi \
5924         --without-doxygen \
5925         --without-tls \
5926         --without-webdav \
5927         --without-x \
5929     # single quotes added for better readability in case of spaces
5930     echo "    Running CONF-FOR-BUILD/configure" \
5931         $sub_conf_defaults \
5932         --with-parallelism="'$with_parallelism'" \
5933         --with-theme="'$with_theme'" \
5934         --with-vendor="'$with_vendor'" \
5935         $sub_conf_opts \
5936         $with_build_platform_configure_options \
5937         --srcdir=$srcdir
5939     ./configure \
5940         $sub_conf_defaults \
5941         --with-parallelism="$with_parallelism" \
5942         --with-theme="$with_theme" \
5943         "--with-vendor=$with_vendor" \
5944         $sub_conf_opts \
5945         $with_build_platform_configure_options \
5946         --srcdir=$srcdir \
5947         2>&1 | sed -e 's/^/    /'
5948     if test [${PIPESTATUS[0]}] -ne 0; then
5949         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5950     fi
5952     # filter permitted build targets
5953     PERMITTED_BUILD_TARGETS="
5954         ARGON2
5955         AVMEDIA
5956         BOOST
5957         BZIP2
5958         CAIRO
5959         CLUCENE
5960         CURL
5961         DBCONNECTIVITY
5962         DESKTOP
5963         DRAGONBOX
5964         DYNLOADING
5965         EPOXY
5966         EXPAT
5967         FROZEN
5968         GLM
5969         GRAPHITE
5970         HARFBUZZ
5971         HELPTOOLS
5972         ICU
5973         LCMS2
5974         LIBJPEG_TURBO
5975         LIBLANGTAG
5976         LibO
5977         LIBFFI
5978         LIBPN
5979         LIBTIFF
5980         LIBWEBP
5981         LIBXML2
5982         LIBXSLT
5983         MDDS
5984         NATIVE
5985         OPENSSL
5986         ORCUS
5987         PYTHON
5988         REPORTBUILDER
5989         SCRIPTING
5990         ZLIB
5991         ZXCVBN
5993     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5994     # newlined lists, to use grep as a filter
5995     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5996     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5997     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5998     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
6000     cp config_host.mk ../config_build.mk
6001     cp config_host_lang.mk ../config_build_lang.mk
6002     mv config.log ../config.Build.log
6003     mkdir -p ../config_build
6004     mv config_host/*.h ../config_build
6005     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6007     # all these will get a _FOR_BUILD postfix
6008     DIRECT_FOR_BUILD_SETTINGS="
6009         CC
6010         CPPU_ENV
6011         CXX
6012         ILIB
6013         JAVA_HOME
6014         JAVAIFLAGS
6015         JDK
6016         JDK_SECURITYMANAGER_DISALLOWED
6017         LIBO_BIN_FOLDER
6018         LIBO_LIB_FOLDER
6019         LIBO_URE_LIB_FOLDER
6020         LIBO_URE_MISC_FOLDER
6021         OS
6022         SDKDIRNAME
6023         SYSTEM_LIBXML
6024         SYSTEM_LIBXSLT
6026     # these overwrite host config with build config
6027     OVERWRITING_SETTINGS="
6028         ANT
6029         ANT_HOME
6030         ANT_LIB
6031         JAVA_SOURCE_VER
6032         JAVA_TARGET_VER
6033         JAVACFLAGS
6034         JAVACOMPILER
6035         JAVADOC
6036         JAVADOCISGJDOC
6037         LOCKFILE
6038         SYSTEM_GENBRK
6039         SYSTEM_GENCCODE
6040         SYSTEM_GENCMN
6042     # these need some special handling
6043     EXTRA_HANDLED_SETTINGS="
6044         INSTDIR
6045         INSTROOT
6046         PATH
6047         WORKDIR
6049     OLD_PATH=$PATH
6050     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6051     BUILD_PATH=$PATH
6052     PATH=$OLD_PATH
6054     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6055     echo "$line" >>build-config
6057     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6058         VV='$'$V
6059         VV=`eval "echo $VV"`
6060         if test -n "$VV"; then
6061             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6062             echo "$line" >>build-config
6063         fi
6064     done
6066     for V in $OVERWRITING_SETTINGS; do
6067         VV='$'$V
6068         VV=`eval "echo $VV"`
6069         if test -n "$VV"; then
6070             line=${V}='${'${V}:-$VV'}'
6071             echo "$line" >>build-config
6072         fi
6073     done
6075     for V in INSTDIR INSTROOT WORKDIR; do
6076         VV='$'$V
6077         VV=`eval "echo $VV"`
6078         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6079         if test -n "$VV"; then
6080             line="${V}_FOR_BUILD='$VV'"
6081             echo "$line" >>build-config
6082         fi
6083     done
6085     )
6086     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6087     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])
6088     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6089              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6091     eval `cat CONF-FOR-BUILD/build-config`
6093     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6095     rm -rf CONF-FOR-BUILD
6096 else
6097     OS_FOR_BUILD="$OS"
6098     CC_FOR_BUILD="$CC"
6099     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6100     CXX_FOR_BUILD="$CXX"
6101     INSTDIR_FOR_BUILD="$INSTDIR"
6102     INSTROOT_FOR_BUILD="$INSTROOT"
6103     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6104     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6105     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6106     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6107     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6108     WORKDIR_FOR_BUILD="$WORKDIR"
6110 AC_SUBST(OS_FOR_BUILD)
6111 AC_SUBST(INSTDIR_FOR_BUILD)
6112 AC_SUBST(INSTROOT_FOR_BUILD)
6113 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6114 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6115 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6116 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6117 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6118 AC_SUBST(WORKDIR_FOR_BUILD)
6119 AC_SUBST(CC_FOR_BUILD)
6120 AC_SUBST(CXX_FOR_BUILD)
6121 AC_SUBST(CPPU_ENV_FOR_BUILD)
6123 dnl ===================================================================
6124 dnl Check for lockfile deps
6125 dnl ===================================================================
6126 if test -z "$CROSS_COMPILING"; then
6127     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6128     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6129     AC_MSG_CHECKING([which lockfile binary to use])
6130     case "$with_system_lockfile" in
6131     yes)
6132         AC_MSG_RESULT([external])
6133         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6134         ;;
6135     no)
6136         AC_MSG_RESULT([internal])
6137         ;;
6138     *)
6139         if test -x "$with_system_lockfile"; then
6140             LOCKFILE="$with_system_lockfile"
6141         else
6142             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6143         fi
6144         AC_MSG_RESULT([$with_system_lockfile])
6145         ;;
6146     esac
6149 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6150     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6153 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6154 AC_CHECK_FUNCS([utime utimes])
6155 AC_SUBST(LOCKFILE)
6157 dnl ===================================================================
6158 dnl Check for syslog header
6159 dnl ===================================================================
6160 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6162 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6163 dnl ===================================================================
6164 AC_MSG_CHECKING([whether to turn warnings to errors])
6165 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6166     ENABLE_WERROR="TRUE"
6167     PYTHONWARNINGS="error"
6168     AC_MSG_RESULT([yes])
6169 else
6170     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6171         ENABLE_WERROR="TRUE"
6172         PYTHONWARNINGS="error"
6173         AC_MSG_RESULT([yes])
6174     else
6175         AC_MSG_RESULT([no])
6176     fi
6178 AC_SUBST(ENABLE_WERROR)
6179 AC_SUBST(PYTHONWARNINGS)
6181 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6182 dnl ===================================================================
6183 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6184 if test -z "$enable_assert_always_abort"; then
6185    if test "$ENABLE_DEBUG" = TRUE; then
6186        enable_assert_always_abort=yes
6187    else
6188        enable_assert_always_abort=no
6189    fi
6191 if test "$enable_assert_always_abort" = "yes"; then
6192     ASSERT_ALWAYS_ABORT="TRUE"
6193     AC_MSG_RESULT([yes])
6194 else
6195     ASSERT_ALWAYS_ABORT="FALSE"
6196     AC_MSG_RESULT([no])
6198 AC_SUBST(ASSERT_ALWAYS_ABORT)
6200 # Determine whether to use ooenv for the instdir installation
6201 # ===================================================================
6202 if test $_os != "WINNT" -a $_os != "Darwin"; then
6203     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6204     if test -z "$enable_ooenv"; then
6205         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6206             enable_ooenv=yes
6207         else
6208             enable_ooenv=no
6209         fi
6210     fi
6211     if test "$enable_ooenv" = "no"; then
6212         AC_MSG_RESULT([no])
6213     else
6214         ENABLE_OOENV="TRUE"
6215         AC_MSG_RESULT([yes])
6216     fi
6218 AC_SUBST(ENABLE_OOENV)
6220 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6221     if test "$enable_qt5" = "no"; then
6222         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6223     else
6224         enable_qt5=yes
6225     fi
6228 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6229     if test "$enable_qt6" = "no"; then
6230         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6231     else
6232         enable_qt6=yes
6233     fi
6237 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6238 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6239     AC_MSG_RESULT([yes])
6240     ENABLE_PAGEIN=TRUE
6241     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6242 else
6243     AC_MSG_RESULT([no])
6245 AC_SUBST(ENABLE_PAGEIN)
6247 dnl ===================================================================
6248 dnl check for cups support
6249 dnl ===================================================================
6251 AC_MSG_CHECKING([whether to enable CUPS support])
6252 if test "$test_cups" = yes -a "$enable_cups" != no; then
6253     ENABLE_CUPS=TRUE
6254     AC_MSG_RESULT([yes])
6256     AC_MSG_CHECKING([whether cups support is present])
6257     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6258     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6259     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6260         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6261     fi
6262 else
6263     AC_MSG_RESULT([no])
6266 AC_SUBST(ENABLE_CUPS)
6268 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6270 dnl whether to find & fetch external tarballs?
6271 dnl ===================================================================
6272 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6273    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6274        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6275    else
6276        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6277    fi
6279 if test -z "$TARFILE_LOCATION"; then
6280     if test -d "$SRC_ROOT/src" ; then
6281         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6282         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6283     fi
6284     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6285 else
6286     AbsolutePath "$TARFILE_LOCATION"
6287     PathFormat "${absolute_path}"
6288     TARFILE_LOCATION="${formatted_path_unix}"
6290 PathFormat "$TARFILE_LOCATION"
6291 TARFILE_LOCATION_NATIVE="$formatted_path"
6292 AC_SUBST(TARFILE_LOCATION)
6293 AC_SUBST(TARFILE_LOCATION_NATIVE)
6295 AC_MSG_CHECKING([whether we want to fetch tarballs])
6296 if test "$enable_fetch_external" != "no"; then
6297     if test "$with_all_tarballs" = "yes"; then
6298         AC_MSG_RESULT([yes, all of them])
6299         DO_FETCH_TARBALLS="ALL"
6300     else
6301         AC_MSG_RESULT([yes, if we use them])
6302         DO_FETCH_TARBALLS="TRUE"
6303     fi
6304 else
6305     AC_MSG_RESULT([no])
6306     DO_FETCH_TARBALLS=
6308 AC_SUBST(DO_FETCH_TARBALLS)
6310 dnl Test whether to include MySpell dictionaries
6311 dnl ===================================================================
6312 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6313 if test "$with_myspell_dicts" = "yes"; then
6314     AC_MSG_RESULT([yes])
6315     WITH_MYSPELL_DICTS=TRUE
6316     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6317     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6318 else
6319     AC_MSG_RESULT([no])
6320     WITH_MYSPELL_DICTS=
6322 AC_SUBST(WITH_MYSPELL_DICTS)
6324 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6325 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6326     if test "$with_system_dicts" = yes; then
6327         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6328     fi
6329     with_system_dicts=no
6332 AC_MSG_CHECKING([whether to use dicts from external paths])
6333 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6334     AC_MSG_RESULT([yes])
6335     SYSTEM_DICTS=TRUE
6336     AC_MSG_CHECKING([for spelling dictionary directory])
6337     if test -n "$with_external_dict_dir"; then
6338         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6339     else
6340         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6341         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6342             DICT_SYSTEM_DIR=file:///usr/share/myspell
6343         fi
6344     fi
6345     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6346     AC_MSG_CHECKING([for hyphenation patterns directory])
6347     if test -n "$with_external_hyph_dir"; then
6348         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6349     else
6350         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6351     fi
6352     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6353     AC_MSG_CHECKING([for thesaurus directory])
6354     if test -n "$with_external_thes_dir"; then
6355         THES_SYSTEM_DIR=file://$with_external_thes_dir
6356     else
6357         THES_SYSTEM_DIR=file:///usr/share/mythes
6358     fi
6359     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6360 else
6361     AC_MSG_RESULT([no])
6362     SYSTEM_DICTS=
6364 AC_SUBST(SYSTEM_DICTS)
6365 AC_SUBST(DICT_SYSTEM_DIR)
6366 AC_SUBST(HYPH_SYSTEM_DIR)
6367 AC_SUBST(THES_SYSTEM_DIR)
6369 dnl ===================================================================
6370 dnl Precompiled headers.
6371 ENABLE_PCH=""
6372 AC_MSG_CHECKING([whether to enable pch feature])
6373 if test -z "$enable_pch"; then
6374     if test "$_os" = "WINNT"; then
6375         # Enabled by default on Windows.
6376         enable_pch=yes
6377         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6378         if test -z "$enable_ccache" -a "$SCCACHE"; then
6379             CCACHE=""
6380         fi
6381     else
6382         enable_pch=no
6383     fi
6385 if test "$enable_pch" != no -a "$_os" = Emscripten; then
6386     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6388 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6389     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6391 if test "$enable_pch" = "system"; then
6392     ENABLE_PCH="1"
6393     AC_MSG_RESULT([yes (system headers)])
6394 elif test "$enable_pch" = "base"; then
6395     ENABLE_PCH="2"
6396     AC_MSG_RESULT([yes (system and base headers)])
6397 elif test "$enable_pch" = "normal"; then
6398     ENABLE_PCH="3"
6399     AC_MSG_RESULT([yes (normal)])
6400 elif test "$enable_pch" = "full"; then
6401     ENABLE_PCH="4"
6402     AC_MSG_RESULT([yes (full)])
6403 elif test "$enable_pch" = "yes"; then
6404     # Pick a suitable default.
6405     if test "$GCC" = "yes"; then
6406         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6407         # while making the PCHs larger and rebuilds more likely.
6408         ENABLE_PCH="2"
6409         AC_MSG_RESULT([yes (system and base headers)])
6410     else
6411         # With MSVC the highest level makes a significant difference,
6412         # and it was the default when there used to be no PCH levels.
6413         ENABLE_PCH="4"
6414         AC_MSG_RESULT([yes (full)])
6415     fi
6416 elif test "$enable_pch" = "no"; then
6417     AC_MSG_RESULT([no])
6418 else
6419     AC_MSG_ERROR([Unknown value for --enable-pch])
6421 AC_SUBST(ENABLE_PCH)
6422 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6423 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6424     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6425     if test "$CCACHE_BIN" != "not found"; then
6426         AC_MSG_CHECKING([ccache version])
6427         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6428         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6429         AC_MSG_RESULT([$CCACHE_VERSION])
6430         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6431         if test "$CCACHE_NUMVER" -gt "030701"; then
6432             AC_MSG_RESULT([yes])
6433         else
6434             AC_MSG_RESULT([no (not newer than 3.7.1)])
6435             CCACHE_DEPEND_MODE=
6436         fi
6437     fi
6440 PCH_INSTANTIATE_TEMPLATES=
6441 if test -n "$ENABLE_PCH"; then
6442     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6443     save_CFLAGS=$CFLAGS
6444     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6445     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6446     CFLAGS=$save_CFLAGS
6447     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6448         AC_MSG_RESULT(yes)
6449     else
6450         AC_MSG_RESULT(no)
6451     fi
6453 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6455 BUILDING_PCH_WITH_OBJ=
6456 if test -n "$ENABLE_PCH"; then
6457     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6458     save_CFLAGS=$CFLAGS
6459     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6460     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6461     CFLAGS=$save_CFLAGS
6462     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6463         AC_MSG_RESULT(yes)
6464     else
6465         AC_MSG_RESULT(no)
6466     fi
6468 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6470 PCH_CODEGEN=
6471 PCH_NO_CODEGEN=
6472 fpch_prefix=
6473 if test "$COM" = MSC; then
6474     fpch_prefix="-Xclang "
6476 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6477     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6478     save_CFLAGS=$CFLAGS
6479     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6480     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6481         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6482     CFLAGS=$save_CFLAGS
6483     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6484     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6485         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6486     CFLAGS=$save_CFLAGS
6487     if test -n "$PCH_CODEGEN"; then
6488         AC_MSG_RESULT(yes)
6489     else
6490         AC_MSG_RESULT(no)
6491     fi
6493 AC_SUBST(PCH_CODEGEN)
6494 AC_SUBST(PCH_NO_CODEGEN)
6495 PCH_DEBUGINFO=
6496 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6497     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6498     save_CFLAGS=$CFLAGS
6499     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6500     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6501     CFLAGS=$save_CFLAGS
6502     if test -n "$PCH_DEBUGINFO"; then
6503         AC_MSG_RESULT(yes)
6504     else
6505         AC_MSG_RESULT(no)
6506     fi
6508 AC_SUBST(PCH_DEBUGINFO)
6510 TAB=`printf '\t'`
6512 AC_MSG_CHECKING([the GNU Make version])
6513 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6514 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6515 if test "$_make_longver" -ge "040000"; then
6516     AC_MSG_RESULT([$GNUMAKE $_make_version])
6517 else
6518     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6521 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6522 STALE_MAKE=
6523 if test "$_make_ver_check" = ""; then
6524    STALE_MAKE=TRUE
6527 HAVE_LD_HASH_STYLE=FALSE
6528 WITH_LINKER_HASH_STYLE=
6529 AC_MSG_CHECKING([for --hash-style gcc linker support])
6530 if test "$GCC" = "yes"; then
6531     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6532         hash_styles="gnu sysv"
6533     elif test "$with_linker_hash_style" = "no"; then
6534         hash_styles=
6535     else
6536         hash_styles="$with_linker_hash_style"
6537     fi
6539     for hash_style in $hash_styles; do
6540         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6541         hash_style_ldflags_save=$LDFLAGS
6542         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6544         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6545             [
6546 #include <stdio.h>
6547             ],[
6548 printf ("");
6549             ])],
6550             [
6551                   HAVE_LD_HASH_STYLE=TRUE
6552                   WITH_LINKER_HASH_STYLE=$hash_style
6553             ],
6554             [HAVE_LD_HASH_STYLE=FALSE],
6555             [HAVE_LD_HASH_STYLE=FALSE])
6556         LDFLAGS=$hash_style_ldflags_save
6557     done
6559     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6560         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6561     else
6562         AC_MSG_RESULT( no )
6563     fi
6564     LDFLAGS=$hash_style_ldflags_save
6565 else
6566     AC_MSG_RESULT( no )
6568 AC_SUBST(HAVE_LD_HASH_STYLE)
6569 AC_SUBST(WITH_LINKER_HASH_STYLE)
6571 dnl ===================================================================
6572 dnl Check whether there's a Perl version available.
6573 dnl ===================================================================
6574 if test -z "$with_perl_home"; then
6575     AC_PATH_PROG(PERL, perl)
6576 else
6577     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6578     _perl_path="$with_perl_home/bin/perl"
6579     if test -x "$_perl_path"; then
6580         PERL=$_perl_path
6581     else
6582         AC_MSG_ERROR([$_perl_path not found])
6583     fi
6586 dnl ===================================================================
6587 dnl Testing for Perl version 5 or greater.
6588 dnl $] is the Perl version variable, it is returned as an integer
6589 dnl ===================================================================
6590 if test "$PERL"; then
6591     AC_MSG_CHECKING([the Perl version])
6592     ${PERL} -e "exit($]);"
6593     _perl_version=$?
6594     if test "$_perl_version" -lt 5; then
6595         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6596     fi
6597     AC_MSG_RESULT([Perl $_perl_version])
6598 else
6599     AC_MSG_ERROR([Perl not found, install Perl 5])
6602 dnl ===================================================================
6603 dnl Testing for required Perl modules
6604 dnl ===================================================================
6606 AC_MSG_CHECKING([for required Perl modules])
6607 perl_use_string="use Cwd ; use Digest::MD5"
6608 if test "$_os" = "WINNT"; then
6609     if test -n "$PKGFORMAT"; then
6610         for i in $PKGFORMAT; do
6611             case "$i" in
6612             msi)
6613                 # for getting fonts versions to use in MSI
6614                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6615                 ;;
6616             esac
6617         done
6618     fi
6620 if test "$with_system_hsqldb" = "yes"; then
6621     perl_use_string="$perl_use_string ; use Archive::Zip"
6623 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6624     # OpenSSL needs that to build
6625     perl_use_string="$perl_use_string ; use FindBin"
6627 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6628     AC_MSG_RESULT([all modules found])
6629 else
6630     AC_MSG_RESULT([failed to find some modules])
6631     # Find out which modules are missing.
6632     for i in $perl_use_string; do
6633         if test "$i" != "use" -a "$i" != ";"; then
6634             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6635                 missing_perl_modules="$missing_perl_modules $i"
6636             fi
6637         fi
6638     done
6639     AC_MSG_ERROR([
6640     The missing Perl modules are: $missing_perl_modules
6641     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6644 dnl ===================================================================
6645 dnl Check for pkg-config
6646 dnl ===================================================================
6647 if test "$_os" != "WINNT"; then
6648     PKG_PROG_PKG_CONFIG
6650 AC_SUBST(PKG_CONFIG)
6651 AC_SUBST(PKG_CONFIG_PATH)
6652 AC_SUBST(PKG_CONFIG_LIBDIR)
6654 if test "$_os" != "WINNT"; then
6656     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6657     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6658     # explicitly. Or put /path/to/compiler in PATH yourself.
6660     toolprefix=gcc
6661     if test "$COM_IS_CLANG" = "TRUE"; then
6662         toolprefix=llvm
6663     fi
6664     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6665     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6666     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6667     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6668     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6669     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6671 AC_SUBST(AR)
6672 AC_SUBST(NM)
6673 AC_SUBST(OBJDUMP)
6674 AC_SUBST(RANLIB)
6675 AC_SUBST(READELF)
6676 AC_SUBST(STRIP)
6678 dnl ===================================================================
6679 dnl pkg-config checks on macOS
6680 dnl ===================================================================
6682 if test $_os = Darwin; then
6683     AC_MSG_CHECKING([for bogus pkg-config])
6684     if test -n "$PKG_CONFIG"; then
6685         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6686             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6687         else
6688             if test "$enable_bogus_pkg_config" = "yes"; then
6689                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6690             else
6691                 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.])
6692             fi
6693         fi
6694     else
6695         AC_MSG_RESULT([no, good])
6696     fi
6699 find_csc()
6701     # Return value: $csctest
6703     unset csctest
6705     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6706     if test -n "$regvalue"; then
6707         csctest=$regvalue
6708         return
6709     fi
6712 find_al()
6714     # Return value: $altest
6716     unset altest
6718     # We need this check to detect 4.6.1 or above.
6719     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6720         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6721         PathFormat "$regvalue"
6722         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6723             altest=$regvalue
6724             return
6725         fi
6726     done
6728     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6729     for x in $reglist; do
6730         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6731         PathFormat "$regvalue"
6732         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6733             altest=$regvalue
6734             return
6735         fi
6736     done
6739 find_dotnetsdk()
6741     unset frametest
6743     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
6744         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6745         if test -n "$regvalue"; then
6746             frametest=$regvalue
6747             return
6748         fi
6749     done
6750     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6753 find_winsdk_version()
6755     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6756     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6758     unset winsdktest winsdkbinsubdir winsdklibsubdir
6760     case "$1" in
6761     8.0|8.0A)
6762         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6763         if test -n "$regvalue"; then
6764             winsdktest=$regvalue
6765             winsdklibsubdir=win8
6766             return
6767         fi
6768         ;;
6769     8.1|8.1A)
6770         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6771         if test -n "$regvalue"; then
6772             winsdktest=$regvalue
6773             winsdklibsubdir=winv6.3
6774             return
6775         fi
6776         ;;
6777     10.0)
6778         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
6779         if test -n "$regvalue"; then
6780             winsdktest=$regvalue
6781             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
6782             if test -n "$regvalue"; then
6783                 winsdkbinsubdir="$regvalue".0
6784                 winsdklibsubdir=$winsdkbinsubdir
6785                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6786                 PathFormat "$tmppath"
6787                 local tmppath_unix=$formatted_path_unix
6788                 # test exist the SDK path
6789                 if test ! -d "$tmppath_unix"; then
6790                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6791                 fi
6792             fi
6793             return
6794         fi
6795         ;;
6796     esac
6799 find_winsdk()
6801     # Return value: From find_winsdk_version
6803     unset winsdktest
6805     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6806         find_winsdk_version $ver
6807         if test -n "$winsdktest"; then
6808             return
6809         fi
6810     done
6813 find_msms()
6815     # Return value: $msmdir
6816     local version="$1"
6818     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6819     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6820     local my_msm_dir
6822     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6824     msmdir=
6825     case "$VCVER" in
6826     16.0 | 17.0 | 17.11)
6827         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6828             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6829             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6830             if test -e "$my_msm_dir${my_msm_file}"; then
6831                 msmdir=$my_msm_dir
6832             fi
6833         done
6834         ;;
6835     esac
6837     if test -n "$msmdir"; then
6838         msmdir=`cygpath -m "$msmdir"`
6839         AC_MSG_RESULT([$msmdir])
6840     else
6841         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6842             AC_MSG_FAILURE([not found])
6843         else
6844             AC_MSG_WARN([not found (check config.log)])
6845             add_warning "MSM ${my_msm_file} not found"
6846         fi
6847     fi
6850 find_msvc_x64_dlls()
6852     # Return value: $msvcdllpath, $msvcdlls
6854     AC_MSG_CHECKING([for MSVC x64 DLL path])
6856     dnl Order crtver in increasing order. Then check the directories returned by
6857     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6858     dnl the result will be the highest CRT version found in the highest directory.
6860     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6861     case "$VCVER" in
6862     16.0 | 17.0 | 17.11)
6863         for crtver in 141 142 143; do
6864             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6865                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6866                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6867                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6868                 fi
6869             done
6870         done
6871         ;;
6872     esac
6873     AC_MSG_RESULT([$msvcdllpath])
6874     AC_MSG_CHECKING([for MSVC x64 DLLs])
6875     msvcdlls="msvcp140.dll vcruntime140.dll"
6876     for dll in $msvcdlls; do
6877         if ! test -f "$msvcdllpath/$dll"; then
6878             AC_MSG_FAILURE([missing $dll])
6879         fi
6880     done
6881     AC_MSG_RESULT([found all ($msvcdlls)])
6884 dnl =========================================
6885 dnl Check for the Windows  SDK.
6886 dnl =========================================
6887 if test "$_os" = "WINNT"; then
6888     AC_MSG_CHECKING([for Windows SDK])
6889     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6890         find_winsdk
6891         WINDOWS_SDK_HOME=$winsdktest
6893         # normalize if found
6894         if test -n "$WINDOWS_SDK_HOME"; then
6895             PathFormat "$WINDOWS_SDK_HOME"
6896             WINDOWS_SDK_HOME=$formatted_path_unix
6897         fi
6899         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6900         # The variable also contains the Windows SDK version
6901         echo $WINDOWS_SDK_LIB_SUBDIR
6902         IFS='.' read -r SDK_v1 SDK_v2 SDK_v3 SDK_v4 <<< "$WINDOWS_SDK_LIB_SUBDIR"
6903         # Assuming maximum of 5 digits for each part and ignoring last part
6904         SDK_NORMALIZED_VER=$((SDK_v1 * 10000000000 + SDK_v2 * 100000 + SDK_v3))
6905         # 10.0.20348.0 is the minimum required version
6906         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
6907             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
6908         fi
6909     fi
6911     if test -n "$WINDOWS_SDK_HOME"; then
6912         # Remove a possible trailing backslash
6913         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6915         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6916              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6917              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6918             have_windows_sdk_headers=yes
6919         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6920              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6921              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6922             have_windows_sdk_headers=yes
6923         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6924              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6925              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6926             have_windows_sdk_headers=yes
6927         else
6928             have_windows_sdk_headers=no
6929         fi
6931         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6932             have_windows_sdk_libs=yes
6933         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6934             have_windows_sdk_libs=yes
6935         else
6936             have_windows_sdk_libs=no
6937         fi
6939         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6940             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6941 the  Windows SDK are installed.])
6942         fi
6943     fi
6945     if test -z "$WINDOWS_SDK_HOME"; then
6946         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6947     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6948         WINDOWS_SDK_VERSION=80
6949         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6950     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6951         WINDOWS_SDK_VERSION=81
6952         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6953     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6954         WINDOWS_SDK_VERSION=10
6955         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6956     else
6957         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6958     fi
6959     PathFormat "$WINDOWS_SDK_HOME"
6960     WINDOWS_SDK_HOME="$formatted_path"
6961     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6962     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6963         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6964         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
6965             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6966         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
6967             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6968         fi
6969     fi
6971     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6972     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6973     dnl but not in v8.0), so allow this to be overridden with a
6974     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6975     dnl and configuration error if no WiLangId.vbs is found would arguably be
6976     dnl better, but I do not know under which conditions exactly it is needed by
6977     dnl msiglobal.pm:
6978     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6979         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6980         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6981             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6982         fi
6983         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6984             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6985         fi
6986         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6987             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
6988         fi
6989         PathFormat "$WINDOWS_SDK_WILANGID_unix"
6990         WINDOWS_SDK_WILANGID="$formatted_path"
6991     fi
6992     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6993         if test -n "$with_package_format" -a "$with_package_format" != no; then
6994             for i in "$with_package_format"; do
6995                 if test "$i" = "msi"; then
6996                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6997                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6998                     fi
6999                 fi
7000             done
7001         fi
7002     fi
7004 AC_SUBST(WINDOWS_SDK_HOME)
7005 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7006 AC_SUBST(WINDOWS_SDK_VERSION)
7007 AC_SUBST(WINDOWS_SDK_WILANGID)
7009 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7010     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7011     dnl dir, it also determines that dir's path w/o an arch segment if any,
7012     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7013     AC_MSG_CHECKING([for midl.exe])
7015     find_winsdk
7016     PathFormat "$winsdktest"
7017     winsdktest_unix="$formatted_path_unix"
7019     if test -n "$winsdkbinsubdir" \
7020         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7021     then
7022         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7023         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7024     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7025         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7026         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7027     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7028         MIDL_PATH=$winsdktest_unix/Bin
7029         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7030     fi
7031     PathFormat "$MIDL_PATH"
7032     if test ! -f "$formatted_path_unix/midl.exe"; then
7033         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7034     else
7035         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7036     fi
7038     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7039     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7041     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7042          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7043          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7044          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7045     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7046          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7047          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7048          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7049     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7050          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7051          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7052          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7053     else
7054         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7055     fi
7057     dnl Check csc.exe
7058     AC_MSG_CHECKING([for csc.exe])
7059     find_csc
7060     PathFormat "$csctest"
7061     csctest_unix="$formatted_path_unix"
7062     if test -f "$csctest_unix/csc.exe"; then
7063         CSC_PATH="$csctest"
7064     fi
7065     if test ! -f "$csctest_unix/csc.exe"; then
7066         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7067     else
7068         AC_MSG_RESULT([$CSC_PATH/csc.exe])
7069     fi
7071     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7073     dnl Check al.exe
7074     AC_MSG_CHECKING([for al.exe])
7075     if test -n "$winsdkbinsubdir" \
7076         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7077     then
7078         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7079     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7080         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7081     elif test -f "$winsdktest_unix/Bin/al.exe"; then
7082         AL_PATH="$winsdktest/Bin"
7083     fi
7085     if test -z "$AL_PATH"; then
7086         find_al
7087         PathFormat "$altest"
7088         altest_unix="$formatted_path_unix"
7089         if test -f "$altest_unix/bin/al.exe"; then
7090             AL_PATH="$altest/bin"
7091         elif test -f "$altest_unix/al.exe"; then
7092             AL_PATH="$altest"
7093         fi
7094     fi
7095     PathFormat "$AL_PATH"
7096     if test ! -f "$formatted_path_unix/al.exe"; then
7097         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7098     else
7099         AC_MSG_RESULT([$AL_PATH/al.exe])
7100     fi
7102     AL_PATH=`win_short_path_for_make "$AL_PATH"`
7104     dnl Check mscoree.lib / .NET Framework dir
7105     AC_MSG_CHECKING(.NET Framework)
7106     find_dotnetsdk
7107     PathFormat "$frametest"
7108     frametest="$formatted_path_unix"
7109     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7110         DOTNET_FRAMEWORK_HOME="$frametest"
7111     else
7112         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7113             DOTNET_FRAMEWORK_HOME="$winsdktest"
7114         fi
7115     fi
7116     PathFormat "$DOTNET_FRAMEWORK_HOME"
7117     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
7118         AC_MSG_ERROR([mscoree.lib not found])
7119     fi
7120     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7122     PathFormat "$MIDL_PATH"
7123     MIDL_PATH="$formatted_path"
7125     PathFormat "$AL_PATH"
7126     AL_PATH="$formatted_path"
7128     PathFormat "$DOTNET_FRAMEWORK_HOME"
7129     DOTNET_FRAMEWORK_HOME="$formatted_path"
7131     PathFormat "$CSC_PATH"
7132     CSC_PATH="$formatted_path"
7135 dnl ===================================================================
7136 dnl Testing for C++ compiler and version...
7137 dnl ===================================================================
7139 if test "$_os" != "WINNT"; then
7140     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7141     # see AC_PROG_CC above):
7142     save_CXXFLAGS=$CXXFLAGS
7143     CXXFLAGS=-g
7144     AC_PROG_CXX
7145     CXXFLAGS=$save_CXXFLAGS
7146     if test -z "$CXX_BASE"; then
7147         CXX_BASE=`first_arg_basename "$CXX"`
7148     fi
7151 dnl check for GNU C++ compiler version
7152 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7153     AC_MSG_CHECKING([the GNU C++ compiler version])
7155     _gpp_version=`$CXX -dumpversion`
7156     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7158     if test "$_gpp_majmin" -lt "700"; then
7159         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7160     else
7161         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7162     fi
7164     dnl see https://issuetracker.google.com/issues/36962819
7165         glibcxx_threads=no
7166         AC_LANG_PUSH([C++])
7167         AC_REQUIRE_CPP
7168         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7169         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7170             #include <bits/c++config.h>]],[[
7171             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7172             && !defined(_GLIBCXX__PTHREADS) \
7173             && !defined(_GLIBCXX_HAS_GTHREADS)
7174             choke me
7175             #endif
7176         ]])],[AC_MSG_RESULT([yes])
7177         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7178         AC_LANG_POP([C++])
7179         if test $glibcxx_threads = yes; then
7180             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7181         fi
7183 AC_SUBST(BOOST_CXXFLAGS)
7186 # prefx CXX with ccache if needed
7188 if test "$CCACHE" != ""; then
7189     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7190     AC_LANG_PUSH([C++])
7191     save_CXXFLAGS=$CXXFLAGS
7192     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7193     # msvc does not fail on unknown options, check stdout
7194     if test "$COM" = MSC; then
7195         CXXFLAGS="$CXXFLAGS -nologo"
7196     fi
7197     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7198     ac_cxx_werror_flag=yes
7199     dnl an empty program will do, we're checking the compiler flags
7200     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7201                       [use_ccache=yes], [use_ccache=no])
7202     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7203         AC_MSG_RESULT([yes])
7204     else
7205         CXX="$CCACHE $CXX"
7206         CXX_BASE="ccache $CXX_BASE"
7207         AC_MSG_RESULT([no])
7208     fi
7209     CXXFLAGS=$save_CXXFLAGS
7210     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7211     AC_LANG_POP([C++])
7214 dnl ===================================================================
7215 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7216 dnl ===================================================================
7218 if test "$_os" != "WINNT"; then
7219     AC_PROG_CXXCPP
7221     dnl Check whether there's a C pre-processor.
7222     AC_PROG_CPP
7226 dnl ===================================================================
7227 dnl Find integral type sizes and alignments
7228 dnl ===================================================================
7230 if test "$_os" != "WINNT"; then
7232     AC_CHECK_SIZEOF(long)
7233     AC_CHECK_SIZEOF(short)
7234     AC_CHECK_SIZEOF(int)
7235     AC_CHECK_SIZEOF(long long)
7236     AC_CHECK_SIZEOF(double)
7237     AC_CHECK_SIZEOF(void*)
7238     AC_CHECK_SIZEOF(size_t)
7240     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7241     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7242     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7243     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7244     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7245     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7247     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7248     m4_pattern_allow([AC_CHECK_ALIGNOF])
7249     m4_ifdef([AC_CHECK_ALIGNOF],
7250         [
7251             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7252             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7253             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7254             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7255         ],
7256         [
7257             case "$_os-$host_cpu" in
7258             Linux-i686)
7259                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7260                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7261                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7262                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7263                 ;;
7264             Linux-x86_64)
7265                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7266                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7267                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7268                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7269                 ;;
7270             *)
7271                 if test -z "$ac_cv_alignof_short" -o \
7272                         -z "$ac_cv_alignof_int" -o \
7273                         -z "$ac_cv_alignof_long" -o \
7274                         -z "$ac_cv_alignof_double"; then
7275                    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.])
7276                 fi
7277                 ;;
7278             esac
7279         ])
7281     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7282     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7283     if test $ac_cv_sizeof_long -eq 8; then
7284         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7285     elif test $ac_cv_sizeof_double -eq 8; then
7286         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7287     else
7288         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7289     fi
7291     dnl Check for large file support
7292     AC_SYS_LARGEFILE
7293     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
7294         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7295     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7296         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7297     fi
7298     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7299         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7300     fi
7301 else
7302     # Hardcode for MSVC
7303     SAL_TYPES_SIZEOFSHORT=2
7304     SAL_TYPES_SIZEOFINT=4
7305     SAL_TYPES_SIZEOFLONG=4
7306     SAL_TYPES_SIZEOFLONGLONG=8
7307     if test $WIN_HOST_BITS -eq 32; then
7308         SAL_TYPES_SIZEOFPOINTER=4
7309         SIZEOF_SIZE_T=4
7310     else
7311         SAL_TYPES_SIZEOFPOINTER=8
7312         SIZEOF_SIZE_T=8
7313     fi
7314     SAL_TYPES_ALIGNMENT2=2
7315     SAL_TYPES_ALIGNMENT4=4
7316     SAL_TYPES_ALIGNMENT8=8
7317     LFS_CFLAGS=''
7319 AC_SUBST(LFS_CFLAGS)
7320 AC_SUBST(SIZEOF_SIZE_T)
7322 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7323 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7324 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7325 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7326 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7327 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7328 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7329 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7331 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7332 AC_MSG_CHECKING([whether jumbo sheets are supported])
7333 if test "$_os" != "WINNT"; then
7334     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7335         AC_MSG_RESULT([yes])
7336         ENABLE_JUMBO_SHEETS=TRUE
7337         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7338     else
7339         AC_MSG_RESULT([no])
7340     fi
7341 else
7342     if test $WIN_HOST_BITS -gt 32; then
7343         # 64bit windows is special-cased for tools::Long because long is 32bit
7344         AC_MSG_RESULT([yes])
7345         ENABLE_JUMBO_SHEETS=TRUE
7346         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7347     else
7348         AC_MSG_RESULT([no])
7349     fi
7351 AC_SUBST(ENABLE_JUMBO_SHEETS)
7353 dnl ===================================================================
7354 dnl Check whether to enable runtime optimizations
7355 dnl ===================================================================
7356 ENABLE_RUNTIME_OPTIMIZATIONS=
7357 AC_MSG_CHECKING([whether to enable runtime optimizations])
7358 if test -z "$enable_runtime_optimizations"; then
7359     for i in $CC; do
7360         case $i in
7361         -fsanitize=*)
7362             enable_runtime_optimizations=no
7363             break
7364             ;;
7365         esac
7366     done
7368 if test "$enable_runtime_optimizations" != no; then
7369     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7370     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7371     AC_MSG_RESULT([yes])
7372 else
7373     AC_MSG_RESULT([no])
7375 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7377 dnl ===================================================================
7378 dnl Check if valgrind headers are available
7379 dnl ===================================================================
7380 ENABLE_VALGRIND=
7381 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7382     prev_cppflags=$CPPFLAGS
7383     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7384     # or where does it come from?
7385     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7386     AC_CHECK_HEADER([valgrind/valgrind.h],
7387         [ENABLE_VALGRIND=TRUE])
7388     CPPFLAGS=$prev_cppflags
7390 AC_SUBST([ENABLE_VALGRIND])
7391 if test -z "$ENABLE_VALGRIND"; then
7392     if test "$with_valgrind" = yes; then
7393         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7394     fi
7395     VALGRIND_CFLAGS=
7397 AC_SUBST([VALGRIND_CFLAGS])
7400 dnl ===================================================================
7401 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7402 dnl ===================================================================
7404 # We need at least the sys/sdt.h include header.
7405 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7406 if test "$SDT_H_FOUND" = "TRUE"; then
7407     # Found sys/sdt.h header, now make sure the c++ compiler works.
7408     # Old g++ versions had problems with probes in constructors/destructors.
7409     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7410     AC_LANG_PUSH([C++])
7411     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7412     #include <sys/sdt.h>
7413     class ProbeClass
7414     {
7415     private:
7416       int& ref;
7417       const char *name;
7419     public:
7420       ProbeClass(int& v, const char *n) : ref(v), name(n)
7421       {
7422         DTRACE_PROBE2(_test_, cons, name, ref);
7423       }
7425       void method(int min)
7426       {
7427         DTRACE_PROBE3(_test_, meth, name, ref, min);
7428         ref -= min;
7429       }
7431       ~ProbeClass()
7432       {
7433         DTRACE_PROBE2(_test_, dest, name, ref);
7434       }
7435     };
7436     ]],[[
7437     int i = 64;
7438     DTRACE_PROBE1(_test_, call, i);
7439     ProbeClass inst = ProbeClass(i, "call");
7440     inst.method(24);
7441     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7442           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7443     AC_LANG_POP([C++])
7445 AC_CONFIG_HEADERS([config_host/config_probes.h])
7447 dnl ===================================================================
7448 dnl GCC features
7449 dnl ===================================================================
7450 HAVE_GCC_STACK_CLASH_PROTECTION=
7451 HARDENING_CFLAGS=
7452 HARDENING_OPT_CFLAGS=
7453 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7454     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7455     save_CFLAGS=$CFLAGS
7456     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7457     AC_LINK_IFELSE(
7458         [AC_LANG_PROGRAM(, [[return 0;]])],
7459         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7460         [AC_MSG_RESULT([no])])
7461     CFLAGS=$save_CFLAGS
7463     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7464     save_CFLAGS=$CFLAGS
7465     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7466     if test "$ENABLE_OPTIMIZED" = TRUE; then
7467         CFLAGS="$CFLAGS -O2"
7468     fi
7469     AC_LINK_IFELSE(
7470         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7471         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7472         [AC_MSG_RESULT([no])])
7473     CFLAGS=$save_CFLAGS
7475     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7476     save_CFLAGS=$CFLAGS
7477     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7478     AC_LINK_IFELSE(
7479         [AC_LANG_PROGRAM(, [[return 0;]])],
7480         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7481         [AC_MSG_RESULT([no])])
7482     CFLAGS=$save_CFLAGS
7484     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7485     save_CFLAGS=$CFLAGS
7486     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7487     AC_LINK_IFELSE(
7488         [AC_LANG_PROGRAM(, [[return 0;]])],
7489         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7490         [AC_MSG_RESULT([no])])
7491     CFLAGS=$save_CFLAGS
7493     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7494     save_CFLAGS=$CFLAGS
7495     CFLAGS="$CFLAGS -Werror -fcf-protection"
7496     AC_LINK_IFELSE(
7497         [AC_LANG_PROGRAM(, [[return 0;]])],
7498         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7499         [AC_MSG_RESULT([no])])
7500     CFLAGS=$save_CFLAGS
7502     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7503     save_CFLAGS=$CFLAGS
7504     CFLAGS="$CFLAGS -Werror -mno-avx"
7505     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7506     CFLAGS=$save_CFLAGS
7507     if test "$HAVE_GCC_AVX" = "TRUE"; then
7508         AC_MSG_RESULT([yes])
7509     else
7510         AC_MSG_RESULT([no])
7511     fi
7513     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7514     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7515     int v = 0;
7516     if (__sync_add_and_fetch(&v, 1) != 1 ||
7517         __sync_sub_and_fetch(&v, 1) != 0)
7518         return 1;
7519     __sync_synchronize();
7520     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7521         v != 1)
7522         return 1;
7523     return 0;
7524 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7525     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7526         AC_MSG_RESULT([yes])
7527         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7528     else
7529         AC_MSG_RESULT([no])
7530     fi
7532     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7533     AC_LANG_PUSH([C++])
7534     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7535             #include <cstddef>
7536             #include <cxxabi.h>
7537             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7538         ])], [
7539             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7540             AC_MSG_RESULT([yes])
7541         ], [AC_MSG_RESULT([no])])
7542     AC_LANG_POP([C++])
7544     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7545     AC_LANG_PUSH([C++])
7546     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7547             #include <cstddef>
7548             #include <cxxabi.h>
7549             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7550         ])], [
7551             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7552             AC_MSG_RESULT([yes])
7553         ], [AC_MSG_RESULT([no])])
7554     AC_LANG_POP([C++])
7556     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7557     AC_LANG_PUSH([C++])
7558     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7559             #include <cxxabi.h>
7560             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7561         ])], [
7562             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7563             AC_MSG_RESULT([yes])
7564         ], [AC_MSG_RESULT([no])])
7565     AC_LANG_POP([C++])
7567     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7568     AC_LANG_PUSH([C++])
7569     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7570             #include <cstddef>
7571             #include <cxxabi.h>
7572             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7573         ])], [
7574             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7575             AC_MSG_RESULT([yes])
7576         ], [AC_MSG_RESULT([no])])
7577     AC_LANG_POP([C++])
7579     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7580     AC_LANG_PUSH([C++])
7581     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7582             #include <cstddef>
7583             #include <cxxabi.h>
7584             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7585         ])], [
7586             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7587             AC_MSG_RESULT([yes])
7588         ], [AC_MSG_RESULT([no])])
7589     AC_LANG_POP([C++])
7591     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7592     AC_LANG_PUSH([C++])
7593     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7594             #include <cxxabi.h>
7595             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7596         ])], [
7597             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7598             AC_MSG_RESULT([yes])
7599         ], [AC_MSG_RESULT([no])])
7600     AC_LANG_POP([C++])
7602     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7603     AC_LANG_PUSH([C++])
7604     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7605             #include <cxxabi.h>
7606             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7607         ])], [
7608             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7609             AC_MSG_RESULT([yes])
7610         ], [AC_MSG_RESULT([no])])
7611     AC_LANG_POP([C++])
7613     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7614     AC_LANG_PUSH([C++])
7615     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7616             #include <cxxabi.h>
7617             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7618         ])], [
7619             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7620             AC_MSG_RESULT([yes])
7621         ], [AC_MSG_RESULT([no])])
7622     AC_LANG_POP([C++])
7624     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7625     AC_LANG_PUSH([C++])
7626     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7627             #include <cstddef>
7628             #include <cxxabi.h>
7629             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7630         ])], [
7631             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7632             AC_MSG_RESULT([yes])
7633         ], [AC_MSG_RESULT([no])])
7634     AC_LANG_POP([C++])
7636     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7637     AC_LANG_PUSH([C++])
7638     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7639             #include <cstddef>
7640             #include <cxxabi.h>
7641             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7642         ])], [
7643             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7644             AC_MSG_RESULT([yes])
7645         ], [AC_MSG_RESULT([no])])
7646     AC_LANG_POP([C++])
7649 AC_SUBST(HAVE_GCC_AVX)
7650 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7651 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7652 AC_SUBST(HARDENING_CFLAGS)
7653 AC_SUBST(HARDENING_OPT_CFLAGS)
7655 dnl ===================================================================
7656 dnl Identify the C++ library
7657 dnl ===================================================================
7659 AC_MSG_CHECKING([what the C++ library is])
7660 HAVE_LIBSTDCPP=
7661 HAVE_LIBCPP=
7662 AC_LANG_PUSH([C++])
7663 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7664 #include <utility>
7665 #ifndef __GLIBCXX__
7666 foo bar
7667 #endif
7668 ]])],
7669     [CPP_LIBRARY=GLIBCXX
7670      cpp_library_name="GNU libstdc++"
7671      HAVE_LIBSTDCPP=TRUE
7672     ],
7673     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7674 #include <utility>
7675 #ifndef _LIBCPP_VERSION
7676 foo bar
7677 #endif
7678 ]])],
7679     [CPP_LIBRARY=LIBCPP
7680      cpp_library_name="LLVM libc++"
7681      AC_DEFINE([HAVE_LIBCPP])
7682      HAVE_LIBCPP=TRUE
7683     ],
7684     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7685 #include <utility>
7686 #ifndef _MSC_VER
7687 foo bar
7688 #endif
7689 ]])],
7690     [CPP_LIBRARY=MSVCRT
7691      cpp_library_name="Microsoft"
7692     ],
7693     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7694 AC_MSG_RESULT([$cpp_library_name])
7695 AC_LANG_POP([C++])
7696 AC_SUBST([HAVE_LIBSTDCPP])
7697 AC_SUBST([HAVE_LIBCPP])
7699 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7700 then
7701     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7702     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7703     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7704     # although there will be backwards compatibility).
7705     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7706     # and there would be undefined references to debug functions.
7707     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7708     # So check if debug mode can be used and disable or downgrade it to assertions
7709     # if needed.
7710     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7711     AC_LANG_PUSH([C++])
7712     libcpp_debug_links=
7713     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7714 #define _LIBCPP_DEBUG 0 // only assertions
7715 #include <vector>
7716 int main()
7718     std::vector<int> v;
7719     v.push_back( 1 );
7720     return v[ 3 ];
7722 ]])], [libcpp_debug_links=1])
7723     if test -n "$libcpp_debug_links"; then
7724         # we can use at least assertions, check if debug mode works
7725         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7726 #define _LIBCPP_DEBUG 1 // debug mode
7727 #include <string>
7728 #include <vector>
7729 int foo(const std::vector<int>& v) { return *v.begin(); }
7730 int main()
7732     std::vector<int> v;
7733     v.push_back( 1 );
7734     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7735     return (foo(v) + s.size()) != 0 ? 0 : 1;
7737 ]])],
7738         [AC_MSG_RESULT(yes)
7739          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7740         ],
7741         [AC_MSG_RESULT(no, using only assertions)
7742          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7743         ]
7744         )
7745     else
7746         AC_MSG_RESULT(no)
7747     fi
7748     AC_LANG_POP([C++])
7750 AC_SUBST([LIBCPP_DEBUG])
7752 dnl ===================================================================
7753 dnl Check for gperf
7754 dnl ===================================================================
7755 AC_PATH_PROG(GPERF, gperf)
7756 if test -z "$GPERF"; then
7757     AC_MSG_ERROR([gperf not found but needed. Install it.])
7759 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7760     GPERF=`cygpath -m $GPERF`
7762 AC_MSG_CHECKING([whether gperf is new enough])
7763 my_gperf_ver1=$($GPERF --version | head -n 1)
7764 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7765 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7766 if test "$my_gperf_ver3" -ge 301; then
7767     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7768 else
7769     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7771 AC_SUBST(GPERF)
7773 dnl ===================================================================
7774 dnl Check for system libcmis
7775 dnl ===================================================================
7776 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7778 dnl ===================================================================
7779 dnl C++11
7780 dnl ===================================================================
7782 if test -z "${CXXFLAGS_CXX11+x}"; then
7783     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7784     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7785         if test "$with_latest_c__" = yes; then
7786             CXXFLAGS_CXX11=-std:c++latest
7787         else
7788             CXXFLAGS_CXX11=-std:c++20
7789         fi
7790         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7791     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7792         my_flags='-std=c++20 -std=c++2a'
7793         if test "$with_latest_c__" = yes; then
7794             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7795         fi
7796         for flag in $my_flags; do
7797             if test "$COM" = MSC; then
7798                 flag="-Xclang $flag"
7799             fi
7800             save_CXXFLAGS=$CXXFLAGS
7801             CXXFLAGS="$CXXFLAGS $flag -Werror"
7802             AC_LANG_PUSH([C++])
7803             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7804                 #include <algorithm>
7805                 #include <functional>
7806                 #include <vector>
7808                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7809                     std::sort(v.begin(), v.end(), fn);
7810                 }
7811                 ]])],[CXXFLAGS_CXX11=$flag])
7812             AC_LANG_POP([C++])
7813             CXXFLAGS=$save_CXXFLAGS
7814             if test -n "$CXXFLAGS_CXX11"; then
7815                 break
7816             fi
7817         done
7818     fi
7819     if test -n "$CXXFLAGS_CXX11"; then
7820         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7821     else
7822         AC_MSG_ERROR(no)
7823     fi
7825 AC_SUBST(CXXFLAGS_CXX11)
7827 if test "$GCC" = "yes"; then
7828     save_CXXFLAGS=$CXXFLAGS
7829     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7830     CHECK_L_ATOMIC
7831     CXXFLAGS=$save_CXXFLAGS
7832     AC_SUBST(ATOMIC_LIB)
7835 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7836 save_CXXFLAGS=$CXXFLAGS
7837 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7838 AC_LANG_PUSH([C++])
7840 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7841 #include <stddef.h>
7843 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7845 namespace
7847         struct b
7848         {
7849                 int i;
7850                 int j;
7851         };
7853 ]], [[
7854 struct a
7856         int i;
7857         int j;
7859 a thinga[]={{0,0}, {1,1}};
7860 b thingb[]={{0,0}, {1,1}};
7861 size_t i = sizeof(sal_n_array_size(thinga));
7862 size_t j = sizeof(sal_n_array_size(thingb));
7863 return !(i != 0 && j != 0);
7865     ], [ AC_MSG_RESULT(yes) ],
7866     [ AC_MSG_ERROR(no)])
7867 AC_LANG_POP([C++])
7868 CXXFLAGS=$save_CXXFLAGS
7870 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7871 if test "$GCC" = yes; then
7872     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7873     AC_LANG_PUSH([C++])
7874     save_CXXFLAGS=$CXXFLAGS
7875     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7876     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7877     CXXFLAGS=$save_CXXFLAGS
7878     AC_LANG_POP([C++])
7879     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7880         AC_MSG_RESULT([yes])
7881     else
7882         AC_MSG_RESULT([no])
7883     fi
7885 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7887 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7888 AC_LANG_PUSH([C++])
7889 save_CXXFLAGS=$CXXFLAGS
7890 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7891 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7892         #include <algorithm>
7893         #include <initializer_list>
7894         #include <vector>
7895         template<typename T> class S {
7896         private:
7897             std::vector<T> v_;
7898         public:
7899             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7900         };
7901         constinit S<int> s{3, 2, 1};
7902     ])], [
7903         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7904         AC_MSG_RESULT([yes])
7905     ], [AC_MSG_RESULT([no])])
7906 CXXFLAGS=$save_CXXFLAGS
7907 AC_LANG_POP([C++])
7909 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7910 AC_LANG_PUSH([C++])
7911 save_CXXFLAGS=$CXXFLAGS
7912 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7913 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7914         struct S1 { S1(S1 &&); };
7915         struct S2: S1 {};
7916         S1 f(S2 s) { return s; }
7917     ])], [
7918         AC_DEFINE([HAVE_P1155R3],[1])
7919         AC_MSG_RESULT([yes])
7920     ], [AC_MSG_RESULT([no])])
7921 CXXFLAGS=$save_CXXFLAGS
7922 AC_LANG_POP([C++])
7924 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7925 HAVE_CXX20_ATOMIC_REF=
7926 AC_LANG_PUSH([C++])
7927 save_CXXFLAGS=$CXXFLAGS
7928 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7929 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7930         #include <atomic>
7931         int x;
7932         std::atomic_ref<int> y(x);
7933     ])], [
7934         HAVE_CXX20_ATOMIC_REF=TRUE
7935         AC_MSG_RESULT([yes])
7936     ], [AC_MSG_RESULT([no])])
7937 CXXFLAGS=$save_CXXFLAGS
7938 AC_LANG_POP([C++])
7939 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7941 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7942 dnl which is included in -Wextra anyway):
7943 HAVE_WDEPRECATED_COPY_DTOR=
7944 if test "$GCC" = yes; then
7945     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7946     AC_LANG_PUSH([C++])
7947     save_CXXFLAGS=$CXXFLAGS
7948     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7949     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7950             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7951             AC_MSG_RESULT([yes])
7952         ], [AC_MSG_RESULT([no])])
7953     CXXFLAGS=$save_CXXFLAGS
7954     AC_LANG_POP([C++])
7956 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7958 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7959 dnl uninitialized warning for code like
7961 dnl   OString f();
7962 dnl   boost::optional<OString> * g(bool b) {
7963 dnl       boost::optional<OString> o;
7964 dnl       if (b) o = f();
7965 dnl       return new boost::optional<OString>(o);
7966 dnl   }
7968 dnl (as is e.g. present, in a slightly more elaborate form, in
7969 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7970 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7971 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7972 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7973     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7974     AC_LANG_PUSH([C++])
7975     save_CXXFLAGS=$CXXFLAGS
7976     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7977     if test "$ENABLE_OPTIMIZED" = TRUE; then
7978         CXXFLAGS="$CXXFLAGS -O2"
7979     else
7980         CXXFLAGS="$CXXFLAGS -O0"
7981     fi
7982     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7983             #include <new>
7984             void f1(int);
7985             struct S1 {
7986                 ~S1() { f1(n); }
7987                 int n = 0;
7988             };
7989             struct S2 {
7990                 S2() {}
7991                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7992                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7993                 void set(S1 s) {
7994                     new (stg) S1(s);
7995                     init = true;
7996                 }
7997                 bool init = false;
7998                 char stg[sizeof (S1)];
7999             } ;
8000             S1 f2();
8001             S2 * f3(bool b) {
8002                 S2 o;
8003                 if (b) o.set(f2());
8004                 return new S2(o);
8005             }
8006         ]])], [AC_MSG_RESULT([no])], [
8007             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8008             AC_MSG_RESULT([yes])
8009         ])
8010     CXXFLAGS=$save_CXXFLAGS
8011     AC_LANG_POP([C++])
8013 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8015 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8016 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8017 dnl hits us e.g. with GCC 10 and --enable-optimized at
8019 dnl   In file included from include/rtl/string.hxx:49,
8020 dnl                    from include/rtl/ustring.hxx:43,
8021 dnl                    from include/osl/file.hxx:35,
8022 dnl                    from include/codemaker/global.hxx:28,
8023 dnl                    from include/codemaker/options.hxx:23,
8024 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8025 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8026 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,
8027 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,
8028 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,
8029 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8030 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8031 dnl      78 |         memcpy( buffer, data, length );
8032 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8033 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8034 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8035     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8036     AC_LANG_PUSH([C++])
8037     save_CXXFLAGS=$CXXFLAGS
8038     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8039     if test "$ENABLE_OPTIMIZED" = TRUE; then
8040         CXXFLAGS="$CXXFLAGS -O2"
8041     else
8042         CXXFLAGS="$CXXFLAGS -O0"
8043     fi
8044     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8045     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8046             void fill(char const * begin, char const * end, char c);
8047             struct q {
8048                 char ids[4];
8049                 char username[6];
8050             };
8051             void test(q & c) {
8052                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8053                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8054             }
8055         ]])], [AC_MSG_RESULT([no])], [
8056             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8057             AC_MSG_RESULT([yes])
8058         ])
8059     CXXFLAGS=$save_CXXFLAGS
8060     AC_LANG_POP([C++])
8062 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8064 HAVE_DLLEXPORTINLINES=
8065 if test "$_os" = "WINNT"; then
8066     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8067     AC_LANG_PUSH([C++])
8068     save_CXXFLAGS=$CXXFLAGS
8069     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8070     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8071             HAVE_DLLEXPORTINLINES=TRUE
8072             AC_MSG_RESULT([yes])
8073         ], [AC_MSG_RESULT([no])])
8074     CXXFLAGS=$save_CXXFLAGS
8075     AC_LANG_POP([C++])
8077 AC_SUBST([HAVE_DLLEXPORTINLINES])
8079 dnl ===================================================================
8080 dnl CPU Intrinsics support - SSE, AVX
8081 dnl ===================================================================
8083 CXXFLAGS_INTRINSICS_SSE2=
8084 CXXFLAGS_INTRINSICS_SSSE3=
8085 CXXFLAGS_INTRINSICS_SSE41=
8086 CXXFLAGS_INTRINSICS_SSE42=
8087 CXXFLAGS_INTRINSICS_AVX=
8088 CXXFLAGS_INTRINSICS_AVX2=
8089 CXXFLAGS_INTRINSICS_AVX512=
8090 CXXFLAGS_INTRINSICS_AVX512F=
8091 CXXFLAGS_INTRINSICS_F16C=
8092 CXXFLAGS_INTRINSICS_FMA=
8094 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8095     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8096     flag_sse2=-msse2
8097     flag_ssse3=-mssse3
8098     flag_sse41=-msse4.1
8099     flag_sse42=-msse4.2
8100     flag_avx=-mavx
8101     flag_avx2=-mavx2
8102     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8103     flag_avx512f=-mavx512f
8104     flag_f16c=-mf16c
8105     flag_fma=-mfma
8106 else
8107     # With MSVC using -arch is in fact not necessary for being able
8108     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8109     # even if compiled with -arch:AVX, the -arch option really only affects
8110     # instructions generated for C/C++ code.
8111     # So use the matching same (or lower) -arch options, but only in order
8112     # to generate the best matching instructions for the C++ code surrounding
8113     # the intrinsics.
8114     # SSE2 is the default for x86/x64, so no need to specify the option.
8115     flag_sse2=
8116     # No specific options for these, use the next lower.
8117     flag_ssse3="$flag_sse2"
8118     flag_sse41="$flag_sse2"
8119     flag_sse42="$flag_sse2"
8120     flag_avx=-arch:AVX
8121     flag_avx2=-arch:AVX2
8122     flag_avx512=-arch:AVX512
8123     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8124     flag_avx512f=-arch:AVX2
8125     # No MSVC options for these.
8126     flag_f16c="$flag_sse2"
8127     flag_fma="$flag_sse2"
8130 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8131 AC_LANG_PUSH([C++])
8132 save_CXXFLAGS=$CXXFLAGS
8133 CXXFLAGS="$CXXFLAGS $flag_sse2"
8134 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8135     #include <emmintrin.h>
8136     int main () {
8137         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8138         c = _mm_xor_si128 (a, b);
8139         return 0;
8140     }
8141     ])],
8142     [can_compile_sse2=yes],
8143     [can_compile_sse2=no])
8144 AC_LANG_POP([C++])
8145 CXXFLAGS=$save_CXXFLAGS
8146 AC_MSG_RESULT([${can_compile_sse2}])
8147 if test "${can_compile_sse2}" = "yes" ; then
8148     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8151 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8152 AC_LANG_PUSH([C++])
8153 save_CXXFLAGS=$CXXFLAGS
8154 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8155 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8156     #include <tmmintrin.h>
8157     int main () {
8158         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8159         c = _mm_maddubs_epi16 (a, b);
8160         return 0;
8161     }
8162     ])],
8163     [can_compile_ssse3=yes],
8164     [can_compile_ssse3=no])
8165 AC_LANG_POP([C++])
8166 CXXFLAGS=$save_CXXFLAGS
8167 AC_MSG_RESULT([${can_compile_ssse3}])
8168 if test "${can_compile_ssse3}" = "yes" ; then
8169     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8172 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8173 AC_LANG_PUSH([C++])
8174 save_CXXFLAGS=$CXXFLAGS
8175 CXXFLAGS="$CXXFLAGS $flag_sse41"
8176 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8177     #include <smmintrin.h>
8178     int main () {
8179         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8180         c = _mm_cmpeq_epi64 (a, b);
8181         return 0;
8182     }
8183     ])],
8184     [can_compile_sse41=yes],
8185     [can_compile_sse41=no])
8186 AC_LANG_POP([C++])
8187 CXXFLAGS=$save_CXXFLAGS
8188 AC_MSG_RESULT([${can_compile_sse41}])
8189 if test "${can_compile_sse41}" = "yes" ; then
8190     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8193 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8194 AC_LANG_PUSH([C++])
8195 save_CXXFLAGS=$CXXFLAGS
8196 CXXFLAGS="$CXXFLAGS $flag_sse42"
8197 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8198     #include <nmmintrin.h>
8199     int main () {
8200         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8201         c = _mm_cmpgt_epi64 (a, b);
8202         return 0;
8203     }
8204     ])],
8205     [can_compile_sse42=yes],
8206     [can_compile_sse42=no])
8207 AC_LANG_POP([C++])
8208 CXXFLAGS=$save_CXXFLAGS
8209 AC_MSG_RESULT([${can_compile_sse42}])
8210 if test "${can_compile_sse42}" = "yes" ; then
8211     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8214 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8215 AC_LANG_PUSH([C++])
8216 save_CXXFLAGS=$CXXFLAGS
8217 CXXFLAGS="$CXXFLAGS $flag_avx"
8218 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8219     #include <immintrin.h>
8220     int main () {
8221         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8222         c = _mm256_xor_ps(a, b);
8223         return 0;
8224     }
8225     ])],
8226     [can_compile_avx=yes],
8227     [can_compile_avx=no])
8228 AC_LANG_POP([C++])
8229 CXXFLAGS=$save_CXXFLAGS
8230 AC_MSG_RESULT([${can_compile_avx}])
8231 if test "${can_compile_avx}" = "yes" ; then
8232     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8235 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8236 AC_LANG_PUSH([C++])
8237 save_CXXFLAGS=$CXXFLAGS
8238 CXXFLAGS="$CXXFLAGS $flag_avx2"
8239 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8240     #include <immintrin.h>
8241     int main () {
8242         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8243         c = _mm256_maddubs_epi16(a, b);
8244         return 0;
8245     }
8246     ])],
8247     [can_compile_avx2=yes],
8248     [can_compile_avx2=no])
8249 AC_LANG_POP([C++])
8250 CXXFLAGS=$save_CXXFLAGS
8251 AC_MSG_RESULT([${can_compile_avx2}])
8252 if test "${can_compile_avx2}" = "yes" ; then
8253     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8256 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8257 AC_LANG_PUSH([C++])
8258 save_CXXFLAGS=$CXXFLAGS
8259 CXXFLAGS="$CXXFLAGS $flag_avx512"
8260 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8261     #include <immintrin.h>
8262     int main () {
8263         __m512i a = _mm512_loadu_si512(0);
8264         __m512d v1 = _mm512_load_pd(0);
8265         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8266         __m512d v2 = _mm512_abs_pd(v1);
8267         return 0;
8268     }
8269     ])],
8270     [can_compile_avx512=yes],
8271     [can_compile_avx512=no])
8272 AC_LANG_POP([C++])
8273 CXXFLAGS=$save_CXXFLAGS
8274 AC_MSG_RESULT([${can_compile_avx512}])
8275 if test "${can_compile_avx512}" = "yes" ; then
8276     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8277     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8280 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8281 AC_LANG_PUSH([C++])
8282 save_CXXFLAGS=$CXXFLAGS
8283 CXXFLAGS="$CXXFLAGS $flag_f16c"
8284 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8285     #include <immintrin.h>
8286     int main () {
8287         __m128i a = _mm_set1_epi32 (0);
8288         __m128 c;
8289         c = _mm_cvtph_ps(a);
8290         return 0;
8291     }
8292     ])],
8293     [can_compile_f16c=yes],
8294     [can_compile_f16c=no])
8295 AC_LANG_POP([C++])
8296 CXXFLAGS=$save_CXXFLAGS
8297 AC_MSG_RESULT([${can_compile_f16c}])
8298 if test "${can_compile_f16c}" = "yes" ; then
8299     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8302 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8303 AC_LANG_PUSH([C++])
8304 save_CXXFLAGS=$CXXFLAGS
8305 CXXFLAGS="$CXXFLAGS $flag_fma"
8306 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8307     #include <immintrin.h>
8308     int main () {
8309         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8310         d = _mm256_fmadd_ps(a, b, c);
8311         return 0;
8312     }
8313     ])],
8314     [can_compile_fma=yes],
8315     [can_compile_fma=no])
8316 AC_LANG_POP([C++])
8317 CXXFLAGS=$save_CXXFLAGS
8318 AC_MSG_RESULT([${can_compile_fma}])
8319 if test "${can_compile_fma}" = "yes" ; then
8320     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8323 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8324 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8325 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8326 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8327 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8328 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8329 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8330 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8331 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8332 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8334 dnl ===================================================================
8335 dnl system stl sanity tests
8336 dnl ===================================================================
8337 if test "$_os" != "WINNT"; then
8339     AC_LANG_PUSH([C++])
8341     save_CPPFLAGS="$CPPFLAGS"
8342     if test -n "$MACOSX_SDK_PATH"; then
8343         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8344     fi
8346     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8347     # only.
8348     if test "$CPP_LIBRARY" = GLIBCXX; then
8349         dnl gcc#19664, gcc#22482, rhbz#162935
8350         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8351         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8352         AC_MSG_RESULT([$stlvisok])
8353         if test "$stlvisok" = "no"; then
8354             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8355         fi
8356     fi
8358     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8359     # when we don't make any dynamic libraries?
8360     if test "$DISABLE_DYNLOADING" = ""; then
8361         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8362         cat > conftestlib1.cc <<_ACEOF
8363 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8364 struct S2: S1<int> { virtual ~S2(); };
8365 S2::~S2() {}
8366 _ACEOF
8367         cat > conftestlib2.cc <<_ACEOF
8368 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8369 struct S2: S1<int> { virtual ~S2(); };
8370 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8371 _ACEOF
8372         gccvisinlineshiddenok=yes
8373         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8374             gccvisinlineshiddenok=no
8375         else
8376             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8377             dnl known to not work with -z defs (unsetting which makes the test
8378             dnl moot, though):
8379             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8380             if test "$COM_IS_CLANG" = TRUE; then
8381                 for i in $CXX $CXXFLAGS; do
8382                     case $i in
8383                     -fsanitize=*)
8384                         my_linkflagsnoundefs=
8385                         break
8386                         ;;
8387                     esac
8388                 done
8389             fi
8390             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8391                 gccvisinlineshiddenok=no
8392             fi
8393         fi
8395         rm -fr libconftest*
8396         AC_MSG_RESULT([$gccvisinlineshiddenok])
8397         if test "$gccvisinlineshiddenok" = "no"; then
8398             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8399         fi
8400     fi
8402    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8403     cat >visibility.cxx <<_ACEOF
8404 #pragma GCC visibility push(hidden)
8405 struct __attribute__ ((visibility ("default"))) TestStruct {
8406   static void Init();
8408 __attribute__ ((visibility ("default"))) void TestFunc() {
8409   TestStruct::Init();
8411 _ACEOF
8412     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8413         gccvisbroken=yes
8414     else
8415         case "$host_cpu" in
8416         i?86|x86_64)
8417             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8418                 gccvisbroken=no
8419             else
8420                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8421                     gccvisbroken=no
8422                 else
8423                     gccvisbroken=yes
8424                 fi
8425             fi
8426             ;;
8427         *)
8428             gccvisbroken=no
8429             ;;
8430         esac
8431     fi
8432     rm -f visibility.s visibility.cxx
8434     AC_MSG_RESULT([$gccvisbroken])
8435     if test "$gccvisbroken" = "yes"; then
8436         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8437     fi
8439     CPPFLAGS="$save_CPPFLAGS"
8441     AC_MSG_CHECKING([if CET endbranch is recognized])
8442 cat > endbr.s <<_ACEOF
8443 endbr32
8444 _ACEOF
8445     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8446     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8447         AC_MSG_RESULT([yes])
8448         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8449     else
8450         AC_MSG_RESULT([no])
8451     fi
8452     rm -f endbr.s endbr.o
8453     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8455     AC_LANG_POP([C++])
8458 dnl ===================================================================
8459 dnl  Clang++ tests
8460 dnl ===================================================================
8462 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8463 if test "$GCC" = "yes"; then
8464     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8465     AC_LANG_PUSH([C++])
8466     save_CXXFLAGS=$CXXFLAGS
8467     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8468     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8469     CXXFLAGS=$save_CXXFLAGS
8470     AC_LANG_POP([C++])
8471     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8472         AC_MSG_RESULT([yes])
8473     else
8474         AC_MSG_RESULT([no])
8475     fi
8477 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8479 dnl ===================================================================
8480 dnl Compiler plugins
8481 dnl ===================================================================
8483 COMPILER_PLUGINS=
8484 # currently only Clang
8486 if test "$COM_IS_CLANG" != "TRUE"; then
8487     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8488         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8489         enable_compiler_plugins=no
8490     fi
8493 COMPILER_PLUGINS_COM_IS_CLANG=
8494 if test "$COM_IS_CLANG" = "TRUE"; then
8495     if test -n "$enable_compiler_plugins"; then
8496         compiler_plugins="$enable_compiler_plugins"
8497     elif test -n "$ENABLE_DBGUTIL"; then
8498         compiler_plugins=test
8499     else
8500         compiler_plugins=no
8501     fi
8502     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8503         if test "$CLANGVER" -lt 120001; then
8504             if test "$compiler_plugins" = yes; then
8505                 AC_MSG_ERROR(
8506                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8507             else
8508                 compiler_plugins=no
8509             fi
8510         fi
8511     fi
8512     if test "$compiler_plugins" != "no"; then
8513         dnl The prefix where Clang resides, override to where Clang resides if
8514         dnl using a source build:
8515         if test -z "$CLANGDIR"; then
8516             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8517         fi
8518         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8519         if test -z "$COMPILER_PLUGINS_CXX"; then
8520             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8521         fi
8522         clangbindir=$CLANGDIR/bin
8523         if test "$build_os" = "cygwin"; then
8524             clangbindir=$(cygpath -u "$clangbindir")
8525         fi
8526         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8527         if test -n "$LLVM_CONFIG"; then
8528             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8529             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8530             if test -z "$CLANGLIBDIR"; then
8531                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8532             fi
8533             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8534             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8535             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8536                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8537                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8538                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8539                 fi
8540             fi
8541             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8542             clangobjdir=$($LLVM_CONFIG --obj-root)
8543             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8544                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8545             fi
8546         fi
8547         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8548         AC_LANG_PUSH([C++])
8549         save_CXX=$CXX
8550         save_CXXCPP=$CXXCPP
8551         save_CPPFLAGS=$CPPFLAGS
8552         save_CXXFLAGS=$CXXFLAGS
8553         save_LDFLAGS=$LDFLAGS
8554         save_LIBS=$LIBS
8555         CXX=$COMPILER_PLUGINS_CXX
8556         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8557         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8558         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8559         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8560             [COMPILER_PLUGINS=TRUE],
8561             [
8562             if test "$compiler_plugins" = "yes"; then
8563                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8564             else
8565                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8566                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8567             fi
8568             ])
8569         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8570         dnl comment in compilerplugins/Makefile-clang.mk:
8571         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8572             LDFLAGS=""
8573             AC_MSG_CHECKING([for clang libraries to use])
8574             if test -z "$CLANGTOOLLIBS"; then
8575                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8576                 AC_LINK_IFELSE([
8577                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8578                         [[ clang::FullSourceLoc().dump(); ]])
8579                 ],[CLANGTOOLLIBS="$LIBS"],[])
8580             fi
8581             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8582             dnl list of individual -lclang* (but note that that list can become outdated over time,
8583             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8584             dnl needs to include -lclangSupport now"):
8585             if test -z "$CLANGTOOLLIBS"; then
8586                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8587  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8588                 AC_LINK_IFELSE([
8589                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8590                         [[ clang::FullSourceLoc().dump(); ]])
8591                 ],[CLANGTOOLLIBS="$LIBS"],[])
8592             fi
8593             AC_MSG_RESULT([$CLANGTOOLLIBS])
8594             if test -z "$CLANGTOOLLIBS"; then
8595                 if test "$compiler_plugins" = "yes"; then
8596                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8597                 else
8598                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8599                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8600                 fi
8601                 COMPILER_PLUGINS=
8602             fi
8603             if test -n "$COMPILER_PLUGINS"; then
8604                 if test -z "$CLANGSYSINCLUDE"; then
8605                     if test -n "$LLVM_CONFIG"; then
8606                         # Path to the clang system headers (no idea if there's a better way to get it).
8607                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8608                     fi
8609                 fi
8610             fi
8611         fi
8612         CXX=$save_CXX
8613         CXXCPP=$save_CXXCPP
8614         CPPFLAGS=$save_CPPFLAGS
8615         CXXFLAGS=$save_CXXFLAGS
8616         LDFLAGS=$save_LDFLAGS
8617         LIBS="$save_LIBS"
8618         AC_LANG_POP([C++])
8620         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8621         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8622             #ifndef __clang__
8623             you lose
8624             #endif
8625             int foo=42;
8626             ]])],
8627             [AC_MSG_RESULT([yes])
8628              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8629             [AC_MSG_RESULT([no])])
8630         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8631     fi
8632 else
8633     if test "$enable_compiler_plugins" = "yes"; then
8634         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8635     fi
8637 COMPILER_PLUGINS_ANALYZER_PCH=
8638 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8639     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8641 AC_SUBST(COMPILER_PLUGINS)
8642 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8643 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8644 AC_SUBST(COMPILER_PLUGINS_CXX)
8645 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8646 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8647 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8648 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8649 AC_SUBST(CLANGDIR)
8650 AC_SUBST(CLANGLIBDIR)
8651 AC_SUBST(CLANGTOOLLIBS)
8652 AC_SUBST(CLANGSYSINCLUDE)
8654 # Plugin to help linker.
8655 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8656 # This makes --enable-lto build with clang work.
8657 AC_SUBST(LD_PLUGIN)
8659 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8660 AC_SUBST(HAVE_POSIX_FALLOCATE)
8662 JITC_PROCESSOR_TYPE=""
8663 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8664     # IBMs JDK needs this...
8665     JITC_PROCESSOR_TYPE=6
8666     export JITC_PROCESSOR_TYPE
8668 AC_SUBST([JITC_PROCESSOR_TYPE])
8670 # Misc Windows Stuff
8671 AC_ARG_WITH(ucrt-dir,
8672     AS_HELP_STRING([--with-ucrt-dir],
8673         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8674         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8675         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8676             Windows6.1-KB2999226-x64.msu
8677             Windows6.1-KB2999226-x86.msu
8678             Windows8.1-KB2999226-x64.msu
8679             Windows8.1-KB2999226-x86.msu
8680             Windows8-RT-KB2999226-x64.msu
8681             Windows8-RT-KB2999226-x86.msu
8682         A zip archive including those files is available from Microsoft site:
8683         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8686 UCRT_REDISTDIR="$with_ucrt_dir"
8687 if test $_os = "WINNT"; then
8688     find_msvc_x64_dlls
8689     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8690     MSVC_DLLS="$msvcdlls"
8691     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8692         with_redist=143
8693     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8694         with_redist=142
8695     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8696         with_redist=141
8697     fi
8698     for i in $PKGFORMAT; do
8699         if test "$i" = msi; then
8700             find_msms "$with_redist"
8701             if test -n "$msmdir"; then
8702                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8703                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8704             fi
8705             break
8706         fi
8707     done
8709     if test "$UCRT_REDISTDIR" = "no"; then
8710         dnl explicitly disabled
8711         UCRT_REDISTDIR=""
8712     else
8713         PathFormat "$UCRT_REDISTDIR"
8714         UCRT_REDISTDIR="$formatted_path"
8715         UCRT_REDISTDIR_unix="$formatted_path_unix"
8716         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8717                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8718                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8719                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8720                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8721                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8722             UCRT_REDISTDIR=""
8723             if test -n "$PKGFORMAT"; then
8724                for i in $PKGFORMAT; do
8725                    case "$i" in
8726                    msi)
8727                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8728                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8729                        ;;
8730                    esac
8731                done
8732             fi
8733         fi
8734     fi
8737 AC_SUBST(UCRT_REDISTDIR)
8738 AC_SUBST(MSVC_DLL_PATH)
8739 AC_SUBST(MSVC_DLLS)
8740 AC_SUBST(MSM_PATH)
8743 dnl ===================================================================
8744 dnl Checks for Java
8745 dnl ===================================================================
8746 if test "$ENABLE_JAVA" != ""; then
8748     # Windows-specific tests
8749     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8750         if test -z "$with_jdk_home"; then
8751             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8752             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8753             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8754             if test -n "$regvalue"; then
8755                 ver=$regvalue
8756                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8757                 with_jdk_home=$regvalue
8758             fi
8759             howfound="found automatically"
8760         else
8761             howfound="you passed"
8762         fi
8763         PathFormat "$with_jdk_home"
8764         with_jdk_home="$formatted_path_unix"
8766         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8767             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])
8768         fi
8769         with_java="java.exe"
8770         javacompiler="javac.exe"
8771         javadoc="javadoc.exe"
8772     fi
8774     # 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.
8775     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8776     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8777         with_jdk_home=`/usr/libexec/java_home`
8778     fi
8780     JAVA_HOME=; export JAVA_HOME
8781     if test -z "$with_jdk_home"; then
8782         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8783     else
8784         _java_path="$with_jdk_home/bin/$with_java"
8785         dnl Check if there is a Java interpreter at all.
8786         if test -x "$_java_path"; then
8787             JAVAINTERPRETER=$_java_path
8788         else
8789             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8790         fi
8791     fi
8793     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8794     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8795     dnl loaded by java to run JunitTests:
8796     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8797         shortjdkhome=`cygpath -d "$with_jdk_home"`
8798         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
8799             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8800             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8801         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
8802             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8803             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8804         fi
8806         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8807             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8808         fi
8809         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8810     elif test "$cross_compiling" != "yes"; then
8811         case $CPUNAME in
8812             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8813                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8814                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8815                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8816                 fi
8817                 ;;
8818             *) # assumption: everything else 32-bit
8819                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8820                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8821                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8822                 fi
8823                 ;;
8824         esac
8825     fi
8828 dnl ===================================================================
8829 dnl Checks for JDK.
8830 dnl ===================================================================
8832 # Whether all the complexity here actually is needed any more or not, no idea.
8834 JDK_SECURITYMANAGER_DISALLOWED=
8835 MODULAR_JAVA=
8836 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8837     _gij_longver=0
8838     AC_MSG_CHECKING([the installed JDK])
8839     if test -n "$JAVAINTERPRETER"; then
8840         dnl java -version sends output to stderr!
8841         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8842             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8843         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8844             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8845         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8846             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8847         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8848             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8849         else
8850             JDK=sun
8852             dnl Sun JDK specific tests
8853             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8854             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8856             if test "$_jdk_ver" -lt 10800; then
8857                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
8858             fi
8859             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8860             dnl completely removed in some Java version > 18 (see
8861             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8862             if test "$_jdk_ver" -ge 180000; then
8863                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8864             fi
8866             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8867             if test "$_os" = "WINNT"; then
8868                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8869             fi
8870             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8872             dnl Check whether the build Java supports modules
8873             if test "$_jdk_ver" -ge 90000; then
8874                 MODULAR_JAVA=TRUE
8875             else
8876                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
8877                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
8878             fi
8880             # set to limit VM usage for JunitTests
8881             JAVAIFLAGS=-Xmx64M
8882             # set to limit VM usage for javac
8883             JAVACFLAGS=-J-Xmx128M
8884         fi
8885     else
8886         AC_MSG_ERROR([Java not found. You need at least JDK 8])
8887     fi
8888 else
8889     if test -z "$ENABLE_JAVA"; then
8890         dnl Java disabled
8891         JAVA_HOME=
8892         export JAVA_HOME
8893     elif test "$cross_compiling" = "yes"; then
8894         # Just assume compatibility of build and host JDK
8895         JDK=$JDK_FOR_BUILD
8896         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8897     fi
8900 dnl ===================================================================
8901 dnl Checks for javac
8902 dnl ===================================================================
8903 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8904     : ${JAVA_SOURCE_VER=8}
8905     : ${JAVA_TARGET_VER=8}
8906     if test -z "$with_jdk_home"; then
8907         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8908     else
8909         _javac_path="$with_jdk_home/bin/$javacompiler"
8910         dnl Check if there is a Java compiler at all.
8911         if test -x "$_javac_path"; then
8912             JAVACOMPILER=$_javac_path
8913         fi
8914     fi
8915     if test -z "$JAVACOMPILER"; then
8916         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8917     fi
8918     if test "$build_os" = "cygwin"; then
8919         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8920             JAVACOMPILER="${JAVACOMPILER}.exe"
8921         fi
8922         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8923     fi
8926 dnl ===================================================================
8927 dnl Checks for javadoc
8928 dnl ===================================================================
8929 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8930     if test -z "$with_jdk_home"; then
8931         AC_PATH_PROG(JAVADOC, $javadoc)
8932     else
8933         _javadoc_path="$with_jdk_home/bin/$javadoc"
8934         dnl Check if there is a javadoc at all.
8935         if test -x "$_javadoc_path"; then
8936             JAVADOC=$_javadoc_path
8937         else
8938             AC_PATH_PROG(JAVADOC, $javadoc)
8939         fi
8940     fi
8941     if test -z "$JAVADOC"; then
8942         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8943     fi
8944     if test "$build_os" = "cygwin"; then
8945         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8946             JAVADOC="${JAVADOC}.exe"
8947         fi
8948         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8949     fi
8951     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8952     JAVADOCISGJDOC="yes"
8953     fi
8955 AC_SUBST(JAVADOC)
8956 AC_SUBST(JAVADOCISGJDOC)
8958 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8959     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8960     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8961         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8962            # try to recover first by looking whether we have an alternative
8963            # system as in Debian or newer SuSEs where following /usr/bin/javac
8964            # over /etc/alternatives/javac leads to the right bindir where we
8965            # just need to strip a bit away to get a valid JAVA_HOME
8966            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8967         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8968             # maybe only one level of symlink (e.g. on Mac)
8969             JAVA_HOME=$(readlink $JAVACOMPILER)
8970             if test "$(dirname $JAVA_HOME)" = "."; then
8971                 # we've got no path to trim back
8972                 JAVA_HOME=""
8973             fi
8974         else
8975             # else warn
8976             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8977             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8978             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8979             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8980         fi
8981         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8982         if test "$JAVA_HOME" != "/usr"; then
8983             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8984                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8985                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8986                 dnl Tiger already returns a JDK path...
8987                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8988             else
8989                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8990                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8991                 dnl that checks which version to run
8992                 if test -f "$JAVA_HOME"; then
8993                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8994                 fi
8995             fi
8996         fi
8997     fi
8998     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
9000     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9001     if test -z "$JAVA_HOME"; then
9002         if test "x$with_jdk_home" = "x"; then
9003             cat > findhome.java <<_ACEOF
9004 [import java.io.File;
9006 class findhome
9008     public static void main(String args[])
9009     {
9010         String jrelocation = System.getProperty("java.home");
9011         File jre = new File(jrelocation);
9012         System.out.println(jre.getParent());
9013     }
9015 _ACEOF
9016             AC_MSG_CHECKING([if javac works])
9017             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9018             AC_TRY_EVAL(javac_cmd)
9019             if test $? = 0 -a -f ./findhome.class; then
9020                 AC_MSG_RESULT([javac works])
9021             else
9022                 echo "configure: javac test failed" >&5
9023                 cat findhome.java >&5
9024                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9025             fi
9026             AC_MSG_CHECKING([if gij knows its java.home])
9027             JAVA_HOME=`$JAVAINTERPRETER findhome`
9028             if test $? = 0 -a "$JAVA_HOME" != ""; then
9029                 AC_MSG_RESULT([$JAVA_HOME])
9030             else
9031                 echo "configure: java test failed" >&5
9032                 cat findhome.java >&5
9033                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9034             fi
9035             # clean-up after ourselves
9036             rm -f ./findhome.java ./findhome.class
9037         else
9038             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9039         fi
9040     fi
9042     # now check if $JAVA_HOME is really valid
9043     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9044         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9045             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9046             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9047             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9048             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9049             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9050             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9051         fi
9052     fi
9053     PathFormat "$JAVA_HOME"
9054     JAVA_HOME="$formatted_path_unix"
9057 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9058     "$_os" != Darwin
9059 then
9060     AC_MSG_CHECKING([for JAWT lib])
9061     if test "$_os" = WINNT; then
9062         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9063         JAWTLIB=jawt.lib
9064     else
9065         case "$host_cpu" in
9066         arm*)
9067             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9068             JAVA_ARCH=$my_java_arch
9069             ;;
9070         i*86)
9071             my_java_arch=i386
9072             ;;
9073         m68k)
9074             my_java_arch=m68k
9075             ;;
9076         powerpc)
9077             my_java_arch=ppc
9078             ;;
9079         powerpc64)
9080             my_java_arch=ppc64
9081             ;;
9082         powerpc64le)
9083             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9084             JAVA_ARCH=$my_java_arch
9085             ;;
9086         sparc64)
9087             my_java_arch=sparcv9
9088             ;;
9089         x86_64)
9090             my_java_arch=amd64
9091             ;;
9092         *)
9093             my_java_arch=$host_cpu
9094             ;;
9095         esac
9096         # This is where JDK9 puts the library
9097         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9098             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9099         else
9100             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9101         fi
9102         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9103     fi
9104     AC_MSG_RESULT([$JAWTLIB])
9106 AC_SUBST(JAWTLIB)
9108 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9109     case "$host_os" in
9111     cygwin*|wsl*)
9112         JAVAINC="-I$JAVA_HOME/include/win32"
9113         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9114         ;;
9116     darwin*)
9117         if test -d "$JAVA_HOME/include/darwin"; then
9118             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9119         else
9120             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9121         fi
9122         ;;
9124     dragonfly*)
9125         JAVAINC="-I$JAVA_HOME/include"
9126         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9127         ;;
9129     freebsd*)
9130         JAVAINC="-I$JAVA_HOME/include"
9131         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9132         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9133         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9134         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9135         ;;
9137     k*bsd*-gnu*)
9138         JAVAINC="-I$JAVA_HOME/include"
9139         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9140         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9141         ;;
9143     linux-gnu*)
9144         JAVAINC="-I$JAVA_HOME/include"
9145         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9146         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9147         ;;
9149     *netbsd*)
9150         JAVAINC="-I$JAVA_HOME/include"
9151         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9152         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9153        ;;
9155     openbsd*)
9156         JAVAINC="-I$JAVA_HOME/include"
9157         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9158         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9159         ;;
9161     solaris*)
9162         JAVAINC="-I$JAVA_HOME/include"
9163         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9164         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9165         ;;
9166     esac
9168 SOLARINC="$SOLARINC $JAVAINC"
9170 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9171     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9172     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9173     JDK_FOR_BUILD=$JDK
9174     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9177 AC_SUBST(JAVACFLAGS)
9178 AC_SUBST(JAVACOMPILER)
9179 AC_SUBST(JAVAINTERPRETER)
9180 AC_SUBST(JAVAIFLAGS)
9181 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9182 AC_SUBST(JAVA_HOME)
9183 AC_SUBST(JAVA_HOME_FOR_BUILD)
9184 AC_SUBST(JDK)
9185 AC_SUBST(JDK_FOR_BUILD)
9186 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9187 AC_SUBST(JAVA_SOURCE_VER)
9188 AC_SUBST(JAVA_TARGET_VER)
9189 AC_SUBST(MODULAR_JAVA)
9192 dnl ===================================================================
9193 dnl Export file validation
9194 dnl ===================================================================
9195 AC_MSG_CHECKING([whether to enable export file validation])
9196 if test "$with_export_validation" != "no"; then
9197     if test -z "$ENABLE_JAVA"; then
9198         if test "$with_export_validation" = "yes"; then
9199             AC_MSG_ERROR([requested, but Java is disabled])
9200         else
9201             AC_MSG_RESULT([no, as Java is disabled])
9202         fi
9203     elif ! test -d "${SRC_ROOT}/schema"; then
9204         if test "$with_export_validation" = "yes"; then
9205             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9206         else
9207             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9208         fi
9209     else
9210         AC_MSG_RESULT([yes])
9211         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9213         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9214         if test -z "$ODFVALIDATOR"; then
9215             # remember to download the ODF toolkit with validator later
9216             AC_MSG_NOTICE([no odfvalidator found, will download it])
9217             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9218             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9220             # and fetch name of odfvalidator jar name from download.lst
9221             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9222             AC_SUBST(ODFVALIDATOR_JAR)
9224             if test -z "$ODFVALIDATOR_JAR"; then
9225                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9226             fi
9227         fi
9228         if test "$build_os" = "cygwin"; then
9229             # In case of Cygwin it will be executed from Windows,
9230             # so we need to run bash and absolute path to validator
9231             # so instead of "odfvalidator" it will be
9232             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9233             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9234         else
9235             ODFVALIDATOR="sh $ODFVALIDATOR"
9236         fi
9237         AC_SUBST(ODFVALIDATOR)
9240         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9241         if test -z "$OFFICEOTRON"; then
9242             # remember to download the officeotron with validator later
9243             AC_MSG_NOTICE([no officeotron found, will download it])
9244             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9245             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9247             # and fetch name of officeotron jar name from download.lst
9248             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9249             AC_SUBST(OFFICEOTRON_JAR)
9251             if test -z "$OFFICEOTRON_JAR"; then
9252                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9253             fi
9254         else
9255             # check version of existing officeotron
9256             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9257             if test 0"$OFFICEOTRON_VER" -lt 704; then
9258                 AC_MSG_ERROR([officeotron too old])
9259             fi
9260         fi
9261         if test "$build_os" = "cygwin"; then
9262             # In case of Cygwin it will be executed from Windows,
9263             # so we need to run bash and absolute path to validator
9264             # so instead of "odfvalidator" it will be
9265             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9266             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9267         else
9268             OFFICEOTRON="sh $OFFICEOTRON"
9269         fi
9270     fi
9271     AC_SUBST(OFFICEOTRON)
9272 else
9273     AC_MSG_RESULT([no])
9276 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9277 if test "$with_bffvalidator" != "no"; then
9278     AC_DEFINE(HAVE_BFFVALIDATOR)
9280     if test "$with_export_validation" = "no"; then
9281         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9282     fi
9284     if test "$with_bffvalidator" = "yes"; then
9285         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9286     else
9287         BFFVALIDATOR="$with_bffvalidator"
9288     fi
9290     if test "$build_os" = "cygwin"; then
9291         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9292             AC_MSG_RESULT($BFFVALIDATOR)
9293         else
9294             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9295         fi
9296     elif test -n "$BFFVALIDATOR"; then
9297         # We are not in Cygwin but need to run Windows binary with wine
9298         AC_PATH_PROGS(WINE, wine)
9300         # so swap in a shell wrapper that converts paths transparently
9301         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9302         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9303         AC_SUBST(BFFVALIDATOR_EXE)
9304         AC_MSG_RESULT($BFFVALIDATOR)
9305     else
9306         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9307     fi
9308     AC_SUBST(BFFVALIDATOR)
9309 else
9310     AC_MSG_RESULT([no])
9313 dnl ===================================================================
9314 dnl Check for epm (not needed for Windows)
9315 dnl ===================================================================
9316 AC_MSG_CHECKING([whether to enable EPM for packing])
9317 if test "$enable_epm" = "yes"; then
9318     AC_MSG_RESULT([yes])
9319     if test "$_os" != "WINNT"; then
9320         if test $_os = Darwin; then
9321             EPM=internal
9322         elif test -n "$with_epm"; then
9323             EPM=$with_epm
9324         else
9325             AC_PATH_PROG(EPM, epm, no)
9326         fi
9327         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9328             AC_MSG_NOTICE([EPM will be built.])
9329             BUILD_TYPE="$BUILD_TYPE EPM"
9330             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9331         else
9332             # Gentoo has some epm which is something different...
9333             AC_MSG_CHECKING([whether the found epm is the right epm])
9334             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9335                 AC_MSG_RESULT([yes])
9336             else
9337                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9338             fi
9339             AC_MSG_CHECKING([epm version])
9340             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9341             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9342                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9343                 AC_MSG_RESULT([OK, >= 3.7])
9344             else
9345                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9346                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9347             fi
9348         fi
9349     fi
9351     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9352         AC_MSG_CHECKING([for rpm])
9353         for a in "$RPM" rpmbuild rpm; do
9354             $a --usage >/dev/null 2> /dev/null
9355             if test $? -eq 0; then
9356                 RPM=$a
9357                 break
9358             else
9359                 $a --version >/dev/null 2> /dev/null
9360                 if test $? -eq 0; then
9361                     RPM=$a
9362                     break
9363                 fi
9364             fi
9365         done
9366         if test -z "$RPM"; then
9367             AC_MSG_ERROR([not found])
9368         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9369             RPM_PATH=`command -v $RPM`
9370             AC_MSG_RESULT([$RPM_PATH])
9371             SCPDEFS="$SCPDEFS -DWITH_RPM"
9372         else
9373             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9374         fi
9375     fi
9376     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9377         AC_PATH_PROG(DPKG, dpkg, no)
9378         if test "$DPKG" = "no"; then
9379             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9380         fi
9381     fi
9382     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9383        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9384         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9385             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9386                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9387                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9388                     AC_MSG_RESULT([yes])
9389                 else
9390                     AC_MSG_RESULT([no])
9391                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9392                         _pt="rpm"
9393                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9394                         add_warning "the rpms will need to be installed with --nodeps"
9395                     else
9396                         _pt="pkg"
9397                     fi
9398                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9399                     add_warning "the ${_pt}s will not be relocatable"
9400                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9401                                  relocation will work, you need to patch your epm with the
9402                                  patch in epm/epm-3.7.patch or build with
9403                                  --with-epm=internal which will build a suitable epm])
9404                 fi
9405             fi
9406         fi
9407     fi
9408     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9409         AC_PATH_PROG(PKGMK, pkgmk, no)
9410         if test "$PKGMK" = "no"; then
9411             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9412         fi
9413     fi
9414     AC_SUBST(RPM)
9415     AC_SUBST(DPKG)
9416     AC_SUBST(PKGMK)
9417 else
9418     for i in $PKGFORMAT; do
9419         case "$i" in
9420         bsd | deb | pkg | rpm | native | portable)
9421             AC_MSG_ERROR(
9422                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9423             ;;
9424         esac
9425     done
9426     AC_MSG_RESULT([no])
9427     EPM=NO
9429 AC_SUBST(EPM)
9431 ENABLE_LWP=
9432 if test "$enable_lotuswordpro" = "yes"; then
9433     ENABLE_LWP="TRUE"
9435 AC_SUBST(ENABLE_LWP)
9437 dnl ===================================================================
9438 dnl Check for building ODK
9439 dnl ===================================================================
9440 AC_MSG_CHECKING([whether to build the ODK])
9441 if test "$enable_odk" = yes; then
9442     if test "$DISABLE_DYNLOADING" = TRUE; then
9443         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9444     fi
9445     AC_MSG_RESULT([yes])
9446     BUILD_TYPE="$BUILD_TYPE ODK"
9447 else
9448     AC_MSG_RESULT([no])
9451 if test "$enable_odk" != yes; then
9452     unset DOXYGEN
9453 else
9454     if test "$with_doxygen" = no; then
9455         AC_MSG_CHECKING([for doxygen])
9456         unset DOXYGEN
9457         AC_MSG_RESULT([no])
9458     else
9459         if test "$with_doxygen" = yes; then
9460             AC_PATH_PROG([DOXYGEN], [doxygen])
9461             if test -z "$DOXYGEN"; then
9462                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9463             fi
9464             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9465                 if ! dot -V 2>/dev/null; then
9466                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9467                 fi
9468             fi
9469         else
9470             AC_MSG_CHECKING([for doxygen])
9471             PathFormat "$with_doxygen"
9472             DOXYGEN="$formatted_path_unix"
9473             AC_MSG_RESULT([$formatted_path])
9474         fi
9475         if test -n "$DOXYGEN"; then
9476             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9477             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9478             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9479                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9480             fi
9481         fi
9482         if test -n "$WSL_ONLY_AS_HELPER"; then
9483             dnl what really should be tested is whether it is doxygen from windows-realm
9484             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9485             dnl using doxygen from wsl container would be possible, but there's a performance
9486             dnl penalty when accessing the files outside the container
9487             AC_MSG_CHECKING([whether doxygen is a windows executable])
9488             if $(file "$DOXYGEN" | grep -q "PE32"); then
9489                 AC_MSG_RESULT([yes])
9490             else
9491                 AC_MSG_RESULT([no])
9492                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9493             fi
9494         fi
9495     fi
9497 AC_SUBST([DOXYGEN])
9499 dnl ==================================================================
9500 dnl libfuzzer
9501 dnl ==================================================================
9502 AC_MSG_CHECKING([whether to enable fuzzers])
9503 if test "$enable_fuzzers" != yes; then
9504     AC_MSG_RESULT([no])
9505 else
9506     if test -z $LIB_FUZZING_ENGINE; then
9507       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9508     fi
9509     AC_MSG_RESULT([yes])
9510     ENABLE_FUZZERS="TRUE"
9511     AC_DEFINE([ENABLE_FUZZERS],1)
9512     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9514 AC_SUBST(LIB_FUZZING_ENGINE)
9516 dnl ===================================================================
9517 dnl Check for system zlib
9518 dnl ===================================================================
9519 if test "$with_system_zlib" = "auto"; then
9520     case "$_os" in
9521     WINNT)
9522         with_system_zlib="$with_system_libs"
9523         ;;
9524     *)
9525         if test "$enable_fuzzers" != "yes"; then
9526             with_system_zlib=yes
9527         else
9528             with_system_zlib=no
9529         fi
9530         ;;
9531     esac
9534 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9535 dnl and has no pkg-config for it at least on some tinderboxes,
9536 dnl so leaving that out for now
9537 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9538 AC_MSG_CHECKING([which zlib to use])
9539 if test "$with_system_zlib" = "yes"; then
9540     AC_MSG_RESULT([external])
9541     SYSTEM_ZLIB=TRUE
9542     AC_CHECK_HEADER(zlib.h, [],
9543         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9544     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9545         [AC_MSG_ERROR(zlib not found or functional)], [])
9546 else
9547     AC_MSG_RESULT([internal])
9548     SYSTEM_ZLIB=
9549     BUILD_TYPE="$BUILD_TYPE ZLIB"
9550     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9551     if test "$COM" = "MSC"; then
9552         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9553     else
9554         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9555     fi
9557 AC_SUBST(ZLIB_CFLAGS)
9558 AC_SUBST(ZLIB_LIBS)
9559 AC_SUBST(SYSTEM_ZLIB)
9561 dnl ===================================================================
9562 dnl Check for system jpeg
9563 dnl ===================================================================
9564 AC_MSG_CHECKING([which libjpeg to use])
9565 if test "$with_system_jpeg" = "yes"; then
9566     AC_MSG_RESULT([external])
9567     SYSTEM_LIBJPEG=TRUE
9568     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9569         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9570     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9571         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9572 else
9573     SYSTEM_LIBJPEG=
9574     AC_MSG_RESULT([internal, libjpeg-turbo])
9575     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9577     case "$host_cpu" in
9578     x86_64 | amd64 | i*86 | x86 | ia32)
9579         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9580         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9581             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9582                 NASM="$LODE_HOME/opt/bin/nasm"
9583             elif test -x "/opt/lo/bin/nasm"; then
9584                 NASM="/opt/lo/bin/nasm"
9585             fi
9586         fi
9588         if test -n "$NASM"; then
9589             AC_MSG_CHECKING([for object file format of host system])
9590             case "$host_os" in
9591               cygwin* | mingw* | pw32* | wsl*)
9592                 case "$host_cpu" in
9593                   x86_64)
9594                     objfmt='Win64-COFF'
9595                     ;;
9596                   *)
9597                     objfmt='Win32-COFF'
9598                     ;;
9599                 esac
9600               ;;
9601               msdosdjgpp* | go32*)
9602                 objfmt='COFF'
9603               ;;
9604               os2-emx*) # not tested
9605                 objfmt='MSOMF' # obj
9606               ;;
9607               linux*coff* | linux*oldld*)
9608                 objfmt='COFF' # ???
9609               ;;
9610               linux*aout*)
9611                 objfmt='a.out'
9612               ;;
9613               linux*)
9614                 case "$host_cpu" in
9615                   x86_64)
9616                     objfmt='ELF64'
9617                     ;;
9618                   *)
9619                     objfmt='ELF'
9620                     ;;
9621                 esac
9622               ;;
9623               kfreebsd* | freebsd* | netbsd* | openbsd*)
9624                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9625                   objfmt='BSD-a.out'
9626                 else
9627                   case "$host_cpu" in
9628                     x86_64 | amd64)
9629                       objfmt='ELF64'
9630                       ;;
9631                     *)
9632                       objfmt='ELF'
9633                       ;;
9634                   esac
9635                 fi
9636               ;;
9637               solaris* | sunos* | sysv* | sco*)
9638                 case "$host_cpu" in
9639                   x86_64)
9640                     objfmt='ELF64'
9641                     ;;
9642                   *)
9643                     objfmt='ELF'
9644                     ;;
9645                 esac
9646               ;;
9647               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9648                 case "$host_cpu" in
9649                   x86_64)
9650                     objfmt='Mach-O64'
9651                     ;;
9652                   *)
9653                     objfmt='Mach-O'
9654                     ;;
9655                 esac
9656               ;;
9657               *)
9658                 objfmt='ELF ?'
9659               ;;
9660             esac
9662             AC_MSG_RESULT([$objfmt])
9663             if test "$objfmt" = 'ELF ?'; then
9664               objfmt='ELF'
9665               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9666             fi
9668             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9669             case "$objfmt" in
9670               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9671               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9672               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9673               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9674               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9675               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9676               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9677               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9678               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9679               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9680               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9681             esac
9682             AC_MSG_RESULT([$NAFLAGS])
9684             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9685             cat > conftest.asm << EOF
9686             [%line __oline__ "configure"
9687                     section .text
9688                     global  _main,main
9689             _main:
9690             main:   xor     eax,eax
9691                     ret
9692             ]
9694             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9695             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9696               AC_MSG_RESULT(yes)
9697             else
9698               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9699               cat conftest.asm >&AS_MESSAGE_LOG_FD
9700               rm -rf conftest*
9701               AC_MSG_RESULT(no)
9702               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9703               NASM=""
9704             fi
9706         fi
9708         if test -z "$NASM"; then
9709 cat << _EOS
9710 ****************************************************************************
9711 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9712 To get one please:
9714 _EOS
9715             if test "$build_os" = "cygwin"; then
9716 cat << _EOS
9717 install a pre-compiled binary for Win32
9719 mkdir -p /opt/lo/bin
9720 cd /opt/lo/bin
9721 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9722 chmod +x nasm
9724 or get and install one from https://www.nasm.us/
9726 Then re-run autogen.sh
9728 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9729 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9731 _EOS
9732             else
9733 cat << _EOS
9734 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9736 _EOS
9737             fi
9738             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9739             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9740         fi
9741       ;;
9742     esac
9745 AC_SUBST(NASM)
9746 AC_SUBST(NAFLAGS)
9747 AC_SUBST(LIBJPEG_CFLAGS)
9748 AC_SUBST(LIBJPEG_LIBS)
9749 AC_SUBST(SYSTEM_LIBJPEG)
9751 dnl ===================================================================
9752 dnl Check for system clucene
9753 dnl ===================================================================
9754 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9755 if test "$SYSTEM_CLUCENE" = TRUE; then
9756     AC_LANG_PUSH([C++])
9757     save_CXXFLAGS=$CXXFLAGS
9758     save_CPPFLAGS=$CPPFLAGS
9759     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9760     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9761     dnl https://sourceforge.net/p/clucene/bugs/200/
9762     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9763     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9764                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9765     CXXFLAGS=$save_CXXFLAGS
9766     CPPFLAGS=$save_CPPFLAGS
9767     AC_LANG_POP([C++])
9768     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9771 dnl ===================================================================
9772 dnl Check for system expat
9773 dnl ===================================================================
9774 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9776 dnl ===================================================================
9777 dnl Check for system xmlsec
9778 dnl ===================================================================
9779 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9781 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9782 if test "$enable_eot" = "yes"; then
9783     ENABLE_EOT="TRUE"
9784     AC_DEFINE([ENABLE_EOT])
9785     AC_MSG_RESULT([yes])
9787     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9788 else
9789     ENABLE_EOT=
9790     AC_MSG_RESULT([no])
9792 AC_SUBST([ENABLE_EOT])
9794 dnl ===================================================================
9795 dnl Check for DLP libs
9796 dnl ===================================================================
9797 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9798 AS_IF([test "$COM" = "MSC"],
9799       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9800       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9802 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9803 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9805 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9807 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9809 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9810 AS_IF([test "$COM" = "MSC"],
9811       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9812       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9814 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9815 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9817 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9819 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9820 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9822 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9824 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9826 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9828 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9829 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9831 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9832 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9834 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9836 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9837 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9839 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9841 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9843 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9845 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9847 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9848 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9850 dnl ===================================================================
9851 dnl Check for system lcms2
9852 dnl ===================================================================
9853 if test "$with_system_lcms2" != "yes"; then
9854     SYSTEM_LCMS2=
9856 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9857 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9858 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9859 if test "$GCC" = "yes"; then
9860     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9862 if test "$COM" = "MSC"; then # override the above
9863     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9866 dnl ===================================================================
9867 dnl Check for system cppunit
9868 dnl ===================================================================
9869 if test "$_os" != "Android" ; then
9870     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9873 dnl ===================================================================
9874 dnl Check whether freetype is available
9876 dnl FreeType has 3 different kinds of versions
9877 dnl * release, like 2.4.10
9878 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9879 dnl * soname
9880 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9882 dnl 9.9.3 is 2.2.0
9883 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9884 dnl ===================================================================
9885 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9886 if test "x$ac_config_site_64bit_host" = xYES; then
9887     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9888 else
9889     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9891 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9893 # ===================================================================
9894 # Check for system libxslt
9895 # to prevent incompatibilities between internal libxml2 and external libxslt,
9896 # or vice versa, use with_system_libxml here
9897 # ===================================================================
9898 if test "$with_system_libxml" = "auto"; then
9899     case "$_os" in
9900     WINNT|iOS|Android)
9901         with_system_libxml="$with_system_libs"
9902         ;;
9903     Emscripten)
9904         with_system_libxml=no
9905         ;;
9906     *)
9907         if test "$enable_fuzzers" != "yes"; then
9908             with_system_libxml=yes
9909         else
9910             with_system_libxml=no
9911         fi
9912         ;;
9913     esac
9916 AC_MSG_CHECKING([which libxslt to use])
9917 if test "$with_system_libxml" = "yes"; then
9918     AC_MSG_RESULT([external])
9919     SYSTEM_LIBXSLT=TRUE
9920     if test "$_os" = "Darwin"; then
9921         dnl make sure to use SDK path
9922         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9923         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9924         dnl omit -L/usr/lib
9925         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9926         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9927     else
9928         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9929         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9930         FilterLibs "${LIBXSLT_LIBS}"
9931         LIBXSLT_LIBS="${filteredlibs}"
9932         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9933         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9934         FilterLibs "${LIBEXSLT_LIBS}"
9935         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9936     fi
9938     dnl Check for xsltproc
9939     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9940     if test "$XSLTPROC" = "no"; then
9941         AC_MSG_ERROR([xsltproc is required])
9942     fi
9943 else
9944     AC_MSG_RESULT([internal])
9945     SYSTEM_LIBXSLT=
9946     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9948 AC_SUBST(SYSTEM_LIBXSLT)
9949 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9950     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9952 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9954 AC_SUBST(LIBEXSLT_CFLAGS)
9955 AC_SUBST(LIBEXSLT_LIBS)
9956 AC_SUBST(LIBXSLT_CFLAGS)
9957 AC_SUBST(LIBXSLT_LIBS)
9958 AC_SUBST(XSLTPROC)
9960 # ===================================================================
9961 # Check for system libxml
9962 # ===================================================================
9963 AC_MSG_CHECKING([which libxml to use])
9964 if test "$with_system_libxml" = "yes"; then
9965     AC_MSG_RESULT([external])
9966     SYSTEM_LIBXML=TRUE
9967     if test "$_os" = "Darwin"; then
9968         dnl make sure to use SDK path
9969         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9970         dnl omit -L/usr/lib
9971         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9972     elif test $_os = iOS; then
9973         dnl make sure to use SDK path
9974         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9975         LIBXML_CFLAGS="-I$usr/include/libxml2"
9976         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9977     else
9978         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9979         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9980         FilterLibs "${LIBXML_LIBS}"
9981         LIBXML_LIBS="${filteredlibs}"
9982     fi
9984     dnl Check for xmllint
9985     AC_PATH_PROG(XMLLINT, xmllint, no)
9986     if test "$XMLLINT" = "no"; then
9987         AC_MSG_ERROR([xmllint is required])
9988     fi
9989 else
9990     AC_MSG_RESULT([internal])
9991     SYSTEM_LIBXML=
9992     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9993     if test "$COM" = "MSC"; then
9994         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9995     fi
9996     if test "$COM" = "MSC"; then
9997         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9998     else
9999         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10000         if test "$DISABLE_DYNLOADING" = TRUE; then
10001             LIBXML_LIBS="$LIBXML_LIBS -lm"
10002         fi
10003     fi
10004     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10006 AC_SUBST(SYSTEM_LIBXML)
10007 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10008     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10010 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10011 AC_SUBST(LIBXML_CFLAGS)
10012 AC_SUBST(LIBXML_LIBS)
10013 AC_SUBST(XMLLINT)
10015 # =====================================================================
10016 # Checking for a Python interpreter with version >= 3.3.
10017 # Optionally user can pass an option to configure, i. e.
10018 # ./configure PYTHON=/usr/bin/python
10019 # =====================================================================
10020 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10021     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10022     # unless PYTHON is defined as above which allows 'system'
10023     enable_python=internal
10025 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10026     if test -n "$PYTHON"; then
10027         PYTHON_FOR_BUILD=$PYTHON
10028     else
10029         # This allows a lack of system python with no error, we use internal one in that case.
10030         AM_PATH_PYTHON([3.3],, [:])
10031         # Clean PYTHON_VERSION checked below if cross-compiling
10032         PYTHON_VERSION=""
10033         if test "$PYTHON" != ":"; then
10034             PYTHON_FOR_BUILD=$PYTHON
10035         fi
10036     fi
10039 # Checks for Python to use for Pyuno
10040 AC_MSG_CHECKING([which Python to use for Pyuno])
10041 case "$enable_python" in
10042 no|disable)
10043     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10044         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10045         # requirement from the choice whether to include Python stuff in the installer, but why
10046         # bother?
10047         AC_MSG_ERROR([Python is required at build time.])
10048     fi
10049     enable_python=no
10050     AC_MSG_RESULT([none])
10051     ;;
10052 ""|yes|auto)
10053     if test "$DISABLE_SCRIPTING" = TRUE; then
10054         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10055             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10056         fi
10057         AC_MSG_RESULT([none, overridden by --disable-scripting])
10058         enable_python=no
10059     elif test $build_os = cygwin -o $build_os = wsl; then
10060         dnl When building on Windows we don't attempt to use any installed
10061         dnl "system"  Python.
10062         AC_MSG_RESULT([fully internal])
10063         enable_python=internal
10064     elif test "$cross_compiling" = yes; then
10065         AC_MSG_RESULT([system])
10066         enable_python=system
10067     else
10068         # Unset variables set by the above AM_PATH_PYTHON so that
10069         # we actually do check anew.
10070         AC_MSG_RESULT([])
10071         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
10072         AM_PATH_PYTHON([3.3],, [:])
10073         AC_MSG_CHECKING([which Python to use for Pyuno])
10074         if test "$PYTHON" = ":"; then
10075             if test -z "$PYTHON_FOR_BUILD"; then
10076                 AC_MSG_RESULT([fully internal])
10077             else
10078                 AC_MSG_RESULT([internal])
10079             fi
10080             enable_python=internal
10081         else
10082             AC_MSG_RESULT([system])
10083             enable_python=system
10084         fi
10085     fi
10086     ;;
10087 internal)
10088     AC_MSG_RESULT([internal])
10089     ;;
10090 fully-internal)
10091     AC_MSG_RESULT([fully internal])
10092     enable_python=internal
10093     ;;
10094 system)
10095     AC_MSG_RESULT([system])
10096     if test "$_os" = Darwin -a -z "$PYTHON"; then
10097         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10098     fi
10099     ;;
10101     AC_MSG_ERROR([Incorrect --enable-python option])
10102     ;;
10103 esac
10105 if test $enable_python != no; then
10106     BUILD_TYPE="$BUILD_TYPE PYUNO"
10109 if test $enable_python = system; then
10110     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10111         # Fallback: Accept these in the environment, or as set above
10112         # for MacOSX.
10113         :
10114     elif test "$cross_compiling" != yes; then
10115         # Unset variables set by the above AM_PATH_PYTHON so that
10116         # we actually do check anew.
10117         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
10118         # This causes an error if no python command is found
10119         AM_PATH_PYTHON([3.3])
10120         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10121         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10122         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10123         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10124         if test -z "$PKG_CONFIG"; then
10125             PYTHON_CFLAGS="-I$python_include"
10126             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10127         elif $PKG_CONFIG --exists python-$python_version-embed; then
10128             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10129             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10130         elif $PKG_CONFIG --exists python-$python_version; then
10131             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10132             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10133         else
10134             PYTHON_CFLAGS="-I$python_include"
10135             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10136         fi
10137         FilterLibs "${PYTHON_LIBS}"
10138         PYTHON_LIBS="${filteredlibs}"
10139     else
10140         dnl How to find out the cross-compilation Python installation path?
10141         AC_MSG_CHECKING([for python version])
10142         AS_IF([test -n "$PYTHON_VERSION"],
10143               [AC_MSG_RESULT([$PYTHON_VERSION])],
10144               [AC_MSG_RESULT([not found])
10145                AC_MSG_ERROR([no usable python found])])
10146         test -n "$PYTHON_CFLAGS" && break
10147     fi
10149     dnl Check if the headers really work
10150     save_CPPFLAGS="$CPPFLAGS"
10151     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10152     AC_CHECK_HEADER(Python.h)
10153     CPPFLAGS="$save_CPPFLAGS"
10155     # let the PYTHON_FOR_BUILD match the same python installation that
10156     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10157     # better for PythonTests.
10158     PYTHON_FOR_BUILD=$PYTHON
10161 if test "$with_lxml" != no; then
10162     if test -z "$PYTHON_FOR_BUILD"; then
10163         case $build_os in
10164             cygwin)
10165                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10166                 ;;
10167             *)
10168                 if test "$cross_compiling" != yes ; then
10169                     BUILD_TYPE="$BUILD_TYPE LXML"
10170                 fi
10171                 ;;
10172         esac
10173     else
10174         AC_MSG_CHECKING([for python lxml])
10175         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10176             AC_MSG_RESULT([yes])
10177         else
10178             case $build_os in
10179                 cygwin)
10180                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10181                     ;;
10182                 *)
10183                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10184                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10185                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10186                         else
10187                             BUILD_TYPE="$BUILD_TYPE LXML"
10188                             AC_MSG_RESULT([no, using internal lxml])
10189                         fi
10190                     else
10191                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10192                     fi
10193                     ;;
10194             esac
10195         fi
10196     fi
10199 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10200     SYSTEM_PYTHON=
10201     PYTHON_VERSION_MAJOR=3
10202     PYTHON_VERSION_MINOR=9
10203     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.20
10204     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10205         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10206     fi
10207     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10209     # Embedded Python dies without Home set
10210     if test "$HOME" = ""; then
10211         export HOME=""
10212     fi
10215 dnl By now enable_python should be "system", "internal" or "no"
10216 case $enable_python in
10217 system)
10218     SYSTEM_PYTHON=TRUE
10220     if test "x$ac_cv_header_Python_h" != "xyes"; then
10221        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10222     fi
10224     AC_LANG_PUSH(C)
10225     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10226     AC_MSG_CHECKING([for correct python library version])
10227        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10228 #include <Python.h>
10230 int main(int argc, char **argv) {
10231    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10232    else return 1;
10234        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10235     AC_LANG_POP(C)
10237     dnl FIXME Check if the Python library can be linked with, too?
10238     ;;
10240 internal)
10241     BUILD_TYPE="$BUILD_TYPE PYTHON"
10242     if test "$OS" = LINUX -o "$OS" = WNT ; then
10243         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10244     fi
10245     ;;
10247     DISABLE_PYTHON=TRUE
10248     SYSTEM_PYTHON=
10249     ;;
10251     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10252     ;;
10253 esac
10255 AC_SUBST(DISABLE_PYTHON)
10256 AC_SUBST(SYSTEM_PYTHON)
10257 AC_SUBST(PYTHON_CFLAGS)
10258 AC_SUBST(PYTHON_FOR_BUILD)
10259 AC_SUBST(PYTHON_LIBS)
10260 AC_SUBST(PYTHON_VERSION)
10261 AC_SUBST(PYTHON_VERSION_MAJOR)
10262 AC_SUBST(PYTHON_VERSION_MINOR)
10264 AC_MSG_CHECKING([whether to build LibreLogo])
10265 case "$enable_python" in
10266 no|disable)
10267     AC_MSG_RESULT([no; Python disabled])
10268     ;;
10270     if test "${enable_librelogo}" = "no"; then
10271         AC_MSG_RESULT([no])
10272     else
10273         AC_MSG_RESULT([yes])
10274         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10275         AC_DEFINE([ENABLE_LIBRELOGO],1)
10276     fi
10277     ;;
10278 esac
10279 AC_SUBST(ENABLE_LIBRELOGO)
10281 ENABLE_MARIADBC=
10282 MARIADBC_MAJOR=1
10283 MARIADBC_MINOR=0
10284 MARIADBC_MICRO=2
10285 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10286 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10287     ENABLE_MARIADBC=TRUE
10288     AC_MSG_RESULT([yes])
10289     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10290 else
10291     AC_MSG_RESULT([no])
10293 AC_SUBST(ENABLE_MARIADBC)
10294 AC_SUBST(MARIADBC_MAJOR)
10295 AC_SUBST(MARIADBC_MINOR)
10296 AC_SUBST(MARIADBC_MICRO)
10298 if test "$ENABLE_MARIADBC" = "TRUE"; then
10299     dnl ===================================================================
10300     dnl Check for system MariaDB
10301     dnl ===================================================================
10303     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10304         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10305     fi
10307     AC_MSG_CHECKING([which MariaDB to use])
10308     if test "$with_system_mariadb" = "yes"; then
10309         AC_MSG_RESULT([external])
10310         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10311         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10312         if test -z "$MARIADBCONFIG"; then
10313             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10314             if test -z "$MARIADBCONFIG"; then
10315                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10316                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10317             fi
10318         fi
10319         AC_MSG_CHECKING([MariaDB version])
10320         MARIADB_VERSION=`$MARIADBCONFIG --version`
10321         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10322         if test "$MARIADB_MAJOR" -ge "5"; then
10323             AC_MSG_RESULT([OK])
10324         else
10325             AC_MSG_ERROR([too old, use 5.0.x or later])
10326         fi
10327         AC_MSG_CHECKING([for MariaDB Client library])
10328         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10329         if test "$COM_IS_CLANG" = TRUE; then
10330             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10331         fi
10332         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10333         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10334         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10335         dnl linux32:
10336         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10337             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10338             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10339                 | sed -e 's|/lib64/|/lib/|')
10340         fi
10341         FilterLibs "${MARIADB_LIBS}"
10342         MARIADB_LIBS="${filteredlibs}"
10343         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10344         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10345         if test "$enable_bundle_mariadb" = "yes"; then
10346             AC_MSG_RESULT([yes])
10347             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10348             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10350 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10352 /g' | grep -E '(mysqlclient|mariadb)')
10353             if test "$_os" = "Darwin"; then
10354                 LIBMARIADB=${LIBMARIADB}.dylib
10355                 if test "$with_gssapi" != "no"; then
10356                     WITH_GSSAPI=TRUE
10357                     save_LIBS=$LIBS
10358                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10359                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10360                     GSSAPI_LIBS=$LIBS
10361                     LIBS=$save_LIBS
10362                 fi
10363             elif test "$_os" = "WINNT"; then
10364                 LIBMARIADB=${LIBMARIADB}.dll
10365             else
10366                 LIBMARIADB=${LIBMARIADB}.so
10367                 if test "$with_gssapi" != "no"; then
10368                     WITH_GSSAPI=TRUE
10369                     save_LIBS=$LIBS
10370                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10371                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10372                     GSSAPI_LIBS=$LIBS
10373                     LIBS=$save_LIBS
10374                 fi
10375             fi
10376             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10377             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10378             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10379                 AC_MSG_RESULT([found.])
10380                 PathFormat "$LIBMARIADB_PATH"
10381                 LIBMARIADB_PATH="$formatted_path"
10382             else
10383                 AC_MSG_ERROR([not found.])
10384             fi
10385         else
10386             AC_MSG_RESULT([no])
10387             BUNDLE_MARIADB_CONNECTOR_C=
10388         fi
10389     else
10390         AC_MSG_RESULT([internal])
10391         SYSTEM_MARIADB_CONNECTOR_C=
10392         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10393         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10394         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10395     fi
10397     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10398     AC_SUBST(MARIADB_CFLAGS)
10399     AC_SUBST(MARIADB_LIBS)
10400     AC_SUBST(LIBMARIADB)
10401     AC_SUBST(LIBMARIADB_PATH)
10402     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10405 dnl ===================================================================
10406 dnl Check for system hsqldb
10407 dnl ===================================================================
10408 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10409     AC_MSG_CHECKING([which hsqldb to use])
10410     if test "$with_system_hsqldb" = "yes"; then
10411         AC_MSG_RESULT([external])
10412         SYSTEM_HSQLDB=TRUE
10413         if test -z $HSQLDB_JAR; then
10414             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10415         fi
10416         if ! test -f $HSQLDB_JAR; then
10417                AC_MSG_ERROR(hsqldb.jar not found.)
10418         fi
10419         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10420         export HSQLDB_JAR
10421         if $PERL -e \
10422            'use Archive::Zip;
10423             my $file = "$ENV{'HSQLDB_JAR'}";
10424             my $zip = Archive::Zip->new( $file );
10425             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10426             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10427             {
10428                 push @l, split(/\n/, $mf);
10429                 foreach my $line (@l)
10430                 {
10431                     if ($line =~ m/Specification-Version:/)
10432                     {
10433                         ($t, $version) = split (/:/,$line);
10434                         $version =~ s/^\s//;
10435                         ($a, $b, $c, $d) = split (/\./,$version);
10436                         if ($c == "0" && $d > "8")
10437                         {
10438                             exit 0;
10439                         }
10440                         else
10441                         {
10442                             exit 1;
10443                         }
10444                     }
10445                 }
10446             }
10447             else
10448             {
10449                 exit 1;
10450             }'; then
10451             AC_MSG_RESULT([yes])
10452         else
10453             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10454         fi
10455     else
10456         AC_MSG_RESULT([internal])
10457         SYSTEM_HSQLDB=
10458         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10459         NEED_ANT=TRUE
10460     fi
10461 else
10462     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10463         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10464     fi
10466 AC_SUBST(SYSTEM_HSQLDB)
10467 AC_SUBST(HSQLDB_JAR)
10469 dnl ===================================================================
10470 dnl Check for PostgreSQL stuff
10471 dnl ===================================================================
10472 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10473 if test "x$enable_postgresql_sdbc" != "xno"; then
10474     AC_MSG_RESULT([yes])
10475     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10477     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10478         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10479     fi
10480     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10481         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10482     fi
10484     postgres_interface=""
10485     if test "$with_system_postgresql" = "yes"; then
10486         postgres_interface="external PostgreSQL"
10487         SYSTEM_POSTGRESQL=TRUE
10488         if test "$_os" = Darwin; then
10489             supp_path=''
10490             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10491                 pg_supp_path="$P_SEP$d$pg_supp_path"
10492             done
10493         fi
10494         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10495         if test -n "$PGCONFIG"; then
10496             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10497             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10498         else
10499             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10500               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10501               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10502             ],[
10503               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10504             ])
10505         fi
10506         FilterLibs "${POSTGRESQL_LIB}"
10507         POSTGRESQL_LIB="${filteredlibs}"
10508     else
10509         # if/when anything else than PostgreSQL uses Kerberos,
10510         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10511         WITH_KRB5=
10512         WITH_GSSAPI=
10513         case "$_os" in
10514         Darwin)
10515             # macOS has system MIT Kerberos 5 since 10.4
10516             if test "$with_krb5" != "no"; then
10517                 WITH_KRB5=TRUE
10518                 save_LIBS=$LIBS
10519                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10520                 # that the libraries where these functions are located on macOS will change, is it?
10521                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10522                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10523                 KRB5_LIBS=$LIBS
10524                 LIBS=$save_LIBS
10525                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10526                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10527                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10528                 LIBS=$save_LIBS
10529             fi
10530             if test "$with_gssapi" != "no"; then
10531                 WITH_GSSAPI=TRUE
10532                 save_LIBS=$LIBS
10533                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10534                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10535                 GSSAPI_LIBS=$LIBS
10536                 LIBS=$save_LIBS
10537             fi
10538             ;;
10539         WINNT)
10540             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10541                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10542             fi
10543             ;;
10544         Linux|GNU|*BSD|DragonFly)
10545             if test "$with_krb5" != "no"; then
10546                 WITH_KRB5=TRUE
10547                 save_LIBS=$LIBS
10548                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10549                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10550                 KRB5_LIBS=$LIBS
10551                 LIBS=$save_LIBS
10552                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10553                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10554                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10555                 LIBS=$save_LIBS
10556             fi
10557             if test "$with_gssapi" != "no"; then
10558                 WITH_GSSAPI=TRUE
10559                 save_LIBS=$LIBS
10560                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10561                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10562                 GSSAPI_LIBS=$LIBS
10563                 LIBS=$save_LIBS
10564             fi
10565             ;;
10566         *)
10567             if test "$with_krb5" = "yes"; then
10568                 WITH_KRB5=TRUE
10569                 save_LIBS=$LIBS
10570                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10571                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10572                 KRB5_LIBS=$LIBS
10573                 LIBS=$save_LIBS
10574                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10575                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10576                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10577                 LIBS=$save_LIBS
10578             fi
10579             if test "$with_gssapi" = "yes"; then
10580                 WITH_GSSAPI=TRUE
10581                 save_LIBS=$LIBS
10582                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10583                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10584                 LIBS=$save_LIBS
10585                 GSSAPI_LIBS=$LIBS
10586             fi
10587         esac
10589         if test -n "$with_libpq_path"; then
10590             SYSTEM_POSTGRESQL=TRUE
10591             postgres_interface="external libpq"
10592             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10593             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10594         else
10595             SYSTEM_POSTGRESQL=
10596             postgres_interface="internal"
10597             POSTGRESQL_LIB=""
10598             POSTGRESQL_INC="%OVERRIDE_ME%"
10599             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10600         fi
10601     fi
10603     AC_MSG_CHECKING([PostgreSQL C interface])
10604     AC_MSG_RESULT([$postgres_interface])
10606     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10607         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10608         save_CFLAGS=$CFLAGS
10609         save_CPPFLAGS=$CPPFLAGS
10610         save_LIBS=$LIBS
10611         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10612         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10613         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10614         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10615             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10616         CFLAGS=$save_CFLAGS
10617         CPPFLAGS=$save_CPPFLAGS
10618         LIBS=$save_LIBS
10619     fi
10620     BUILD_POSTGRESQL_SDBC=TRUE
10621 else
10622     AC_MSG_RESULT([no])
10624 AC_SUBST(WITH_KRB5)
10625 AC_SUBST(WITH_GSSAPI)
10626 AC_SUBST(GSSAPI_LIBS)
10627 AC_SUBST(KRB5_LIBS)
10628 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10629 AC_SUBST(SYSTEM_POSTGRESQL)
10630 AC_SUBST(POSTGRESQL_INC)
10631 AC_SUBST(POSTGRESQL_LIB)
10633 dnl ===================================================================
10634 dnl Check for Firebird stuff
10635 dnl ===================================================================
10636 ENABLE_FIREBIRD_SDBC=
10637 if test "$enable_firebird_sdbc" = "yes" ; then
10638     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10640     dnl ===================================================================
10641     dnl Check for system Firebird
10642     dnl ===================================================================
10643     AC_MSG_CHECKING([which Firebird to use])
10644     if test "$with_system_firebird" = "yes"; then
10645         AC_MSG_RESULT([external])
10646         SYSTEM_FIREBIRD=TRUE
10647         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10648         if test -z "$FIREBIRDCONFIG"; then
10649             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10650             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10651                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10652             ])
10653             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10654         else
10655             AC_MSG_NOTICE([fb_config found])
10656             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10657             AC_MSG_CHECKING([for Firebird Client library])
10658             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10659             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10660             FilterLibs "${FIREBIRD_LIBS}"
10661             FIREBIRD_LIBS="${filteredlibs}"
10662         fi
10663         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10664         AC_MSG_CHECKING([Firebird version])
10665         if test -n "${FIREBIRD_VERSION}"; then
10666             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10667             if test "$FIREBIRD_MAJOR" -ge "3"; then
10668                 AC_MSG_RESULT([OK])
10669             else
10670                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10671             fi
10672         else
10673             save_CFLAGS="${CFLAGS}"
10674             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10675             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10676 #if defined(FB_API_VER) && FB_API_VER == 30
10677 int fb_api_is_30(void) { return 0; }
10678 #else
10679 #error "Wrong Firebird API version"
10680 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10681             CFLAGS="$save_CFLAGS"
10682         fi
10683         ENABLE_FIREBIRD_SDBC=TRUE
10684         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10685     elif test "$enable_database_connectivity" = no; then
10686         AC_MSG_RESULT([none])
10687     elif test "$cross_compiling" = "yes"; then
10688         AC_MSG_RESULT([none])
10689     else
10690         dnl Embedded Firebird has version 3.0
10691         dnl We need libatomic_ops for any non X86/X64 system
10692         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10693             dnl ===================================================================
10694             dnl Check for system libatomic_ops
10695             dnl ===================================================================
10696             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10697             if test "$with_system_libatomic_ops" = "yes"; then
10698                 SYSTEM_LIBATOMIC_OPS=TRUE
10699                 AC_CHECK_HEADERS(atomic_ops.h, [],
10700                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10701             else
10702                 SYSTEM_LIBATOMIC_OPS=
10703                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10704                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10705                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10706             fi
10707         fi
10709         AC_MSG_RESULT([internal])
10710         SYSTEM_FIREBIRD=
10711         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10712         FIREBIRD_LIBS="-lfbclient"
10714         if test "$with_system_libtommath" = "yes"; then
10715             SYSTEM_LIBTOMMATH=TRUE
10716             dnl check for tommath presence
10717             save_LIBS=$LIBS
10718             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10719             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10720             LIBS=$save_LIBS
10721         else
10722             SYSTEM_LIBTOMMATH=
10723             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10724             LIBTOMMATH_LIBS="-ltommath"
10725             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10726         fi
10728         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10729         ENABLE_FIREBIRD_SDBC=TRUE
10730         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10731     fi
10733 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10734 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10735 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10736 AC_SUBST(LIBATOMIC_OPS_LIBS)
10737 AC_SUBST(SYSTEM_FIREBIRD)
10738 AC_SUBST(FIREBIRD_CFLAGS)
10739 AC_SUBST(FIREBIRD_LIBS)
10740 AC_SUBST(SYSTEM_LIBTOMMATH)
10741 AC_SUBST(LIBTOMMATH_CFLAGS)
10742 AC_SUBST(LIBTOMMATH_LIBS)
10744 dnl ===================================================================
10745 dnl Check for system curl
10746 dnl ===================================================================
10747 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10749 if test "$enable_curl" = "yes" -a "$with_system_curl" != "yes" -a "$with_gssapi" != "no"; then
10750     if test "$_os" != "WINNT"; then
10751         WITH_GSSAPI=TRUE
10752         save_LIBS=$LIBS
10753         AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10754             [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10755         GSSAPI_LIBS=$LIBS
10756         LIBS=$save_LIBS
10757     fi
10760 dnl ===================================================================
10761 dnl Check for system boost
10762 dnl ===================================================================
10763 AC_MSG_CHECKING([which boost to use])
10764 if test "$with_system_boost" = "yes"; then
10765     AC_MSG_RESULT([external])
10766     SYSTEM_BOOST=TRUE
10767     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10768     AX_BOOST_DATE_TIME
10769     AX_BOOST_FILESYSTEM
10770     AX_BOOST_IOSTREAMS
10771     AX_BOOST_LOCALE
10772     AC_LANG_PUSH([C++])
10773     save_CXXFLAGS=$CXXFLAGS
10774     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10775     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10776        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10777     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10778        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10779     CXXFLAGS=$save_CXXFLAGS
10780     AC_LANG_POP([C++])
10781     # this is in m4/ax_boost_base.m4
10782     FilterLibs "${BOOST_LDFLAGS}"
10783     BOOST_LDFLAGS="${filteredlibs}"
10784 else
10785     AC_MSG_RESULT([internal])
10786     BUILD_TYPE="$BUILD_TYPE BOOST"
10787     SYSTEM_BOOST=
10788     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10789         # use warning-suppressing wrapper headers
10790         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10791     else
10792         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10793     fi
10795 AC_SUBST(SYSTEM_BOOST)
10797 dnl ===================================================================
10798 dnl Check for system mdds
10799 dnl ===================================================================
10800 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10801 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10803 dnl ===================================================================
10804 dnl Check for system dragonbox
10805 dnl ===================================================================
10806 AC_MSG_CHECKING([which dragonbox to use])
10807 if test "$with_system_dragonbox" = "yes"; then
10808     AC_MSG_RESULT([external])
10809     SYSTEM_DRAGONBOX=TRUE
10810     AC_LANG_PUSH([C++])
10811     save_CPPFLAGS=$CPPFLAGS
10812     # This is where upstream installs to, unfortunately no .pc or so...
10813     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10814     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10815     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10816        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10817     AC_LANG_POP([C++])
10818     CPPFLAGS=$save_CPPFLAGS
10819 else
10820     AC_MSG_RESULT([internal])
10821     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10822     SYSTEM_DRAGONBOX=
10824 AC_SUBST([SYSTEM_DRAGONBOX])
10825 AC_SUBST([DRAGONBOX_CFLAGS])
10827 dnl ===================================================================
10828 dnl Check for system frozen
10829 dnl ===================================================================
10830 AC_MSG_CHECKING([which frozen to use])
10831 if test "$with_system_frozen" = "yes"; then
10832     AC_MSG_RESULT([external])
10833     SYSTEM_FROZEN=TRUE
10834     AC_LANG_PUSH([C++])
10835     save_CPPFLAGS=$CPPFLAGS
10836     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10837        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10838     AC_LANG_POP([C++])
10839     CPPFLAGS=$save_CPPFLAGS
10840 else
10841     AC_MSG_RESULT([internal])
10842     BUILD_TYPE="$BUILD_TYPE FROZEN"
10843     SYSTEM_FROZEN=
10845 AC_SUBST([SYSTEM_FROZEN])
10846 AC_SUBST([FROZEN_CFLAGS])
10848 dnl ===================================================================
10849 dnl Check for system libfixmath
10850 dnl ===================================================================
10851 AC_MSG_CHECKING([which libfixmath to use])
10852 if test "$with_system_libfixmath" = "yes"; then
10853     AC_MSG_RESULT([external])
10854     SYSTEM_LIBFIXMATH=TRUE
10855     AC_LANG_PUSH([C++])
10856     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10857        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10858     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10859                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10860                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10861     AC_LANG_POP([C++])
10862 else
10863     AC_MSG_RESULT([internal])
10864     SYSTEM_LIBFIXMATH=
10865     LIBFIXMATH_LIBS=
10867 AC_SUBST([SYSTEM_LIBFIXMATH])
10868 AC_SUBST([LIBFIXMATH_LIBS])
10870 dnl ===================================================================
10871 dnl Check for system glm
10872 dnl ===================================================================
10873 AC_MSG_CHECKING([which glm to use])
10874 if test "$with_system_glm" = "yes"; then
10875     AC_MSG_RESULT([external])
10876     SYSTEM_GLM=TRUE
10877     AC_LANG_PUSH([C++])
10878     AC_CHECK_HEADER([glm/glm.hpp], [],
10879        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10880     AC_LANG_POP([C++])
10881 else
10882     AC_MSG_RESULT([internal])
10883     BUILD_TYPE="$BUILD_TYPE GLM"
10884     SYSTEM_GLM=
10885     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10887 AC_SUBST([GLM_CFLAGS])
10888 AC_SUBST([SYSTEM_GLM])
10890 dnl ===================================================================
10891 dnl Check for system odbc
10892 dnl ===================================================================
10893 AC_MSG_CHECKING([which odbc headers to use])
10894 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
10895     AC_MSG_RESULT([external])
10896     SYSTEM_ODBC_HEADERS=TRUE
10898     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10899         save_CPPFLAGS=$CPPFLAGS
10900         find_winsdk
10901         PathFormat "$winsdktest"
10902         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"
10903         AC_CHECK_HEADER(sqlext.h, [],
10904             [AC_MSG_ERROR(odbc not found. install odbc)],
10905             [#include <windows.h>])
10906         CPPFLAGS=$save_CPPFLAGS
10907     else
10908         AC_CHECK_HEADER(sqlext.h, [],
10909             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10910     fi
10911 elif test "$enable_database_connectivity" = no; then
10912     AC_MSG_RESULT([none])
10913 else
10914     AC_MSG_RESULT([internal])
10915     SYSTEM_ODBC_HEADERS=
10917 AC_SUBST(SYSTEM_ODBC_HEADERS)
10919 dnl ===================================================================
10920 dnl Check for system NSS
10921 dnl ===================================================================
10922 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10923     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10924     AC_DEFINE(HAVE_FEATURE_NSS)
10925     ENABLE_NSS=TRUE
10926 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10927     with_tls=openssl
10929 AC_SUBST(ENABLE_NSS)
10931 dnl ===================================================================
10932 dnl Enable LDAP support
10933 dnl ===================================================================
10935 if test "$test_openldap" = yes; then
10936     AC_MSG_CHECKING([whether to enable LDAP support])
10937     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10938         AC_MSG_RESULT([yes])
10939         ENABLE_LDAP=TRUE
10940     else
10941         if test "$enable_ldap" != "yes"; then
10942             AC_MSG_RESULT([no])
10943         else
10944             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10945         fi
10946     fi
10948 dnl ===================================================================
10949 dnl Check for system openldap
10950 dnl ===================================================================
10952     if test "$ENABLE_LDAP" = TRUE; then
10953         AC_MSG_CHECKING([which openldap library to use])
10954         if test "$with_system_openldap" = yes; then
10955             AC_MSG_RESULT([external])
10956             SYSTEM_OPENLDAP=TRUE
10957             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10958             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10959             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10960         else
10961             AC_MSG_RESULT([internal])
10962             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10963         fi
10964     fi
10967 AC_SUBST(ENABLE_LDAP)
10968 AC_SUBST(SYSTEM_OPENLDAP)
10970 dnl ===================================================================
10971 dnl Check for TLS/SSL and cryptographic implementation to use
10972 dnl ===================================================================
10973 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10974 if test -n "$with_tls"; then
10975     case $with_tls in
10976     openssl)
10977         AC_DEFINE(USE_TLS_OPENSSL)
10978         TLS=OPENSSL
10979         AC_MSG_RESULT([$TLS])
10981         if test "$enable_openssl" != "yes"; then
10982             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10983         fi
10985         # warn that OpenSSL has been selected but not all TLS code has this option
10986         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10987         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10988         ;;
10989     nss)
10990         AC_DEFINE(USE_TLS_NSS)
10991         TLS=NSS
10992         AC_MSG_RESULT([$TLS])
10993         ;;
10994     no)
10995         AC_MSG_RESULT([none])
10996         AC_MSG_WARN([Skipping TLS/SSL])
10997         ;;
10998     *)
10999         AC_MSG_RESULT([])
11000         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
11001 openssl - OpenSSL
11002 nss - Mozilla's Network Security Services (NSS)
11003     ])
11004         ;;
11005     esac
11006 else
11007     # default to using NSS, it results in smaller oox lib
11008     AC_DEFINE(USE_TLS_NSS)
11009     TLS=NSS
11010     AC_MSG_RESULT([$TLS])
11012 AC_SUBST(TLS)
11014 dnl ===================================================================
11015 dnl Check for system sane
11016 dnl ===================================================================
11017 AC_MSG_CHECKING([which sane header to use])
11018 if test "$with_system_sane" = "yes"; then
11019     AC_MSG_RESULT([external])
11020     AC_CHECK_HEADER(sane/sane.h, [],
11021       [AC_MSG_ERROR(sane not found. install sane)], [])
11022 else
11023     AC_MSG_RESULT([internal])
11024     BUILD_TYPE="$BUILD_TYPE SANE"
11027 dnl ===================================================================
11028 dnl Check for system icu
11029 dnl ===================================================================
11030 ICU_MAJOR=74
11031 ICU_MINOR=2
11032 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11033 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
11034 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11035 if test "$SYSTEM_ICU" = TRUE; then
11036     AC_LANG_PUSH([C++])
11037     AC_MSG_CHECKING([for unicode/rbbi.h])
11038     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11039     AC_LANG_POP([C++])
11041     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11042     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11043     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11045     if test "$CROSS_COMPILING" != TRUE; then
11046         # using the system icu tools can lead to version confusion, use the
11047         # ones from the build environment when cross-compiling
11048         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11049         if test -z "$SYSTEM_GENBRK"; then
11050             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11051         fi
11052         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11053         if test -z "$SYSTEM_GENCCODE"; then
11054             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11055         fi
11056         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11057         if test -z "$SYSTEM_GENCMN"; then
11058             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11059         fi
11060     fi
11063 AC_SUBST(SYSTEM_GENBRK)
11064 AC_SUBST(SYSTEM_GENCCODE)
11065 AC_SUBST(SYSTEM_GENCMN)
11066 AC_SUBST(ICU_MAJOR)
11067 AC_SUBST(ICU_MINOR)
11069 dnl ==================================================================
11070 dnl CURL
11071 dnl ==================================================================
11072 if test "$enable_curl" = "yes"; then
11073     AC_DEFINE([HAVE_FEATURE_CURL])
11076 dnl ==================================================================
11077 dnl Breakpad
11078 dnl ==================================================================
11079 DEFAULT_CRASHDUMP_VALUE="true"
11080 AC_MSG_CHECKING([whether to enable breakpad])
11081 if test "$enable_breakpad" != yes; then
11082     AC_MSG_RESULT([no])
11083 else
11084     if test "$enable_curl" != "yes"; then
11085         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11086     fi
11087     AC_MSG_RESULT([yes])
11088     ENABLE_BREAKPAD="TRUE"
11089     AC_DEFINE(ENABLE_BREAKPAD)
11090     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11091     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11093     AC_MSG_CHECKING([for disable crash dump])
11094     if test "$enable_crashdump" = no; then
11095         DEFAULT_CRASHDUMP_VALUE="false"
11096         AC_MSG_RESULT([yes])
11097     else
11098        AC_MSG_RESULT([no])
11099     fi
11101     AC_MSG_CHECKING([for crashreport config])
11102     if test "$with_symbol_config" = "no"; then
11103         BREAKPAD_SYMBOL_CONFIG="invalid"
11104         AC_MSG_RESULT([no])
11105     else
11106         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11107         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11108         AC_MSG_RESULT([yes])
11109     fi
11110     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11112 AC_SUBST(ENABLE_BREAKPAD)
11113 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11115 dnl ==================================================================
11116 dnl libcmis
11117 dnl ==================================================================
11118 if test "$enable_libcmis" = "yes"; then
11119     if test "$enable_curl" != "yes"; then
11120         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11121     fi
11124 dnl ===================================================================
11125 dnl Orcus
11126 dnl ===================================================================
11127 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11128 if test "$with_system_orcus" != "yes"; then
11129     if test "$SYSTEM_BOOST" = "TRUE"; then
11130         dnl Link with Boost.System
11131         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11132         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11133         dnl in documentation has no effect.
11134         AX_BOOST_SYSTEM
11135     fi
11137 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11138 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11139 AC_SUBST([BOOST_SYSTEM_LIB])
11140 AC_SUBST(SYSTEM_LIBORCUS)
11142 dnl ===================================================================
11143 dnl HarfBuzz
11144 dnl ===================================================================
11145 harfbuzz_required_version=5.1.0
11147 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11148 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11149 case "$_os" in
11150     Linux)
11151         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
11152         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11153         ;;
11154     *)
11155         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
11156         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11157         ;;
11158 esac
11159 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11160 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11162 if test "$COM" = "MSC"; then # override the above
11163     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
11164     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11167 if test "$with_system_harfbuzz" = "yes"; then
11168     if test "$with_system_graphite" = "no"; then
11169         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11170     fi
11171     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11172     save_LIBS="$LIBS"
11173     save_CFLAGS="$CFLAGS"
11174     LIBS="$LIBS $HARFBUZZ_LIBS"
11175     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11176     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11177     LIBS="$save_LIBS"
11178     CFLAGS="$save_CFLAGS"
11179 else
11180     if test "$with_system_graphite" = "yes"; then
11181         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11182     fi
11185 if test "$USING_X11" = TRUE; then
11186     AC_PATH_X
11187     AC_PATH_XTRA
11188     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11190     if test -z "$x_includes"; then
11191         x_includes="default_x_includes"
11192     fi
11193     if test -z "$x_libraries"; then
11194         x_libraries="default_x_libraries"
11195     fi
11196     CFLAGS="$CFLAGS $X_CFLAGS"
11197     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11198     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11199 else
11200     x_includes="no_x_includes"
11201     x_libraries="no_x_libraries"
11204 if test "$USING_X11" = TRUE; then
11205     dnl ===================================================================
11206     dnl Check for extension headers
11207     dnl ===================================================================
11208     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11209      [#include <X11/extensions/shape.h>])
11211     # vcl needs ICE and SM
11212     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11213     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11214         [AC_MSG_ERROR(ICE library not found)])
11215     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11216     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11217         [AC_MSG_ERROR(SM library not found)])
11220 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11221     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11222     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11225 dnl ===================================================================
11226 dnl Check for system Xrender
11227 dnl ===================================================================
11228 AC_MSG_CHECKING([whether to use Xrender])
11229 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11230     AC_MSG_RESULT([yes])
11231     PKG_CHECK_MODULES(XRENDER, xrender)
11232     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11233     FilterLibs "${XRENDER_LIBS}"
11234     XRENDER_LIBS="${filteredlibs}"
11235     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11236       [AC_MSG_ERROR(libXrender not found or functional)], [])
11237     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11238       [AC_MSG_ERROR(Xrender not found. install X)], [])
11239 else
11240     AC_MSG_RESULT([no])
11242 AC_SUBST(XRENDER_CFLAGS)
11243 AC_SUBST(XRENDER_LIBS)
11245 dnl ===================================================================
11246 dnl Check for XRandr
11247 dnl ===================================================================
11248 AC_MSG_CHECKING([whether to enable RandR support])
11249 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11250     AC_MSG_RESULT([yes])
11251     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11252     if test "$ENABLE_RANDR" != "TRUE"; then
11253         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11254                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11255         XRANDR_CFLAGS=" "
11256         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11257           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11258         XRANDR_LIBS="-lXrandr "
11259         ENABLE_RANDR="TRUE"
11260     fi
11261     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11262     FilterLibs "${XRANDR_LIBS}"
11263     XRANDR_LIBS="${filteredlibs}"
11264 else
11265     ENABLE_RANDR=""
11266     AC_MSG_RESULT([no])
11268 AC_SUBST(XRANDR_CFLAGS)
11269 AC_SUBST(XRANDR_LIBS)
11270 AC_SUBST(ENABLE_RANDR)
11272 if test -z "$with_webdav"; then
11273     with_webdav=$test_webdav
11276 AC_MSG_CHECKING([for WebDAV support])
11277 case "$with_webdav" in
11279     AC_MSG_RESULT([no])
11280     WITH_WEBDAV=""
11281     ;;
11283     AC_MSG_RESULT([yes])
11284     # curl is already mandatory (almost) and checked elsewhere
11285     if test "$enable_curl" = "no"; then
11286         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11287     fi
11288     WITH_WEBDAV=TRUE
11289     ;;
11290 esac
11291 AC_SUBST(WITH_WEBDAV)
11293 dnl ===================================================================
11294 dnl Check for disabling cve_tests
11295 dnl ===================================================================
11296 AC_MSG_CHECKING([whether to execute CVE tests])
11297 if test "$enable_cve_tests" = "no"; then
11298     AC_MSG_RESULT([no])
11299     DISABLE_CVE_TESTS=TRUE
11300     AC_SUBST(DISABLE_CVE_TESTS)
11301 else
11302     AC_MSG_RESULT([yes])
11305 dnl ===================================================================
11306 dnl Check for system openssl
11307 dnl ===================================================================
11308 ENABLE_OPENSSL=
11309 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11310 if test "$enable_openssl" = "yes"; then
11311     AC_MSG_RESULT([no])
11312     ENABLE_OPENSSL=TRUE
11313     if test "$_os" = Darwin ; then
11314         # OpenSSL is deprecated when building for 10.7 or later.
11315         #
11316         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11317         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11319         with_system_openssl=no
11320         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11321     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11322             && test "$with_system_openssl" != "no"; then
11323         with_system_openssl=yes
11324         SYSTEM_OPENSSL=TRUE
11325         OPENSSL_CFLAGS=
11326         OPENSSL_LIBS="-lssl -lcrypto"
11327     else
11328         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11329         if test -n "${SYSTEM_OPENSSL}"; then
11330             AC_DEFINE([SYSTEM_OPENSSL])
11331         fi
11332     fi
11333     if test "$with_system_openssl" = "yes"; then
11334         AC_MSG_CHECKING([whether openssl supports SHA512])
11335         AC_LANG_PUSH([C])
11336         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11337             SHA512_CTX context;
11338 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11339         AC_LANG_POP(C)
11340     fi
11341 else
11342     AC_MSG_RESULT([yes])
11344     # warn that although OpenSSL is disabled, system libraries may depend on it
11345     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11346     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11349 AC_SUBST([ENABLE_OPENSSL])
11351 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11352     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11353         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11354         enable_cipher_openssl_backend=no
11355     else
11356         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11357     fi
11359 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11360 ENABLE_CIPHER_OPENSSL_BACKEND=
11361 if test "$enable_cipher_openssl_backend" = yes; then
11362     AC_MSG_RESULT([yes])
11363     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11364 else
11365     AC_MSG_RESULT([no])
11367 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11369 dnl ===================================================================
11370 dnl Select the crypto backends used by LO
11371 dnl ===================================================================
11373 if test "$build_crypto" = yes; then
11374     if test "$OS" = WNT; then
11375         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11376         AC_DEFINE([USE_CRYPTO_MSCAPI])
11377     elif test "$ENABLE_NSS" = TRUE; then
11378         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11379         AC_DEFINE([USE_CRYPTO_NSS])
11380     fi
11383 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11384 if test "$COM" = "MSC"; then
11385     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11386 else
11387     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11389 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11391 dnl ===================================================================
11392 dnl Check for system redland
11393 dnl ===================================================================
11394 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11395 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11396 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11397 if test "$with_system_redland" = "yes"; then
11398     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11399             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11400 else
11401     RAPTOR_MAJOR="0"
11402     RASQAL_MAJOR="3"
11403     REDLAND_MAJOR="0"
11405 AC_SUBST(RAPTOR_MAJOR)
11406 AC_SUBST(RASQAL_MAJOR)
11407 AC_SUBST(REDLAND_MAJOR)
11409 dnl ===================================================================
11410 dnl Check for system hunspell
11411 dnl ===================================================================
11412 AC_MSG_CHECKING([which libhunspell to use])
11413 if test "$with_system_hunspell" = "yes"; then
11414     AC_MSG_RESULT([external])
11415     SYSTEM_HUNSPELL=TRUE
11416     AC_LANG_PUSH([C++])
11417     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11418     if test "$HUNSPELL_PC" != "TRUE"; then
11419         AC_CHECK_HEADER(hunspell.hxx, [],
11420             [
11421             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11422             [AC_MSG_ERROR(hunspell headers not found.)], [])
11423             ], [])
11424         AC_CHECK_LIB([hunspell], [main], [:],
11425            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11426         HUNSPELL_LIBS=-lhunspell
11427     fi
11428     AC_LANG_POP([C++])
11429     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11430     FilterLibs "${HUNSPELL_LIBS}"
11431     HUNSPELL_LIBS="${filteredlibs}"
11432 else
11433     AC_MSG_RESULT([internal])
11434     SYSTEM_HUNSPELL=
11435     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11436     if test "$COM" = "MSC"; then
11437         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11438     else
11439         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11440     fi
11441     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11443 AC_SUBST(SYSTEM_HUNSPELL)
11444 AC_SUBST(HUNSPELL_CFLAGS)
11445 AC_SUBST(HUNSPELL_LIBS)
11447 dnl ===================================================================
11448 dnl Check for system zxcvbn
11449 dnl ===================================================================
11450 AC_MSG_CHECKING([which zxcvbn to use])
11451 if test "$with_system_zxcvbn" = "yes"; then
11452     AC_MSG_RESULT([external])
11453     SYSTEM_ZXCVBN=TRUE
11454     AC_CHECK_HEADER(zxcvbn.h, [],
11455        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11456     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11457         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11458 else
11459    AC_MSG_RESULT([internal])
11460    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11461    SYSTEM_ZXCVBN=
11463 AC_SUBST(SYSTEM_ZXCVBN)
11465 dnl ===================================================================
11466 dnl Check for system zxing
11467 dnl ===================================================================
11468 AC_MSG_CHECKING([whether to use zxing])
11469 if test "$enable_zxing" = "no"; then
11470     AC_MSG_RESULT([no])
11471     ENABLE_ZXING=
11472     SYSTEM_ZXING=
11473 else
11474     AC_MSG_RESULT([yes])
11475     ENABLE_ZXING=TRUE
11476     AC_MSG_CHECKING([which libzxing to use])
11477     if test "$with_system_zxing" = "yes"; then
11478         AC_MSG_RESULT([external])
11479         SYSTEM_ZXING=TRUE
11480         ZXING_CFLAGS=
11481         AC_LANG_PUSH([C++])
11482         save_CXXFLAGS=$CXXFLAGS
11483         save_IFS=$IFS
11484         IFS=$P_SEP
11485         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11486             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11487             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11488             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11489             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11490             dnl unsetting IFS."):
11491             IFS=$save_IFS
11492             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11493             dnl ignore them here:
11494             if test -z "$i"; then
11495                 continue
11496             fi
11497             dnl TODO: White space in $i would cause problems:
11498             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11499             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11500                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11501         done
11502         CXXFLAGS=$save_CXXFLAGS
11503         if test -z "$ZXING_CFLAGS"; then
11504             AC_MSG_ERROR(zxing headers not found.)
11505         fi
11506         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11507             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11508             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11509         AC_LANG_POP([C++])
11510         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11511         FilterLibs "${ZXING_LIBS}"
11512         ZXING_LIBS="${filteredlibs}"
11513     else
11514         AC_MSG_RESULT([internal])
11515         SYSTEM_ZXING=
11516         BUILD_TYPE="$BUILD_TYPE ZXING"
11517         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11518     fi
11519     if test "$ENABLE_ZXING" = TRUE; then
11520         AC_DEFINE(ENABLE_ZXING)
11521     fi
11522     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11523     AC_LANG_PUSH([C++])
11524     save_CXXFLAGS=$CXXFLAGS
11525     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11526     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11527             #include <BitMatrix.h>
11528             #include <BitMatrixIO.h>
11529             int main(){
11530                 ZXing::BitMatrix matrix(1, 1);
11531                 matrix.set(0, 0, true);
11532                 ZXing::ToSVG(matrix);
11533                 return 0;
11534             }
11535         ])], [
11536             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11537             AC_MSG_RESULT([yes])
11538         ], [AC_MSG_RESULT([no])])
11539     CXXFLAGS=$save_CXXFLAGS
11540     AC_LANG_POP([C++])
11541     AC_SUBST(HAVE_ZXING_TOSVG)
11543 AC_SUBST(SYSTEM_ZXING)
11544 AC_SUBST(ENABLE_ZXING)
11545 AC_SUBST(ZXING_CFLAGS)
11546 AC_SUBST(ZXING_LIBS)
11548 dnl ===================================================================
11549 dnl Check for system box2d
11550 dnl ===================================================================
11551 AC_MSG_CHECKING([which box2d to use])
11552 if test "$with_system_box2d" = "yes"; then
11553     AC_MSG_RESULT([external])
11554     SYSTEM_BOX2D=TRUE
11555     AC_LANG_PUSH([C++])
11556     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11557         [BOX2D_H_FOUND='FALSE'])
11558     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11559         _BOX2D_LIB=box2d
11560         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11561     else
11562         # fail this. there's no other alternative to check when we are here.
11563         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11564             [AC_MSG_ERROR(box2d headers not found.)])
11565         _BOX2D_LIB=Box2D
11566         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11567     fi
11568     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11569         [ AC_MSG_ERROR(box2d library not found.) ], [])
11570     BOX2D_LIBS=-l$_BOX2D_LIB
11571     AC_LANG_POP([C++])
11572     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11573     FilterLibs "${BOX2D_LIBS}"
11574     BOX2D_LIBS="${filteredlibs}"
11575 else
11576     AC_MSG_RESULT([internal])
11577     SYSTEM_BOX2D=
11578     BUILD_TYPE="$BUILD_TYPE BOX2D"
11580 AC_SUBST(SYSTEM_BOX2D)
11581 AC_SUBST(BOX2D_CFLAGS)
11582 AC_SUBST(BOX2D_LIBS)
11584 dnl ===================================================================
11585 dnl Checking for altlinuxhyph
11586 dnl ===================================================================
11587 AC_MSG_CHECKING([which altlinuxhyph to use])
11588 if test "$with_system_altlinuxhyph" = "yes"; then
11589     AC_MSG_RESULT([external])
11590     SYSTEM_HYPH=TRUE
11591     AC_CHECK_HEADER(hyphen.h, [],
11592        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11593     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11594        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11595        [#include <hyphen.h>])
11596     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11597         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11598     if test -z "$HYPHEN_LIB"; then
11599         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11600            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11601     fi
11602     if test -z "$HYPHEN_LIB"; then
11603         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11604            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11605     fi
11606 else
11607     AC_MSG_RESULT([internal])
11608     SYSTEM_HYPH=
11609     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11610     if test "$COM" = "MSC"; then
11611         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11612     else
11613         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11614     fi
11616 AC_SUBST(SYSTEM_HYPH)
11617 AC_SUBST(HYPHEN_LIB)
11619 dnl ===================================================================
11620 dnl Checking for mythes
11621 dnl ===================================================================
11622 AC_MSG_CHECKING([which mythes to use])
11623 if test "$with_system_mythes" = "yes"; then
11624     AC_MSG_RESULT([external])
11625     SYSTEM_MYTHES=TRUE
11626     AC_LANG_PUSH([C++])
11627     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11628     if test "$MYTHES_PKGCONFIG" = "no"; then
11629         AC_CHECK_HEADER(mythes.hxx, [],
11630             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11631         AC_CHECK_LIB([mythes-1.2], [main], [:],
11632             [ MYTHES_FOUND=no], [])
11633     if test "$MYTHES_FOUND" = "no"; then
11634         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11635                 [ MYTHES_FOUND=no], [])
11636     fi
11637     if test "$MYTHES_FOUND" = "no"; then
11638         AC_MSG_ERROR([mythes library not found!.])
11639     fi
11640     fi
11641     AC_LANG_POP([C++])
11642     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11643     FilterLibs "${MYTHES_LIBS}"
11644     MYTHES_LIBS="${filteredlibs}"
11645 else
11646     AC_MSG_RESULT([internal])
11647     SYSTEM_MYTHES=
11648     BUILD_TYPE="$BUILD_TYPE MYTHES"
11649     if test "$COM" = "MSC"; then
11650         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11651     else
11652         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11653     fi
11655 AC_SUBST(SYSTEM_MYTHES)
11656 AC_SUBST(MYTHES_CFLAGS)
11657 AC_SUBST(MYTHES_LIBS)
11659 dnl ===================================================================
11660 dnl How should we build the linear programming solver ?
11661 dnl ===================================================================
11663 ENABLE_COINMP=
11664 AC_MSG_CHECKING([whether to build with CoinMP])
11665 if test "$enable_coinmp" != "no"; then
11666     ENABLE_COINMP=TRUE
11667     AC_MSG_RESULT([yes])
11668     if test "$with_system_coinmp" = "yes"; then
11669         SYSTEM_COINMP=TRUE
11670         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11671         FilterLibs "${COINMP_LIBS}"
11672         COINMP_LIBS="${filteredlibs}"
11673     else
11674         BUILD_TYPE="$BUILD_TYPE COINMP"
11675     fi
11676 else
11677     AC_MSG_RESULT([no])
11679 AC_SUBST(ENABLE_COINMP)
11680 AC_SUBST(SYSTEM_COINMP)
11681 AC_SUBST(COINMP_CFLAGS)
11682 AC_SUBST(COINMP_LIBS)
11684 ENABLE_LPSOLVE=
11685 AC_MSG_CHECKING([whether to build with lpsolve])
11686 if test "$enable_lpsolve" != "no"; then
11687     ENABLE_LPSOLVE=TRUE
11688     AC_MSG_RESULT([yes])
11689 else
11690     AC_MSG_RESULT([no])
11692 AC_SUBST(ENABLE_LPSOLVE)
11694 if test "$ENABLE_LPSOLVE" = TRUE; then
11695     AC_MSG_CHECKING([which lpsolve to use])
11696     if test "$with_system_lpsolve" = "yes"; then
11697         AC_MSG_RESULT([external])
11698         SYSTEM_LPSOLVE=TRUE
11699         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11700            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11701         save_LIBS=$LIBS
11702         # some systems need this. Like Ubuntu...
11703         AC_CHECK_LIB(m, floor)
11704         AC_CHECK_LIB(dl, dlopen)
11705         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11706             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11707         LIBS=$save_LIBS
11708     else
11709         AC_MSG_RESULT([internal])
11710         SYSTEM_LPSOLVE=
11711         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11712     fi
11714 AC_SUBST(SYSTEM_LPSOLVE)
11716 dnl ===================================================================
11717 dnl Checking for libexttextcat
11718 dnl ===================================================================
11719 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11720 if test "$with_system_libexttextcat" = "yes"; then
11721     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11723 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11725 dnl ===================================================================
11726 dnl Checking for libnumbertext
11727 dnl ===================================================================
11728 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11729 if test "$with_system_libnumbertext" = "yes"; then
11730     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11731     SYSTEM_LIBNUMBERTEXT=YES
11732 else
11733     SYSTEM_LIBNUMBERTEXT=
11735 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11736 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11738 dnl ***************************************
11739 dnl testing libc version for Linux...
11740 dnl ***************************************
11741 if test "$_os" = "Linux"; then
11742     AC_MSG_CHECKING([whether the libc is recent enough])
11743     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11744     #include <features.h>
11745     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11746     #error glibc >= 2.1 is required
11747     #endif
11748     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11751 dnl =========================================
11752 dnl Check for uuidgen
11753 dnl =========================================
11754 if test "$_os" = "WINNT"; then
11755     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11756     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11757     UUIDGEN=uuidgen.exe
11758     AC_SUBST(UUIDGEN)
11759 else
11760     AC_PATH_PROG([UUIDGEN], [uuidgen])
11761     if test -z "$UUIDGEN"; then
11762         AC_MSG_WARN([uuid is needed for building installation sets])
11763     fi
11766 dnl ***************************************
11767 dnl Checking for bison and flex
11768 dnl ***************************************
11769 AC_PATH_PROG(BISON, bison)
11770 if test -z "$BISON"; then
11771     AC_MSG_ERROR([no bison found in \$PATH, install it])
11772 else
11773     AC_MSG_CHECKING([the bison version])
11774     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11775     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11776     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11777     dnl cause
11778     dnl
11779     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]
11780     dnl   typedef union YYSTYPE
11781     dnl           ~~~~~~^~~~~~~
11782     dnl
11783     dnl while at least 3.4.1 is know to be good:
11784     if test "$COMPILER_PLUGINS" = TRUE; then
11785         if test "$_bison_longver" -lt 2004; then
11786             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11787         fi
11788     else
11789         if test "$_bison_longver" -lt 2000; then
11790             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11791         fi
11792     fi
11794 AC_SUBST([BISON])
11796 AC_PATH_PROG(FLEX, flex)
11797 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11798     FLEX=`cygpath -m $FLEX`
11800 if test -z "$FLEX"; then
11801     AC_MSG_ERROR([no flex found in \$PATH, install it])
11802 else
11803     AC_MSG_CHECKING([the flex version])
11804     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11805     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11806         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11807     fi
11809 AC_SUBST([FLEX])
11811 AC_PATH_PROG(DIFF, diff)
11812 if test -z "$DIFF"; then
11813     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11815 AC_SUBST([DIFF])
11817 AC_PATH_PROG(UNIQ, uniq)
11818 if test -z "$UNIQ"; then
11819     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11821 AC_SUBST([UNIQ])
11823 dnl ***************************************
11824 dnl Checking for patch
11825 dnl ***************************************
11826 AC_PATH_PROG(PATCH, patch)
11827 if test -z "$PATCH"; then
11828     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11831 dnl On Solaris or macOS, check if --with-gnu-patch was used
11832 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11833     if test -z "$with_gnu_patch"; then
11834         GNUPATCH=$PATCH
11835     else
11836         if test -x "$with_gnu_patch"; then
11837             GNUPATCH=$with_gnu_patch
11838         else
11839             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11840         fi
11841     fi
11843     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11844     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11845         AC_MSG_RESULT([yes])
11846     else
11847         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11848             AC_MSG_RESULT([no, but accepted (Apple patch)])
11849             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11850         else
11851             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11852         fi
11853     fi
11854 else
11855     GNUPATCH=$PATCH
11858 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11859     GNUPATCH=`cygpath -m $GNUPATCH`
11862 dnl We also need to check for --with-gnu-cp
11864 if test -z "$with_gnu_cp"; then
11865     # check the place where the good stuff is hidden on Solaris...
11866     if test -x /usr/gnu/bin/cp; then
11867         GNUCP=/usr/gnu/bin/cp
11868     else
11869         AC_PATH_PROGS(GNUCP, gnucp cp)
11870     fi
11871     if test -z $GNUCP; then
11872         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11873     fi
11874 else
11875     if test -x "$with_gnu_cp"; then
11876         GNUCP=$with_gnu_cp
11877     else
11878         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11879     fi
11882 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11883     GNUCP=`cygpath -m $GNUCP`
11886 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11887 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11888     AC_MSG_RESULT([yes])
11889 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11890     AC_MSG_RESULT([yes])
11891 else
11892     case "$build_os" in
11893     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11894         x_GNUCP=[\#]
11895         GNUCP=''
11896         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11897         ;;
11898     *)
11899         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11900         ;;
11901     esac
11904 AC_SUBST(GNUPATCH)
11905 AC_SUBST(GNUCP)
11906 AC_SUBST(x_GNUCP)
11908 dnl ***************************************
11909 dnl testing assembler path
11910 dnl ***************************************
11911 ML_EXE=""
11912 if test "$_os" = "WINNT"; then
11913     case "$WIN_HOST_ARCH" in
11914     x86) assembler=ml.exe ;;
11915     x64) assembler=ml64.exe ;;
11916     arm64) assembler=armasm64.exe ;;
11917     esac
11919     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11920     if test -f "$MSVC_HOST_PATH/$assembler"; then
11921         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11922         AC_MSG_RESULT([$ML_EXE])
11923     else
11924         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11925     fi
11928 AC_SUBST(ML_EXE)
11930 dnl ===================================================================
11931 dnl We need zip and unzip
11932 dnl ===================================================================
11933 AC_PATH_PROG(ZIP, zip)
11934 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11935 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11936     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],,)
11939 AC_PATH_PROG(UNZIP, unzip)
11940 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11942 dnl ===================================================================
11943 dnl Zip must be a specific type for different build types.
11944 dnl ===================================================================
11945 if test $build_os = cygwin; then
11946     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11947         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11948     fi
11951 dnl ===================================================================
11952 dnl We need touch with -h option support.
11953 dnl ===================================================================
11954 AC_PATH_PROG(TOUCH, touch)
11955 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11956 touch "$WARNINGS_FILE"
11957 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11958     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],,)
11961 dnl ===================================================================
11962 dnl Check for system epoxy
11963 dnl ===================================================================
11964 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11965 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11967 dnl ===================================================================
11968 dnl Show which vclplugs will be built.
11969 dnl ===================================================================
11970 R=""
11972 libo_ENABLE_VCLPLUG([gen])
11973 libo_ENABLE_VCLPLUG([gtk3])
11974 libo_ENABLE_VCLPLUG([gtk3_kde5])
11975 libo_ENABLE_VCLPLUG([gtk4])
11976 libo_ENABLE_VCLPLUG([kf5])
11977 libo_ENABLE_VCLPLUG([kf6])
11978 libo_ENABLE_VCLPLUG([qt5])
11979 libo_ENABLE_VCLPLUG([qt6])
11981 if test "$_os" = "WINNT"; then
11982     R="$R win"
11983 elif test "$_os" = "Darwin"; then
11984     R="$R osx"
11985 elif test "$_os" = "iOS"; then
11986     R="ios"
11987 elif test "$_os" = Android; then
11988     R="android"
11991 build_vcl_plugins="$R"
11992 if test -z "$build_vcl_plugins"; then
11993     build_vcl_plugins=" none"
11995 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11996 VCL_PLUGIN_INFO=$R
11997 AC_SUBST([VCL_PLUGIN_INFO])
11999 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
12000     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
12003 dnl ===================================================================
12004 dnl Check for GTK libraries
12005 dnl ===================================================================
12007 GTK3_CFLAGS=""
12008 GTK3_LIBS=""
12009 ENABLE_GTKTILEDVIEWER=""
12010 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12011     if test "$with_system_cairo" = no; then
12012         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.'
12013     fi
12014     : ${with_system_cairo:=yes}
12015     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)
12016     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12017     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12018     FilterLibs "${GTK3_LIBS}"
12019     GTK3_LIBS="${filteredlibs}"
12021     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12022     if test "$with_system_epoxy" != "yes"; then
12023         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12024         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12025                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12026     fi
12027 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12028     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12029     if test "$build_os" = "cygwin"; then
12030         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12031         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12032     fi
12034     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12035     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12036     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12037     FilterLibs "${GTK3_LIBS}"
12038     GTK3_LIBS="${filteredlibs}"
12039     ENABLE_GTKTILEDVIEWER="yes"
12041 AC_SUBST(GTK3_LIBS)
12042 AC_SUBST(GTK3_CFLAGS)
12043 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12045 GTK4_CFLAGS=""
12046 GTK4_LIBS=""
12047 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12048     if test "$with_system_cairo" = no; then
12049         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12050     fi
12051     : ${with_system_cairo:=yes}
12052     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12053     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12054     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12055     FilterLibs "${GTK4_LIBS}"
12056     GTK4_LIBS="${filteredlibs}"
12058     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12059     if test "$with_system_epoxy" != "yes"; then
12060         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12061         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12062                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12063     fi
12065 AC_SUBST(GTK4_LIBS)
12066 AC_SUBST(GTK4_CFLAGS)
12068 if test "$enable_introspection" = yes; then
12069     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12070         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12071     else
12072         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12073     fi
12076 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12077 if ! test "$ENABLE_GTK3" = TRUE; then
12078     if test "$enable_atspi_tests" = yes; then
12079         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12080     fi
12081     enable_atspi_tests=no
12083 if ! test "$enable_atspi_tests" = no; then
12084     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12085     if ! test "$XVFB_RUN" = no; then
12086         dnl make sure the found xvfb-run actually works
12087         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12088         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12089             AC_MSG_RESULT([yes])
12090         else
12091             AC_MSG_RESULT([no])
12092             XVFB_RUN=no
12093         fi
12094     fi
12095     if test "$XVFB_RUN" = no; then
12096         if test "$enable_atspi_tests" = yes; then
12097             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12098         fi
12099         enable_atspi_tests=no
12100     fi
12102 if ! test "$enable_atspi_tests" = no; then
12103     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12104     if test "$DBUS_LAUNCH" = no; then
12105         if test "$enable_atspi_tests" = yes; then
12106             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12107         fi
12108         enable_atspi_tests=no
12109     fi
12111 if ! test "$enable_atspi_tests" = no; then
12112     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12113                       [if test "$enable_atspi_tests" = yes; then
12114                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12115                        else
12116                            enable_atspi_tests=no
12117                        fi])
12119 if ! test "x$enable_atspi_tests" = xno; then
12120     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12121                       [have_atspi_scroll_to=1],
12122                       [have_atspi_scroll_to=0])
12123     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12124                        [Whether AT-SPI2 has the scrollTo API])
12126 ENABLE_ATSPI_TESTS=
12127 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12128 AC_SUBST([ENABLE_ATSPI_TESTS])
12130 dnl ===================================================================
12131 dnl check for dbus support
12132 dnl ===================================================================
12133 ENABLE_DBUS=""
12134 DBUS_CFLAGS=""
12135 DBUS_LIBS=""
12136 DBUS_GLIB_CFLAGS=""
12137 DBUS_GLIB_LIBS=""
12138 DBUS_HAVE_GLIB=""
12140 if test "$enable_dbus" = "no"; then
12141     test_dbus=no
12144 AC_MSG_CHECKING([whether to enable DBUS support])
12145 if test "$test_dbus" = "yes"; then
12146     ENABLE_DBUS="TRUE"
12147     AC_MSG_RESULT([yes])
12148     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12149     AC_DEFINE(ENABLE_DBUS)
12150     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12151     FilterLibs "${DBUS_LIBS}"
12152     DBUS_LIBS="${filteredlibs}"
12154     # Glib is needed for BluetoothServer
12155     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12156     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12157         [
12158             DBUS_HAVE_GLIB="TRUE"
12159             AC_DEFINE(DBUS_HAVE_GLIB,1)
12160         ],
12161         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12162     )
12163 else
12164     AC_MSG_RESULT([no])
12167 AC_SUBST(ENABLE_DBUS)
12168 AC_SUBST(DBUS_CFLAGS)
12169 AC_SUBST(DBUS_LIBS)
12170 AC_SUBST(DBUS_GLIB_CFLAGS)
12171 AC_SUBST(DBUS_GLIB_LIBS)
12172 AC_SUBST(DBUS_HAVE_GLIB)
12174 AC_MSG_CHECKING([whether to enable Impress remote control])
12175 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12176     AC_MSG_RESULT([yes])
12177     ENABLE_SDREMOTE=TRUE
12178     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12179         <true/>"
12180     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12182     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12183         # The Bluetooth code doesn't compile with macOS SDK 10.15
12184         if test "$enable_sdremote_bluetooth" = yes; then
12185             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12186         fi
12187         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12188         enable_sdremote_bluetooth=no
12189     fi
12190     # If not explicitly enabled or disabled, default
12191     if test -z "$enable_sdremote_bluetooth"; then
12192         case "$OS" in
12193         LINUX|MACOSX|WNT)
12194             # Default to yes for these
12195             enable_sdremote_bluetooth=yes
12196             ;;
12197         *)
12198             # otherwise no
12199             enable_sdremote_bluetooth=no
12200             ;;
12201         esac
12202     fi
12203     # $enable_sdremote_bluetooth is guaranteed non-empty now
12205     if test "$enable_sdremote_bluetooth" != "no"; then
12206         if test "$OS" = "LINUX"; then
12207             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12208                 AC_MSG_RESULT([yes])
12209                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12210                 dnl ===================================================================
12211                 dnl Check for system bluez
12212                 dnl ===================================================================
12213                 AC_MSG_CHECKING([which Bluetooth header to use])
12214                 if test "$with_system_bluez" = "yes"; then
12215                     AC_MSG_RESULT([external])
12216                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12217                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12218                     SYSTEM_BLUEZ=TRUE
12219                 else
12220                     AC_MSG_RESULT([internal])
12221                     SYSTEM_BLUEZ=
12222                 fi
12223             else
12224                 AC_MSG_RESULT([no, dbus disabled])
12225                 ENABLE_SDREMOTE_BLUETOOTH=
12226                 SYSTEM_BLUEZ=
12227             fi
12228         else
12229             AC_MSG_RESULT([yes])
12230             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12231             SYSTEM_BLUEZ=
12232             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12233         <key>com.apple.security.device.bluetooth</key>
12234         <true/>"
12235         fi
12236     else
12237         AC_MSG_RESULT([no])
12238         ENABLE_SDREMOTE_BLUETOOTH=
12239         SYSTEM_BLUEZ=
12240     fi
12241 else
12242     ENABLE_SDREMOTE=
12243     SYSTEM_BLUEZ=
12244     AC_MSG_RESULT([no])
12246 AC_SUBST(ENABLE_SDREMOTE)
12247 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12248 AC_SUBST(SDREMOTE_ENTITLEMENT)
12249 AC_SUBST(SYSTEM_BLUEZ)
12251 dnl ===================================================================
12252 dnl Check whether to enable GIO support
12253 dnl ===================================================================
12254 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12255     AC_MSG_CHECKING([whether to enable GIO support])
12256     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12257         dnl Need at least 2.26 for the dbus support.
12258         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12259                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12260         if test "$ENABLE_GIO" = "TRUE"; then
12261             AC_DEFINE(ENABLE_GIO)
12262             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12263             FilterLibs "${GIO_LIBS}"
12264             GIO_LIBS="${filteredlibs}"
12265         fi
12266     else
12267         AC_MSG_RESULT([no])
12268     fi
12270 AC_SUBST(ENABLE_GIO)
12271 AC_SUBST(GIO_CFLAGS)
12272 AC_SUBST(GIO_LIBS)
12275 dnl ===================================================================
12277 SPLIT_APP_MODULES=""
12278 if test "$enable_split_app_modules" = "yes"; then
12279     SPLIT_APP_MODULES="TRUE"
12281 AC_SUBST(SPLIT_APP_MODULES)
12283 SPLIT_OPT_FEATURES=""
12284 if test "$enable_split_opt_features" = "yes"; then
12285     SPLIT_OPT_FEATURES="TRUE"
12287 AC_SUBST(SPLIT_OPT_FEATURES)
12289 dnl ===================================================================
12290 dnl Check whether the GStreamer libraries are available.
12291 dnl ===================================================================
12293 ENABLE_GSTREAMER_1_0=""
12295 if test "$test_gstreamer_1_0" = yes; then
12297     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12298     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12299         ENABLE_GSTREAMER_1_0="TRUE"
12300         AC_MSG_RESULT([yes])
12301         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12302         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12303         FilterLibs "${GSTREAMER_1_0_LIBS}"
12304         GSTREAMER_1_0_LIBS="${filteredlibs}"
12305         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12306     else
12307         AC_MSG_RESULT([no])
12308     fi
12310 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12311 AC_SUBST(GSTREAMER_1_0_LIBS)
12312 AC_SUBST(ENABLE_GSTREAMER_1_0)
12314 ENABLE_OPENGL_TRANSITIONS=
12315 ENABLE_OPENGL_CANVAS=
12316 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12317    : # disable
12318 elif test "$_os" = "Darwin"; then
12319     # We use frameworks on macOS, no need for detail checks
12320     ENABLE_OPENGL_TRANSITIONS=TRUE
12321     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12322     ENABLE_OPENGL_CANVAS=TRUE
12323 elif test $_os = WINNT; then
12324     ENABLE_OPENGL_TRANSITIONS=TRUE
12325     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12326     ENABLE_OPENGL_CANVAS=TRUE
12327 else
12328     if test "$USING_X11" = TRUE; then
12329         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12330         ENABLE_OPENGL_TRANSITIONS=TRUE
12331         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12332         ENABLE_OPENGL_CANVAS=TRUE
12333     fi
12336 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12337 AC_SUBST(ENABLE_OPENGL_CANVAS)
12339 dnl =================================================
12340 dnl Check whether to build with OpenCL support.
12341 dnl =================================================
12343 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12344     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12345     # platform (optional at run-time, used through clew).
12346     BUILD_TYPE="$BUILD_TYPE OPENCL"
12347     AC_DEFINE(HAVE_FEATURE_OPENCL)
12350 dnl =================================================
12351 dnl Check whether to build with dconf support.
12352 dnl =================================================
12354 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12355     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12356         if test "$enable_dconf" = yes; then
12357             AC_MSG_ERROR([dconf not found])
12358         else
12359             enable_dconf=no
12360         fi])
12362 AC_MSG_CHECKING([whether to enable dconf])
12363 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12364     DCONF_CFLAGS=
12365     DCONF_LIBS=
12366     ENABLE_DCONF=
12367     AC_MSG_RESULT([no])
12368 else
12369     ENABLE_DCONF=TRUE
12370     AC_DEFINE(ENABLE_DCONF)
12371     AC_MSG_RESULT([yes])
12373 AC_SUBST([DCONF_CFLAGS])
12374 AC_SUBST([DCONF_LIBS])
12375 AC_SUBST([ENABLE_DCONF])
12377 # pdf import?
12378 AC_MSG_CHECKING([whether to build the PDF import feature])
12379 ENABLE_PDFIMPORT=
12380 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12381     AC_MSG_RESULT([yes])
12382     ENABLE_PDFIMPORT=TRUE
12383     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12384 else
12385     AC_MSG_RESULT([no])
12388 # Pdfium?
12389 AC_MSG_CHECKING([whether to build PDFium])
12390 ENABLE_PDFIUM=
12391 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12392     AC_MSG_RESULT([yes])
12393     ENABLE_PDFIUM=TRUE
12394     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12395 else
12396     AC_MSG_RESULT([no])
12398 AC_SUBST(ENABLE_PDFIUM)
12400 if test "$ENABLE_PDFIUM" = "TRUE"; then
12401     AC_MSG_CHECKING([which OpenJPEG library to use])
12402     if test "$with_system_openjpeg" = "yes"; then
12403         SYSTEM_OPENJPEG2=TRUE
12404         AC_MSG_RESULT([external])
12405         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12406         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12407         FilterLibs "${OPENJPEG2_LIBS}"
12408         OPENJPEG2_LIBS="${filteredlibs}"
12409     else
12410         SYSTEM_OPENJPEG2=FALSE
12411         AC_MSG_RESULT([internal])
12412     fi
12414     AC_MSG_CHECKING([which Abseil library to use])
12415     if test "$with_system_abseil" = "yes"; then
12416         AC_MSG_RESULT([external])
12417         SYSTEM_ABSEIL=TRUE
12418         AC_LANG_PUSH([C++])
12419         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12420         AC_LANG_POP([C++])
12421         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12422         FilterLibs "${ABSEIL_LIBS}"
12423         ABSEIL_LIBS="${filteredlibs}"
12424     else
12425         AC_MSG_RESULT([internal])
12426     fi
12428 AC_SUBST(SYSTEM_OPENJPEG2)
12429 AC_SUBST(SYSTEM_ABSEIL)
12430 AC_SUBST(ABSEIL_CFLAGS)
12431 AC_SUBST(ABSEIL_LIBS)
12433 dnl ===================================================================
12434 dnl Check for poppler
12435 dnl ===================================================================
12436 ENABLE_POPPLER=
12437 AC_MSG_CHECKING([whether to build Poppler])
12438 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12439     AC_MSG_RESULT([yes])
12440     ENABLE_POPPLER=TRUE
12441     AC_DEFINE(HAVE_FEATURE_POPPLER)
12442 else
12443     AC_MSG_RESULT([no])
12445 AC_SUBST(ENABLE_POPPLER)
12447 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12448     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12451 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12452     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12455 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12456     dnl ===================================================================
12457     dnl Check for system poppler
12458     dnl ===================================================================
12459     AC_MSG_CHECKING([which PDF import poppler to use])
12460     if test "$with_system_poppler" = "yes"; then
12461         AC_MSG_RESULT([external])
12462         SYSTEM_POPPLER=TRUE
12463         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12464         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12465         FilterLibs "${POPPLER_LIBS}"
12466         POPPLER_LIBS="${filteredlibs}"
12467     else
12468         AC_MSG_RESULT([internal])
12469         SYSTEM_POPPLER=
12470         BUILD_TYPE="$BUILD_TYPE POPPLER"
12471     fi
12472     AC_DEFINE([ENABLE_PDFIMPORT],1)
12474 AC_SUBST(ENABLE_PDFIMPORT)
12475 AC_SUBST(SYSTEM_POPPLER)
12476 AC_SUBST(POPPLER_CFLAGS)
12477 AC_SUBST(POPPLER_LIBS)
12479 # Skia?
12480 ENABLE_SKIA=
12481 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12482     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12483     if test "$SYSTEM_FREETYPE" = TRUE; then
12484         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12485             [skia_freetype_ok=yes],
12486             [skia_freetype_ok=no])
12487     else # internal is ok
12488         skia_freetype_ok=yes
12489     fi
12490     AC_MSG_CHECKING([whether to build Skia])
12491     if test "$skia_freetype_ok" = "yes"; then
12492         if test "$enable_skia" = "debug"; then
12493             AC_MSG_RESULT([yes (debug)])
12494             ENABLE_SKIA_DEBUG=TRUE
12495         else
12496             AC_MSG_RESULT([yes])
12497             ENABLE_SKIA_DEBUG=
12498         fi
12499         ENABLE_SKIA=TRUE
12500         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12501             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12502         fi
12504         AC_DEFINE(HAVE_FEATURE_SKIA)
12505         BUILD_TYPE="$BUILD_TYPE SKIA"
12507         if test "$OS" = "MACOSX"; then
12508             AC_DEFINE(SK_GANESH,1)
12509             AC_DEFINE(SK_METAL,1)
12510             SKIA_GPU=METAL
12511             AC_SUBST(SKIA_GPU)
12512         else
12513             AC_DEFINE(SK_GANESH,1)
12514             AC_DEFINE(SK_VULKAN,1)
12515             SKIA_GPU=VULKAN
12516             AC_SUBST(SKIA_GPU)
12517         fi
12518     else
12519         AC_MSG_RESULT([no (freetype too old)])
12520         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12521     fi
12523 else
12524     AC_MSG_CHECKING([whether to build Skia])
12525     AC_MSG_RESULT([no])
12527 AC_SUBST(ENABLE_SKIA)
12528 AC_SUBST(ENABLE_SKIA_DEBUG)
12530 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12531 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12532 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12533 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12534 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12535 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12536 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12537 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12538 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12539 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12540 LO_CLANG_VERSION=
12541 HAVE_LO_CLANG_DLLEXPORTINLINES=
12543 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12544     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12545         AC_MSG_CHECKING([for Clang])
12546         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12547     else
12548         if test "$_os" = "WINNT"; then
12549             AC_MSG_CHECKING([for clang-cl])
12550             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12551                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12552             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12553                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12554             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12555                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12556             fi
12557             if test -n "$LO_CLANG_CC"; then
12558                 dnl explicitly set -m32/-m64
12559                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12560                 LO_CLANG_CXX="$LO_CLANG_CC"
12561                 AC_MSG_RESULT([$LO_CLANG_CC])
12562             else
12563                 AC_MSG_RESULT([no])
12564             fi
12566             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12567             echo "#include <stdlib.h>" > conftest.c
12568             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12569                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12570             rm -f conftest.c conftest.obj
12571             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12572                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12573             else
12574                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12575             fi
12576         else
12577             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12578             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12579         fi
12580     fi
12581     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12582         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12583         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12584         if test "$LO_CLANG_VERSION" -lt 50002; then
12585             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12586             LO_CLANG_CC=
12587             LO_CLANG_CXX=
12588         fi
12589     fi
12590     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12591         save_CXX="$CXX"
12592         CXX="$LO_CLANG_CXX"
12593         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12594         AC_LANG_PUSH([C++])
12595         save_CXXFLAGS=$CXXFLAGS
12596         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12597         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12598                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12599                 AC_MSG_RESULT([yes])
12600             ], [AC_MSG_RESULT([no])])
12601         CXXFLAGS=$save_CXXFLAGS
12602         AC_LANG_POP([C++])
12603         CXX="$save_CXX"
12604         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12605             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.])
12606         fi
12607     fi
12608     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12609         # Skia is the default on Windows and Mac, so hard-require Clang.
12610         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12611         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12612             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12613         else
12614             AC_MSG_WARN([Clang compiler not found.])
12615         fi
12616     else
12618         save_CXX="$CXX"
12619         CXX="$LO_CLANG_CXX"
12620         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12621         flag_sse2=-msse2
12622         flag_ssse3=-mssse3
12623         flag_sse41=-msse4.1
12624         flag_sse42=-msse4.2
12625         flag_avx=-mavx
12626         flag_avx2=-mavx2
12627         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12628         flag_avx512f=-mavx512f
12629         flag_f16c=-mf16c
12630         flag_fma=-mfma
12632         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12633         AC_LANG_PUSH([C++])
12634         save_CXXFLAGS=$CXXFLAGS
12635         CXXFLAGS="$CXXFLAGS $flag_sse2"
12636         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12637             #include <emmintrin.h>
12638             int main () {
12639                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12640                 c = _mm_xor_si128 (a, b);
12641                 return 0;
12642             }
12643             ])],
12644             [can_compile_sse2=yes],
12645             [can_compile_sse2=no])
12646         AC_LANG_POP([C++])
12647         CXXFLAGS=$save_CXXFLAGS
12648         AC_MSG_RESULT([${can_compile_sse2}])
12649         if test "${can_compile_sse2}" = "yes" ; then
12650             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12651         fi
12653         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12654         AC_LANG_PUSH([C++])
12655         save_CXXFLAGS=$CXXFLAGS
12656         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12657         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12658             #include <tmmintrin.h>
12659             int main () {
12660                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12661                 c = _mm_maddubs_epi16 (a, b);
12662                 return 0;
12663             }
12664             ])],
12665             [can_compile_ssse3=yes],
12666             [can_compile_ssse3=no])
12667         AC_LANG_POP([C++])
12668         CXXFLAGS=$save_CXXFLAGS
12669         AC_MSG_RESULT([${can_compile_ssse3}])
12670         if test "${can_compile_ssse3}" = "yes" ; then
12671             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12672         fi
12674         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12675         AC_LANG_PUSH([C++])
12676         save_CXXFLAGS=$CXXFLAGS
12677         CXXFLAGS="$CXXFLAGS $flag_sse41"
12678         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12679             #include <smmintrin.h>
12680             int main () {
12681                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12682                 c = _mm_cmpeq_epi64 (a, b);
12683                 return 0;
12684             }
12685             ])],
12686             [can_compile_sse41=yes],
12687             [can_compile_sse41=no])
12688         AC_LANG_POP([C++])
12689         CXXFLAGS=$save_CXXFLAGS
12690         AC_MSG_RESULT([${can_compile_sse41}])
12691         if test "${can_compile_sse41}" = "yes" ; then
12692             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12693         fi
12695         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12696         AC_LANG_PUSH([C++])
12697         save_CXXFLAGS=$CXXFLAGS
12698         CXXFLAGS="$CXXFLAGS $flag_sse42"
12699         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12700             #include <nmmintrin.h>
12701             int main () {
12702                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12703                 c = _mm_cmpgt_epi64 (a, b);
12704                 return 0;
12705             }
12706             ])],
12707             [can_compile_sse42=yes],
12708             [can_compile_sse42=no])
12709         AC_LANG_POP([C++])
12710         CXXFLAGS=$save_CXXFLAGS
12711         AC_MSG_RESULT([${can_compile_sse42}])
12712         if test "${can_compile_sse42}" = "yes" ; then
12713             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12714         fi
12716         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12717         AC_LANG_PUSH([C++])
12718         save_CXXFLAGS=$CXXFLAGS
12719         CXXFLAGS="$CXXFLAGS $flag_avx"
12720         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12721             #include <immintrin.h>
12722             int main () {
12723                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12724                 c = _mm256_xor_ps(a, b);
12725                 return 0;
12726             }
12727             ])],
12728             [can_compile_avx=yes],
12729             [can_compile_avx=no])
12730         AC_LANG_POP([C++])
12731         CXXFLAGS=$save_CXXFLAGS
12732         AC_MSG_RESULT([${can_compile_avx}])
12733         if test "${can_compile_avx}" = "yes" ; then
12734             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12735         fi
12737         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12738         AC_LANG_PUSH([C++])
12739         save_CXXFLAGS=$CXXFLAGS
12740         CXXFLAGS="$CXXFLAGS $flag_avx2"
12741         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12742             #include <immintrin.h>
12743             int main () {
12744                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12745                 c = _mm256_maddubs_epi16(a, b);
12746                 return 0;
12747             }
12748             ])],
12749             [can_compile_avx2=yes],
12750             [can_compile_avx2=no])
12751         AC_LANG_POP([C++])
12752         CXXFLAGS=$save_CXXFLAGS
12753         AC_MSG_RESULT([${can_compile_avx2}])
12754         if test "${can_compile_avx2}" = "yes" ; then
12755             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12756         fi
12758         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12759         AC_LANG_PUSH([C++])
12760         save_CXXFLAGS=$CXXFLAGS
12761         CXXFLAGS="$CXXFLAGS $flag_avx512"
12762         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12763             #include <immintrin.h>
12764             int main () {
12765                 __m512i a = _mm512_loadu_si512(0);
12766                 __m512d v1 = _mm512_load_pd(0);
12767                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12768                 __m512d v2 = _mm512_abs_pd(v1);
12769                 return 0;
12770             }
12771             ])],
12772             [can_compile_avx512=yes],
12773             [can_compile_avx512=no])
12774         AC_LANG_POP([C++])
12775         CXXFLAGS=$save_CXXFLAGS
12776         AC_MSG_RESULT([${can_compile_avx512}])
12777         if test "${can_compile_avx512}" = "yes" ; then
12778             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12779             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12780         fi
12782         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12783         AC_LANG_PUSH([C++])
12784         save_CXXFLAGS=$CXXFLAGS
12785         CXXFLAGS="$CXXFLAGS $flag_f16c"
12786         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12787             #include <immintrin.h>
12788             int main () {
12789                 __m128i a = _mm_set1_epi32 (0);
12790                 __m128 c;
12791                 c = _mm_cvtph_ps(a);
12792                 return 0;
12793             }
12794             ])],
12795             [can_compile_f16c=yes],
12796             [can_compile_f16c=no])
12797         AC_LANG_POP([C++])
12798         CXXFLAGS=$save_CXXFLAGS
12799         AC_MSG_RESULT([${can_compile_f16c}])
12800         if test "${can_compile_f16c}" = "yes" ; then
12801             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12802         fi
12804         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12805         AC_LANG_PUSH([C++])
12806         save_CXXFLAGS=$CXXFLAGS
12807         CXXFLAGS="$CXXFLAGS $flag_fma"
12808         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12809             #include <immintrin.h>
12810             int main () {
12811                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12812                 d = _mm256_fmadd_ps(a, b, c);
12813                 return 0;
12814             }
12815             ])],
12816             [can_compile_fma=yes],
12817             [can_compile_fma=no])
12818         AC_LANG_POP([C++])
12819         CXXFLAGS=$save_CXXFLAGS
12820         AC_MSG_RESULT([${can_compile_fma}])
12821         if test "${can_compile_fma}" = "yes" ; then
12822             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12823         fi
12825         CXX="$save_CXX"
12826     fi
12829 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12831 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12832     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12833     AC_LANG_PUSH([C])
12834     save_CC="$CC"
12835     CC="$LO_CLANG_CC"
12836     save_CFLAGS=$CFLAGS
12837     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12838     dnl an empty program will do, we're checking the compiler flags
12839     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12840                       [use_ccache=yes], [use_ccache=no])
12841     CFLAGS=$save_CFLAGS
12842     CC=$save_CC
12843     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12844         AC_MSG_RESULT([yes])
12845     else
12846         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12847         AC_MSG_RESULT([no])
12848     fi
12849     AC_LANG_POP([C])
12851     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12852     AC_LANG_PUSH([C++])
12853     save_CXX="$CXX"
12854     CXX="$LO_CLANG_CXX"
12855     save_CXXFLAGS=$CXXFLAGS
12856     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12857     dnl an empty program will do, we're checking the compiler flags
12858     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12859                       [use_ccache=yes], [use_ccache=no])
12860     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12861         AC_MSG_RESULT([yes])
12862     else
12863         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12864         AC_MSG_RESULT([no])
12865     fi
12866     CXXFLAGS=$save_CXXFLAGS
12867     CXX=$save_CXX
12868     AC_LANG_POP([C++])
12871 AC_SUBST(LO_CLANG_CC)
12872 AC_SUBST(LO_CLANG_CXX)
12873 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12874 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12875 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12876 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12877 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12878 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12879 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12880 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12881 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12882 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12883 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12884 AC_SUBST(LO_CLANG_VERSION)
12885 AC_SUBST(CLANG_USE_LD)
12886 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12888 SYSTEM_GPGMEPP=
12890 AC_MSG_CHECKING([whether to enable gpgmepp])
12891 if test "$enable_gpgmepp" = no; then
12892     AC_MSG_RESULT([no])
12893 elif test "$enable_mpl_subset" = "yes"; then
12894     AC_MSG_RESULT([no (MPL only)])
12895 elif test "$enable_fuzzers" = "yes"; then
12896     AC_MSG_RESULT([no (oss-fuzz)])
12897 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12898     AC_MSG_RESULT([yes])
12899     dnl ===================================================================
12900     dnl Check for system gpgme
12901     dnl ===================================================================
12902     AC_MSG_CHECKING([which gpgmepp to use])
12903     if test "$with_system_gpgmepp" = "yes"; then
12904         AC_MSG_RESULT([external])
12905         SYSTEM_GPGMEPP=TRUE
12907         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12908         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12909             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12910         AC_CHECK_HEADER(gpgme.h, [],
12911             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12912         AC_CHECK_LIB(gpgmepp, main, [],
12913             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12914         GPGMEPP_LIBS=-lgpgmepp
12915     else
12916         AC_MSG_RESULT([internal])
12917         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12919         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12920         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12921         if test "$_os" != "WINNT"; then
12922             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12923             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12924         fi
12925     fi
12926     ENABLE_GPGMEPP=TRUE
12927     AC_DEFINE([HAVE_FEATURE_GPGME])
12928     AC_PATH_PROG(GPG, gpg)
12929     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12930     # so let's exclude that manually for the moment
12931     if test -n "$GPG" -a "$_os" != "WINNT"; then
12932         # make sure we not only have a working gpgme, but a full working
12933         # gpg installation to run OpenPGP signature verification
12934         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12935     fi
12936     if test "$_os" = "Linux"; then
12937       uid=`id -u`
12938       AC_MSG_CHECKING([for /run/user/$uid])
12939       if test -d /run/user/$uid; then
12940         AC_MSG_RESULT([yes])
12941         AC_PATH_PROG(GPGCONF, gpgconf)
12943         # Older versions of gpgconf are not working as expected, since
12944         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12945         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12946         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12947         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12948         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12949         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12950         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12951           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12952           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12953           if $GPGCONF --dump-options > /dev/null ; then
12954             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12955               AC_MSG_RESULT([yes])
12956               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12957               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12958             else
12959               AC_MSG_RESULT([no])
12960             fi
12961           else
12962             AC_MSG_RESULT([no. missing or broken gpgconf?])
12963           fi
12964         else
12965           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12966         fi
12967       else
12968         AC_MSG_RESULT([no])
12969      fi
12970    fi
12971 else
12972     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12974 AC_SUBST(ENABLE_GPGMEPP)
12975 AC_SUBST(SYSTEM_GPGMEPP)
12976 AC_SUBST(GPG_ERROR_CFLAGS)
12977 AC_SUBST(GPG_ERROR_LIBS)
12978 AC_SUBST(LIBASSUAN_CFLAGS)
12979 AC_SUBST(LIBASSUAN_LIBS)
12980 AC_SUBST(GPGMEPP_CFLAGS)
12981 AC_SUBST(GPGMEPP_LIBS)
12983 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12984 if test "$with_java" != "no"; then
12985     AC_MSG_RESULT([yes])
12986     ENABLE_JAVA_WEBSOCKET=TRUE
12987     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12988     NEED_ANT=TRUE
12989 else
12990     AC_MSG_RESULT([no])
12991     ENABLE_JAVA_WEBSOCKET=
12993 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12995 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12996 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12997     AC_MSG_RESULT([yes])
12998     ENABLE_MEDIAWIKI=TRUE
12999     BUILD_TYPE="$BUILD_TYPE XSLTML"
13000     if test  "x$with_java" = "xno"; then
13001         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
13002     fi
13003 else
13004     AC_MSG_RESULT([no])
13005     ENABLE_MEDIAWIKI=
13006     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13008 AC_SUBST(ENABLE_MEDIAWIKI)
13010 AC_MSG_CHECKING([whether to build the Report Builder])
13011 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13012     AC_MSG_RESULT([yes])
13013     ENABLE_REPORTBUILDER=TRUE
13014     AC_MSG_CHECKING([which jfreereport libs to use])
13015     if test "$with_system_jfreereport" = "yes"; then
13016         SYSTEM_JFREEREPORT=TRUE
13017         AC_MSG_RESULT([external])
13018         if test -z $SAC_JAR; then
13019             SAC_JAR=/usr/share/java/sac.jar
13020         fi
13021         if ! test -f $SAC_JAR; then
13022              AC_MSG_ERROR(sac.jar not found.)
13023         fi
13025         if test -z $LIBXML_JAR; then
13026             if test -f /usr/share/java/libxml-1.0.0.jar; then
13027                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13028             elif test -f /usr/share/java/libxml.jar; then
13029                 LIBXML_JAR=/usr/share/java/libxml.jar
13030             else
13031                 AC_MSG_ERROR(libxml.jar replacement not found.)
13032             fi
13033         elif ! test -f $LIBXML_JAR; then
13034             AC_MSG_ERROR(libxml.jar not found.)
13035         fi
13037         if test -z $FLUTE_JAR; then
13038             if test -f /usr/share/java/flute-1.3.0.jar; then
13039                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13040             elif test -f /usr/share/java/flute.jar; then
13041                 FLUTE_JAR=/usr/share/java/flute.jar
13042             else
13043                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13044             fi
13045         elif ! test -f $FLUTE_JAR; then
13046             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13047         fi
13049         if test -z $JFREEREPORT_JAR; then
13050             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13051                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13052             elif test -f /usr/share/java/flow-engine.jar; then
13053                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13054             else
13055                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13056             fi
13057         elif ! test -f  $JFREEREPORT_JAR; then
13058                 AC_MSG_ERROR(jfreereport.jar not found.)
13059         fi
13061         if test -z $LIBLAYOUT_JAR; then
13062             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13063                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13064             elif test -f /usr/share/java/liblayout.jar; then
13065                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13066             else
13067                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13068             fi
13069         elif ! test -f $LIBLAYOUT_JAR; then
13070                 AC_MSG_ERROR(liblayout.jar not found.)
13071         fi
13073         if test -z $LIBLOADER_JAR; then
13074             if test -f /usr/share/java/libloader-1.0.0.jar; then
13075                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13076             elif test -f /usr/share/java/libloader.jar; then
13077                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13078             else
13079                 AC_MSG_ERROR(libloader.jar replacement not found.)
13080             fi
13081         elif ! test -f  $LIBLOADER_JAR; then
13082             AC_MSG_ERROR(libloader.jar not found.)
13083         fi
13085         if test -z $LIBFORMULA_JAR; then
13086             if test -f /usr/share/java/libformula-0.2.0.jar; then
13087                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13088             elif test -f /usr/share/java/libformula.jar; then
13089                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13090             else
13091                 AC_MSG_ERROR(libformula.jar replacement not found.)
13092             fi
13093         elif ! test -f $LIBFORMULA_JAR; then
13094                 AC_MSG_ERROR(libformula.jar not found.)
13095         fi
13097         if test -z $LIBREPOSITORY_JAR; then
13098             if test -f /usr/share/java/librepository-1.0.0.jar; then
13099                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13100             elif test -f /usr/share/java/librepository.jar; then
13101                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13102             else
13103                 AC_MSG_ERROR(librepository.jar replacement not found.)
13104             fi
13105         elif ! test -f $LIBREPOSITORY_JAR; then
13106             AC_MSG_ERROR(librepository.jar not found.)
13107         fi
13109         if test -z $LIBFONTS_JAR; then
13110             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13111                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13112             elif test -f /usr/share/java/libfonts.jar; then
13113                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13114             else
13115                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13116             fi
13117         elif ! test -f $LIBFONTS_JAR; then
13118                 AC_MSG_ERROR(libfonts.jar not found.)
13119         fi
13121         if test -z $LIBSERIALIZER_JAR; then
13122             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13123                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13124             elif test -f /usr/share/java/libserializer.jar; then
13125                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13126             else
13127                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13128             fi
13129         elif ! test -f $LIBSERIALIZER_JAR; then
13130                 AC_MSG_ERROR(libserializer.jar not found.)
13131         fi
13133         if test -z $LIBBASE_JAR; then
13134             if test -f /usr/share/java/libbase-1.0.0.jar; then
13135                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13136             elif test -f /usr/share/java/libbase.jar; then
13137                 LIBBASE_JAR=/usr/share/java/libbase.jar
13138             else
13139                 AC_MSG_ERROR(libbase.jar replacement not found.)
13140             fi
13141         elif ! test -f $LIBBASE_JAR; then
13142             AC_MSG_ERROR(libbase.jar not found.)
13143         fi
13145     else
13146         AC_MSG_RESULT([internal])
13147         SYSTEM_JFREEREPORT=
13148         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13149         NEED_ANT=TRUE
13150     fi
13151     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13152 else
13153     AC_MSG_RESULT([no])
13154     ENABLE_REPORTBUILDER=
13155     SYSTEM_JFREEREPORT=
13157 AC_SUBST(ENABLE_REPORTBUILDER)
13158 AC_SUBST(SYSTEM_JFREEREPORT)
13159 AC_SUBST(SAC_JAR)
13160 AC_SUBST(LIBXML_JAR)
13161 AC_SUBST(FLUTE_JAR)
13162 AC_SUBST(JFREEREPORT_JAR)
13163 AC_SUBST(LIBBASE_JAR)
13164 AC_SUBST(LIBLAYOUT_JAR)
13165 AC_SUBST(LIBLOADER_JAR)
13166 AC_SUBST(LIBFORMULA_JAR)
13167 AC_SUBST(LIBREPOSITORY_JAR)
13168 AC_SUBST(LIBFONTS_JAR)
13169 AC_SUBST(LIBSERIALIZER_JAR)
13171 # scripting provider for BeanShell?
13172 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13173 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13174     AC_MSG_RESULT([yes])
13175     ENABLE_SCRIPTING_BEANSHELL=TRUE
13177     dnl ===================================================================
13178     dnl Check for system beanshell
13179     dnl ===================================================================
13180     AC_MSG_CHECKING([which beanshell to use])
13181     if test "$with_system_beanshell" = "yes"; then
13182         AC_MSG_RESULT([external])
13183         SYSTEM_BSH=TRUE
13184         if test -z $BSH_JAR; then
13185             BSH_JAR=/usr/share/java/bsh.jar
13186         fi
13187         if ! test -f $BSH_JAR; then
13188             AC_MSG_ERROR(bsh.jar not found.)
13189         fi
13190     else
13191         AC_MSG_RESULT([internal])
13192         SYSTEM_BSH=
13193         BUILD_TYPE="$BUILD_TYPE BSH"
13194     fi
13195 else
13196     AC_MSG_RESULT([no])
13197     ENABLE_SCRIPTING_BEANSHELL=
13198     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13200 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13201 AC_SUBST(SYSTEM_BSH)
13202 AC_SUBST(BSH_JAR)
13204 # scripting provider for JavaScript?
13205 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13206 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13207     AC_MSG_RESULT([yes])
13208     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13210     dnl ===================================================================
13211     dnl Check for system rhino
13212     dnl ===================================================================
13213     AC_MSG_CHECKING([which rhino to use])
13214     if test "$with_system_rhino" = "yes"; then
13215         AC_MSG_RESULT([external])
13216         SYSTEM_RHINO=TRUE
13217         if test -z $RHINO_JAR; then
13218             RHINO_JAR=/usr/share/java/js.jar
13219         fi
13220         if ! test -f $RHINO_JAR; then
13221             AC_MSG_ERROR(js.jar not found.)
13222         fi
13223     else
13224         AC_MSG_RESULT([internal])
13225         SYSTEM_RHINO=
13226         BUILD_TYPE="$BUILD_TYPE RHINO"
13227         NEED_ANT=TRUE
13228     fi
13229 else
13230     AC_MSG_RESULT([no])
13231     ENABLE_SCRIPTING_JAVASCRIPT=
13232     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13234 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13235 AC_SUBST(SYSTEM_RHINO)
13236 AC_SUBST(RHINO_JAR)
13238 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13239 # paths should be added to library search path. So lets put all 64-bit
13240 # platforms there.
13241 supports_multilib=
13242 case "$host_cpu" in
13243 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13244     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13245         supports_multilib="yes"
13246     fi
13247     ;;
13249     ;;
13250 esac
13252 dnl ===================================================================
13253 dnl QT5 Integration
13254 dnl ===================================================================
13256 QT5_CFLAGS=""
13257 QT5_LIBS=""
13258 QT5_GOBJECT_CFLAGS=""
13259 QT5_GOBJECT_LIBS=""
13260 QT5_HAVE_GOBJECT=""
13261 QT5_PLATFORMS_SRCDIR=""
13262 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13263         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13264         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13265 then
13266     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13267     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13269     if test -n "$supports_multilib"; then
13270         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13271     fi
13273     qt5_test_include="QtWidgets/qapplication.h"
13274     if test "$_os" = "Emscripten"; then
13275         qt5_test_library="libQt5Widgets.a"
13276     else
13277         qt5_test_library="libQt5Widgets.so"
13278     fi
13280     dnl Check for qmake5
13281     if test -n "$QT5DIR"; then
13282         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13283     else
13284         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13285     fi
13286     if test "$QMAKE5" = "no"; then
13287         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13288     else
13289         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13290         if test -z "$qmake5_test_ver"; then
13291             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13292         fi
13293         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13294         qt5_minimal_minor="15"
13295         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13296             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13297         else
13298             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13299         fi
13300     fi
13302     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13303     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13304     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13305     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13307     AC_MSG_CHECKING([for Qt5 headers])
13308     qt5_incdir="no"
13309     for inc_dir in $qt5_incdirs; do
13310         if test -r "$inc_dir/$qt5_test_include"; then
13311             qt5_incdir="$inc_dir"
13312             break
13313         fi
13314     done
13315     AC_MSG_RESULT([$qt5_incdir])
13316     if test "x$qt5_incdir" = "xno"; then
13317         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13318     fi
13319     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13320     AC_LANG_PUSH([C++])
13321     save_CPPFLAGS=$CPPFLAGS
13322     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13323     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13324         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13325     CPPFLAGS=$save_CPPFLAGS
13326     AC_LANG_POP([C++])
13328     AC_MSG_CHECKING([for Qt5 libraries])
13329     qt5_libdir="no"
13330     for lib_dir in $qt5_libdirs; do
13331         if test -r "$lib_dir/$qt5_test_library"; then
13332             qt5_libdir="$lib_dir"
13333             break
13334         fi
13335     done
13336     AC_MSG_RESULT([$qt5_libdir])
13337     if test "x$qt5_libdir" = "xno"; then
13338         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13339     fi
13341     if test "$_os" = "Emscripten"; then
13342         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13343             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13344         fi
13345         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13346             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13347         fi
13349         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13350         if ! test -x "$EMSDK_LLVM_NM"; then
13351             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13352         fi
13353         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13354             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13355         fi
13356         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13357         if test -n "$QT5_WASM_SJLJ"; then
13358             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13359         fi
13360     fi
13362     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13363     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13364     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13365     if test "$_os" = "Emscripten"; then
13366         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13367     fi
13369     if test "$USING_X11" = TRUE; then
13370         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13371         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13372         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13373         QT5_USING_X11=1
13374         AC_DEFINE(QT5_USING_X11)
13375     fi
13377     dnl Check for Meta Object Compiler
13379     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13380     if test "$MOC5" = "no"; then
13381         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13382 the root of your Qt installation by exporting QT5DIR before running "configure".])
13383     fi
13385     if test "$test_gstreamer_1_0" = yes; then
13386         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13387                 QT5_HAVE_GOBJECT=1
13388                 AC_DEFINE(QT5_HAVE_GOBJECT)
13389             ],
13390             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13391         )
13392     fi
13394 AC_SUBST(QT5_CFLAGS)
13395 AC_SUBST(QT5_LIBS)
13396 AC_SUBST(MOC5)
13397 AC_SUBST(QT5_GOBJECT_CFLAGS)
13398 AC_SUBST(QT5_GOBJECT_LIBS)
13399 AC_SUBST(QT5_HAVE_GOBJECT)
13400 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13402 dnl ===================================================================
13403 dnl QT6 Integration
13404 dnl ===================================================================
13406 QT6_CFLAGS=""
13407 QT6_LIBS=""
13408 QT6_PLATFORMS_SRCDIR=""
13409 ENABLE_QT6_MULTIMEDIA=""
13410 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13411         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13412 then
13413     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13414     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13416     if test -n "$supports_multilib"; then
13417         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13418     fi
13420     qt6_test_include="QtWidgets/qapplication.h"
13421     if test "$_os" = "Emscripten"; then
13422         qt6_test_library="libQt6Widgets.a"
13423     else
13424         qt6_test_library="libQt6Widgets.so"
13425     fi
13427     dnl Check for qmake6
13428     if test -n "$QT6DIR"; then
13429         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13430     else
13431         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13432     fi
13433     if test "$QMAKE6" = "no"; then
13434         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13435     else
13436         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13437         if test -z "$qmake6_test_ver"; then
13438             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13439         fi
13440         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13441     fi
13443     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13444     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13445     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13446     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13448     AC_MSG_CHECKING([for Qt6 headers])
13449     qt6_incdir="no"
13450     for inc_dir in $qt6_incdirs; do
13451         if test -r "$inc_dir/$qt6_test_include"; then
13452             qt6_incdir="$inc_dir"
13453             break
13454         fi
13455     done
13456     AC_MSG_RESULT([$qt6_incdir])
13457     if test "x$qt6_incdir" = "xno"; then
13458         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13459     fi
13460     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13461     AC_LANG_PUSH([C++])
13462     save_CPPFLAGS=$CPPFLAGS
13463     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13464     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13465         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13466     CPPFLAGS=$save_CPPFLAGS
13467     AC_LANG_POP([C++])
13469     AC_MSG_CHECKING([for Qt6 libraries])
13470     qt6_libdir="no"
13471     for lib_dir in $qt6_libdirs; do
13472         if test -r "$lib_dir/$qt6_test_library"; then
13473             qt6_libdir="$lib_dir"
13474             break
13475         fi
13476     done
13477     AC_MSG_RESULT([$qt6_libdir])
13478     if test "x$qt6_libdir" = "xno"; then
13479         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13480     fi
13482     if test "$_os" = "Emscripten"; then
13483         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13484             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13485         fi
13486         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13487             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13488         fi
13489     fi
13491     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13492     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13493     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13494     if test "$_os" = "Emscripten"; then
13495         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13496     else
13497         if ! test "$enable_qt6_multimedia" = "no"; then
13498             if ! test -r "$qt6_incdir/QtMultimediaWidgets/QVideoWidget"; then
13499                 AC_MSG_ERROR([Qt 6 QMultimedia not found.])
13500                 break
13501             fi
13502             ENABLE_QT6_MULTIMEDIA=TRUE
13503             QT6_LIBS="$QT6_LIBS -lQt6Multimedia -lQt6MultimediaWidgets"
13504         fi
13505     fi
13507     if test "$USING_X11" = TRUE; then
13508         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13509         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13510         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13511         QT6_USING_X11=1
13512         AC_DEFINE(QT6_USING_X11)
13513     fi
13515     dnl Check for Meta Object Compiler
13517     for lib_dir in $qt6_libdirs; do
13518         if test -z "$qt6_libexec_dirs"; then
13519             qt6_libexec_dirs="$lib_dir/libexec"
13520         else
13521             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13522         fi
13523     done
13524     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])
13525     if test "$MOC6" = "no"; then
13526         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13527 the root of your Qt installation by exporting QT6DIR before running "configure".])
13528     else
13529         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13530         if test -z "$moc6_test_ver"; then
13531             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13532         fi
13533         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13534     fi
13536 AC_SUBST(QT6_CFLAGS)
13537 AC_SUBST(QT6_LIBS)
13538 AC_SUBST(MOC6)
13539 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13540 AC_SUBST(ENABLE_QT6_MULTIMEDIA)
13542 dnl ===================================================================
13543 dnl KF5 Integration
13544 dnl ===================================================================
13546 KF5_CFLAGS=""
13547 KF5_LIBS=""
13548 KF5_CONFIG="kf5-config"
13549 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13550         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13551 then
13552     if test "$OS" = "HAIKU"; then
13553         haiku_arch="`echo $RTL_ARCH | tr X x`"
13554         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13555         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13556     fi
13558     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13559     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13560     if test -n "$supports_multilib"; then
13561         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13562     fi
13564     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13565     kf5_test_library="libKF5KIOFileWidgets.so"
13566     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13568     dnl kf5 KDE4 support compatibility installed
13569     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13570     if test "$KF5_CONFIG" != "no"; then
13571         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13572         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13573     fi
13575     dnl Check for KF5 headers
13576     AC_MSG_CHECKING([for KF5 headers])
13577     kf5_incdir="no"
13578     for kf5_check in $kf5_incdirs; do
13579         if test -r "$kf5_check/$kf5_test_include"; then
13580             kf5_incdir="$kf5_check/KF5"
13581             break
13582         fi
13583     done
13584     AC_MSG_RESULT([$kf5_incdir])
13585     if test "x$kf5_incdir" = "xno"; then
13586         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13587     fi
13589     dnl Check for KF5 libraries
13590     AC_MSG_CHECKING([for KF5 libraries])
13591     kf5_libdir="no"
13592     for kf5_check in $kf5_libdirs; do
13593         if test -r "$kf5_check/$kf5_test_library"; then
13594             kf5_libdir="$kf5_check"
13595             break
13596         fi
13597     done
13599     AC_MSG_RESULT([$kf5_libdir])
13600     if test "x$kf5_libdir" = "xno"; then
13601         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13602     fi
13604     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"
13605     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13606     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13608     if test "$USING_X11" = TRUE; then
13609         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13610     fi
13612     AC_LANG_PUSH([C++])
13613     save_CXXFLAGS=$CXXFLAGS
13614     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13615     AC_MSG_CHECKING([whether KDE is >= 5.0])
13616        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13617 #include <kcoreaddons_version.h>
13619 int main(int argc, char **argv) {
13620        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13621        else return 1;
13623        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13624     CXXFLAGS=$save_CXXFLAGS
13625     AC_LANG_POP([C++])
13627 AC_SUBST(KF5_CFLAGS)
13628 AC_SUBST(KF5_LIBS)
13630 dnl ===================================================================
13631 dnl KF6 Integration
13632 dnl ===================================================================
13634 KF6_CFLAGS=""
13635 KF6_LIBS=""
13636 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13637 then
13638     if test "$OS" = "HAIKU"; then
13639         haiku_arch="`echo $RTL_ARCH | tr X x`"
13640         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13641         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13642     fi
13644     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13645     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13646     if test -n "$supports_multilib"; then
13647         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13648     fi
13650     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13651     kf6_test_library="libKF6KIOFileWidgets.so"
13652     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13654     dnl Check for KF6 headers
13655     AC_MSG_CHECKING([for KF6 headers])
13656     kf6_incdir="no"
13657     for kf6_check in $kf6_incdirs; do
13658         if test -r "$kf6_check/$kf6_test_include"; then
13659             kf6_incdir="$kf6_check/KF6"
13660             break
13661         fi
13662     done
13663     AC_MSG_RESULT([$kf6_incdir])
13664     if test "x$kf6_incdir" = "xno"; then
13665         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13666     fi
13668     dnl Check for KF6 libraries
13669     AC_MSG_CHECKING([for KF6 libraries])
13670     kf6_libdir="no"
13671     for kf6_check in $kf6_libdirs; do
13672         if test -r "$kf6_check/$kf6_test_library"; then
13673             kf6_libdir="$kf6_check"
13674             break
13675         fi
13676     done
13678     AC_MSG_RESULT([$kf6_libdir])
13679     if test "x$kf6_libdir" = "xno"; then
13680         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13681     fi
13683     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"
13684     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13685     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13687     AC_LANG_PUSH([C++])
13688     save_CXXFLAGS=$CXXFLAGS
13689     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13690     dnl KF6 development version as of 2023-06 uses version number 5.240
13691     AC_MSG_CHECKING([whether KDE is >= 5.240])
13692        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13693 #include <kcoreaddons_version.h>
13695 int main(int argc, char **argv) {
13696        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13697        else return 1;
13699        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13700     CXXFLAGS=$save_CXXFLAGS
13701     AC_LANG_POP([C++])
13703 AC_SUBST(KF6_CFLAGS)
13704 AC_SUBST(KF6_LIBS)
13706 if test "$enable_qt6_multimedia" = "yes" -a "$ENABLE_QT6" != "TRUE"; then
13707     AC_MSG_ERROR([--enable-qt6-multimedia requires --enable-qt6 or --enable-kf6])
13710 dnl ===================================================================
13711 dnl Test whether to include Evolution 2 support
13712 dnl ===================================================================
13713 AC_MSG_CHECKING([whether to enable evolution 2 support])
13714 if test "$enable_evolution2" = yes; then
13715     AC_MSG_RESULT([yes])
13716     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13717     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13718     FilterLibs "${GOBJECT_LIBS}"
13719     GOBJECT_LIBS="${filteredlibs}"
13720     ENABLE_EVOAB2="TRUE"
13721 else
13722     AC_MSG_RESULT([no])
13724 AC_SUBST(ENABLE_EVOAB2)
13725 AC_SUBST(GOBJECT_CFLAGS)
13726 AC_SUBST(GOBJECT_LIBS)
13728 dnl ===================================================================
13729 dnl Test which themes to include
13730 dnl ===================================================================
13731 AC_MSG_CHECKING([which themes to include])
13732 # if none given use default subset of available themes
13733 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13734     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"
13737 WITH_THEMES=""
13738 if test "x$with_theme" != "xno"; then
13739     for theme in $with_theme; do
13740         case $theme in
13741         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" ;;
13742         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13743         esac
13744     done
13746 AC_MSG_RESULT([$WITH_THEMES])
13747 AC_SUBST([WITH_THEMES])
13749 ###############################################################################
13750 # Extensions checking
13751 ###############################################################################
13752 AC_MSG_CHECKING([for extensions integration])
13753 if test "x$enable_extension_integration" != "xno"; then
13754     WITH_EXTENSION_INTEGRATION=TRUE
13755     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13756     AC_MSG_RESULT([yes, use integration])
13757 else
13758     WITH_EXTENSION_INTEGRATION=
13759     AC_MSG_RESULT([no, do not integrate])
13761 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13763 dnl Should any extra extensions be included?
13764 dnl There are standalone tests for each of these below.
13765 WITH_EXTRA_EXTENSIONS=
13766 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13768 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13769 if test "x$with_java" != "xno"; then
13770     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13773 AC_MSG_CHECKING([whether to build opens___.ttf])
13774 if test "$enable_build_opensymbol" = "yes"; then
13775     AC_MSG_RESULT([yes])
13776     AC_PATH_PROG(FONTFORGE, fontforge)
13777     if test -z "$FONTFORGE"; then
13778         AC_MSG_ERROR([fontforge not installed])
13779     fi
13780 else
13781     AC_MSG_RESULT([no])
13782     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13784 AC_SUBST(FONTFORGE)
13786 dnl ===================================================================
13787 dnl Test whether to include fonts
13788 dnl ===================================================================
13789 AC_MSG_CHECKING([whether to include third-party fonts])
13790 if test "$with_fonts" != "no"; then
13791     AC_MSG_RESULT([yes])
13792     WITH_FONTS=TRUE
13793     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13794     AC_DEFINE(HAVE_MORE_FONTS)
13795 else
13796     AC_MSG_RESULT([no])
13797     WITH_FONTS=
13798     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13800 AC_SUBST(WITH_FONTS)
13803 dnl ===================================================================
13804 dnl Test whether to enable online update service
13805 dnl ===================================================================
13806 AC_MSG_CHECKING([whether to enable online update])
13807 ENABLE_ONLINE_UPDATE=
13808 if test "$enable_online_update" = ""; then
13809     AC_MSG_RESULT([no])
13810 else
13811     if test "$enable_online_update" = "mar"; then
13812         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13813     elif test "$enable_online_update" = "yes"; then
13814         if test "$enable_curl" != "yes"; then
13815             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13816         fi
13817         AC_MSG_RESULT([yes])
13818         ENABLE_ONLINE_UPDATE="TRUE"
13819     else
13820         AC_MSG_RESULT([no])
13821     fi
13823 AC_SUBST(ENABLE_ONLINE_UPDATE)
13826 dnl ===================================================================
13827 dnl Test whether to enable mar online update service
13828 dnl ===================================================================
13829 AC_MSG_CHECKING([whether to enable mar online update])
13830 ENABLE_ONLINE_UPDATE_MAR=
13831 if test "$enable_online_update_mar" = yes; then
13832     AC_MSG_RESULT([yes])
13833     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13834     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13835     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13836 else
13837     AC_MSG_RESULT([no])
13839 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13841 AC_MSG_CHECKING([for mar online update baseurl])
13842 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13843 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13844     AC_MSG_RESULT([yes])
13845 else
13846     AC_MSG_RESULT([no])
13848 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13850 AC_MSG_CHECKING([for mar online update certificateder])
13851 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13852 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13853     AC_MSG_RESULT([yes])
13854 else
13855     AC_MSG_RESULT([no])
13857 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13859 AC_MSG_CHECKING([for mar online update certificatename])
13860 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13861 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13862     AC_MSG_RESULT([yes])
13863 else
13864     AC_MSG_RESULT([no])
13866 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13868 AC_MSG_CHECKING([for mar online update certificatepath])
13869 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13870 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13871     AC_MSG_RESULT([yes])
13872 else
13873     AC_MSG_RESULT([no])
13875 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13878 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13879 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13880     if test "x$with_privacy_policy_url" = "xundefined"; then
13881         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13882     fi
13884 AC_SUBST(PRIVACY_POLICY_URL)
13885 dnl ===================================================================
13886 dnl Test whether we need bzip2
13887 dnl ===================================================================
13888 SYSTEM_BZIP2=
13889 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13890     AC_MSG_CHECKING([whether to use system bzip2])
13891     if test "$with_system_bzip2" = yes; then
13892         SYSTEM_BZIP2=TRUE
13893         AC_MSG_RESULT([yes])
13894         PKG_CHECK_MODULES(BZIP2, bzip2)
13895         FilterLibs "${BZIP2_LIBS}"
13896         BZIP2_LIBS="${filteredlibs}"
13897     else
13898         AC_MSG_RESULT([no])
13899         BUILD_TYPE="$BUILD_TYPE BZIP2"
13900     fi
13902 AC_SUBST(SYSTEM_BZIP2)
13903 AC_SUBST(BZIP2_CFLAGS)
13904 AC_SUBST(BZIP2_LIBS)
13906 dnl ===================================================================
13907 dnl Test whether to enable extension update
13908 dnl ===================================================================
13909 AC_MSG_CHECKING([whether to enable extension update])
13910 ENABLE_EXTENSION_UPDATE=
13911 if test "x$enable_extension_update" = "xno"; then
13912     AC_MSG_RESULT([no])
13913 else
13914     AC_MSG_RESULT([yes])
13915     ENABLE_EXTENSION_UPDATE="TRUE"
13916     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13917     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13919 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13922 dnl ===================================================================
13923 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13924 dnl ===================================================================
13925 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13926 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13927     AC_MSG_RESULT([no])
13928     ENABLE_SILENT_MSI=
13929 else
13930     AC_MSG_RESULT([yes])
13931     ENABLE_SILENT_MSI=TRUE
13932     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13934 AC_SUBST(ENABLE_SILENT_MSI)
13936 dnl ===================================================================
13937 dnl Check for WiX tools.
13938 dnl ===================================================================
13939 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13940     AC_MSG_RESULT([no])
13941     ENABLE_WIX=
13942 else
13943     AC_MSG_RESULT([yes])
13944     # FIXME: this should do proper detection, but the path is currently
13945     # hardcoded in msicreator/createmsi.py
13946     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13947       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13948     fi
13949     ENABLE_WIX=TRUE
13951 AC_SUBST(ENABLE_WIX)
13953 AC_MSG_CHECKING([whether and how to use Xinerama])
13954 if test "$USING_X11" = TRUE; then
13955     if test "$x_libraries" = "default_x_libraries"; then
13956         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13957         if test "x$XINERAMALIB" = x; then
13958            XINERAMALIB="/usr/lib"
13959         fi
13960     else
13961         XINERAMALIB="$x_libraries"
13962     fi
13963     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13964         # we have both versions, let the user decide but use the dynamic one
13965         # per default
13966         USE_XINERAMA=TRUE
13967         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13968             XINERAMA_LINK=dynamic
13969         else
13970             XINERAMA_LINK=static
13971         fi
13972     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13973         # we have only the dynamic version
13974         USE_XINERAMA=TRUE
13975         XINERAMA_LINK=dynamic
13976     elif test -e "$XINERAMALIB/libXinerama.a"; then
13977         # static version
13978         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13979             USE_XINERAMA=TRUE
13980             XINERAMA_LINK=static
13981         else
13982             USE_XINERAMA=
13983             XINERAMA_LINK=none
13984         fi
13985     else
13986         # no Xinerama
13987         USE_XINERAMA=
13988         XINERAMA_LINK=none
13989     fi
13990     if test "$USE_XINERAMA" = "TRUE"; then
13991         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13992         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13993             [AC_MSG_ERROR(Xinerama header not found.)], [])
13994         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13995         if test "x$XEXTLIB" = x; then
13996            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13997         fi
13998         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13999         if test "$_os" = "FreeBSD"; then
14000             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
14001         fi
14002         if test "$_os" = "Linux"; then
14003             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
14004         fi
14005         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
14006             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
14007     else
14008         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
14009     fi
14010 else
14011     USE_XINERAMA=
14012     XINERAMA_LINK=none
14013     AC_MSG_RESULT([no])
14015 AC_SUBST(XINERAMA_LINK)
14017 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14018 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14019     enable_cairo_rgba=yes
14021 if test "$enable_cairo_rgba" = yes; then
14022     AC_DEFINE(ENABLE_CAIRO_RGBA)
14023     ENABLE_CAIRO_RGBA=TRUE
14024     AC_MSG_RESULT([yes])
14025 else
14026     ENABLE_CAIRO_RGBA=
14027     AC_MSG_RESULT([no])
14029 AC_SUBST(ENABLE_CAIRO_RGBA)
14031 dnl ===================================================================
14032 dnl Test whether to build cairo or rely on the system version
14033 dnl ===================================================================
14035 if test "$test_cairo" = "yes"; then
14036     AC_MSG_CHECKING([whether to use the system cairo])
14038     : ${with_system_cairo:=$with_system_libs}
14039     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14040         SYSTEM_CAIRO=TRUE
14041         AC_MSG_RESULT([yes])
14043         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14044         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14045         FilterLibs "${CAIRO_LIBS}"
14046         CAIRO_LIBS="${filteredlibs}"
14048         if test "$test_xrender" = "yes"; then
14049             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14050             AC_LANG_PUSH([C])
14051             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14052 #ifdef PictStandardA8
14053 #else
14054       return fail;
14055 #endif
14056 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14058             AC_LANG_POP([C])
14059         fi
14060     else
14061         AC_MSG_RESULT([no])
14062         BUILD_TYPE="$BUILD_TYPE CAIRO"
14063     fi
14065     if test "$enable_cairo_canvas" != no; then
14066         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14067         ENABLE_CAIRO_CANVAS=TRUE
14068     fi
14071 AC_SUBST(CAIRO_CFLAGS)
14072 AC_SUBST(CAIRO_LIBS)
14073 AC_SUBST(ENABLE_CAIRO_CANVAS)
14074 AC_SUBST(SYSTEM_CAIRO)
14076 dnl ===================================================================
14077 dnl Test whether to use avahi
14078 dnl ===================================================================
14079 if test "$_os" = "WINNT"; then
14080     # Windows uses bundled mDNSResponder
14081     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14082 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14083     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14084                       [ENABLE_AVAHI="TRUE"])
14085     AC_DEFINE(HAVE_FEATURE_AVAHI)
14086     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14087     FilterLibs "${AVAHI_LIBS}"
14088     AVAHI_LIBS="${filteredlibs}"
14091 AC_SUBST(ENABLE_AVAHI)
14092 AC_SUBST(AVAHI_CFLAGS)
14093 AC_SUBST(AVAHI_LIBS)
14095 dnl ===================================================================
14096 dnl Test whether to use liblangtag
14097 dnl ===================================================================
14098 SYSTEM_LIBLANGTAG=
14099 AC_MSG_CHECKING([whether to use system liblangtag])
14100 if test "$with_system_liblangtag" = yes; then
14101     SYSTEM_LIBLANGTAG=TRUE
14102     AC_MSG_RESULT([yes])
14103     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14104     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14105     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14106     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14107     FilterLibs "${LIBLANGTAG_LIBS}"
14108     LIBLANGTAG_LIBS="${filteredlibs}"
14109 else
14110     SYSTEM_LIBLANGTAG=
14111     AC_MSG_RESULT([no])
14112     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14113     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14114     if test "$COM" = "MSC"; then
14115         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14116     else
14117         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14118     fi
14120 AC_SUBST(SYSTEM_LIBLANGTAG)
14121 AC_SUBST(LIBLANGTAG_CFLAGS)
14122 AC_SUBST(LIBLANGTAG_LIBS)
14124 dnl ===================================================================
14125 dnl Test whether to build libpng or rely on the system version
14126 dnl ===================================================================
14128 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14129 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
14130 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14132 dnl ===================================================================
14133 dnl Test whether to build libtiff or rely on the system version
14134 dnl ===================================================================
14136 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14138 dnl ===================================================================
14139 dnl Test whether to build libwebp or rely on the system version
14140 dnl ===================================================================
14142 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14144 dnl ===================================================================
14145 dnl Check for runtime JVM search path
14146 dnl ===================================================================
14147 if test "$ENABLE_JAVA" != ""; then
14148     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14149     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14150         AC_MSG_RESULT([yes])
14151         if ! test -d "$with_jvm_path"; then
14152             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14153         fi
14154         if ! test -d "$with_jvm_path"jvm; then
14155             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14156         fi
14157         JVM_ONE_PATH_CHECK="$with_jvm_path"
14158         AC_SUBST(JVM_ONE_PATH_CHECK)
14159     else
14160         AC_MSG_RESULT([no])
14161     fi
14164 dnl ===================================================================
14165 dnl Test for the presence of Ant and that it works
14166 dnl ===================================================================
14168 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14169 # breaks filename decoding, so for the ant section, set it to LANG
14170 LC_ALL=$LANG
14171 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14172     ANT_HOME=; export ANT_HOME
14173     WITH_ANT_HOME=; export WITH_ANT_HOME
14174     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14175         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14176             if test "$_os" = "WINNT"; then
14177                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14178             else
14179                 with_ant_home="$LODE_HOME/opt/ant"
14180             fi
14181         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14182             with_ant_home="$LODE_HOME/opt/ant"
14183         fi
14184     fi
14185     if test -z "$with_ant_home"; then
14186         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14187     else
14188         if test "$_os" = "WINNT"; then
14189             # AC_PATH_PROGS needs unix path
14190             PathFormat "$with_ant_home"
14191             with_ant_home="$formatted_path_unix"
14192         fi
14193         AbsolutePath "$with_ant_home"
14194         with_ant_home=$absolute_path
14195         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14196         WITH_ANT_HOME=$with_ant_home
14197         ANT_HOME=$with_ant_home
14198     fi
14200     if test -z "$ANT"; then
14201         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14202     else
14203         # resolve relative or absolute symlink
14204         while test -h "$ANT"; do
14205             a_cwd=`pwd`
14206             a_basename=`basename "$ANT"`
14207             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14208             cd "`dirname "$ANT"`"
14209             cd "`dirname "$a_script"`"
14210             ANT="`pwd`"/"`basename "$a_script"`"
14211             cd "$a_cwd"
14212         done
14214         AC_MSG_CHECKING([if $ANT works])
14215         mkdir -p conftest.dir
14216         a_cwd=$(pwd)
14217         cd conftest.dir
14218         cat > conftest.java << EOF
14219         public class conftest {
14220             int testmethod(int a, int b) {
14221                     return a + b;
14222             }
14223         }
14226         cat > conftest.xml << EOF
14227         <project name="conftest" default="conftest">
14228         <target name="conftest">
14229             <javac srcdir="." includes="conftest.java">
14230             </javac>
14231         </target>
14232         </project>
14235         if test -n "$WSL_ONLY_AS_HELPER"; then
14236             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14237             export JAVACMD="$JAVAINTERPRETER"
14238             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14239             # building the classpath, but we need the windows-style one for the windows-java
14240             PathFormat "$ANT_HOME"
14241             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14242         fi
14243         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14244         if test $? = 0 -a -f ./conftest.class; then
14245             AC_MSG_RESULT([Ant works])
14246             if test -z "$WITH_ANT_HOME"; then
14247                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14248                 if test -z "$ANT_HOME"; then
14249                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14250                 fi
14251             else
14252                 ANT_HOME="$WITH_ANT_HOME"
14253             fi
14254         else
14255             echo "configure: Ant test failed" >&5
14256             cat conftest.java >&5
14257             cat conftest.xml >&5
14258             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14259         fi
14260         cd "$a_cwd"
14261         rm -fr conftest.dir
14262     fi
14263     if test -z "$ANT_HOME"; then
14264         ANT_HOME="NO_ANT_HOME"
14265     else
14266         PathFormat "$ANT_HOME"
14267         ANT_HOME="$formatted_path_unix"
14268         PathFormat "$ANT"
14269         ANT="$formatted_path_unix"
14270     fi
14272     dnl Checking for ant.jar
14273     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14274         AC_MSG_CHECKING([Ant lib directory])
14275         if test -f $ANT_HOME/lib/ant.jar; then
14276             ANT_LIB="$ANT_HOME/lib"
14277         else
14278             if test -f $ANT_HOME/ant.jar; then
14279                 ANT_LIB="$ANT_HOME"
14280             else
14281                 if test -f /usr/share/java/ant.jar; then
14282                     ANT_LIB=/usr/share/java
14283                 else
14284                     if test -f /usr/share/ant-core/lib/ant.jar; then
14285                         ANT_LIB=/usr/share/ant-core/lib
14286                     else
14287                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14288                             ANT_LIB="$ANT_HOME/lib/ant"
14289                         else
14290                             if test -f /usr/share/lib/ant/ant.jar; then
14291                                 ANT_LIB=/usr/share/lib/ant
14292                             else
14293                                 AC_MSG_ERROR([Ant libraries not found!])
14294                             fi
14295                         fi
14296                     fi
14297                 fi
14298             fi
14299         fi
14300         PathFormat "$ANT_LIB"
14301         ANT_LIB="$formatted_path"
14302         AC_MSG_RESULT([Ant lib directory found.])
14303     fi
14305     ant_minver=1.6.0
14306     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14308     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14309     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14310     ant_version_major=`echo $ant_version | cut -d. -f1`
14311     ant_version_minor=`echo $ant_version | cut -d. -f2`
14312     echo "configure: ant_version $ant_version " >&5
14313     echo "configure: ant_version_major $ant_version_major " >&5
14314     echo "configure: ant_version_minor $ant_version_minor " >&5
14315     if test "$ant_version_major" -ge "2"; then
14316         AC_MSG_RESULT([yes, $ant_version])
14317     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14318         AC_MSG_RESULT([yes, $ant_version])
14319     else
14320         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14321     fi
14323     rm -f conftest* core core.* *.core
14325 AC_SUBST(ANT)
14326 AC_SUBST(ANT_HOME)
14327 AC_SUBST(ANT_LIB)
14329 OOO_JUNIT_JAR=
14330 HAMCREST_JAR=
14331 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14332     AC_MSG_CHECKING([for JUnit 4])
14333     if test "$with_junit" = "yes"; then
14334         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14335             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14336         elif test -e /usr/share/java/junit4.jar; then
14337             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14338         else
14339            if test -e /usr/share/lib/java/junit.jar; then
14340               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14341            else
14342               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14343            fi
14344         fi
14345     else
14346         OOO_JUNIT_JAR=$with_junit
14347     fi
14348     if test "$_os" = "WINNT"; then
14349         PathFormat "$OOO_JUNIT_JAR"
14350         OOO_JUNIT_JAR="$formatted_path"
14351     fi
14352     printf 'import org.junit.Before;' > conftest.java
14353     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14354         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14355     else
14356         AC_MSG_ERROR(
14357 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14358  specify its pathname via --with-junit=..., or disable it via --without-junit])
14359     fi
14360     rm -f conftest.class conftest.java
14361     if test $OOO_JUNIT_JAR != ""; then
14362         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14363     fi
14365     AC_MSG_CHECKING([for included Hamcrest])
14366     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14367     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14368         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14369     else
14370         AC_MSG_RESULT([Not included])
14371         AC_MSG_CHECKING([for standalone hamcrest jar.])
14372         if test "$with_hamcrest" = "yes"; then
14373             if test -e /usr/share/lib/java/hamcrest.jar; then
14374                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14375             elif test -e /usr/share/java/hamcrest/core.jar; then
14376                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14377             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14378                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14379             else
14380                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14381             fi
14382         else
14383             HAMCREST_JAR=$with_hamcrest
14384         fi
14385         if test "$_os" = "WINNT"; then
14386             PathFormat "$HAMCREST_JAR"
14387             HAMCREST_JAR="$formatted_path"
14388         fi
14389         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14390             AC_MSG_RESULT([$HAMCREST_JAR])
14391         else
14392             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),
14393                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14394         fi
14395     fi
14396     rm -f conftest.class conftest.java
14398 AC_SUBST(OOO_JUNIT_JAR)
14399 AC_SUBST(HAMCREST_JAR)
14400 # set back LC_ALL to C after the java related tests...
14401 LC_ALL=C
14403 AC_SUBST(SCPDEFS)
14406 # check for wget and curl
14408 WGET=
14409 CURL=
14411 if test "$enable_fetch_external" != "no"; then
14413 CURL=`command -v curl`
14415 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14416     # wget new enough?
14417     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14418     if test $? -eq 0; then
14419         WGET=$i
14420         break
14421     fi
14422 done
14424 if test -z "$WGET" -a -z "$CURL"; then
14425     AC_MSG_ERROR([neither wget nor curl found!])
14430 AC_SUBST(WGET)
14431 AC_SUBST(CURL)
14434 # check for sha256sum
14436 SHA256SUM=
14438 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14439     eval "$i -a 256 --version" > /dev/null 2>&1
14440     ret=$?
14441     if test $ret -eq 0; then
14442         SHA256SUM="$i -a 256"
14443         break
14444     fi
14445 done
14447 if test -z "$SHA256SUM"; then
14448     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14449         eval "$i --version" > /dev/null 2>&1
14450         ret=$?
14451         if test $ret -eq 0; then
14452             SHA256SUM=$i
14453             break
14454         fi
14455     done
14458 if test -z "$SHA256SUM"; then
14459     AC_MSG_ERROR([no sha256sum found!])
14462 AC_SUBST(SHA256SUM)
14464 dnl ===================================================================
14465 dnl Dealing with l10n options
14466 dnl ===================================================================
14467 AC_MSG_CHECKING([which languages to be built])
14468 # get list of all languages
14469 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14470 # we want en-US at the beginning
14471 ALL_LANGS=$($GNUMAKE SRC_ROOT=$SRC_ROOT WITH_LANG="$with_lang" ENABLE_RELEASE_BUILD="$ENABLE_RELEASE_BUILD" -sr -f - <<'EOF' | tr -d '\r'
14472 include $(SRC_ROOT)/solenv/inc/langlist.mk
14473 all:
14474         $(info en-US $(filter-out en-US,$(sort $(completelangiso))))
14478 # check the configured localizations
14479 WITH_LANG="$with_lang"
14481 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14482 # (Norwegian is "nb" and "nn".)
14483 if test "$WITH_LANG" = "no"; then
14484     WITH_LANG=
14487 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14488     AC_MSG_RESULT([en-US])
14489 else
14490     AC_MSG_RESULT([$WITH_LANG])
14491     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14492     if test -z "$MSGFMT"; then
14493         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14494             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14495         elif test -x "/opt/lo/bin/msgfmt"; then
14496             MSGFMT="/opt/lo/bin/msgfmt"
14497         else
14498             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14499             if test -z "$MSGFMT"; then
14500                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14501             fi
14502         fi
14503     fi
14504     if test -z "$MSGUNIQ"; then
14505         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14506             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14507         elif test -x "/opt/lo/bin/msguniq"; then
14508             MSGUNIQ="/opt/lo/bin/msguniq"
14509         else
14510             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14511             if test -z "$MSGUNIQ"; then
14512                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14513             fi
14514         fi
14515     fi
14517 AC_SUBST(MSGFMT)
14518 AC_SUBST(MSGUNIQ)
14519 # check that the list is valid
14520 for lang in $WITH_LANG; do
14521     test "$lang" = "ALL" && continue
14522     # need to check for the exact string, so add space before and after the list of all languages
14523     for vl in $ALL_LANGS; do
14524         if test "$vl" = "$lang"; then
14525            break
14526         fi
14527     done
14528     if test "$vl" != "$lang"; then
14529         # if you're reading this - you prolly quoted your languages remove the quotes ...
14530         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14531     fi
14532 done
14533 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14534     echo $WITH_LANG | grep -q en-US
14535     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14537 # list with substituted ALL
14538 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14539 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14540 test "$WITH_LANG" = "en-US" && WITH_LANG=
14541 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14542     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14543     ALL_LANGS=`echo $ALL_LANGS qtz`
14545 AC_SUBST(ALL_LANGS)
14546 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14547 AC_SUBST(WITH_LANG)
14548 AC_SUBST(WITH_LANG_LIST)
14549 AC_SUBST(GIT_NEEDED_SUBMODULES)
14551 WITH_POOR_HELP_LOCALIZATIONS=
14552 if test -d "$SRC_ROOT/translations/source"; then
14553     for l in `ls -1 $SRC_ROOT/translations/source`; do
14554         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14555             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14556         fi
14557     done
14559 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14561 if test -n "$with_locales" -a "$with_locales" != ALL; then
14562     WITH_LOCALES="$with_locales"
14564     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14565     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14566     # config_host/config_locales.h.in
14567     for locale in $WITH_LOCALES; do
14568         lang=${locale%_*}
14570         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14572         case $lang in
14573         hi|mr*ne)
14574             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14575             ;;
14576         bg|ru)
14577             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14578             ;;
14579         esac
14580     done
14581 else
14582     AC_DEFINE(WITH_LOCALE_ALL)
14584 AC_SUBST(WITH_LOCALES)
14586 dnl git submodule update --reference
14587 dnl ===================================================================
14588 if test -n "${GIT_REFERENCE_SRC}"; then
14589     for repo in ${GIT_NEEDED_SUBMODULES}; do
14590         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14591             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14592         fi
14593     done
14595 AC_SUBST(GIT_REFERENCE_SRC)
14597 dnl git submodules linked dirs
14598 dnl ===================================================================
14599 if test -n "${GIT_LINK_SRC}"; then
14600     for repo in ${GIT_NEEDED_SUBMODULES}; do
14601         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14602             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14603         fi
14604     done
14606 AC_SUBST(GIT_LINK_SRC)
14608 dnl branding
14609 dnl ===================================================================
14610 AC_MSG_CHECKING([for alternative branding images directory])
14611 # initialize mapped arrays
14612 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14613 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14615 if test -z "$with_branding" -o "$with_branding" = "no"; then
14616     AC_MSG_RESULT([none])
14617     DEFAULT_BRAND_IMAGES="$brand_files"
14618 else
14619     if ! test -d $with_branding ; then
14620         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14621     else
14622         AC_MSG_RESULT([$with_branding])
14623         CUSTOM_BRAND_DIR="$with_branding"
14624         for lfile in $brand_files
14625         do
14626             if ! test -f $with_branding/$lfile ; then
14627                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14628                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14629             else
14630                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14631             fi
14632         done
14633         check_for_progress="yes"
14634     fi
14636 AC_SUBST([BRAND_INTRO_IMAGES])
14637 AC_SUBST([CUSTOM_BRAND_DIR])
14638 AC_SUBST([CUSTOM_BRAND_IMAGES])
14639 AC_SUBST([DEFAULT_BRAND_IMAGES])
14642 AC_MSG_CHECKING([for 'intro' progress settings])
14643 PROGRESSBARCOLOR=
14644 PROGRESSSIZE=
14645 PROGRESSPOSITION=
14646 PROGRESSFRAMECOLOR=
14647 PROGRESSTEXTCOLOR=
14648 PROGRESSTEXTBASELINE=
14650 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14651     source "$with_branding/progress.conf"
14652     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14653 else
14654     AC_MSG_RESULT([none])
14657 AC_SUBST(PROGRESSBARCOLOR)
14658 AC_SUBST(PROGRESSSIZE)
14659 AC_SUBST(PROGRESSPOSITION)
14660 AC_SUBST(PROGRESSFRAMECOLOR)
14661 AC_SUBST(PROGRESSTEXTCOLOR)
14662 AC_SUBST(PROGRESSTEXTBASELINE)
14665 dnl ===================================================================
14666 dnl Custom build version
14667 dnl ===================================================================
14668 AC_MSG_CHECKING([for extra build ID])
14669 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14670     EXTRA_BUILDID="$with_extra_buildid"
14672 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14673 if test -n "$EXTRA_BUILDID" ; then
14674     AC_MSG_RESULT([$EXTRA_BUILDID])
14675 else
14676     AC_MSG_RESULT([not set])
14678 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14680 OOO_VENDOR=
14681 AC_MSG_CHECKING([for vendor])
14682 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14683     OOO_VENDOR="$USERNAME"
14685     if test -z "$OOO_VENDOR"; then
14686         OOO_VENDOR="$USER"
14687     fi
14689     if test -z "$OOO_VENDOR"; then
14690         OOO_VENDOR="`id -u -n`"
14691     fi
14693     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14694 else
14695     OOO_VENDOR="$with_vendor"
14696     AC_MSG_RESULT([$OOO_VENDOR])
14698 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14699 AC_SUBST(OOO_VENDOR)
14701 if test "$_os" = "Android" ; then
14702     ANDROID_PACKAGE_NAME=
14703     AC_MSG_CHECKING([for Android package name])
14704     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14705         if test -n "$ENABLE_DEBUG"; then
14706             # Default to the package name that makes ndk-gdb happy.
14707             ANDROID_PACKAGE_NAME="org.libreoffice"
14708         else
14709             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14710         fi
14712         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14713     else
14714         ANDROID_PACKAGE_NAME="$with_android_package_name"
14715         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14716     fi
14717     AC_SUBST(ANDROID_PACKAGE_NAME)
14720 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14721 if test "$with_compat_oowrappers" = "yes"; then
14722     WITH_COMPAT_OOWRAPPERS=TRUE
14723     AC_MSG_RESULT(yes)
14724 else
14725     WITH_COMPAT_OOWRAPPERS=
14726     AC_MSG_RESULT(no)
14728 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14730 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14731 AC_MSG_CHECKING([for install dirname])
14732 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14733     INSTALLDIRNAME="$with_install_dirname"
14735 AC_MSG_RESULT([$INSTALLDIRNAME])
14736 AC_SUBST(INSTALLDIRNAME)
14738 AC_MSG_CHECKING([for prefix])
14739 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14740 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14741 PREFIXDIR="$prefix"
14742 AC_MSG_RESULT([$PREFIXDIR])
14743 AC_SUBST(PREFIXDIR)
14745 LIBDIR=[$(eval echo $(eval echo $libdir))]
14746 AC_SUBST(LIBDIR)
14748 DATADIR=[$(eval echo $(eval echo $datadir))]
14749 AC_SUBST(DATADIR)
14751 MANDIR=[$(eval echo $(eval echo $mandir))]
14752 AC_SUBST(MANDIR)
14754 DOCDIR=[$(eval echo $(eval echo $docdir))]
14755 AC_SUBST(DOCDIR)
14757 BINDIR=[$(eval echo $(eval echo $bindir))]
14758 AC_SUBST(BINDIR)
14760 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14761 AC_SUBST(INSTALLDIR)
14763 TESTINSTALLDIR="${BUILDDIR}/test-install"
14764 AC_SUBST(TESTINSTALLDIR)
14767 # ===================================================================
14768 # OAuth2 id and secrets
14769 # ===================================================================
14771 AC_MSG_CHECKING([for Google Drive client id and secret])
14772 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14773     AC_MSG_RESULT([not set])
14774     GDRIVE_CLIENT_ID="\"\""
14775     GDRIVE_CLIENT_SECRET="\"\""
14776 else
14777     AC_MSG_RESULT([set])
14778     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14779     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14781 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14782 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14784 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14785 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14786     AC_MSG_RESULT([not set])
14787     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14788     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14789 else
14790     AC_MSG_RESULT([set])
14791     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14792     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14794 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14795 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14797 AC_MSG_CHECKING([for OneDrive client id and secret])
14798 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14799     AC_MSG_RESULT([not set])
14800     ONEDRIVE_CLIENT_ID="\"\""
14801     ONEDRIVE_CLIENT_SECRET="\"\""
14802 else
14803     AC_MSG_RESULT([set])
14804     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14805     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14807 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14808 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14811 dnl ===================================================================
14812 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14813 dnl --enable-dependency-tracking configure option
14814 dnl ===================================================================
14815 AC_MSG_CHECKING([whether to enable dependency tracking])
14816 if test "$enable_dependency_tracking" = "no"; then
14817     nodep=TRUE
14818     AC_MSG_RESULT([no])
14819 else
14820     AC_MSG_RESULT([yes])
14822 AC_SUBST(nodep)
14824 dnl ===================================================================
14825 dnl Number of CPUs to use during the build
14826 dnl ===================================================================
14827 AC_MSG_CHECKING([for number of processors to use])
14828 # plain --with-parallelism is just the default
14829 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14830     if test "$with_parallelism" = "no"; then
14831         PARALLELISM=0
14832     else
14833         PARALLELISM=$with_parallelism
14834     fi
14835 else
14836     if test "$enable_icecream" = "yes"; then
14837         PARALLELISM="40"
14838     else
14839         case `uname -s` in
14841         Darwin|FreeBSD|NetBSD|OpenBSD)
14842             PARALLELISM=`sysctl -n hw.ncpu`
14843             ;;
14845         Linux)
14846             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14847         ;;
14848         # what else than above does profit here *and* has /proc?
14849         *)
14850             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14851             ;;
14852         esac
14854         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14855         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14856     fi
14859 if test $PARALLELISM -eq 0; then
14860     AC_MSG_RESULT([explicit make -j option needed])
14861 else
14862     AC_MSG_RESULT([$PARALLELISM])
14864 AC_SUBST(PARALLELISM)
14867 # Set up ILIB for MSVC build
14869 ILIB1=
14870 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14871     ILIB="."
14872     if test -n "$JAVA_HOME"; then
14873         ILIB="$ILIB;$JAVA_HOME/lib"
14874     fi
14875     ILIB1=-link
14876     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14877     ILIB="$ILIB;$formatted_path"
14878     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14879     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14880     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14881     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14882         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14883         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14884     fi
14885     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14886     ucrtlibpath_formatted=$formatted_path
14887     ILIB="$ILIB;$ucrtlibpath_formatted"
14888     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14889     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14890         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14891         ILIB="$ILIB;$formatted_path"
14892     else
14893         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14894         ILIB="$ILIB;$formatted_path"
14895     fi
14897     if test "$cross_compiling" != "yes"; then
14898         ILIB_FOR_BUILD="$ILIB"
14899     fi
14901 AC_SUBST(ILIB)
14902 AC_SUBST(ILIB_FOR_BUILD)
14904 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14905 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14906 dnl from consteval constructor initializing const variable",
14907 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14908 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14909 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14910 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14911 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14912 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
14913 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
14914 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14915 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14916 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14917 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
14918 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
14919 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
14920 have_cpp_consteval=
14921 AC_LANG_PUSH([C++])
14922 save_CXX=$CXX
14923 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14924     CXX="env LIB=$ILIB $CXX"
14926 save_CXXFLAGS=$CXXFLAGS
14927 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14928 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14929         struct S {
14930             consteval S() { i = 1; }
14931             int i = 0;
14932         };
14933         S const s;
14935         struct S1 {
14936              int a;
14937              consteval S1(int n): a(n) {}
14938         };
14939         struct S2 {
14940             S1 x;
14941             S2(): x(0) {}
14942         };
14944         struct S3 {
14945             consteval S3() {}
14946             union {
14947                 int a;
14948                 unsigned b = 0;
14949             };
14950         };
14951         void f() { S3(); }
14953         struct S4 { consteval S4() = default; };
14954         void f4(bool b) { b ? S4() : S4(); }
14956         struct S5 {
14957             consteval S5() { c = 0; }
14958             char * f() { return &c; }
14959             union {
14960                 char c;
14961                 int i;
14962             };
14963         };
14964         auto s5 = S5().f();
14966         struct S6 {
14967             consteval S6(char const (&lit)[[2]]) {
14968                 buf[[0]] = lit[[0]];
14969                 buf[[1]] = lit[[1]];
14970             }
14971             union {
14972                 int x;
14973                 char buf[[2]];
14974             };
14975         };
14976         void f6() { S6("a"); }
14977     ], [
14978         return (s.i == 1) ? 0 : 1;
14979     ])], [
14980         have_cpp_consteval=1
14981         AC_MSG_RESULT([yes])
14982     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14983 CXX=$save_CXX
14984 CXXFLAGS=$save_CXXFLAGS
14985 AC_LANG_POP([C++])
14986 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
14987 then
14988     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
14989     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
14990     dnl reference to consteval constructor exported from module" (which also affects PCH, see
14991     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
14992     dnl --enable-pch setup is known broken"):
14993     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
14994     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
14995     rm conftest.cppm
14996     AC_LANG_PUSH([C++])
14997     save_CXXFLAGS=$CXXFLAGS
14998     save_LDFLAGS=$LDFLAGS
14999     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15000     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
15001     AC_LINK_IFELSE([AC_LANG_PROGRAM([
15002         import M;
15003     ], [
15004         struct S2 { S1 s = 0; };
15005         S2 s;
15006     ])], [
15007         AC_MSG_RESULT([yes])
15008     ], [
15009         have_cpp_consteval=
15010         AC_MSG_RESULT([no])])
15011     CXXFLAGS=$save_CXXFLAGS
15012     LDFLAGS=$save_LDFLAGS
15013     AC_LANG_POP([C++])
15014     rm conftest.pcm
15016 if test -n "$have_cpp_consteval"; then
15017     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15020 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15021 dnl ...which is known to not be implemented in libc++ prior to
15022 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15023 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15024 AC_LANG_PUSH([C++])
15025 save_CXX=$CXX
15026 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15027     CXX="env LIB=$ILIB $CXX"
15029 save_CXXFLAGS=$CXXFLAGS
15030 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15031 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15032         #include <compare>
15033     ], [
15034         (void) (std::strong_order(1.0, 2.0) < 0);
15035     ])], [
15036         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15037         AC_MSG_RESULT([yes])
15038     ], [AC_MSG_RESULT([no])])
15039 CXX=$save_CXX
15040 CXXFLAGS=$save_CXXFLAGS
15041 AC_LANG_POP([C++])
15043 # ===================================================================
15044 # Creating bigger shared library to link against
15045 # ===================================================================
15046 AC_MSG_CHECKING([whether to create huge library])
15047 MERGELIBS=
15048 MERGELIBS_MORE=
15050 if test $_os = iOS -o $_os = Android; then
15051     # Never any point in mergelibs for these as we build just static
15052     # libraries anyway...
15053     enable_mergelibs=no
15056 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15057     if test "$enable_mergelibs" = "more"; then
15058         MERGELIBS="TRUE"
15059         MERGELIBS_MORE="TRUE"
15060         AC_MSG_RESULT([yes (more)])
15061         AC_DEFINE(ENABLE_MERGELIBS)
15062         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15063     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15064         MERGELIBS="TRUE"
15065         AC_MSG_RESULT([yes])
15066         AC_DEFINE(ENABLE_MERGELIBS)
15067     else
15068         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15069     fi
15070 else
15071     AC_MSG_RESULT([no])
15073 AC_SUBST([MERGELIBS])
15074 AC_SUBST([MERGELIBS_MORE])
15076 dnl ===================================================================
15077 dnl icerun is a wrapper that stops us spawning tens of processes
15078 dnl locally - for tools that can't be executed on the compile cluster
15079 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15080 dnl ===================================================================
15081 AC_MSG_CHECKING([whether to use icerun wrapper])
15082 ICECREAM_RUN=
15083 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15084     ICECREAM_RUN=icerun
15085     AC_MSG_RESULT([yes])
15086 else
15087     AC_MSG_RESULT([no])
15089 AC_SUBST(ICECREAM_RUN)
15091 dnl ===================================================================
15092 dnl Setup the ICECC_VERSION for the build the same way it was set for
15093 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15094 dnl ===================================================================
15095 x_ICECC_VERSION=[\#]
15096 if test -n "$ICECC_VERSION" ; then
15097     x_ICECC_VERSION=
15099 AC_SUBST(x_ICECC_VERSION)
15100 AC_SUBST(ICECC_VERSION)
15102 dnl ===================================================================
15104 AC_MSG_CHECKING([MPL subset])
15105 MPL_SUBSET=
15106 LICENSE="LGPL"
15108 if test "$enable_mpl_subset" = "yes"; then
15109     mpl_error_string=
15110     newline=$'\n    *'
15111     warn_report=false
15112     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15113         warn_report=true
15114     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15115         warn_report=true
15116     fi
15117     if test "$warn_report" = "true"; then
15118         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15119     fi
15120     if test "x$enable_postgresql_sdbc" != "xno"; then
15121         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15122     fi
15123     if test "$enable_lotuswordpro" = "yes"; then
15124         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15125     fi
15126     if test -n "$ENABLE_POPPLER"; then
15127         if test "x$SYSTEM_POPPLER" = "x"; then
15128             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15129         fi
15130     fi
15131     # cf. m4/libo_check_extension.m4
15132     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15133         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15134     fi
15135     denied_themes=
15136     filtered_themes=
15137     for theme in $WITH_THEMES; do
15138         case $theme in
15139         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15140             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15141         *)
15142             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15143         esac
15144     done
15145     if test "x$denied_themes" != "x"; then
15146         if test "x$filtered_themes" == "x"; then
15147             filtered_themes="colibre"
15148         fi
15149         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15150     fi
15152     ENABLE_OPENGL_TRANSITIONS=
15154     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15155         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15156     fi
15158     if test "x$mpl_error_string" != "x"; then
15159         AC_MSG_ERROR([$mpl_error_string])
15160     fi
15162     MPL_SUBSET="TRUE"
15163     LICENSE="MPL-2.0"
15164     AC_DEFINE(MPL_HAVE_SUBSET)
15165     AC_MSG_RESULT([only])
15166 else
15167     AC_MSG_RESULT([no restrictions])
15169 AC_SUBST(MPL_SUBSET)
15170 AC_SUBST(LICENSE)
15172 dnl ===================================================================
15174 AC_MSG_CHECKING([formula logger])
15175 ENABLE_FORMULA_LOGGER=
15177 if test "x$enable_formula_logger" = "xyes"; then
15178     AC_MSG_RESULT([yes])
15179     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15180     ENABLE_FORMULA_LOGGER=TRUE
15181 elif test -n "$ENABLE_DBGUTIL" ; then
15182     AC_MSG_RESULT([yes])
15183     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15184     ENABLE_FORMULA_LOGGER=TRUE
15185 else
15186     AC_MSG_RESULT([no])
15189 AC_SUBST(ENABLE_FORMULA_LOGGER)
15191 dnl ===================================================================
15192 dnl Checking for active Antivirus software.
15193 dnl ===================================================================
15195 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15196     AC_MSG_CHECKING([for active Antivirus software])
15197     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15198     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15199     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15200         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15201             AC_MSG_RESULT([found])
15202             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15203             echo $EICAR_STRING > $SRC_ROOT/eicar
15204             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15205             rm $SRC_ROOT/eicar
15206             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15207                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15208             fi
15209             echo $EICAR_STRING > $BUILDDIR/eicar
15210             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15211             rm $BUILDDIR/eicar
15212             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15213                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15214             fi
15215             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"
15216         else
15217             AC_MSG_RESULT([not found])
15218         fi
15219     else
15220         AC_MSG_RESULT([n/a])
15221     fi
15224 dnl ===================================================================
15226 AC_MSG_CHECKING([for coredumpctl support])
15227 if test -z "$with_coredumpctl" && test $_os != Linux; then
15228     with_coredumpctl=no
15230 if test "$with_coredumpctl" = no; then
15231     WITH_COREDUMPCTL=
15232 else
15233     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15234     AC_PATH_PROG(JQ, jq)
15235     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15236     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15237     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15238         || test -z "$SYSTEMD_RUN"
15239     then
15240         if test -z "$with_coredumpctl"; then
15241             WITH_COREDUMPCTL=
15242         else
15243             if test -z "$COREDUMPCTL"; then
15244                 AC_MSG_ERROR([coredumpctl not found])
15245             fi
15246             if test -z "$JQ"; then
15247                 AC_MSG_ERROR([jq not found])
15248             fi
15249             if test -z "$SYSTEMD_ESCAPE"; then
15250                 AC_MSG_ERROR([systemd-escape not found])
15251             fi
15252             if test -z "$SYSTEMD_RUN"; then
15253                 AC_MSG_ERROR([systemd-run not found])
15254             fi
15255         fi
15256     else
15257         WITH_COREDUMPCTL=TRUE
15258     fi
15260 if test -z "$WITH_COREDUMPCTL"; then
15261     AC_MSG_RESULT([no])
15262 else
15263     AC_MSG_RESULT([yes])
15265 AC_SUBST(COREDUMPCTL)
15266 AC_SUBST(JQ)
15267 AC_SUBST(SYSTEMD_ESCAPE)
15268 AC_SUBST(SYSTEMD_RUN)
15269 AC_SUBST(WITH_COREDUMPCTL)
15271 dnl ===================================================================
15272 dnl Checking whether to use a keep-awake helper
15273 dnl ===================================================================
15275 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15276 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15277     AC_MSG_RESULT([no])
15278 elif test "$with_keep_awake" = "yes"; then
15279     AC_MSG_RESULT([yes (autodetect)])
15280     AC_MSG_CHECKING([for a suitable keep-awake command])
15281     if test "$_os" = "WINNT"; then
15282         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15283         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15284             AC_MSG_RESULT([using "Awake"])
15285             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15286             # make's PID and then use that to get the windows-PID.
15287             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15288             # much scarier looking than it actually is. Using make's shell instead of subshells in
15289             # the recipe to keep the command that's echoed by make short.
15290             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}'"'"') &'
15291         else
15292             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15293         fi
15294     elif test "$_os" = "Darwin"; then
15295         AC_MSG_RESULT([using "caffeinate"])
15296         KEEP_AWAKE_CMD="caffeinate"
15297     else
15298         AC_MSG_ERROR([no default available for $_os, please specify manually])
15299     fi
15300 else
15301     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15303 AC_SUBST(KEEP_AWAKE_CMD)
15305 dnl ===================================================================
15306 dnl Setting up the environment.
15307 dnl ===================================================================
15308 AC_MSG_NOTICE([setting up the build environment variables...])
15310 AC_SUBST(COMPATH)
15312 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15313     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15314         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15315         ATL_INCLUDE="$COMPATH/atlmfc/include"
15316     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15317         ATL_LIB="$COMPATH/atlmfc/lib"
15318         ATL_INCLUDE="$COMPATH/atlmfc/include"
15319     else
15320         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15321         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15322     fi
15323     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15324     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15325     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15328 if test "$build_os" = "cygwin"; then
15329     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15330     PathFormat "/usr/bin/find.exe"
15331     FIND="$formatted_path"
15332     PathFormat "/usr/bin/sort.exe"
15333     SORT="$formatted_path"
15334     PathFormat "/usr/bin/grep.exe"
15335     WIN_GREP="$formatted_path"
15336     PathFormat "/usr/bin/ls.exe"
15337     WIN_LS="$formatted_path"
15338     PathFormat "/usr/bin/touch.exe"
15339     WIN_TOUCH="$formatted_path"
15340 else
15341     FIND=find
15342     SORT=sort
15345 AC_SUBST(ATL_INCLUDE)
15346 AC_SUBST(ATL_LIB)
15347 AC_SUBST(FIND)
15348 AC_SUBST(SORT)
15349 AC_SUBST(WIN_GREP)
15350 AC_SUBST(WIN_LS)
15351 AC_SUBST(WIN_TOUCH)
15353 AC_SUBST(BUILD_TYPE)
15355 AC_SUBST(SOLARINC)
15357 PathFormat "$PERL"
15358 PERL="$formatted_path"
15359 AC_SUBST(PERL)
15361 if test -n "$TMPDIR"; then
15362     TEMP_DIRECTORY="$TMPDIR"
15363     if test -n "$WSL_ONLY_AS_HELPER"; then
15364        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15365     fi
15366 else
15367     TEMP_DIRECTORY="/tmp"
15369 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15370 if test "$build_os" = "cygwin"; then
15371     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15372     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15374 AC_SUBST(TEMP_DIRECTORY)
15375 AC_SUBST(CYGWIN_BASH)
15377 # setup the PATH for the environment
15378 if test -n "$LO_PATH_FOR_BUILD"; then
15379     LO_PATH="$LO_PATH_FOR_BUILD"
15380     case "$host_os" in
15381     cygwin*|wsl*)
15382         pathmunge "$MSVC_HOST_PATH" "before"
15383         ;;
15384     esac
15385 else
15386     LO_PATH="$PATH"
15388     case "$host_os" in
15390     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15391         if test "$ENABLE_JAVA" != ""; then
15392             pathmunge "$JAVA_HOME/bin" "after"
15393         fi
15394         ;;
15396     cygwin*|wsl*)
15397         # Win32 make needs native paths
15398         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15399             LO_PATH=`cygpath -p -m "$PATH"`
15400         fi
15401         if test "$WIN_BUILD_ARCH" = "x64"; then
15402             # needed for msi packaging
15403             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15404         fi
15405         if test "$WIN_BUILD_ARCH" = "arm64"; then
15406             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15407             # the x86 ones probably would work just as well...
15408             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15409         fi
15410         # .NET 4.6 and higher don't have bin directory
15411         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15412             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15413         fi
15414         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15415         pathmunge "$CSC_PATH" "before"
15416         pathmunge "$MIDL_PATH" "before"
15417         pathmunge "$AL_PATH" "before"
15418         pathmunge "$MSVC_MULTI_PATH" "before"
15419         pathmunge "$MSVC_BUILD_PATH" "before"
15420         if test -n "$MSBUILD_PATH" ; then
15421             pathmunge "$MSBUILD_PATH" "before"
15422         fi
15423         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15424         if test "$ENABLE_JAVA" != ""; then
15425             if test -d "$JAVA_HOME/jre/bin/client"; then
15426                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15427             fi
15428             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15429                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15430             fi
15431             pathmunge "$JAVA_HOME/bin" "before"
15432         fi
15433         pathmunge "$MSVC_HOST_PATH" "before"
15434         ;;
15436     solaris*)
15437         pathmunge "/usr/css/bin" "before"
15438         if test "$ENABLE_JAVA" != ""; then
15439             pathmunge "$JAVA_HOME/bin" "after"
15440         fi
15441         ;;
15442     esac
15445 AC_SUBST(LO_PATH)
15447 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15448 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15449     x_LO_ELFCHECK_ALLOWLIST=
15450 else
15451     x_LO_ELFCHECK_ALLOWLIST=[\#]
15453 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15454 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15456 libo_FUZZ_SUMMARY
15458 # Generate a configuration sha256 we can use for deps
15459 if test -f config_host.mk; then
15460     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15462 if test -f config_host_lang.mk; then
15463     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15466 CFLAGS=$my_original_CFLAGS
15467 CXXFLAGS=$my_original_CXXFLAGS
15468 CPPFLAGS=$my_original_CPPFLAGS
15470 AC_CONFIG_LINKS([include:include])
15472 if test -n "$WSL_ONLY_AS_HELPER"; then
15473     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15474     build=$host
15475     PathFormat "$SRC_ROOT"
15476     SRC_ROOT="$formatted_path"
15477     PathFormat "$BUILDDIR"
15478     BUILDDIR="$formatted_path"
15479     # git-bash has (gnu) tar, curl and sha256sum
15480     CURL="curl.exe"
15481     WGET=
15482     GNUTAR="tar.exe"
15483     SHA256SUM="sha256sum.exe"
15484     # TODO: maybe switch to strawberry-perl right away?
15485     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15486     PERL="perl.exe"
15487     # use flex, gperf and nasm from wsl-container
15488     # if using absolute path, would need to use double-leading slash for the msys path mangling
15489     FLEX="$WSL $FLEX"
15490     NASM="$WSL $NASM"
15491     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15492     # with an absolute path/requires the value to begin with a slash
15493     GPERF="/c/Windows/system32/$WSL gperf"
15494     # append strawberry tools dir to PATH (for e.g. windres, ar)
15495     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15496     # temp-dir needs to be in windows realm, hardcode for now
15497     if test "$TEMP_DIRECTORY" = /tmp; then
15498         mkdir -p tmp
15499         TEMP_DIRECTORY="$BUILDDIR/tmp"
15500     fi
15503 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15504 # BUILD platform configuration] - otherwise breaks cross building
15505 AC_CONFIG_FILES([
15506                  config_host_lang.mk
15507                  Makefile
15508                  bin/bffvalidator.sh
15509                  bin/odfvalidator.sh
15510                  bin/officeotron.sh
15511                  instsetoo_native/util/openoffice.lst
15512                  sysui/desktop/macosx/Info.plist
15513                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15514                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15515                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15516 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15517 # easier to do it in a postprocessing command than to modify every single variable
15518 AC_CONFIG_FILES([config_host.mk], [
15519     if test -n "$WSL_ONLY_AS_HELPER"; then
15520         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15521     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15523 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15524 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15525 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15526 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15527 AC_CONFIG_HEADERS([config_host/config_clang.h])
15528 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15529 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15530 AC_CONFIG_HEADERS([config_host/config_eot.h])
15531 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15532 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15533 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15534 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15535 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15536 AC_CONFIG_HEADERS([config_host/config_features.h])
15537 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15538 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15539 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15540 AC_CONFIG_HEADERS([config_host/config_folders.h])
15541 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15542 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15543 AC_CONFIG_HEADERS([config_host/config_gio.h])
15544 AC_CONFIG_HEADERS([config_host/config_global.h])
15545 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15546 AC_CONFIG_HEADERS([config_host/config_java.h])
15547 AC_CONFIG_HEADERS([config_host/config_langs.h])
15548 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15549 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15550 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15551 AC_CONFIG_HEADERS([config_host/config_locales.h])
15552 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15553 AC_CONFIG_HEADERS([config_host/config_oox.h])
15554 AC_CONFIG_HEADERS([config_host/config_options.h])
15555 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15556 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15557 AC_CONFIG_HEADERS([config_host/config_skia.h])
15558 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15559 AC_CONFIG_HEADERS([config_host/config_validation.h])
15560 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15561 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15562 AC_CONFIG_HEADERS([config_host/config_version.h])
15563 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15564 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15565 AC_CONFIG_HEADERS([config_host/config_python.h])
15566 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15567 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15568 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15569 AC_OUTPUT
15571 if test "$CROSS_COMPILING" = TRUE; then
15572     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15575 # touch the config timestamp file
15576 if test ! -f config_host.mk.stamp; then
15577     echo > config_host.mk.stamp
15578 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15579     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15580 else
15581     echo > config_host.mk.stamp
15584 # touch the config lang timestamp file
15585 if test ! -f config_host_lang.mk.stamp; then
15586     echo > config_host_lang.mk.stamp
15587 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15588     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15589 else
15590     echo > config_host_lang.mk.stamp
15594 if test \( "$STALE_MAKE" = "TRUE" \) \
15595         -a "$build_os" = "cygwin"; then
15597 cat << _EOS
15598 ****************************************************************************
15599 WARNING:
15600 Your make version is known to be horribly slow, and hard to debug
15601 problems with. To get a reasonably functional make please do:
15603 to install a pre-compiled binary make for Win32
15605  mkdir -p /opt/lo/bin
15606  cd /opt/lo/bin
15607  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15608  cp make-4.2.1-msvc.exe make
15609  chmod +x make
15611 to install from source:
15612 place yourself in a working directory of you choice.
15614  git clone git://git.savannah.gnu.org/make.git
15616  [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"]
15617  set PATH=%PATH%;C:\Cygwin\bin
15618  [or Cygwin64, if that is what you have]
15619  cd path-to-make-repo-you-cloned-above
15620  build_w32.bat --without-guile
15622 should result in a WinRel/gnumake.exe.
15623 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15625 Then re-run autogen.sh
15627 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15628 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15630 _EOS
15634 cat << _EOF
15635 ****************************************************************************
15637 To show information on various make targets and make flags, run:
15638 $GNUMAKE help
15640 To just build, run:
15641 $GNUMAKE
15643 _EOF
15645 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15646     cat << _EOF
15647 After the build has finished successfully, you can immediately run what you built using the command:
15648 _EOF
15650     if test $_os = Darwin; then
15651         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15652     else
15653         echo instdir/program/soffice
15654     fi
15655     cat << _EOF
15657 If you want to run the unit tests, run:
15658 $GNUMAKE check
15660 _EOF
15663 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15664     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15665     cat "$WARNINGS_FILE_FOR_BUILD"
15666     echo
15669 if test -s "$WARNINGS_FILE"; then
15670     echo "HOST config ($WARNINGS_FILE)"
15671     cat "$WARNINGS_FILE"
15674 # Remove unneeded emconfigure artifacts
15675 rm -f a.out a.wasm a.out.js a.out.wasm
15677 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: