workaround clang-14 bug
[LibreOffice.git] / configure.ac
blob00ed89ef3ac080a01ca97be2347ba9c729fa2756
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.0.1.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 experimental Mozilla-like online update service that will
1936          check for new versions of LibreOffice. Disabled by default.]),
1939 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1940     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1941         [Set the base URL value for --enable-online-update-mar.
1942          (Can be left off for debug purposes, even if that may render the feature
1943          non-functional.)]),
1946 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1947     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1948         [Set the certificate DER value for --enable-online-update-mar.
1949          (Can be left off for debug purposes, even if that may render the feature
1950          non-functional.)]),
1953 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1954     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1955         [Set the certificate name value for --enable-online-update-mar.
1956          (Can be left off for debug purposes, even if that may render the feature
1957          non-functional.)]),
1960 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1961     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1962         [Set the certificate path value for --enable-online-update-mar.
1963          (Can be left off for debug purposes, even if that may render the feature
1964          non-functional.)]),
1967 libo_FUZZ_ARG_ENABLE(extension-update,
1968     AS_HELP_STRING([--disable-extension-update],
1969         [Disable possibility to update installed extensions.]),
1972 libo_FUZZ_ARG_ENABLE(release-build,
1973     AS_HELP_STRING([--enable-release-build],
1974         [Enable release build. Note that the "release build" choice is orthogonal to
1975          whether symbols are present, debug info is generated, or optimization
1976          is done.
1977          See https://wiki.documentfoundation.org/Development/DevBuild]),
1980 libo_FUZZ_ARG_ENABLE(hardening-flags,
1981     AS_HELP_STRING([--enable-hardening-flags],
1982         [Enable automatically using hardening compiler flags. Distros typically
1983          instead use their default configuration via CXXFLAGS, etc. But this provides a
1984          convenient set of default hardening flags for non-distros]),
1987 AC_ARG_ENABLE(windows-build-signing,
1988     AS_HELP_STRING([--enable-windows-build-signing],
1989         [Enable signing of windows binaries (*.exe, *.dll)]),
1992 AC_ARG_ENABLE(silent-msi,
1993     AS_HELP_STRING([--enable-silent-msi],
1994         [Enable MSI with LIMITUI=1 (silent install).]),
1997 AC_ARG_ENABLE(wix,
1998     AS_HELP_STRING([--enable-wix],
1999         [Build Windows installer using WiX.]),
2002 AC_ARG_ENABLE(macosx-code-signing,
2003     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
2004         [Sign executables, dylibs, frameworks and the app bundle. If you
2005          don't provide an identity the first suitable certificate
2006          in your keychain is used.]),
2009 AC_ARG_ENABLE(macosx-package-signing,
2010     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2011         [Create a .pkg suitable for uploading to the Mac App Store and sign
2012          it. If you don't provide an identity the first suitable certificate
2013          in your keychain is used.]),
2016 AC_ARG_ENABLE(macosx-sandbox,
2017     AS_HELP_STRING([--enable-macosx-sandbox],
2018         [Make the app bundle run in a sandbox. Requires code signing.
2019          Is required by apps distributed in the Mac App Store, and implies
2020          adherence to App Store rules.]),
2023 AC_ARG_WITH(macosx-bundle-identifier,
2024     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2025         [Define the macOS bundle identifier. Default is the somewhat weird
2026          org.libreoffice.script ("script", huh?).]),
2027 ,with_macosx_bundle_identifier=org.libreoffice.script)
2029 AC_ARG_WITH(macosx-provisioning-profile,
2030     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2031         [Specify the path to a provisioning profile to use]),
2034 AC_ARG_WITH(product-name,
2035     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2036         [Define the product name. Default is AC_PACKAGE_NAME.]),
2037 ,with_product_name=$PRODUCTNAME)
2039 libo_FUZZ_ARG_ENABLE(community-flavor,
2040     AS_HELP_STRING([--disable-community-flavor],
2041         [Disable the Community branding.]),
2044 AC_ARG_WITH(package-version,
2045     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2046         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2049 libo_FUZZ_ARG_ENABLE(readonly-installset,
2050     AS_HELP_STRING([--enable-readonly-installset],
2051         [Prevents any attempts by LibreOffice to write into its installation. That means
2052          at least that no "system-wide" extensions can be added. Partly experimental work in
2053          progress, probably not fully implemented. Always enabled for macOS.]),
2056 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2057     AS_HELP_STRING([--disable-mariadb-sdbc],
2058         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2061 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2062     AS_HELP_STRING([--disable-postgresql-sdbc],
2063         [Disable the build of the PostgreSQL-SDBC driver.])
2066 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2067     AS_HELP_STRING([--disable-lotuswordpro],
2068         [Disable the build of the Lotus Word Pro filter.]),
2069 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2071 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2072     AS_HELP_STRING([--disable-firebird-sdbc],
2073         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2074 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2076 AC_ARG_ENABLE(bogus-pkg-config,
2077     AS_HELP_STRING([--enable-bogus-pkg-config],
2078         [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.]),
2081 AC_ARG_ENABLE(openssl,
2082     AS_HELP_STRING([--disable-openssl],
2083         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2084          components will use NSS. Work in progress,
2085          use only if you are hacking on it.]),
2086 ,enable_openssl=yes)
2088 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2089     AS_HELP_STRING([--enable-cipher-openssl-backend],
2090         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2091          Requires --enable-openssl.]))
2093 AC_ARG_ENABLE(nss,
2094     AS_HELP_STRING([--disable-nss],
2095         [Disable using NSS. If disabled,
2096          components will use openssl. Work in progress,
2097          use only if you are hacking on it.]),
2098 ,enable_nss=yes)
2100 AC_ARG_ENABLE(library-bin-tar,
2101     AS_HELP_STRING([--enable-library-bin-tar],
2102         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2103         Some libraries can save their build result in a tarball
2104         stored in TARFILE_LOCATION. That binary tarball is
2105         uniquely identified by the source tarball,
2106         the content of the config_host.mk file and the content
2107         of the top-level directory in core for that library
2108         If this option is enabled, then if such a tarfile exist, it will be untarred
2109         instead of the source tarfile, and the build step will be skipped for that
2110         library.
2111         If a proper tarfile does not exist, then the normal source-based
2112         build is done for that library and a proper binary tarfile is created
2113         for the next time.]),
2116 AC_ARG_ENABLE(dconf,
2117     AS_HELP_STRING([--disable-dconf],
2118         [Disable the dconf configuration backend (enabled by default where
2119          available).]))
2121 libo_FUZZ_ARG_ENABLE(formula-logger,
2122     AS_HELP_STRING(
2123         [--enable-formula-logger],
2124         [Enable formula logger for logging formula calculation flow in Calc.]
2125     )
2128 AC_ARG_ENABLE(ldap,
2129     AS_HELP_STRING([--disable-ldap],
2130         [Disable LDAP support.]),
2131 ,enable_ldap=yes)
2133 AC_ARG_ENABLE(opencl,
2134     AS_HELP_STRING([--disable-opencl],
2135         [Disable OpenCL support.]),
2136 ,enable_opencl=yes)
2138 libo_FUZZ_ARG_ENABLE(librelogo,
2139     AS_HELP_STRING([--disable-librelogo],
2140         [Do not build LibreLogo.]),
2141 ,enable_librelogo=yes)
2143 AC_ARG_ENABLE(wasm-strip,
2144     AS_HELP_STRING([--enable-wasm-strip],
2145         [Strip the static build like for WASM/emscripten platform.]),
2148 AC_ARG_WITH(main-module,
2149     AS_HELP_STRING([--with-main-module=<writer/calc>],
2150         [Specify which main module to build for wasm.
2151         Default value is 'writer'.]),
2154 AC_ARG_ENABLE(xmlhelp,
2155     AS_HELP_STRING([--disable-xmlhelp],
2156         [Disable XML help support]),
2157 ,enable_xmlhelp=yes)
2159 AC_ARG_ENABLE(customtarget-components,
2160     AS_HELP_STRING([--enable-customtarget-components],
2161         [Generates the static UNO object constructor mapping from the build.]))
2163 dnl ===================================================================
2164 dnl Optional Packages (--with/without-)
2165 dnl ===================================================================
2167 AC_ARG_WITH(gcc-home,
2168     AS_HELP_STRING([--with-gcc-home],
2169         [Specify the location of gcc/g++ manually. This can be used in conjunction
2170          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2171          non-default path.]),
2174 AC_ARG_WITH(gnu-patch,
2175     AS_HELP_STRING([--with-gnu-patch],
2176         [Specify location of GNU patch on Solaris or FreeBSD.]),
2179 AC_ARG_WITH(build-platform-configure-options,
2180     AS_HELP_STRING([--with-build-platform-configure-options],
2181         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2184 AC_ARG_WITH(gnu-cp,
2185     AS_HELP_STRING([--with-gnu-cp],
2186         [Specify location of GNU cp on Solaris or FreeBSD.]),
2189 AC_ARG_WITH(external-tar,
2190     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2191         [Specify an absolute path of where to find (and store) tarfiles.]),
2192     TARFILE_LOCATION=$withval ,
2195 AC_ARG_WITH(referenced-git,
2196     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2197         [Specify another checkout directory to reference. This makes use of
2198                  git submodule update --reference, and saves a lot of diskspace
2199                  when having multiple trees side-by-side.]),
2200     GIT_REFERENCE_SRC=$withval ,
2203 AC_ARG_WITH(linked-git,
2204     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2205         [Specify a directory where the repositories of submodules are located.
2206          This uses a method similar to git-new-workdir to get submodules.]),
2207     GIT_LINK_SRC=$withval ,
2210 AC_ARG_WITH(galleries,
2211     AS_HELP_STRING([--with-galleries],
2212         [Specify how galleries should be built. It is possible either to
2213          build these internally from source ("build"),
2214          or to disable them ("no")]),
2217 AC_ARG_WITH(templates,
2218     AS_HELP_STRING([--with-templates],
2219         [Specify we build with or without template files. It is possible either to
2220          build with templates ("yes"),
2221          or to disable them ("no")]),
2224 AC_ARG_WITH(theme,
2225     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2226         [Choose which themes to include. By default those themes with an '*' are included.
2227          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2228          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2229          *elementary, *elementary_svg,
2230          *karasa_jaga, *karasa_jaga_svg,
2231          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2232          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2235 libo_FUZZ_ARG_WITH(helppack-integration,
2236     AS_HELP_STRING([--without-helppack-integration],
2237         [It will not integrate the helppacks to the installer
2238          of the product. Please use this switch to use the online help
2239          or separate help packages.]),
2242 libo_FUZZ_ARG_WITH(fonts,
2243     AS_HELP_STRING([--without-fonts],
2244         [LibreOffice includes some third-party fonts to provide a reliable basis for
2245          help content, templates, samples, etc. When these fonts are already
2246          known to be available on the system then you should use this option.]),
2249 AC_ARG_WITH(epm,
2250     AS_HELP_STRING([--with-epm],
2251         [Decides which epm to use. Default is to use the one from the system if
2252          one is built. When either this is not there or you say =internal epm
2253          will be built.]),
2256 AC_ARG_WITH(package-format,
2257     AS_HELP_STRING([--with-package-format],
2258         [Specify package format(s) for LibreOffice installation sets. The
2259          implicit --without-package-format leads to no installation sets being
2260          generated. Possible values: archive, bsd, deb, dmg,
2261          installed, msi, pkg, and rpm.
2262          Example: --with-package-format='deb rpm']),
2265 AC_ARG_WITH(tls,
2266     AS_HELP_STRING([--with-tls],
2267         [Decides which TLS/SSL and cryptographic implementations to use for
2268          LibreOffice's code. Default is to use NSS although OpenSSL is also
2269          possible. Notice that selecting NSS restricts the usage of OpenSSL
2270          in LO's code but selecting OpenSSL doesn't restrict by now the
2271          usage of NSS in LO's code. Possible values: openssl, nss.
2272          Example: --with-tls="nss"]),
2275 AC_ARG_WITH(system-libs,
2276     AS_HELP_STRING([--with-system-libs],
2277         [Use libraries already on system -- enables all --with-system-* flags.]),
2280 AC_ARG_WITH(system-bzip2,
2281     AS_HELP_STRING([--with-system-bzip2],
2282         [Use bzip2 already on system. Used when --enable-online-update-mar
2283         or --enable-python=internal]),,
2284     [with_system_bzip2="$with_system_libs"])
2286 AC_ARG_WITH(system-headers,
2287     AS_HELP_STRING([--with-system-headers],
2288         [Use headers already on system -- enables all --with-system-* flags for
2289          external packages whose headers are the only entities used i.e.
2290          boost/odbc/sane-header(s).]),,
2291     [with_system_headers="$with_system_libs"])
2293 AC_ARG_WITH(system-jars,
2294     AS_HELP_STRING([--without-system-jars],
2295         [When building with --with-system-libs, also the needed jars are expected
2296          on the system. Use this to disable that]),,
2297     [with_system_jars="$with_system_libs"])
2299 AC_ARG_WITH(system-cairo,
2300     AS_HELP_STRING([--with-system-cairo],
2301         [Use cairo libraries already on system.  Happens automatically for
2302          (implicit) --enable-gtk3.]))
2304 AC_ARG_WITH(system-epoxy,
2305     AS_HELP_STRING([--with-system-epoxy],
2306         [Use epoxy libraries already on system.  Happens automatically for
2307          (implicit) --enable-gtk3.]),,
2308        [with_system_epoxy="$with_system_libs"])
2310 AC_ARG_WITH(myspell-dicts,
2311     AS_HELP_STRING([--with-myspell-dicts],
2312         [Adds myspell dictionaries to the LibreOffice installation set]),
2315 AC_ARG_WITH(system-dicts,
2316     AS_HELP_STRING([--without-system-dicts],
2317         [Do not use dictionaries from system paths.]),
2320 AC_ARG_WITH(external-dict-dir,
2321     AS_HELP_STRING([--with-external-dict-dir],
2322         [Specify external dictionary dir.]),
2325 AC_ARG_WITH(external-hyph-dir,
2326     AS_HELP_STRING([--with-external-hyph-dir],
2327         [Specify external hyphenation pattern dir.]),
2330 AC_ARG_WITH(external-thes-dir,
2331     AS_HELP_STRING([--with-external-thes-dir],
2332         [Specify external thesaurus dir.]),
2335 AC_ARG_WITH(system-zlib,
2336     AS_HELP_STRING([--with-system-zlib],
2337         [Use zlib already on system.]),,
2338     [with_system_zlib=auto])
2340 AC_ARG_WITH(system-jpeg,
2341     AS_HELP_STRING([--with-system-jpeg],
2342         [Use jpeg already on system.]),,
2343     [with_system_jpeg="$with_system_libs"])
2345 AC_ARG_WITH(system-expat,
2346     AS_HELP_STRING([--with-system-expat],
2347         [Use expat already on system.]),,
2348     [with_system_expat="$with_system_libs"])
2350 AC_ARG_WITH(system-libxml,
2351     AS_HELP_STRING([--with-system-libxml],
2352         [Use libxml/libxslt already on system.]),,
2353     [with_system_libxml=auto])
2355 AC_ARG_WITH(system-openldap,
2356     AS_HELP_STRING([--with-system-openldap],
2357         [Use the OpenLDAP LDAP SDK already on system.]),,
2358     [with_system_openldap="$with_system_libs"])
2360 libo_FUZZ_ARG_ENABLE(poppler,
2361     AS_HELP_STRING([--disable-poppler],
2362         [Disable building Poppler.])
2365 AC_ARG_WITH(system-poppler,
2366     AS_HELP_STRING([--with-system-poppler],
2367         [Use system poppler (only needed for PDF import).]),,
2368     [with_system_poppler="$with_system_libs"])
2370 AC_ARG_WITH(system-abseil,
2371     AS_HELP_STRING([--with-system-abseil],
2372         [Use the abseil libraries already on system.]),,
2373     [with_system_abseil="$with_system_libs"])
2375 AC_ARG_WITH(system-openjpeg,
2376     AS_HELP_STRING([--with-system-openjpeg],
2377         [Use the OpenJPEG library already on system.]),,
2378     [with_system_openjpeg="$with_system_libs"])
2380 libo_FUZZ_ARG_ENABLE(gpgmepp,
2381     AS_HELP_STRING([--disable-gpgmepp],
2382         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2385 AC_ARG_WITH(system-gpgmepp,
2386     AS_HELP_STRING([--with-system-gpgmepp],
2387         [Use gpgmepp already on system]),,
2388     [with_system_gpgmepp="$with_system_libs"])
2390 AC_ARG_WITH(system-mariadb,
2391     AS_HELP_STRING([--with-system-mariadb],
2392         [Use MariaDB/MySQL libraries already on system.]),,
2393     [with_system_mariadb="$with_system_libs"])
2395 AC_ARG_ENABLE(bundle-mariadb,
2396     AS_HELP_STRING([--enable-bundle-mariadb],
2397         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2400 AC_ARG_WITH(system-postgresql,
2401     AS_HELP_STRING([--with-system-postgresql],
2402         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2403          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2404     [with_system_postgresql="$with_system_libs"])
2406 AC_ARG_WITH(libpq-path,
2407     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2408         [Use this PostgreSQL C interface (libpq) installation for building
2409          the PostgreSQL-SDBC extension.]),
2412 AC_ARG_WITH(system-firebird,
2413     AS_HELP_STRING([--with-system-firebird],
2414         [Use Firebird libraries already on system, for building the Firebird-SDBC
2415          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2416     [with_system_firebird="$with_system_libs"])
2418 AC_ARG_WITH(system-libtommath,
2419             AS_HELP_STRING([--with-system-libtommath],
2420                            [Use libtommath already on system]),,
2421             [with_system_libtommath="$with_system_libs"])
2423 AC_ARG_WITH(system-hsqldb,
2424     AS_HELP_STRING([--with-system-hsqldb],
2425         [Use hsqldb already on system.]))
2427 AC_ARG_WITH(hsqldb-jar,
2428     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2429         [Specify path to jarfile manually.]),
2430     HSQLDB_JAR=$withval)
2432 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2433     AS_HELP_STRING([--disable-scripting-beanshell],
2434         [Disable support for scripts in BeanShell.]),
2438 AC_ARG_WITH(system-beanshell,
2439     AS_HELP_STRING([--with-system-beanshell],
2440         [Use beanshell already on system.]),,
2441     [with_system_beanshell="$with_system_jars"])
2443 AC_ARG_WITH(beanshell-jar,
2444     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2445         [Specify path to jarfile manually.]),
2446     BSH_JAR=$withval)
2448 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2449     AS_HELP_STRING([--disable-scripting-javascript],
2450         [Disable support for scripts in JavaScript.]),
2454 AC_ARG_WITH(system-rhino,
2455     AS_HELP_STRING([--with-system-rhino],
2456         [Use rhino already on system.]),,
2457     [with_system_rhino="$with_system_jars"])
2459 AC_ARG_WITH(rhino-jar,
2460     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2461         [Specify path to jarfile manually.]),
2462     RHINO_JAR=$withval)
2464 AC_ARG_WITH(system-jfreereport,
2465     AS_HELP_STRING([--with-system-jfreereport],
2466         [Use JFreeReport already on system.]),,
2467     [with_system_jfreereport="$with_system_jars"])
2469 AC_ARG_WITH(sac-jar,
2470     AS_HELP_STRING([--with-sac-jar=JARFILE],
2471         [Specify path to jarfile manually.]),
2472     SAC_JAR=$withval)
2474 AC_ARG_WITH(libxml-jar,
2475     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2476         [Specify path to jarfile manually.]),
2477     LIBXML_JAR=$withval)
2479 AC_ARG_WITH(flute-jar,
2480     AS_HELP_STRING([--with-flute-jar=JARFILE],
2481         [Specify path to jarfile manually.]),
2482     FLUTE_JAR=$withval)
2484 AC_ARG_WITH(jfreereport-jar,
2485     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2486         [Specify path to jarfile manually.]),
2487     JFREEREPORT_JAR=$withval)
2489 AC_ARG_WITH(liblayout-jar,
2490     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2491         [Specify path to jarfile manually.]),
2492     LIBLAYOUT_JAR=$withval)
2494 AC_ARG_WITH(libloader-jar,
2495     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2496         [Specify path to jarfile manually.]),
2497     LIBLOADER_JAR=$withval)
2499 AC_ARG_WITH(libformula-jar,
2500     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2501         [Specify path to jarfile manually.]),
2502     LIBFORMULA_JAR=$withval)
2504 AC_ARG_WITH(librepository-jar,
2505     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2506         [Specify path to jarfile manually.]),
2507     LIBREPOSITORY_JAR=$withval)
2509 AC_ARG_WITH(libfonts-jar,
2510     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2511         [Specify path to jarfile manually.]),
2512     LIBFONTS_JAR=$withval)
2514 AC_ARG_WITH(libserializer-jar,
2515     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2516         [Specify path to jarfile manually.]),
2517     LIBSERIALIZER_JAR=$withval)
2519 AC_ARG_WITH(libbase-jar,
2520     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2521         [Specify path to jarfile manually.]),
2522     LIBBASE_JAR=$withval)
2524 AC_ARG_WITH(system-odbc,
2525     AS_HELP_STRING([--with-system-odbc],
2526         [Use the odbc headers already on system.]),,
2527     [with_system_odbc="auto"])
2529 AC_ARG_WITH(system-sane,
2530     AS_HELP_STRING([--with-system-sane],
2531         [Use sane.h already on system.]),,
2532     [with_system_sane="$with_system_headers"])
2534 AC_ARG_WITH(system-bluez,
2535     AS_HELP_STRING([--with-system-bluez],
2536         [Use bluetooth.h already on system.]),,
2537     [with_system_bluez="$with_system_headers"])
2539 AC_ARG_WITH(system-boost,
2540     AS_HELP_STRING([--with-system-boost],
2541         [Use boost already on system.]),,
2542     [with_system_boost="$with_system_headers"])
2544 AC_ARG_WITH(system-dragonbox,
2545     AS_HELP_STRING([--with-system-dragonbox],
2546         [Use dragonbox already on system.]),,
2547     [with_system_dragonbox="$with_system_headers"])
2549 AC_ARG_WITH(system-frozen,
2550     AS_HELP_STRING([--with-system-frozen],
2551         [Use frozen already on system.]),,
2552     [with_system_frozen="$with_system_headers"])
2554 AC_ARG_WITH(system-libfixmath,
2555     AS_HELP_STRING([--with-system-libfixmath],
2556         [Use libfixmath already on system.]),,
2557     [with_system_libfixmath="$with_system_libs"])
2559 AC_ARG_WITH(system-glm,
2560     AS_HELP_STRING([--with-system-glm],
2561         [Use glm already on system.]),,
2562     [with_system_glm="$with_system_headers"])
2564 AC_ARG_WITH(system-hunspell,
2565     AS_HELP_STRING([--with-system-hunspell],
2566         [Use libhunspell already on system.]),,
2567     [with_system_hunspell="$with_system_libs"])
2569 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2570     AS_HELP_STRING([--enable-cairo-rgba],
2571         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2573 libo_FUZZ_ARG_ENABLE(zxing,
2574     AS_HELP_STRING([--disable-zxing],
2575        [Disable use of zxing external library.]))
2577 AC_ARG_WITH(system-zxing,
2578     AS_HELP_STRING([--with-system-zxing],
2579         [Use libzxing already on system.]),,
2580     [with_system_zxing="$with_system_libs"])
2582 AC_ARG_WITH(system-zxcvbn,
2583     AS_HELP_STRING([--with-system-zxcvbn],
2584         [Use libzxcvbn already on system.]),,
2585     [with_system_zxcvbn="$with_system_libs"])
2587 AC_ARG_WITH(system-box2d,
2588     AS_HELP_STRING([--with-system-box2d],
2589         [Use box2d already on system.]),,
2590     [with_system_box2d="$with_system_libs"])
2592 AC_ARG_WITH(system-mythes,
2593     AS_HELP_STRING([--with-system-mythes],
2594         [Use mythes already on system.]),,
2595     [with_system_mythes="$with_system_libs"])
2597 AC_ARG_WITH(system-altlinuxhyph,
2598     AS_HELP_STRING([--with-system-altlinuxhyph],
2599         [Use ALTLinuxhyph already on system.]),,
2600     [with_system_altlinuxhyph="$with_system_libs"])
2602 AC_ARG_WITH(system-lpsolve,
2603     AS_HELP_STRING([--with-system-lpsolve],
2604         [Use lpsolve already on system.]),,
2605     [with_system_lpsolve="$with_system_libs"])
2607 AC_ARG_WITH(system-coinmp,
2608     AS_HELP_STRING([--with-system-coinmp],
2609         [Use CoinMP already on system.]),,
2610     [with_system_coinmp="$with_system_libs"])
2612 AC_ARG_WITH(system-liblangtag,
2613     AS_HELP_STRING([--with-system-liblangtag],
2614         [Use liblangtag library already on system.]),,
2615     [with_system_liblangtag="$with_system_libs"])
2617 AC_ARG_WITH(system-lockfile,
2618     AS_HELP_STRING([--with-system-lockfile[=file]],
2619         [Detect a system lockfile program or use the \$file argument.]))
2621 AC_ARG_WITH(webdav,
2622     AS_HELP_STRING([--without-webdav],
2623         [Disable WebDAV support in the UCB.]))
2625 AC_ARG_WITH(linker-hash-style,
2626     AS_HELP_STRING([--with-linker-hash-style],
2627         [Use linker with --hash-style=<style> when linking shared objects.
2628          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2629          if supported on the build system, and "sysv" otherwise.]))
2631 AC_ARG_WITH(jdk-home,
2632     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2633         [If you have installed JDK 8 or later on your system please supply the
2634          path here. Note that this is not the location of the java command but the
2635          location of the entire distribution. In case of cross-compiling, this
2636          is the JDK of the host os. Use --with-build-platform-configure-options
2637          to point to a different build platform JDK.]),
2640 AC_ARG_WITH(help,
2641     AS_HELP_STRING([--with-help],
2642         [Enable the build of help. There is a special parameter "common" that
2643          can be used to bundle only the common part, .e.g help-specific icons.
2644          This is useful when you build the helpcontent separately.])
2645     [
2646                           Usage:     --with-help    build the old local help
2647                                  --without-help     no local help (default)
2648                                  --with-help=html   build the new HTML local help
2649                                  --with-help=online build the new HTML online help
2650     ],
2653 AC_ARG_WITH(omindex,
2654    AS_HELP_STRING([--with-omindex],
2655         [Enable the support of xapian-omega index for online help.])
2656    [
2657                          Usage: --with-omindex=server prepare the pages for omindex
2658                                 but let xapian-omega be built in server.
2659                                 --with-omindex=noxap do not prepare online pages
2660                                 for xapian-omega
2661   ],
2664 libo_FUZZ_ARG_WITH(java,
2665     AS_HELP_STRING([--with-java=<java command>],
2666         [Specify the name of the Java interpreter command. Typically "java"
2667          which is the default.
2669          To build without support for Java components, applets, accessibility
2670          or the XML filters written in Java, use --without-java or --with-java=no.]),
2671     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2672     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2675 AC_ARG_WITH(jvm-path,
2676     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2677         [Use a specific JVM search path at runtime.
2678          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2681 AC_ARG_WITH(ant-home,
2682     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2683         [If you have installed Apache Ant on your system, please supply the path here.
2684          Note that this is not the location of the Ant binary but the location
2685          of the entire distribution.]),
2688 AC_ARG_WITH(symbol-config,
2689     AS_HELP_STRING([--with-symbol-config],
2690         [Configuration for the crashreport symbol upload]),
2691         [],
2692         [with_symbol_config=no])
2694 AC_ARG_WITH(export-validation,
2695     AS_HELP_STRING([--without-export-validation],
2696         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2697 ,with_export_validation=auto)
2699 AC_ARG_WITH(bffvalidator,
2700     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2701         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2702          Requires installed Microsoft Office Binary File Format Validator.
2703          Note: export-validation (--with-export-validation) is required to be turned on.
2704          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2705 ,with_bffvalidator=no)
2707 libo_FUZZ_ARG_WITH(junit,
2708     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2709         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2710          --without-junit disables those tests. Not relevant in the --without-java case.]),
2711 ,with_junit=yes)
2713 AC_ARG_WITH(hamcrest,
2714     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2715         [Specifies the hamcrest jar file to use for JUnit-based tests.
2716          --without-junit disables those tests. Not relevant in the --without-java case.]),
2717 ,with_hamcrest=yes)
2719 AC_ARG_WITH(perl-home,
2720     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2721         [If you have installed Perl 5 Distribution, on your system, please
2722          supply the path here. Note that this is not the location of the Perl
2723          binary but the location of the entire distribution.]),
2726 libo_FUZZ_ARG_WITH(doxygen,
2727     AS_HELP_STRING(
2728         [--with-doxygen=<absolute path to doxygen executable>],
2729         [Specifies the doxygen executable to use when generating ODK C/C++
2730          documentation. --without-doxygen disables generation of ODK C/C++
2731          documentation. Not relevant in the --disable-odk case.]),
2732 ,with_doxygen=yes)
2734 AC_ARG_WITH(visual-studio,
2735     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2736         [Specify which Visual Studio version to use in case several are
2737          installed. Currently 2019 (default) and 2022 are supported.]),
2740 AC_ARG_WITH(windows-sdk,
2741     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2742         [Specify which Windows SDK, or "Windows Kit", version to use
2743          in case the one that came with the selected Visual Studio
2744          is not what you want for some reason. Note that not all compiler/SDK
2745          combinations are supported. The intent is that this option should not
2746          be needed.]),
2749 AC_ARG_WITH(lang,
2750     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2751         [Use this option to build LibreOffice with additional UI language support.
2752          English (US) is always included by default.
2753          Separate multiple languages with space.
2754          For all languages, use --with-lang=ALL.]),
2757 AC_ARG_WITH(locales,
2758     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2759         [Use this option to limit the locale information built in.
2760          Separate multiple locales with space.
2761          Very experimental and might well break stuff.
2762          Just a desperate measure to shrink code and data size.
2763          By default all the locales available is included.
2764          Just works with --disable-dynloading. Defaults to "ALL".
2765          This option is completely unrelated to --with-lang.])
2766     [
2767                           Affects also our character encoding conversion
2768                           tables for encodings mainly targeted for a
2769                           particular locale, like EUC-CN and EUC-TW for
2770                           zh, ISO-2022-JP for ja.
2772                           Affects also our add-on break iterator data for
2773                           some languages.
2775                           For the default, all locales, don't use this switch at all.
2776                           Specifying just the language part of a locale means all matching
2777                           locales will be included.
2778     ],
2781 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2782 # and also by Mariadb/Mysql and libcurl since LibO 24.8
2783 libo_FUZZ_ARG_WITH(krb5,
2784     AS_HELP_STRING([--with-krb5],
2785         [Enable MIT Kerberos 5 support in modules that support it.
2786          By default automatically enabled on platforms
2787          where a good system Kerberos 5 is available.]),
2790 libo_FUZZ_ARG_WITH(gssapi,
2791     AS_HELP_STRING([--with-gssapi],
2792         [Enable GSSAPI support in modules that support it.
2793          By default automatically enabled on platforms
2794          where a good system GSSAPI is available.]),
2797 libo_FUZZ_ARG_WITH(lxml,
2798     AS_HELP_STRING([--without-lxml],
2799         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2800          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2801          report widget classes and ids.]),
2804 libo_FUZZ_ARG_WITH(latest-c++,
2805     AS_HELP_STRING([--with-latest-c++],
2806         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2807          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2808         [with_latest_c__=no])
2810 AC_ARG_WITH(gtk3-build,
2811     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2812         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2813          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2815 AC_ARG_WITH(keep-awake,
2816     AS_HELP_STRING([--with-keep-awake],
2817         [command to prefix make with in order to prevent the system from going to sleep/suspend
2818          while building.
2819          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2820          and caffeinate on macOS]))
2822 dnl ===================================================================
2823 dnl Branding
2824 dnl ===================================================================
2826 AC_ARG_WITH(branding,
2827     AS_HELP_STRING([--with-branding=/path/to/images],
2828         [Use given path to retrieve branding images set.])
2829     [
2830                           Search for intro.png about.svg and logo.svg.
2831                           If any is missing, default ones will be used instead.
2833                           Search also progress.conf for progress
2834                           settings on intro screen :
2836                           PROGRESSBARCOLOR="255,255,255" Set color of
2837                           progress bar. Comma separated RGB decimal values.
2838                           PROGRESSSIZE="407,6" Set size of progress bar.
2839                           Comma separated decimal values (width, height).
2840                           PROGRESSPOSITION="61,317" Set position of progress
2841                           bar from left,top. Comma separated decimal values.
2842                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2843                           bar frame. Comma separated RGB decimal values.
2844                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2845                           bar text. Comma separated RGB decimal values.
2846                           PROGRESSTEXTBASELINE="287" Set vertical position of
2847                           progress bar text from top. Decimal value.
2849                           Default values will be used if not found.
2850     ],
2854 AC_ARG_WITH(extra-buildid,
2855     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2856         [Show addition build identification in about dialog.]),
2860 AC_ARG_WITH(vendor,
2861     AS_HELP_STRING([--with-vendor="John the Builder"],
2862         [Set vendor of the build.]),
2865 AC_ARG_WITH(privacy-policy-url,
2866     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2867         [The URL to your privacy policy (needed when
2868          enabling online-update or crashreporting via breakpad)]),
2869         [if test "x$with_privacy_policy_url" = "xyes"; then
2870             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2871          elif test "x$with_privacy_policy_url" = "xno"; then
2872             with_privacy_policy_url="undefined"
2873          fi]
2874 ,[with_privacy_policy_url="undefined"])
2876 AC_ARG_WITH(android-package-name,
2877     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2878         [Set Android package name of the build.]),
2881 AC_ARG_WITH(compat-oowrappers,
2882     AS_HELP_STRING([--with-compat-oowrappers],
2883         [Install oo* wrappers in parallel with
2884          lo* ones to keep backward compatibility.
2885          Has effect only with make distro-pack-install]),
2888 AC_ARG_WITH(os-version,
2889     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2890         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2893 AC_ARG_WITH(parallelism,
2894     AS_HELP_STRING([--with-parallelism],
2895         [Number of jobs to run simultaneously during build. Parallel builds can
2896         save a lot of time on multi-cpu machines. Defaults to the number of
2897         CPUs on the machine, unless you configure --enable-icecream - then to
2898         40.]),
2901 AC_ARG_WITH(all-tarballs,
2902     AS_HELP_STRING([--with-all-tarballs],
2903         [Download all external tarballs unconditionally]))
2905 AC_ARG_WITH(gdrive-client-id,
2906     AS_HELP_STRING([--with-gdrive-client-id],
2907         [Provides the client id of the application for OAuth2 authentication
2908         on Google Drive. If either this or --with-gdrive-client-secret is
2909         empty, the feature will be disabled]),
2912 AC_ARG_WITH(gdrive-client-secret,
2913     AS_HELP_STRING([--with-gdrive-client-secret],
2914         [Provides the client secret of the application for OAuth2
2915         authentication on Google Drive. If either this or
2916         --with-gdrive-client-id is empty, the feature will be disabled]),
2919 AC_ARG_WITH(alfresco-cloud-client-id,
2920     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2921         [Provides the client id of the application for OAuth2 authentication
2922         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2923         empty, the feature will be disabled]),
2926 AC_ARG_WITH(alfresco-cloud-client-secret,
2927     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2928         [Provides the client secret of the application for OAuth2
2929         authentication on Alfresco Cloud. If either this or
2930         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2933 AC_ARG_WITH(onedrive-client-id,
2934     AS_HELP_STRING([--with-onedrive-client-id],
2935         [Provides the client id of the application for OAuth2 authentication
2936         on OneDrive. If either this or --with-onedrive-client-secret is
2937         empty, the feature will be disabled]),
2940 AC_ARG_WITH(onedrive-client-secret,
2941     AS_HELP_STRING([--with-onedrive-client-secret],
2942         [Provides the client secret of the application for OAuth2
2943         authentication on OneDrive. If either this or
2944         --with-onedrive-client-id is empty, the feature will be disabled]),
2947 dnl Check for coredumpctl support to present information about crashing test processes:
2948 AC_ARG_WITH(coredumpctl,
2949     AS_HELP_STRING([--with-coredumpctl],
2950         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2951         processes.]))
2953 AC_ARG_WITH(buildconfig-recorded,
2954     AS_HELP_STRING([--with-buildconfig-recorded],
2955         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2958 AC_MSG_CHECKING([whether to record build config])
2959 if test -z "$with_buildconfig_recorded"; then
2960     with_buildconfig_recorded=no
2962 if test "$with_buildconfig_recorded" = no; then
2963     AC_MSG_RESULT([no])
2964 else
2965     AC_MSG_RESULT([yes])
2966     # replace backslashes, to get a valid c++ string
2967     config_args=$(echo $ac_configure_args | tr '\\' '/')
2968     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2969     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2972 dnl ===================================================================
2973 dnl Do we want to use pre-build binary tarball for recompile
2974 dnl ===================================================================
2976 if test "$enable_library_bin_tar" = "yes" ; then
2977     USE_LIBRARY_BIN_TAR=TRUE
2978 else
2979     USE_LIBRARY_BIN_TAR=
2981 AC_SUBST(USE_LIBRARY_BIN_TAR)
2983 dnl ===================================================================
2984 dnl Test whether build target is Release Build
2985 dnl ===================================================================
2986 AC_MSG_CHECKING([whether build target is Release Build])
2987 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2988     AC_MSG_RESULT([no])
2989     ENABLE_RELEASE_BUILD=
2990     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2991     dnl the newlines and then complains about spaces.
2992     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/>'
2993 else
2994     AC_MSG_RESULT([yes])
2995     ENABLE_RELEASE_BUILD=TRUE
2996     GET_TASK_ALLOW_ENTITLEMENT=
2998 AC_SUBST(ENABLE_RELEASE_BUILD)
2999 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
3001 dnl ===================================================================
3002 dnl Test whether build should auto use hardening compiler flags
3003 dnl ===================================================================
3004 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3005 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3006     AC_MSG_RESULT([no])
3007     ENABLE_HARDENING_FLAGS=
3008 else
3009     AC_MSG_RESULT([yes])
3010     ENABLE_HARDENING_FLAGS=TRUE
3012 AC_SUBST(ENABLE_HARDENING_FLAGS)
3014 AC_MSG_CHECKING([whether to build a Community flavor])
3015 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3016     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3017     AC_MSG_RESULT([yes])
3018 else
3019     AC_MSG_RESULT([no])
3022 dnl ===================================================================
3023 dnl Test whether to sign Windows Build
3024 dnl ===================================================================
3025 AC_MSG_CHECKING([whether to sign windows build])
3026 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3027     AC_MSG_RESULT([yes])
3028     WINDOWS_BUILD_SIGNING="TRUE"
3029 else
3030     AC_MSG_RESULT([no])
3031     WINDOWS_BUILD_SIGNING="FALSE"
3033 AC_SUBST(WINDOWS_BUILD_SIGNING)
3035 dnl ===================================================================
3036 dnl MacOSX build and runtime environment options
3037 dnl ===================================================================
3039 AC_ARG_WITH(macosx-version-min-required,
3040     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3041         [set the minimum OS version needed to run the built LibreOffice])
3042     [
3043                           e. g.: --with-macosx-version-min-required=10.15
3044     ],
3047 dnl ===================================================================
3048 dnl Check for incompatible options set by fuzzing, and reset those
3049 dnl automatically to working combinations
3050 dnl ===================================================================
3052 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3053         "$enable_dbus" != "$enable_avahi"; then
3054     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3055     enable_avahi=$enable_dbus
3058 add_lopath_after ()
3060     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3061         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3062     fi
3065 add_lopath_before ()
3067     local IFS=${P_SEP}
3068     local path_cleanup
3069     local dir
3070     for dir in $LO_PATH ; do
3071         if test "$dir" != "$1" ; then
3072             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3073         fi
3074     done
3075     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3078 dnl ===================================================================
3079 dnl check for required programs (grep, awk, sed, bash)
3080 dnl ===================================================================
3082 pathmunge ()
3084     local new_path
3085     if test -n "$1"; then
3086         if test "$build_os" = "cygwin"; then
3087             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3088                 PathFormat "$1"
3089                 new_path=`cygpath -sm "$formatted_path"`
3090             else
3091                 PathFormat "$1"
3092                 new_path=`cygpath -u "$formatted_path"`
3093             fi
3094         else
3095             new_path="$1"
3096         fi
3097         if test "$2" = "after"; then
3098             add_lopath_after "$new_path"
3099         else
3100             add_lopath_before "$new_path"
3101         fi
3102     fi
3105 AC_PROG_AWK
3106 AC_PATH_PROG( AWK, $AWK)
3107 if test -z "$AWK"; then
3108     AC_MSG_ERROR([install awk to run this script])
3111 AC_PATH_PROG(BASH, bash)
3112 if test -z "$BASH"; then
3113     AC_MSG_ERROR([bash not found in \$PATH])
3115 AC_SUBST(BASH)
3117 # prefer parallel compression tools, if available
3118 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3119 if test -z "$COMPRESSIONTOOL"; then
3120     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3121     if test -z "$COMPRESSIONTOOL"; then
3122         AC_MSG_ERROR([gzip not found in \$PATH])
3123     fi
3125 AC_SUBST(COMPRESSIONTOOL)
3127 AC_MSG_CHECKING([for GNU or BSD tar])
3128 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3129     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3130     if test $? -eq 0;  then
3131         GNUTAR=$a
3132         break
3133     fi
3134 done
3135 AC_MSG_RESULT($GNUTAR)
3136 if test -z "$GNUTAR"; then
3137     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3139 AC_SUBST(GNUTAR)
3141 AC_MSG_CHECKING([for tar's option to strip components])
3142 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3143 if test $? -eq 0; then
3144     STRIP_COMPONENTS="--strip-components"
3145 else
3146     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3147     if test $? -eq 0; then
3148         STRIP_COMPONENTS="--strip-path"
3149     else
3150         STRIP_COMPONENTS="unsupported"
3151     fi
3153 AC_MSG_RESULT($STRIP_COMPONENTS)
3154 if test x$STRIP_COMPONENTS = xunsupported; then
3155     AC_MSG_ERROR([you need a tar that is able to strip components.])
3157 AC_SUBST(STRIP_COMPONENTS)
3159 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3160 dnl desktop OSes from "mobile" ones.
3162 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3163 dnl In other words, that when building for an OS that is not a
3164 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3166 dnl Note the direction of the implication; there is no assumption that
3167 dnl cross-compiling would imply a non-desktop OS.
3169 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3170     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3171     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3172     if test "$_os" != Emscripten; then
3173         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3174     fi
3177 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3178 # also work with the default gtk3 plugin.
3179 if test "$enable_wasm_strip" = "yes"; then
3180     enable_avmedia=no
3181     enable_libcmis=no
3182     enable_coinmp=no
3183     enable_cups=no
3184     test "$_os" = Emscripten && enable_curl=no
3185     enable_database_connectivity=no
3186     enable_dbus=no
3187     enable_dconf=no
3188     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3189     enable_extension_integration=no
3190     enable_extensions=no
3191     enable_extension_update=no
3192     enable_gio=no
3193     enable_gpgmepp=no
3194     enable_ldap=no
3195     enable_lotuswordpro=no
3196     enable_lpsolve=no
3197     enable_nss=no
3198     enable_odk=no
3199     enable_online_update=no
3200     enable_opencl=no
3201     enable_pdfimport=no
3202     enable_randr=no
3203     enable_report_builder=no
3204     enable_scripting=no
3205     enable_sdremote_bluetooth=no
3206     enable_skia=no
3207     enable_xmlhelp=no
3208     enable_zxing=no
3209     test_libepubgen=no
3210     test_libcdr=no
3211     test_libcmis=no
3212     test_libetonyek=no
3213     test_libfreehand=no
3214     test_libmspub=no
3215     test_libpagemaker=no
3216     test_libqxp=no
3217     test_libvisio=no
3218     test_libzmf=no
3219     test_webdav=no
3220     with_galleries=no
3221     with_templates=no
3222     with_webdav=no
3223     with_x=no
3225     test "${with_fonts+set}" = set || with_fonts=yes
3226     test "${with_locales+set}" = set || with_locales=en
3228     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3229     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3230     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3231     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3232 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3233     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3234     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3235     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3236     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3237 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3238     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3239     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3240     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3241     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3242     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3243     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3244     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3245     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3248 # Whether to build "avmedia" functionality or not.
3250 if test "$enable_avmedia" = yes; then
3251     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3252     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3253 else
3254     test_gstreamer_1_0=no
3257 # Decide whether to build database connectivity stuff (including Base) or not.
3258 if test "$enable_database_connectivity" != no; then
3259     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3260     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3261 else
3262     if test "$_os" = iOS; then
3263         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3264     fi
3265     disable_database_connectivity_dependencies
3268 if test -z "$enable_extensions"; then
3269     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3270     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3271         enable_extensions=yes
3272     fi
3275 DISABLE_SCRIPTING=''
3276 if test "$enable_scripting" = yes; then
3277     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3278     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3279 else
3280     DISABLE_SCRIPTING='TRUE'
3281     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3284 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3285     # Disable dynamic_loading always for iOS and Android
3286     enable_dynamic_loading=no
3287 elif test -z "$enable_dynamic_loading"; then
3288     # Otherwise enable it unless specifically disabled
3289     enable_dynamic_loading=yes
3292 DISABLE_DYNLOADING=''
3293 if test "$enable_dynamic_loading" = yes; then
3294     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3295 else
3296     DISABLE_DYNLOADING='TRUE'
3297     if test $_os != iOS -a $_os != Android; then
3298         enable_database_connectivity=no
3299         enable_nss=no
3300         enable_odk=no
3301         enable_python=no
3302         enable_skia=no
3303         with_java=no
3304     fi
3306 AC_SUBST(DISABLE_DYNLOADING)
3308 ENABLE_CUSTOMTARGET_COMPONENTS=
3309 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3310     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3311     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3312         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3313     fi
3315 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3317 if test "$enable_extensions" = yes; then
3318     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3319     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3320 else
3321     enable_extension_integration=no
3322     enable_extension_update=no
3325 # remember SYSBASE value
3326 AC_SUBST(SYSBASE)
3328 dnl ===================================================================
3329 dnl  Sort out various gallery compilation options
3330 dnl ===================================================================
3331 WITH_GALLERY_BUILD=TRUE
3332 AC_MSG_CHECKING([how to build and package galleries])
3333 if test -n "${with_galleries}"; then
3334     if test "$with_galleries" = "build"; then
3335         if test "$enable_database_connectivity" = no; then
3336             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3337         fi
3338         AC_MSG_RESULT([build from source images internally])
3339     elif test "$with_galleries" = "no"; then
3340         WITH_GALLERY_BUILD=
3341         AC_MSG_RESULT([disable non-internal gallery build])
3342     else
3343         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3344     fi
3345 else
3346     if test $_os != iOS -a $_os != Android; then
3347         AC_MSG_RESULT([internal src images for desktop])
3348     else
3349         WITH_GALLERY_BUILD=
3350         AC_MSG_RESULT([disable src image build])
3351     fi
3353 AC_SUBST(WITH_GALLERY_BUILD)
3355 dnl ===================================================================
3356 dnl  Sort out various templates compilation options
3357 dnl ===================================================================
3358 WITH_TEMPLATES=TRUE
3359 AC_MSG_CHECKING([build with or without template files])
3360 if test -n "${with_templates}"; then
3361     if test "$with_templates" = "yes"; then
3362         AC_MSG_RESULT([enable all templates])
3363     elif test "$with_templates" = "no"; then
3364         WITH_TEMPLATES=
3365         AC_MSG_RESULT([disable non-internal templates])
3366     else
3367         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3368     fi
3369 else
3370     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3371         AC_MSG_RESULT([enable all templates])
3372     else
3373         WITH_TEMPLATES=
3374         AC_MSG_RESULT([disable non-internal templates])
3375     fi
3377 AC_SUBST(WITH_TEMPLATES)
3379 dnl ===================================================================
3380 dnl  Checks if ccache is available
3381 dnl ===================================================================
3382 CCACHE_DEPEND_MODE=
3383 if test "$enable_ccache" = "no"; then
3384     CCACHE=""
3385 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3386     case "%$CC%$CXX%" in
3387     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3388     # assume that's good then
3389     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3390         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3391         CCACHE_DEPEND_MODE=1
3392         ;;
3393     *)
3394         # try to use our own ccache if it is available and CCACHE was not already defined
3395         if test -z "$CCACHE"; then
3396             if test "$_os" = "WINNT"; then
3397                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3398             fi
3399             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3400                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3401             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3402                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3403             fi
3404         fi
3405         AC_PATH_PROG([CCACHE],[ccache],[not found])
3406         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3407             CCACHE=`win_short_path_for_make "$CCACHE"`
3408             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3409             rm -f conftest.txt
3410             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3411             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3412             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3413                 AC_MSG_RESULT(yes)
3414             else
3415                 AC_MSG_RESULT(no)
3416                 CCACHE="not found"
3417             fi
3418             rm -f conftest.txt
3419         fi
3420         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3421             # on windows/VC perhaps sccache is around?
3422             case "%$CC%$CXX%" in
3423             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3424             # assume that's good then
3425             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3426                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3427                 CCACHE_DEPEND_MODE=1
3428                 SCCACHE=1
3429                 ;;
3430             *)
3431                 # for sharing code below, reuse CCACHE env var
3432                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3433                 if test "$CCACHE" != "not found"; then
3434                     CCACHE=`win_short_path_for_make "$CCACHE"`
3435                     SCCACHE=1
3436                     CCACHE_DEPEND_MODE=1
3437                 fi
3438                 ;;
3439             esac
3440         fi
3441         if test "$CCACHE" = "not found"; then
3442             CCACHE=""
3443         fi
3444         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3445             CCACHE_DEPEND_MODE=1
3446             # Need to check for ccache version: otherwise prevents
3447             # caching of the results (like "-x objective-c++" for Mac)
3448             if test $_os = Darwin -o $_os = iOS; then
3449                 # Check ccache version
3450                 AC_MSG_CHECKING([whether version of ccache is suitable])
3451                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3452                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3453                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3454                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3455                 else
3456                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3457                     CCACHE=""
3458                     CCACHE_DEPEND_MODE=
3459                 fi
3460             fi
3461         fi
3462         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3463             AC_MSG_ERROR([No suitable ccache found])
3464         fi
3465         ;;
3466     esac
3467 else
3468     CCACHE=""
3470 if test "$enable_ccache" = "nodepend"; then
3471     CCACHE_DEPEND_MODE=""
3473 AC_SUBST(CCACHE_DEPEND_MODE)
3475 # sccache defaults are good enough
3476 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3477     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3478     # or (...) max_size = 20.0 G
3479     # -p works with both 4.2 and 4.4
3480     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3481     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3482     if test "$ccache_size" = ""; then
3483         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3484         if test "$ccache_size" = ""; then
3485             ccache_size=0
3486         fi
3487         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3488         if test $ccache_size -lt 1024; then
3489             CCACHE=""
3490             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3491             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3492         else
3493             # warn that ccache may be too small for debug build
3494             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3495             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3496         fi
3497     else
3498         if test $ccache_size -lt 5; then
3499             #warn that ccache may be too small for debug build
3500             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3501             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3502         fi
3503     fi
3506 ENABLE_Z7_DEBUG=
3507 if test "$enable_z7_debug" != no; then
3508     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3509         ENABLE_Z7_DEBUG=TRUE
3510     fi
3511 else
3512     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3513     add_warning "ccache will not work with --disable-z7-debug"
3515 AC_SUBST(ENABLE_Z7_DEBUG)
3517 dnl ===================================================================
3518 dnl  Checks for C compiler,
3519 dnl  The check for the C++ compiler is later on.
3520 dnl ===================================================================
3521 if test "$_os" != "WINNT"; then
3522     GCC_HOME_SET="true"
3523     AC_MSG_CHECKING([gcc home])
3524     if test -z "$with_gcc_home"; then
3525         if test "$enable_icecream" = "yes"; then
3526             if test -d "/usr/lib/icecc/bin"; then
3527                 GCC_HOME="/usr/lib/icecc/"
3528             elif test -d "/usr/libexec/icecc/bin"; then
3529                 GCC_HOME="/usr/libexec/icecc/"
3530             elif test -d "/opt/icecream/bin"; then
3531                 GCC_HOME="/opt/icecream/"
3532             else
3533                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3535             fi
3536         else
3537             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3538             GCC_HOME_SET="false"
3539         fi
3540     else
3541         GCC_HOME="$with_gcc_home"
3542     fi
3543     AC_MSG_RESULT($GCC_HOME)
3544     AC_SUBST(GCC_HOME)
3546     if test "$GCC_HOME_SET" = "true"; then
3547         if test -z "$CC"; then
3548             CC="$GCC_HOME/bin/gcc"
3549             CC_BASE="gcc"
3550         fi
3551         if test -z "$CXX"; then
3552             CXX="$GCC_HOME/bin/g++"
3553             CXX_BASE="g++"
3554         fi
3555     fi
3558 COMPATH=`dirname "$CC"`
3559 if test "$COMPATH" = "."; then
3560     AC_PATH_PROGS(COMPATH, $CC)
3561     dnl double square bracket to get single because of M4 quote...
3562     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3564 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3566 dnl ===================================================================
3567 dnl Java support
3568 dnl ===================================================================
3569 AC_MSG_CHECKING([whether to build with Java support])
3570 javacompiler="javac"
3571 javadoc="javadoc"
3572 if test "$with_java" != "no"; then
3573     if test "$DISABLE_SCRIPTING" = TRUE; then
3574         AC_MSG_RESULT([no, overridden by --disable-scripting])
3575         ENABLE_JAVA=""
3576         with_java=no
3577     else
3578         AC_MSG_RESULT([yes])
3579         ENABLE_JAVA="TRUE"
3580         AC_DEFINE(HAVE_FEATURE_JAVA)
3581     fi
3582 else
3583     AC_MSG_RESULT([no])
3584     ENABLE_JAVA=""
3587 AC_SUBST(ENABLE_JAVA)
3589 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3591 dnl ENABLE_JAVA="" indicate no Java support at all
3593 dnl ===================================================================
3594 dnl Check macOS SDK and compiler
3595 dnl ===================================================================
3597 if test $_os = Darwin; then
3599     # The SDK in the currently selected Xcode should be found.
3601     AC_MSG_CHECKING([what macOS SDK to use])
3602     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3603     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3604     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3605     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3606     # problems that existed in the PPC days with target versions not being respected or random
3607     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3608     # SDK version is enough, no need to do both...
3609     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3610     if test ! -d "$MACOSX_SDK_PATH"; then
3611         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3612     fi
3613     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3614     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3615     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3616     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3617     # 10.10.2 is 101002
3618     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3619     # correct version in case such an old SDK is specified, it will be rejected later anyway
3620     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3621     if test $MACOSX_SDK_VERSION -lt 101500; then
3622         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3623     fi
3624     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3625         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3626     fi
3627     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3629     AC_MSG_CHECKING([what minimum version of macOS to require])
3630     if test "$with_macosx_version_min_required" = "" ; then
3631         if test "$host_cpu" = x86_64; then
3632             with_macosx_version_min_required="10.15";
3633         else
3634             with_macosx_version_min_required="11.0";
3635         fi
3636     fi
3637     # see same notes about MACOSX_SDK_VERSION above
3638     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3639     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3640         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3641     fi
3642     AC_MSG_RESULT([$with_macosx_version_min_required])
3644     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3645     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3646         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3647     else
3648         AC_MSG_RESULT([yes])
3649     fi
3651     # export this so that "xcrun" invocations later return matching values
3652     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3653     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3654     export DEVELOPER_DIR
3655     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3656     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3658     AC_MSG_CHECKING([whether Xcode is new enough])
3659     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3660     my_xcode_ver2=${my_xcode_ver1#Xcode }
3661     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3662     if test "$my_xcode_ver3" -ge 1205; then
3663         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3664         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3665             if test "$my_xcode_ver3" -eq 1500; then
3666                 dnl the bug was aleady fixed on 15.1 and 15.2 still has the same OS requirements as 15.0
3667                 dnl in other words all affected users could update to a working Xcode version
3668                 AC_MSG_WARN([Use a current version of XCode or bump the minimum deployment target])
3669                 AC_MSG_WARN([[see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking]])
3670                 AC_MSG_ERROR([Xcode 15.0 has a bug in the new linker that causes runtime crashes on macOS 11 - aborting])
3671             fi
3672         fi
3673     else
3674         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3675     fi
3677     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3678     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3680     LIBTOOL=/usr/bin/libtool
3681     INSTALL_NAME_TOOL=install_name_tool
3682     if test -z "$save_CC"; then
3683         stdlib=-stdlib=libc++
3685         AC_MSG_CHECKING([what C compiler to use])
3686         CC="`xcrun -find clang`"
3687         CC_BASE=`first_arg_basename "$CC"`
3688         if test "$host_cpu" = x86_64; then
3689             CC+=" -target x86_64-apple-macos"
3690         else
3691             CC+=" -target arm64-apple-macos"
3692         fi
3693         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3694         AC_MSG_RESULT([$CC])
3696         AC_MSG_CHECKING([what C++ compiler to use])
3697         CXX="`xcrun -find clang++`"
3698         CXX_BASE=`first_arg_basename "$CXX"`
3699         if test "$host_cpu" = x86_64; then
3700             CXX+=" -target x86_64-apple-macos"
3701         else
3702             CXX+=" -target arm64-apple-macos"
3703         fi
3704         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3705         AC_MSG_RESULT([$CXX])
3707         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3708         AR=`xcrun -find ar`
3709         NM=`xcrun -find nm`
3710         STRIP=`xcrun -find strip`
3711         LIBTOOL=`xcrun -find libtool`
3712         RANLIB=`xcrun -find ranlib`
3713     fi
3715     AC_MSG_CHECKING([whether to do code signing])
3717     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3718         AC_MSG_RESULT([no])
3719     else
3720         if test "$enable_macosx_code_signing" = yes; then
3721             # By default use the first suitable certificate (?).
3723             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3724             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3725             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3726             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3727             # "Developer ID Application" one.
3728             identity="Developer ID Application:"
3729         else
3730             identity=$enable_macosx_code_signing
3731         fi
3732         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3733         if test -n "$identity"; then
3734             MACOSX_CODESIGNING_IDENTITY=$identity
3735             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3736             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3737         else
3738             AC_MSG_ERROR([cannot determine identity to use])
3739         fi
3740     fi
3742     AC_MSG_CHECKING([whether to create a Mac App Store package])
3744     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3745         AC_MSG_RESULT([no])
3746     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3747         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3748     else
3749         if test "$enable_macosx_package_signing" = yes; then
3750             # By default use the first suitable certificate.
3751             # It should be a "3rd Party Mac Developer Installer" one
3752             identity="3rd Party Mac Developer Installer:"
3753         else
3754             identity=$enable_macosx_package_signing
3755         fi
3756         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3757         if test -n "$identity"; then
3758             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3759             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3760             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3761         else
3762             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3763         fi
3764     fi
3766     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3767         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3768     fi
3770     AC_MSG_CHECKING([whether to sandbox the application])
3772     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3773         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3774     elif test "$enable_macosx_sandbox" = yes; then
3775         ENABLE_MACOSX_SANDBOX=TRUE
3776         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3777         AC_MSG_RESULT([yes])
3778     else
3779         AC_MSG_RESULT([no])
3780     fi
3782     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3783     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3784     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3786     if test -n "$with_macosx_provisioning_profile" ; then
3787         if test ! -f "$with_macosx_provisioning_profile"; then
3788             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3789         else
3790             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3791             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3792                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3793                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3794                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3795         fi
3796     fi
3798 AC_SUBST(MACOSX_SDK_PATH)
3799 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3800 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3801 AC_SUBST(INSTALL_NAME_TOOL)
3802 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3803 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3804 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3805 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3806 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3807 AC_SUBST(MACOSX_PROVISIONING_INFO)
3808 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3809 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3810 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3812 dnl ===================================================================
3813 dnl Check iOS SDK and compiler
3814 dnl ===================================================================
3816 if test $_os = iOS; then
3817     AC_MSG_CHECKING([what iOS SDK to use])
3819     if test "$enable_ios_simulator" = "yes"; then
3820         platformlc=iphonesimulator
3821         versionmin=-mios-simulator-version-min=14.5
3822     else
3823         platformlc=iphoneos
3824         versionmin=-miphoneos-version-min=14.5
3825     fi
3827     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3829     if ! test -d "$sysroot"; then
3830         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3831     fi
3833     AC_MSG_RESULT($sysroot)
3835     stdlib="-stdlib=libc++"
3837     AC_MSG_CHECKING([what C compiler to use])
3838     CC="`xcrun -find clang`"
3839     CC_BASE=`first_arg_basename "$CC"`
3840     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3841     AC_MSG_RESULT([$CC])
3843     AC_MSG_CHECKING([what C++ compiler to use])
3844     CXX="`xcrun -find clang++`"
3845     CXX_BASE=`first_arg_basename "$CXX"`
3846     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3847     AC_MSG_RESULT([$CXX])
3849     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3850     AR=`xcrun -find ar`
3851     NM=`xcrun -find nm`
3852     STRIP=`xcrun -find strip`
3853     LIBTOOL=`xcrun -find libtool`
3854     RANLIB=`xcrun -find ranlib`
3857 AC_MSG_CHECKING([whether to treat the installation as read-only])
3859 if test $_os = Darwin; then
3860     enable_readonly_installset=yes
3861 elif test "$enable_extensions" != yes; then
3862     enable_readonly_installset=yes
3864 if test "$enable_readonly_installset" = yes; then
3865     AC_MSG_RESULT([yes])
3866     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3867 else
3868     AC_MSG_RESULT([no])
3871 dnl ===================================================================
3872 dnl Structure of install set
3873 dnl ===================================================================
3875 if test $_os = Darwin; then
3876     LIBO_BIN_FOLDER=MacOS
3877     LIBO_ETC_FOLDER=Resources
3878     LIBO_LIBEXEC_FOLDER=MacOS
3879     LIBO_LIB_FOLDER=Frameworks
3880     LIBO_LIB_PYUNO_FOLDER=Resources
3881     LIBO_SHARE_FOLDER=Resources
3882     LIBO_SHARE_HELP_FOLDER=Resources/help
3883     LIBO_SHARE_JAVA_FOLDER=Resources/java
3884     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3885     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3886     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3887     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3888     LIBO_URE_BIN_FOLDER=MacOS
3889     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3890     LIBO_URE_LIB_FOLDER=Frameworks
3891     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3892     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3893 elif test $_os = WINNT; then
3894     LIBO_BIN_FOLDER=program
3895     LIBO_ETC_FOLDER=program
3896     LIBO_LIBEXEC_FOLDER=program
3897     LIBO_LIB_FOLDER=program
3898     LIBO_LIB_PYUNO_FOLDER=program
3899     LIBO_SHARE_FOLDER=share
3900     LIBO_SHARE_HELP_FOLDER=help
3901     LIBO_SHARE_JAVA_FOLDER=program/classes
3902     LIBO_SHARE_PRESETS_FOLDER=presets
3903     LIBO_SHARE_READMES_FOLDER=readmes
3904     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3905     LIBO_SHARE_SHELL_FOLDER=program/shell
3906     LIBO_URE_BIN_FOLDER=program
3907     LIBO_URE_ETC_FOLDER=program
3908     LIBO_URE_LIB_FOLDER=program
3909     LIBO_URE_MISC_FOLDER=program
3910     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3911 else
3912     LIBO_BIN_FOLDER=program
3913     LIBO_ETC_FOLDER=program
3914     LIBO_LIBEXEC_FOLDER=program
3915     LIBO_LIB_FOLDER=program
3916     LIBO_LIB_PYUNO_FOLDER=program
3917     LIBO_SHARE_FOLDER=share
3918     LIBO_SHARE_HELP_FOLDER=help
3919     LIBO_SHARE_JAVA_FOLDER=program/classes
3920     LIBO_SHARE_PRESETS_FOLDER=presets
3921     LIBO_SHARE_READMES_FOLDER=readmes
3922     if test "$enable_fuzzers" != yes; then
3923         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3924     else
3925         LIBO_SHARE_RESOURCE_FOLDER=resource
3926     fi
3927     LIBO_SHARE_SHELL_FOLDER=program/shell
3928     LIBO_URE_BIN_FOLDER=program
3929     LIBO_URE_ETC_FOLDER=program
3930     LIBO_URE_LIB_FOLDER=program
3931     LIBO_URE_MISC_FOLDER=program
3932     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3934 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3935 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3936 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3937 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3938 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3939 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3940 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3941 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3942 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3943 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3944 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3945 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3946 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3947 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3948 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3949 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3951 # Not all of them needed in config_host.mk, add more if need arises
3952 AC_SUBST(LIBO_BIN_FOLDER)
3953 AC_SUBST(LIBO_ETC_FOLDER)
3954 AC_SUBST(LIBO_LIB_FOLDER)
3955 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3956 AC_SUBST(LIBO_SHARE_FOLDER)
3957 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3958 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3959 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3960 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3961 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3962 AC_SUBST(LIBO_URE_BIN_FOLDER)
3963 AC_SUBST(LIBO_URE_ETC_FOLDER)
3964 AC_SUBST(LIBO_URE_LIB_FOLDER)
3965 AC_SUBST(LIBO_URE_MISC_FOLDER)
3966 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3968 dnl ===================================================================
3969 dnl Windows specific tests and stuff
3970 dnl ===================================================================
3972 reg_get_value()
3974     # Return value: $regvalue
3975     unset regvalue
3977     if test "$build_os" = "wsl"; then
3978         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
3979         return
3980     elif test -n "$WSL_ONLY_AS_HELPER"; then
3981         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
3982         return
3983     fi
3985     local _regentry="/proc/registry${1}/${2}/${3}"
3986     if test -f "$_regentry"; then
3987         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3988         # Registry keys read via /proc/registry* are always \0 terminated!
3989         local _regvalue=$(tr -d '\0' < "$_regentry")
3990         if test $? -eq 0; then
3991             regvalue=$_regvalue
3992         fi
3993     fi
3996 # Get a value from the 32-bit side of the Registry
3997 reg_get_value_32()
3999     reg_get_value "32" "$1" "$2"
4002 # Get a value from the 64-bit side of the Registry
4003 reg_get_value_64()
4005     reg_get_value "64" "$1" "$2"
4008 reg_list_values()
4010     # Return value: $reglist
4011     unset reglist
4013     if test "$build_os" = "wsl"; then
4014         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4015         return
4016     fi
4018     reglist=$(ls "/proc/registry${1}/${2}")
4021 # List values from the 32-bit side of the Registry
4022 reg_list_values_32()
4024     reg_list_values "32" "$1"
4027 # List values from the 64-bit side of the Registry
4028 reg_list_values_64()
4030     reg_list_values "64" "$1"
4033 case "$host_os" in
4034 cygwin*|wsl*)
4035     COM=MSC
4036     OS=WNT
4037     RTL_OS=Windows
4038     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4039         P_SEP=";"
4040     else
4041         P_SEP=:
4042     fi
4043     case "$host_cpu" in
4044     x86_64)
4045         CPUNAME=X86_64
4046         RTL_ARCH=X86_64
4047         PLATFORMID=windows_x86_64
4048         WINDOWS_X64=1
4049         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4050         WIN_HOST_ARCH="x64"
4051         WIN_MULTI_ARCH="x86"
4052         WIN_HOST_BITS=64
4053         ;;
4054     i*86)
4055         CPUNAME=INTEL
4056         RTL_ARCH=x86
4057         PLATFORMID=windows_x86
4058         WIN_HOST_ARCH="x86"
4059         WIN_HOST_BITS=32
4060         WIN_OTHER_ARCH="x64"
4061         ;;
4062     aarch64)
4063         CPUNAME=AARCH64
4064         RTL_ARCH=AARCH64
4065         PLATFORMID=windows_aarch64
4066         WINDOWS_X64=1
4067         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4068         WIN_HOST_ARCH="arm64"
4069         WIN_HOST_BITS=64
4070         with_ucrt_dir=no
4071         ;;
4072     *)
4073         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4074         ;;
4075     esac
4077     case "$build_cpu" in
4078     x86_64) WIN_BUILD_ARCH="x64" ;;
4079     i*86) WIN_BUILD_ARCH="x86" ;;
4080     aarch64) WIN_BUILD_ARCH="arm64" ;;
4081     *)
4082         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4083         ;;
4084     esac
4086     SCPDEFS="$SCPDEFS -D_MSC_VER"
4087     ;;
4088 esac
4090 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4091 # other-arch won't, but wouldn't break the build (x64 on x86).
4092 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4093     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4097 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4098     # To allow building Windows multi-arch releases without cross-tooling
4099     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4100         cross_compiling="yes"
4101     fi
4104 if test "$cross_compiling" = "yes"; then
4105     export CROSS_COMPILING=TRUE
4106     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4107         ENABLE_WASM_STRIP=TRUE
4108     fi
4109     if test "$_os" = "Emscripten"; then
4110         if test "$with_main_module" = "calc"; then
4111             ENABLE_WASM_STRIP_WRITER=TRUE
4112         elif test "$with_main_module" = "writer"; then
4113             ENABLE_WASM_STRIP_CALC=TRUE
4114         fi
4115     fi
4116 else
4117     CROSS_COMPILING=
4118     BUILD_TYPE="$BUILD_TYPE NATIVE"
4120 AC_SUBST(CROSS_COMPILING)
4121 AC_SUBST(ENABLE_WASM_STRIP)
4122 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4123 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4125 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4126 # NOTE: must _not_ be used for bundled external libraries!
4127 ISYSTEM=
4128 if test "$GCC" = "yes"; then
4129     AC_MSG_CHECKING( for -isystem )
4130     save_CFLAGS=$CFLAGS
4131     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4132     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4133     CFLAGS=$save_CFLAGS
4134     if test -n "$ISYSTEM"; then
4135         AC_MSG_RESULT(yes)
4136     else
4137         AC_MSG_RESULT(no)
4138     fi
4140 if test -z "$ISYSTEM"; then
4141     # fall back to using -I
4142     ISYSTEM=-I
4144 AC_SUBST(ISYSTEM)
4146 dnl ===================================================================
4147 dnl  Check which Visual Studio compiler is used
4148 dnl ===================================================================
4150 map_vs_year_to_version()
4152     # Return value: $vsversion
4154     unset vsversion
4156     case $1 in
4157     2019)
4158         vsversion=16;;
4159     2022)
4160         vsversion=17;;
4161     2022preview)
4162         vsversion=17.11;;
4163     *)
4164         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4165     esac
4168 vs_versions_to_check()
4170     # Args: $1 (optional) : versions to check, in the order of preference
4171     # Return value: $vsversions
4173     unset vsversions
4175     if test -n "$1"; then
4176         map_vs_year_to_version "$1"
4177         vsversions=$vsversion
4178     else
4179         # Default version is 2019
4180         vsversions="16"
4181     fi
4184 win_get_env_from_vsdevcmdbat()
4186     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4187     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4188     PathFormat "$VC_PRODUCT_DIR"
4189     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4190     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4191     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4192     local result
4193     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4194         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4195     else
4196         chmod +x $WRAPPERBATCHFILEPATH
4197         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4198     fi
4199     rm -f $WRAPPERBATCHFILEPATH
4200     printf '%s' "$result"
4203 find_ucrt()
4205     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4206     if test -n "$regvalue"; then
4207         PathFormat "$regvalue"
4208         UCRTSDKDIR=$formatted_path_unix
4209         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4210         if test -n "$regvalue"; then
4211             UCRTVERSION="$regvalue".0
4212         fi
4214         # Rest if not exist
4215         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4216           UCRTSDKDIR=
4217         fi
4218     fi
4219     if test -z "$UCRTSDKDIR"; then
4220         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4221         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4222         if test -f "$ide_env_file"; then
4223             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4224             UCRTSDKDIR=$formatted_path_unix
4225             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4226             dnl Hack needed at least by tml:
4227             if test "$UCRTVERSION" = 10.0.15063.0 \
4228                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4229                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4230             then
4231                 UCRTVERSION=10.0.14393.0
4232             fi
4233         else
4234           AC_MSG_ERROR([No UCRT found])
4235         fi
4236     fi
4239 find_msvc()
4241     # Find Visual C++
4242     # Args: $1 (optional) : The VS version year
4243     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4245     unset vctest vctoolset vcnumwithdot vcbuildnumber
4247     vs_versions_to_check "$1"
4248     if test "$build_os" = wsl; then
4249         vswhere="$PROGRAMFILESX86"
4250         if test -z "$vswhere"; then
4251             vswhere="c:\\Program Files (x86)"
4252         fi
4253     elif test -n "$WSL_ONLY_AS_HELPER"; then
4254         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4255     else
4256         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4257     fi
4258     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4259     PathFormat "$vswhere"
4260     vswhere=$formatted_path_unix
4261     for ver in $vsversions; do
4262         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4263         if test -z "$vswhereoutput"; then
4264             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4265         fi
4266         # Fall back to all MS products (this includes VC++ Build Tools)
4267         if ! test -n "$vswhereoutput"; then
4268             AC_MSG_CHECKING([VC++ Build Tools and similar])
4269             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4270         fi
4271         if test -n "$vswhereoutput"; then
4272             PathFormat "$vswhereoutput"
4273             vctest=$formatted_path_unix
4274             break
4275         fi
4276     done
4278     if test -n "$vctest"; then
4279         vcnumwithdot="$ver"
4280         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4281             vcnumwithdot=$vcnumwithdot.0
4282         fi
4283         case "$vcnumwithdot" in
4284         16.0)
4285             vcyear=2019
4286             vctoolset=v142
4287             ;;
4288         17.0 | 17.11)
4289             vcyear=2022
4290             vctoolset=v143
4291             ;;
4292         esac
4293         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4295     fi
4298 test_cl_exe()
4300     AC_MSG_CHECKING([$1 compiler])
4302     CL_EXE_PATH="$2/cl.exe"
4304     if test ! -f "$CL_EXE_PATH"; then
4305         if test "$1" = "multi-arch"; then
4306             AC_MSG_WARN([no compiler (cl.exe) in $2])
4307             return 1
4308         else
4309             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4310         fi
4311     fi
4313     dnl ===========================================================
4314     dnl  Check for the corresponding mspdb*.dll
4315     dnl ===========================================================
4317     # MSVC 15.0 has libraries from 14.0?
4318     mspdbnum="140"
4320     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4321         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4322     fi
4324     # The compiles has to find its shared libraries
4325     OLD_PATH="$PATH"
4326     TEMP_PATH=`cygpath -d "$2"`
4327     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4329     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4330         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4331     fi
4333     PATH="$OLD_PATH"
4335     AC_MSG_RESULT([$CL_EXE_PATH])
4338 SOLARINC=
4339 MSBUILD_PATH=
4340 DEVENV=
4341 if test "$_os" = "WINNT"; then
4342     AC_MSG_CHECKING([Visual C++])
4343     find_msvc "$with_visual_studio"
4344     if test -z "$vctest"; then
4345         if test -n "$with_visual_studio"; then
4346             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4347         else
4348             AC_MSG_ERROR([no Visual Studio installation found])
4349         fi
4350     fi
4351     AC_MSG_RESULT([])
4353     VC_PRODUCT_DIR="$vctest/VC"
4354     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4356     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4357     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4358         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4359         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4360         if test $? -ne 0; then
4361             WIN_MULTI_ARCH=""
4362             WIN_OTHER_ARCH=""
4363         fi
4364     fi
4366     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4367         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4368         test_cl_exe "build" "$MSVC_BUILD_PATH"
4369     fi
4371     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4372         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4373         test_cl_exe "host" "$MSVC_HOST_PATH"
4374     else
4375         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4376     fi
4378     AC_MSG_CHECKING([for short pathname of VC product directory])
4379     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4380     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4382     UCRTSDKDIR=
4383     UCRTVERSION=
4385     AC_MSG_CHECKING([for UCRT location])
4386     find_ucrt
4387     # find_ucrt errors out if it doesn't find it
4388     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4389     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4390     ucrtincpath_formatted=$formatted_path
4391     # SOLARINC is used for external modules and must be set too.
4392     # And no, it's not sufficient to set SOLARINC only, as configure
4393     # itself doesn't honour it.
4394     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4395     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4396     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4397     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4399     AC_SUBST(UCRTSDKDIR)
4400     AC_SUBST(UCRTVERSION)
4402     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4403     # Find the proper version of MSBuild.exe to use based on the VS version
4404     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4405     if test -z "$regvalue" ; then
4406         if test "$WIN_BUILD_ARCH" != "x64"; then
4407             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4408         else
4409             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4410         fi
4411     fi
4412     if test -d "$regvalue" ; then
4413         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4414         AC_MSG_RESULT([$regvalue])
4415     else
4416         AC_MSG_ERROR([MSBuild.exe location not found])
4417     fi
4419     # Find the version of devenv.exe
4420     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4421     DEVENV="$formatted_path"
4422     DEVENV_unix="$formatted_path_unix"
4423     if test ! -e "$DEVENV_unix"; then
4424         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4425     fi
4427     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4428     dnl needed when building CLR code:
4429     if test -z "$MSVC_CXX"; then
4430         # This gives us a posix path with 8.3 filename restrictions
4431         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4432     fi
4434     if test -z "$CC"; then
4435         CC=$MSVC_CXX
4436         CC_BASE=`first_arg_basename "$CC"`
4437     fi
4438     if test -z "$CXX"; then
4439         CXX=$MSVC_CXX
4440         CXX_BASE=`first_arg_basename "$CXX"`
4441     fi
4443     if test -n "$CC"; then
4444         # Remove /cl.exe from CC case insensitive
4445         AC_MSG_NOTICE([found Visual C++ $vcyear])
4447         PathFormat "$COMPATH"
4448         COMPATH="$formatted_path"
4449         COMPATH_unix="$formatted_path_unix"
4450         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4452         VCVER=$vcnumwithdot
4453         VCTOOLSET=$vctoolset
4455         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4456         # are always "better", we list them in reverse chronological order.
4458         case "$vcnumwithdot" in
4459         16.0 | 17.0 | 17.11)
4460             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4461             ;;
4462         esac
4464         # The expectation is that --with-windows-sdk should not need to be used
4465         if test -n "$with_windows_sdk"; then
4466             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4467             *" "$with_windows_sdk" "*)
4468                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4469                 ;;
4470             *)
4471                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4472                 ;;
4473             esac
4474         fi
4476         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4477         ac_objext=obj
4478         ac_exeext=exe
4480     else
4481         AC_MSG_ERROR([Visual C++ not found after all, huh])
4482     fi
4484     # ERROR if VS version < 16.5
4485     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4486     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4487         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4488         // between Visual Studio versions and _MSC_VER:
4489         #if _MSC_VER < 1925
4490         #error
4491         #endif
4492     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4494     # WARN if VS version < 16.10
4495     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4496     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4497         #if _MSC_VER < 1929
4498         #error
4499         #endif
4500     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4502     if test $vs2019_recommended_version = yes; then
4503         AC_MSG_RESULT([yes])
4504     else
4505         AC_MSG_WARN([no])
4506         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."
4507     fi
4509     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4510     # version of the Explorer extension (and maybe other small
4511     # bits, too) needed when installing a 32-bit LibreOffice on a
4512     # 64-bit OS. The 64-bit Explorer extension is a feature that
4513     # has been present since long in OOo. Don't confuse it with
4514     # building LibreOffice itself as 64-bit code.
4516     BUILD_X64=
4517     CXX_X64_BINARY=
4519     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4520         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4521         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4522              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4523         then
4524             BUILD_X64=TRUE
4525             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4526             AC_MSG_RESULT([found])
4527         else
4528             AC_MSG_RESULT([not found])
4529             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4530         fi
4531     elif test "$WIN_HOST_ARCH" = "x64"; then
4532         CXX_X64_BINARY=$CXX
4533     fi
4534     AC_SUBST(BUILD_X64)
4536     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4537     AC_SUBST(CXX_X64_BINARY)
4539     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4540     # needed to support TWAIN scan on both 32- and 64-bit systems
4542     case "$WIN_HOST_ARCH" in
4543     x64)
4544         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4545         if test -n "$CXX_X86_BINARY"; then
4546             BUILD_X86=TRUE
4547             AC_MSG_RESULT([preset])
4548         elif test -n "$WIN_MULTI_ARCH"; then
4549             BUILD_X86=TRUE
4550             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4551             AC_MSG_RESULT([found])
4552         else
4553             AC_MSG_RESULT([not found])
4554             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4555         fi
4556         ;;
4557     x86)
4558         BUILD_X86=TRUE
4559         CXX_X86_BINARY=$MSVC_CXX
4560         ;;
4561     esac
4562     AC_SUBST(BUILD_X86)
4563     AC_SUBST(CXX_X86_BINARY)
4565 AC_SUBST(VCVER)
4566 AC_SUBST(VCTOOLSET)
4567 AC_SUBST(DEVENV)
4568 AC_SUBST(MSVC_CXX)
4570 COM_IS_CLANG=
4571 AC_MSG_CHECKING([whether the compiler is actually Clang])
4572 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4573     #ifndef __clang__
4574     you lose
4575     #endif
4576     int foo=42;
4577     ]])],
4578     [AC_MSG_RESULT([yes])
4579      COM_IS_CLANG=TRUE],
4580     [AC_MSG_RESULT([no])])
4581 AC_SUBST(COM_IS_CLANG)
4583 CLANGVER=
4584 if test "$COM_IS_CLANG" = TRUE; then
4585     AC_MSG_CHECKING([whether Clang is new enough])
4586     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4587         #if !defined __apple_build_version__
4588         #error
4589         #endif
4590         ]])],
4591         [my_apple_clang=yes],[my_apple_clang=])
4592     if test "$my_apple_clang" = yes; then
4593         AC_MSG_RESULT([assumed yes (Apple Clang)])
4594     elif test "$_os" = Emscripten; then
4595         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4596     else
4597         if test "$_os" = WINNT; then
4598             dnl In which case, assume clang-cl:
4599             my_args="/EP /TC"
4600         else
4601             my_args="-E -P"
4602         fi
4603         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4604         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4605         CLANGVER=`echo $clang_version \
4606             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4607         if test "$CLANGVER" -ge 120000; then
4608             AC_MSG_RESULT([yes ($clang_version)])
4609         else
4610             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4611         fi
4612         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4613         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4614     fi
4617 SHOWINCLUDES_PREFIX=
4618 if test "$_os" = WINNT; then
4619     dnl We need to guess the prefix of the -showIncludes output, it can be
4620     dnl localized
4621     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4622     echo "#include <stdlib.h>" > conftest.c
4623     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4624         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4625     rm -f conftest.c conftest.obj
4626     if test -z "$SHOWINCLUDES_PREFIX"; then
4627         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4628     else
4629         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4630     fi
4632 AC_SUBST(SHOWINCLUDES_PREFIX)
4635 # prefix C with ccache if needed
4637 if test "$CCACHE" != ""; then
4638     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4640     AC_LANG_PUSH([C])
4641     save_CFLAGS=$CFLAGS
4642     CFLAGS="$CFLAGS --ccache-skip -O2"
4643     # msvc does not fail on unknown options, check stdout
4644     if test "$COM" = MSC; then
4645         CFLAGS="$CFLAGS -nologo"
4646     fi
4647     save_ac_c_werror_flag=$ac_c_werror_flag
4648     ac_c_werror_flag=yes
4649     dnl an empty program will do, we're checking the compiler flags
4650     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4651                       [use_ccache=yes], [use_ccache=no])
4652     CFLAGS=$save_CFLAGS
4653     ac_c_werror_flag=$save_ac_c_werror_flag
4654     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4655         AC_MSG_RESULT([yes])
4656     else
4657         CC="$CCACHE $CC"
4658         CC_BASE="ccache $CC_BASE"
4659         AC_MSG_RESULT([no])
4660     fi
4661     AC_LANG_POP([C])
4664 # ===================================================================
4665 # check various GCC options that Clang does not support now but maybe
4666 # will somewhen in the future, check them even for GCC, so that the
4667 # flags are set
4668 # ===================================================================
4670 HAVE_GCC_GGDB2=
4671 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4672     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4673     save_CFLAGS=$CFLAGS
4674     CFLAGS="$CFLAGS -Werror -ggdb2"
4675     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4676     CFLAGS=$save_CFLAGS
4677     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4678         AC_MSG_RESULT([yes])
4679     else
4680         AC_MSG_RESULT([no])
4681     fi
4683     if test "$host_cpu" = "m68k"; then
4684         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4685         save_CFLAGS=$CFLAGS
4686         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4687         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4688         CFLAGS=$save_CFLAGS
4689         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4690             AC_MSG_RESULT([yes])
4691         else
4692             AC_MSG_ERROR([no])
4693         fi
4694     fi
4696 AC_SUBST(HAVE_GCC_GGDB2)
4698 dnl ===================================================================
4699 dnl  Test the gcc version
4700 dnl ===================================================================
4701 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4702     AC_MSG_CHECKING([the GCC version])
4703     _gcc_version=`$CC -dumpfullversion`
4704     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4705         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4706     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4708     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4710     if test "$gcc_full_version" -lt 120000; then
4711         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4712     fi
4713 else
4714     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4715     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4716     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4717     # (which reports itself as GCC 4.2.1).
4718     GCC_VERSION=
4720 AC_SUBST(GCC_VERSION)
4722 dnl Set the ENABLE_DBGUTIL variable
4723 dnl ===================================================================
4724 AC_MSG_CHECKING([whether to build with additional debug utilities])
4725 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4726     ENABLE_DBGUTIL="TRUE"
4727     # this is an extra var so it can have different default on different MSVC
4728     # versions (in case there are version specific problems with it)
4729     MSVC_USE_DEBUG_RUNTIME="TRUE"
4731     AC_MSG_RESULT([yes])
4732     # cppunit and graphite expose STL in public headers
4733     if test "$with_system_cppunit" = "yes"; then
4734         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4735     else
4736         with_system_cppunit=no
4737     fi
4738     if test "$with_system_graphite" = "yes"; then
4739         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4740     else
4741         with_system_graphite=no
4742     fi
4743     if test "$with_system_orcus" = "yes"; then
4744         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4745     else
4746         with_system_orcus=no
4747     fi
4748     if test "$with_system_libcmis" = "yes"; then
4749         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4750     else
4751         with_system_libcmis=no
4752     fi
4753     if test "$with_system_hunspell" = "yes"; then
4754         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4755     else
4756         with_system_hunspell=no
4757     fi
4758     if test "$with_system_gpgmepp" = "yes"; then
4759         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4760     else
4761         with_system_gpgmepp=no
4762     fi
4763     if test "$with_system_zxing" = "yes"; then
4764         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4765     else
4766         with_system_zxing=no
4767     fi
4768     if test "$with_system_poppler" = "yes"; then
4769         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4770     else
4771         with_system_poppler=no
4772     fi
4773     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4774     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4775     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4776     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4777     # of those two is using the system variant:
4778     if test "$with_system_libnumbertext" = "yes"; then
4779         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4780     else
4781         with_system_libnumbertext=no
4782     fi
4783     if test "$with_system_libwps" = "yes"; then
4784         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4785     else
4786         with_system_libwps=no
4787     fi
4788 else
4789     ENABLE_DBGUTIL=""
4790     MSVC_USE_DEBUG_RUNTIME=""
4791     AC_MSG_RESULT([no])
4793 AC_SUBST(ENABLE_DBGUTIL)
4794 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4796 dnl Set the ENABLE_DEBUG variable.
4797 dnl ===================================================================
4798 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4799     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4801 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4802     if test -z "$libo_fuzzed_enable_debug"; then
4803         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4804     else
4805         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4806         enable_debug=yes
4807     fi
4810 AC_MSG_CHECKING([whether to do a debug build])
4811 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4812     ENABLE_DEBUG="TRUE"
4813     if test -n "$ENABLE_DBGUTIL" ; then
4814         AC_MSG_RESULT([yes (dbgutil)])
4815     else
4816         AC_MSG_RESULT([yes])
4817     fi
4818 else
4819     ENABLE_DEBUG=""
4820     AC_MSG_RESULT([no])
4822 AC_SUBST(ENABLE_DEBUG)
4824 dnl ===================================================================
4825 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4826 dnl This is done only after compiler checks (need to know if Clang is
4827 dnl used, for different defaults) and after checking if a debug build
4828 dnl is wanted (non-debug builds get the default linker if not explicitly
4829 dnl specified otherwise).
4830 dnl All checks for linker features/options should come after this.
4831 dnl ===================================================================
4832 check_use_ld()
4834     use_ld=-fuse-ld=${1%%:*}
4835     use_ld_path=${1#*:}
4836     if test "$use_ld_path" != "$1"; then
4837         if test "$COM_IS_CLANG" = TRUE; then
4838             if test "$CLANGVER" -ge 120000; then
4839                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4840             else
4841                 use_ld="-fuse-ld=${use_ld_path}"
4842             fi
4843         else
4844             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4845             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4846             # pickup the alternative linker, when called by libtool for linking.
4847             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4848             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4849         fi
4850     fi
4851     use_ld_fail_if_error=$2
4852     use_ld_ok=
4853     AC_MSG_CHECKING([for $use_ld linker support])
4854     use_ld_ldflags_save="$LDFLAGS"
4855     LDFLAGS="$LDFLAGS $use_ld"
4856     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4857 #include <stdio.h>
4858         ],[
4859 printf ("hello world\n");
4860         ])], USE_LD=$use_ld, [])
4861     if test -n "$USE_LD"; then
4862         AC_MSG_RESULT( yes )
4863         use_ld_ok=yes
4864     else
4865         if test -n "$use_ld_fail_if_error"; then
4866             AC_MSG_ERROR( no )
4867         else
4868             AC_MSG_RESULT( no )
4869         fi
4870     fi
4871     if test -n "$use_ld_ok"; then
4872         dnl keep the value of LDFLAGS
4873         return 0
4874     fi
4875     LDFLAGS="$use_ld_ldflags_save"
4876     return 1
4878 USE_LD=
4879 if test "$enable_ld" != "no"; then
4880     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4881         if test -n "$enable_ld"; then
4882             check_use_ld "$enable_ld" fail_if_error
4883         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4884             dnl non-debug builds default to the default linker
4885             true
4886         elif test -n "$COM_IS_CLANG"; then
4887             check_use_ld lld
4888             if test $? -ne 0; then
4889                 check_use_ld gold
4890                 if test $? -ne 0; then
4891                     check_use_ld mold
4892                 fi
4893             fi
4894         else
4895             # For gcc first try gold, new versions also support lld/mold.
4896             check_use_ld gold
4897             if test $? -ne 0; then
4898                 check_use_ld lld
4899                 if test $? -ne 0; then
4900                     check_use_ld mold
4901                 fi
4902             fi
4903         fi
4904         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4905         rm conftest.out
4906         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4907         if test -z "$ld_used"; then
4908             ld_used="unknown"
4909         fi
4910         AC_MSG_CHECKING([for linker that is used])
4911         AC_MSG_RESULT([$ld_used])
4912         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4913             if echo "$ld_used" | grep -q "^GNU ld"; then
4914                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4915                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4916             fi
4917         fi
4918     else
4919         if test "$enable_ld" = "yes"; then
4920             AC_MSG_ERROR([--enable-ld not supported])
4921         fi
4922     fi
4924 AC_SUBST(USE_LD)
4925 AC_SUBST(LD)
4927 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4928 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4929     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4930     bsymbolic_functions_ldflags_save=$LDFLAGS
4931     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4932     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4933 #include <stdio.h>
4934         ],[
4935 printf ("hello world\n");
4936         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4937     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4938         AC_MSG_RESULT( found )
4939     else
4940         AC_MSG_RESULT( not found )
4941     fi
4942     LDFLAGS=$bsymbolic_functions_ldflags_save
4944 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4946 LD_GC_SECTIONS=
4947 if test "$GCC" = "yes"; then
4948     for flag in "--gc-sections" "-dead_strip"; do
4949         AC_MSG_CHECKING([for $flag linker support])
4950         ldflags_save=$LDFLAGS
4951         LDFLAGS="$LDFLAGS -Wl,$flag"
4952         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4953 #include <stdio.h>
4954             ],[
4955 printf ("hello world\n");
4956             ])],[
4957             LD_GC_SECTIONS="-Wl,$flag"
4958             AC_MSG_RESULT( found )
4959             ], [
4960             AC_MSG_RESULT( not found )
4961             ])
4962         LDFLAGS=$ldflags_save
4963         if test -n "$LD_GC_SECTIONS"; then
4964             break
4965         fi
4966     done
4968 AC_SUBST(LD_GC_SECTIONS)
4970 HAVE_EXTERNAL_DWARF=
4971 if test "$enable_split_debug" != no; then
4972     use_split_debug=
4973     if test -n "$ENABLE_LTO"; then
4974         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4975     elif test "$enable_split_debug" = yes; then
4976         use_split_debug=1
4977     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4978     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4979         use_split_debug=1
4980     fi
4981     if test -n "$use_split_debug"; then
4982         if test "$_os" = "Emscripten"; then
4983             TEST_CC_FLAG=-gsplit-dwarf -gpubnames
4984         else
4985             TEST_CC_FLAG=-gsplit-dwarf
4986         fi
4987         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4988         save_CFLAGS=$CFLAGS
4989         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4990         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4991         CFLAGS=$save_CFLAGS
4992         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4993             AC_MSG_RESULT([yes])
4994         else
4995             if test "$enable_split_debug" = yes; then
4996                 AC_MSG_ERROR([no])
4997             else
4998                 AC_MSG_RESULT([no])
4999             fi
5000         fi
5001     fi
5002     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5003         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5004         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5005     fi
5007 AC_SUBST(HAVE_EXTERNAL_DWARF)
5009 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5010 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5011 save_CFLAGS=$CFLAGS
5012 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5013 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5014 CFLAGS=$save_CFLAGS
5015 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5016     AC_MSG_RESULT([yes])
5017 else
5018     AC_MSG_RESULT([no])
5020 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5022 ENABLE_GDB_INDEX=
5023 if test "$enable_gdb_index" != "no"; then
5024     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5025     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5026         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5027         save_CFLAGS=$CFLAGS
5028         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5029         have_ggnu_pubnames=
5030         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5031         if test "$have_ggnu_pubnames" != "TRUE"; then
5032             if test "$enable_gdb_index" = "yes"; then
5033                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5034             else
5035                 AC_MSG_RESULT( no )
5036             fi
5037         else
5038             AC_MSG_RESULT( yes )
5039             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5040             ldflags_save=$LDFLAGS
5041             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5042             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5043 #include <stdio.h>
5044                 ],[
5045 printf ("hello world\n");
5046                 ])], ENABLE_GDB_INDEX=TRUE, [])
5047             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5048                 AC_MSG_RESULT( yes )
5049             else
5050                 if test "$enable_gdb_index" = "yes"; then
5051                     AC_MSG_ERROR( no )
5052                 else
5053                     AC_MSG_RESULT( no )
5054                 fi
5055             fi
5056             LDFLAGS=$ldflags_save
5057         fi
5058         CFLAGS=$save_CFLAGS
5059         fi
5060     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5061         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5062         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5063     fi
5065 AC_SUBST(ENABLE_GDB_INDEX)
5067 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5068     enable_sal_log=yes
5070 if test "$enable_sal_log" = yes; then
5071     ENABLE_SAL_LOG=TRUE
5073 AC_SUBST(ENABLE_SAL_LOG)
5075 dnl Check for enable symbols option
5076 dnl ===================================================================
5077 AC_MSG_CHECKING([whether to generate debug information])
5078 if test -z "$enable_symbols"; then
5079     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5080         enable_symbols=yes
5081     else
5082         enable_symbols=no
5083     fi
5085 if test "$enable_symbols" = yes; then
5086     ENABLE_SYMBOLS_FOR=all
5087     AC_MSG_RESULT([yes])
5088 elif test "$enable_symbols" = no; then
5089     ENABLE_SYMBOLS_FOR=
5090     AC_MSG_RESULT([no])
5091 else
5092     # Selective debuginfo.
5093     ENABLE_SYMBOLS_FOR="$enable_symbols"
5094     AC_MSG_RESULT([for "$enable_symbols"])
5096 AC_SUBST(ENABLE_SYMBOLS_FOR)
5098 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5099     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5100     AC_MSG_CHECKING([whether enough memory is available for linking])
5101     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5102     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5103     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5104         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5105     else
5106         AC_MSG_RESULT([yes])
5107     fi
5110 ENABLE_OPTIMIZED=
5111 ENABLE_OPTIMIZED_DEBUG=
5112 AC_MSG_CHECKING([whether to compile with optimization flags])
5113 if test -z "$enable_optimized"; then
5114     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5115         enable_optimized=no
5116     else
5117         enable_optimized=yes
5118     fi
5120 if test "$enable_optimized" = yes; then
5121     ENABLE_OPTIMIZED=TRUE
5122     AC_MSG_RESULT([yes])
5123 elif test "$enable_optimized" = debug; then
5124     ENABLE_OPTIMIZED_DEBUG=TRUE
5125     AC_MSG_RESULT([yes (debug)])
5126     HAVE_GCC_OG=
5127     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5128         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5129         save_CFLAGS=$CFLAGS
5130         CFLAGS="$CFLAGS -Werror -Og"
5131         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5132         CFLAGS=$save_CFLAGS
5133         if test "$HAVE_GCC_OG" = "TRUE"; then
5134             AC_MSG_RESULT([yes])
5135         else
5136             AC_MSG_RESULT([no])
5137         fi
5138     fi
5139     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5140         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5141     fi
5142 else
5143     AC_MSG_RESULT([no])
5145 AC_SUBST(ENABLE_OPTIMIZED)
5146 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5149 # determine CPUNAME, OS, ...
5151 case "$host_os" in
5153 cygwin*|wsl*)
5154     # Already handled
5155     ;;
5157 darwin*)
5158     COM=GCC
5159     OS=MACOSX
5160     RTL_OS=MacOSX
5161     P_SEP=:
5163     case "$host_cpu" in
5164     aarch64|arm64)
5165         if test "$enable_ios_simulator" = "yes"; then
5166             OS=iOS
5167         else
5168             CPUNAME=AARCH64
5169             RTL_ARCH=AARCH64
5170             PLATFORMID=macosx_aarch64
5171         fi
5172         ;;
5173     x86_64)
5174         if test "$enable_ios_simulator" = "yes"; then
5175             OS=iOS
5176         fi
5177         CPUNAME=X86_64
5178         RTL_ARCH=X86_64
5179         PLATFORMID=macosx_x86_64
5180         ;;
5181     *)
5182         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5183         ;;
5184     esac
5185     ;;
5187 ios*)
5188     COM=GCC
5189     OS=iOS
5190     RTL_OS=iOS
5191     P_SEP=:
5193     case "$host_cpu" in
5194     aarch64|arm64)
5195         if test "$enable_ios_simulator" = "yes"; then
5196             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5197         fi
5198         ;;
5199     *)
5200         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5201         ;;
5202     esac
5203     CPUNAME=AARCH64
5204     RTL_ARCH=AARCH64
5205     PLATFORMID=ios_arm64
5206     ;;
5208 dragonfly*)
5209     COM=GCC
5210     OS=DRAGONFLY
5211     RTL_OS=DragonFly
5212     P_SEP=:
5214     case "$host_cpu" in
5215     i*86)
5216         CPUNAME=INTEL
5217         RTL_ARCH=x86
5218         PLATFORMID=dragonfly_x86
5219         ;;
5220     x86_64)
5221         CPUNAME=X86_64
5222         RTL_ARCH=X86_64
5223         PLATFORMID=dragonfly_x86_64
5224         ;;
5225     *)
5226         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5227         ;;
5228     esac
5229     ;;
5231 freebsd*)
5232     COM=GCC
5233     RTL_OS=FreeBSD
5234     OS=FREEBSD
5235     P_SEP=:
5237     case "$host_cpu" in
5238     aarch64)
5239         CPUNAME=AARCH64
5240         PLATFORMID=freebsd_aarch64
5241         RTL_ARCH=AARCH64
5242         ;;
5243     i*86)
5244         CPUNAME=INTEL
5245         RTL_ARCH=x86
5246         PLATFORMID=freebsd_x86
5247         ;;
5248     x86_64|amd64)
5249         CPUNAME=X86_64
5250         RTL_ARCH=X86_64
5251         PLATFORMID=freebsd_x86_64
5252         ;;
5253     powerpc64)
5254         CPUNAME=POWERPC64
5255         RTL_ARCH=PowerPC_64
5256         PLATFORMID=freebsd_powerpc64
5257         ;;
5258     powerpc|powerpcspe)
5259         CPUNAME=POWERPC
5260         RTL_ARCH=PowerPC
5261         PLATFORMID=freebsd_powerpc
5262         ;;
5263     *)
5264         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5265         ;;
5266     esac
5267     ;;
5269 haiku*)
5270     COM=GCC
5271     GUIBASE=haiku
5272     RTL_OS=Haiku
5273     OS=HAIKU
5274     P_SEP=:
5276     case "$host_cpu" in
5277     i*86)
5278         CPUNAME=INTEL
5279         RTL_ARCH=x86
5280         PLATFORMID=haiku_x86
5281         ;;
5282     x86_64|amd64)
5283         CPUNAME=X86_64
5284         RTL_ARCH=X86_64
5285         PLATFORMID=haiku_x86_64
5286         ;;
5287     *)
5288         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5289         ;;
5290     esac
5291     ;;
5293 kfreebsd*)
5294     COM=GCC
5295     OS=LINUX
5296     RTL_OS=kFreeBSD
5297     P_SEP=:
5299     case "$host_cpu" in
5301     i*86)
5302         CPUNAME=INTEL
5303         RTL_ARCH=x86
5304         PLATFORMID=kfreebsd_x86
5305         ;;
5306     x86_64)
5307         CPUNAME=X86_64
5308         RTL_ARCH=X86_64
5309         PLATFORMID=kfreebsd_x86_64
5310         ;;
5311     *)
5312         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5313         ;;
5314     esac
5315     ;;
5317 linux-gnu*|linux-musl*)
5318     COM=GCC
5319     OS=LINUX
5320     RTL_OS=Linux
5321     P_SEP=:
5323     case "$host_cpu" in
5325     aarch64)
5326         CPUNAME=AARCH64
5327         PLATFORMID=linux_aarch64
5328         RTL_ARCH=AARCH64
5329         EPM_FLAGS="-a arm64"
5330         ;;
5331     alpha)
5332         CPUNAME=AXP
5333         RTL_ARCH=ALPHA
5334         PLATFORMID=linux_alpha
5335         ;;
5336     arm*)
5337         CPUNAME=ARM
5338         EPM_FLAGS="-a arm"
5339         RTL_ARCH=ARM_EABI
5340         PLATFORMID=linux_arm_eabi
5341         case "$host_cpu" in
5342         arm*-linux)
5343             RTL_ARCH=ARM_OABI
5344             PLATFORMID=linux_arm_oabi
5345             ;;
5346         esac
5347         ;;
5348     hppa)
5349         CPUNAME=HPPA
5350         RTL_ARCH=HPPA
5351         EPM_FLAGS="-a hppa"
5352         PLATFORMID=linux_hppa
5353         ;;
5354     i*86)
5355         CPUNAME=INTEL
5356         RTL_ARCH=x86
5357         PLATFORMID=linux_x86
5358         ;;
5359     ia64)
5360         CPUNAME=IA64
5361         RTL_ARCH=IA64
5362         PLATFORMID=linux_ia64
5363         ;;
5364     mips)
5365         CPUNAME=MIPS
5366         RTL_ARCH=MIPS_EB
5367         EPM_FLAGS="-a mips"
5368         PLATFORMID=linux_mips_eb
5369         ;;
5370     mips64)
5371         CPUNAME=MIPS64
5372         RTL_ARCH=MIPS64_EB
5373         EPM_FLAGS="-a mips64"
5374         PLATFORMID=linux_mips64_eb
5375         ;;
5376     mips64el)
5377         CPUNAME=MIPS64
5378         RTL_ARCH=MIPS64_EL
5379         EPM_FLAGS="-a mips64el"
5380         PLATFORMID=linux_mips64_el
5381         ;;
5382     mipsel)
5383         CPUNAME=MIPS
5384         RTL_ARCH=MIPS_EL
5385         EPM_FLAGS="-a mipsel"
5386         PLATFORMID=linux_mips_el
5387         ;;
5388     riscv64)
5389         CPUNAME=RISCV64
5390         RTL_ARCH=RISCV64
5391         EPM_FLAGS="-a riscv64"
5392         PLATFORMID=linux_riscv64
5393         ;;
5394     m68k)
5395         CPUNAME=M68K
5396         RTL_ARCH=M68K
5397         PLATFORMID=linux_m68k
5398         ;;
5399     powerpc)
5400         CPUNAME=POWERPC
5401         RTL_ARCH=PowerPC
5402         PLATFORMID=linux_powerpc
5403         ;;
5404     powerpc64)
5405         CPUNAME=POWERPC64
5406         RTL_ARCH=PowerPC_64
5407         PLATFORMID=linux_powerpc64
5408         ;;
5409     powerpc64le)
5410         CPUNAME=POWERPC64
5411         RTL_ARCH=PowerPC_64_LE
5412         PLATFORMID=linux_powerpc64_le
5413         ;;
5414     sparc)
5415         CPUNAME=SPARC
5416         RTL_ARCH=SPARC
5417         PLATFORMID=linux_sparc
5418         ;;
5419     sparc64)
5420         CPUNAME=SPARC64
5421         RTL_ARCH=SPARC64
5422         PLATFORMID=linux_sparc64
5423         ;;
5424     s390x)
5425         CPUNAME=S390X
5426         RTL_ARCH=S390x
5427         PLATFORMID=linux_s390x
5428         ;;
5429     x86_64)
5430         CPUNAME=X86_64
5431         RTL_ARCH=X86_64
5432         PLATFORMID=linux_x86_64
5433         ;;
5434     loongarch64)
5435         CPUNAME=LOONGARCH64
5436         RTL_ARCH=LOONGARCH64
5437         PLATFORMID=linux_loongarch64
5438         ;;
5439     *)
5440         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5441         ;;
5442     esac
5443     ;;
5445 linux-android*)
5446     COM=GCC
5447     OS=ANDROID
5448     RTL_OS=Android
5449     P_SEP=:
5451     case "$host_cpu" in
5453     arm|armel)
5454         CPUNAME=ARM
5455         RTL_ARCH=ARM_EABI
5456         PLATFORMID=android_arm_eabi
5457         ;;
5458     aarch64)
5459         CPUNAME=AARCH64
5460         RTL_ARCH=AARCH64
5461         PLATFORMID=android_aarch64
5462         ;;
5463     i*86)
5464         CPUNAME=INTEL
5465         RTL_ARCH=x86
5466         PLATFORMID=android_x86
5467         ;;
5468     x86_64)
5469         CPUNAME=X86_64
5470         RTL_ARCH=X86_64
5471         PLATFORMID=android_x86_64
5472         ;;
5473     *)
5474         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5475         ;;
5476     esac
5477     ;;
5479 *netbsd*)
5480     COM=GCC
5481     OS=NETBSD
5482     RTL_OS=NetBSD
5483     P_SEP=:
5485     case "$host_cpu" in
5486     i*86)
5487         CPUNAME=INTEL
5488         RTL_ARCH=x86
5489         PLATFORMID=netbsd_x86
5490         ;;
5491     powerpc)
5492         CPUNAME=POWERPC
5493         RTL_ARCH=PowerPC
5494         PLATFORMID=netbsd_powerpc
5495         ;;
5496     sparc)
5497         CPUNAME=SPARC
5498         RTL_ARCH=SPARC
5499         PLATFORMID=netbsd_sparc
5500         ;;
5501     x86_64)
5502         CPUNAME=X86_64
5503         RTL_ARCH=X86_64
5504         PLATFORMID=netbsd_x86_64
5505         ;;
5506     *)
5507         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5508         ;;
5509     esac
5510     ;;
5512 openbsd*)
5513     COM=GCC
5514     OS=OPENBSD
5515     RTL_OS=OpenBSD
5516     P_SEP=:
5518     case "$host_cpu" in
5519     i*86)
5520         CPUNAME=INTEL
5521         RTL_ARCH=x86
5522         PLATFORMID=openbsd_x86
5523         ;;
5524     x86_64)
5525         CPUNAME=X86_64
5526         RTL_ARCH=X86_64
5527         PLATFORMID=openbsd_x86_64
5528         ;;
5529     *)
5530         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5531         ;;
5532     esac
5533     SOLARINC="$SOLARINC -I/usr/local/include"
5534     ;;
5536 solaris*)
5537     COM=GCC
5538     OS=SOLARIS
5539     RTL_OS=Solaris
5540     P_SEP=:
5542     case "$host_cpu" in
5543     i*86)
5544         CPUNAME=INTEL
5545         RTL_ARCH=x86
5546         PLATFORMID=solaris_x86
5547         ;;
5548     sparc)
5549         CPUNAME=SPARC
5550         RTL_ARCH=SPARC
5551         PLATFORMID=solaris_sparc
5552         ;;
5553     sparc64)
5554         CPUNAME=SPARC64
5555         RTL_ARCH=SPARC64
5556         PLATFORMID=solaris_sparc64
5557         ;;
5558     *)
5559         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5560         ;;
5561     esac
5562     SOLARINC="$SOLARINC -I/usr/local/include"
5563     ;;
5565 emscripten*)
5566     COM=GCC
5567     OS=EMSCRIPTEN
5568     RTL_OS=Emscripten
5569     P_SEP=:
5571     case "$host_cpu" in
5572     wasm32|wasm64)
5573         ;;
5574     *)
5575         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5576         ;;
5577     esac
5578     CPUNAME=INTEL
5579     RTL_ARCH=x86
5580     PLATFORMID=linux_x86
5581     ;;
5584     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5585     ;;
5586 esac
5588 DISABLE_GUI=""
5589 if test "$enable_gui" = "no"; then
5590     if test "$using_x11" != yes; then
5591         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5592     fi
5593     USING_X11=
5594     DISABLE_GUI=TRUE
5595     test_epoxy=no
5596 else
5597     AC_DEFINE(HAVE_FEATURE_UI)
5599 AC_SUBST(DISABLE_GUI)
5601 if test "$with_x" = "no"; then
5602     USING_X11=
5605 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5606     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5609 if test "$using_x11" = yes; then
5610     if test "$USING_X11" = TRUE; then
5611         AC_DEFINE(USING_X11)
5612     else
5613         disable_x11_tests
5614         if test "$DISABLE_DYNLOADING" = TRUE; then
5615             test_qt5=yes
5616             test_qt6=yes
5617         fi
5618     fi
5619 else
5620     if test "$USING_X11" = TRUE; then
5621         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5622     fi
5625 WORKDIR="${BUILDDIR}/workdir"
5626 INSTDIR="${BUILDDIR}/instdir"
5627 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5628 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5629 AC_SUBST(COM)
5630 AC_SUBST(CPUNAME)
5631 AC_SUBST(RTL_OS)
5632 AC_SUBST(RTL_ARCH)
5633 AC_SUBST(EPM_FLAGS)
5634 AC_SUBST(USING_X11)
5635 AC_SUBST([INSTDIR])
5636 AC_SUBST([INSTROOT])
5637 AC_SUBST([INSTROOTBASE])
5638 AC_SUBST(OS)
5639 AC_SUBST(P_SEP)
5640 AC_SUBST(WORKDIR)
5641 AC_SUBST(PLATFORMID)
5642 AC_SUBST(WINDOWS_X64)
5643 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5644 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5646 if test "$OS" = WNT -a "$COM" = MSC; then
5647     case "$CPUNAME" in
5648     INTEL) CPPU_ENV=msci ;;
5649     X86_64) CPPU_ENV=mscx ;;
5650     AARCH64) CPPU_ENV=msca ;;
5651     *)
5652         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5653         ;;
5654     esac
5655 else
5656     CPPU_ENV=gcc3
5658 AC_SUBST(CPPU_ENV)
5660 dnl ===================================================================
5661 dnl Test which package format to use
5662 dnl ===================================================================
5663 AC_MSG_CHECKING([which package format to use])
5664 if test -n "$with_package_format" -a "$with_package_format" != no; then
5665     for i in $with_package_format; do
5666         case "$i" in
5667         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5668             ;;
5669         *)
5670             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5671 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5672 deb - Debian software distribution
5673 pkg - Solaris software distribution
5674 rpm - RedHat software distribution
5676 LibreOffice additionally supports:
5677 archive - .tar.gz or .zip
5678 dmg - macOS .dmg
5679 installed - installation tree
5680 msi - Windows .msi
5681         ])
5682             ;;
5683         esac
5684     done
5685     # fakeroot is needed to ensure correct file ownerships/permissions
5686     # inside deb packages and tar archives created on Linux and Solaris.
5687     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5688         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5689         if test "$FAKEROOT" = "no"; then
5690             AC_MSG_ERROR(
5691                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5692         fi
5693     fi
5694     PKGFORMAT="$with_package_format"
5695     AC_MSG_RESULT([$PKGFORMAT])
5696 else
5697     PKGFORMAT=
5698     AC_MSG_RESULT([none])
5700 AC_SUBST(PKGFORMAT)
5702 dnl ===================================================================
5703 dnl handle help related options
5705 dnl If you change help related options, please update README.help
5706 dnl ===================================================================
5708 ENABLE_HTMLHELP=
5709 HELP_OMINDEX_PAGE=
5710 HELP_ONLINE=
5711 WITH_HELPPACKS=
5713 AC_MSG_CHECKING([which help to build])
5714 if test -n "$with_help" -a "$with_help" != "no"; then
5715     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5716     BUILD_TYPE="$BUILD_TYPE HELP"
5717     case "$with_help" in
5718     "html")
5719         ENABLE_HTMLHELP=TRUE
5720         WITH_HELPPACKS=TRUE
5721         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5722         AC_MSG_RESULT([HTML (local)])
5723         ;;
5724     "online")
5725         ENABLE_HTMLHELP=TRUE
5726         HELP_ONLINE=TRUE
5727         AC_MSG_RESULT([HTML (online)])
5728         ;;
5729     yes)
5730         WITH_HELPPACKS=TRUE
5731         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5732         AC_MSG_RESULT([XML (local)])
5733         ;;
5734     *)
5735         AC_MSG_ERROR([Unknown --with-help=$with_help])
5736         ;;
5737     esac
5738 else
5739     AC_MSG_RESULT([no])
5742 AC_MSG_CHECKING([if we need to build the help index tooling])
5743 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5744     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5745     test_clucene=yes
5746     AC_MSG_RESULT([yes])
5747 else
5748     AC_MSG_RESULT([no])
5751 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5752 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5753     if test "$HELP_ONLINE" != TRUE; then
5754         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5755     fi
5756     case "$with_omindex" in
5757     "server")
5758         HELP_OMINDEX_PAGE=TRUE
5759         AC_MSG_RESULT([SERVER])
5760         ;;
5761     "noxap")
5762         AC_MSG_RESULT([NOXAP])
5763         ;;
5764     *)
5765         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5766         ;;
5767     esac
5768 else
5769     AC_MSG_RESULT([no])
5772 AC_MSG_CHECKING([whether to include the XML-help support])
5773 if test "$enable_xmlhelp" = yes; then
5774     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5775     test_clucene=yes
5776     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5777     AC_MSG_RESULT([yes])
5778 else
5779     if test "$with_help" = yes; then
5780         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5781     fi
5782     AC_MSG_RESULT([no])
5785 dnl Test whether to integrate helppacks into the product's installer
5786 AC_MSG_CHECKING([for helppack integration])
5787 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5788     AC_MSG_RESULT([no integration])
5789 else
5790     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5791     AC_MSG_RESULT([integration])
5794 AC_SUBST([ENABLE_HTMLHELP])
5795 AC_SUBST([HELP_OMINDEX_PAGE])
5796 AC_SUBST([HELP_ONLINE])
5797 # WITH_HELPPACKS is used only in configure
5799 dnl ===================================================================
5800 dnl Set up a different compiler to produce tools to run on the build
5801 dnl machine when doing cross-compilation
5802 dnl ===================================================================
5804 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5805 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5806 if test "$cross_compiling" = "yes"; then
5807     AC_MSG_CHECKING([for BUILD platform configuration])
5808     echo
5809     rm -rf CONF-FOR-BUILD config_build.mk
5810     mkdir CONF-FOR-BUILD
5811     # Here must be listed all files needed when running the configure script. In particular, also
5812     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5813     # keep them in the same order as there.
5814     (cd $SRC_ROOT && tar cf - \
5815         config.guess \
5816         bin/get_config_variables \
5817         solenv/bin/getcompver.awk \
5818         solenv/inc/langlist.mk \
5819         download.lst \
5820         config_host.mk.in \
5821         config_host_lang.mk.in \
5822         Makefile.in \
5823         bin/bffvalidator.sh.in \
5824         bin/odfvalidator.sh.in \
5825         bin/officeotron.sh.in \
5826         instsetoo_native/util/openoffice.lst.in \
5827         config_host/*.in \
5828         sysui/desktop/macosx/Info.plist.in \
5829         sysui/desktop/macosx/hardened_runtime.xcent.in \
5830         sysui/desktop/macosx/lo.xcent.in \
5831         .vscode/vs-code-template.code-workspace.in \
5832         solenv/lockfile/autoconf.h.in \
5833         ) \
5834     | (cd CONF-FOR-BUILD && tar xf -)
5835     cp configure CONF-FOR-BUILD
5836     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5837     (
5838     unset COM USING_X11 OS CPUNAME
5839     unset CC CXX SYSBASE CFLAGS
5840     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5841     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5842     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5843     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5844     if test -n "$CC_FOR_BUILD"; then
5845         export CC="$CC_FOR_BUILD"
5846         CC_BASE=`first_arg_basename "$CC"`
5847     fi
5848     if test -n "$CXX_FOR_BUILD"; then
5849         export CXX="$CXX_FOR_BUILD"
5850         CXX_BASE=`first_arg_basename "$CXX"`
5851     fi
5852     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5853     cd CONF-FOR-BUILD
5855     # Handle host configuration, which affects the cross-toolset too
5856     sub_conf_opts=""
5857     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5858     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5859     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5860     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5861     if test -n "$ENABLE_JAVA"; then
5862         case "$_os" in
5863         Android)
5864             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5865             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5866             ;;
5867         *)
5868             if test -z "$with_jdk_home"; then
5869                 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.])
5870             fi
5871             ;;
5872         esac
5873     else
5874         sub_conf_opts="$sub_conf_opts --without-java"
5875     fi
5876     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5877     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5878     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5879     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5880     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5881     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5882     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5883     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5884     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5885     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5886     if test "$_os" = "Emscripten"; then
5887         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5888         if test "${with_main_module+set}" = set; then
5889             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5890         else
5891             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5892         fi
5893     fi
5894     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5895     # when cross-compiling for aarch64, overriding the defaults below
5896     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5898     # Don't bother having configure look for stuff not needed for the build platform anyway
5899     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5900     sub_conf_defaults=" \
5901         --build="$build_alias" \
5902         --disable-cairo-canvas \
5903         --disable-cups \
5904         --disable-customtarget-components \
5905         --disable-firebird-sdbc \
5906         --disable-gpgmepp \
5907         --disable-gstreamer-1-0 \
5908         --disable-gtk3 \
5909         --disable-gtk4 \
5910         --disable-libcmis \
5911         --disable-mariadb-sdbc \
5912         --disable-nss \
5913         --disable-online-update \
5914         --disable-opencl \
5915         --disable-openssl \
5916         --disable-pdfimport \
5917         --disable-postgresql-sdbc \
5918         --disable-skia \
5919         --disable-xmlhelp \
5920         --enable-dynamic-loading \
5921         --enable-icecream="$enable_icecream" \
5922         --without-gssapi \
5923         --without-doxygen \
5924         --without-tls \
5925         --without-webdav \
5926         --without-x \
5928     # single quotes added for better readability in case of spaces
5929     echo "    Running CONF-FOR-BUILD/configure" \
5930         $sub_conf_defaults \
5931         --with-parallelism="'$with_parallelism'" \
5932         --with-theme="'$with_theme'" \
5933         --with-vendor="'$with_vendor'" \
5934         $sub_conf_opts \
5935         $with_build_platform_configure_options \
5936         --srcdir=$srcdir
5938     ./configure \
5939         $sub_conf_defaults \
5940         --with-parallelism="$with_parallelism" \
5941         --with-theme="$with_theme" \
5942         "--with-vendor=$with_vendor" \
5943         $sub_conf_opts \
5944         $with_build_platform_configure_options \
5945         --srcdir=$srcdir \
5946         2>&1 | sed -e 's/^/    /'
5947     if test [${PIPESTATUS[0]}] -ne 0; then
5948         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5949     fi
5951     # filter permitted build targets
5952     PERMITTED_BUILD_TARGETS="
5953         ARGON2
5954         AVMEDIA
5955         BOOST
5956         BZIP2
5957         CAIRO
5958         CLUCENE
5959         CURL
5960         DBCONNECTIVITY
5961         DESKTOP
5962         DRAGONBOX
5963         DYNLOADING
5964         EPOXY
5965         EXPAT
5966         FROZEN
5967         GLM
5968         GRAPHITE
5969         HARFBUZZ
5970         HELPTOOLS
5971         ICU
5972         LCMS2
5973         LIBJPEG_TURBO
5974         LIBLANGTAG
5975         LibO
5976         LIBFFI
5977         LIBPN
5978         LIBTIFF
5979         LIBWEBP
5980         LIBXML2
5981         LIBXSLT
5982         MDDS
5983         NATIVE
5984         OPENSSL
5985         ORCUS
5986         PYTHON
5987         REPORTBUILDER
5988         SCRIPTING
5989         ZLIB
5990         ZXCVBN
5992     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5993     # newlined lists, to use grep as a filter
5994     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5995     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5996     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5997     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5999     cp config_host.mk ../config_build.mk
6000     cp config_host_lang.mk ../config_build_lang.mk
6001     mv config.log ../config.Build.log
6002     mkdir -p ../config_build
6003     mv config_host/*.h ../config_build
6004     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6006     # all these will get a _FOR_BUILD postfix
6007     DIRECT_FOR_BUILD_SETTINGS="
6008         CC
6009         CPPU_ENV
6010         CXX
6011         ILIB
6012         JAVA_HOME
6013         JAVAIFLAGS
6014         JDK
6015         JDK_SECURITYMANAGER_DISALLOWED
6016         LIBO_BIN_FOLDER
6017         LIBO_LIB_FOLDER
6018         LIBO_URE_LIB_FOLDER
6019         LIBO_URE_MISC_FOLDER
6020         OS
6021         SDKDIRNAME
6022         SYSTEM_LIBXML
6023         SYSTEM_LIBXSLT
6025     # these overwrite host config with build config
6026     OVERWRITING_SETTINGS="
6027         ANT
6028         ANT_HOME
6029         ANT_LIB
6030         JAVA_SOURCE_VER
6031         JAVA_TARGET_VER
6032         JAVACFLAGS
6033         JAVACOMPILER
6034         JAVADOC
6035         JAVADOCISGJDOC
6036         LOCKFILE
6037         SYSTEM_GENBRK
6038         SYSTEM_GENCCODE
6039         SYSTEM_GENCMN
6041     # these need some special handling
6042     EXTRA_HANDLED_SETTINGS="
6043         INSTDIR
6044         INSTROOT
6045         PATH
6046         WORKDIR
6048     OLD_PATH=$PATH
6049     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6050     BUILD_PATH=$PATH
6051     PATH=$OLD_PATH
6053     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6054     echo "$line" >>build-config
6056     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6057         VV='$'$V
6058         VV=`eval "echo $VV"`
6059         if test -n "$VV"; then
6060             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6061             echo "$line" >>build-config
6062         fi
6063     done
6065     for V in $OVERWRITING_SETTINGS; do
6066         VV='$'$V
6067         VV=`eval "echo $VV"`
6068         if test -n "$VV"; then
6069             line=${V}='${'${V}:-$VV'}'
6070             echo "$line" >>build-config
6071         fi
6072     done
6074     for V in INSTDIR INSTROOT WORKDIR; do
6075         VV='$'$V
6076         VV=`eval "echo $VV"`
6077         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6078         if test -n "$VV"; then
6079             line="${V}_FOR_BUILD='$VV'"
6080             echo "$line" >>build-config
6081         fi
6082     done
6084     )
6085     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6086     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])
6087     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6088              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6090     eval `cat CONF-FOR-BUILD/build-config`
6092     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6094     rm -rf CONF-FOR-BUILD
6095 else
6096     OS_FOR_BUILD="$OS"
6097     CC_FOR_BUILD="$CC"
6098     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6099     CXX_FOR_BUILD="$CXX"
6100     INSTDIR_FOR_BUILD="$INSTDIR"
6101     INSTROOT_FOR_BUILD="$INSTROOT"
6102     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6103     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6104     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6105     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6106     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6107     WORKDIR_FOR_BUILD="$WORKDIR"
6109 AC_SUBST(OS_FOR_BUILD)
6110 AC_SUBST(INSTDIR_FOR_BUILD)
6111 AC_SUBST(INSTROOT_FOR_BUILD)
6112 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6113 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6114 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6115 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6116 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6117 AC_SUBST(WORKDIR_FOR_BUILD)
6118 AC_SUBST(CC_FOR_BUILD)
6119 AC_SUBST(CXX_FOR_BUILD)
6120 AC_SUBST(CPPU_ENV_FOR_BUILD)
6122 dnl ===================================================================
6123 dnl Check for lockfile deps
6124 dnl ===================================================================
6125 if test -z "$CROSS_COMPILING"; then
6126     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6127     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6128     AC_MSG_CHECKING([which lockfile binary to use])
6129     case "$with_system_lockfile" in
6130     yes)
6131         AC_MSG_RESULT([external])
6132         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6133         ;;
6134     no)
6135         AC_MSG_RESULT([internal])
6136         ;;
6137     *)
6138         if test -x "$with_system_lockfile"; then
6139             LOCKFILE="$with_system_lockfile"
6140         else
6141             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6142         fi
6143         AC_MSG_RESULT([$with_system_lockfile])
6144         ;;
6145     esac
6148 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6149     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6152 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6153 AC_CHECK_FUNCS([utime utimes])
6154 AC_SUBST(LOCKFILE)
6156 dnl ===================================================================
6157 dnl Check for syslog header
6158 dnl ===================================================================
6159 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6161 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6162 dnl ===================================================================
6163 AC_MSG_CHECKING([whether to turn warnings to errors])
6164 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6165     ENABLE_WERROR="TRUE"
6166     PYTHONWARNINGS="error"
6167     AC_MSG_RESULT([yes])
6168 else
6169     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6170         ENABLE_WERROR="TRUE"
6171         PYTHONWARNINGS="error"
6172         AC_MSG_RESULT([yes])
6173     else
6174         AC_MSG_RESULT([no])
6175     fi
6177 AC_SUBST(ENABLE_WERROR)
6178 AC_SUBST(PYTHONWARNINGS)
6180 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6181 dnl ===================================================================
6182 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6183 if test -z "$enable_assert_always_abort"; then
6184    if test "$ENABLE_DEBUG" = TRUE; then
6185        enable_assert_always_abort=yes
6186    else
6187        enable_assert_always_abort=no
6188    fi
6190 if test "$enable_assert_always_abort" = "yes"; then
6191     ASSERT_ALWAYS_ABORT="TRUE"
6192     AC_MSG_RESULT([yes])
6193 else
6194     ASSERT_ALWAYS_ABORT="FALSE"
6195     AC_MSG_RESULT([no])
6197 AC_SUBST(ASSERT_ALWAYS_ABORT)
6199 # Determine whether to use ooenv for the instdir installation
6200 # ===================================================================
6201 if test $_os != "WINNT" -a $_os != "Darwin"; then
6202     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6203     if test -z "$enable_ooenv"; then
6204         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6205             enable_ooenv=yes
6206         else
6207             enable_ooenv=no
6208         fi
6209     fi
6210     if test "$enable_ooenv" = "no"; then
6211         AC_MSG_RESULT([no])
6212     else
6213         ENABLE_OOENV="TRUE"
6214         AC_MSG_RESULT([yes])
6215     fi
6217 AC_SUBST(ENABLE_OOENV)
6219 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6220     if test "$enable_qt5" = "no"; then
6221         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6222     else
6223         enable_qt5=yes
6224     fi
6227 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6228     if test "$enable_qt6" = "no"; then
6229         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6230     else
6231         enable_qt6=yes
6232     fi
6236 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6237 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6238     AC_MSG_RESULT([yes])
6239     ENABLE_PAGEIN=TRUE
6240     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6241 else
6242     AC_MSG_RESULT([no])
6244 AC_SUBST(ENABLE_PAGEIN)
6246 dnl ===================================================================
6247 dnl check for cups support
6248 dnl ===================================================================
6250 AC_MSG_CHECKING([whether to enable CUPS support])
6251 if test "$test_cups" = yes -a "$enable_cups" != no; then
6252     ENABLE_CUPS=TRUE
6253     AC_MSG_RESULT([yes])
6255     AC_MSG_CHECKING([whether cups support is present])
6256     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6257     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6258     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6259         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6260     fi
6261 else
6262     AC_MSG_RESULT([no])
6265 AC_SUBST(ENABLE_CUPS)
6267 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6269 dnl whether to find & fetch external tarballs?
6270 dnl ===================================================================
6271 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6272    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6273        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6274    else
6275        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6276    fi
6278 if test -z "$TARFILE_LOCATION"; then
6279     if test -d "$SRC_ROOT/src" ; then
6280         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6281         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6282     fi
6283     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6284 else
6285     AbsolutePath "$TARFILE_LOCATION"
6286     PathFormat "${absolute_path}"
6287     TARFILE_LOCATION="${formatted_path_unix}"
6289 PathFormat "$TARFILE_LOCATION"
6290 TARFILE_LOCATION_NATIVE="$formatted_path"
6291 AC_SUBST(TARFILE_LOCATION)
6292 AC_SUBST(TARFILE_LOCATION_NATIVE)
6294 AC_MSG_CHECKING([whether we want to fetch tarballs])
6295 if test "$enable_fetch_external" != "no"; then
6296     if test "$with_all_tarballs" = "yes"; then
6297         AC_MSG_RESULT([yes, all of them])
6298         DO_FETCH_TARBALLS="ALL"
6299     else
6300         AC_MSG_RESULT([yes, if we use them])
6301         DO_FETCH_TARBALLS="TRUE"
6302     fi
6303 else
6304     AC_MSG_RESULT([no])
6305     DO_FETCH_TARBALLS=
6307 AC_SUBST(DO_FETCH_TARBALLS)
6309 dnl Test whether to include MySpell dictionaries
6310 dnl ===================================================================
6311 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6312 if test "$with_myspell_dicts" = "yes"; then
6313     AC_MSG_RESULT([yes])
6314     WITH_MYSPELL_DICTS=TRUE
6315     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6316     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6317 else
6318     AC_MSG_RESULT([no])
6319     WITH_MYSPELL_DICTS=
6321 AC_SUBST(WITH_MYSPELL_DICTS)
6323 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6324 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6325     if test "$with_system_dicts" = yes; then
6326         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6327     fi
6328     with_system_dicts=no
6331 AC_MSG_CHECKING([whether to use dicts from external paths])
6332 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6333     AC_MSG_RESULT([yes])
6334     SYSTEM_DICTS=TRUE
6335     AC_MSG_CHECKING([for spelling dictionary directory])
6336     if test -n "$with_external_dict_dir"; then
6337         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6338     else
6339         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6340         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6341             DICT_SYSTEM_DIR=file:///usr/share/myspell
6342         fi
6343     fi
6344     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6345     AC_MSG_CHECKING([for hyphenation patterns directory])
6346     if test -n "$with_external_hyph_dir"; then
6347         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6348     else
6349         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6350     fi
6351     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6352     AC_MSG_CHECKING([for thesaurus directory])
6353     if test -n "$with_external_thes_dir"; then
6354         THES_SYSTEM_DIR=file://$with_external_thes_dir
6355     else
6356         THES_SYSTEM_DIR=file:///usr/share/mythes
6357     fi
6358     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6359 else
6360     AC_MSG_RESULT([no])
6361     SYSTEM_DICTS=
6363 AC_SUBST(SYSTEM_DICTS)
6364 AC_SUBST(DICT_SYSTEM_DIR)
6365 AC_SUBST(HYPH_SYSTEM_DIR)
6366 AC_SUBST(THES_SYSTEM_DIR)
6368 dnl ===================================================================
6369 dnl Precompiled headers.
6370 ENABLE_PCH=""
6371 AC_MSG_CHECKING([whether to enable pch feature])
6372 if test -z "$enable_pch"; then
6373     if test "$_os" = "WINNT"; then
6374         # Enabled by default on Windows.
6375         enable_pch=yes
6376         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6377         if test -z "$enable_ccache" -a "$SCCACHE"; then
6378             CCACHE=""
6379         fi
6380     else
6381         enable_pch=no
6382     fi
6384 if test "$enable_pch" != no -a "$_os" = Emscripten; then
6385     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6387 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6388     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6390 if test "$enable_pch" = "system"; then
6391     ENABLE_PCH="1"
6392     AC_MSG_RESULT([yes (system headers)])
6393 elif test "$enable_pch" = "base"; then
6394     ENABLE_PCH="2"
6395     AC_MSG_RESULT([yes (system and base headers)])
6396 elif test "$enable_pch" = "normal"; then
6397     ENABLE_PCH="3"
6398     AC_MSG_RESULT([yes (normal)])
6399 elif test "$enable_pch" = "full"; then
6400     ENABLE_PCH="4"
6401     AC_MSG_RESULT([yes (full)])
6402 elif test "$enable_pch" = "yes"; then
6403     # Pick a suitable default.
6404     if test "$GCC" = "yes"; then
6405         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6406         # while making the PCHs larger and rebuilds more likely.
6407         ENABLE_PCH="2"
6408         AC_MSG_RESULT([yes (system and base headers)])
6409     else
6410         # With MSVC the highest level makes a significant difference,
6411         # and it was the default when there used to be no PCH levels.
6412         ENABLE_PCH="4"
6413         AC_MSG_RESULT([yes (full)])
6414     fi
6415 elif test "$enable_pch" = "no"; then
6416     AC_MSG_RESULT([no])
6417 else
6418     AC_MSG_ERROR([Unknown value for --enable-pch])
6420 AC_SUBST(ENABLE_PCH)
6421 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6422 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6423     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6424     if test "$CCACHE_BIN" != "not found"; then
6425         AC_MSG_CHECKING([ccache version])
6426         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6427         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6428         AC_MSG_RESULT([$CCACHE_VERSION])
6429         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6430         if test "$CCACHE_NUMVER" -gt "030701"; then
6431             AC_MSG_RESULT([yes])
6432         else
6433             AC_MSG_RESULT([no (not newer than 3.7.1)])
6434             CCACHE_DEPEND_MODE=
6435         fi
6436     fi
6439 PCH_INSTANTIATE_TEMPLATES=
6440 if test -n "$ENABLE_PCH"; then
6441     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6442     save_CFLAGS=$CFLAGS
6443     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6444     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6445     CFLAGS=$save_CFLAGS
6446     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6447         AC_MSG_RESULT(yes)
6448     else
6449         AC_MSG_RESULT(no)
6450     fi
6452 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6454 BUILDING_PCH_WITH_OBJ=
6455 if test -n "$ENABLE_PCH"; then
6456     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6457     save_CFLAGS=$CFLAGS
6458     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6459     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6460     CFLAGS=$save_CFLAGS
6461     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6462         AC_MSG_RESULT(yes)
6463     else
6464         AC_MSG_RESULT(no)
6465     fi
6467 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6469 PCH_CODEGEN=
6470 PCH_NO_CODEGEN=
6471 fpch_prefix=
6472 if test "$COM" = MSC; then
6473     fpch_prefix="-Xclang "
6475 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6476     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6477     save_CFLAGS=$CFLAGS
6478     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6479     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6480         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6481     CFLAGS=$save_CFLAGS
6482     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6483     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6484         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6485     CFLAGS=$save_CFLAGS
6486     if test -n "$PCH_CODEGEN"; then
6487         AC_MSG_RESULT(yes)
6488     else
6489         AC_MSG_RESULT(no)
6490     fi
6492 AC_SUBST(PCH_CODEGEN)
6493 AC_SUBST(PCH_NO_CODEGEN)
6494 PCH_DEBUGINFO=
6495 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6496     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6497     save_CFLAGS=$CFLAGS
6498     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6499     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6500     CFLAGS=$save_CFLAGS
6501     if test -n "$PCH_DEBUGINFO"; then
6502         AC_MSG_RESULT(yes)
6503     else
6504         AC_MSG_RESULT(no)
6505     fi
6507 AC_SUBST(PCH_DEBUGINFO)
6509 TAB=`printf '\t'`
6511 AC_MSG_CHECKING([the GNU Make version])
6512 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6513 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6514 if test "$_make_longver" -ge "040000"; then
6515     AC_MSG_RESULT([$GNUMAKE $_make_version])
6516 else
6517     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6520 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6521 STALE_MAKE=
6522 if test "$_make_ver_check" = ""; then
6523    STALE_MAKE=TRUE
6526 HAVE_LD_HASH_STYLE=FALSE
6527 WITH_LINKER_HASH_STYLE=
6528 AC_MSG_CHECKING([for --hash-style gcc linker support])
6529 if test "$GCC" = "yes"; then
6530     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6531         hash_styles="gnu sysv"
6532     elif test "$with_linker_hash_style" = "no"; then
6533         hash_styles=
6534     else
6535         hash_styles="$with_linker_hash_style"
6536     fi
6538     for hash_style in $hash_styles; do
6539         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6540         hash_style_ldflags_save=$LDFLAGS
6541         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6543         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6544             [
6545 #include <stdio.h>
6546             ],[
6547 printf ("");
6548             ])],
6549             [
6550                   HAVE_LD_HASH_STYLE=TRUE
6551                   WITH_LINKER_HASH_STYLE=$hash_style
6552             ],
6553             [HAVE_LD_HASH_STYLE=FALSE],
6554             [HAVE_LD_HASH_STYLE=FALSE])
6555         LDFLAGS=$hash_style_ldflags_save
6556     done
6558     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6559         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6560     else
6561         AC_MSG_RESULT( no )
6562     fi
6563     LDFLAGS=$hash_style_ldflags_save
6564 else
6565     AC_MSG_RESULT( no )
6567 AC_SUBST(HAVE_LD_HASH_STYLE)
6568 AC_SUBST(WITH_LINKER_HASH_STYLE)
6570 dnl ===================================================================
6571 dnl Check whether there's a Perl version available.
6572 dnl ===================================================================
6573 if test -z "$with_perl_home"; then
6574     AC_PATH_PROG(PERL, perl)
6575 else
6576     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6577     _perl_path="$with_perl_home/bin/perl"
6578     if test -x "$_perl_path"; then
6579         PERL=$_perl_path
6580     else
6581         AC_MSG_ERROR([$_perl_path not found])
6582     fi
6585 dnl ===================================================================
6586 dnl Testing for Perl version 5 or greater.
6587 dnl $] is the Perl version variable, it is returned as an integer
6588 dnl ===================================================================
6589 if test "$PERL"; then
6590     AC_MSG_CHECKING([the Perl version])
6591     ${PERL} -e "exit($]);"
6592     _perl_version=$?
6593     if test "$_perl_version" -lt 5; then
6594         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6595     fi
6596     AC_MSG_RESULT([Perl $_perl_version])
6597 else
6598     AC_MSG_ERROR([Perl not found, install Perl 5])
6601 dnl ===================================================================
6602 dnl Testing for required Perl modules
6603 dnl ===================================================================
6605 AC_MSG_CHECKING([for required Perl modules])
6606 perl_use_string="use Cwd ; use Digest::MD5"
6607 if test "$_os" = "WINNT"; then
6608     if test -n "$PKGFORMAT"; then
6609         for i in $PKGFORMAT; do
6610             case "$i" in
6611             msi)
6612                 # for getting fonts versions to use in MSI
6613                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6614                 ;;
6615             esac
6616         done
6617     fi
6619 if test "$with_system_hsqldb" = "yes"; then
6620     perl_use_string="$perl_use_string ; use Archive::Zip"
6622 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6623     # OpenSSL needs that to build
6624     perl_use_string="$perl_use_string ; use FindBin"
6626 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6627     AC_MSG_RESULT([all modules found])
6628 else
6629     AC_MSG_RESULT([failed to find some modules])
6630     # Find out which modules are missing.
6631     for i in $perl_use_string; do
6632         if test "$i" != "use" -a "$i" != ";"; then
6633             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6634                 missing_perl_modules="$missing_perl_modules $i"
6635             fi
6636         fi
6637     done
6638     AC_MSG_ERROR([
6639     The missing Perl modules are: $missing_perl_modules
6640     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6643 dnl ===================================================================
6644 dnl Check for pkg-config
6645 dnl ===================================================================
6646 if test "$_os" != "WINNT"; then
6647     PKG_PROG_PKG_CONFIG
6649 AC_SUBST(PKG_CONFIG)
6650 AC_SUBST(PKG_CONFIG_PATH)
6651 AC_SUBST(PKG_CONFIG_LIBDIR)
6653 if test "$_os" != "WINNT"; then
6655     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6656     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6657     # explicitly. Or put /path/to/compiler in PATH yourself.
6659     toolprefix=gcc
6660     if test "$COM_IS_CLANG" = "TRUE"; then
6661         toolprefix=llvm
6662     fi
6663     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6664     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6665     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6666     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6667     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6668     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6670 AC_SUBST(AR)
6671 AC_SUBST(NM)
6672 AC_SUBST(OBJDUMP)
6673 AC_SUBST(RANLIB)
6674 AC_SUBST(READELF)
6675 AC_SUBST(STRIP)
6677 dnl ===================================================================
6678 dnl pkg-config checks on macOS
6679 dnl ===================================================================
6681 if test $_os = Darwin; then
6682     AC_MSG_CHECKING([for bogus pkg-config])
6683     if test -n "$PKG_CONFIG"; then
6684         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6685             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6686         else
6687             if test "$enable_bogus_pkg_config" = "yes"; then
6688                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6689             else
6690                 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.])
6691             fi
6692         fi
6693     else
6694         AC_MSG_RESULT([no, good])
6695     fi
6698 find_csc()
6700     # Return value: $csctest
6702     unset csctest
6704     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6705     if test -n "$regvalue"; then
6706         csctest=$regvalue
6707         return
6708     fi
6711 find_al()
6713     # Return value: $altest
6715     unset altest
6717     # We need this check to detect 4.6.1 or above.
6718     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6719         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6720         PathFormat "$regvalue"
6721         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6722             altest=$regvalue
6723             return
6724         fi
6725     done
6727     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6728     for x in $reglist; do
6729         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6730         PathFormat "$regvalue"
6731         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6732             altest=$regvalue
6733             return
6734         fi
6735     done
6738 find_dotnetsdk()
6740     unset frametest
6742     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
6743         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6744         if test -n "$regvalue"; then
6745             frametest=$regvalue
6746             return
6747         fi
6748     done
6749     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6752 find_winsdk_version()
6754     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6755     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6757     unset winsdktest winsdkbinsubdir winsdklibsubdir
6759     case "$1" in
6760     8.0|8.0A)
6761         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6762         if test -n "$regvalue"; then
6763             winsdktest=$regvalue
6764             winsdklibsubdir=win8
6765             return
6766         fi
6767         ;;
6768     8.1|8.1A)
6769         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6770         if test -n "$regvalue"; then
6771             winsdktest=$regvalue
6772             winsdklibsubdir=winv6.3
6773             return
6774         fi
6775         ;;
6776     10.0)
6777         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
6778         if test -n "$regvalue"; then
6779             winsdktest=$regvalue
6780             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
6781             if test -n "$regvalue"; then
6782                 winsdkbinsubdir="$regvalue".0
6783                 winsdklibsubdir=$winsdkbinsubdir
6784                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6785                 PathFormat "$tmppath"
6786                 local tmppath_unix=$formatted_path_unix
6787                 # test exist the SDK path
6788                 if test ! -d "$tmppath_unix"; then
6789                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6790                 fi
6791             fi
6792             return
6793         fi
6794         ;;
6795     esac
6798 find_winsdk()
6800     # Return value: From find_winsdk_version
6802     unset winsdktest
6804     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6805         find_winsdk_version $ver
6806         if test -n "$winsdktest"; then
6807             return
6808         fi
6809     done
6812 find_msms()
6814     # Return value: $msmdir
6815     local version="$1"
6817     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6818     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6819     local my_msm_dir
6821     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6823     msmdir=
6824     case "$VCVER" in
6825     16.0 | 17.0 | 17.11)
6826         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6827             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6828             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6829             if test -e "$my_msm_dir${my_msm_file}"; then
6830                 msmdir=$my_msm_dir
6831             fi
6832         done
6833         ;;
6834     esac
6836     if test -n "$msmdir"; then
6837         msmdir=`cygpath -m "$msmdir"`
6838         AC_MSG_RESULT([$msmdir])
6839     else
6840         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6841             AC_MSG_FAILURE([not found])
6842         else
6843             AC_MSG_WARN([not found (check config.log)])
6844             add_warning "MSM ${my_msm_file} not found"
6845         fi
6846     fi
6849 find_msvc_x64_dlls()
6851     # Return value: $msvcdllpath, $msvcdlls
6853     AC_MSG_CHECKING([for MSVC x64 DLL path])
6855     dnl Order crtver in increasing order. Then check the directories returned by
6856     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6857     dnl the result will be the highest CRT version found in the highest directory.
6859     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6860     case "$VCVER" in
6861     16.0 | 17.0 | 17.11)
6862         for crtver in 141 142 143; do
6863             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6864                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6865                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6866                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6867                 fi
6868             done
6869         done
6870         ;;
6871     esac
6872     AC_MSG_RESULT([$msvcdllpath])
6873     AC_MSG_CHECKING([for MSVC x64 DLLs])
6874     msvcdlls="msvcp140.dll vcruntime140.dll"
6875     for dll in $msvcdlls; do
6876         if ! test -f "$msvcdllpath/$dll"; then
6877             AC_MSG_FAILURE([missing $dll])
6878         fi
6879     done
6880     AC_MSG_RESULT([found all ($msvcdlls)])
6883 dnl =========================================
6884 dnl Check for the Windows  SDK.
6885 dnl =========================================
6886 if test "$_os" = "WINNT"; then
6887     AC_MSG_CHECKING([for Windows SDK])
6888     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6889         find_winsdk
6890         WINDOWS_SDK_HOME=$winsdktest
6892         # normalize if found
6893         if test -n "$WINDOWS_SDK_HOME"; then
6894             PathFormat "$WINDOWS_SDK_HOME"
6895             WINDOWS_SDK_HOME=$formatted_path_unix
6896         fi
6898         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6899         # The variable also contains the Windows SDK version
6900         echo $WINDOWS_SDK_LIB_SUBDIR
6901         IFS='.' read -r SDK_v1 SDK_v2 SDK_v3 SDK_v4 <<< "$WINDOWS_SDK_LIB_SUBDIR"
6902         # Assuming maximum of 5 digits for each part and ignoring last part
6903         SDK_NORMALIZED_VER=$((SDK_v1 * 10000000000 + SDK_v2 * 100000 + SDK_v3))
6904         # 10.0.20348.0 is the minimum required version
6905         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
6906             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
6907         fi
6908     fi
6910     if test -n "$WINDOWS_SDK_HOME"; then
6911         # Remove a possible trailing backslash
6912         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6914         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6915              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6916              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6917             have_windows_sdk_headers=yes
6918         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6919              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6920              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6921             have_windows_sdk_headers=yes
6922         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6923              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6924              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6925             have_windows_sdk_headers=yes
6926         else
6927             have_windows_sdk_headers=no
6928         fi
6930         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6931             have_windows_sdk_libs=yes
6932         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6933             have_windows_sdk_libs=yes
6934         else
6935             have_windows_sdk_libs=no
6936         fi
6938         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6939             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6940 the  Windows SDK are installed.])
6941         fi
6942     fi
6944     if test -z "$WINDOWS_SDK_HOME"; then
6945         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6946     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6947         WINDOWS_SDK_VERSION=80
6948         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6949     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6950         WINDOWS_SDK_VERSION=81
6951         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6952     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6953         WINDOWS_SDK_VERSION=10
6954         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6955     else
6956         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6957     fi
6958     PathFormat "$WINDOWS_SDK_HOME"
6959     WINDOWS_SDK_HOME="$formatted_path"
6960     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6961     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6962         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6963         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
6964             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6965         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
6966             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6967         fi
6968     fi
6970     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6971     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6972     dnl but not in v8.0), so allow this to be overridden with a
6973     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6974     dnl and configuration error if no WiLangId.vbs is found would arguably be
6975     dnl better, but I do not know under which conditions exactly it is needed by
6976     dnl msiglobal.pm:
6977     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6978         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6979         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6980             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6981         fi
6982         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6983             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6984         fi
6985         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6986             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
6987         fi
6988         PathFormat "$WINDOWS_SDK_WILANGID_unix"
6989         WINDOWS_SDK_WILANGID="$formatted_path"
6990     fi
6991     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6992         if test -n "$with_package_format" -a "$with_package_format" != no; then
6993             for i in "$with_package_format"; do
6994                 if test "$i" = "msi"; then
6995                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6996                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6997                     fi
6998                 fi
6999             done
7000         fi
7001     fi
7003 AC_SUBST(WINDOWS_SDK_HOME)
7004 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7005 AC_SUBST(WINDOWS_SDK_VERSION)
7006 AC_SUBST(WINDOWS_SDK_WILANGID)
7008 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7009     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7010     dnl dir, it also determines that dir's path w/o an arch segment if any,
7011     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7012     AC_MSG_CHECKING([for midl.exe])
7014     find_winsdk
7015     PathFormat "$winsdktest"
7016     winsdktest_unix="$formatted_path_unix"
7018     if test -n "$winsdkbinsubdir" \
7019         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7020     then
7021         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7022         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7023     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7024         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7025         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7026     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7027         MIDL_PATH=$winsdktest_unix/Bin
7028         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7029     fi
7030     PathFormat "$MIDL_PATH"
7031     if test ! -f "$formatted_path_unix/midl.exe"; then
7032         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7033     else
7034         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7035     fi
7037     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7038     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7040     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7041          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7042          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7043          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7044     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7045          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7046          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7047          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7048     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7049          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7050          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7051          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7052     else
7053         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7054     fi
7056     dnl Check csc.exe
7057     AC_MSG_CHECKING([for csc.exe])
7058     find_csc
7059     PathFormat "$csctest"
7060     csctest_unix="$formatted_path_unix"
7061     if test -f "$csctest_unix/csc.exe"; then
7062         CSC_PATH="$csctest"
7063     fi
7064     if test ! -f "$csctest_unix/csc.exe"; then
7065         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7066     else
7067         AC_MSG_RESULT([$CSC_PATH/csc.exe])
7068     fi
7070     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7072     dnl Check al.exe
7073     AC_MSG_CHECKING([for al.exe])
7074     if test -n "$winsdkbinsubdir" \
7075         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7076     then
7077         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7078     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7079         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7080     elif test -f "$winsdktest_unix/Bin/al.exe"; then
7081         AL_PATH="$winsdktest/Bin"
7082     fi
7084     if test -z "$AL_PATH"; then
7085         find_al
7086         PathFormat "$altest"
7087         altest_unix="$formatted_path_unix"
7088         if test -f "$altest_unix/bin/al.exe"; then
7089             AL_PATH="$altest/bin"
7090         elif test -f "$altest_unix/al.exe"; then
7091             AL_PATH="$altest"
7092         fi
7093     fi
7094     PathFormat "$AL_PATH"
7095     if test ! -f "$formatted_path_unix/al.exe"; then
7096         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7097     else
7098         AC_MSG_RESULT([$AL_PATH/al.exe])
7099     fi
7101     AL_PATH=`win_short_path_for_make "$AL_PATH"`
7103     dnl Check mscoree.lib / .NET Framework dir
7104     AC_MSG_CHECKING(.NET Framework)
7105     find_dotnetsdk
7106     PathFormat "$frametest"
7107     frametest="$formatted_path_unix"
7108     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7109         DOTNET_FRAMEWORK_HOME="$frametest"
7110     else
7111         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7112             DOTNET_FRAMEWORK_HOME="$winsdktest"
7113         fi
7114     fi
7115     PathFormat "$DOTNET_FRAMEWORK_HOME"
7116     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
7117         AC_MSG_ERROR([mscoree.lib not found])
7118     fi
7119     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7121     PathFormat "$MIDL_PATH"
7122     MIDL_PATH="$formatted_path"
7124     PathFormat "$AL_PATH"
7125     AL_PATH="$formatted_path"
7127     PathFormat "$DOTNET_FRAMEWORK_HOME"
7128     DOTNET_FRAMEWORK_HOME="$formatted_path"
7130     PathFormat "$CSC_PATH"
7131     CSC_PATH="$formatted_path"
7134 dnl ===================================================================
7135 dnl Testing for C++ compiler and version...
7136 dnl ===================================================================
7138 if test "$_os" != "WINNT"; then
7139     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7140     # see AC_PROG_CC above):
7141     save_CXXFLAGS=$CXXFLAGS
7142     CXXFLAGS=-g
7143     AC_PROG_CXX
7144     CXXFLAGS=$save_CXXFLAGS
7145     if test -z "$CXX_BASE"; then
7146         CXX_BASE=`first_arg_basename "$CXX"`
7147     fi
7150 dnl check for GNU C++ compiler version
7151 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7152     AC_MSG_CHECKING([the GNU C++ compiler version])
7154     _gpp_version=`$CXX -dumpversion`
7155     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7157     if test "$_gpp_majmin" -lt "700"; then
7158         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7159     else
7160         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7161     fi
7163     dnl see https://issuetracker.google.com/issues/36962819
7164         glibcxx_threads=no
7165         AC_LANG_PUSH([C++])
7166         AC_REQUIRE_CPP
7167         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7168         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7169             #include <bits/c++config.h>]],[[
7170             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7171             && !defined(_GLIBCXX__PTHREADS) \
7172             && !defined(_GLIBCXX_HAS_GTHREADS)
7173             choke me
7174             #endif
7175         ]])],[AC_MSG_RESULT([yes])
7176         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7177         AC_LANG_POP([C++])
7178         if test $glibcxx_threads = yes; then
7179             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7180         fi
7182 AC_SUBST(BOOST_CXXFLAGS)
7185 # prefx CXX with ccache if needed
7187 if test "$CCACHE" != ""; then
7188     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7189     AC_LANG_PUSH([C++])
7190     save_CXXFLAGS=$CXXFLAGS
7191     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7192     # msvc does not fail on unknown options, check stdout
7193     if test "$COM" = MSC; then
7194         CXXFLAGS="$CXXFLAGS -nologo"
7195     fi
7196     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7197     ac_cxx_werror_flag=yes
7198     dnl an empty program will do, we're checking the compiler flags
7199     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7200                       [use_ccache=yes], [use_ccache=no])
7201     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7202         AC_MSG_RESULT([yes])
7203     else
7204         CXX="$CCACHE $CXX"
7205         CXX_BASE="ccache $CXX_BASE"
7206         AC_MSG_RESULT([no])
7207     fi
7208     CXXFLAGS=$save_CXXFLAGS
7209     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7210     AC_LANG_POP([C++])
7213 dnl ===================================================================
7214 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7215 dnl ===================================================================
7217 if test "$_os" != "WINNT"; then
7218     AC_PROG_CXXCPP
7220     dnl Check whether there's a C pre-processor.
7221     AC_PROG_CPP
7225 dnl ===================================================================
7226 dnl Find integral type sizes and alignments
7227 dnl ===================================================================
7229 if test "$_os" != "WINNT"; then
7231     AC_CHECK_SIZEOF(long)
7232     AC_CHECK_SIZEOF(short)
7233     AC_CHECK_SIZEOF(int)
7234     AC_CHECK_SIZEOF(long long)
7235     AC_CHECK_SIZEOF(double)
7236     AC_CHECK_SIZEOF(void*)
7237     AC_CHECK_SIZEOF(size_t)
7239     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7240     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7241     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7242     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7243     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7244     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7246     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7247     m4_pattern_allow([AC_CHECK_ALIGNOF])
7248     m4_ifdef([AC_CHECK_ALIGNOF],
7249         [
7250             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7251             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7252             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7253             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7254         ],
7255         [
7256             case "$_os-$host_cpu" in
7257             Linux-i686)
7258                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7259                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7260                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7261                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7262                 ;;
7263             Linux-x86_64)
7264                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7265                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7266                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7267                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7268                 ;;
7269             *)
7270                 if test -z "$ac_cv_alignof_short" -o \
7271                         -z "$ac_cv_alignof_int" -o \
7272                         -z "$ac_cv_alignof_long" -o \
7273                         -z "$ac_cv_alignof_double"; then
7274                    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.])
7275                 fi
7276                 ;;
7277             esac
7278         ])
7280     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7281     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7282     if test $ac_cv_sizeof_long -eq 8; then
7283         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7284     elif test $ac_cv_sizeof_double -eq 8; then
7285         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7286     else
7287         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7288     fi
7290     dnl Check for large file support
7291     AC_SYS_LARGEFILE
7292     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
7293         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7294     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7295         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7296     fi
7297     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7298         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7299     fi
7300 else
7301     # Hardcode for MSVC
7302     SAL_TYPES_SIZEOFSHORT=2
7303     SAL_TYPES_SIZEOFINT=4
7304     SAL_TYPES_SIZEOFLONG=4
7305     SAL_TYPES_SIZEOFLONGLONG=8
7306     if test $WIN_HOST_BITS -eq 32; then
7307         SAL_TYPES_SIZEOFPOINTER=4
7308         SIZEOF_SIZE_T=4
7309     else
7310         SAL_TYPES_SIZEOFPOINTER=8
7311         SIZEOF_SIZE_T=8
7312     fi
7313     SAL_TYPES_ALIGNMENT2=2
7314     SAL_TYPES_ALIGNMENT4=4
7315     SAL_TYPES_ALIGNMENT8=8
7316     LFS_CFLAGS=''
7318 AC_SUBST(LFS_CFLAGS)
7319 AC_SUBST(SIZEOF_SIZE_T)
7321 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7322 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7323 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7324 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7325 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7326 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7327 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7328 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7330 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7331 AC_MSG_CHECKING([whether jumbo sheets are supported])
7332 if test "$_os" != "WINNT"; then
7333     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7334         AC_MSG_RESULT([yes])
7335         ENABLE_JUMBO_SHEETS=TRUE
7336         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7337     else
7338         AC_MSG_RESULT([no])
7339     fi
7340 else
7341     if test $WIN_HOST_BITS -gt 32; then
7342         # 64bit windows is special-cased for tools::Long because long is 32bit
7343         AC_MSG_RESULT([yes])
7344         ENABLE_JUMBO_SHEETS=TRUE
7345         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7346     else
7347         AC_MSG_RESULT([no])
7348     fi
7350 AC_SUBST(ENABLE_JUMBO_SHEETS)
7352 dnl ===================================================================
7353 dnl Check whether to enable runtime optimizations
7354 dnl ===================================================================
7355 ENABLE_RUNTIME_OPTIMIZATIONS=
7356 AC_MSG_CHECKING([whether to enable runtime optimizations])
7357 if test -z "$enable_runtime_optimizations"; then
7358     for i in $CC; do
7359         case $i in
7360         -fsanitize=*)
7361             enable_runtime_optimizations=no
7362             break
7363             ;;
7364         esac
7365     done
7367 if test "$enable_runtime_optimizations" != no; then
7368     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7369     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7370     AC_MSG_RESULT([yes])
7371 else
7372     AC_MSG_RESULT([no])
7374 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7376 dnl ===================================================================
7377 dnl Check if valgrind headers are available
7378 dnl ===================================================================
7379 ENABLE_VALGRIND=
7380 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7381     prev_cppflags=$CPPFLAGS
7382     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7383     # or where does it come from?
7384     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7385     AC_CHECK_HEADER([valgrind/valgrind.h],
7386         [ENABLE_VALGRIND=TRUE])
7387     CPPFLAGS=$prev_cppflags
7389 AC_SUBST([ENABLE_VALGRIND])
7390 if test -z "$ENABLE_VALGRIND"; then
7391     if test "$with_valgrind" = yes; then
7392         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7393     fi
7394     VALGRIND_CFLAGS=
7396 AC_SUBST([VALGRIND_CFLAGS])
7399 dnl ===================================================================
7400 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7401 dnl ===================================================================
7403 # We need at least the sys/sdt.h include header.
7404 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7405 if test "$SDT_H_FOUND" = "TRUE"; then
7406     # Found sys/sdt.h header, now make sure the c++ compiler works.
7407     # Old g++ versions had problems with probes in constructors/destructors.
7408     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7409     AC_LANG_PUSH([C++])
7410     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7411     #include <sys/sdt.h>
7412     class ProbeClass
7413     {
7414     private:
7415       int& ref;
7416       const char *name;
7418     public:
7419       ProbeClass(int& v, const char *n) : ref(v), name(n)
7420       {
7421         DTRACE_PROBE2(_test_, cons, name, ref);
7422       }
7424       void method(int min)
7425       {
7426         DTRACE_PROBE3(_test_, meth, name, ref, min);
7427         ref -= min;
7428       }
7430       ~ProbeClass()
7431       {
7432         DTRACE_PROBE2(_test_, dest, name, ref);
7433       }
7434     };
7435     ]],[[
7436     int i = 64;
7437     DTRACE_PROBE1(_test_, call, i);
7438     ProbeClass inst = ProbeClass(i, "call");
7439     inst.method(24);
7440     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7441           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7442     AC_LANG_POP([C++])
7444 AC_CONFIG_HEADERS([config_host/config_probes.h])
7446 dnl ===================================================================
7447 dnl GCC features
7448 dnl ===================================================================
7449 HAVE_GCC_STACK_CLASH_PROTECTION=
7450 HARDENING_CFLAGS=
7451 HARDENING_OPT_CFLAGS=
7452 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7453     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7454     save_CFLAGS=$CFLAGS
7455     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7456     AC_LINK_IFELSE(
7457         [AC_LANG_PROGRAM(, [[return 0;]])],
7458         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7459         [AC_MSG_RESULT([no])])
7460     CFLAGS=$save_CFLAGS
7462     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7463     save_CFLAGS=$CFLAGS
7464     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7465     if test "$ENABLE_OPTIMIZED" = TRUE; then
7466         CFLAGS="$CFLAGS -O2"
7467     fi
7468     AC_LINK_IFELSE(
7469         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7470         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7471         [AC_MSG_RESULT([no])])
7472     CFLAGS=$save_CFLAGS
7474     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7475     save_CFLAGS=$CFLAGS
7476     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7477     AC_LINK_IFELSE(
7478         [AC_LANG_PROGRAM(, [[return 0;]])],
7479         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7480         [AC_MSG_RESULT([no])])
7481     CFLAGS=$save_CFLAGS
7483     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7484     save_CFLAGS=$CFLAGS
7485     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7486     AC_LINK_IFELSE(
7487         [AC_LANG_PROGRAM(, [[return 0;]])],
7488         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7489         [AC_MSG_RESULT([no])])
7490     CFLAGS=$save_CFLAGS
7492     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7493     save_CFLAGS=$CFLAGS
7494     CFLAGS="$CFLAGS -Werror -fcf-protection"
7495     AC_LINK_IFELSE(
7496         [AC_LANG_PROGRAM(, [[return 0;]])],
7497         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7498         [AC_MSG_RESULT([no])])
7499     CFLAGS=$save_CFLAGS
7501     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7502     save_CFLAGS=$CFLAGS
7503     CFLAGS="$CFLAGS -Werror -mno-avx"
7504     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7505     CFLAGS=$save_CFLAGS
7506     if test "$HAVE_GCC_AVX" = "TRUE"; then
7507         AC_MSG_RESULT([yes])
7508     else
7509         AC_MSG_RESULT([no])
7510     fi
7512     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7513     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7514     int v = 0;
7515     if (__sync_add_and_fetch(&v, 1) != 1 ||
7516         __sync_sub_and_fetch(&v, 1) != 0)
7517         return 1;
7518     __sync_synchronize();
7519     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7520         v != 1)
7521         return 1;
7522     return 0;
7523 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7524     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7525         AC_MSG_RESULT([yes])
7526         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7527     else
7528         AC_MSG_RESULT([no])
7529     fi
7531     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7532     AC_LANG_PUSH([C++])
7533     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7534             #include <cstddef>
7535             #include <cxxabi.h>
7536             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7537         ])], [
7538             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7539             AC_MSG_RESULT([yes])
7540         ], [AC_MSG_RESULT([no])])
7541     AC_LANG_POP([C++])
7543     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7544     AC_LANG_PUSH([C++])
7545     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7546             #include <cstddef>
7547             #include <cxxabi.h>
7548             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7549         ])], [
7550             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7551             AC_MSG_RESULT([yes])
7552         ], [AC_MSG_RESULT([no])])
7553     AC_LANG_POP([C++])
7555     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7556     AC_LANG_PUSH([C++])
7557     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7558             #include <cxxabi.h>
7559             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7560         ])], [
7561             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7562             AC_MSG_RESULT([yes])
7563         ], [AC_MSG_RESULT([no])])
7564     AC_LANG_POP([C++])
7566     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7567     AC_LANG_PUSH([C++])
7568     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7569             #include <cstddef>
7570             #include <cxxabi.h>
7571             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7572         ])], [
7573             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7574             AC_MSG_RESULT([yes])
7575         ], [AC_MSG_RESULT([no])])
7576     AC_LANG_POP([C++])
7578     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7579     AC_LANG_PUSH([C++])
7580     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7581             #include <cstddef>
7582             #include <cxxabi.h>
7583             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7584         ])], [
7585             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7586             AC_MSG_RESULT([yes])
7587         ], [AC_MSG_RESULT([no])])
7588     AC_LANG_POP([C++])
7590     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7591     AC_LANG_PUSH([C++])
7592     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7593             #include <cxxabi.h>
7594             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7595         ])], [
7596             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7597             AC_MSG_RESULT([yes])
7598         ], [AC_MSG_RESULT([no])])
7599     AC_LANG_POP([C++])
7601     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7602     AC_LANG_PUSH([C++])
7603     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7604             #include <cxxabi.h>
7605             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7606         ])], [
7607             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7608             AC_MSG_RESULT([yes])
7609         ], [AC_MSG_RESULT([no])])
7610     AC_LANG_POP([C++])
7612     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7613     AC_LANG_PUSH([C++])
7614     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7615             #include <cxxabi.h>
7616             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7617         ])], [
7618             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7619             AC_MSG_RESULT([yes])
7620         ], [AC_MSG_RESULT([no])])
7621     AC_LANG_POP([C++])
7623     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7624     AC_LANG_PUSH([C++])
7625     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7626             #include <cstddef>
7627             #include <cxxabi.h>
7628             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7629         ])], [
7630             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7631             AC_MSG_RESULT([yes])
7632         ], [AC_MSG_RESULT([no])])
7633     AC_LANG_POP([C++])
7635     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7636     AC_LANG_PUSH([C++])
7637     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7638             #include <cstddef>
7639             #include <cxxabi.h>
7640             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7641         ])], [
7642             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7643             AC_MSG_RESULT([yes])
7644         ], [AC_MSG_RESULT([no])])
7645     AC_LANG_POP([C++])
7648 AC_SUBST(HAVE_GCC_AVX)
7649 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7650 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7651 AC_SUBST(HARDENING_CFLAGS)
7652 AC_SUBST(HARDENING_OPT_CFLAGS)
7654 dnl ===================================================================
7655 dnl Identify the C++ library
7656 dnl ===================================================================
7658 AC_MSG_CHECKING([what the C++ library is])
7659 HAVE_LIBSTDCPP=
7660 HAVE_LIBCPP=
7661 AC_LANG_PUSH([C++])
7662 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7663 #include <utility>
7664 #ifndef __GLIBCXX__
7665 foo bar
7666 #endif
7667 ]])],
7668     [CPP_LIBRARY=GLIBCXX
7669      cpp_library_name="GNU libstdc++"
7670      HAVE_LIBSTDCPP=TRUE
7671     ],
7672     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7673 #include <utility>
7674 #ifndef _LIBCPP_VERSION
7675 foo bar
7676 #endif
7677 ]])],
7678     [CPP_LIBRARY=LIBCPP
7679      cpp_library_name="LLVM libc++"
7680      AC_DEFINE([HAVE_LIBCPP])
7681      HAVE_LIBCPP=TRUE
7682     ],
7683     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7684 #include <utility>
7685 #ifndef _MSC_VER
7686 foo bar
7687 #endif
7688 ]])],
7689     [CPP_LIBRARY=MSVCRT
7690      cpp_library_name="Microsoft"
7691     ],
7692     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7693 AC_MSG_RESULT([$cpp_library_name])
7694 AC_LANG_POP([C++])
7695 AC_SUBST([HAVE_LIBSTDCPP])
7696 AC_SUBST([HAVE_LIBCPP])
7698 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7699 then
7700     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7701     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7702     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7703     # although there will be backwards compatibility).
7704     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7705     # and there would be undefined references to debug functions.
7706     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7707     # So check if debug mode can be used and disable or downgrade it to assertions
7708     # if needed.
7709     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7710     AC_LANG_PUSH([C++])
7711     libcpp_debug_links=
7712     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7713 #define _LIBCPP_DEBUG 0 // only assertions
7714 #include <vector>
7715 int main()
7717     std::vector<int> v;
7718     v.push_back( 1 );
7719     return v[ 3 ];
7721 ]])], [libcpp_debug_links=1])
7722     if test -n "$libcpp_debug_links"; then
7723         # we can use at least assertions, check if debug mode works
7724         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7725 #define _LIBCPP_DEBUG 1 // debug mode
7726 #include <string>
7727 #include <vector>
7728 int foo(const std::vector<int>& v) { return *v.begin(); }
7729 int main()
7731     std::vector<int> v;
7732     v.push_back( 1 );
7733     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7734     return (foo(v) + s.size()) != 0 ? 0 : 1;
7736 ]])],
7737         [AC_MSG_RESULT(yes)
7738          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7739         ],
7740         [AC_MSG_RESULT(no, using only assertions)
7741          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7742         ]
7743         )
7744     else
7745         AC_MSG_RESULT(no)
7746     fi
7747     AC_LANG_POP([C++])
7749 AC_SUBST([LIBCPP_DEBUG])
7751 dnl ===================================================================
7752 dnl Check for gperf
7753 dnl ===================================================================
7754 AC_PATH_PROG(GPERF, gperf)
7755 if test -z "$GPERF"; then
7756     AC_MSG_ERROR([gperf not found but needed. Install it.])
7758 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7759     GPERF=`cygpath -m $GPERF`
7761 AC_MSG_CHECKING([whether gperf is new enough])
7762 my_gperf_ver1=$($GPERF --version | head -n 1)
7763 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7764 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7765 if test "$my_gperf_ver3" -ge 301; then
7766     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7767 else
7768     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7770 AC_SUBST(GPERF)
7772 dnl ===================================================================
7773 dnl Check for system libcmis
7774 dnl ===================================================================
7775 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7777 dnl ===================================================================
7778 dnl C++11
7779 dnl ===================================================================
7781 if test -z "${CXXFLAGS_CXX11+x}"; then
7782     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7783     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7784         if test "$with_latest_c__" = yes; then
7785             CXXFLAGS_CXX11=-std:c++latest
7786         else
7787             CXXFLAGS_CXX11=-std:c++20
7788         fi
7789         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7790     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7791         my_flags='-std=c++20 -std=c++2a'
7792         if test "$with_latest_c__" = yes; then
7793             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7794         fi
7795         for flag in $my_flags; do
7796             if test "$COM" = MSC; then
7797                 flag="-Xclang $flag"
7798             fi
7799             save_CXXFLAGS=$CXXFLAGS
7800             CXXFLAGS="$CXXFLAGS $flag -Werror"
7801             AC_LANG_PUSH([C++])
7802             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7803                 #include <algorithm>
7804                 #include <functional>
7805                 #include <vector>
7807                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7808                     std::sort(v.begin(), v.end(), fn);
7809                 }
7810                 ]])],[CXXFLAGS_CXX11=$flag])
7811             AC_LANG_POP([C++])
7812             CXXFLAGS=$save_CXXFLAGS
7813             if test -n "$CXXFLAGS_CXX11"; then
7814                 break
7815             fi
7816         done
7817     fi
7818     if test -n "$CXXFLAGS_CXX11"; then
7819         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7820     else
7821         AC_MSG_ERROR(no)
7822     fi
7824 AC_SUBST(CXXFLAGS_CXX11)
7826 if test "$GCC" = "yes"; then
7827     save_CXXFLAGS=$CXXFLAGS
7828     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7829     CHECK_L_ATOMIC
7830     CXXFLAGS=$save_CXXFLAGS
7831     AC_SUBST(ATOMIC_LIB)
7834 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7835 save_CXXFLAGS=$CXXFLAGS
7836 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7837 AC_LANG_PUSH([C++])
7839 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7840 #include <stddef.h>
7842 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7844 namespace
7846         struct b
7847         {
7848                 int i;
7849                 int j;
7850         };
7852 ]], [[
7853 struct a
7855         int i;
7856         int j;
7858 a thinga[]={{0,0}, {1,1}};
7859 b thingb[]={{0,0}, {1,1}};
7860 size_t i = sizeof(sal_n_array_size(thinga));
7861 size_t j = sizeof(sal_n_array_size(thingb));
7862 return !(i != 0 && j != 0);
7864     ], [ AC_MSG_RESULT(yes) ],
7865     [ AC_MSG_ERROR(no)])
7866 AC_LANG_POP([C++])
7867 CXXFLAGS=$save_CXXFLAGS
7869 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7870 if test "$GCC" = yes; then
7871     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7872     AC_LANG_PUSH([C++])
7873     save_CXXFLAGS=$CXXFLAGS
7874     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7875     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7876     CXXFLAGS=$save_CXXFLAGS
7877     AC_LANG_POP([C++])
7878     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7879         AC_MSG_RESULT([yes])
7880     else
7881         AC_MSG_RESULT([no])
7882     fi
7884 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7886 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7887 AC_LANG_PUSH([C++])
7888 save_CXXFLAGS=$CXXFLAGS
7889 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7890 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7891         #include <algorithm>
7892         #include <initializer_list>
7893         #include <vector>
7894         template<typename T> class S {
7895         private:
7896             std::vector<T> v_;
7897         public:
7898             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7899         };
7900         constinit S<int> s{3, 2, 1};
7901     ])], [
7902         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7903         AC_MSG_RESULT([yes])
7904     ], [AC_MSG_RESULT([no])])
7905 CXXFLAGS=$save_CXXFLAGS
7906 AC_LANG_POP([C++])
7908 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7909 AC_LANG_PUSH([C++])
7910 save_CXXFLAGS=$CXXFLAGS
7911 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7912 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7913         struct S1 { S1(S1 &&); };
7914         struct S2: S1 {};
7915         S1 f(S2 s) { return s; }
7916     ])], [
7917         AC_DEFINE([HAVE_P1155R3],[1])
7918         AC_MSG_RESULT([yes])
7919     ], [AC_MSG_RESULT([no])])
7920 CXXFLAGS=$save_CXXFLAGS
7921 AC_LANG_POP([C++])
7923 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7924 HAVE_CXX20_ATOMIC_REF=
7925 AC_LANG_PUSH([C++])
7926 save_CXXFLAGS=$CXXFLAGS
7927 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7928 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7929         #include <atomic>
7930         int x;
7931         std::atomic_ref<int> y(x);
7932     ])], [
7933         HAVE_CXX20_ATOMIC_REF=TRUE
7934         AC_MSG_RESULT([yes])
7935     ], [AC_MSG_RESULT([no])])
7936 CXXFLAGS=$save_CXXFLAGS
7937 AC_LANG_POP([C++])
7938 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7940 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7941 dnl which is included in -Wextra anyway):
7942 HAVE_WDEPRECATED_COPY_DTOR=
7943 if test "$GCC" = yes; then
7944     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7945     AC_LANG_PUSH([C++])
7946     save_CXXFLAGS=$CXXFLAGS
7947     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7948     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7949             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7950             AC_MSG_RESULT([yes])
7951         ], [AC_MSG_RESULT([no])])
7952     CXXFLAGS=$save_CXXFLAGS
7953     AC_LANG_POP([C++])
7955 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7957 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7958 dnl uninitialized warning for code like
7960 dnl   OString f();
7961 dnl   boost::optional<OString> * g(bool b) {
7962 dnl       boost::optional<OString> o;
7963 dnl       if (b) o = f();
7964 dnl       return new boost::optional<OString>(o);
7965 dnl   }
7967 dnl (as is e.g. present, in a slightly more elaborate form, in
7968 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7969 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7970 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7971 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7972     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7973     AC_LANG_PUSH([C++])
7974     save_CXXFLAGS=$CXXFLAGS
7975     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7976     if test "$ENABLE_OPTIMIZED" = TRUE; then
7977         CXXFLAGS="$CXXFLAGS -O2"
7978     else
7979         CXXFLAGS="$CXXFLAGS -O0"
7980     fi
7981     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7982             #include <new>
7983             void f1(int);
7984             struct S1 {
7985                 ~S1() { f1(n); }
7986                 int n = 0;
7987             };
7988             struct S2 {
7989                 S2() {}
7990                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7991                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7992                 void set(S1 s) {
7993                     new (stg) S1(s);
7994                     init = true;
7995                 }
7996                 bool init = false;
7997                 char stg[sizeof (S1)];
7998             } ;
7999             S1 f2();
8000             S2 * f3(bool b) {
8001                 S2 o;
8002                 if (b) o.set(f2());
8003                 return new S2(o);
8004             }
8005         ]])], [AC_MSG_RESULT([no])], [
8006             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8007             AC_MSG_RESULT([yes])
8008         ])
8009     CXXFLAGS=$save_CXXFLAGS
8010     AC_LANG_POP([C++])
8012 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8014 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8015 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8016 dnl hits us e.g. with GCC 10 and --enable-optimized at
8018 dnl   In file included from include/rtl/string.hxx:49,
8019 dnl                    from include/rtl/ustring.hxx:43,
8020 dnl                    from include/osl/file.hxx:35,
8021 dnl                    from include/codemaker/global.hxx:28,
8022 dnl                    from include/codemaker/options.hxx:23,
8023 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8024 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8025 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,
8026 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,
8027 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,
8028 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8029 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8030 dnl      78 |         memcpy( buffer, data, length );
8031 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8032 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8033 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8034     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8035     AC_LANG_PUSH([C++])
8036     save_CXXFLAGS=$CXXFLAGS
8037     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8038     if test "$ENABLE_OPTIMIZED" = TRUE; then
8039         CXXFLAGS="$CXXFLAGS -O2"
8040     else
8041         CXXFLAGS="$CXXFLAGS -O0"
8042     fi
8043     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8044     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8045             void fill(char const * begin, char const * end, char c);
8046             struct q {
8047                 char ids[4];
8048                 char username[6];
8049             };
8050             void test(q & c) {
8051                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8052                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8053             }
8054         ]])], [AC_MSG_RESULT([no])], [
8055             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8056             AC_MSG_RESULT([yes])
8057         ])
8058     CXXFLAGS=$save_CXXFLAGS
8059     AC_LANG_POP([C++])
8061 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8063 HAVE_DLLEXPORTINLINES=
8064 if test "$_os" = "WINNT"; then
8065     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8066     AC_LANG_PUSH([C++])
8067     save_CXXFLAGS=$CXXFLAGS
8068     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8069     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8070             HAVE_DLLEXPORTINLINES=TRUE
8071             AC_MSG_RESULT([yes])
8072         ], [AC_MSG_RESULT([no])])
8073     CXXFLAGS=$save_CXXFLAGS
8074     AC_LANG_POP([C++])
8076 AC_SUBST([HAVE_DLLEXPORTINLINES])
8078 dnl ===================================================================
8079 dnl CPU Intrinsics support - SSE, AVX
8080 dnl ===================================================================
8082 CXXFLAGS_INTRINSICS_SSE2=
8083 CXXFLAGS_INTRINSICS_SSSE3=
8084 CXXFLAGS_INTRINSICS_SSE41=
8085 CXXFLAGS_INTRINSICS_SSE42=
8086 CXXFLAGS_INTRINSICS_AVX=
8087 CXXFLAGS_INTRINSICS_AVX2=
8088 CXXFLAGS_INTRINSICS_AVX512=
8089 CXXFLAGS_INTRINSICS_AVX512F=
8090 CXXFLAGS_INTRINSICS_F16C=
8091 CXXFLAGS_INTRINSICS_FMA=
8093 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8094     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8095     flag_sse2=-msse2
8096     flag_ssse3=-mssse3
8097     flag_sse41=-msse4.1
8098     flag_sse42=-msse4.2
8099     flag_avx=-mavx
8100     flag_avx2=-mavx2
8101     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8102     flag_avx512f=-mavx512f
8103     flag_f16c=-mf16c
8104     flag_fma=-mfma
8105 else
8106     # With MSVC using -arch is in fact not necessary for being able
8107     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8108     # even if compiled with -arch:AVX, the -arch option really only affects
8109     # instructions generated for C/C++ code.
8110     # So use the matching same (or lower) -arch options, but only in order
8111     # to generate the best matching instructions for the C++ code surrounding
8112     # the intrinsics.
8113     # SSE2 is the default for x86/x64, so no need to specify the option.
8114     flag_sse2=
8115     # No specific options for these, use the next lower.
8116     flag_ssse3="$flag_sse2"
8117     flag_sse41="$flag_sse2"
8118     flag_sse42="$flag_sse2"
8119     flag_avx=-arch:AVX
8120     flag_avx2=-arch:AVX2
8121     flag_avx512=-arch:AVX512
8122     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8123     flag_avx512f=-arch:AVX2
8124     # No MSVC options for these.
8125     flag_f16c="$flag_sse2"
8126     flag_fma="$flag_sse2"
8129 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8130 AC_LANG_PUSH([C++])
8131 save_CXXFLAGS=$CXXFLAGS
8132 CXXFLAGS="$CXXFLAGS $flag_sse2"
8133 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8134     #include <emmintrin.h>
8135     int main () {
8136         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8137         c = _mm_xor_si128 (a, b);
8138         return 0;
8139     }
8140     ])],
8141     [can_compile_sse2=yes],
8142     [can_compile_sse2=no])
8143 AC_LANG_POP([C++])
8144 CXXFLAGS=$save_CXXFLAGS
8145 AC_MSG_RESULT([${can_compile_sse2}])
8146 if test "${can_compile_sse2}" = "yes" ; then
8147     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8150 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8151 AC_LANG_PUSH([C++])
8152 save_CXXFLAGS=$CXXFLAGS
8153 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8154 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8155     #include <tmmintrin.h>
8156     int main () {
8157         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8158         c = _mm_maddubs_epi16 (a, b);
8159         return 0;
8160     }
8161     ])],
8162     [can_compile_ssse3=yes],
8163     [can_compile_ssse3=no])
8164 AC_LANG_POP([C++])
8165 CXXFLAGS=$save_CXXFLAGS
8166 AC_MSG_RESULT([${can_compile_ssse3}])
8167 if test "${can_compile_ssse3}" = "yes" ; then
8168     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8171 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8172 AC_LANG_PUSH([C++])
8173 save_CXXFLAGS=$CXXFLAGS
8174 CXXFLAGS="$CXXFLAGS $flag_sse41"
8175 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8176     #include <smmintrin.h>
8177     int main () {
8178         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8179         c = _mm_cmpeq_epi64 (a, b);
8180         return 0;
8181     }
8182     ])],
8183     [can_compile_sse41=yes],
8184     [can_compile_sse41=no])
8185 AC_LANG_POP([C++])
8186 CXXFLAGS=$save_CXXFLAGS
8187 AC_MSG_RESULT([${can_compile_sse41}])
8188 if test "${can_compile_sse41}" = "yes" ; then
8189     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8192 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8193 AC_LANG_PUSH([C++])
8194 save_CXXFLAGS=$CXXFLAGS
8195 CXXFLAGS="$CXXFLAGS $flag_sse42"
8196 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8197     #include <nmmintrin.h>
8198     int main () {
8199         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8200         c = _mm_cmpgt_epi64 (a, b);
8201         return 0;
8202     }
8203     ])],
8204     [can_compile_sse42=yes],
8205     [can_compile_sse42=no])
8206 AC_LANG_POP([C++])
8207 CXXFLAGS=$save_CXXFLAGS
8208 AC_MSG_RESULT([${can_compile_sse42}])
8209 if test "${can_compile_sse42}" = "yes" ; then
8210     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8213 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8214 AC_LANG_PUSH([C++])
8215 save_CXXFLAGS=$CXXFLAGS
8216 CXXFLAGS="$CXXFLAGS $flag_avx"
8217 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8218     #include <immintrin.h>
8219     int main () {
8220         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8221         c = _mm256_xor_ps(a, b);
8222         return 0;
8223     }
8224     ])],
8225     [can_compile_avx=yes],
8226     [can_compile_avx=no])
8227 AC_LANG_POP([C++])
8228 CXXFLAGS=$save_CXXFLAGS
8229 AC_MSG_RESULT([${can_compile_avx}])
8230 if test "${can_compile_avx}" = "yes" ; then
8231     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8234 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8235 AC_LANG_PUSH([C++])
8236 save_CXXFLAGS=$CXXFLAGS
8237 CXXFLAGS="$CXXFLAGS $flag_avx2"
8238 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8239     #include <immintrin.h>
8240     int main () {
8241         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8242         c = _mm256_maddubs_epi16(a, b);
8243         return 0;
8244     }
8245     ])],
8246     [can_compile_avx2=yes],
8247     [can_compile_avx2=no])
8248 AC_LANG_POP([C++])
8249 CXXFLAGS=$save_CXXFLAGS
8250 AC_MSG_RESULT([${can_compile_avx2}])
8251 if test "${can_compile_avx2}" = "yes" ; then
8252     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8255 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8256 AC_LANG_PUSH([C++])
8257 save_CXXFLAGS=$CXXFLAGS
8258 CXXFLAGS="$CXXFLAGS $flag_avx512"
8259 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8260     #include <immintrin.h>
8261     int main () {
8262         __m512i a = _mm512_loadu_si512(0);
8263         __m512d v1 = _mm512_load_pd(0);
8264         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8265         __m512d v2 = _mm512_abs_pd(v1);
8266         return 0;
8267     }
8268     ])],
8269     [can_compile_avx512=yes],
8270     [can_compile_avx512=no])
8271 AC_LANG_POP([C++])
8272 CXXFLAGS=$save_CXXFLAGS
8273 AC_MSG_RESULT([${can_compile_avx512}])
8274 if test "${can_compile_avx512}" = "yes" ; then
8275     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8276     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8279 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8280 AC_LANG_PUSH([C++])
8281 save_CXXFLAGS=$CXXFLAGS
8282 CXXFLAGS="$CXXFLAGS $flag_f16c"
8283 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8284     #include <immintrin.h>
8285     int main () {
8286         __m128i a = _mm_set1_epi32 (0);
8287         __m128 c;
8288         c = _mm_cvtph_ps(a);
8289         return 0;
8290     }
8291     ])],
8292     [can_compile_f16c=yes],
8293     [can_compile_f16c=no])
8294 AC_LANG_POP([C++])
8295 CXXFLAGS=$save_CXXFLAGS
8296 AC_MSG_RESULT([${can_compile_f16c}])
8297 if test "${can_compile_f16c}" = "yes" ; then
8298     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8301 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8302 AC_LANG_PUSH([C++])
8303 save_CXXFLAGS=$CXXFLAGS
8304 CXXFLAGS="$CXXFLAGS $flag_fma"
8305 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8306     #include <immintrin.h>
8307     int main () {
8308         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8309         d = _mm256_fmadd_ps(a, b, c);
8310         return 0;
8311     }
8312     ])],
8313     [can_compile_fma=yes],
8314     [can_compile_fma=no])
8315 AC_LANG_POP([C++])
8316 CXXFLAGS=$save_CXXFLAGS
8317 AC_MSG_RESULT([${can_compile_fma}])
8318 if test "${can_compile_fma}" = "yes" ; then
8319     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8322 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8323 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8324 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8325 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8326 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8327 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8328 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8329 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8330 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8331 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8333 dnl ===================================================================
8334 dnl system stl sanity tests
8335 dnl ===================================================================
8336 if test "$_os" != "WINNT"; then
8338     AC_LANG_PUSH([C++])
8340     save_CPPFLAGS="$CPPFLAGS"
8341     if test -n "$MACOSX_SDK_PATH"; then
8342         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8343     fi
8345     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8346     # only.
8347     if test "$CPP_LIBRARY" = GLIBCXX; then
8348         dnl gcc#19664, gcc#22482, rhbz#162935
8349         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8350         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8351         AC_MSG_RESULT([$stlvisok])
8352         if test "$stlvisok" = "no"; then
8353             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8354         fi
8355     fi
8357     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8358     # when we don't make any dynamic libraries?
8359     if test "$DISABLE_DYNLOADING" = ""; then
8360         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8361         cat > conftestlib1.cc <<_ACEOF
8362 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8363 struct S2: S1<int> { virtual ~S2(); };
8364 S2::~S2() {}
8365 _ACEOF
8366         cat > conftestlib2.cc <<_ACEOF
8367 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8368 struct S2: S1<int> { virtual ~S2(); };
8369 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8370 _ACEOF
8371         gccvisinlineshiddenok=yes
8372         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8373             gccvisinlineshiddenok=no
8374         else
8375             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8376             dnl known to not work with -z defs (unsetting which makes the test
8377             dnl moot, though):
8378             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8379             if test "$COM_IS_CLANG" = TRUE; then
8380                 for i in $CXX $CXXFLAGS; do
8381                     case $i in
8382                     -fsanitize=*)
8383                         my_linkflagsnoundefs=
8384                         break
8385                         ;;
8386                     esac
8387                 done
8388             fi
8389             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8390                 gccvisinlineshiddenok=no
8391             fi
8392         fi
8394         rm -fr libconftest*
8395         AC_MSG_RESULT([$gccvisinlineshiddenok])
8396         if test "$gccvisinlineshiddenok" = "no"; then
8397             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8398         fi
8399     fi
8401    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8402     cat >visibility.cxx <<_ACEOF
8403 #pragma GCC visibility push(hidden)
8404 struct __attribute__ ((visibility ("default"))) TestStruct {
8405   static void Init();
8407 __attribute__ ((visibility ("default"))) void TestFunc() {
8408   TestStruct::Init();
8410 _ACEOF
8411     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8412         gccvisbroken=yes
8413     else
8414         case "$host_cpu" in
8415         i?86|x86_64)
8416             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8417                 gccvisbroken=no
8418             else
8419                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8420                     gccvisbroken=no
8421                 else
8422                     gccvisbroken=yes
8423                 fi
8424             fi
8425             ;;
8426         *)
8427             gccvisbroken=no
8428             ;;
8429         esac
8430     fi
8431     rm -f visibility.s visibility.cxx
8433     AC_MSG_RESULT([$gccvisbroken])
8434     if test "$gccvisbroken" = "yes"; then
8435         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8436     fi
8438     CPPFLAGS="$save_CPPFLAGS"
8440     AC_MSG_CHECKING([if CET endbranch is recognized])
8441 cat > endbr.s <<_ACEOF
8442 endbr32
8443 _ACEOF
8444     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8445     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8446         AC_MSG_RESULT([yes])
8447         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8448     else
8449         AC_MSG_RESULT([no])
8450     fi
8451     rm -f endbr.s endbr.o
8452     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8454     AC_LANG_POP([C++])
8457 dnl ===================================================================
8458 dnl  Clang++ tests
8459 dnl ===================================================================
8461 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8462 if test "$GCC" = "yes"; then
8463     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8464     AC_LANG_PUSH([C++])
8465     save_CXXFLAGS=$CXXFLAGS
8466     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8467     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8468     CXXFLAGS=$save_CXXFLAGS
8469     AC_LANG_POP([C++])
8470     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8471         AC_MSG_RESULT([yes])
8472     else
8473         AC_MSG_RESULT([no])
8474     fi
8476 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8478 dnl ===================================================================
8479 dnl Compiler plugins
8480 dnl ===================================================================
8482 COMPILER_PLUGINS=
8483 # currently only Clang
8485 if test "$COM_IS_CLANG" != "TRUE"; then
8486     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8487         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8488         enable_compiler_plugins=no
8489     fi
8492 COMPILER_PLUGINS_COM_IS_CLANG=
8493 if test "$COM_IS_CLANG" = "TRUE"; then
8494     if test -n "$enable_compiler_plugins"; then
8495         compiler_plugins="$enable_compiler_plugins"
8496     elif test -n "$ENABLE_DBGUTIL"; then
8497         compiler_plugins=test
8498     else
8499         compiler_plugins=no
8500     fi
8501     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8502         if test "$CLANGVER" -lt 120001; then
8503             if test "$compiler_plugins" = yes; then
8504                 AC_MSG_ERROR(
8505                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8506             else
8507                 compiler_plugins=no
8508             fi
8509         fi
8510     fi
8511     if test "$compiler_plugins" != "no"; then
8512         dnl The prefix where Clang resides, override to where Clang resides if
8513         dnl using a source build:
8514         if test -z "$CLANGDIR"; then
8515             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8516         fi
8517         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8518         if test -z "$COMPILER_PLUGINS_CXX"; then
8519             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8520         fi
8521         clangbindir=$CLANGDIR/bin
8522         if test "$build_os" = "cygwin"; then
8523             clangbindir=$(cygpath -u "$clangbindir")
8524         fi
8525         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8526         if test -n "$LLVM_CONFIG"; then
8527             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8528             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8529             if test -z "$CLANGLIBDIR"; then
8530                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8531             fi
8532             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8533             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8534             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8535                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8536                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8537                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8538                 fi
8539             fi
8540             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8541             clangobjdir=$($LLVM_CONFIG --obj-root)
8542             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8543                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8544             fi
8545         fi
8546         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8547         AC_LANG_PUSH([C++])
8548         save_CXX=$CXX
8549         save_CXXCPP=$CXXCPP
8550         save_CPPFLAGS=$CPPFLAGS
8551         save_CXXFLAGS=$CXXFLAGS
8552         save_LDFLAGS=$LDFLAGS
8553         save_LIBS=$LIBS
8554         CXX=$COMPILER_PLUGINS_CXX
8555         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8556         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8557         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8558         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8559             [COMPILER_PLUGINS=TRUE],
8560             [
8561             if test "$compiler_plugins" = "yes"; then
8562                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8563             else
8564                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8565                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8566             fi
8567             ])
8568         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8569         dnl comment in compilerplugins/Makefile-clang.mk:
8570         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8571             LDFLAGS=""
8572             AC_MSG_CHECKING([for clang libraries to use])
8573             if test -z "$CLANGTOOLLIBS"; then
8574                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8575                 AC_LINK_IFELSE([
8576                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8577                         [[ clang::FullSourceLoc().dump(); ]])
8578                 ],[CLANGTOOLLIBS="$LIBS"],[])
8579             fi
8580             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8581             dnl list of individual -lclang* (but note that that list can become outdated over time,
8582             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8583             dnl needs to include -lclangSupport now"):
8584             if test -z "$CLANGTOOLLIBS"; then
8585                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8586  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8587                 AC_LINK_IFELSE([
8588                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8589                         [[ clang::FullSourceLoc().dump(); ]])
8590                 ],[CLANGTOOLLIBS="$LIBS"],[])
8591             fi
8592             AC_MSG_RESULT([$CLANGTOOLLIBS])
8593             if test -z "$CLANGTOOLLIBS"; then
8594                 if test "$compiler_plugins" = "yes"; then
8595                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8596                 else
8597                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8598                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8599                 fi
8600                 COMPILER_PLUGINS=
8601             fi
8602             if test -n "$COMPILER_PLUGINS"; then
8603                 if test -z "$CLANGSYSINCLUDE"; then
8604                     if test -n "$LLVM_CONFIG"; then
8605                         # Path to the clang system headers (no idea if there's a better way to get it).
8606                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8607                     fi
8608                 fi
8609             fi
8610         fi
8611         CXX=$save_CXX
8612         CXXCPP=$save_CXXCPP
8613         CPPFLAGS=$save_CPPFLAGS
8614         CXXFLAGS=$save_CXXFLAGS
8615         LDFLAGS=$save_LDFLAGS
8616         LIBS="$save_LIBS"
8617         AC_LANG_POP([C++])
8619         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8620         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8621             #ifndef __clang__
8622             you lose
8623             #endif
8624             int foo=42;
8625             ]])],
8626             [AC_MSG_RESULT([yes])
8627              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8628             [AC_MSG_RESULT([no])])
8629         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8630     fi
8631 else
8632     if test "$enable_compiler_plugins" = "yes"; then
8633         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8634     fi
8636 COMPILER_PLUGINS_ANALYZER_PCH=
8637 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8638     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8640 AC_SUBST(COMPILER_PLUGINS)
8641 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8642 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8643 AC_SUBST(COMPILER_PLUGINS_CXX)
8644 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8645 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8646 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8647 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8648 AC_SUBST(CLANGDIR)
8649 AC_SUBST(CLANGLIBDIR)
8650 AC_SUBST(CLANGTOOLLIBS)
8651 AC_SUBST(CLANGSYSINCLUDE)
8653 # Plugin to help linker.
8654 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8655 # This makes --enable-lto build with clang work.
8656 AC_SUBST(LD_PLUGIN)
8658 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8659 AC_SUBST(HAVE_POSIX_FALLOCATE)
8661 JITC_PROCESSOR_TYPE=""
8662 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8663     # IBMs JDK needs this...
8664     JITC_PROCESSOR_TYPE=6
8665     export JITC_PROCESSOR_TYPE
8667 AC_SUBST([JITC_PROCESSOR_TYPE])
8669 # Misc Windows Stuff
8670 AC_ARG_WITH(ucrt-dir,
8671     AS_HELP_STRING([--with-ucrt-dir],
8672         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8673         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8674         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8675             Windows6.1-KB2999226-x64.msu
8676             Windows6.1-KB2999226-x86.msu
8677             Windows8.1-KB2999226-x64.msu
8678             Windows8.1-KB2999226-x86.msu
8679             Windows8-RT-KB2999226-x64.msu
8680             Windows8-RT-KB2999226-x86.msu
8681         A zip archive including those files is available from Microsoft site:
8682         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8685 UCRT_REDISTDIR="$with_ucrt_dir"
8686 if test $_os = "WINNT"; then
8687     find_msvc_x64_dlls
8688     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8689     MSVC_DLLS="$msvcdlls"
8690     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8691         with_redist=143
8692     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8693         with_redist=142
8694     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8695         with_redist=141
8696     fi
8697     for i in $PKGFORMAT; do
8698         if test "$i" = msi; then
8699             find_msms "$with_redist"
8700             if test -n "$msmdir"; then
8701                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8702                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8703             fi
8704             break
8705         fi
8706     done
8708     if test "$UCRT_REDISTDIR" = "no"; then
8709         dnl explicitly disabled
8710         UCRT_REDISTDIR=""
8711     else
8712         PathFormat "$UCRT_REDISTDIR"
8713         UCRT_REDISTDIR="$formatted_path"
8714         UCRT_REDISTDIR_unix="$formatted_path_unix"
8715         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8716                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8717                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8718                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8719                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8720                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8721             UCRT_REDISTDIR=""
8722             if test -n "$PKGFORMAT"; then
8723                for i in $PKGFORMAT; do
8724                    case "$i" in
8725                    msi)
8726                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8727                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8728                        ;;
8729                    esac
8730                done
8731             fi
8732         fi
8733     fi
8736 AC_SUBST(UCRT_REDISTDIR)
8737 AC_SUBST(MSVC_DLL_PATH)
8738 AC_SUBST(MSVC_DLLS)
8739 AC_SUBST(MSM_PATH)
8742 dnl ===================================================================
8743 dnl Checks for Java
8744 dnl ===================================================================
8745 if test "$ENABLE_JAVA" != ""; then
8747     # Windows-specific tests
8748     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8749         if test -z "$with_jdk_home"; then
8750             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8751             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8752             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8753             if test -n "$regvalue"; then
8754                 ver=$regvalue
8755                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8756                 with_jdk_home=$regvalue
8757             fi
8758             howfound="found automatically"
8759         else
8760             howfound="you passed"
8761         fi
8762         PathFormat "$with_jdk_home"
8763         with_jdk_home="$formatted_path_unix"
8765         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8766             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])
8767         fi
8768         with_java="java.exe"
8769         javacompiler="javac.exe"
8770         javadoc="javadoc.exe"
8771     fi
8773     # 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.
8774     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8775     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8776         with_jdk_home=`/usr/libexec/java_home`
8777     fi
8779     JAVA_HOME=; export JAVA_HOME
8780     if test -z "$with_jdk_home"; then
8781         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8782     else
8783         _java_path="$with_jdk_home/bin/$with_java"
8784         dnl Check if there is a Java interpreter at all.
8785         if test -x "$_java_path"; then
8786             JAVAINTERPRETER=$_java_path
8787         else
8788             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8789         fi
8790     fi
8792     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8793     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8794     dnl loaded by java to run JunitTests:
8795     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8796         shortjdkhome=`cygpath -d "$with_jdk_home"`
8797         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
8798             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8799             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8800         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
8801             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8802             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8803         fi
8805         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8806             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8807         fi
8808         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8809     elif test "$cross_compiling" != "yes"; then
8810         case $CPUNAME in
8811             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8812                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8813                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8814                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8815                 fi
8816                 ;;
8817             *) # assumption: everything else 32-bit
8818                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8819                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8820                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8821                 fi
8822                 ;;
8823         esac
8824     fi
8827 dnl ===================================================================
8828 dnl Checks for JDK.
8829 dnl ===================================================================
8831 # Whether all the complexity here actually is needed any more or not, no idea.
8833 JDK_SECURITYMANAGER_DISALLOWED=
8834 MODULAR_JAVA=
8835 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8836     _gij_longver=0
8837     AC_MSG_CHECKING([the installed JDK])
8838     if test -n "$JAVAINTERPRETER"; then
8839         dnl java -version sends output to stderr!
8840         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8841             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8842         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8843             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8844         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8845             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8846         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8847             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8848         else
8849             JDK=sun
8851             dnl Sun JDK specific tests
8852             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8853             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8855             if test "$_jdk_ver" -lt 10800; then
8856                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
8857             fi
8858             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8859             dnl completely removed in some Java version > 18 (see
8860             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8861             if test "$_jdk_ver" -ge 180000; then
8862                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8863             fi
8865             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8866             if test "$_os" = "WINNT"; then
8867                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8868             fi
8869             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8871             dnl Check whether the build Java supports modules
8872             if test "$_jdk_ver" -ge 90000; then
8873                 MODULAR_JAVA=TRUE
8874             else
8875                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
8876                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
8877             fi
8879             # set to limit VM usage for JunitTests
8880             JAVAIFLAGS=-Xmx64M
8881             # set to limit VM usage for javac
8882             JAVACFLAGS=-J-Xmx128M
8883         fi
8884     else
8885         AC_MSG_ERROR([Java not found. You need at least JDK 8])
8886     fi
8887 else
8888     if test -z "$ENABLE_JAVA"; then
8889         dnl Java disabled
8890         JAVA_HOME=
8891         export JAVA_HOME
8892     elif test "$cross_compiling" = "yes"; then
8893         # Just assume compatibility of build and host JDK
8894         JDK=$JDK_FOR_BUILD
8895         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8896     fi
8899 dnl ===================================================================
8900 dnl Checks for javac
8901 dnl ===================================================================
8902 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8903     : ${JAVA_SOURCE_VER=8}
8904     : ${JAVA_TARGET_VER=8}
8905     if test -z "$with_jdk_home"; then
8906         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8907     else
8908         _javac_path="$with_jdk_home/bin/$javacompiler"
8909         dnl Check if there is a Java compiler at all.
8910         if test -x "$_javac_path"; then
8911             JAVACOMPILER=$_javac_path
8912         fi
8913     fi
8914     if test -z "$JAVACOMPILER"; then
8915         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8916     fi
8917     if test "$build_os" = "cygwin"; then
8918         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8919             JAVACOMPILER="${JAVACOMPILER}.exe"
8920         fi
8921         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8922     fi
8925 dnl ===================================================================
8926 dnl Checks for javadoc
8927 dnl ===================================================================
8928 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8929     if test -z "$with_jdk_home"; then
8930         AC_PATH_PROG(JAVADOC, $javadoc)
8931     else
8932         _javadoc_path="$with_jdk_home/bin/$javadoc"
8933         dnl Check if there is a javadoc at all.
8934         if test -x "$_javadoc_path"; then
8935             JAVADOC=$_javadoc_path
8936         else
8937             AC_PATH_PROG(JAVADOC, $javadoc)
8938         fi
8939     fi
8940     if test -z "$JAVADOC"; then
8941         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8942     fi
8943     if test "$build_os" = "cygwin"; then
8944         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8945             JAVADOC="${JAVADOC}.exe"
8946         fi
8947         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8948     fi
8950     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8951     JAVADOCISGJDOC="yes"
8952     fi
8954 AC_SUBST(JAVADOC)
8955 AC_SUBST(JAVADOCISGJDOC)
8957 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8958     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8959     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8960         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8961            # try to recover first by looking whether we have an alternative
8962            # system as in Debian or newer SuSEs where following /usr/bin/javac
8963            # over /etc/alternatives/javac leads to the right bindir where we
8964            # just need to strip a bit away to get a valid JAVA_HOME
8965            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8966         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8967             # maybe only one level of symlink (e.g. on Mac)
8968             JAVA_HOME=$(readlink $JAVACOMPILER)
8969             if test "$(dirname $JAVA_HOME)" = "."; then
8970                 # we've got no path to trim back
8971                 JAVA_HOME=""
8972             fi
8973         else
8974             # else warn
8975             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8976             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8977             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8978             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8979         fi
8980         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8981         if test "$JAVA_HOME" != "/usr"; then
8982             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8983                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8984                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8985                 dnl Tiger already returns a JDK path...
8986                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8987             else
8988                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8989                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8990                 dnl that checks which version to run
8991                 if test -f "$JAVA_HOME"; then
8992                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8993                 fi
8994             fi
8995         fi
8996     fi
8997     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8999     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9000     if test -z "$JAVA_HOME"; then
9001         if test "x$with_jdk_home" = "x"; then
9002             cat > findhome.java <<_ACEOF
9003 [import java.io.File;
9005 class findhome
9007     public static void main(String args[])
9008     {
9009         String jrelocation = System.getProperty("java.home");
9010         File jre = new File(jrelocation);
9011         System.out.println(jre.getParent());
9012     }
9014 _ACEOF
9015             AC_MSG_CHECKING([if javac works])
9016             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9017             AC_TRY_EVAL(javac_cmd)
9018             if test $? = 0 -a -f ./findhome.class; then
9019                 AC_MSG_RESULT([javac works])
9020             else
9021                 echo "configure: javac test failed" >&5
9022                 cat findhome.java >&5
9023                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9024             fi
9025             AC_MSG_CHECKING([if gij knows its java.home])
9026             JAVA_HOME=`$JAVAINTERPRETER findhome`
9027             if test $? = 0 -a "$JAVA_HOME" != ""; then
9028                 AC_MSG_RESULT([$JAVA_HOME])
9029             else
9030                 echo "configure: java test failed" >&5
9031                 cat findhome.java >&5
9032                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9033             fi
9034             # clean-up after ourselves
9035             rm -f ./findhome.java ./findhome.class
9036         else
9037             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9038         fi
9039     fi
9041     # now check if $JAVA_HOME is really valid
9042     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9043         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9044             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9045             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9046             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9047             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9048             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9049             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9050         fi
9051     fi
9052     PathFormat "$JAVA_HOME"
9053     JAVA_HOME="$formatted_path_unix"
9056 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9057     "$_os" != Darwin
9058 then
9059     AC_MSG_CHECKING([for JAWT lib])
9060     if test "$_os" = WINNT; then
9061         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9062         JAWTLIB=jawt.lib
9063     else
9064         case "$host_cpu" in
9065         arm*)
9066             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9067             JAVA_ARCH=$my_java_arch
9068             ;;
9069         i*86)
9070             my_java_arch=i386
9071             ;;
9072         m68k)
9073             my_java_arch=m68k
9074             ;;
9075         powerpc)
9076             my_java_arch=ppc
9077             ;;
9078         powerpc64)
9079             my_java_arch=ppc64
9080             ;;
9081         powerpc64le)
9082             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9083             JAVA_ARCH=$my_java_arch
9084             ;;
9085         sparc64)
9086             my_java_arch=sparcv9
9087             ;;
9088         x86_64)
9089             my_java_arch=amd64
9090             ;;
9091         *)
9092             my_java_arch=$host_cpu
9093             ;;
9094         esac
9095         # This is where JDK9 puts the library
9096         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9097             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9098         else
9099             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9100         fi
9101         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9102     fi
9103     AC_MSG_RESULT([$JAWTLIB])
9105 AC_SUBST(JAWTLIB)
9107 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9108     case "$host_os" in
9110     cygwin*|wsl*)
9111         JAVAINC="-I$JAVA_HOME/include/win32"
9112         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9113         ;;
9115     darwin*)
9116         if test -d "$JAVA_HOME/include/darwin"; then
9117             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9118         else
9119             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9120         fi
9121         ;;
9123     dragonfly*)
9124         JAVAINC="-I$JAVA_HOME/include"
9125         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9126         ;;
9128     freebsd*)
9129         JAVAINC="-I$JAVA_HOME/include"
9130         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9131         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9132         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9133         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9134         ;;
9136     k*bsd*-gnu*)
9137         JAVAINC="-I$JAVA_HOME/include"
9138         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9139         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9140         ;;
9142     linux-gnu*)
9143         JAVAINC="-I$JAVA_HOME/include"
9144         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9145         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9146         ;;
9148     *netbsd*)
9149         JAVAINC="-I$JAVA_HOME/include"
9150         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9151         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9152        ;;
9154     openbsd*)
9155         JAVAINC="-I$JAVA_HOME/include"
9156         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9157         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9158         ;;
9160     solaris*)
9161         JAVAINC="-I$JAVA_HOME/include"
9162         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9163         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9164         ;;
9165     esac
9167 SOLARINC="$SOLARINC $JAVAINC"
9169 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9170     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9171     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9172     JDK_FOR_BUILD=$JDK
9173     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9176 AC_SUBST(JAVACFLAGS)
9177 AC_SUBST(JAVACOMPILER)
9178 AC_SUBST(JAVAINTERPRETER)
9179 AC_SUBST(JAVAIFLAGS)
9180 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9181 AC_SUBST(JAVA_HOME)
9182 AC_SUBST(JAVA_HOME_FOR_BUILD)
9183 AC_SUBST(JDK)
9184 AC_SUBST(JDK_FOR_BUILD)
9185 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9186 AC_SUBST(JAVA_SOURCE_VER)
9187 AC_SUBST(JAVA_TARGET_VER)
9188 AC_SUBST(MODULAR_JAVA)
9191 dnl ===================================================================
9192 dnl Export file validation
9193 dnl ===================================================================
9194 AC_MSG_CHECKING([whether to enable export file validation])
9195 if test "$with_export_validation" != "no"; then
9196     if test -z "$ENABLE_JAVA"; then
9197         if test "$with_export_validation" = "yes"; then
9198             AC_MSG_ERROR([requested, but Java is disabled])
9199         else
9200             AC_MSG_RESULT([no, as Java is disabled])
9201         fi
9202     elif ! test -d "${SRC_ROOT}/schema"; then
9203         if test "$with_export_validation" = "yes"; then
9204             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9205         else
9206             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9207         fi
9208     else
9209         AC_MSG_RESULT([yes])
9210         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9212         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9213         if test -z "$ODFVALIDATOR"; then
9214             # remember to download the ODF toolkit with validator later
9215             AC_MSG_NOTICE([no odfvalidator found, will download it])
9216             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9217             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9219             # and fetch name of odfvalidator jar name from download.lst
9220             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9221             AC_SUBST(ODFVALIDATOR_JAR)
9223             if test -z "$ODFVALIDATOR_JAR"; then
9224                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9225             fi
9226         fi
9227         if test "$build_os" = "cygwin"; then
9228             # In case of Cygwin it will be executed from Windows,
9229             # so we need to run bash and absolute path to validator
9230             # so instead of "odfvalidator" it will be
9231             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9232             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9233         else
9234             ODFVALIDATOR="sh $ODFVALIDATOR"
9235         fi
9236         AC_SUBST(ODFVALIDATOR)
9239         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9240         if test -z "$OFFICEOTRON"; then
9241             # remember to download the officeotron with validator later
9242             AC_MSG_NOTICE([no officeotron found, will download it])
9243             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9244             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9246             # and fetch name of officeotron jar name from download.lst
9247             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9248             AC_SUBST(OFFICEOTRON_JAR)
9250             if test -z "$OFFICEOTRON_JAR"; then
9251                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9252             fi
9253         else
9254             # check version of existing officeotron
9255             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9256             if test 0"$OFFICEOTRON_VER" -lt 704; then
9257                 AC_MSG_ERROR([officeotron too old])
9258             fi
9259         fi
9260         if test "$build_os" = "cygwin"; then
9261             # In case of Cygwin it will be executed from Windows,
9262             # so we need to run bash and absolute path to validator
9263             # so instead of "odfvalidator" it will be
9264             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9265             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9266         else
9267             OFFICEOTRON="sh $OFFICEOTRON"
9268         fi
9269     fi
9270     AC_SUBST(OFFICEOTRON)
9271 else
9272     AC_MSG_RESULT([no])
9275 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9276 if test "$with_bffvalidator" != "no"; then
9277     AC_DEFINE(HAVE_BFFVALIDATOR)
9279     if test "$with_export_validation" = "no"; then
9280         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9281     fi
9283     if test "$with_bffvalidator" = "yes"; then
9284         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9285     else
9286         BFFVALIDATOR="$with_bffvalidator"
9287     fi
9289     if test "$build_os" = "cygwin"; then
9290         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9291             AC_MSG_RESULT($BFFVALIDATOR)
9292         else
9293             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9294         fi
9295     elif test -n "$BFFVALIDATOR"; then
9296         # We are not in Cygwin but need to run Windows binary with wine
9297         AC_PATH_PROGS(WINE, wine)
9299         # so swap in a shell wrapper that converts paths transparently
9300         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9301         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9302         AC_SUBST(BFFVALIDATOR_EXE)
9303         AC_MSG_RESULT($BFFVALIDATOR)
9304     else
9305         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9306     fi
9307     AC_SUBST(BFFVALIDATOR)
9308 else
9309     AC_MSG_RESULT([no])
9312 dnl ===================================================================
9313 dnl Check for epm (not needed for Windows)
9314 dnl ===================================================================
9315 AC_MSG_CHECKING([whether to enable EPM for packing])
9316 if test "$enable_epm" = "yes"; then
9317     AC_MSG_RESULT([yes])
9318     if test "$_os" != "WINNT"; then
9319         if test $_os = Darwin; then
9320             EPM=internal
9321         elif test -n "$with_epm"; then
9322             EPM=$with_epm
9323         else
9324             AC_PATH_PROG(EPM, epm, no)
9325         fi
9326         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9327             AC_MSG_NOTICE([EPM will be built.])
9328             BUILD_TYPE="$BUILD_TYPE EPM"
9329             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9330         else
9331             # Gentoo has some epm which is something different...
9332             AC_MSG_CHECKING([whether the found epm is the right epm])
9333             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9334                 AC_MSG_RESULT([yes])
9335             else
9336                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9337             fi
9338             AC_MSG_CHECKING([epm version])
9339             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9340             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9341                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9342                 AC_MSG_RESULT([OK, >= 3.7])
9343             else
9344                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9345                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9346             fi
9347         fi
9348     fi
9350     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9351         AC_MSG_CHECKING([for rpm])
9352         for a in "$RPM" rpmbuild rpm; do
9353             $a --usage >/dev/null 2> /dev/null
9354             if test $? -eq 0; then
9355                 RPM=$a
9356                 break
9357             else
9358                 $a --version >/dev/null 2> /dev/null
9359                 if test $? -eq 0; then
9360                     RPM=$a
9361                     break
9362                 fi
9363             fi
9364         done
9365         if test -z "$RPM"; then
9366             AC_MSG_ERROR([not found])
9367         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9368             RPM_PATH=`command -v $RPM`
9369             AC_MSG_RESULT([$RPM_PATH])
9370             SCPDEFS="$SCPDEFS -DWITH_RPM"
9371         else
9372             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9373         fi
9374     fi
9375     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9376         AC_PATH_PROG(DPKG, dpkg, no)
9377         if test "$DPKG" = "no"; then
9378             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9379         fi
9380     fi
9381     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9382        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9383         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9384             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9385                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9386                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9387                     AC_MSG_RESULT([yes])
9388                 else
9389                     AC_MSG_RESULT([no])
9390                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9391                         _pt="rpm"
9392                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9393                         add_warning "the rpms will need to be installed with --nodeps"
9394                     else
9395                         _pt="pkg"
9396                     fi
9397                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9398                     add_warning "the ${_pt}s will not be relocatable"
9399                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9400                                  relocation will work, you need to patch your epm with the
9401                                  patch in epm/epm-3.7.patch or build with
9402                                  --with-epm=internal which will build a suitable epm])
9403                 fi
9404             fi
9405         fi
9406     fi
9407     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9408         AC_PATH_PROG(PKGMK, pkgmk, no)
9409         if test "$PKGMK" = "no"; then
9410             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9411         fi
9412     fi
9413     AC_SUBST(RPM)
9414     AC_SUBST(DPKG)
9415     AC_SUBST(PKGMK)
9416 else
9417     for i in $PKGFORMAT; do
9418         case "$i" in
9419         bsd | deb | pkg | rpm | native | portable)
9420             AC_MSG_ERROR(
9421                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9422             ;;
9423         esac
9424     done
9425     AC_MSG_RESULT([no])
9426     EPM=NO
9428 AC_SUBST(EPM)
9430 ENABLE_LWP=
9431 if test "$enable_lotuswordpro" = "yes"; then
9432     ENABLE_LWP="TRUE"
9434 AC_SUBST(ENABLE_LWP)
9436 dnl ===================================================================
9437 dnl Check for building ODK
9438 dnl ===================================================================
9439 AC_MSG_CHECKING([whether to build the ODK])
9440 if test "$enable_odk" = yes; then
9441     if test "$DISABLE_DYNLOADING" = TRUE; then
9442         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9443     fi
9444     AC_MSG_RESULT([yes])
9445     BUILD_TYPE="$BUILD_TYPE ODK"
9446 else
9447     AC_MSG_RESULT([no])
9450 if test "$enable_odk" != yes; then
9451     unset DOXYGEN
9452 else
9453     if test "$with_doxygen" = no; then
9454         AC_MSG_CHECKING([for doxygen])
9455         unset DOXYGEN
9456         AC_MSG_RESULT([no])
9457     else
9458         if test "$with_doxygen" = yes; then
9459             AC_PATH_PROG([DOXYGEN], [doxygen])
9460             if test -z "$DOXYGEN"; then
9461                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9462             fi
9463             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9464                 if ! dot -V 2>/dev/null; then
9465                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9466                 fi
9467             fi
9468         else
9469             AC_MSG_CHECKING([for doxygen])
9470             PathFormat "$with_doxygen"
9471             DOXYGEN="$formatted_path_unix"
9472             AC_MSG_RESULT([$formatted_path])
9473         fi
9474         if test -n "$DOXYGEN"; then
9475             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9476             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9477             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9478                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9479             fi
9480         fi
9481         if test -n "$WSL_ONLY_AS_HELPER"; then
9482             dnl what really should be tested is whether it is doxygen from windows-realm
9483             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9484             dnl using doxygen from wsl container would be possible, but there's a performance
9485             dnl penalty when accessing the files outside the container
9486             AC_MSG_CHECKING([whether doxygen is a windows executable])
9487             if $(file "$DOXYGEN" | grep -q "PE32"); then
9488                 AC_MSG_RESULT([yes])
9489             else
9490                 AC_MSG_RESULT([no])
9491                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9492             fi
9493         fi
9494     fi
9496 AC_SUBST([DOXYGEN])
9498 dnl ==================================================================
9499 dnl libfuzzer
9500 dnl ==================================================================
9501 AC_MSG_CHECKING([whether to enable fuzzers])
9502 if test "$enable_fuzzers" != yes; then
9503     AC_MSG_RESULT([no])
9504 else
9505     if test -z $LIB_FUZZING_ENGINE; then
9506       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9507     fi
9508     AC_MSG_RESULT([yes])
9509     ENABLE_FUZZERS="TRUE"
9510     AC_DEFINE([ENABLE_FUZZERS],1)
9511     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9513 AC_SUBST(LIB_FUZZING_ENGINE)
9515 dnl ===================================================================
9516 dnl Check for system zlib
9517 dnl ===================================================================
9518 if test "$with_system_zlib" = "auto"; then
9519     case "$_os" in
9520     WINNT)
9521         with_system_zlib="$with_system_libs"
9522         ;;
9523     *)
9524         if test "$enable_fuzzers" != "yes"; then
9525             with_system_zlib=yes
9526         else
9527             with_system_zlib=no
9528         fi
9529         ;;
9530     esac
9533 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9534 dnl and has no pkg-config for it at least on some tinderboxes,
9535 dnl so leaving that out for now
9536 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9537 AC_MSG_CHECKING([which zlib to use])
9538 if test "$with_system_zlib" = "yes"; then
9539     AC_MSG_RESULT([external])
9540     SYSTEM_ZLIB=TRUE
9541     AC_CHECK_HEADER(zlib.h, [],
9542         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9543     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9544         [AC_MSG_ERROR(zlib not found or functional)], [])
9545 else
9546     AC_MSG_RESULT([internal])
9547     SYSTEM_ZLIB=
9548     BUILD_TYPE="$BUILD_TYPE ZLIB"
9549     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9550     if test "$COM" = "MSC"; then
9551         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9552     else
9553         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9554     fi
9556 AC_SUBST(ZLIB_CFLAGS)
9557 AC_SUBST(ZLIB_LIBS)
9558 AC_SUBST(SYSTEM_ZLIB)
9560 dnl ===================================================================
9561 dnl Check for system jpeg
9562 dnl ===================================================================
9563 AC_MSG_CHECKING([which libjpeg to use])
9564 if test "$with_system_jpeg" = "yes"; then
9565     AC_MSG_RESULT([external])
9566     SYSTEM_LIBJPEG=TRUE
9567     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9568         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9569     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9570         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9571 else
9572     SYSTEM_LIBJPEG=
9573     AC_MSG_RESULT([internal, libjpeg-turbo])
9574     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9576     case "$host_cpu" in
9577     x86_64 | amd64 | i*86 | x86 | ia32)
9578         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9579         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9580             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9581                 NASM="$LODE_HOME/opt/bin/nasm"
9582             elif test -x "/opt/lo/bin/nasm"; then
9583                 NASM="/opt/lo/bin/nasm"
9584             fi
9585         fi
9587         if test -n "$NASM"; then
9588             AC_MSG_CHECKING([for object file format of host system])
9589             case "$host_os" in
9590               cygwin* | mingw* | pw32* | wsl*)
9591                 case "$host_cpu" in
9592                   x86_64)
9593                     objfmt='Win64-COFF'
9594                     ;;
9595                   *)
9596                     objfmt='Win32-COFF'
9597                     ;;
9598                 esac
9599               ;;
9600               msdosdjgpp* | go32*)
9601                 objfmt='COFF'
9602               ;;
9603               os2-emx*) # not tested
9604                 objfmt='MSOMF' # obj
9605               ;;
9606               linux*coff* | linux*oldld*)
9607                 objfmt='COFF' # ???
9608               ;;
9609               linux*aout*)
9610                 objfmt='a.out'
9611               ;;
9612               linux*)
9613                 case "$host_cpu" in
9614                   x86_64)
9615                     objfmt='ELF64'
9616                     ;;
9617                   *)
9618                     objfmt='ELF'
9619                     ;;
9620                 esac
9621               ;;
9622               kfreebsd* | freebsd* | netbsd* | openbsd*)
9623                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9624                   objfmt='BSD-a.out'
9625                 else
9626                   case "$host_cpu" in
9627                     x86_64 | amd64)
9628                       objfmt='ELF64'
9629                       ;;
9630                     *)
9631                       objfmt='ELF'
9632                       ;;
9633                   esac
9634                 fi
9635               ;;
9636               solaris* | sunos* | sysv* | sco*)
9637                 case "$host_cpu" in
9638                   x86_64)
9639                     objfmt='ELF64'
9640                     ;;
9641                   *)
9642                     objfmt='ELF'
9643                     ;;
9644                 esac
9645               ;;
9646               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9647                 case "$host_cpu" in
9648                   x86_64)
9649                     objfmt='Mach-O64'
9650                     ;;
9651                   *)
9652                     objfmt='Mach-O'
9653                     ;;
9654                 esac
9655               ;;
9656               *)
9657                 objfmt='ELF ?'
9658               ;;
9659             esac
9661             AC_MSG_RESULT([$objfmt])
9662             if test "$objfmt" = 'ELF ?'; then
9663               objfmt='ELF'
9664               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9665             fi
9667             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9668             case "$objfmt" in
9669               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9670               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9671               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9672               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9673               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9674               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9675               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9676               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9677               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9678               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9679               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9680             esac
9681             AC_MSG_RESULT([$NAFLAGS])
9683             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9684             cat > conftest.asm << EOF
9685             [%line __oline__ "configure"
9686                     section .text
9687                     global  _main,main
9688             _main:
9689             main:   xor     eax,eax
9690                     ret
9691             ]
9693             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9694             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9695               AC_MSG_RESULT(yes)
9696             else
9697               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9698               cat conftest.asm >&AS_MESSAGE_LOG_FD
9699               rm -rf conftest*
9700               AC_MSG_RESULT(no)
9701               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9702               NASM=""
9703             fi
9705         fi
9707         if test -z "$NASM"; then
9708 cat << _EOS
9709 ****************************************************************************
9710 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9711 To get one please:
9713 _EOS
9714             if test "$build_os" = "cygwin"; then
9715 cat << _EOS
9716 install a pre-compiled binary for Win32
9718 mkdir -p /opt/lo/bin
9719 cd /opt/lo/bin
9720 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9721 chmod +x nasm
9723 or get and install one from https://www.nasm.us/
9725 Then re-run autogen.sh
9727 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9728 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9730 _EOS
9731             else
9732 cat << _EOS
9733 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9735 _EOS
9736             fi
9737             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9738             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9739         fi
9740       ;;
9741     esac
9744 AC_SUBST(NASM)
9745 AC_SUBST(NAFLAGS)
9746 AC_SUBST(LIBJPEG_CFLAGS)
9747 AC_SUBST(LIBJPEG_LIBS)
9748 AC_SUBST(SYSTEM_LIBJPEG)
9750 dnl ===================================================================
9751 dnl Check for system clucene
9752 dnl ===================================================================
9753 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9754 if test "$SYSTEM_CLUCENE" = TRUE; then
9755     AC_LANG_PUSH([C++])
9756     save_CXXFLAGS=$CXXFLAGS
9757     save_CPPFLAGS=$CPPFLAGS
9758     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9759     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9760     dnl https://sourceforge.net/p/clucene/bugs/200/
9761     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9762     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9763                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9764     CXXFLAGS=$save_CXXFLAGS
9765     CPPFLAGS=$save_CPPFLAGS
9766     AC_LANG_POP([C++])
9767     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9770 dnl ===================================================================
9771 dnl Check for system expat
9772 dnl ===================================================================
9773 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9775 dnl ===================================================================
9776 dnl Check for system xmlsec
9777 dnl ===================================================================
9778 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9780 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9781 if test "$enable_eot" = "yes"; then
9782     ENABLE_EOT="TRUE"
9783     AC_DEFINE([ENABLE_EOT])
9784     AC_MSG_RESULT([yes])
9786     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9787 else
9788     ENABLE_EOT=
9789     AC_MSG_RESULT([no])
9791 AC_SUBST([ENABLE_EOT])
9793 dnl ===================================================================
9794 dnl Check for DLP libs
9795 dnl ===================================================================
9796 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9797 AS_IF([test "$COM" = "MSC"],
9798       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9799       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9801 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9802 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9804 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9806 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9808 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9809 AS_IF([test "$COM" = "MSC"],
9810       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9811       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9813 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9814 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9816 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9818 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9819 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9821 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9823 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9825 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9827 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9828 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9830 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9831 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9833 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9835 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9836 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9838 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9840 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9842 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9844 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9846 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9847 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9849 dnl ===================================================================
9850 dnl Check for system lcms2
9851 dnl ===================================================================
9852 if test "$with_system_lcms2" != "yes"; then
9853     SYSTEM_LCMS2=
9855 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9856 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9857 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9858 if test "$GCC" = "yes"; then
9859     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9861 if test "$COM" = "MSC"; then # override the above
9862     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9865 dnl ===================================================================
9866 dnl Check for system cppunit
9867 dnl ===================================================================
9868 if test "$_os" != "Android" ; then
9869     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9872 dnl ===================================================================
9873 dnl Check whether freetype is available
9875 dnl FreeType has 3 different kinds of versions
9876 dnl * release, like 2.4.10
9877 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9878 dnl * soname
9879 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9881 dnl 9.9.3 is 2.2.0
9882 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9883 dnl ===================================================================
9884 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9885 if test "x$ac_config_site_64bit_host" = xYES; then
9886     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9887 else
9888     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9890 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9892 # ===================================================================
9893 # Check for system libxslt
9894 # to prevent incompatibilities between internal libxml2 and external libxslt,
9895 # or vice versa, use with_system_libxml here
9896 # ===================================================================
9897 if test "$with_system_libxml" = "auto"; then
9898     case "$_os" in
9899     WINNT|iOS|Android)
9900         with_system_libxml="$with_system_libs"
9901         ;;
9902     Emscripten)
9903         with_system_libxml=no
9904         ;;
9905     *)
9906         if test "$enable_fuzzers" != "yes"; then
9907             with_system_libxml=yes
9908         else
9909             with_system_libxml=no
9910         fi
9911         ;;
9912     esac
9915 AC_MSG_CHECKING([which libxslt to use])
9916 if test "$with_system_libxml" = "yes"; then
9917     AC_MSG_RESULT([external])
9918     SYSTEM_LIBXSLT=TRUE
9919     if test "$_os" = "Darwin"; then
9920         dnl make sure to use SDK path
9921         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9922         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9923         dnl omit -L/usr/lib
9924         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9925         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9926     else
9927         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9928         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9929         FilterLibs "${LIBXSLT_LIBS}"
9930         LIBXSLT_LIBS="${filteredlibs}"
9931         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9932         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9933         FilterLibs "${LIBEXSLT_LIBS}"
9934         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9935     fi
9937     dnl Check for xsltproc
9938     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9939     if test "$XSLTPROC" = "no"; then
9940         AC_MSG_ERROR([xsltproc is required])
9941     fi
9942 else
9943     AC_MSG_RESULT([internal])
9944     SYSTEM_LIBXSLT=
9945     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9947 AC_SUBST(SYSTEM_LIBXSLT)
9948 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9949     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9951 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9953 AC_SUBST(LIBEXSLT_CFLAGS)
9954 AC_SUBST(LIBEXSLT_LIBS)
9955 AC_SUBST(LIBXSLT_CFLAGS)
9956 AC_SUBST(LIBXSLT_LIBS)
9957 AC_SUBST(XSLTPROC)
9959 # ===================================================================
9960 # Check for system libxml
9961 # ===================================================================
9962 AC_MSG_CHECKING([which libxml to use])
9963 if test "$with_system_libxml" = "yes"; then
9964     AC_MSG_RESULT([external])
9965     SYSTEM_LIBXML=TRUE
9966     if test "$_os" = "Darwin"; then
9967         dnl make sure to use SDK path
9968         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9969         dnl omit -L/usr/lib
9970         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9971     elif test $_os = iOS; then
9972         dnl make sure to use SDK path
9973         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9974         LIBXML_CFLAGS="-I$usr/include/libxml2"
9975         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9976     else
9977         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9978         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9979         FilterLibs "${LIBXML_LIBS}"
9980         LIBXML_LIBS="${filteredlibs}"
9981     fi
9983     dnl Check for xmllint
9984     AC_PATH_PROG(XMLLINT, xmllint, no)
9985     if test "$XMLLINT" = "no"; then
9986         AC_MSG_ERROR([xmllint is required])
9987     fi
9988 else
9989     AC_MSG_RESULT([internal])
9990     SYSTEM_LIBXML=
9991     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9992     if test "$COM" = "MSC"; then
9993         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9994     fi
9995     if test "$COM" = "MSC"; then
9996         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9997     else
9998         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9999         if test "$DISABLE_DYNLOADING" = TRUE; then
10000             LIBXML_LIBS="$LIBXML_LIBS -lm"
10001         fi
10002     fi
10003     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10005 AC_SUBST(SYSTEM_LIBXML)
10006 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10007     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10009 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10010 AC_SUBST(LIBXML_CFLAGS)
10011 AC_SUBST(LIBXML_LIBS)
10012 AC_SUBST(XMLLINT)
10014 # =====================================================================
10015 # Checking for a Python interpreter with version >= 3.3.
10016 # Optionally user can pass an option to configure, i. e.
10017 # ./configure PYTHON=/usr/bin/python
10018 # =====================================================================
10019 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10020     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10021     # unless PYTHON is defined as above which allows 'system'
10022     enable_python=internal
10024 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10025     if test -n "$PYTHON"; then
10026         PYTHON_FOR_BUILD=$PYTHON
10027     else
10028         # This allows a lack of system python with no error, we use internal one in that case.
10029         AM_PATH_PYTHON([3.3],, [:])
10030         # Clean PYTHON_VERSION checked below if cross-compiling
10031         PYTHON_VERSION=""
10032         if test "$PYTHON" != ":"; then
10033             PYTHON_FOR_BUILD=$PYTHON
10034         fi
10035     fi
10038 # Checks for Python to use for Pyuno
10039 AC_MSG_CHECKING([which Python to use for Pyuno])
10040 case "$enable_python" in
10041 no|disable)
10042     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10043         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10044         # requirement from the choice whether to include Python stuff in the installer, but why
10045         # bother?
10046         AC_MSG_ERROR([Python is required at build time.])
10047     fi
10048     enable_python=no
10049     AC_MSG_RESULT([none])
10050     ;;
10051 ""|yes|auto)
10052     if test "$DISABLE_SCRIPTING" = TRUE; then
10053         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10054             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10055         fi
10056         AC_MSG_RESULT([none, overridden by --disable-scripting])
10057         enable_python=no
10058     elif test $build_os = cygwin -o $build_os = wsl; then
10059         dnl When building on Windows we don't attempt to use any installed
10060         dnl "system"  Python.
10061         AC_MSG_RESULT([fully internal])
10062         enable_python=internal
10063     elif test "$cross_compiling" = yes; then
10064         AC_MSG_RESULT([system])
10065         enable_python=system
10066     else
10067         # Unset variables set by the above AM_PATH_PYTHON so that
10068         # we actually do check anew.
10069         AC_MSG_RESULT([])
10070         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
10071         AM_PATH_PYTHON([3.3],, [:])
10072         AC_MSG_CHECKING([which Python to use for Pyuno])
10073         if test "$PYTHON" = ":"; then
10074             if test -z "$PYTHON_FOR_BUILD"; then
10075                 AC_MSG_RESULT([fully internal])
10076             else
10077                 AC_MSG_RESULT([internal])
10078             fi
10079             enable_python=internal
10080         else
10081             AC_MSG_RESULT([system])
10082             enable_python=system
10083         fi
10084     fi
10085     ;;
10086 internal)
10087     AC_MSG_RESULT([internal])
10088     ;;
10089 fully-internal)
10090     AC_MSG_RESULT([fully internal])
10091     enable_python=internal
10092     ;;
10093 system)
10094     AC_MSG_RESULT([system])
10095     if test "$_os" = Darwin -a -z "$PYTHON"; then
10096         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10097     fi
10098     ;;
10100     AC_MSG_ERROR([Incorrect --enable-python option])
10101     ;;
10102 esac
10104 if test $enable_python != no; then
10105     BUILD_TYPE="$BUILD_TYPE PYUNO"
10108 if test $enable_python = system; then
10109     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10110         # Fallback: Accept these in the environment, or as set above
10111         # for MacOSX.
10112         :
10113     elif test "$cross_compiling" != yes; then
10114         # Unset variables set by the above AM_PATH_PYTHON so that
10115         # we actually do check anew.
10116         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
10117         # This causes an error if no python command is found
10118         AM_PATH_PYTHON([3.3])
10119         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10120         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10121         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10122         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10123         if test -z "$PKG_CONFIG"; then
10124             PYTHON_CFLAGS="-I$python_include"
10125             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10126         elif $PKG_CONFIG --exists python-$python_version-embed; then
10127             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10128             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10129         elif $PKG_CONFIG --exists python-$python_version; then
10130             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10131             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10132         else
10133             PYTHON_CFLAGS="-I$python_include"
10134             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10135         fi
10136         FilterLibs "${PYTHON_LIBS}"
10137         PYTHON_LIBS="${filteredlibs}"
10138     else
10139         dnl How to find out the cross-compilation Python installation path?
10140         AC_MSG_CHECKING([for python version])
10141         AS_IF([test -n "$PYTHON_VERSION"],
10142               [AC_MSG_RESULT([$PYTHON_VERSION])],
10143               [AC_MSG_RESULT([not found])
10144                AC_MSG_ERROR([no usable python found])])
10145         test -n "$PYTHON_CFLAGS" && break
10146     fi
10148     dnl Check if the headers really work
10149     save_CPPFLAGS="$CPPFLAGS"
10150     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10151     AC_CHECK_HEADER(Python.h)
10152     CPPFLAGS="$save_CPPFLAGS"
10154     # let the PYTHON_FOR_BUILD match the same python installation that
10155     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10156     # better for PythonTests.
10157     PYTHON_FOR_BUILD=$PYTHON
10160 if test "$with_lxml" != no; then
10161     if test -z "$PYTHON_FOR_BUILD"; then
10162         case $build_os in
10163             cygwin)
10164                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10165                 ;;
10166             *)
10167                 if test "$cross_compiling" != yes ; then
10168                     BUILD_TYPE="$BUILD_TYPE LXML"
10169                 fi
10170                 ;;
10171         esac
10172     else
10173         AC_MSG_CHECKING([for python lxml])
10174         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10175             AC_MSG_RESULT([yes])
10176         else
10177             case $build_os in
10178                 cygwin)
10179                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10180                     ;;
10181                 *)
10182                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10183                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10184                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10185                         else
10186                             BUILD_TYPE="$BUILD_TYPE LXML"
10187                             AC_MSG_RESULT([no, using internal lxml])
10188                         fi
10189                     else
10190                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10191                     fi
10192                     ;;
10193             esac
10194         fi
10195     fi
10198 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10199     SYSTEM_PYTHON=
10200     PYTHON_VERSION_MAJOR=3
10201     PYTHON_VERSION_MINOR=9
10202     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.19
10203     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10204         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10205     fi
10206     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10208     # Embedded Python dies without Home set
10209     if test "$HOME" = ""; then
10210         export HOME=""
10211     fi
10214 dnl By now enable_python should be "system", "internal" or "no"
10215 case $enable_python in
10216 system)
10217     SYSTEM_PYTHON=TRUE
10219     if test "x$ac_cv_header_Python_h" != "xyes"; then
10220        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10221     fi
10223     AC_LANG_PUSH(C)
10224     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10225     AC_MSG_CHECKING([for correct python library version])
10226        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10227 #include <Python.h>
10229 int main(int argc, char **argv) {
10230    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10231    else return 1;
10233        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10234     AC_LANG_POP(C)
10236     dnl FIXME Check if the Python library can be linked with, too?
10237     ;;
10239 internal)
10240     BUILD_TYPE="$BUILD_TYPE PYTHON"
10241     if test "$OS" = LINUX -o "$OS" = WNT ; then
10242         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10243     fi
10244     ;;
10246     DISABLE_PYTHON=TRUE
10247     SYSTEM_PYTHON=
10248     ;;
10250     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10251     ;;
10252 esac
10254 AC_SUBST(DISABLE_PYTHON)
10255 AC_SUBST(SYSTEM_PYTHON)
10256 AC_SUBST(PYTHON_CFLAGS)
10257 AC_SUBST(PYTHON_FOR_BUILD)
10258 AC_SUBST(PYTHON_LIBS)
10259 AC_SUBST(PYTHON_VERSION)
10260 AC_SUBST(PYTHON_VERSION_MAJOR)
10261 AC_SUBST(PYTHON_VERSION_MINOR)
10263 AC_MSG_CHECKING([whether to build LibreLogo])
10264 case "$enable_python" in
10265 no|disable)
10266     AC_MSG_RESULT([no; Python disabled])
10267     ;;
10269     if test "${enable_librelogo}" = "no"; then
10270         AC_MSG_RESULT([no])
10271     else
10272         AC_MSG_RESULT([yes])
10273         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10274         AC_DEFINE([ENABLE_LIBRELOGO],1)
10275     fi
10276     ;;
10277 esac
10278 AC_SUBST(ENABLE_LIBRELOGO)
10280 ENABLE_MARIADBC=
10281 MARIADBC_MAJOR=1
10282 MARIADBC_MINOR=0
10283 MARIADBC_MICRO=2
10284 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10285 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10286     ENABLE_MARIADBC=TRUE
10287     AC_MSG_RESULT([yes])
10288     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10289 else
10290     AC_MSG_RESULT([no])
10292 AC_SUBST(ENABLE_MARIADBC)
10293 AC_SUBST(MARIADBC_MAJOR)
10294 AC_SUBST(MARIADBC_MINOR)
10295 AC_SUBST(MARIADBC_MICRO)
10297 if test "$ENABLE_MARIADBC" = "TRUE"; then
10298     dnl ===================================================================
10299     dnl Check for system MariaDB
10300     dnl ===================================================================
10302     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10303         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10304     fi
10306     AC_MSG_CHECKING([which MariaDB to use])
10307     if test "$with_system_mariadb" = "yes"; then
10308         AC_MSG_RESULT([external])
10309         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10310         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10311         if test -z "$MARIADBCONFIG"; then
10312             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10313             if test -z "$MARIADBCONFIG"; then
10314                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10315                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10316             fi
10317         fi
10318         AC_MSG_CHECKING([MariaDB version])
10319         MARIADB_VERSION=`$MARIADBCONFIG --version`
10320         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10321         if test "$MARIADB_MAJOR" -ge "5"; then
10322             AC_MSG_RESULT([OK])
10323         else
10324             AC_MSG_ERROR([too old, use 5.0.x or later])
10325         fi
10326         AC_MSG_CHECKING([for MariaDB Client library])
10327         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10328         if test "$COM_IS_CLANG" = TRUE; then
10329             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10330         fi
10331         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10332         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10333         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10334         dnl linux32:
10335         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10336             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10337             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10338                 | sed -e 's|/lib64/|/lib/|')
10339         fi
10340         FilterLibs "${MARIADB_LIBS}"
10341         MARIADB_LIBS="${filteredlibs}"
10342         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10343         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10344         if test "$enable_bundle_mariadb" = "yes"; then
10345             AC_MSG_RESULT([yes])
10346             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10347             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10349 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10351 /g' | grep -E '(mysqlclient|mariadb)')
10352             if test "$_os" = "Darwin"; then
10353                 LIBMARIADB=${LIBMARIADB}.dylib
10354                 if test "$with_gssapi" != "no"; then
10355                     WITH_GSSAPI=TRUE
10356                     save_LIBS=$LIBS
10357                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10358                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10359                     GSSAPI_LIBS=$LIBS
10360                     LIBS=$save_LIBS
10361                 fi
10362             elif test "$_os" = "WINNT"; then
10363                 LIBMARIADB=${LIBMARIADB}.dll
10364             else
10365                 LIBMARIADB=${LIBMARIADB}.so
10366                 if test "$with_gssapi" != "no"; then
10367                     WITH_GSSAPI=TRUE
10368                     save_LIBS=$LIBS
10369                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10370                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10371                     GSSAPI_LIBS=$LIBS
10372                     LIBS=$save_LIBS
10373                 fi
10374             fi
10375             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10376             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10377             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10378                 AC_MSG_RESULT([found.])
10379                 PathFormat "$LIBMARIADB_PATH"
10380                 LIBMARIADB_PATH="$formatted_path"
10381             else
10382                 AC_MSG_ERROR([not found.])
10383             fi
10384         else
10385             AC_MSG_RESULT([no])
10386             BUNDLE_MARIADB_CONNECTOR_C=
10387         fi
10388     else
10389         AC_MSG_RESULT([internal])
10390         SYSTEM_MARIADB_CONNECTOR_C=
10391         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10392         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10393         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10394     fi
10396     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10397     AC_SUBST(MARIADB_CFLAGS)
10398     AC_SUBST(MARIADB_LIBS)
10399     AC_SUBST(LIBMARIADB)
10400     AC_SUBST(LIBMARIADB_PATH)
10401     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10404 dnl ===================================================================
10405 dnl Check for system hsqldb
10406 dnl ===================================================================
10407 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10408     AC_MSG_CHECKING([which hsqldb to use])
10409     if test "$with_system_hsqldb" = "yes"; then
10410         AC_MSG_RESULT([external])
10411         SYSTEM_HSQLDB=TRUE
10412         if test -z $HSQLDB_JAR; then
10413             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10414         fi
10415         if ! test -f $HSQLDB_JAR; then
10416                AC_MSG_ERROR(hsqldb.jar not found.)
10417         fi
10418         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10419         export HSQLDB_JAR
10420         if $PERL -e \
10421            'use Archive::Zip;
10422             my $file = "$ENV{'HSQLDB_JAR'}";
10423             my $zip = Archive::Zip->new( $file );
10424             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10425             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10426             {
10427                 push @l, split(/\n/, $mf);
10428                 foreach my $line (@l)
10429                 {
10430                     if ($line =~ m/Specification-Version:/)
10431                     {
10432                         ($t, $version) = split (/:/,$line);
10433                         $version =~ s/^\s//;
10434                         ($a, $b, $c, $d) = split (/\./,$version);
10435                         if ($c == "0" && $d > "8")
10436                         {
10437                             exit 0;
10438                         }
10439                         else
10440                         {
10441                             exit 1;
10442                         }
10443                     }
10444                 }
10445             }
10446             else
10447             {
10448                 exit 1;
10449             }'; then
10450             AC_MSG_RESULT([yes])
10451         else
10452             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10453         fi
10454     else
10455         AC_MSG_RESULT([internal])
10456         SYSTEM_HSQLDB=
10457         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10458         NEED_ANT=TRUE
10459     fi
10460 else
10461     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10462         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10463     fi
10465 AC_SUBST(SYSTEM_HSQLDB)
10466 AC_SUBST(HSQLDB_JAR)
10468 dnl ===================================================================
10469 dnl Check for PostgreSQL stuff
10470 dnl ===================================================================
10471 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10472 if test "x$enable_postgresql_sdbc" != "xno"; then
10473     AC_MSG_RESULT([yes])
10474     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10476     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10477         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10478     fi
10479     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10480         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10481     fi
10483     postgres_interface=""
10484     if test "$with_system_postgresql" = "yes"; then
10485         postgres_interface="external PostgreSQL"
10486         SYSTEM_POSTGRESQL=TRUE
10487         if test "$_os" = Darwin; then
10488             supp_path=''
10489             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10490                 pg_supp_path="$P_SEP$d$pg_supp_path"
10491             done
10492         fi
10493         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10494         if test -n "$PGCONFIG"; then
10495             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10496             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10497         else
10498             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10499               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10500               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10501             ],[
10502               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10503             ])
10504         fi
10505         FilterLibs "${POSTGRESQL_LIB}"
10506         POSTGRESQL_LIB="${filteredlibs}"
10507     else
10508         # if/when anything else than PostgreSQL uses Kerberos,
10509         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10510         WITH_KRB5=
10511         WITH_GSSAPI=
10512         case "$_os" in
10513         Darwin)
10514             # macOS has system MIT Kerberos 5 since 10.4
10515             if test "$with_krb5" != "no"; then
10516                 WITH_KRB5=TRUE
10517                 save_LIBS=$LIBS
10518                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10519                 # that the libraries where these functions are located on macOS will change, is it?
10520                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10521                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10522                 KRB5_LIBS=$LIBS
10523                 LIBS=$save_LIBS
10524                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10525                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10526                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10527                 LIBS=$save_LIBS
10528             fi
10529             if test "$with_gssapi" != "no"; then
10530                 WITH_GSSAPI=TRUE
10531                 save_LIBS=$LIBS
10532                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10533                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10534                 GSSAPI_LIBS=$LIBS
10535                 LIBS=$save_LIBS
10536             fi
10537             ;;
10538         WINNT)
10539             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10540                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10541             fi
10542             ;;
10543         Linux|GNU|*BSD|DragonFly)
10544             if test "$with_krb5" != "no"; then
10545                 WITH_KRB5=TRUE
10546                 save_LIBS=$LIBS
10547                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10548                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10549                 KRB5_LIBS=$LIBS
10550                 LIBS=$save_LIBS
10551                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10552                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10553                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10554                 LIBS=$save_LIBS
10555             fi
10556             if test "$with_gssapi" != "no"; then
10557                 WITH_GSSAPI=TRUE
10558                 save_LIBS=$LIBS
10559                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10560                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10561                 GSSAPI_LIBS=$LIBS
10562                 LIBS=$save_LIBS
10563             fi
10564             ;;
10565         *)
10566             if test "$with_krb5" = "yes"; then
10567                 WITH_KRB5=TRUE
10568                 save_LIBS=$LIBS
10569                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10570                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10571                 KRB5_LIBS=$LIBS
10572                 LIBS=$save_LIBS
10573                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10574                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10575                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10576                 LIBS=$save_LIBS
10577             fi
10578             if test "$with_gssapi" = "yes"; then
10579                 WITH_GSSAPI=TRUE
10580                 save_LIBS=$LIBS
10581                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10582                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10583                 LIBS=$save_LIBS
10584                 GSSAPI_LIBS=$LIBS
10585             fi
10586         esac
10588         if test -n "$with_libpq_path"; then
10589             SYSTEM_POSTGRESQL=TRUE
10590             postgres_interface="external libpq"
10591             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10592             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10593         else
10594             SYSTEM_POSTGRESQL=
10595             postgres_interface="internal"
10596             POSTGRESQL_LIB=""
10597             POSTGRESQL_INC="%OVERRIDE_ME%"
10598             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10599         fi
10600     fi
10602     AC_MSG_CHECKING([PostgreSQL C interface])
10603     AC_MSG_RESULT([$postgres_interface])
10605     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10606         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10607         save_CFLAGS=$CFLAGS
10608         save_CPPFLAGS=$CPPFLAGS
10609         save_LIBS=$LIBS
10610         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10611         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10612         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10613         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10614             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10615         CFLAGS=$save_CFLAGS
10616         CPPFLAGS=$save_CPPFLAGS
10617         LIBS=$save_LIBS
10618     fi
10619     BUILD_POSTGRESQL_SDBC=TRUE
10620 else
10621     AC_MSG_RESULT([no])
10623 AC_SUBST(WITH_KRB5)
10624 AC_SUBST(WITH_GSSAPI)
10625 AC_SUBST(GSSAPI_LIBS)
10626 AC_SUBST(KRB5_LIBS)
10627 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10628 AC_SUBST(SYSTEM_POSTGRESQL)
10629 AC_SUBST(POSTGRESQL_INC)
10630 AC_SUBST(POSTGRESQL_LIB)
10632 dnl ===================================================================
10633 dnl Check for Firebird stuff
10634 dnl ===================================================================
10635 ENABLE_FIREBIRD_SDBC=
10636 if test "$enable_firebird_sdbc" = "yes" ; then
10637     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10639     dnl ===================================================================
10640     dnl Check for system Firebird
10641     dnl ===================================================================
10642     AC_MSG_CHECKING([which Firebird to use])
10643     if test "$with_system_firebird" = "yes"; then
10644         AC_MSG_RESULT([external])
10645         SYSTEM_FIREBIRD=TRUE
10646         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10647         if test -z "$FIREBIRDCONFIG"; then
10648             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10649             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10650                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10651             ])
10652             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10653         else
10654             AC_MSG_NOTICE([fb_config found])
10655             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10656             AC_MSG_CHECKING([for Firebird Client library])
10657             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10658             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10659             FilterLibs "${FIREBIRD_LIBS}"
10660             FIREBIRD_LIBS="${filteredlibs}"
10661         fi
10662         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10663         AC_MSG_CHECKING([Firebird version])
10664         if test -n "${FIREBIRD_VERSION}"; then
10665             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10666             if test "$FIREBIRD_MAJOR" -ge "3"; then
10667                 AC_MSG_RESULT([OK])
10668             else
10669                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10670             fi
10671         else
10672             save_CFLAGS="${CFLAGS}"
10673             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10674             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10675 #if defined(FB_API_VER) && FB_API_VER == 30
10676 int fb_api_is_30(void) { return 0; }
10677 #else
10678 #error "Wrong Firebird API version"
10679 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10680             CFLAGS="$save_CFLAGS"
10681         fi
10682         ENABLE_FIREBIRD_SDBC=TRUE
10683         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10684     elif test "$enable_database_connectivity" = no; then
10685         AC_MSG_RESULT([none])
10686     elif test "$cross_compiling" = "yes"; then
10687         AC_MSG_RESULT([none])
10688     else
10689         dnl Embedded Firebird has version 3.0
10690         dnl We need libatomic_ops for any non X86/X64 system
10691         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10692             dnl ===================================================================
10693             dnl Check for system libatomic_ops
10694             dnl ===================================================================
10695             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10696             if test "$with_system_libatomic_ops" = "yes"; then
10697                 SYSTEM_LIBATOMIC_OPS=TRUE
10698                 AC_CHECK_HEADERS(atomic_ops.h, [],
10699                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10700             else
10701                 SYSTEM_LIBATOMIC_OPS=
10702                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10703                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10704                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10705             fi
10706         fi
10708         AC_MSG_RESULT([internal])
10709         SYSTEM_FIREBIRD=
10710         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10711         FIREBIRD_LIBS="-lfbclient"
10713         if test "$with_system_libtommath" = "yes"; then
10714             SYSTEM_LIBTOMMATH=TRUE
10715             dnl check for tommath presence
10716             save_LIBS=$LIBS
10717             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10718             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10719             LIBS=$save_LIBS
10720         else
10721             SYSTEM_LIBTOMMATH=
10722             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10723             LIBTOMMATH_LIBS="-ltommath"
10724             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10725         fi
10727         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10728         ENABLE_FIREBIRD_SDBC=TRUE
10729         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10730     fi
10732 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10733 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10734 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10735 AC_SUBST(LIBATOMIC_OPS_LIBS)
10736 AC_SUBST(SYSTEM_FIREBIRD)
10737 AC_SUBST(FIREBIRD_CFLAGS)
10738 AC_SUBST(FIREBIRD_LIBS)
10739 AC_SUBST(SYSTEM_LIBTOMMATH)
10740 AC_SUBST(LIBTOMMATH_CFLAGS)
10741 AC_SUBST(LIBTOMMATH_LIBS)
10743 dnl ===================================================================
10744 dnl Check for system curl
10745 dnl ===================================================================
10746 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10748 if test "$enable_curl" = "yes" -a "$with_system_curl" != "yes" -a "$with_gssapi" != "no"; then
10749     if test "$_os" != "WINNT"; then
10750         WITH_GSSAPI=TRUE
10751         save_LIBS=$LIBS
10752         AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10753             [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10754         GSSAPI_LIBS=$LIBS
10755         LIBS=$save_LIBS
10756     fi
10759 dnl ===================================================================
10760 dnl Check for system boost
10761 dnl ===================================================================
10762 AC_MSG_CHECKING([which boost to use])
10763 if test "$with_system_boost" = "yes"; then
10764     AC_MSG_RESULT([external])
10765     SYSTEM_BOOST=TRUE
10766     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10767     AX_BOOST_DATE_TIME
10768     AX_BOOST_FILESYSTEM
10769     AX_BOOST_IOSTREAMS
10770     AX_BOOST_LOCALE
10771     AC_LANG_PUSH([C++])
10772     save_CXXFLAGS=$CXXFLAGS
10773     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10774     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10775        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10776     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10777        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10778     CXXFLAGS=$save_CXXFLAGS
10779     AC_LANG_POP([C++])
10780     # this is in m4/ax_boost_base.m4
10781     FilterLibs "${BOOST_LDFLAGS}"
10782     BOOST_LDFLAGS="${filteredlibs}"
10783 else
10784     AC_MSG_RESULT([internal])
10785     BUILD_TYPE="$BUILD_TYPE BOOST"
10786     SYSTEM_BOOST=
10787     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10788         # use warning-suppressing wrapper headers
10789         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10790     else
10791         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10792     fi
10794 AC_SUBST(SYSTEM_BOOST)
10796 dnl ===================================================================
10797 dnl Check for system mdds
10798 dnl ===================================================================
10799 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10800 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10802 dnl ===================================================================
10803 dnl Check for system dragonbox
10804 dnl ===================================================================
10805 AC_MSG_CHECKING([which dragonbox to use])
10806 if test "$with_system_dragonbox" = "yes"; then
10807     AC_MSG_RESULT([external])
10808     SYSTEM_DRAGONBOX=TRUE
10809     AC_LANG_PUSH([C++])
10810     save_CPPFLAGS=$CPPFLAGS
10811     # This is where upstream installs to, unfortunately no .pc or so...
10812     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10813     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10814     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10815        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10816     AC_LANG_POP([C++])
10817     CPPFLAGS=$save_CPPFLAGS
10818 else
10819     AC_MSG_RESULT([internal])
10820     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10821     SYSTEM_DRAGONBOX=
10823 AC_SUBST([SYSTEM_DRAGONBOX])
10824 AC_SUBST([DRAGONBOX_CFLAGS])
10826 dnl ===================================================================
10827 dnl Check for system frozen
10828 dnl ===================================================================
10829 AC_MSG_CHECKING([which frozen to use])
10830 if test "$with_system_frozen" = "yes"; then
10831     AC_MSG_RESULT([external])
10832     SYSTEM_FROZEN=TRUE
10833     AC_LANG_PUSH([C++])
10834     save_CPPFLAGS=$CPPFLAGS
10835     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10836        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10837     AC_LANG_POP([C++])
10838     CPPFLAGS=$save_CPPFLAGS
10839 else
10840     AC_MSG_RESULT([internal])
10841     BUILD_TYPE="$BUILD_TYPE FROZEN"
10842     SYSTEM_FROZEN=
10844 AC_SUBST([SYSTEM_FROZEN])
10845 AC_SUBST([FROZEN_CFLAGS])
10847 dnl ===================================================================
10848 dnl Check for system libfixmath
10849 dnl ===================================================================
10850 AC_MSG_CHECKING([which libfixmath to use])
10851 if test "$with_system_libfixmath" = "yes"; then
10852     AC_MSG_RESULT([external])
10853     SYSTEM_LIBFIXMATH=TRUE
10854     AC_LANG_PUSH([C++])
10855     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10856        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10857     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10858                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10859                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10860     AC_LANG_POP([C++])
10861 else
10862     AC_MSG_RESULT([internal])
10863     SYSTEM_LIBFIXMATH=
10864     LIBFIXMATH_LIBS=
10866 AC_SUBST([SYSTEM_LIBFIXMATH])
10867 AC_SUBST([LIBFIXMATH_LIBS])
10869 dnl ===================================================================
10870 dnl Check for system glm
10871 dnl ===================================================================
10872 AC_MSG_CHECKING([which glm to use])
10873 if test "$with_system_glm" = "yes"; then
10874     AC_MSG_RESULT([external])
10875     SYSTEM_GLM=TRUE
10876     AC_LANG_PUSH([C++])
10877     AC_CHECK_HEADER([glm/glm.hpp], [],
10878        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10879     AC_LANG_POP([C++])
10880 else
10881     AC_MSG_RESULT([internal])
10882     BUILD_TYPE="$BUILD_TYPE GLM"
10883     SYSTEM_GLM=
10884     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10886 AC_SUBST([GLM_CFLAGS])
10887 AC_SUBST([SYSTEM_GLM])
10889 dnl ===================================================================
10890 dnl Check for system odbc
10891 dnl ===================================================================
10892 AC_MSG_CHECKING([which odbc headers to use])
10893 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
10894     AC_MSG_RESULT([external])
10895     SYSTEM_ODBC_HEADERS=TRUE
10897     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10898         save_CPPFLAGS=$CPPFLAGS
10899         find_winsdk
10900         PathFormat "$winsdktest"
10901         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"
10902         AC_CHECK_HEADER(sqlext.h, [],
10903             [AC_MSG_ERROR(odbc not found. install odbc)],
10904             [#include <windows.h>])
10905         CPPFLAGS=$save_CPPFLAGS
10906     else
10907         AC_CHECK_HEADER(sqlext.h, [],
10908             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10909     fi
10910 elif test "$enable_database_connectivity" = no; then
10911     AC_MSG_RESULT([none])
10912 else
10913     AC_MSG_RESULT([internal])
10914     SYSTEM_ODBC_HEADERS=
10916 AC_SUBST(SYSTEM_ODBC_HEADERS)
10918 dnl ===================================================================
10919 dnl Check for system NSS
10920 dnl ===================================================================
10921 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10922     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10923     AC_DEFINE(HAVE_FEATURE_NSS)
10924     ENABLE_NSS=TRUE
10925 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10926     with_tls=openssl
10928 AC_SUBST(ENABLE_NSS)
10930 dnl ===================================================================
10931 dnl Enable LDAP support
10932 dnl ===================================================================
10934 if test "$test_openldap" = yes; then
10935     AC_MSG_CHECKING([whether to enable LDAP support])
10936     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10937         AC_MSG_RESULT([yes])
10938         ENABLE_LDAP=TRUE
10939     else
10940         if test "$enable_ldap" != "yes"; then
10941             AC_MSG_RESULT([no])
10942         else
10943             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10944         fi
10945     fi
10947 dnl ===================================================================
10948 dnl Check for system openldap
10949 dnl ===================================================================
10951     if test "$ENABLE_LDAP" = TRUE; then
10952         AC_MSG_CHECKING([which openldap library to use])
10953         if test "$with_system_openldap" = yes; then
10954             AC_MSG_RESULT([external])
10955             SYSTEM_OPENLDAP=TRUE
10956             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10957             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10958             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10959         else
10960             AC_MSG_RESULT([internal])
10961             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10962         fi
10963     fi
10966 AC_SUBST(ENABLE_LDAP)
10967 AC_SUBST(SYSTEM_OPENLDAP)
10969 dnl ===================================================================
10970 dnl Check for TLS/SSL and cryptographic implementation to use
10971 dnl ===================================================================
10972 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10973 if test -n "$with_tls"; then
10974     case $with_tls in
10975     openssl)
10976         AC_DEFINE(USE_TLS_OPENSSL)
10977         TLS=OPENSSL
10978         AC_MSG_RESULT([$TLS])
10980         if test "$enable_openssl" != "yes"; then
10981             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10982         fi
10984         # warn that OpenSSL has been selected but not all TLS code has this option
10985         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10986         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10987         ;;
10988     nss)
10989         AC_DEFINE(USE_TLS_NSS)
10990         TLS=NSS
10991         AC_MSG_RESULT([$TLS])
10992         ;;
10993     no)
10994         AC_MSG_RESULT([none])
10995         AC_MSG_WARN([Skipping TLS/SSL])
10996         ;;
10997     *)
10998         AC_MSG_RESULT([])
10999         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
11000 openssl - OpenSSL
11001 nss - Mozilla's Network Security Services (NSS)
11002     ])
11003         ;;
11004     esac
11005 else
11006     # default to using NSS, it results in smaller oox lib
11007     AC_DEFINE(USE_TLS_NSS)
11008     TLS=NSS
11009     AC_MSG_RESULT([$TLS])
11011 AC_SUBST(TLS)
11013 dnl ===================================================================
11014 dnl Check for system sane
11015 dnl ===================================================================
11016 AC_MSG_CHECKING([which sane header to use])
11017 if test "$with_system_sane" = "yes"; then
11018     AC_MSG_RESULT([external])
11019     AC_CHECK_HEADER(sane/sane.h, [],
11020       [AC_MSG_ERROR(sane not found. install sane)], [])
11021 else
11022     AC_MSG_RESULT([internal])
11023     BUILD_TYPE="$BUILD_TYPE SANE"
11026 dnl ===================================================================
11027 dnl Check for system icu
11028 dnl ===================================================================
11029 ICU_MAJOR=74
11030 ICU_MINOR=2
11031 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11032 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
11033 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11034 if test "$SYSTEM_ICU" = TRUE; then
11035     AC_LANG_PUSH([C++])
11036     AC_MSG_CHECKING([for unicode/rbbi.h])
11037     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11038     AC_LANG_POP([C++])
11040     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11041     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11042     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11044     if test "$CROSS_COMPILING" != TRUE; then
11045         # using the system icu tools can lead to version confusion, use the
11046         # ones from the build environment when cross-compiling
11047         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11048         if test -z "$SYSTEM_GENBRK"; then
11049             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11050         fi
11051         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11052         if test -z "$SYSTEM_GENCCODE"; then
11053             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11054         fi
11055         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11056         if test -z "$SYSTEM_GENCMN"; then
11057             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11058         fi
11059     fi
11062 AC_SUBST(SYSTEM_GENBRK)
11063 AC_SUBST(SYSTEM_GENCCODE)
11064 AC_SUBST(SYSTEM_GENCMN)
11065 AC_SUBST(ICU_MAJOR)
11066 AC_SUBST(ICU_MINOR)
11068 dnl ==================================================================
11069 dnl CURL
11070 dnl ==================================================================
11071 if test "$enable_curl" = "yes"; then
11072     AC_DEFINE([HAVE_FEATURE_CURL])
11075 dnl ==================================================================
11076 dnl Breakpad
11077 dnl ==================================================================
11078 DEFAULT_CRASHDUMP_VALUE="true"
11079 AC_MSG_CHECKING([whether to enable breakpad])
11080 if test "$enable_breakpad" != yes; then
11081     AC_MSG_RESULT([no])
11082 else
11083     if test "$enable_curl" != "yes"; then
11084         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11085     fi
11086     AC_MSG_RESULT([yes])
11087     ENABLE_BREAKPAD="TRUE"
11088     AC_DEFINE(ENABLE_BREAKPAD)
11089     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11090     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11092     AC_MSG_CHECKING([for disable crash dump])
11093     if test "$enable_crashdump" = no; then
11094         DEFAULT_CRASHDUMP_VALUE="false"
11095         AC_MSG_RESULT([yes])
11096     else
11097        AC_MSG_RESULT([no])
11098     fi
11100     AC_MSG_CHECKING([for crashreport config])
11101     if test "$with_symbol_config" = "no"; then
11102         BREAKPAD_SYMBOL_CONFIG="invalid"
11103         AC_MSG_RESULT([no])
11104     else
11105         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11106         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11107         AC_MSG_RESULT([yes])
11108     fi
11109     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11111 AC_SUBST(ENABLE_BREAKPAD)
11112 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11114 dnl ==================================================================
11115 dnl libcmis
11116 dnl ==================================================================
11117 if test "$enable_libcmis" = "yes"; then
11118     if test "$enable_curl" != "yes"; then
11119         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11120     fi
11123 dnl ===================================================================
11124 dnl Orcus
11125 dnl ===================================================================
11126 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11127 if test "$with_system_orcus" != "yes"; then
11128     if test "$SYSTEM_BOOST" = "TRUE"; then
11129         dnl Link with Boost.System
11130         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11131         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11132         dnl in documentation has no effect.
11133         AX_BOOST_SYSTEM
11134     fi
11136 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11137 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11138 AC_SUBST([BOOST_SYSTEM_LIB])
11139 AC_SUBST(SYSTEM_LIBORCUS)
11141 dnl ===================================================================
11142 dnl HarfBuzz
11143 dnl ===================================================================
11144 harfbuzz_required_version=5.1.0
11146 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11147 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11148 case "$_os" in
11149     Linux)
11150         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
11151         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11152         ;;
11153     *)
11154         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
11155         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11156         ;;
11157 esac
11158 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11159 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11161 if test "$COM" = "MSC"; then # override the above
11162     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
11163     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11166 if test "$with_system_harfbuzz" = "yes"; then
11167     if test "$with_system_graphite" = "no"; then
11168         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11169     fi
11170     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11171     save_LIBS="$LIBS"
11172     save_CFLAGS="$CFLAGS"
11173     LIBS="$LIBS $HARFBUZZ_LIBS"
11174     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11175     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11176     LIBS="$save_LIBS"
11177     CFLAGS="$save_CFLAGS"
11178 else
11179     if test "$with_system_graphite" = "yes"; then
11180         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11181     fi
11184 if test "$USING_X11" = TRUE; then
11185     AC_PATH_X
11186     AC_PATH_XTRA
11187     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11189     if test -z "$x_includes"; then
11190         x_includes="default_x_includes"
11191     fi
11192     if test -z "$x_libraries"; then
11193         x_libraries="default_x_libraries"
11194     fi
11195     CFLAGS="$CFLAGS $X_CFLAGS"
11196     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11197     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11198 else
11199     x_includes="no_x_includes"
11200     x_libraries="no_x_libraries"
11203 if test "$USING_X11" = TRUE; then
11204     dnl ===================================================================
11205     dnl Check for extension headers
11206     dnl ===================================================================
11207     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11208      [#include <X11/extensions/shape.h>])
11210     # vcl needs ICE and SM
11211     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11212     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11213         [AC_MSG_ERROR(ICE library not found)])
11214     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11215     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11216         [AC_MSG_ERROR(SM library not found)])
11219 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11220     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11221     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11224 dnl ===================================================================
11225 dnl Check for system Xrender
11226 dnl ===================================================================
11227 AC_MSG_CHECKING([whether to use Xrender])
11228 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11229     AC_MSG_RESULT([yes])
11230     PKG_CHECK_MODULES(XRENDER, xrender)
11231     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11232     FilterLibs "${XRENDER_LIBS}"
11233     XRENDER_LIBS="${filteredlibs}"
11234     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11235       [AC_MSG_ERROR(libXrender not found or functional)], [])
11236     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11237       [AC_MSG_ERROR(Xrender not found. install X)], [])
11238 else
11239     AC_MSG_RESULT([no])
11241 AC_SUBST(XRENDER_CFLAGS)
11242 AC_SUBST(XRENDER_LIBS)
11244 dnl ===================================================================
11245 dnl Check for XRandr
11246 dnl ===================================================================
11247 AC_MSG_CHECKING([whether to enable RandR support])
11248 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11249     AC_MSG_RESULT([yes])
11250     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11251     if test "$ENABLE_RANDR" != "TRUE"; then
11252         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11253                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11254         XRANDR_CFLAGS=" "
11255         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11256           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11257         XRANDR_LIBS="-lXrandr "
11258         ENABLE_RANDR="TRUE"
11259     fi
11260     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11261     FilterLibs "${XRANDR_LIBS}"
11262     XRANDR_LIBS="${filteredlibs}"
11263 else
11264     ENABLE_RANDR=""
11265     AC_MSG_RESULT([no])
11267 AC_SUBST(XRANDR_CFLAGS)
11268 AC_SUBST(XRANDR_LIBS)
11269 AC_SUBST(ENABLE_RANDR)
11271 if test -z "$with_webdav"; then
11272     with_webdav=$test_webdav
11275 AC_MSG_CHECKING([for WebDAV support])
11276 case "$with_webdav" in
11278     AC_MSG_RESULT([no])
11279     WITH_WEBDAV=""
11280     ;;
11282     AC_MSG_RESULT([yes])
11283     # curl is already mandatory (almost) and checked elsewhere
11284     if test "$enable_curl" = "no"; then
11285         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11286     fi
11287     WITH_WEBDAV=TRUE
11288     ;;
11289 esac
11290 AC_SUBST(WITH_WEBDAV)
11292 dnl ===================================================================
11293 dnl Check for disabling cve_tests
11294 dnl ===================================================================
11295 AC_MSG_CHECKING([whether to execute CVE tests])
11296 if test "$enable_cve_tests" = "no"; then
11297     AC_MSG_RESULT([no])
11298     DISABLE_CVE_TESTS=TRUE
11299     AC_SUBST(DISABLE_CVE_TESTS)
11300 else
11301     AC_MSG_RESULT([yes])
11304 dnl ===================================================================
11305 dnl Check for system openssl
11306 dnl ===================================================================
11307 ENABLE_OPENSSL=
11308 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11309 if test "$enable_openssl" = "yes"; then
11310     AC_MSG_RESULT([no])
11311     ENABLE_OPENSSL=TRUE
11312     if test "$_os" = Darwin ; then
11313         # OpenSSL is deprecated when building for 10.7 or later.
11314         #
11315         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11316         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11318         with_system_openssl=no
11319         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11320     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11321             && test "$with_system_openssl" != "no"; then
11322         with_system_openssl=yes
11323         SYSTEM_OPENSSL=TRUE
11324         OPENSSL_CFLAGS=
11325         OPENSSL_LIBS="-lssl -lcrypto"
11326     else
11327         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11328         if test -n "${SYSTEM_OPENSSL}"; then
11329             AC_DEFINE([SYSTEM_OPENSSL])
11330         fi
11331     fi
11332     if test "$with_system_openssl" = "yes"; then
11333         AC_MSG_CHECKING([whether openssl supports SHA512])
11334         AC_LANG_PUSH([C])
11335         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11336             SHA512_CTX context;
11337 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11338         AC_LANG_POP(C)
11339     fi
11340 else
11341     AC_MSG_RESULT([yes])
11343     # warn that although OpenSSL is disabled, system libraries may depend on it
11344     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11345     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11348 AC_SUBST([ENABLE_OPENSSL])
11350 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11351     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11352         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11353         enable_cipher_openssl_backend=no
11354     else
11355         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11356     fi
11358 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11359 ENABLE_CIPHER_OPENSSL_BACKEND=
11360 if test "$enable_cipher_openssl_backend" = yes; then
11361     AC_MSG_RESULT([yes])
11362     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11363 else
11364     AC_MSG_RESULT([no])
11366 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11368 dnl ===================================================================
11369 dnl Select the crypto backends used by LO
11370 dnl ===================================================================
11372 if test "$build_crypto" = yes; then
11373     if test "$OS" = WNT; then
11374         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11375         AC_DEFINE([USE_CRYPTO_MSCAPI])
11376     elif test "$ENABLE_NSS" = TRUE; then
11377         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11378         AC_DEFINE([USE_CRYPTO_NSS])
11379     fi
11382 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11383 if test "$COM" = "MSC"; then
11384     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11385 else
11386     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11388 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11390 dnl ===================================================================
11391 dnl Check for system redland
11392 dnl ===================================================================
11393 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11394 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11395 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11396 if test "$with_system_redland" = "yes"; then
11397     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11398             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11399 else
11400     RAPTOR_MAJOR="0"
11401     RASQAL_MAJOR="3"
11402     REDLAND_MAJOR="0"
11404 AC_SUBST(RAPTOR_MAJOR)
11405 AC_SUBST(RASQAL_MAJOR)
11406 AC_SUBST(REDLAND_MAJOR)
11408 dnl ===================================================================
11409 dnl Check for system hunspell
11410 dnl ===================================================================
11411 AC_MSG_CHECKING([which libhunspell to use])
11412 if test "$with_system_hunspell" = "yes"; then
11413     AC_MSG_RESULT([external])
11414     SYSTEM_HUNSPELL=TRUE
11415     AC_LANG_PUSH([C++])
11416     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11417     if test "$HUNSPELL_PC" != "TRUE"; then
11418         AC_CHECK_HEADER(hunspell.hxx, [],
11419             [
11420             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11421             [AC_MSG_ERROR(hunspell headers not found.)], [])
11422             ], [])
11423         AC_CHECK_LIB([hunspell], [main], [:],
11424            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11425         HUNSPELL_LIBS=-lhunspell
11426     fi
11427     AC_LANG_POP([C++])
11428     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11429     FilterLibs "${HUNSPELL_LIBS}"
11430     HUNSPELL_LIBS="${filteredlibs}"
11431 else
11432     AC_MSG_RESULT([internal])
11433     SYSTEM_HUNSPELL=
11434     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11435     if test "$COM" = "MSC"; then
11436         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11437     else
11438         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11439     fi
11440     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11442 AC_SUBST(SYSTEM_HUNSPELL)
11443 AC_SUBST(HUNSPELL_CFLAGS)
11444 AC_SUBST(HUNSPELL_LIBS)
11446 dnl ===================================================================
11447 dnl Check for system zxcvbn
11448 dnl ===================================================================
11449 AC_MSG_CHECKING([which zxcvbn to use])
11450 if test "$with_system_zxcvbn" = "yes"; then
11451     AC_MSG_RESULT([external])
11452     SYSTEM_ZXCVBN=TRUE
11453     AC_CHECK_HEADER(zxcvbn.h, [],
11454        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11455     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11456         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11457 else
11458    AC_MSG_RESULT([internal])
11459    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11460    SYSTEM_ZXCVBN=
11462 AC_SUBST(SYSTEM_ZXCVBN)
11464 dnl ===================================================================
11465 dnl Check for system zxing
11466 dnl ===================================================================
11467 AC_MSG_CHECKING([whether to use zxing])
11468 if test "$enable_zxing" = "no"; then
11469     AC_MSG_RESULT([no])
11470     ENABLE_ZXING=
11471     SYSTEM_ZXING=
11472 else
11473     AC_MSG_RESULT([yes])
11474     ENABLE_ZXING=TRUE
11475     AC_MSG_CHECKING([which libzxing to use])
11476     if test "$with_system_zxing" = "yes"; then
11477         AC_MSG_RESULT([external])
11478         SYSTEM_ZXING=TRUE
11479         ZXING_CFLAGS=
11480         AC_LANG_PUSH([C++])
11481         save_CXXFLAGS=$CXXFLAGS
11482         save_IFS=$IFS
11483         IFS=$P_SEP
11484         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11485             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11486             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11487             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11488             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11489             dnl unsetting IFS."):
11490             IFS=$save_IFS
11491             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11492             dnl ignore them here:
11493             if test -z "$i"; then
11494                 continue
11495             fi
11496             dnl TODO: White space in $i would cause problems:
11497             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11498             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11499                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11500         done
11501         CXXFLAGS=$save_CXXFLAGS
11502         if test -z "$ZXING_CFLAGS"; then
11503             AC_MSG_ERROR(zxing headers not found.)
11504         fi
11505         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11506             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11507             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11508         AC_LANG_POP([C++])
11509         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11510         FilterLibs "${ZXING_LIBS}"
11511         ZXING_LIBS="${filteredlibs}"
11512     else
11513         AC_MSG_RESULT([internal])
11514         SYSTEM_ZXING=
11515         BUILD_TYPE="$BUILD_TYPE ZXING"
11516         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11517     fi
11518     if test "$ENABLE_ZXING" = TRUE; then
11519         AC_DEFINE(ENABLE_ZXING)
11520     fi
11521     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11522     AC_LANG_PUSH([C++])
11523     save_CXXFLAGS=$CXXFLAGS
11524     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11525     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11526             #include <BitMatrix.h>
11527             #include <BitMatrixIO.h>
11528             int main(){
11529                 ZXing::BitMatrix matrix(1, 1);
11530                 matrix.set(0, 0, true);
11531                 ZXing::ToSVG(matrix);
11532                 return 0;
11533             }
11534         ])], [
11535             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11536             AC_MSG_RESULT([yes])
11537         ], [AC_MSG_RESULT([no])])
11538     CXXFLAGS=$save_CXXFLAGS
11539     AC_LANG_POP([C++])
11540     AC_SUBST(HAVE_ZXING_TOSVG)
11542 AC_SUBST(SYSTEM_ZXING)
11543 AC_SUBST(ENABLE_ZXING)
11544 AC_SUBST(ZXING_CFLAGS)
11545 AC_SUBST(ZXING_LIBS)
11547 dnl ===================================================================
11548 dnl Check for system box2d
11549 dnl ===================================================================
11550 AC_MSG_CHECKING([which box2d to use])
11551 if test "$with_system_box2d" = "yes"; then
11552     AC_MSG_RESULT([external])
11553     SYSTEM_BOX2D=TRUE
11554     AC_LANG_PUSH([C++])
11555     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11556         [BOX2D_H_FOUND='FALSE'])
11557     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11558         _BOX2D_LIB=box2d
11559         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11560     else
11561         # fail this. there's no other alternative to check when we are here.
11562         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11563             [AC_MSG_ERROR(box2d headers not found.)])
11564         _BOX2D_LIB=Box2D
11565         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11566     fi
11567     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11568         [ AC_MSG_ERROR(box2d library not found.) ], [])
11569     BOX2D_LIBS=-l$_BOX2D_LIB
11570     AC_LANG_POP([C++])
11571     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11572     FilterLibs "${BOX2D_LIBS}"
11573     BOX2D_LIBS="${filteredlibs}"
11574 else
11575     AC_MSG_RESULT([internal])
11576     SYSTEM_BOX2D=
11577     BUILD_TYPE="$BUILD_TYPE BOX2D"
11579 AC_SUBST(SYSTEM_BOX2D)
11580 AC_SUBST(BOX2D_CFLAGS)
11581 AC_SUBST(BOX2D_LIBS)
11583 dnl ===================================================================
11584 dnl Checking for altlinuxhyph
11585 dnl ===================================================================
11586 AC_MSG_CHECKING([which altlinuxhyph to use])
11587 if test "$with_system_altlinuxhyph" = "yes"; then
11588     AC_MSG_RESULT([external])
11589     SYSTEM_HYPH=TRUE
11590     AC_CHECK_HEADER(hyphen.h, [],
11591        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11592     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11593        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11594        [#include <hyphen.h>])
11595     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11596         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11597     if test -z "$HYPHEN_LIB"; then
11598         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11599            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11600     fi
11601     if test -z "$HYPHEN_LIB"; then
11602         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11603            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11604     fi
11605 else
11606     AC_MSG_RESULT([internal])
11607     SYSTEM_HYPH=
11608     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11609     if test "$COM" = "MSC"; then
11610         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11611     else
11612         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11613     fi
11615 AC_SUBST(SYSTEM_HYPH)
11616 AC_SUBST(HYPHEN_LIB)
11618 dnl ===================================================================
11619 dnl Checking for mythes
11620 dnl ===================================================================
11621 AC_MSG_CHECKING([which mythes to use])
11622 if test "$with_system_mythes" = "yes"; then
11623     AC_MSG_RESULT([external])
11624     SYSTEM_MYTHES=TRUE
11625     AC_LANG_PUSH([C++])
11626     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11627     if test "$MYTHES_PKGCONFIG" = "no"; then
11628         AC_CHECK_HEADER(mythes.hxx, [],
11629             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11630         AC_CHECK_LIB([mythes-1.2], [main], [:],
11631             [ MYTHES_FOUND=no], [])
11632     if test "$MYTHES_FOUND" = "no"; then
11633         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11634                 [ MYTHES_FOUND=no], [])
11635     fi
11636     if test "$MYTHES_FOUND" = "no"; then
11637         AC_MSG_ERROR([mythes library not found!.])
11638     fi
11639     fi
11640     AC_LANG_POP([C++])
11641     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11642     FilterLibs "${MYTHES_LIBS}"
11643     MYTHES_LIBS="${filteredlibs}"
11644 else
11645     AC_MSG_RESULT([internal])
11646     SYSTEM_MYTHES=
11647     BUILD_TYPE="$BUILD_TYPE MYTHES"
11648     if test "$COM" = "MSC"; then
11649         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11650     else
11651         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11652     fi
11654 AC_SUBST(SYSTEM_MYTHES)
11655 AC_SUBST(MYTHES_CFLAGS)
11656 AC_SUBST(MYTHES_LIBS)
11658 dnl ===================================================================
11659 dnl How should we build the linear programming solver ?
11660 dnl ===================================================================
11662 ENABLE_COINMP=
11663 AC_MSG_CHECKING([whether to build with CoinMP])
11664 if test "$enable_coinmp" != "no"; then
11665     ENABLE_COINMP=TRUE
11666     AC_MSG_RESULT([yes])
11667     if test "$with_system_coinmp" = "yes"; then
11668         SYSTEM_COINMP=TRUE
11669         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11670         FilterLibs "${COINMP_LIBS}"
11671         COINMP_LIBS="${filteredlibs}"
11672     else
11673         BUILD_TYPE="$BUILD_TYPE COINMP"
11674     fi
11675 else
11676     AC_MSG_RESULT([no])
11678 AC_SUBST(ENABLE_COINMP)
11679 AC_SUBST(SYSTEM_COINMP)
11680 AC_SUBST(COINMP_CFLAGS)
11681 AC_SUBST(COINMP_LIBS)
11683 ENABLE_LPSOLVE=
11684 AC_MSG_CHECKING([whether to build with lpsolve])
11685 if test "$enable_lpsolve" != "no"; then
11686     ENABLE_LPSOLVE=TRUE
11687     AC_MSG_RESULT([yes])
11688 else
11689     AC_MSG_RESULT([no])
11691 AC_SUBST(ENABLE_LPSOLVE)
11693 if test "$ENABLE_LPSOLVE" = TRUE; then
11694     AC_MSG_CHECKING([which lpsolve to use])
11695     if test "$with_system_lpsolve" = "yes"; then
11696         AC_MSG_RESULT([external])
11697         SYSTEM_LPSOLVE=TRUE
11698         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11699            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11700         save_LIBS=$LIBS
11701         # some systems need this. Like Ubuntu...
11702         AC_CHECK_LIB(m, floor)
11703         AC_CHECK_LIB(dl, dlopen)
11704         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11705             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11706         LIBS=$save_LIBS
11707     else
11708         AC_MSG_RESULT([internal])
11709         SYSTEM_LPSOLVE=
11710         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11711     fi
11713 AC_SUBST(SYSTEM_LPSOLVE)
11715 dnl ===================================================================
11716 dnl Checking for libexttextcat
11717 dnl ===================================================================
11718 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11719 if test "$with_system_libexttextcat" = "yes"; then
11720     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11722 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11724 dnl ===================================================================
11725 dnl Checking for libnumbertext
11726 dnl ===================================================================
11727 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11728 if test "$with_system_libnumbertext" = "yes"; then
11729     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11730     SYSTEM_LIBNUMBERTEXT=YES
11731 else
11732     SYSTEM_LIBNUMBERTEXT=
11734 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11735 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11737 dnl ***************************************
11738 dnl testing libc version for Linux...
11739 dnl ***************************************
11740 if test "$_os" = "Linux"; then
11741     AC_MSG_CHECKING([whether the libc is recent enough])
11742     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11743     #include <features.h>
11744     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11745     #error glibc >= 2.1 is required
11746     #endif
11747     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11750 dnl =========================================
11751 dnl Check for uuidgen
11752 dnl =========================================
11753 if test "$_os" = "WINNT"; then
11754     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11755     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11756     UUIDGEN=uuidgen.exe
11757     AC_SUBST(UUIDGEN)
11758 else
11759     AC_PATH_PROG([UUIDGEN], [uuidgen])
11760     if test -z "$UUIDGEN"; then
11761         AC_MSG_WARN([uuid is needed for building installation sets])
11762     fi
11765 dnl ***************************************
11766 dnl Checking for bison and flex
11767 dnl ***************************************
11768 AC_PATH_PROG(BISON, bison)
11769 if test -z "$BISON"; then
11770     AC_MSG_ERROR([no bison found in \$PATH, install it])
11771 else
11772     AC_MSG_CHECKING([the bison version])
11773     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11774     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11775     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11776     dnl cause
11777     dnl
11778     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]
11779     dnl   typedef union YYSTYPE
11780     dnl           ~~~~~~^~~~~~~
11781     dnl
11782     dnl while at least 3.4.1 is know to be good:
11783     if test "$COMPILER_PLUGINS" = TRUE; then
11784         if test "$_bison_longver" -lt 2004; then
11785             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11786         fi
11787     else
11788         if test "$_bison_longver" -lt 2000; then
11789             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11790         fi
11791     fi
11793 AC_SUBST([BISON])
11795 AC_PATH_PROG(FLEX, flex)
11796 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11797     FLEX=`cygpath -m $FLEX`
11799 if test -z "$FLEX"; then
11800     AC_MSG_ERROR([no flex found in \$PATH, install it])
11801 else
11802     AC_MSG_CHECKING([the flex version])
11803     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11804     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11805         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11806     fi
11808 AC_SUBST([FLEX])
11810 AC_PATH_PROG(DIFF, diff)
11811 if test -z "$DIFF"; then
11812     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11814 AC_SUBST([DIFF])
11816 AC_PATH_PROG(UNIQ, uniq)
11817 if test -z "$UNIQ"; then
11818     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11820 AC_SUBST([UNIQ])
11822 dnl ***************************************
11823 dnl Checking for patch
11824 dnl ***************************************
11825 AC_PATH_PROG(PATCH, patch)
11826 if test -z "$PATCH"; then
11827     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11830 dnl On Solaris or macOS, check if --with-gnu-patch was used
11831 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11832     if test -z "$with_gnu_patch"; then
11833         GNUPATCH=$PATCH
11834     else
11835         if test -x "$with_gnu_patch"; then
11836             GNUPATCH=$with_gnu_patch
11837         else
11838             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11839         fi
11840     fi
11842     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11843     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11844         AC_MSG_RESULT([yes])
11845     else
11846         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11847             AC_MSG_RESULT([no, but accepted (Apple patch)])
11848             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11849         else
11850             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11851         fi
11852     fi
11853 else
11854     GNUPATCH=$PATCH
11857 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11858     GNUPATCH=`cygpath -m $GNUPATCH`
11861 dnl We also need to check for --with-gnu-cp
11863 if test -z "$with_gnu_cp"; then
11864     # check the place where the good stuff is hidden on Solaris...
11865     if test -x /usr/gnu/bin/cp; then
11866         GNUCP=/usr/gnu/bin/cp
11867     else
11868         AC_PATH_PROGS(GNUCP, gnucp cp)
11869     fi
11870     if test -z $GNUCP; then
11871         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11872     fi
11873 else
11874     if test -x "$with_gnu_cp"; then
11875         GNUCP=$with_gnu_cp
11876     else
11877         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11878     fi
11881 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11882     GNUCP=`cygpath -m $GNUCP`
11885 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11886 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11887     AC_MSG_RESULT([yes])
11888 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11889     AC_MSG_RESULT([yes])
11890 else
11891     case "$build_os" in
11892     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11893         x_GNUCP=[\#]
11894         GNUCP=''
11895         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11896         ;;
11897     *)
11898         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11899         ;;
11900     esac
11903 AC_SUBST(GNUPATCH)
11904 AC_SUBST(GNUCP)
11905 AC_SUBST(x_GNUCP)
11907 dnl ***************************************
11908 dnl testing assembler path
11909 dnl ***************************************
11910 ML_EXE=""
11911 if test "$_os" = "WINNT"; then
11912     case "$WIN_HOST_ARCH" in
11913     x86) assembler=ml.exe ;;
11914     x64) assembler=ml64.exe ;;
11915     arm64) assembler=armasm64.exe ;;
11916     esac
11918     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11919     if test -f "$MSVC_HOST_PATH/$assembler"; then
11920         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11921         AC_MSG_RESULT([$ML_EXE])
11922     else
11923         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11924     fi
11927 AC_SUBST(ML_EXE)
11929 dnl ===================================================================
11930 dnl We need zip and unzip
11931 dnl ===================================================================
11932 AC_PATH_PROG(ZIP, zip)
11933 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11934 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11935     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],,)
11938 AC_PATH_PROG(UNZIP, unzip)
11939 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11941 dnl ===================================================================
11942 dnl Zip must be a specific type for different build types.
11943 dnl ===================================================================
11944 if test $build_os = cygwin; then
11945     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11946         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11947     fi
11950 dnl ===================================================================
11951 dnl We need touch with -h option support.
11952 dnl ===================================================================
11953 AC_PATH_PROG(TOUCH, touch)
11954 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11955 touch "$WARNINGS_FILE"
11956 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11957     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],,)
11960 dnl ===================================================================
11961 dnl Check for system epoxy
11962 dnl ===================================================================
11963 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11964 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11966 dnl ===================================================================
11967 dnl Show which vclplugs will be built.
11968 dnl ===================================================================
11969 R=""
11971 libo_ENABLE_VCLPLUG([gen])
11972 libo_ENABLE_VCLPLUG([gtk3])
11973 libo_ENABLE_VCLPLUG([gtk3_kde5])
11974 libo_ENABLE_VCLPLUG([gtk4])
11975 libo_ENABLE_VCLPLUG([kf5])
11976 libo_ENABLE_VCLPLUG([kf6])
11977 libo_ENABLE_VCLPLUG([qt5])
11978 libo_ENABLE_VCLPLUG([qt6])
11980 if test "$_os" = "WINNT"; then
11981     R="$R win"
11982 elif test "$_os" = "Darwin"; then
11983     R="$R osx"
11984 elif test "$_os" = "iOS"; then
11985     R="ios"
11986 elif test "$_os" = Android; then
11987     R="android"
11990 build_vcl_plugins="$R"
11991 if test -z "$build_vcl_plugins"; then
11992     build_vcl_plugins=" none"
11994 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11995 VCL_PLUGIN_INFO=$R
11996 AC_SUBST([VCL_PLUGIN_INFO])
11998 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11999     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
12002 dnl ===================================================================
12003 dnl Check for GTK libraries
12004 dnl ===================================================================
12006 GTK3_CFLAGS=""
12007 GTK3_LIBS=""
12008 ENABLE_GTKTILEDVIEWER=""
12009 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12010     if test "$with_system_cairo" = no; then
12011         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.'
12012     fi
12013     : ${with_system_cairo:=yes}
12014     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)
12015     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12016     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12017     FilterLibs "${GTK3_LIBS}"
12018     GTK3_LIBS="${filteredlibs}"
12020     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12021     if test "$with_system_epoxy" != "yes"; then
12022         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12023         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12024                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12025     fi
12026 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12027     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12028     if test "$build_os" = "cygwin"; then
12029         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12030         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12031     fi
12033     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12034     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12035     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12036     FilterLibs "${GTK3_LIBS}"
12037     GTK3_LIBS="${filteredlibs}"
12038     ENABLE_GTKTILEDVIEWER="yes"
12040 AC_SUBST(GTK3_LIBS)
12041 AC_SUBST(GTK3_CFLAGS)
12042 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12044 GTK4_CFLAGS=""
12045 GTK4_LIBS=""
12046 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12047     if test "$with_system_cairo" = no; then
12048         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12049     fi
12050     : ${with_system_cairo:=yes}
12051     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12052     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12053     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12054     FilterLibs "${GTK4_LIBS}"
12055     GTK4_LIBS="${filteredlibs}"
12057     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12058     if test "$with_system_epoxy" != "yes"; then
12059         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12060         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12061                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12062     fi
12064 AC_SUBST(GTK4_LIBS)
12065 AC_SUBST(GTK4_CFLAGS)
12067 if test "$enable_introspection" = yes; then
12068     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12069         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12070     else
12071         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12072     fi
12075 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12076 if ! test "$ENABLE_GTK3" = TRUE; then
12077     if test "$enable_atspi_tests" = yes; then
12078         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12079     fi
12080     enable_atspi_tests=no
12082 if ! test "$enable_atspi_tests" = no; then
12083     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12084     if ! test "$XVFB_RUN" = no; then
12085         dnl make sure the found xvfb-run actually works
12086         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12087         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12088             AC_MSG_RESULT([yes])
12089         else
12090             AC_MSG_RESULT([no])
12091             XVFB_RUN=no
12092         fi
12093     fi
12094     if test "$XVFB_RUN" = no; then
12095         if test "$enable_atspi_tests" = yes; then
12096             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12097         fi
12098         enable_atspi_tests=no
12099     fi
12101 if ! test "$enable_atspi_tests" = no; then
12102     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12103     if test "$DBUS_LAUNCH" = no; then
12104         if test "$enable_atspi_tests" = yes; then
12105             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12106         fi
12107         enable_atspi_tests=no
12108     fi
12110 if ! test "$enable_atspi_tests" = no; then
12111     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12112                       [if test "$enable_atspi_tests" = yes; then
12113                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12114                        else
12115                            enable_atspi_tests=no
12116                        fi])
12118 if ! test "x$enable_atspi_tests" = xno; then
12119     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12120                       [have_atspi_scroll_to=1],
12121                       [have_atspi_scroll_to=0])
12122     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12123                        [Whether AT-SPI2 has the scrollTo API])
12125 ENABLE_ATSPI_TESTS=
12126 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12127 AC_SUBST([ENABLE_ATSPI_TESTS])
12129 dnl ===================================================================
12130 dnl check for dbus support
12131 dnl ===================================================================
12132 ENABLE_DBUS=""
12133 DBUS_CFLAGS=""
12134 DBUS_LIBS=""
12135 DBUS_GLIB_CFLAGS=""
12136 DBUS_GLIB_LIBS=""
12137 DBUS_HAVE_GLIB=""
12139 if test "$enable_dbus" = "no"; then
12140     test_dbus=no
12143 AC_MSG_CHECKING([whether to enable DBUS support])
12144 if test "$test_dbus" = "yes"; then
12145     ENABLE_DBUS="TRUE"
12146     AC_MSG_RESULT([yes])
12147     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12148     AC_DEFINE(ENABLE_DBUS)
12149     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12150     FilterLibs "${DBUS_LIBS}"
12151     DBUS_LIBS="${filteredlibs}"
12153     # Glib is needed for BluetoothServer
12154     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12155     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12156         [
12157             DBUS_HAVE_GLIB="TRUE"
12158             AC_DEFINE(DBUS_HAVE_GLIB,1)
12159         ],
12160         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12161     )
12162 else
12163     AC_MSG_RESULT([no])
12166 AC_SUBST(ENABLE_DBUS)
12167 AC_SUBST(DBUS_CFLAGS)
12168 AC_SUBST(DBUS_LIBS)
12169 AC_SUBST(DBUS_GLIB_CFLAGS)
12170 AC_SUBST(DBUS_GLIB_LIBS)
12171 AC_SUBST(DBUS_HAVE_GLIB)
12173 AC_MSG_CHECKING([whether to enable Impress remote control])
12174 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12175     AC_MSG_RESULT([yes])
12176     ENABLE_SDREMOTE=TRUE
12177     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12178         <true/>"
12179     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12181     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12182         # The Bluetooth code doesn't compile with macOS SDK 10.15
12183         if test "$enable_sdremote_bluetooth" = yes; then
12184             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12185         fi
12186         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12187         enable_sdremote_bluetooth=no
12188     fi
12189     # If not explicitly enabled or disabled, default
12190     if test -z "$enable_sdremote_bluetooth"; then
12191         case "$OS" in
12192         LINUX|MACOSX|WNT)
12193             # Default to yes for these
12194             enable_sdremote_bluetooth=yes
12195             ;;
12196         *)
12197             # otherwise no
12198             enable_sdremote_bluetooth=no
12199             ;;
12200         esac
12201     fi
12202     # $enable_sdremote_bluetooth is guaranteed non-empty now
12204     if test "$enable_sdremote_bluetooth" != "no"; then
12205         if test "$OS" = "LINUX"; then
12206             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12207                 AC_MSG_RESULT([yes])
12208                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12209                 dnl ===================================================================
12210                 dnl Check for system bluez
12211                 dnl ===================================================================
12212                 AC_MSG_CHECKING([which Bluetooth header to use])
12213                 if test "$with_system_bluez" = "yes"; then
12214                     AC_MSG_RESULT([external])
12215                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12216                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12217                     SYSTEM_BLUEZ=TRUE
12218                 else
12219                     AC_MSG_RESULT([internal])
12220                     SYSTEM_BLUEZ=
12221                 fi
12222             else
12223                 AC_MSG_RESULT([no, dbus disabled])
12224                 ENABLE_SDREMOTE_BLUETOOTH=
12225                 SYSTEM_BLUEZ=
12226             fi
12227         else
12228             AC_MSG_RESULT([yes])
12229             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12230             SYSTEM_BLUEZ=
12231             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12232         <key>com.apple.security.device.bluetooth</key>
12233         <true/>"
12234         fi
12235     else
12236         AC_MSG_RESULT([no])
12237         ENABLE_SDREMOTE_BLUETOOTH=
12238         SYSTEM_BLUEZ=
12239     fi
12240 else
12241     ENABLE_SDREMOTE=
12242     SYSTEM_BLUEZ=
12243     AC_MSG_RESULT([no])
12245 AC_SUBST(ENABLE_SDREMOTE)
12246 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12247 AC_SUBST(SDREMOTE_ENTITLEMENT)
12248 AC_SUBST(SYSTEM_BLUEZ)
12250 dnl ===================================================================
12251 dnl Check whether to enable GIO support
12252 dnl ===================================================================
12253 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12254     AC_MSG_CHECKING([whether to enable GIO support])
12255     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12256         dnl Need at least 2.26 for the dbus support.
12257         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12258                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12259         if test "$ENABLE_GIO" = "TRUE"; then
12260             AC_DEFINE(ENABLE_GIO)
12261             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12262             FilterLibs "${GIO_LIBS}"
12263             GIO_LIBS="${filteredlibs}"
12264         fi
12265     else
12266         AC_MSG_RESULT([no])
12267     fi
12269 AC_SUBST(ENABLE_GIO)
12270 AC_SUBST(GIO_CFLAGS)
12271 AC_SUBST(GIO_LIBS)
12274 dnl ===================================================================
12276 SPLIT_APP_MODULES=""
12277 if test "$enable_split_app_modules" = "yes"; then
12278     SPLIT_APP_MODULES="TRUE"
12280 AC_SUBST(SPLIT_APP_MODULES)
12282 SPLIT_OPT_FEATURES=""
12283 if test "$enable_split_opt_features" = "yes"; then
12284     SPLIT_OPT_FEATURES="TRUE"
12286 AC_SUBST(SPLIT_OPT_FEATURES)
12288 dnl ===================================================================
12289 dnl Check whether the GStreamer libraries are available.
12290 dnl ===================================================================
12292 ENABLE_GSTREAMER_1_0=""
12294 if test "$test_gstreamer_1_0" = yes; then
12296     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12297     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12298         ENABLE_GSTREAMER_1_0="TRUE"
12299         AC_MSG_RESULT([yes])
12300         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12301         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12302         FilterLibs "${GSTREAMER_1_0_LIBS}"
12303         GSTREAMER_1_0_LIBS="${filteredlibs}"
12304         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12305     else
12306         AC_MSG_RESULT([no])
12307     fi
12309 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12310 AC_SUBST(GSTREAMER_1_0_LIBS)
12311 AC_SUBST(ENABLE_GSTREAMER_1_0)
12313 ENABLE_OPENGL_TRANSITIONS=
12314 ENABLE_OPENGL_CANVAS=
12315 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12316    : # disable
12317 elif test "$_os" = "Darwin"; then
12318     # We use frameworks on macOS, no need for detail checks
12319     ENABLE_OPENGL_TRANSITIONS=TRUE
12320     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12321     ENABLE_OPENGL_CANVAS=TRUE
12322 elif test $_os = WINNT; then
12323     ENABLE_OPENGL_TRANSITIONS=TRUE
12324     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12325     ENABLE_OPENGL_CANVAS=TRUE
12326 else
12327     if test "$USING_X11" = TRUE; then
12328         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12329         ENABLE_OPENGL_TRANSITIONS=TRUE
12330         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12331         ENABLE_OPENGL_CANVAS=TRUE
12332     fi
12335 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12336 AC_SUBST(ENABLE_OPENGL_CANVAS)
12338 dnl =================================================
12339 dnl Check whether to build with OpenCL support.
12340 dnl =================================================
12342 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12343     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12344     # platform (optional at run-time, used through clew).
12345     BUILD_TYPE="$BUILD_TYPE OPENCL"
12346     AC_DEFINE(HAVE_FEATURE_OPENCL)
12349 dnl =================================================
12350 dnl Check whether to build with dconf support.
12351 dnl =================================================
12353 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12354     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12355         if test "$enable_dconf" = yes; then
12356             AC_MSG_ERROR([dconf not found])
12357         else
12358             enable_dconf=no
12359         fi])
12361 AC_MSG_CHECKING([whether to enable dconf])
12362 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12363     DCONF_CFLAGS=
12364     DCONF_LIBS=
12365     ENABLE_DCONF=
12366     AC_MSG_RESULT([no])
12367 else
12368     ENABLE_DCONF=TRUE
12369     AC_DEFINE(ENABLE_DCONF)
12370     AC_MSG_RESULT([yes])
12372 AC_SUBST([DCONF_CFLAGS])
12373 AC_SUBST([DCONF_LIBS])
12374 AC_SUBST([ENABLE_DCONF])
12376 # pdf import?
12377 AC_MSG_CHECKING([whether to build the PDF import feature])
12378 ENABLE_PDFIMPORT=
12379 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12380     AC_MSG_RESULT([yes])
12381     ENABLE_PDFIMPORT=TRUE
12382     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12383 else
12384     AC_MSG_RESULT([no])
12387 # Pdfium?
12388 AC_MSG_CHECKING([whether to build PDFium])
12389 ENABLE_PDFIUM=
12390 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12391     AC_MSG_RESULT([yes])
12392     ENABLE_PDFIUM=TRUE
12393     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12394 else
12395     AC_MSG_RESULT([no])
12397 AC_SUBST(ENABLE_PDFIUM)
12399 if test "$ENABLE_PDFIUM" = "TRUE"; then
12400     AC_MSG_CHECKING([which OpenJPEG library to use])
12401     if test "$with_system_openjpeg" = "yes"; then
12402         SYSTEM_OPENJPEG2=TRUE
12403         AC_MSG_RESULT([external])
12404         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12405         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12406         FilterLibs "${OPENJPEG2_LIBS}"
12407         OPENJPEG2_LIBS="${filteredlibs}"
12408     else
12409         SYSTEM_OPENJPEG2=FALSE
12410         AC_MSG_RESULT([internal])
12411     fi
12413     AC_MSG_CHECKING([which Abseil library to use])
12414     if test "$with_system_abseil" = "yes"; then
12415         AC_MSG_RESULT([external])
12416         SYSTEM_ABSEIL=TRUE
12417         AC_LANG_PUSH([C++])
12418         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12419         AC_LANG_POP([C++])
12420         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12421         FilterLibs "${ABSEIL_LIBS}"
12422         ABSEIL_LIBS="${filteredlibs}"
12423     else
12424         AC_MSG_RESULT([internal])
12425     fi
12427 AC_SUBST(SYSTEM_OPENJPEG2)
12428 AC_SUBST(SYSTEM_ABSEIL)
12429 AC_SUBST(ABSEIL_CFLAGS)
12430 AC_SUBST(ABSEIL_LIBS)
12432 dnl ===================================================================
12433 dnl Check for poppler
12434 dnl ===================================================================
12435 ENABLE_POPPLER=
12436 AC_MSG_CHECKING([whether to build Poppler])
12437 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12438     AC_MSG_RESULT([yes])
12439     ENABLE_POPPLER=TRUE
12440     AC_DEFINE(HAVE_FEATURE_POPPLER)
12441 else
12442     AC_MSG_RESULT([no])
12444 AC_SUBST(ENABLE_POPPLER)
12446 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12447     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12450 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12451     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12454 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12455     dnl ===================================================================
12456     dnl Check for system poppler
12457     dnl ===================================================================
12458     AC_MSG_CHECKING([which PDF import poppler to use])
12459     if test "$with_system_poppler" = "yes"; then
12460         AC_MSG_RESULT([external])
12461         SYSTEM_POPPLER=TRUE
12462         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12463         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12464         FilterLibs "${POPPLER_LIBS}"
12465         POPPLER_LIBS="${filteredlibs}"
12466     else
12467         AC_MSG_RESULT([internal])
12468         SYSTEM_POPPLER=
12469         BUILD_TYPE="$BUILD_TYPE POPPLER"
12470     fi
12471     AC_DEFINE([ENABLE_PDFIMPORT],1)
12473 AC_SUBST(ENABLE_PDFIMPORT)
12474 AC_SUBST(SYSTEM_POPPLER)
12475 AC_SUBST(POPPLER_CFLAGS)
12476 AC_SUBST(POPPLER_LIBS)
12478 # Skia?
12479 ENABLE_SKIA=
12480 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12481     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12482     if test "$SYSTEM_FREETYPE" = TRUE; then
12483         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12484             [skia_freetype_ok=yes],
12485             [skia_freetype_ok=no])
12486     else # internal is ok
12487         skia_freetype_ok=yes
12488     fi
12489     AC_MSG_CHECKING([whether to build Skia])
12490     if test "$skia_freetype_ok" = "yes"; then
12491         if test "$enable_skia" = "debug"; then
12492             AC_MSG_RESULT([yes (debug)])
12493             ENABLE_SKIA_DEBUG=TRUE
12494         else
12495             AC_MSG_RESULT([yes])
12496             ENABLE_SKIA_DEBUG=
12497         fi
12498         ENABLE_SKIA=TRUE
12499         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12500             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12501         fi
12503         AC_DEFINE(HAVE_FEATURE_SKIA)
12504         BUILD_TYPE="$BUILD_TYPE SKIA"
12506         if test "$OS" = "MACOSX"; then
12507             AC_DEFINE(SK_GANESH,1)
12508             AC_DEFINE(SK_METAL,1)
12509             SKIA_GPU=METAL
12510             AC_SUBST(SKIA_GPU)
12511         else
12512             AC_DEFINE(SK_GANESH,1)
12513             AC_DEFINE(SK_VULKAN,1)
12514             SKIA_GPU=VULKAN
12515             AC_SUBST(SKIA_GPU)
12516         fi
12517     else
12518         AC_MSG_RESULT([no (freetype too old)])
12519         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12520     fi
12522 else
12523     AC_MSG_CHECKING([whether to build Skia])
12524     AC_MSG_RESULT([no])
12526 AC_SUBST(ENABLE_SKIA)
12527 AC_SUBST(ENABLE_SKIA_DEBUG)
12529 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12530 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12531 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12532 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12533 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12534 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12535 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12536 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12537 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12538 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12539 LO_CLANG_VERSION=
12540 HAVE_LO_CLANG_DLLEXPORTINLINES=
12542 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12543     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12544         AC_MSG_CHECKING([for Clang])
12545         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12546     else
12547         if test "$_os" = "WINNT"; then
12548             AC_MSG_CHECKING([for clang-cl])
12549             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12550                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12551             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12552                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12553             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12554                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12555             fi
12556             if test -n "$LO_CLANG_CC"; then
12557                 dnl explicitly set -m32/-m64
12558                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12559                 LO_CLANG_CXX="$LO_CLANG_CC"
12560                 AC_MSG_RESULT([$LO_CLANG_CC])
12561             else
12562                 AC_MSG_RESULT([no])
12563             fi
12565             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12566             echo "#include <stdlib.h>" > conftest.c
12567             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12568                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12569             rm -f conftest.c conftest.obj
12570             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12571                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12572             else
12573                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12574             fi
12575         else
12576             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12577             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12578         fi
12579     fi
12580     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12581         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12582         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12583         if test "$LO_CLANG_VERSION" -lt 50002; then
12584             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12585             LO_CLANG_CC=
12586             LO_CLANG_CXX=
12587         fi
12588     fi
12589     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12590         save_CXX="$CXX"
12591         CXX="$LO_CLANG_CXX"
12592         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12593         AC_LANG_PUSH([C++])
12594         save_CXXFLAGS=$CXXFLAGS
12595         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12596         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12597                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12598                 AC_MSG_RESULT([yes])
12599             ], [AC_MSG_RESULT([no])])
12600         CXXFLAGS=$save_CXXFLAGS
12601         AC_LANG_POP([C++])
12602         CXX="$save_CXX"
12603         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12604             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.])
12605         fi
12606     fi
12607     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12608         # Skia is the default on Windows and Mac, so hard-require Clang.
12609         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12610         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12611             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12612         else
12613             AC_MSG_WARN([Clang compiler not found.])
12614         fi
12615     else
12617         save_CXX="$CXX"
12618         CXX="$LO_CLANG_CXX"
12619         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12620         flag_sse2=-msse2
12621         flag_ssse3=-mssse3
12622         flag_sse41=-msse4.1
12623         flag_sse42=-msse4.2
12624         flag_avx=-mavx
12625         flag_avx2=-mavx2
12626         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12627         flag_avx512f=-mavx512f
12628         flag_f16c=-mf16c
12629         flag_fma=-mfma
12631         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12632         AC_LANG_PUSH([C++])
12633         save_CXXFLAGS=$CXXFLAGS
12634         CXXFLAGS="$CXXFLAGS $flag_sse2"
12635         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12636             #include <emmintrin.h>
12637             int main () {
12638                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12639                 c = _mm_xor_si128 (a, b);
12640                 return 0;
12641             }
12642             ])],
12643             [can_compile_sse2=yes],
12644             [can_compile_sse2=no])
12645         AC_LANG_POP([C++])
12646         CXXFLAGS=$save_CXXFLAGS
12647         AC_MSG_RESULT([${can_compile_sse2}])
12648         if test "${can_compile_sse2}" = "yes" ; then
12649             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12650         fi
12652         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12653         AC_LANG_PUSH([C++])
12654         save_CXXFLAGS=$CXXFLAGS
12655         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12656         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12657             #include <tmmintrin.h>
12658             int main () {
12659                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12660                 c = _mm_maddubs_epi16 (a, b);
12661                 return 0;
12662             }
12663             ])],
12664             [can_compile_ssse3=yes],
12665             [can_compile_ssse3=no])
12666         AC_LANG_POP([C++])
12667         CXXFLAGS=$save_CXXFLAGS
12668         AC_MSG_RESULT([${can_compile_ssse3}])
12669         if test "${can_compile_ssse3}" = "yes" ; then
12670             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12671         fi
12673         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12674         AC_LANG_PUSH([C++])
12675         save_CXXFLAGS=$CXXFLAGS
12676         CXXFLAGS="$CXXFLAGS $flag_sse41"
12677         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12678             #include <smmintrin.h>
12679             int main () {
12680                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12681                 c = _mm_cmpeq_epi64 (a, b);
12682                 return 0;
12683             }
12684             ])],
12685             [can_compile_sse41=yes],
12686             [can_compile_sse41=no])
12687         AC_LANG_POP([C++])
12688         CXXFLAGS=$save_CXXFLAGS
12689         AC_MSG_RESULT([${can_compile_sse41}])
12690         if test "${can_compile_sse41}" = "yes" ; then
12691             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12692         fi
12694         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12695         AC_LANG_PUSH([C++])
12696         save_CXXFLAGS=$CXXFLAGS
12697         CXXFLAGS="$CXXFLAGS $flag_sse42"
12698         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12699             #include <nmmintrin.h>
12700             int main () {
12701                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12702                 c = _mm_cmpgt_epi64 (a, b);
12703                 return 0;
12704             }
12705             ])],
12706             [can_compile_sse42=yes],
12707             [can_compile_sse42=no])
12708         AC_LANG_POP([C++])
12709         CXXFLAGS=$save_CXXFLAGS
12710         AC_MSG_RESULT([${can_compile_sse42}])
12711         if test "${can_compile_sse42}" = "yes" ; then
12712             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12713         fi
12715         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12716         AC_LANG_PUSH([C++])
12717         save_CXXFLAGS=$CXXFLAGS
12718         CXXFLAGS="$CXXFLAGS $flag_avx"
12719         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12720             #include <immintrin.h>
12721             int main () {
12722                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12723                 c = _mm256_xor_ps(a, b);
12724                 return 0;
12725             }
12726             ])],
12727             [can_compile_avx=yes],
12728             [can_compile_avx=no])
12729         AC_LANG_POP([C++])
12730         CXXFLAGS=$save_CXXFLAGS
12731         AC_MSG_RESULT([${can_compile_avx}])
12732         if test "${can_compile_avx}" = "yes" ; then
12733             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12734         fi
12736         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12737         AC_LANG_PUSH([C++])
12738         save_CXXFLAGS=$CXXFLAGS
12739         CXXFLAGS="$CXXFLAGS $flag_avx2"
12740         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12741             #include <immintrin.h>
12742             int main () {
12743                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12744                 c = _mm256_maddubs_epi16(a, b);
12745                 return 0;
12746             }
12747             ])],
12748             [can_compile_avx2=yes],
12749             [can_compile_avx2=no])
12750         AC_LANG_POP([C++])
12751         CXXFLAGS=$save_CXXFLAGS
12752         AC_MSG_RESULT([${can_compile_avx2}])
12753         if test "${can_compile_avx2}" = "yes" ; then
12754             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12755         fi
12757         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12758         AC_LANG_PUSH([C++])
12759         save_CXXFLAGS=$CXXFLAGS
12760         CXXFLAGS="$CXXFLAGS $flag_avx512"
12761         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12762             #include <immintrin.h>
12763             int main () {
12764                 __m512i a = _mm512_loadu_si512(0);
12765                 __m512d v1 = _mm512_load_pd(0);
12766                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12767                 __m512d v2 = _mm512_abs_pd(v1);
12768                 return 0;
12769             }
12770             ])],
12771             [can_compile_avx512=yes],
12772             [can_compile_avx512=no])
12773         AC_LANG_POP([C++])
12774         CXXFLAGS=$save_CXXFLAGS
12775         AC_MSG_RESULT([${can_compile_avx512}])
12776         if test "${can_compile_avx512}" = "yes" ; then
12777             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12778             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12779         fi
12781         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12782         AC_LANG_PUSH([C++])
12783         save_CXXFLAGS=$CXXFLAGS
12784         CXXFLAGS="$CXXFLAGS $flag_f16c"
12785         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12786             #include <immintrin.h>
12787             int main () {
12788                 __m128i a = _mm_set1_epi32 (0);
12789                 __m128 c;
12790                 c = _mm_cvtph_ps(a);
12791                 return 0;
12792             }
12793             ])],
12794             [can_compile_f16c=yes],
12795             [can_compile_f16c=no])
12796         AC_LANG_POP([C++])
12797         CXXFLAGS=$save_CXXFLAGS
12798         AC_MSG_RESULT([${can_compile_f16c}])
12799         if test "${can_compile_f16c}" = "yes" ; then
12800             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12801         fi
12803         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12804         AC_LANG_PUSH([C++])
12805         save_CXXFLAGS=$CXXFLAGS
12806         CXXFLAGS="$CXXFLAGS $flag_fma"
12807         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12808             #include <immintrin.h>
12809             int main () {
12810                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12811                 d = _mm256_fmadd_ps(a, b, c);
12812                 return 0;
12813             }
12814             ])],
12815             [can_compile_fma=yes],
12816             [can_compile_fma=no])
12817         AC_LANG_POP([C++])
12818         CXXFLAGS=$save_CXXFLAGS
12819         AC_MSG_RESULT([${can_compile_fma}])
12820         if test "${can_compile_fma}" = "yes" ; then
12821             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12822         fi
12824         CXX="$save_CXX"
12825     fi
12828 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12830 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12831     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12832     AC_LANG_PUSH([C])
12833     save_CC="$CC"
12834     CC="$LO_CLANG_CC"
12835     save_CFLAGS=$CFLAGS
12836     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12837     dnl an empty program will do, we're checking the compiler flags
12838     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12839                       [use_ccache=yes], [use_ccache=no])
12840     CFLAGS=$save_CFLAGS
12841     CC=$save_CC
12842     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12843         AC_MSG_RESULT([yes])
12844     else
12845         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12846         AC_MSG_RESULT([no])
12847     fi
12848     AC_LANG_POP([C])
12850     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12851     AC_LANG_PUSH([C++])
12852     save_CXX="$CXX"
12853     CXX="$LO_CLANG_CXX"
12854     save_CXXFLAGS=$CXXFLAGS
12855     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12856     dnl an empty program will do, we're checking the compiler flags
12857     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12858                       [use_ccache=yes], [use_ccache=no])
12859     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12860         AC_MSG_RESULT([yes])
12861     else
12862         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12863         AC_MSG_RESULT([no])
12864     fi
12865     CXXFLAGS=$save_CXXFLAGS
12866     CXX=$save_CXX
12867     AC_LANG_POP([C++])
12870 AC_SUBST(LO_CLANG_CC)
12871 AC_SUBST(LO_CLANG_CXX)
12872 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12873 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12874 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12875 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12876 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12877 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12878 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12879 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12880 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12881 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12882 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12883 AC_SUBST(LO_CLANG_VERSION)
12884 AC_SUBST(CLANG_USE_LD)
12885 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12887 SYSTEM_GPGMEPP=
12889 AC_MSG_CHECKING([whether to enable gpgmepp])
12890 if test "$enable_gpgmepp" = no; then
12891     AC_MSG_RESULT([no])
12892 elif test "$enable_mpl_subset" = "yes"; then
12893     AC_MSG_RESULT([no (MPL only)])
12894 elif test "$enable_fuzzers" = "yes"; then
12895     AC_MSG_RESULT([no (oss-fuzz)])
12896 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12897     AC_MSG_RESULT([yes])
12898     dnl ===================================================================
12899     dnl Check for system gpgme
12900     dnl ===================================================================
12901     AC_MSG_CHECKING([which gpgmepp to use])
12902     if test "$with_system_gpgmepp" = "yes"; then
12903         AC_MSG_RESULT([external])
12904         SYSTEM_GPGMEPP=TRUE
12906         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12907         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12908             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12909         AC_CHECK_HEADER(gpgme.h, [],
12910             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12911         AC_CHECK_LIB(gpgmepp, main, [],
12912             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12913         GPGMEPP_LIBS=-lgpgmepp
12914     else
12915         AC_MSG_RESULT([internal])
12916         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12918         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12919         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12920         if test "$_os" != "WINNT"; then
12921             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12922             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12923         fi
12924     fi
12925     ENABLE_GPGMEPP=TRUE
12926     AC_DEFINE([HAVE_FEATURE_GPGME])
12927     AC_PATH_PROG(GPG, gpg)
12928     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12929     # so let's exclude that manually for the moment
12930     if test -n "$GPG" -a "$_os" != "WINNT"; then
12931         # make sure we not only have a working gpgme, but a full working
12932         # gpg installation to run OpenPGP signature verification
12933         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12934     fi
12935     if test "$_os" = "Linux"; then
12936       uid=`id -u`
12937       AC_MSG_CHECKING([for /run/user/$uid])
12938       if test -d /run/user/$uid; then
12939         AC_MSG_RESULT([yes])
12940         AC_PATH_PROG(GPGCONF, gpgconf)
12942         # Older versions of gpgconf are not working as expected, since
12943         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12944         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12945         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12946         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12947         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12948         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12949         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12950           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12951           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12952           if $GPGCONF --dump-options > /dev/null ; then
12953             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12954               AC_MSG_RESULT([yes])
12955               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12956               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12957             else
12958               AC_MSG_RESULT([no])
12959             fi
12960           else
12961             AC_MSG_RESULT([no. missing or broken gpgconf?])
12962           fi
12963         else
12964           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12965         fi
12966       else
12967         AC_MSG_RESULT([no])
12968      fi
12969    fi
12970 else
12971     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12973 AC_SUBST(ENABLE_GPGMEPP)
12974 AC_SUBST(SYSTEM_GPGMEPP)
12975 AC_SUBST(GPG_ERROR_CFLAGS)
12976 AC_SUBST(GPG_ERROR_LIBS)
12977 AC_SUBST(LIBASSUAN_CFLAGS)
12978 AC_SUBST(LIBASSUAN_LIBS)
12979 AC_SUBST(GPGMEPP_CFLAGS)
12980 AC_SUBST(GPGMEPP_LIBS)
12982 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12983 if test "$with_java" != "no"; then
12984     AC_MSG_RESULT([yes])
12985     ENABLE_JAVA_WEBSOCKET=TRUE
12986     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12987     NEED_ANT=TRUE
12988 else
12989     AC_MSG_RESULT([no])
12990     ENABLE_JAVA_WEBSOCKET=
12992 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12994 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12995 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12996     AC_MSG_RESULT([yes])
12997     ENABLE_MEDIAWIKI=TRUE
12998     BUILD_TYPE="$BUILD_TYPE XSLTML"
12999     if test  "x$with_java" = "xno"; then
13000         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
13001     fi
13002 else
13003     AC_MSG_RESULT([no])
13004     ENABLE_MEDIAWIKI=
13005     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13007 AC_SUBST(ENABLE_MEDIAWIKI)
13009 AC_MSG_CHECKING([whether to build the Report Builder])
13010 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13011     AC_MSG_RESULT([yes])
13012     ENABLE_REPORTBUILDER=TRUE
13013     AC_MSG_CHECKING([which jfreereport libs to use])
13014     if test "$with_system_jfreereport" = "yes"; then
13015         SYSTEM_JFREEREPORT=TRUE
13016         AC_MSG_RESULT([external])
13017         if test -z $SAC_JAR; then
13018             SAC_JAR=/usr/share/java/sac.jar
13019         fi
13020         if ! test -f $SAC_JAR; then
13021              AC_MSG_ERROR(sac.jar not found.)
13022         fi
13024         if test -z $LIBXML_JAR; then
13025             if test -f /usr/share/java/libxml-1.0.0.jar; then
13026                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13027             elif test -f /usr/share/java/libxml.jar; then
13028                 LIBXML_JAR=/usr/share/java/libxml.jar
13029             else
13030                 AC_MSG_ERROR(libxml.jar replacement not found.)
13031             fi
13032         elif ! test -f $LIBXML_JAR; then
13033             AC_MSG_ERROR(libxml.jar not found.)
13034         fi
13036         if test -z $FLUTE_JAR; then
13037             if test -f /usr/share/java/flute-1.3.0.jar; then
13038                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13039             elif test -f /usr/share/java/flute.jar; then
13040                 FLUTE_JAR=/usr/share/java/flute.jar
13041             else
13042                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13043             fi
13044         elif ! test -f $FLUTE_JAR; then
13045             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13046         fi
13048         if test -z $JFREEREPORT_JAR; then
13049             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13050                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13051             elif test -f /usr/share/java/flow-engine.jar; then
13052                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13053             else
13054                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13055             fi
13056         elif ! test -f  $JFREEREPORT_JAR; then
13057                 AC_MSG_ERROR(jfreereport.jar not found.)
13058         fi
13060         if test -z $LIBLAYOUT_JAR; then
13061             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13062                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13063             elif test -f /usr/share/java/liblayout.jar; then
13064                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13065             else
13066                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13067             fi
13068         elif ! test -f $LIBLAYOUT_JAR; then
13069                 AC_MSG_ERROR(liblayout.jar not found.)
13070         fi
13072         if test -z $LIBLOADER_JAR; then
13073             if test -f /usr/share/java/libloader-1.0.0.jar; then
13074                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13075             elif test -f /usr/share/java/libloader.jar; then
13076                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13077             else
13078                 AC_MSG_ERROR(libloader.jar replacement not found.)
13079             fi
13080         elif ! test -f  $LIBLOADER_JAR; then
13081             AC_MSG_ERROR(libloader.jar not found.)
13082         fi
13084         if test -z $LIBFORMULA_JAR; then
13085             if test -f /usr/share/java/libformula-0.2.0.jar; then
13086                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13087             elif test -f /usr/share/java/libformula.jar; then
13088                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13089             else
13090                 AC_MSG_ERROR(libformula.jar replacement not found.)
13091             fi
13092         elif ! test -f $LIBFORMULA_JAR; then
13093                 AC_MSG_ERROR(libformula.jar not found.)
13094         fi
13096         if test -z $LIBREPOSITORY_JAR; then
13097             if test -f /usr/share/java/librepository-1.0.0.jar; then
13098                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13099             elif test -f /usr/share/java/librepository.jar; then
13100                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13101             else
13102                 AC_MSG_ERROR(librepository.jar replacement not found.)
13103             fi
13104         elif ! test -f $LIBREPOSITORY_JAR; then
13105             AC_MSG_ERROR(librepository.jar not found.)
13106         fi
13108         if test -z $LIBFONTS_JAR; then
13109             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13110                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13111             elif test -f /usr/share/java/libfonts.jar; then
13112                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13113             else
13114                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13115             fi
13116         elif ! test -f $LIBFONTS_JAR; then
13117                 AC_MSG_ERROR(libfonts.jar not found.)
13118         fi
13120         if test -z $LIBSERIALIZER_JAR; then
13121             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13122                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13123             elif test -f /usr/share/java/libserializer.jar; then
13124                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13125             else
13126                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13127             fi
13128         elif ! test -f $LIBSERIALIZER_JAR; then
13129                 AC_MSG_ERROR(libserializer.jar not found.)
13130         fi
13132         if test -z $LIBBASE_JAR; then
13133             if test -f /usr/share/java/libbase-1.0.0.jar; then
13134                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13135             elif test -f /usr/share/java/libbase.jar; then
13136                 LIBBASE_JAR=/usr/share/java/libbase.jar
13137             else
13138                 AC_MSG_ERROR(libbase.jar replacement not found.)
13139             fi
13140         elif ! test -f $LIBBASE_JAR; then
13141             AC_MSG_ERROR(libbase.jar not found.)
13142         fi
13144     else
13145         AC_MSG_RESULT([internal])
13146         SYSTEM_JFREEREPORT=
13147         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13148         NEED_ANT=TRUE
13149     fi
13150     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13151 else
13152     AC_MSG_RESULT([no])
13153     ENABLE_REPORTBUILDER=
13154     SYSTEM_JFREEREPORT=
13156 AC_SUBST(ENABLE_REPORTBUILDER)
13157 AC_SUBST(SYSTEM_JFREEREPORT)
13158 AC_SUBST(SAC_JAR)
13159 AC_SUBST(LIBXML_JAR)
13160 AC_SUBST(FLUTE_JAR)
13161 AC_SUBST(JFREEREPORT_JAR)
13162 AC_SUBST(LIBBASE_JAR)
13163 AC_SUBST(LIBLAYOUT_JAR)
13164 AC_SUBST(LIBLOADER_JAR)
13165 AC_SUBST(LIBFORMULA_JAR)
13166 AC_SUBST(LIBREPOSITORY_JAR)
13167 AC_SUBST(LIBFONTS_JAR)
13168 AC_SUBST(LIBSERIALIZER_JAR)
13170 # scripting provider for BeanShell?
13171 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13172 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13173     AC_MSG_RESULT([yes])
13174     ENABLE_SCRIPTING_BEANSHELL=TRUE
13176     dnl ===================================================================
13177     dnl Check for system beanshell
13178     dnl ===================================================================
13179     AC_MSG_CHECKING([which beanshell to use])
13180     if test "$with_system_beanshell" = "yes"; then
13181         AC_MSG_RESULT([external])
13182         SYSTEM_BSH=TRUE
13183         if test -z $BSH_JAR; then
13184             BSH_JAR=/usr/share/java/bsh.jar
13185         fi
13186         if ! test -f $BSH_JAR; then
13187             AC_MSG_ERROR(bsh.jar not found.)
13188         fi
13189     else
13190         AC_MSG_RESULT([internal])
13191         SYSTEM_BSH=
13192         BUILD_TYPE="$BUILD_TYPE BSH"
13193     fi
13194 else
13195     AC_MSG_RESULT([no])
13196     ENABLE_SCRIPTING_BEANSHELL=
13197     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13199 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13200 AC_SUBST(SYSTEM_BSH)
13201 AC_SUBST(BSH_JAR)
13203 # scripting provider for JavaScript?
13204 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13205 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13206     AC_MSG_RESULT([yes])
13207     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13209     dnl ===================================================================
13210     dnl Check for system rhino
13211     dnl ===================================================================
13212     AC_MSG_CHECKING([which rhino to use])
13213     if test "$with_system_rhino" = "yes"; then
13214         AC_MSG_RESULT([external])
13215         SYSTEM_RHINO=TRUE
13216         if test -z $RHINO_JAR; then
13217             RHINO_JAR=/usr/share/java/js.jar
13218         fi
13219         if ! test -f $RHINO_JAR; then
13220             AC_MSG_ERROR(js.jar not found.)
13221         fi
13222     else
13223         AC_MSG_RESULT([internal])
13224         SYSTEM_RHINO=
13225         BUILD_TYPE="$BUILD_TYPE RHINO"
13226         NEED_ANT=TRUE
13227     fi
13228 else
13229     AC_MSG_RESULT([no])
13230     ENABLE_SCRIPTING_JAVASCRIPT=
13231     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13233 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13234 AC_SUBST(SYSTEM_RHINO)
13235 AC_SUBST(RHINO_JAR)
13237 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13238 # paths should be added to library search path. So lets put all 64-bit
13239 # platforms there.
13240 supports_multilib=
13241 case "$host_cpu" in
13242 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13243     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13244         supports_multilib="yes"
13245     fi
13246     ;;
13248     ;;
13249 esac
13251 dnl ===================================================================
13252 dnl QT5 Integration
13253 dnl ===================================================================
13255 QT5_CFLAGS=""
13256 QT5_LIBS=""
13257 QT5_GOBJECT_CFLAGS=""
13258 QT5_GOBJECT_LIBS=""
13259 QT5_HAVE_GOBJECT=""
13260 QT5_PLATFORMS_SRCDIR=""
13261 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13262         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13263         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13264 then
13265     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13266     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13268     if test -n "$supports_multilib"; then
13269         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13270     fi
13272     qt5_test_include="QtWidgets/qapplication.h"
13273     if test "$_os" = "Emscripten"; then
13274         qt5_test_library="libQt5Widgets.a"
13275     else
13276         qt5_test_library="libQt5Widgets.so"
13277     fi
13279     dnl Check for qmake5
13280     if test -n "$QT5DIR"; then
13281         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13282     else
13283         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13284     fi
13285     if test "$QMAKE5" = "no"; then
13286         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13287     else
13288         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13289         if test -z "$qmake5_test_ver"; then
13290             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13291         fi
13292         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13293         qt5_minimal_minor="15"
13294         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13295             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13296         else
13297             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13298         fi
13299     fi
13301     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13302     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13303     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13304     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13306     AC_MSG_CHECKING([for Qt5 headers])
13307     qt5_incdir="no"
13308     for inc_dir in $qt5_incdirs; do
13309         if test -r "$inc_dir/$qt5_test_include"; then
13310             qt5_incdir="$inc_dir"
13311             break
13312         fi
13313     done
13314     AC_MSG_RESULT([$qt5_incdir])
13315     if test "x$qt5_incdir" = "xno"; then
13316         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13317     fi
13318     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13319     AC_LANG_PUSH([C++])
13320     save_CPPFLAGS=$CPPFLAGS
13321     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13322     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13323         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13324     CPPFLAGS=$save_CPPFLAGS
13325     AC_LANG_POP([C++])
13327     AC_MSG_CHECKING([for Qt5 libraries])
13328     qt5_libdir="no"
13329     for lib_dir in $qt5_libdirs; do
13330         if test -r "$lib_dir/$qt5_test_library"; then
13331             qt5_libdir="$lib_dir"
13332             break
13333         fi
13334     done
13335     AC_MSG_RESULT([$qt5_libdir])
13336     if test "x$qt5_libdir" = "xno"; then
13337         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13338     fi
13340     if test "$_os" = "Emscripten"; then
13341         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13342             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13343         fi
13344         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13345             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13346         fi
13348         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13349         if ! test -x "$EMSDK_LLVM_NM"; then
13350             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13351         fi
13352         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13353             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13354         fi
13355         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13356         if test -n "$QT5_WASM_SJLJ"; then
13357             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13358         fi
13359     fi
13361     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13362     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13363     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13364     if test "$_os" = "Emscripten"; then
13365         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13366     fi
13368     if test "$USING_X11" = TRUE; then
13369         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13370         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13371         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13372         QT5_USING_X11=1
13373         AC_DEFINE(QT5_USING_X11)
13374     fi
13376     dnl Check for Meta Object Compiler
13378     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13379     if test "$MOC5" = "no"; then
13380         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13381 the root of your Qt installation by exporting QT5DIR before running "configure".])
13382     fi
13384     if test "$test_gstreamer_1_0" = yes; then
13385         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13386                 QT5_HAVE_GOBJECT=1
13387                 AC_DEFINE(QT5_HAVE_GOBJECT)
13388             ],
13389             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13390         )
13391     fi
13393 AC_SUBST(QT5_CFLAGS)
13394 AC_SUBST(QT5_LIBS)
13395 AC_SUBST(MOC5)
13396 AC_SUBST(QT5_GOBJECT_CFLAGS)
13397 AC_SUBST(QT5_GOBJECT_LIBS)
13398 AC_SUBST(QT5_HAVE_GOBJECT)
13399 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13401 dnl ===================================================================
13402 dnl QT6 Integration
13403 dnl ===================================================================
13405 QT6_CFLAGS=""
13406 QT6_LIBS=""
13407 QT6_PLATFORMS_SRCDIR=""
13408 ENABLE_QT6_MULTIMEDIA=""
13409 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13410         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13411 then
13412     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13413     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13415     if test -n "$supports_multilib"; then
13416         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13417     fi
13419     qt6_test_include="QtWidgets/qapplication.h"
13420     if test "$_os" = "Emscripten"; then
13421         qt6_test_library="libQt6Widgets.a"
13422     else
13423         qt6_test_library="libQt6Widgets.so"
13424     fi
13426     dnl Check for qmake6
13427     if test -n "$QT6DIR"; then
13428         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13429     else
13430         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13431     fi
13432     if test "$QMAKE6" = "no"; then
13433         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13434     else
13435         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13436         if test -z "$qmake6_test_ver"; then
13437             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13438         fi
13439         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13440     fi
13442     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13443     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13444     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13445     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13447     AC_MSG_CHECKING([for Qt6 headers])
13448     qt6_incdir="no"
13449     for inc_dir in $qt6_incdirs; do
13450         if test -r "$inc_dir/$qt6_test_include"; then
13451             qt6_incdir="$inc_dir"
13452             break
13453         fi
13454     done
13455     AC_MSG_RESULT([$qt6_incdir])
13456     if test "x$qt6_incdir" = "xno"; then
13457         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13458     fi
13459     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13460     AC_LANG_PUSH([C++])
13461     save_CPPFLAGS=$CPPFLAGS
13462     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13463     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13464         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13465     CPPFLAGS=$save_CPPFLAGS
13466     AC_LANG_POP([C++])
13468     AC_MSG_CHECKING([for Qt6 libraries])
13469     qt6_libdir="no"
13470     for lib_dir in $qt6_libdirs; do
13471         if test -r "$lib_dir/$qt6_test_library"; then
13472             qt6_libdir="$lib_dir"
13473             break
13474         fi
13475     done
13476     AC_MSG_RESULT([$qt6_libdir])
13477     if test "x$qt6_libdir" = "xno"; then
13478         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13479     fi
13481     if test "$_os" = "Emscripten"; then
13482         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13483             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13484         fi
13485         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13486             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13487         fi
13488     fi
13490     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13491     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13492     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13493     if test "$_os" = "Emscripten"; then
13494         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13495     else
13496         if ! test "$enable_qt6_multimedia" = "no"; then
13497             if ! test -r "$qt6_incdir/QtMultimediaWidgets/QVideoWidget"; then
13498                 AC_MSG_ERROR([Qt 6 QMultimedia not found.])
13499                 break
13500             fi
13501             ENABLE_QT6_MULTIMEDIA=TRUE
13502             QT6_LIBS="$QT6_LIBS -lQt6Multimedia -lQt6MultimediaWidgets"
13503         fi
13504     fi
13506     if test "$USING_X11" = TRUE; then
13507         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13508         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13509         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13510         QT6_USING_X11=1
13511         AC_DEFINE(QT6_USING_X11)
13512     fi
13514     dnl Check for Meta Object Compiler
13516     for lib_dir in $qt6_libdirs; do
13517         if test -z "$qt6_libexec_dirs"; then
13518             qt6_libexec_dirs="$lib_dir/libexec"
13519         else
13520             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13521         fi
13522     done
13523     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])
13524     if test "$MOC6" = "no"; then
13525         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13526 the root of your Qt installation by exporting QT6DIR before running "configure".])
13527     else
13528         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13529         if test -z "$moc6_test_ver"; then
13530             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13531         fi
13532         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13533     fi
13535 AC_SUBST(QT6_CFLAGS)
13536 AC_SUBST(QT6_LIBS)
13537 AC_SUBST(MOC6)
13538 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13539 AC_SUBST(ENABLE_QT6_MULTIMEDIA)
13541 dnl ===================================================================
13542 dnl KF5 Integration
13543 dnl ===================================================================
13545 KF5_CFLAGS=""
13546 KF5_LIBS=""
13547 KF5_CONFIG="kf5-config"
13548 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13549         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13550 then
13551     if test "$OS" = "HAIKU"; then
13552         haiku_arch="`echo $RTL_ARCH | tr X x`"
13553         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13554         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13555     fi
13557     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13558     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13559     if test -n "$supports_multilib"; then
13560         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13561     fi
13563     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13564     kf5_test_library="libKF5KIOFileWidgets.so"
13565     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13567     dnl kf5 KDE4 support compatibility installed
13568     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13569     if test "$KF5_CONFIG" != "no"; then
13570         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13571         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13572     fi
13574     dnl Check for KF5 headers
13575     AC_MSG_CHECKING([for KF5 headers])
13576     kf5_incdir="no"
13577     for kf5_check in $kf5_incdirs; do
13578         if test -r "$kf5_check/$kf5_test_include"; then
13579             kf5_incdir="$kf5_check/KF5"
13580             break
13581         fi
13582     done
13583     AC_MSG_RESULT([$kf5_incdir])
13584     if test "x$kf5_incdir" = "xno"; then
13585         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13586     fi
13588     dnl Check for KF5 libraries
13589     AC_MSG_CHECKING([for KF5 libraries])
13590     kf5_libdir="no"
13591     for kf5_check in $kf5_libdirs; do
13592         if test -r "$kf5_check/$kf5_test_library"; then
13593             kf5_libdir="$kf5_check"
13594             break
13595         fi
13596     done
13598     AC_MSG_RESULT([$kf5_libdir])
13599     if test "x$kf5_libdir" = "xno"; then
13600         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13601     fi
13603     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"
13604     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13605     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13607     if test "$USING_X11" = TRUE; then
13608         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13609     fi
13611     AC_LANG_PUSH([C++])
13612     save_CXXFLAGS=$CXXFLAGS
13613     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13614     AC_MSG_CHECKING([whether KDE is >= 5.0])
13615        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13616 #include <kcoreaddons_version.h>
13618 int main(int argc, char **argv) {
13619        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13620        else return 1;
13622        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13623     CXXFLAGS=$save_CXXFLAGS
13624     AC_LANG_POP([C++])
13626 AC_SUBST(KF5_CFLAGS)
13627 AC_SUBST(KF5_LIBS)
13629 dnl ===================================================================
13630 dnl KF6 Integration
13631 dnl ===================================================================
13633 KF6_CFLAGS=""
13634 KF6_LIBS=""
13635 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13636 then
13637     if test "$OS" = "HAIKU"; then
13638         haiku_arch="`echo $RTL_ARCH | tr X x`"
13639         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13640         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13641     fi
13643     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13644     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13645     if test -n "$supports_multilib"; then
13646         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13647     fi
13649     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13650     kf6_test_library="libKF6KIOFileWidgets.so"
13651     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13653     dnl Check for KF6 headers
13654     AC_MSG_CHECKING([for KF6 headers])
13655     kf6_incdir="no"
13656     for kf6_check in $kf6_incdirs; do
13657         if test -r "$kf6_check/$kf6_test_include"; then
13658             kf6_incdir="$kf6_check/KF6"
13659             break
13660         fi
13661     done
13662     AC_MSG_RESULT([$kf6_incdir])
13663     if test "x$kf6_incdir" = "xno"; then
13664         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13665     fi
13667     dnl Check for KF6 libraries
13668     AC_MSG_CHECKING([for KF6 libraries])
13669     kf6_libdir="no"
13670     for kf6_check in $kf6_libdirs; do
13671         if test -r "$kf6_check/$kf6_test_library"; then
13672             kf6_libdir="$kf6_check"
13673             break
13674         fi
13675     done
13677     AC_MSG_RESULT([$kf6_libdir])
13678     if test "x$kf6_libdir" = "xno"; then
13679         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13680     fi
13682     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"
13683     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13684     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13686     AC_LANG_PUSH([C++])
13687     save_CXXFLAGS=$CXXFLAGS
13688     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13689     dnl KF6 development version as of 2023-06 uses version number 5.240
13690     AC_MSG_CHECKING([whether KDE is >= 5.240])
13691        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13692 #include <kcoreaddons_version.h>
13694 int main(int argc, char **argv) {
13695        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13696        else return 1;
13698        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13699     CXXFLAGS=$save_CXXFLAGS
13700     AC_LANG_POP([C++])
13702 AC_SUBST(KF6_CFLAGS)
13703 AC_SUBST(KF6_LIBS)
13705 if test "$enable_qt6_multimedia" = "yes" -a "$ENABLE_QT6" != "TRUE"; then
13706     AC_MSG_ERROR([--enable-qt6-multimedia requires --enable-qt6 or --enable-kf6])
13709 dnl ===================================================================
13710 dnl Test whether to include Evolution 2 support
13711 dnl ===================================================================
13712 AC_MSG_CHECKING([whether to enable evolution 2 support])
13713 if test "$enable_evolution2" = yes; then
13714     AC_MSG_RESULT([yes])
13715     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13716     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13717     FilterLibs "${GOBJECT_LIBS}"
13718     GOBJECT_LIBS="${filteredlibs}"
13719     ENABLE_EVOAB2="TRUE"
13720 else
13721     AC_MSG_RESULT([no])
13723 AC_SUBST(ENABLE_EVOAB2)
13724 AC_SUBST(GOBJECT_CFLAGS)
13725 AC_SUBST(GOBJECT_LIBS)
13727 dnl ===================================================================
13728 dnl Test which themes to include
13729 dnl ===================================================================
13730 AC_MSG_CHECKING([which themes to include])
13731 # if none given use default subset of available themes
13732 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13733     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"
13736 WITH_THEMES=""
13737 if test "x$with_theme" != "xno"; then
13738     for theme in $with_theme; do
13739         case $theme in
13740         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" ;;
13741         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13742         esac
13743     done
13745 AC_MSG_RESULT([$WITH_THEMES])
13746 AC_SUBST([WITH_THEMES])
13748 ###############################################################################
13749 # Extensions checking
13750 ###############################################################################
13751 AC_MSG_CHECKING([for extensions integration])
13752 if test "x$enable_extension_integration" != "xno"; then
13753     WITH_EXTENSION_INTEGRATION=TRUE
13754     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13755     AC_MSG_RESULT([yes, use integration])
13756 else
13757     WITH_EXTENSION_INTEGRATION=
13758     AC_MSG_RESULT([no, do not integrate])
13760 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13762 dnl Should any extra extensions be included?
13763 dnl There are standalone tests for each of these below.
13764 WITH_EXTRA_EXTENSIONS=
13765 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13767 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13768 if test "x$with_java" != "xno"; then
13769     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13772 AC_MSG_CHECKING([whether to build opens___.ttf])
13773 if test "$enable_build_opensymbol" = "yes"; then
13774     AC_MSG_RESULT([yes])
13775     AC_PATH_PROG(FONTFORGE, fontforge)
13776     if test -z "$FONTFORGE"; then
13777         AC_MSG_ERROR([fontforge not installed])
13778     fi
13779 else
13780     AC_MSG_RESULT([no])
13781     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13783 AC_SUBST(FONTFORGE)
13785 dnl ===================================================================
13786 dnl Test whether to include fonts
13787 dnl ===================================================================
13788 AC_MSG_CHECKING([whether to include third-party fonts])
13789 if test "$with_fonts" != "no"; then
13790     AC_MSG_RESULT([yes])
13791     WITH_FONTS=TRUE
13792     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13793     AC_DEFINE(HAVE_MORE_FONTS)
13794 else
13795     AC_MSG_RESULT([no])
13796     WITH_FONTS=
13797     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13799 AC_SUBST(WITH_FONTS)
13802 dnl ===================================================================
13803 dnl Test whether to enable online update service
13804 dnl ===================================================================
13805 AC_MSG_CHECKING([whether to enable online update])
13806 ENABLE_ONLINE_UPDATE=
13807 if test "$enable_online_update" = ""; then
13808     AC_MSG_RESULT([no])
13809 else
13810     if test "$enable_online_update" = "mar"; then
13811         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13812     elif test "$enable_online_update" = "yes"; then
13813         if test "$enable_curl" != "yes"; then
13814             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13815         fi
13816         AC_MSG_RESULT([yes])
13817         ENABLE_ONLINE_UPDATE="TRUE"
13818     else
13819         AC_MSG_RESULT([no])
13820     fi
13822 AC_SUBST(ENABLE_ONLINE_UPDATE)
13825 dnl ===================================================================
13826 dnl Test whether to enable mar online update service
13827 dnl ===================================================================
13828 AC_MSG_CHECKING([whether to enable mar online update])
13829 ENABLE_ONLINE_UPDATE_MAR=
13830 if test "$enable_online_update_mar" = yes; then
13831     AC_MSG_RESULT([yes])
13832     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13833     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13834     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13835 else
13836     AC_MSG_RESULT([no])
13838 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13840 AC_MSG_CHECKING([for mar online update baseurl])
13841 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13842 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13843     AC_MSG_RESULT([yes])
13844 else
13845     AC_MSG_RESULT([no])
13847 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13849 AC_MSG_CHECKING([for mar online update certificateder])
13850 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13851 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13852     AC_MSG_RESULT([yes])
13853 else
13854     AC_MSG_RESULT([no])
13856 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13858 AC_MSG_CHECKING([for mar online update certificatename])
13859 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13860 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13861     AC_MSG_RESULT([yes])
13862 else
13863     AC_MSG_RESULT([no])
13865 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13867 AC_MSG_CHECKING([for mar online update certificatepath])
13868 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13869 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13870     AC_MSG_RESULT([yes])
13871 else
13872     AC_MSG_RESULT([no])
13874 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13877 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13878 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13879     if test "x$with_privacy_policy_url" = "xundefined"; then
13880         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13881     fi
13883 AC_SUBST(PRIVACY_POLICY_URL)
13884 dnl ===================================================================
13885 dnl Test whether we need bzip2
13886 dnl ===================================================================
13887 SYSTEM_BZIP2=
13888 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13889     AC_MSG_CHECKING([whether to use system bzip2])
13890     if test "$with_system_bzip2" = yes; then
13891         SYSTEM_BZIP2=TRUE
13892         AC_MSG_RESULT([yes])
13893         PKG_CHECK_MODULES(BZIP2, bzip2)
13894         FilterLibs "${BZIP2_LIBS}"
13895         BZIP2_LIBS="${filteredlibs}"
13896     else
13897         AC_MSG_RESULT([no])
13898         BUILD_TYPE="$BUILD_TYPE BZIP2"
13899     fi
13901 AC_SUBST(SYSTEM_BZIP2)
13902 AC_SUBST(BZIP2_CFLAGS)
13903 AC_SUBST(BZIP2_LIBS)
13905 dnl ===================================================================
13906 dnl Test whether to enable extension update
13907 dnl ===================================================================
13908 AC_MSG_CHECKING([whether to enable extension update])
13909 ENABLE_EXTENSION_UPDATE=
13910 if test "x$enable_extension_update" = "xno"; then
13911     AC_MSG_RESULT([no])
13912 else
13913     AC_MSG_RESULT([yes])
13914     ENABLE_EXTENSION_UPDATE="TRUE"
13915     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13916     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13918 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13921 dnl ===================================================================
13922 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13923 dnl ===================================================================
13924 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13925 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13926     AC_MSG_RESULT([no])
13927     ENABLE_SILENT_MSI=
13928 else
13929     AC_MSG_RESULT([yes])
13930     ENABLE_SILENT_MSI=TRUE
13931     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13933 AC_SUBST(ENABLE_SILENT_MSI)
13935 dnl ===================================================================
13936 dnl Check for WiX tools.
13937 dnl ===================================================================
13938 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13939     AC_MSG_RESULT([no])
13940     ENABLE_WIX=
13941 else
13942     AC_MSG_RESULT([yes])
13943     # FIXME: this should do proper detection, but the path is currently
13944     # hardcoded in msicreator/createmsi.py
13945     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13946       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13947     fi
13948     ENABLE_WIX=TRUE
13950 AC_SUBST(ENABLE_WIX)
13952 AC_MSG_CHECKING([whether and how to use Xinerama])
13953 if test "$USING_X11" = TRUE; then
13954     if test "$x_libraries" = "default_x_libraries"; then
13955         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13956         if test "x$XINERAMALIB" = x; then
13957            XINERAMALIB="/usr/lib"
13958         fi
13959     else
13960         XINERAMALIB="$x_libraries"
13961     fi
13962     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13963         # we have both versions, let the user decide but use the dynamic one
13964         # per default
13965         USE_XINERAMA=TRUE
13966         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13967             XINERAMA_LINK=dynamic
13968         else
13969             XINERAMA_LINK=static
13970         fi
13971     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13972         # we have only the dynamic version
13973         USE_XINERAMA=TRUE
13974         XINERAMA_LINK=dynamic
13975     elif test -e "$XINERAMALIB/libXinerama.a"; then
13976         # static version
13977         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13978             USE_XINERAMA=TRUE
13979             XINERAMA_LINK=static
13980         else
13981             USE_XINERAMA=
13982             XINERAMA_LINK=none
13983         fi
13984     else
13985         # no Xinerama
13986         USE_XINERAMA=
13987         XINERAMA_LINK=none
13988     fi
13989     if test "$USE_XINERAMA" = "TRUE"; then
13990         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13991         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13992             [AC_MSG_ERROR(Xinerama header not found.)], [])
13993         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13994         if test "x$XEXTLIB" = x; then
13995            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13996         fi
13997         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13998         if test "$_os" = "FreeBSD"; then
13999             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
14000         fi
14001         if test "$_os" = "Linux"; then
14002             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
14003         fi
14004         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
14005             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
14006     else
14007         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
14008     fi
14009 else
14010     USE_XINERAMA=
14011     XINERAMA_LINK=none
14012     AC_MSG_RESULT([no])
14014 AC_SUBST(XINERAMA_LINK)
14016 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14017 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14018     enable_cairo_rgba=yes
14020 if test "$enable_cairo_rgba" = yes; then
14021     AC_DEFINE(ENABLE_CAIRO_RGBA)
14022     ENABLE_CAIRO_RGBA=TRUE
14023     AC_MSG_RESULT([yes])
14024 else
14025     ENABLE_CAIRO_RGBA=
14026     AC_MSG_RESULT([no])
14028 AC_SUBST(ENABLE_CAIRO_RGBA)
14030 dnl ===================================================================
14031 dnl Test whether to build cairo or rely on the system version
14032 dnl ===================================================================
14034 if test "$test_cairo" = "yes"; then
14035     AC_MSG_CHECKING([whether to use the system cairo])
14037     : ${with_system_cairo:=$with_system_libs}
14038     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14039         SYSTEM_CAIRO=TRUE
14040         AC_MSG_RESULT([yes])
14042         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14043         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14044         FilterLibs "${CAIRO_LIBS}"
14045         CAIRO_LIBS="${filteredlibs}"
14047         if test "$test_xrender" = "yes"; then
14048             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14049             AC_LANG_PUSH([C])
14050             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14051 #ifdef PictStandardA8
14052 #else
14053       return fail;
14054 #endif
14055 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14057             AC_LANG_POP([C])
14058         fi
14059     else
14060         AC_MSG_RESULT([no])
14061         BUILD_TYPE="$BUILD_TYPE CAIRO"
14062     fi
14064     if test "$enable_cairo_canvas" != no; then
14065         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14066         ENABLE_CAIRO_CANVAS=TRUE
14067     fi
14070 AC_SUBST(CAIRO_CFLAGS)
14071 AC_SUBST(CAIRO_LIBS)
14072 AC_SUBST(ENABLE_CAIRO_CANVAS)
14073 AC_SUBST(SYSTEM_CAIRO)
14075 dnl ===================================================================
14076 dnl Test whether to use avahi
14077 dnl ===================================================================
14078 if test "$_os" = "WINNT"; then
14079     # Windows uses bundled mDNSResponder
14080     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14081 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14082     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14083                       [ENABLE_AVAHI="TRUE"])
14084     AC_DEFINE(HAVE_FEATURE_AVAHI)
14085     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14086     FilterLibs "${AVAHI_LIBS}"
14087     AVAHI_LIBS="${filteredlibs}"
14090 AC_SUBST(ENABLE_AVAHI)
14091 AC_SUBST(AVAHI_CFLAGS)
14092 AC_SUBST(AVAHI_LIBS)
14094 dnl ===================================================================
14095 dnl Test whether to use liblangtag
14096 dnl ===================================================================
14097 SYSTEM_LIBLANGTAG=
14098 AC_MSG_CHECKING([whether to use system liblangtag])
14099 if test "$with_system_liblangtag" = yes; then
14100     SYSTEM_LIBLANGTAG=TRUE
14101     AC_MSG_RESULT([yes])
14102     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14103     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14104     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14105     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14106     FilterLibs "${LIBLANGTAG_LIBS}"
14107     LIBLANGTAG_LIBS="${filteredlibs}"
14108 else
14109     SYSTEM_LIBLANGTAG=
14110     AC_MSG_RESULT([no])
14111     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14112     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14113     if test "$COM" = "MSC"; then
14114         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14115     else
14116         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14117     fi
14119 AC_SUBST(SYSTEM_LIBLANGTAG)
14120 AC_SUBST(LIBLANGTAG_CFLAGS)
14121 AC_SUBST(LIBLANGTAG_LIBS)
14123 dnl ===================================================================
14124 dnl Test whether to build libpng or rely on the system version
14125 dnl ===================================================================
14127 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14128 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
14129 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14131 dnl ===================================================================
14132 dnl Test whether to build libtiff or rely on the system version
14133 dnl ===================================================================
14135 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14137 dnl ===================================================================
14138 dnl Test whether to build libwebp or rely on the system version
14139 dnl ===================================================================
14141 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14143 dnl ===================================================================
14144 dnl Check for runtime JVM search path
14145 dnl ===================================================================
14146 if test "$ENABLE_JAVA" != ""; then
14147     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14148     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14149         AC_MSG_RESULT([yes])
14150         if ! test -d "$with_jvm_path"; then
14151             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14152         fi
14153         if ! test -d "$with_jvm_path"jvm; then
14154             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14155         fi
14156         JVM_ONE_PATH_CHECK="$with_jvm_path"
14157         AC_SUBST(JVM_ONE_PATH_CHECK)
14158     else
14159         AC_MSG_RESULT([no])
14160     fi
14163 dnl ===================================================================
14164 dnl Test for the presence of Ant and that it works
14165 dnl ===================================================================
14167 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14168 # breaks filename decoding, so for the ant section, set it to LANG
14169 LC_ALL=$LANG
14170 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14171     ANT_HOME=; export ANT_HOME
14172     WITH_ANT_HOME=; export WITH_ANT_HOME
14173     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14174         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14175             if test "$_os" = "WINNT"; then
14176                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14177             else
14178                 with_ant_home="$LODE_HOME/opt/ant"
14179             fi
14180         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14181             with_ant_home="$LODE_HOME/opt/ant"
14182         fi
14183     fi
14184     if test -z "$with_ant_home"; then
14185         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14186     else
14187         if test "$_os" = "WINNT"; then
14188             # AC_PATH_PROGS needs unix path
14189             PathFormat "$with_ant_home"
14190             with_ant_home="$formatted_path_unix"
14191         fi
14192         AbsolutePath "$with_ant_home"
14193         with_ant_home=$absolute_path
14194         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14195         WITH_ANT_HOME=$with_ant_home
14196         ANT_HOME=$with_ant_home
14197     fi
14199     if test -z "$ANT"; then
14200         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14201     else
14202         # resolve relative or absolute symlink
14203         while test -h "$ANT"; do
14204             a_cwd=`pwd`
14205             a_basename=`basename "$ANT"`
14206             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14207             cd "`dirname "$ANT"`"
14208             cd "`dirname "$a_script"`"
14209             ANT="`pwd`"/"`basename "$a_script"`"
14210             cd "$a_cwd"
14211         done
14213         AC_MSG_CHECKING([if $ANT works])
14214         mkdir -p conftest.dir
14215         a_cwd=$(pwd)
14216         cd conftest.dir
14217         cat > conftest.java << EOF
14218         public class conftest {
14219             int testmethod(int a, int b) {
14220                     return a + b;
14221             }
14222         }
14225         cat > conftest.xml << EOF
14226         <project name="conftest" default="conftest">
14227         <target name="conftest">
14228             <javac srcdir="." includes="conftest.java">
14229             </javac>
14230         </target>
14231         </project>
14234         if test -n "$WSL_ONLY_AS_HELPER"; then
14235             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14236             export JAVACMD="$JAVAINTERPRETER"
14237             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14238             # building the classpath, but we need the windows-style one for the windows-java
14239             PathFormat "$ANT_HOME"
14240             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14241         fi
14242         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14243         if test $? = 0 -a -f ./conftest.class; then
14244             AC_MSG_RESULT([Ant works])
14245             if test -z "$WITH_ANT_HOME"; then
14246                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14247                 if test -z "$ANT_HOME"; then
14248                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14249                 fi
14250             else
14251                 ANT_HOME="$WITH_ANT_HOME"
14252             fi
14253         else
14254             echo "configure: Ant test failed" >&5
14255             cat conftest.java >&5
14256             cat conftest.xml >&5
14257             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14258         fi
14259         cd "$a_cwd"
14260         rm -fr conftest.dir
14261     fi
14262     if test -z "$ANT_HOME"; then
14263         ANT_HOME="NO_ANT_HOME"
14264     else
14265         PathFormat "$ANT_HOME"
14266         ANT_HOME="$formatted_path_unix"
14267         PathFormat "$ANT"
14268         ANT="$formatted_path_unix"
14269     fi
14271     dnl Checking for ant.jar
14272     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14273         AC_MSG_CHECKING([Ant lib directory])
14274         if test -f $ANT_HOME/lib/ant.jar; then
14275             ANT_LIB="$ANT_HOME/lib"
14276         else
14277             if test -f $ANT_HOME/ant.jar; then
14278                 ANT_LIB="$ANT_HOME"
14279             else
14280                 if test -f /usr/share/java/ant.jar; then
14281                     ANT_LIB=/usr/share/java
14282                 else
14283                     if test -f /usr/share/ant-core/lib/ant.jar; then
14284                         ANT_LIB=/usr/share/ant-core/lib
14285                     else
14286                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14287                             ANT_LIB="$ANT_HOME/lib/ant"
14288                         else
14289                             if test -f /usr/share/lib/ant/ant.jar; then
14290                                 ANT_LIB=/usr/share/lib/ant
14291                             else
14292                                 AC_MSG_ERROR([Ant libraries not found!])
14293                             fi
14294                         fi
14295                     fi
14296                 fi
14297             fi
14298         fi
14299         PathFormat "$ANT_LIB"
14300         ANT_LIB="$formatted_path"
14301         AC_MSG_RESULT([Ant lib directory found.])
14302     fi
14304     ant_minver=1.6.0
14305     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14307     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14308     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14309     ant_version_major=`echo $ant_version | cut -d. -f1`
14310     ant_version_minor=`echo $ant_version | cut -d. -f2`
14311     echo "configure: ant_version $ant_version " >&5
14312     echo "configure: ant_version_major $ant_version_major " >&5
14313     echo "configure: ant_version_minor $ant_version_minor " >&5
14314     if test "$ant_version_major" -ge "2"; then
14315         AC_MSG_RESULT([yes, $ant_version])
14316     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14317         AC_MSG_RESULT([yes, $ant_version])
14318     else
14319         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14320     fi
14322     rm -f conftest* core core.* *.core
14324 AC_SUBST(ANT)
14325 AC_SUBST(ANT_HOME)
14326 AC_SUBST(ANT_LIB)
14328 OOO_JUNIT_JAR=
14329 HAMCREST_JAR=
14330 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14331     AC_MSG_CHECKING([for JUnit 4])
14332     if test "$with_junit" = "yes"; then
14333         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14334             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14335         elif test -e /usr/share/java/junit4.jar; then
14336             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14337         else
14338            if test -e /usr/share/lib/java/junit.jar; then
14339               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14340            else
14341               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14342            fi
14343         fi
14344     else
14345         OOO_JUNIT_JAR=$with_junit
14346     fi
14347     if test "$_os" = "WINNT"; then
14348         PathFormat "$OOO_JUNIT_JAR"
14349         OOO_JUNIT_JAR="$formatted_path"
14350     fi
14351     printf 'import org.junit.Before;' > conftest.java
14352     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14353         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14354     else
14355         AC_MSG_ERROR(
14356 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14357  specify its pathname via --with-junit=..., or disable it via --without-junit])
14358     fi
14359     rm -f conftest.class conftest.java
14360     if test $OOO_JUNIT_JAR != ""; then
14361         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14362     fi
14364     AC_MSG_CHECKING([for included Hamcrest])
14365     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14366     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14367         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14368     else
14369         AC_MSG_RESULT([Not included])
14370         AC_MSG_CHECKING([for standalone hamcrest jar.])
14371         if test "$with_hamcrest" = "yes"; then
14372             if test -e /usr/share/lib/java/hamcrest.jar; then
14373                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14374             elif test -e /usr/share/java/hamcrest/core.jar; then
14375                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14376             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14377                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14378             else
14379                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14380             fi
14381         else
14382             HAMCREST_JAR=$with_hamcrest
14383         fi
14384         if test "$_os" = "WINNT"; then
14385             PathFormat "$HAMCREST_JAR"
14386             HAMCREST_JAR="$formatted_path"
14387         fi
14388         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14389             AC_MSG_RESULT([$HAMCREST_JAR])
14390         else
14391             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),
14392                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14393         fi
14394     fi
14395     rm -f conftest.class conftest.java
14397 AC_SUBST(OOO_JUNIT_JAR)
14398 AC_SUBST(HAMCREST_JAR)
14399 # set back LC_ALL to C after the java related tests...
14400 LC_ALL=C
14402 AC_SUBST(SCPDEFS)
14405 # check for wget and curl
14407 WGET=
14408 CURL=
14410 if test "$enable_fetch_external" != "no"; then
14412 CURL=`command -v curl`
14414 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14415     # wget new enough?
14416     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14417     if test $? -eq 0; then
14418         WGET=$i
14419         break
14420     fi
14421 done
14423 if test -z "$WGET" -a -z "$CURL"; then
14424     AC_MSG_ERROR([neither wget nor curl found!])
14429 AC_SUBST(WGET)
14430 AC_SUBST(CURL)
14433 # check for sha256sum
14435 SHA256SUM=
14437 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14438     eval "$i -a 256 --version" > /dev/null 2>&1
14439     ret=$?
14440     if test $ret -eq 0; then
14441         SHA256SUM="$i -a 256"
14442         break
14443     fi
14444 done
14446 if test -z "$SHA256SUM"; then
14447     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14448         eval "$i --version" > /dev/null 2>&1
14449         ret=$?
14450         if test $ret -eq 0; then
14451             SHA256SUM=$i
14452             break
14453         fi
14454     done
14457 if test -z "$SHA256SUM"; then
14458     AC_MSG_ERROR([no sha256sum found!])
14461 AC_SUBST(SHA256SUM)
14463 dnl ===================================================================
14464 dnl Dealing with l10n options
14465 dnl ===================================================================
14466 AC_MSG_CHECKING([which languages to be built])
14467 # get list of all languages
14468 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14469 # we want en-US at the beginning
14470 ALL_LANGS=$($GNUMAKE SRC_ROOT=$SRC_ROOT WITH_LANG="$with_lang" ENABLE_RELEASE_BUILD="$ENABLE_RELEASE_BUILD" -sr -f - <<'EOF' | tr -d '\r'
14471 include $(SRC_ROOT)/solenv/inc/langlist.mk
14472 all:
14473         $(info en-US $(filter-out en-US,$(sort $(completelangiso))))
14477 # check the configured localizations
14478 WITH_LANG="$with_lang"
14480 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14481 # (Norwegian is "nb" and "nn".)
14482 if test "$WITH_LANG" = "no"; then
14483     WITH_LANG=
14486 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14487     AC_MSG_RESULT([en-US])
14488 else
14489     AC_MSG_RESULT([$WITH_LANG])
14490     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14491     if test -z "$MSGFMT"; then
14492         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14493             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14494         elif test -x "/opt/lo/bin/msgfmt"; then
14495             MSGFMT="/opt/lo/bin/msgfmt"
14496         else
14497             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14498             if test -z "$MSGFMT"; then
14499                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14500             fi
14501         fi
14502     fi
14503     if test -z "$MSGUNIQ"; then
14504         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14505             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14506         elif test -x "/opt/lo/bin/msguniq"; then
14507             MSGUNIQ="/opt/lo/bin/msguniq"
14508         else
14509             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14510             if test -z "$MSGUNIQ"; then
14511                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14512             fi
14513         fi
14514     fi
14516 AC_SUBST(MSGFMT)
14517 AC_SUBST(MSGUNIQ)
14518 # check that the list is valid
14519 for lang in $WITH_LANG; do
14520     test "$lang" = "ALL" && continue
14521     # need to check for the exact string, so add space before and after the list of all languages
14522     for vl in $ALL_LANGS; do
14523         if test "$vl" = "$lang"; then
14524            break
14525         fi
14526     done
14527     if test "$vl" != "$lang"; then
14528         # if you're reading this - you prolly quoted your languages remove the quotes ...
14529         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14530     fi
14531 done
14532 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14533     echo $WITH_LANG | grep -q en-US
14534     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14536 # list with substituted ALL
14537 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14538 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14539 test "$WITH_LANG" = "en-US" && WITH_LANG=
14540 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14541     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14542     ALL_LANGS=`echo $ALL_LANGS qtz`
14544 AC_SUBST(ALL_LANGS)
14545 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14546 AC_SUBST(WITH_LANG)
14547 AC_SUBST(WITH_LANG_LIST)
14548 AC_SUBST(GIT_NEEDED_SUBMODULES)
14550 WITH_POOR_HELP_LOCALIZATIONS=
14551 if test -d "$SRC_ROOT/translations/source"; then
14552     for l in `ls -1 $SRC_ROOT/translations/source`; do
14553         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14554             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14555         fi
14556     done
14558 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14560 if test -n "$with_locales" -a "$with_locales" != ALL; then
14561     WITH_LOCALES="$with_locales"
14563     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14564     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14565     # config_host/config_locales.h.in
14566     for locale in $WITH_LOCALES; do
14567         lang=${locale%_*}
14569         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14571         case $lang in
14572         hi|mr*ne)
14573             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14574             ;;
14575         bg|ru)
14576             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14577             ;;
14578         esac
14579     done
14580 else
14581     AC_DEFINE(WITH_LOCALE_ALL)
14583 AC_SUBST(WITH_LOCALES)
14585 dnl git submodule update --reference
14586 dnl ===================================================================
14587 if test -n "${GIT_REFERENCE_SRC}"; then
14588     for repo in ${GIT_NEEDED_SUBMODULES}; do
14589         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14590             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14591         fi
14592     done
14594 AC_SUBST(GIT_REFERENCE_SRC)
14596 dnl git submodules linked dirs
14597 dnl ===================================================================
14598 if test -n "${GIT_LINK_SRC}"; then
14599     for repo in ${GIT_NEEDED_SUBMODULES}; do
14600         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14601             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14602         fi
14603     done
14605 AC_SUBST(GIT_LINK_SRC)
14607 dnl branding
14608 dnl ===================================================================
14609 AC_MSG_CHECKING([for alternative branding images directory])
14610 # initialize mapped arrays
14611 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14612 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14614 if test -z "$with_branding" -o "$with_branding" = "no"; then
14615     AC_MSG_RESULT([none])
14616     DEFAULT_BRAND_IMAGES="$brand_files"
14617 else
14618     if ! test -d $with_branding ; then
14619         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14620     else
14621         AC_MSG_RESULT([$with_branding])
14622         CUSTOM_BRAND_DIR="$with_branding"
14623         for lfile in $brand_files
14624         do
14625             if ! test -f $with_branding/$lfile ; then
14626                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14627                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14628             else
14629                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14630             fi
14631         done
14632         check_for_progress="yes"
14633     fi
14635 AC_SUBST([BRAND_INTRO_IMAGES])
14636 AC_SUBST([CUSTOM_BRAND_DIR])
14637 AC_SUBST([CUSTOM_BRAND_IMAGES])
14638 AC_SUBST([DEFAULT_BRAND_IMAGES])
14641 AC_MSG_CHECKING([for 'intro' progress settings])
14642 PROGRESSBARCOLOR=
14643 PROGRESSSIZE=
14644 PROGRESSPOSITION=
14645 PROGRESSFRAMECOLOR=
14646 PROGRESSTEXTCOLOR=
14647 PROGRESSTEXTBASELINE=
14649 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14650     source "$with_branding/progress.conf"
14651     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14652 else
14653     AC_MSG_RESULT([none])
14656 AC_SUBST(PROGRESSBARCOLOR)
14657 AC_SUBST(PROGRESSSIZE)
14658 AC_SUBST(PROGRESSPOSITION)
14659 AC_SUBST(PROGRESSFRAMECOLOR)
14660 AC_SUBST(PROGRESSTEXTCOLOR)
14661 AC_SUBST(PROGRESSTEXTBASELINE)
14664 dnl ===================================================================
14665 dnl Custom build version
14666 dnl ===================================================================
14667 AC_MSG_CHECKING([for extra build ID])
14668 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14669     EXTRA_BUILDID="$with_extra_buildid"
14671 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14672 if test -n "$EXTRA_BUILDID" ; then
14673     AC_MSG_RESULT([$EXTRA_BUILDID])
14674 else
14675     AC_MSG_RESULT([not set])
14677 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14679 OOO_VENDOR=
14680 AC_MSG_CHECKING([for vendor])
14681 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14682     OOO_VENDOR="$USERNAME"
14684     if test -z "$OOO_VENDOR"; then
14685         OOO_VENDOR="$USER"
14686     fi
14688     if test -z "$OOO_VENDOR"; then
14689         OOO_VENDOR="`id -u -n`"
14690     fi
14692     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14693 else
14694     OOO_VENDOR="$with_vendor"
14695     AC_MSG_RESULT([$OOO_VENDOR])
14697 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14698 AC_SUBST(OOO_VENDOR)
14700 if test "$_os" = "Android" ; then
14701     ANDROID_PACKAGE_NAME=
14702     AC_MSG_CHECKING([for Android package name])
14703     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14704         if test -n "$ENABLE_DEBUG"; then
14705             # Default to the package name that makes ndk-gdb happy.
14706             ANDROID_PACKAGE_NAME="org.libreoffice"
14707         else
14708             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14709         fi
14711         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14712     else
14713         ANDROID_PACKAGE_NAME="$with_android_package_name"
14714         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14715     fi
14716     AC_SUBST(ANDROID_PACKAGE_NAME)
14719 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14720 if test "$with_compat_oowrappers" = "yes"; then
14721     WITH_COMPAT_OOWRAPPERS=TRUE
14722     AC_MSG_RESULT(yes)
14723 else
14724     WITH_COMPAT_OOWRAPPERS=
14725     AC_MSG_RESULT(no)
14727 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14729 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14730 AC_MSG_CHECKING([for install dirname])
14731 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14732     INSTALLDIRNAME="$with_install_dirname"
14734 AC_MSG_RESULT([$INSTALLDIRNAME])
14735 AC_SUBST(INSTALLDIRNAME)
14737 AC_MSG_CHECKING([for prefix])
14738 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14739 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14740 PREFIXDIR="$prefix"
14741 AC_MSG_RESULT([$PREFIXDIR])
14742 AC_SUBST(PREFIXDIR)
14744 LIBDIR=[$(eval echo $(eval echo $libdir))]
14745 AC_SUBST(LIBDIR)
14747 DATADIR=[$(eval echo $(eval echo $datadir))]
14748 AC_SUBST(DATADIR)
14750 MANDIR=[$(eval echo $(eval echo $mandir))]
14751 AC_SUBST(MANDIR)
14753 DOCDIR=[$(eval echo $(eval echo $docdir))]
14754 AC_SUBST(DOCDIR)
14756 BINDIR=[$(eval echo $(eval echo $bindir))]
14757 AC_SUBST(BINDIR)
14759 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14760 AC_SUBST(INSTALLDIR)
14762 TESTINSTALLDIR="${BUILDDIR}/test-install"
14763 AC_SUBST(TESTINSTALLDIR)
14766 # ===================================================================
14767 # OAuth2 id and secrets
14768 # ===================================================================
14770 AC_MSG_CHECKING([for Google Drive client id and secret])
14771 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14772     AC_MSG_RESULT([not set])
14773     GDRIVE_CLIENT_ID="\"\""
14774     GDRIVE_CLIENT_SECRET="\"\""
14775 else
14776     AC_MSG_RESULT([set])
14777     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14778     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14780 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14781 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14783 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14784 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14785     AC_MSG_RESULT([not set])
14786     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14787     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14788 else
14789     AC_MSG_RESULT([set])
14790     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14791     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14793 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14794 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14796 AC_MSG_CHECKING([for OneDrive client id and secret])
14797 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14798     AC_MSG_RESULT([not set])
14799     ONEDRIVE_CLIENT_ID="\"\""
14800     ONEDRIVE_CLIENT_SECRET="\"\""
14801 else
14802     AC_MSG_RESULT([set])
14803     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14804     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14806 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14807 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14810 dnl ===================================================================
14811 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14812 dnl --enable-dependency-tracking configure option
14813 dnl ===================================================================
14814 AC_MSG_CHECKING([whether to enable dependency tracking])
14815 if test "$enable_dependency_tracking" = "no"; then
14816     nodep=TRUE
14817     AC_MSG_RESULT([no])
14818 else
14819     AC_MSG_RESULT([yes])
14821 AC_SUBST(nodep)
14823 dnl ===================================================================
14824 dnl Number of CPUs to use during the build
14825 dnl ===================================================================
14826 AC_MSG_CHECKING([for number of processors to use])
14827 # plain --with-parallelism is just the default
14828 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14829     if test "$with_parallelism" = "no"; then
14830         PARALLELISM=0
14831     else
14832         PARALLELISM=$with_parallelism
14833     fi
14834 else
14835     if test "$enable_icecream" = "yes"; then
14836         PARALLELISM="40"
14837     else
14838         case `uname -s` in
14840         Darwin|FreeBSD|NetBSD|OpenBSD)
14841             PARALLELISM=`sysctl -n hw.ncpu`
14842             ;;
14844         Linux)
14845             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14846         ;;
14847         # what else than above does profit here *and* has /proc?
14848         *)
14849             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14850             ;;
14851         esac
14853         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14854         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14855     fi
14858 if test $PARALLELISM -eq 0; then
14859     AC_MSG_RESULT([explicit make -j option needed])
14860 else
14861     AC_MSG_RESULT([$PARALLELISM])
14863 AC_SUBST(PARALLELISM)
14866 # Set up ILIB for MSVC build
14868 ILIB1=
14869 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14870     ILIB="."
14871     if test -n "$JAVA_HOME"; then
14872         ILIB="$ILIB;$JAVA_HOME/lib"
14873     fi
14874     ILIB1=-link
14875     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14876     ILIB="$ILIB;$formatted_path"
14877     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14878     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14879     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14880     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14881         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14882         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14883     fi
14884     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14885     ucrtlibpath_formatted=$formatted_path
14886     ILIB="$ILIB;$ucrtlibpath_formatted"
14887     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14888     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14889         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14890         ILIB="$ILIB;$formatted_path"
14891     else
14892         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14893         ILIB="$ILIB;$formatted_path"
14894     fi
14896     if test "$cross_compiling" != "yes"; then
14897         ILIB_FOR_BUILD="$ILIB"
14898     fi
14900 AC_SUBST(ILIB)
14901 AC_SUBST(ILIB_FOR_BUILD)
14903 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14904 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14905 dnl from consteval constructor initializing const variable",
14906 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14907 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14908 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14909 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14910 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14911 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
14912 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
14913 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14914 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14915 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14916 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
14917 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
14918 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
14919 have_cpp_consteval=
14920 AC_LANG_PUSH([C++])
14921 save_CXX=$CXX
14922 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14923     CXX="env LIB=$ILIB $CXX"
14925 save_CXXFLAGS=$CXXFLAGS
14926 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14927 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14928         struct S {
14929             consteval S() { i = 1; }
14930             int i = 0;
14931         };
14932         S const s;
14934         struct S1 {
14935              int a;
14936              consteval S1(int n): a(n) {}
14937         };
14938         struct S2 {
14939             S1 x;
14940             S2(): x(0) {}
14941         };
14943         struct S3 {
14944             consteval S3() {}
14945             union {
14946                 int a;
14947                 unsigned b = 0;
14948             };
14949         };
14950         void f() { S3(); }
14952         struct S4 { consteval S4() = default; };
14953         void f4(bool b) { b ? S4() : S4(); }
14955         struct S5 {
14956             consteval S5() { c = 0; }
14957             char * f() { return &c; }
14958             union {
14959                 char c;
14960                 int i;
14961             };
14962         };
14963         auto s5 = S5().f();
14965         struct S6 {
14966             consteval S6(char const (&lit)[[2]]) {
14967                 buf[[0]] = lit[[0]];
14968                 buf[[1]] = lit[[1]];
14969             }
14970             union {
14971                 int x;
14972                 char buf[[2]];
14973             };
14974         };
14975         void f6() { S6("a"); }
14976     ], [
14977         return (s.i == 1) ? 0 : 1;
14978     ])], [
14979         have_cpp_consteval=1
14980         AC_MSG_RESULT([yes])
14981     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14982 CXX=$save_CXX
14983 CXXFLAGS=$save_CXXFLAGS
14984 AC_LANG_POP([C++])
14985 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
14986 then
14987     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
14988     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
14989     dnl reference to consteval constructor exported from module" (which also affects PCH, see
14990     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
14991     dnl --enable-pch setup is known broken"):
14992     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
14993     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
14994     rm conftest.cppm
14995     AC_LANG_PUSH([C++])
14996     save_CXXFLAGS=$CXXFLAGS
14997     save_LDFLAGS=$LDFLAGS
14998     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14999     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
15000     AC_LINK_IFELSE([AC_LANG_PROGRAM([
15001         import M;
15002     ], [
15003         struct S2 { S1 s = 0; };
15004         S2 s;
15005     ])], [
15006         AC_MSG_RESULT([yes])
15007     ], [
15008         have_cpp_consteval=
15009         AC_MSG_RESULT([no])])
15010     CXXFLAGS=$save_CXXFLAGS
15011     LDFLAGS=$save_LDFLAGS
15012     AC_LANG_POP([C++])
15013     rm conftest.pcm
15015 if test -n "$have_cpp_consteval"; then
15016     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15019 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15020 dnl ...which is known to not be implemented in libc++ prior to
15021 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15022 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15023 AC_LANG_PUSH([C++])
15024 save_CXX=$CXX
15025 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15026     CXX="env LIB=$ILIB $CXX"
15028 save_CXXFLAGS=$CXXFLAGS
15029 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15030 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15031         #include <compare>
15032     ], [
15033         (void) (std::strong_order(1.0, 2.0) < 0);
15034     ])], [
15035         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15036         AC_MSG_RESULT([yes])
15037     ], [AC_MSG_RESULT([no])])
15038 CXX=$save_CXX
15039 CXXFLAGS=$save_CXXFLAGS
15040 AC_LANG_POP([C++])
15042 # ===================================================================
15043 # Creating bigger shared library to link against
15044 # ===================================================================
15045 AC_MSG_CHECKING([whether to create huge library])
15046 MERGELIBS=
15047 MERGELIBS_MORE=
15049 if test $_os = iOS -o $_os = Android; then
15050     # Never any point in mergelibs for these as we build just static
15051     # libraries anyway...
15052     enable_mergelibs=no
15055 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15056     if test "$enable_mergelibs" = "more"; then
15057         MERGELIBS="TRUE"
15058         MERGELIBS_MORE="TRUE"
15059         AC_MSG_RESULT([yes (more)])
15060         AC_DEFINE(ENABLE_MERGELIBS)
15061         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15062     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15063         MERGELIBS="TRUE"
15064         AC_MSG_RESULT([yes])
15065         AC_DEFINE(ENABLE_MERGELIBS)
15066     else
15067         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15068     fi
15069 else
15070     AC_MSG_RESULT([no])
15072 AC_SUBST([MERGELIBS])
15073 AC_SUBST([MERGELIBS_MORE])
15075 dnl ===================================================================
15076 dnl icerun is a wrapper that stops us spawning tens of processes
15077 dnl locally - for tools that can't be executed on the compile cluster
15078 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15079 dnl ===================================================================
15080 AC_MSG_CHECKING([whether to use icerun wrapper])
15081 ICECREAM_RUN=
15082 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15083     ICECREAM_RUN=icerun
15084     AC_MSG_RESULT([yes])
15085 else
15086     AC_MSG_RESULT([no])
15088 AC_SUBST(ICECREAM_RUN)
15090 dnl ===================================================================
15091 dnl Setup the ICECC_VERSION for the build the same way it was set for
15092 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15093 dnl ===================================================================
15094 x_ICECC_VERSION=[\#]
15095 if test -n "$ICECC_VERSION" ; then
15096     x_ICECC_VERSION=
15098 AC_SUBST(x_ICECC_VERSION)
15099 AC_SUBST(ICECC_VERSION)
15101 dnl ===================================================================
15103 AC_MSG_CHECKING([MPL subset])
15104 MPL_SUBSET=
15105 LICENSE="LGPL"
15107 if test "$enable_mpl_subset" = "yes"; then
15108     mpl_error_string=
15109     newline=$'\n    *'
15110     warn_report=false
15111     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15112         warn_report=true
15113     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15114         warn_report=true
15115     fi
15116     if test "$warn_report" = "true"; then
15117         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15118     fi
15119     if test "x$enable_postgresql_sdbc" != "xno"; then
15120         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15121     fi
15122     if test "$enable_lotuswordpro" = "yes"; then
15123         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15124     fi
15125     if test -n "$ENABLE_POPPLER"; then
15126         if test "x$SYSTEM_POPPLER" = "x"; then
15127             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15128         fi
15129     fi
15130     # cf. m4/libo_check_extension.m4
15131     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15132         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15133     fi
15134     denied_themes=
15135     filtered_themes=
15136     for theme in $WITH_THEMES; do
15137         case $theme in
15138         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15139             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15140         *)
15141             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15142         esac
15143     done
15144     if test "x$denied_themes" != "x"; then
15145         if test "x$filtered_themes" == "x"; then
15146             filtered_themes="colibre"
15147         fi
15148         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15149     fi
15151     ENABLE_OPENGL_TRANSITIONS=
15153     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15154         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15155     fi
15157     if test "x$mpl_error_string" != "x"; then
15158         AC_MSG_ERROR([$mpl_error_string])
15159     fi
15161     MPL_SUBSET="TRUE"
15162     LICENSE="MPL-2.0"
15163     AC_DEFINE(MPL_HAVE_SUBSET)
15164     AC_MSG_RESULT([only])
15165 else
15166     AC_MSG_RESULT([no restrictions])
15168 AC_SUBST(MPL_SUBSET)
15169 AC_SUBST(LICENSE)
15171 dnl ===================================================================
15173 AC_MSG_CHECKING([formula logger])
15174 ENABLE_FORMULA_LOGGER=
15176 if test "x$enable_formula_logger" = "xyes"; then
15177     AC_MSG_RESULT([yes])
15178     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15179     ENABLE_FORMULA_LOGGER=TRUE
15180 elif test -n "$ENABLE_DBGUTIL" ; then
15181     AC_MSG_RESULT([yes])
15182     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15183     ENABLE_FORMULA_LOGGER=TRUE
15184 else
15185     AC_MSG_RESULT([no])
15188 AC_SUBST(ENABLE_FORMULA_LOGGER)
15190 dnl ===================================================================
15191 dnl Checking for active Antivirus software.
15192 dnl ===================================================================
15194 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15195     AC_MSG_CHECKING([for active Antivirus software])
15196     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15197     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15198     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15199         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15200             AC_MSG_RESULT([found])
15201             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15202             echo $EICAR_STRING > $SRC_ROOT/eicar
15203             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15204             rm $SRC_ROOT/eicar
15205             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15206                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15207             fi
15208             echo $EICAR_STRING > $BUILDDIR/eicar
15209             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15210             rm $BUILDDIR/eicar
15211             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15212                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15213             fi
15214             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"
15215         else
15216             AC_MSG_RESULT([not found])
15217         fi
15218     else
15219         AC_MSG_RESULT([n/a])
15220     fi
15223 dnl ===================================================================
15225 AC_MSG_CHECKING([for coredumpctl support])
15226 if test -z "$with_coredumpctl" && test $_os != Linux; then
15227     with_coredumpctl=no
15229 if test "$with_coredumpctl" = no; then
15230     WITH_COREDUMPCTL=
15231 else
15232     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15233     AC_PATH_PROG(JQ, jq)
15234     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15235     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15236     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15237         || test -z "$SYSTEMD_RUN"
15238     then
15239         if test -z "$with_coredumpctl"; then
15240             WITH_COREDUMPCTL=
15241         else
15242             if test -z "$COREDUMPCTL"; then
15243                 AC_MSG_ERROR([coredumpctl not found])
15244             fi
15245             if test -z "$JQ"; then
15246                 AC_MSG_ERROR([jq not found])
15247             fi
15248             if test -z "$SYSTEMD_ESCAPE"; then
15249                 AC_MSG_ERROR([systemd-escape not found])
15250             fi
15251             if test -z "$SYSTEMD_RUN"; then
15252                 AC_MSG_ERROR([systemd-run not found])
15253             fi
15254         fi
15255     else
15256         WITH_COREDUMPCTL=TRUE
15257     fi
15259 if test -z "$WITH_COREDUMPCTL"; then
15260     AC_MSG_RESULT([no])
15261 else
15262     AC_MSG_RESULT([yes])
15264 AC_SUBST(COREDUMPCTL)
15265 AC_SUBST(JQ)
15266 AC_SUBST(SYSTEMD_ESCAPE)
15267 AC_SUBST(SYSTEMD_RUN)
15268 AC_SUBST(WITH_COREDUMPCTL)
15270 dnl ===================================================================
15271 dnl Checking whether to use a keep-awake helper
15272 dnl ===================================================================
15274 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15275 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15276     AC_MSG_RESULT([no])
15277 elif test "$with_keep_awake" = "yes"; then
15278     AC_MSG_RESULT([yes (autodetect)])
15279     AC_MSG_CHECKING([for a suitable keep-awake command])
15280     if test "$_os" = "WINNT"; then
15281         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15282         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15283             AC_MSG_RESULT([using "Awake"])
15284             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15285             # make's PID and then use that to get the windows-PID.
15286             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15287             # much scarier looking than it actually is. Using make's shell instead of subshells in
15288             # the recipe to keep the command that's echoed by make short.
15289             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}'"'"') &'
15290         else
15291             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15292         fi
15293     elif test "$_os" = "Darwin"; then
15294         AC_MSG_RESULT([using "caffeinate"])
15295         KEEP_AWAKE_CMD="caffeinate"
15296     else
15297         AC_MSG_ERROR([no default available for $_os, please specify manually])
15298     fi
15299 else
15300     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15302 AC_SUBST(KEEP_AWAKE_CMD)
15304 dnl ===================================================================
15305 dnl Setting up the environment.
15306 dnl ===================================================================
15307 AC_MSG_NOTICE([setting up the build environment variables...])
15309 AC_SUBST(COMPATH)
15311 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15312     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15313         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15314         ATL_INCLUDE="$COMPATH/atlmfc/include"
15315     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15316         ATL_LIB="$COMPATH/atlmfc/lib"
15317         ATL_INCLUDE="$COMPATH/atlmfc/include"
15318     else
15319         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15320         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15321     fi
15322     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15323     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15324     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15327 if test "$build_os" = "cygwin"; then
15328     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15329     PathFormat "/usr/bin/find.exe"
15330     FIND="$formatted_path"
15331     PathFormat "/usr/bin/sort.exe"
15332     SORT="$formatted_path"
15333     PathFormat "/usr/bin/grep.exe"
15334     WIN_GREP="$formatted_path"
15335     PathFormat "/usr/bin/ls.exe"
15336     WIN_LS="$formatted_path"
15337     PathFormat "/usr/bin/touch.exe"
15338     WIN_TOUCH="$formatted_path"
15339 else
15340     FIND=find
15341     SORT=sort
15344 AC_SUBST(ATL_INCLUDE)
15345 AC_SUBST(ATL_LIB)
15346 AC_SUBST(FIND)
15347 AC_SUBST(SORT)
15348 AC_SUBST(WIN_GREP)
15349 AC_SUBST(WIN_LS)
15350 AC_SUBST(WIN_TOUCH)
15352 AC_SUBST(BUILD_TYPE)
15354 AC_SUBST(SOLARINC)
15356 PathFormat "$PERL"
15357 PERL="$formatted_path"
15358 AC_SUBST(PERL)
15360 if test -n "$TMPDIR"; then
15361     TEMP_DIRECTORY="$TMPDIR"
15362     if test -n "$WSL_ONLY_AS_HELPER"; then
15363        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15364     fi
15365 else
15366     TEMP_DIRECTORY="/tmp"
15368 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15369 if test "$build_os" = "cygwin"; then
15370     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15371     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15373 AC_SUBST(TEMP_DIRECTORY)
15374 AC_SUBST(CYGWIN_BASH)
15376 # setup the PATH for the environment
15377 if test -n "$LO_PATH_FOR_BUILD"; then
15378     LO_PATH="$LO_PATH_FOR_BUILD"
15379     case "$host_os" in
15380     cygwin*|wsl*)
15381         pathmunge "$MSVC_HOST_PATH" "before"
15382         ;;
15383     esac
15384 else
15385     LO_PATH="$PATH"
15387     case "$host_os" in
15389     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15390         if test "$ENABLE_JAVA" != ""; then
15391             pathmunge "$JAVA_HOME/bin" "after"
15392         fi
15393         ;;
15395     cygwin*|wsl*)
15396         # Win32 make needs native paths
15397         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15398             LO_PATH=`cygpath -p -m "$PATH"`
15399         fi
15400         if test "$WIN_BUILD_ARCH" = "x64"; then
15401             # needed for msi packaging
15402             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15403         fi
15404         if test "$WIN_BUILD_ARCH" = "arm64"; then
15405             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15406             # the x86 ones probably would work just as well...
15407             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15408         fi
15409         # .NET 4.6 and higher don't have bin directory
15410         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15411             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15412         fi
15413         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15414         pathmunge "$CSC_PATH" "before"
15415         pathmunge "$MIDL_PATH" "before"
15416         pathmunge "$AL_PATH" "before"
15417         pathmunge "$MSVC_MULTI_PATH" "before"
15418         pathmunge "$MSVC_BUILD_PATH" "before"
15419         if test -n "$MSBUILD_PATH" ; then
15420             pathmunge "$MSBUILD_PATH" "before"
15421         fi
15422         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15423         if test "$ENABLE_JAVA" != ""; then
15424             if test -d "$JAVA_HOME/jre/bin/client"; then
15425                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15426             fi
15427             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15428                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15429             fi
15430             pathmunge "$JAVA_HOME/bin" "before"
15431         fi
15432         pathmunge "$MSVC_HOST_PATH" "before"
15433         ;;
15435     solaris*)
15436         pathmunge "/usr/css/bin" "before"
15437         if test "$ENABLE_JAVA" != ""; then
15438             pathmunge "$JAVA_HOME/bin" "after"
15439         fi
15440         ;;
15441     esac
15444 AC_SUBST(LO_PATH)
15446 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15447 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15448     x_LO_ELFCHECK_ALLOWLIST=
15449 else
15450     x_LO_ELFCHECK_ALLOWLIST=[\#]
15452 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15453 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15455 libo_FUZZ_SUMMARY
15457 # Generate a configuration sha256 we can use for deps
15458 if test -f config_host.mk; then
15459     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15461 if test -f config_host_lang.mk; then
15462     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15465 CFLAGS=$my_original_CFLAGS
15466 CXXFLAGS=$my_original_CXXFLAGS
15467 CPPFLAGS=$my_original_CPPFLAGS
15469 AC_CONFIG_LINKS([include:include])
15471 if test -n "$WSL_ONLY_AS_HELPER"; then
15472     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15473     build=$host
15474     PathFormat "$SRC_ROOT"
15475     SRC_ROOT="$formatted_path"
15476     PathFormat "$BUILDDIR"
15477     BUILDDIR="$formatted_path"
15478     # git-bash has (gnu) tar, curl and sha256sum
15479     CURL="curl.exe"
15480     WGET=
15481     GNUTAR="tar.exe"
15482     SHA256SUM="sha256sum.exe"
15483     # TODO: maybe switch to strawberry-perl right away?
15484     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15485     PERL="perl.exe"
15486     # use flex, gperf and nasm from wsl-container
15487     # if using absolute path, would need to use double-leading slash for the msys path mangling
15488     FLEX="$WSL $FLEX"
15489     NASM="$WSL $NASM"
15490     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15491     # with an absolute path/requires the value to begin with a slash
15492     GPERF="/c/Windows/system32/$WSL gperf"
15493     # append strawberry tools dir to PATH (for e.g. windres, ar)
15494     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15495     # temp-dir needs to be in windows realm, hardcode for now
15496     if test "$TEMP_DIRECTORY" = /tmp; then
15497         mkdir -p tmp
15498         TEMP_DIRECTORY="$BUILDDIR/tmp"
15499     fi
15502 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15503 # BUILD platform configuration] - otherwise breaks cross building
15504 AC_CONFIG_FILES([
15505                  config_host_lang.mk
15506                  Makefile
15507                  bin/bffvalidator.sh
15508                  bin/odfvalidator.sh
15509                  bin/officeotron.sh
15510                  instsetoo_native/util/openoffice.lst
15511                  sysui/desktop/macosx/Info.plist
15512                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15513                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15514                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15515 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15516 # easier to do it in a postprocessing command than to modify every single variable
15517 AC_CONFIG_FILES([config_host.mk], [
15518     if test -n "$WSL_ONLY_AS_HELPER"; then
15519         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15520     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15522 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15523 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15524 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15525 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15526 AC_CONFIG_HEADERS([config_host/config_clang.h])
15527 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15528 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15529 AC_CONFIG_HEADERS([config_host/config_eot.h])
15530 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15531 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15532 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15533 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15534 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15535 AC_CONFIG_HEADERS([config_host/config_features.h])
15536 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15537 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15538 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15539 AC_CONFIG_HEADERS([config_host/config_folders.h])
15540 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15541 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15542 AC_CONFIG_HEADERS([config_host/config_gio.h])
15543 AC_CONFIG_HEADERS([config_host/config_global.h])
15544 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15545 AC_CONFIG_HEADERS([config_host/config_java.h])
15546 AC_CONFIG_HEADERS([config_host/config_langs.h])
15547 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15548 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15549 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15550 AC_CONFIG_HEADERS([config_host/config_locales.h])
15551 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15552 AC_CONFIG_HEADERS([config_host/config_oox.h])
15553 AC_CONFIG_HEADERS([config_host/config_options.h])
15554 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15555 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15556 AC_CONFIG_HEADERS([config_host/config_skia.h])
15557 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15558 AC_CONFIG_HEADERS([config_host/config_validation.h])
15559 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15560 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15561 AC_CONFIG_HEADERS([config_host/config_version.h])
15562 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15563 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15564 AC_CONFIG_HEADERS([config_host/config_python.h])
15565 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15566 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15567 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15568 AC_OUTPUT
15570 if test "$CROSS_COMPILING" = TRUE; then
15571     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15574 # touch the config timestamp file
15575 if test ! -f config_host.mk.stamp; then
15576     echo > config_host.mk.stamp
15577 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15578     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15579 else
15580     echo > config_host.mk.stamp
15583 # touch the config lang timestamp file
15584 if test ! -f config_host_lang.mk.stamp; then
15585     echo > config_host_lang.mk.stamp
15586 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15587     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15588 else
15589     echo > config_host_lang.mk.stamp
15593 if test \( "$STALE_MAKE" = "TRUE" \) \
15594         -a "$build_os" = "cygwin"; then
15596 cat << _EOS
15597 ****************************************************************************
15598 WARNING:
15599 Your make version is known to be horribly slow, and hard to debug
15600 problems with. To get a reasonably functional make please do:
15602 to install a pre-compiled binary make for Win32
15604  mkdir -p /opt/lo/bin
15605  cd /opt/lo/bin
15606  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15607  cp make-4.2.1-msvc.exe make
15608  chmod +x make
15610 to install from source:
15611 place yourself in a working directory of you choice.
15613  git clone git://git.savannah.gnu.org/make.git
15615  [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"]
15616  set PATH=%PATH%;C:\Cygwin\bin
15617  [or Cygwin64, if that is what you have]
15618  cd path-to-make-repo-you-cloned-above
15619  build_w32.bat --without-guile
15621 should result in a WinRel/gnumake.exe.
15622 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15624 Then re-run autogen.sh
15626 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15627 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15629 _EOS
15633 cat << _EOF
15634 ****************************************************************************
15636 To show information on various make targets and make flags, run:
15637 $GNUMAKE help
15639 To just build, run:
15640 $GNUMAKE
15642 _EOF
15644 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15645     cat << _EOF
15646 After the build has finished successfully, you can immediately run what you built using the command:
15647 _EOF
15649     if test $_os = Darwin; then
15650         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15651     else
15652         echo instdir/program/soffice
15653     fi
15654     cat << _EOF
15656 If you want to run the unit tests, run:
15657 $GNUMAKE check
15659 _EOF
15662 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15663     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15664     cat "$WARNINGS_FILE_FOR_BUILD"
15665     echo
15668 if test -s "$WARNINGS_FILE"; then
15669     echo "HOST config ($WARNINGS_FILE)"
15670     cat "$WARNINGS_FILE"
15673 # Remove unneeded emconfigure artifacts
15674 rm -f a.out a.wasm a.out.js a.out.wasm
15676 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: