tdf#159625: fix "allow to split paragraph"
[LibreOffice.git] / configure.ac
blobe04f4a8466425aec202f60b46ee4ce22cc78e455
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.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
45 FilterLibs()
47     # Return value: $filteredlibs
49     filteredlibs=
50     if test "$COM" = "MSC"; then
51         for f in $1; do
52             if test "x$f" != "x${f#-L}"; then
53                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
54             elif test "x$f" != "x${f#-l}"; then
55                 filteredlibs="$filteredlibs ${f:2}.lib"
56             else
57                 filteredlibs="$filteredlibs $f"
58             fi
59         done
60     else
61         for f in $1; do
62             case "$f" in
63                 # let's start with Fedora's paths for now
64                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
65                     # ignore it: on UNIXoids it is searched by default anyway
66                     # but if it's given explicitly then it may override other paths
67                     # (on macOS it would be an error to use it instead of SDK)
68                     ;;
69                 *)
70                     filteredlibs="$filteredlibs $f"
71                     ;;
72             esac
73         done
74     fi
77 PathFormat()
79     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
80     # function is called also on Unix.
81     #
82     # Return value: $formatted_path and $formatted_path_unix.
83     #
84     # $formatted_path is the argument in Windows format, but using forward slashes instead of
85     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
86     # or shell metacharacters).
87     #
88     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
89     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
90     # Unix pathname.
91     #
92     # Errors out if 8.3 names are needed but aren't present for some of the path components.
94     # Examples:
95     #
96     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
97     #
98     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
99     #
100     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
101     #
102     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
103     #
104     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
105     #
106     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
107     #
108     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
110     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
111         printf "PathFormat $1 ==> "
112     fi
114     formatted_path="$1"
115     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
116         if test "$build_os" = "wsl"; then
117             formatted_path=$(echo "$formatted_path" | tr -d '\r')
118         fi
120         pf_conv_to_dos=
121         # spaces,parentheses,brackets,braces are problematic in pathname
122         # so are backslashes
123         case "$formatted_path" in
124             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
125                 pf_conv_to_dos="yes"
126             ;;
127         esac
128         if test "$pf_conv_to_dos" = "yes"; then
129             if test "$build_os" = "wsl"; then
130                 case "$formatted_path" in
131                     /*)
132                         formatted_path=$(wslpath -w "$formatted_path")
133                         ;;
134                 esac
135                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
136             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
137                 formatted_path=`cygpath -sm "$formatted_path"`
138             else
139                 formatted_path=`cygpath -d "$formatted_path"`
140             fi
141             if test $? -ne 0;  then
142                 AC_MSG_ERROR([path conversion failed for "$1".])
143             fi
144         fi
145         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
146         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
147         if test "$fp_count_slash$fp_count_colon" != "00"; then
148             if test "$fp_count_colon" = "0"; then
149                 new_formatted_path=`realpath "$formatted_path"`
150                 if test $? -ne 0;  then
151                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
152                 else
153                     formatted_path="$new_formatted_path"
154                 fi
155             fi
156             if test "$build_os" = "wsl"; then
157                 if test "$fp_count_colon" != "0"; then
158                     formatted_path=$(wslpath "$formatted_path")
159                     local final_slash=
160                     case "$formatted_path" in
161                         */)
162                             final_slash=/
163                             ;;
164                     esac
165                     formatted_path=$(wslpath -m $formatted_path)
166                     case "$formatted_path" in
167                         */)
168                             ;;
169                         *)
170                             formatted_path="$formatted_path"$final_slash
171                             ;;
172                     esac
173                 else
174                     formatted_path=$(wslpath -m "$formatted_path")
175                 fi
176             else
177                 formatted_path=`cygpath -m "$formatted_path"`
178             fi
179             if test $? -ne 0;  then
180                 AC_MSG_ERROR([path conversion failed for "$1".])
181             fi
182         fi
183         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
184         if test "$fp_count_space" != "0"; then
185             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
186         fi
187     fi
188     if test "$build_os" = "wsl"; then
189         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
190         formatted_path_unix=$(wslpath "$formatted_path")
191     else
192         # But Cygwin can
193         formatted_path_unix="$formatted_path"
194     fi
195     if test -n "$WSL_ONLY_AS_HELPER"; then
196         # if already in unix format, switch to windows format to create shortened path
197         case "$formatted_path" in
198             /*)
199                 formatted_path=$(wslpath -m "$formatted_path")
200                 ;;
201         esac
203         # cd to /mnt/c to avoid wsl/cmd complaining about not supporting UNC paths/the current working directory
204         formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
205         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
206         formatted_path=$(wslpath -m "$formatted_path_unix")
207     fi
210 AbsolutePath()
212     # There appears to be no simple and portable method to get an absolute and
213     # canonical path, so we try creating the directory if does not exist and
214     # utilizing the shell and pwd.
216     # Args: $1: A possibly relative pathname
217     # Return value: $absolute_path
219     # Convert to unix path, mkdir would treat c:/path as a relative path.
220     PathFormat "$1"
221     local rel="$formatted_path_unix"
222     absolute_path=""
223     test ! -e "$rel" && mkdir -p "$rel"
224     if test -d "$rel" ; then
225         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
226         absolute_path="$(pwd)"
227         cd - > /dev/null
228     else
229         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
230     fi
233 WARNINGS_FILE=config.warn
234 WARNINGS_FILE_FOR_BUILD=config.Build.warn
235 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
236 have_WARNINGS="no"
237 add_warning()
239     if test "$have_WARNINGS" = "no"; then
240         echo "*************************************" > "$WARNINGS_FILE"
241         have_WARNINGS="yes"
242         if command -v tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
243             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
244             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
245         else
246             COLORWARN="* WARNING :"
247         fi
248     fi
249     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
252 dnl Some Mac User have the bad habit of letting a lot of crap
253 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
254 dnl that confuse the build.
255 dnl For the ones that use LODE, let's be nice and protect them
256 dnl from themselves
258 mac_sanitize_path()
260     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
261 dnl a common but nevertheless necessary thing that may be in a fancy
262 dnl path location is git, so make sure we have it
263     mac_git_path=`command -v git`
264     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
265         mac_path="$mac_path:`dirname $mac_git_path`"
266     fi
267 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
268 dnl path location is gpg, so make sure we find it
269     mac_gpg_path=`command -v gpg`
270     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
271         mac_path="$mac_path:`dirname $mac_gpg_path`"
272     fi
273     PATH="$mac_path"
274     unset mac_path
275     unset mac_git_path
276     unset mac_gpg_path
279 dnl semantically test a three digits version
280 dnl $1 - $3 = minimal version
281 dnl $4 - $6 = current version
283 check_semantic_version_three()
285     test "$4" -gt "$1" \
286         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
287         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
288     return $?
291 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
292 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
293 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
295 check_semantic_version_three_prefixed()
297     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
298     eval local MIN_MINOR="\$${1}_${2}_MINOR"
299     eval local MIN_TINY="\$${1}_${2}_TINY"
300     eval local CUR_MAJOR="\$${1}_MAJOR"
301     eval local CUR_MINOR="\$${1}_MINOR"
302     eval local CUR_TINY="\$${1}_TINY"
303     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
304     return $?
307 echo "********************************************************************"
308 echo "*"
309 echo "*   Running ${PACKAGE_NAME} build configuration."
310 echo "*"
311 echo "********************************************************************"
312 echo ""
314 dnl ===================================================================
315 dnl checks build and host OSes
316 dnl do this before argument processing to allow for platform dependent defaults
317 dnl ===================================================================
319 # are we running in wsl but are called from git-bash/env with mingw64 in path?
320 # if so, we aim to run nearly everything in the Windows realm, and only run autogen/configure
321 # in wsl and run a few tools via wsl
322 WSL_ONLY_AS_HELPER=
323 if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then
324     WSL_ONLY_AS_HELPER=TRUE
325     AC_ARG_WITH([strawberry-perl-portable],
326         [AS_HELP_STRING([--with-strawberry-perl-portable],
327             [Specify the base path to strawberry perl portable])],
328         [],
329         [AC_MSG_ERROR(
330             [for the moment strawberry-perl-portable is a requirement, feel free to replace it])])
331     shortpath_cmd=$(wslpath -m $srcdir/solenv/bin/shortpath.cmd)
332     PathFormat "$with_strawberry_perl_portable"
333     if test ! -f "$formatted_path_unix/perl/bin/perl.exe" -o ! -d "$formatted_path_unix/c/bin"; then
334         AC_MSG_ERROR([$formatted_path doesn't contain perl or the utilities - sure you provided the base path?])
335     fi
336     STRAWBERRY_TOOLS="$formatted_path/c/bin"
337     STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
338     AC_ARG_WITH([wsl-command],
339         [AS_HELP_STRING([--with-wsl-command],
340             [Specify your wsl distro command if it isn't the default/the one used with just wsl.exe â€“
341              for example: wsl.exe -d MyDistro -u NonDefaultUser])],
342         [],
343         [with_wsl_command="wsl.exe"])
344     WSL="$with_wsl_command"
346 AC_SUBST([STRAWBERRY_PERL])
347 AC_SUBST([WSL])
349 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
350 # Linux on WSL) trust that.
351 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
352     ac_cv_host="x86_64-pc-wsl"
353     ac_cv_host_cpu="x86_64"
354     ac_cv_host_os="wsl"
355     ac_cv_build="$ac_cv_host"
356     ac_cv_build_cpu="$ac_cv_host_cpu"
357     ac_cv_build_os="$ac_cv_host_os"
359     # Emulation of Cygwin's cygpath command for WSL.
360     cygpath()
361     {
362         if test -n "$UNITTEST_WSL_CYGPATH"; then
363             echo -n cygpath "$@" "==> "
364         fi
366         # Cygwin's real cygpath has a plethora of options but we use only a few here.
367         local args="$@"
368         local opt
369         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
370         OPTIND=1
372         while getopts dmuwlsp opt; do
373             case "$opt" in
374                 \?)
375                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
376                     ;;
377                 ?)
378                     eval opt_$opt=yes
379                     ;;
380             esac
381         done
383         shift $((OPTIND-1))
385         if test $# -ne 1; then
386             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
387         fi
389         local input="$1"
391         local result
393         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
394             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
396             if test -n "$opt_u"; then
397                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
398             fi
400             case "$input" in
401                 /mnt/*)
402                     # A Windows file in WSL format
403                     input=$(wslpath -w "$input")
404                     ;;
405                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
406                     # Already in Windows format
407                     ;;
408                 /*)
409                     input=$(wslpath -w "$input")
410                     ;;
411                 *)
412                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
413                     ;;
414             esac
415             if test -n "$opt_d" -o -n "$opt_s"; then
416                 input=$($WSL_LO_HELPER --8.3 "$input")
417             fi
418             if test -n "$opt_m"; then
419                 input="${input//\\//}"
420             fi
421             echo "$input"
422         else
423             # Print Unix path
425             case "$input" in
426                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
427                     wslpath -u "$input"
428                     ;;
429                 /)
430                     echo "$input"
431                     ;;
432                 *)
433                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
434                     ;;
435             esac
436         fi
437     }
439     if test -n "$UNITTEST_WSL_CYGPATH"; then
440         BUILDDIR=.
442         # Nothing special with these file names, just arbitrary ones picked to test with
443         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
444         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
445         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
446         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
447         # At least on my machine for instance this file does have an 8.3 name
448         cygpath -d /mnt/c/windows/WindowsUpdate.log
449         # But for instance this one doesn't
450         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
451         cygpath -ws /mnt/c/windows/WindowsUpdate.log
452         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
453         cygpath -ms /mnt/c/windows/WindowsUpdate.log
455         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
456         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
458         exit 0
459     fi
461     if test -z "$WSL_LO_HELPER"; then
462         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
463             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
464         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
465             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
466         fi
467     fi
468     if test -z "$WSL_LO_HELPER"; then
469         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
470     fi
473 AC_CANONICAL_HOST
474 AC_CANONICAL_BUILD
476 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
477     BUILDDIR=.
478     GREP=grep
480     # Use of PathFormat must be after AC_CANONICAL_BUILD above
481     PathFormat /
482     printf "$formatted_path , $formatted_path_unix\n"
484     PathFormat $PWD
485     printf "$formatted_path , $formatted_path_unix\n"
487     PathFormat "$PROGRAMFILESX86"
488     printf "$formatted_path , $formatted_path_unix\n"
490     exit 0
493 AC_MSG_CHECKING([for product name])
494 PRODUCTNAME="AC_PACKAGE_NAME"
495 if test -n "$with_product_name" -a "$with_product_name" != no; then
496     PRODUCTNAME="$with_product_name"
498 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
499     PRODUCTNAME="${PRODUCTNAME}Dev"
501 AC_MSG_RESULT([$PRODUCTNAME])
502 AC_SUBST(PRODUCTNAME)
503 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
504 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
506 dnl ===================================================================
507 dnl Our version is defined by the AC_INIT() at the top of this script.
508 dnl ===================================================================
510 AC_MSG_CHECKING([for package version])
511 if test -n "$with_package_version" -a "$with_package_version" != no; then
512     PACKAGE_VERSION="$with_package_version"
514 AC_MSG_RESULT([$PACKAGE_VERSION])
516 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
518 LIBO_VERSION_MAJOR=$1
519 LIBO_VERSION_MINOR=$2
520 LIBO_VERSION_MICRO=$3
521 LIBO_VERSION_PATCH=$4
523 LIBO_VERSION_SUFFIX=$5
525 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
526 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
527 # they get undoubled before actually passed to sed.
528 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
529 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
530 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
531 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
533 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
534 # three non-negative integers. Please find more information about CFBundleVersion at
535 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
537 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
538 # of at most three non-negative integers. Please find more information about
539 # CFBundleShortVersionString at
540 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
542 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
544 if test "$enable_macosx_sandbox" = yes; then
545     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
546     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
547 else
548     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
549     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
552 AC_SUBST(LIBO_VERSION_MAJOR)
553 AC_SUBST(LIBO_VERSION_MINOR)
554 AC_SUBST(LIBO_VERSION_MICRO)
555 AC_SUBST(LIBO_VERSION_PATCH)
556 AC_SUBST(LIBO_VERSION_SUFFIX)
557 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
558 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
559 AC_SUBST(MACOSX_BUNDLE_VERSION)
561 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
562 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
563 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
564 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
566 git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>/dev/null`
567 LIBO_THIS_YEAR=${git_date:-2024}
568 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
570 dnl ===================================================================
571 dnl Product version
572 dnl ===================================================================
573 AC_MSG_CHECKING([for product version])
574 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
575 AC_MSG_RESULT([$PRODUCTVERSION])
576 AC_SUBST(PRODUCTVERSION)
578 AC_PROG_EGREP
579 # AC_PROG_EGREP doesn't set GREP on all systems as well
580 AC_PATH_PROG(GREP, grep)
582 BUILDDIR=`pwd`
583 cd $srcdir
584 SRC_ROOT=`pwd`
585 cd $BUILDDIR
586 x_Cygwin=[\#]
588 dnl ======================================
589 dnl Required GObject introspection version
590 dnl ======================================
591 INTROSPECTION_REQUIRED_VERSION=1.32.0
593 dnl ===================================================================
594 dnl Search all the common names for GNU Make
595 dnl ===================================================================
596 AC_MSG_CHECKING([for GNU Make])
598 # try to use our own make if it is available and GNUMAKE was not already defined
599 if test -z "$GNUMAKE"; then
600     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
601         GNUMAKE="$LODE_HOME/opt/bin/make"
602     elif test -x "/opt/lo/bin/make"; then
603         GNUMAKE="/opt/lo/bin/make"
604     fi
607 GNUMAKE_WIN_NATIVE=
608 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
609     if test -n "$a"; then
610         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
611         if test $? -eq 0;  then
612             if test "$build_os" = "cygwin"; then
613                 if test -n "$($a -v | grep 'Built for Windows')" ; then
614                     GNUMAKE="$(cygpath -m "$(command -v "$(cygpath -u $a)")")"
615                     GNUMAKE_WIN_NATIVE="TRUE"
616                 else
617                     GNUMAKE=`command -v $a`
618                 fi
619             else
620                 GNUMAKE=`command -v $a`
621             fi
622             break
623         fi
624     fi
625 done
626 AC_MSG_RESULT($GNUMAKE)
627 if test -z "$GNUMAKE"; then
628     AC_MSG_ERROR([not found. install GNU Make.])
629 else
630     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
631         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
632     fi
635 win_short_path_for_make()
637     local short_path="$1"
638     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
639         cygpath -sm "$short_path"
640     elif test -n "$WSL_ONLY_AS_HELPER"; then
641         # when already unix-style path, wslpath doesn't return anything
642         case "$short_path" in
643         /*)
644             echo $short_path
645             exit
646             ;;
647         esac
648         wslpath -m "$(wslpath -u "$short_path")"
649     else
650         cygpath -u "$(cygpath -d "$short_path")"
651     fi
655 if test "$build_os" = "cygwin"; then
656     PathFormat "$SRC_ROOT"
657     SRC_ROOT="$formatted_path"
658     PathFormat "$BUILDDIR"
659     BUILDDIR="$formatted_path"
660     x_Cygwin=
661     AC_MSG_CHECKING(for explicit COMSPEC)
662     if test -z "$COMSPEC"; then
663         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
664     else
665         AC_MSG_RESULT([found: $COMSPEC])
666     fi
669 AC_SUBST(SRC_ROOT)
670 AC_SUBST(BUILDDIR)
671 AC_SUBST(x_Cygwin)
672 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
673 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
674 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
676 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
677     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
680 # need sed in os checks...
681 AC_PATH_PROGS(SED, sed)
682 if test -z "$SED"; then
683     AC_MSG_ERROR([install sed to run this script])
686 # Set the ENABLE_LTO variable
687 # ===================================================================
688 AC_MSG_CHECKING([whether to use link-time optimization])
689 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
690     ENABLE_LTO="TRUE"
691     AC_MSG_RESULT([yes])
692 else
693     ENABLE_LTO=""
694     AC_MSG_RESULT([no])
696 AC_SUBST(ENABLE_LTO)
698 AC_ARG_ENABLE(fuzz-options,
699     AS_HELP_STRING([--enable-fuzz-options],
700         [Randomly enable or disable each of those configurable options
701          that are supposed to be freely selectable without interdependencies,
702          or where bad interaction from interdependencies is automatically avoided.])
705 dnl ===================================================================
706 dnl When building for Android, --with-android-ndk,
707 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
708 dnl mandatory
709 dnl ===================================================================
711 AC_ARG_WITH(android-ndk,
712     AS_HELP_STRING([--with-android-ndk],
713         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
716 AC_ARG_WITH(android-ndk-toolchain-version,
717     AS_HELP_STRING([--with-android-ndk-toolchain-version],
718         [Specify which toolchain version to use, of those present in the
719         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
720         with_android_ndk_toolchain_version=clang5.0)
722 AC_ARG_WITH(android-sdk,
723     AS_HELP_STRING([--with-android-sdk],
724         [Specify location of the Android SDK. Mandatory when building for Android.]),
727 AC_ARG_WITH(android-api-level,
728     AS_HELP_STRING([--with-android-api-level],
729         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
732 ANDROID_NDK_DIR=
733 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
734     with_android_ndk="$SRC_ROOT/external/android-ndk"
736 if test -n "$with_android_ndk"; then
737     eval ANDROID_NDK_DIR=$with_android_ndk
739     ANDROID_API_LEVEL=21
740     if test -n "$with_android_api_level" ; then
741         ANDROID_API_LEVEL="$with_android_api_level"
742     fi
744     if test $host_cpu = arm; then
745         LLVM_TRIPLE=armv7a-linux-androideabi
746         ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
747         ANDROID_APP_ABI=armeabi-v7a
748         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
749     elif test $host_cpu = aarch64; then
750         LLVM_TRIPLE=aarch64-linux-android
751         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
752         ANDROID_APP_ABI=arm64-v8a
753     elif test $host_cpu = x86_64; then
754         LLVM_TRIPLE=x86_64-linux-android
755         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
756         ANDROID_APP_ABI=x86_64
757     else
758         # host_cpu is something like "i386" or "i686" I guess, NDK uses
759         # "x86" in some contexts
760         LLVM_TRIPLE=i686-linux-android
761         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
762         ANDROID_APP_ABI=x86
763     fi
765     # Set up a lot of pre-canned defaults
767     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
768         if test ! -f $ANDROID_NDK_DIR/source.properties; then
769             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
770         fi
771         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
772     else
773         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
774     fi
775     if test -z "$ANDROID_NDK_VERSION";  then
776         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
777     fi
778     case $ANDROID_NDK_VERSION in
779     r9*|r10*)
780         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
781         ;;
782     11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
783         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
784         ;;
785     23.*|24.*|25.*)
786         ;;
787     *)
788         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
789         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
790         ;;
791     esac
793     case "$with_android_ndk_toolchain_version" in
794     clang5.0)
795         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
796         ;;
797     *)
798         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
799     esac
801     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
803     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
804     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
805     # manage to link the (app-specific) single huge .so that is built for the app in
806     # android/source/ if there is debug information in a significant part of the object files.
807     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
808     # all objects have been built with debug information.)
809     case $build_os in
810     linux-gnu*)
811         android_HOST_TAG=linux-x86_64
812         ;;
813     darwin*)
814         android_HOST_TAG=darwin-x86_64
815         ;;
816     *)
817         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
818         # ndk would also support windows and windows-x86_64
819         ;;
820     esac
821     ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
822     ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
824     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
825     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
826     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
827     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
828     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
830     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
831     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
832     if test "$ENABLE_LTO" = TRUE; then
833         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
834         # $CC and $CXX when building external libraries
835         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
836     fi
838     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
840     if test -z "$CC"; then
841         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
842         CC_BASE="clang"
843     fi
844     if test -z "$CXX"; then
845         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
846         CXX_BASE="clang++"
847     fi
849 AC_SUBST(ANDROID_NDK_DIR)
850 AC_SUBST(ANDROID_API_LEVEL)
851 AC_SUBST(ANDROID_APP_ABI)
852 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
853 AC_SUBST(ANDROID_SYSROOT_PLATFORM)
854 AC_SUBST(ANDROID_TOOLCHAIN)
856 dnl ===================================================================
857 dnl --with-android-sdk
858 dnl ===================================================================
859 ANDROID_SDK_DIR=
860 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
861     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
863 if test -n "$with_android_sdk"; then
864     eval ANDROID_SDK_DIR=$with_android_sdk
865     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
867 AC_SUBST(ANDROID_SDK_DIR)
869 AC_ARG_ENABLE([android-lok],
870     AS_HELP_STRING([--enable-android-lok],
871         [The Android app from the android/ subdir needs several tweaks all
872          over the place that break the LOK when used in the Online-based
873          Android app.  This switch indicates that the intent of this build is
874          actually the Online-based, non-modified LOK.])
876 ENABLE_ANDROID_LOK=
877 if test -n "$ANDROID_NDK_DIR" ; then
878     if test "$enable_android_lok" = yes; then
879         ENABLE_ANDROID_LOK=TRUE
880         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
881         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
882     else
883         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
884     fi
886 AC_SUBST([ENABLE_ANDROID_LOK])
888 libo_FUZZ_ARG_ENABLE([android-editing],
889     AS_HELP_STRING([--enable-android-editing],
890         [Enable the experimental editing feature on Android.])
892 ENABLE_ANDROID_EDITING=
893 if test "$enable_android_editing" = yes; then
894     ENABLE_ANDROID_EDITING=TRUE
896 AC_SUBST([ENABLE_ANDROID_EDITING])
898 disable_database_connectivity_dependencies()
900     enable_evolution2=no
901     enable_firebird_sdbc=no
902     enable_mariadb_sdbc=no
903     enable_postgresql_sdbc=no
904     enable_report_builder=no
907 # ===================================================================
909 # Start initial platform setup
911 # The using_* variables reflect platform support and should not be
912 # changed after the "End initial platform setup" block.
913 # This is also true for most test_* variables.
914 # ===================================================================
915 build_crypto=yes
916 test_clucene=no
917 test_gdb_index=no
918 test_openldap=yes
919 test_split_debug=no
920 test_webdav=yes
921 usable_dlapi=yes
923 # There is currently just iOS not using salplug, so this explicitly enables it.
924 # must: using_freetype_fontconfig
925 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
926 # must: using_x11
928 # Default values, as such probably valid just for Linux, set
929 # differently below just for Mac OSX, but at least better than
930 # hardcoding these as we used to do. Much of this is duplicated also
931 # in solenv for old build system and for gbuild, ideally we should
932 # perhaps define stuff like this only here in configure.ac?
934 LINKFLAGSSHL="-shared"
935 PICSWITCH="-fpic"
936 DLLPOST=".so"
938 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
940 INSTROOTBASESUFFIX=
941 INSTROOTCONTENTSUFFIX=
942 SDKDIRNAME=sdk
944 HOST_PLATFORM="$host"
946 host_cpu_for_clang="$host_cpu"
948 case "$host_os" in
950 solaris*)
951     using_freetype_fontconfig=yes
952     using_x11=yes
953     build_skia=yes
954     _os=SunOS
956     dnl ===========================================================
957     dnl Check whether we're using Solaris 10 - SPARC or Intel.
958     dnl ===========================================================
959     AC_MSG_CHECKING([the Solaris operating system release])
960     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
961     if test "$_os_release" -lt "10"; then
962         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
963     else
964         AC_MSG_RESULT([ok ($_os_release)])
965     fi
967     dnl Check whether we're using a SPARC or i386 processor
968     AC_MSG_CHECKING([the processor type])
969     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
970         AC_MSG_RESULT([ok ($host_cpu)])
971     else
972         AC_MSG_ERROR([only SPARC and i386 processors are supported])
973     fi
974     ;;
976 linux-gnu*|k*bsd*-gnu*|linux-musl*)
977     using_freetype_fontconfig=yes
978     using_x11=yes
979     build_skia=yes
980     test_gdb_index=yes
981     test_split_debug=yes
982     if test "$enable_fuzzers" = yes; then
983         test_system_freetype=no
984     fi
985     _os=Linux
986     ;;
988 gnu)
989     using_freetype_fontconfig=yes
990     using_x11=no
991     _os=GNU
992      ;;
994 cygwin*|wsl*)
995     # When building on Windows normally with MSVC under Cygwin,
996     # configure thinks that the host platform (the platform the
997     # built code will run on) is Cygwin, even if it obviously is
998     # Windows, which in Autoconf terminology is called
999     # "mingw32". (Which is misleading as MinGW is the name of the
1000     # tool-chain, not an operating system.)
1002     # Somewhat confusing, yes. But this configure script doesn't
1003     # look at $host etc that much, it mostly uses its own $_os
1004     # variable, set here in this case statement.
1006     using_freetype_fontconfig=no
1007     using_x11=no
1008     test_unix_dlapi=no
1009     test_openldap=no
1010     enable_pagein=no
1011     build_skia=yes
1012     _os=WINNT
1014     DLLPOST=".dll"
1015     LINKFLAGSNOUNDEFS=
1017     if test "$host_cpu" = "aarch64"; then
1018         build_skia=no
1019         enable_gpgmepp=no
1020         enable_coinmp=no
1021         enable_firebird_sdbc=no
1022     fi
1023     ;;
1025 darwin*) # macOS
1026     using_freetype_fontconfig=no
1027     using_x11=no
1028     build_skia=yes
1029     enable_pagein=no
1030     if test -n "$LODE_HOME" ; then
1031         mac_sanitize_path
1032         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1033     fi
1034     _os=Darwin
1035     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
1036     INSTROOTCONTENTSUFFIX=/Contents
1037     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1038     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1039     LINKFLAGSSHL="-dynamiclib"
1041     # -fPIC is default
1042     PICSWITCH=""
1044     DLLPOST=".dylib"
1046     # -undefined error is the default
1047     LINKFLAGSNOUNDEFS=""
1048     case "$host_cpu" in
1049     aarch64|arm64)
1050         # Apple's Clang uses "arm64"
1051         host_cpu_for_clang=arm64
1052     esac
1055 ios*) # iOS
1056     using_freetype_fontconfig=no
1057     using_x11=no
1058     build_crypto=no
1059     test_libcmis=no
1060     test_openldap=no
1061     test_webdav=no
1062     if test -n "$LODE_HOME" ; then
1063         mac_sanitize_path
1064         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1065     fi
1066     enable_gpgmepp=no
1067     _os=iOS
1068     enable_mpl_subset=yes
1069     enable_lotuswordpro=no
1070     disable_database_connectivity_dependencies
1071     enable_coinmp=no
1072     enable_lpsolve=no
1073     enable_extension_integration=no
1074     enable_xmlhelp=no
1075     with_ppds=no
1076     if test "$enable_ios_simulator" = "yes"; then
1077         host=x86_64-apple-darwin
1078     fi
1079     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1080     LINKFLAGSSHL="-dynamiclib"
1082     # -fPIC is default
1083     PICSWITCH=""
1085     DLLPOST=".dylib"
1087     # -undefined error is the default
1088     LINKFLAGSNOUNDEFS=""
1090     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1091     # part, so use aarch64-apple-darwin for now.
1092     HOST_PLATFORM=aarch64-apple-darwin
1094     # Apple's Clang uses "arm64"
1095     host_cpu_for_clang=arm64
1098 freebsd*)
1099     using_freetype_fontconfig=yes
1100     using_x11=yes
1101     build_skia=yes
1102     AC_MSG_CHECKING([the FreeBSD operating system release])
1103     if test -n "$with_os_version"; then
1104         OSVERSION="$with_os_version"
1105     else
1106         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1107     fi
1108     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1109     AC_MSG_CHECKING([which thread library to use])
1110     if test "$OSVERSION" -lt "500016"; then
1111         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1112         PTHREAD_LIBS="-pthread"
1113     elif test "$OSVERSION" -lt "502102"; then
1114         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1115         PTHREAD_LIBS="-lc_r"
1116     else
1117         PTHREAD_CFLAGS=""
1118         PTHREAD_LIBS="-pthread"
1119     fi
1120     AC_MSG_RESULT([$PTHREAD_LIBS])
1121     _os=FreeBSD
1122     ;;
1124 *netbsd*)
1125     using_freetype_fontconfig=yes
1126     using_x11=yes
1127     test_gtk3_kde5=no
1128     build_skia=yes
1129     PTHREAD_LIBS="-pthread -lpthread"
1130     _os=NetBSD
1131     ;;
1133 openbsd*)
1134     using_freetype_fontconfig=yes
1135     using_x11=yes
1136     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1137     PTHREAD_LIBS="-pthread"
1138     _os=OpenBSD
1139     ;;
1141 dragonfly*)
1142     using_freetype_fontconfig=yes
1143     using_x11=yes
1144     build_skia=yes
1145     PTHREAD_LIBS="-pthread"
1146     _os=DragonFly
1147     ;;
1149 linux-android*)
1150     # API exists, but seems not really usable since Android 7 AFAIK
1151     usable_dlapi=no
1152     using_freetype_fontconfig=yes
1153     using_headless_plugin=no
1154     using_x11=no
1155     build_crypto=no
1156     test_openldap=no
1157     test_system_freetype=no
1158     test_webdav=no
1159     disable_database_connectivity_dependencies
1160     enable_lotuswordpro=no
1161     enable_mpl_subset=yes
1162     enable_cairo_canvas=no
1163     enable_coinmp=yes
1164     enable_lpsolve=no
1165     enable_odk=no
1166     enable_python=no
1167     enable_xmlhelp=no
1168     _os=Android
1169     ;;
1171 haiku*)
1172     using_freetype_fontconfig=yes
1173     using_x11=no
1174     test_gtk3=no
1175     test_gtk3_kde5=no
1176     test_kf5=yes
1177     test_kf6=yes
1178     enable_odk=no
1179     enable_coinmp=no
1180     enable_pdfium=no
1181     enable_sdremote=no
1182     enable_postgresql_sdbc=no
1183     enable_firebird_sdbc=no
1184     _os=Haiku
1185     ;;
1187 emscripten)
1188     # API currently just exists in headers, not code
1189     usable_dlapi=no
1190     using_freetype_fontconfig=yes
1191     using_x11=yes
1192     test_openldap=no
1193     test_qt5=yes
1194     test_split_debug=yes
1195     test_system_freetype=no
1196     enable_compiler_plugins=no
1197     enable_customtarget_components=yes
1198     enable_split_debug=yes
1199     enable_wasm_strip=yes
1200     with_system_zlib=no
1201     with_theme="colibre"
1202     _os=Emscripten
1203     ;;
1206     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1207     ;;
1208 esac
1210 AC_SUBST(HOST_PLATFORM)
1212 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1213     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1216 # Set defaults, if not set by platform
1217 test "${test_cups+set}" = set || test_cups="$using_x11"
1218 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1219 test "${test_gen+set}" = set || test_gen="$using_x11"
1220 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1221 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1222 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1223 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1224 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1225 # don't handle test_qt5, so it can disable test_kf5 later
1226 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1227 test "${test_randr+set}" = set || test_randr="$using_x11"
1228 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1229 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1231 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1232 # Make sure fontconfig and freetype test both either system or not
1233 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1234 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1236 # convenience / platform overriding "fixes"
1237 # Don't sort!
1238 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1239 test "$test_kf5" = yes && test_qt5=yes
1240 test "$test_gtk3" != yes && enable_gtk3=no
1241 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1242 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1243 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1245 # Keep in sync with the above $using_x11 depending test default list
1246 disable_x11_tests()
1248     test_cups=no
1249     test_dbus=no
1250     test_gen=no
1251     test_gstreamer_1_0=no
1252     test_gtk3_kde5=no
1253     test_gtk3=no
1254     test_gtk4=no
1255     test_kf5=no
1256     test_kf6=no
1257     test_qt5=no
1258     test_qt6=no
1259     test_randr=no
1260     test_xrender=no
1263 test "$using_x11" = yes && USING_X11=TRUE
1265 if test "$using_freetype_fontconfig" = yes; then
1266     AC_DEFINE(USE_HEADLESS_CODE)
1267     USE_HEADLESS_CODE=TRUE
1268     if test "$using_headless_plugin" = yes; then
1269         AC_DEFINE(ENABLE_HEADLESS)
1270         ENABLE_HEADLESS=TRUE
1271     fi
1272 else
1273     test_fontconfig=no
1274     test_freetype=no
1277 AC_SUBST(ENABLE_HEADLESS)
1278 AC_SUBST(USE_HEADLESS_CODE)
1280 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1281 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1282 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1283 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1285 # ===================================================================
1287 # End initial platform setup
1289 # ===================================================================
1291 if test "$_os" = "Android" ; then
1292     # Verify that the NDK and SDK options are proper
1293     if test -z "$with_android_ndk"; then
1294         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1295     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1296         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1297     fi
1299     if test -z "$ANDROID_SDK_DIR"; then
1300         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1301     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1302         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1303     fi
1306 AC_SUBST(SDKDIRNAME)
1308 AC_SUBST(PTHREAD_CFLAGS)
1309 AC_SUBST(PTHREAD_LIBS)
1311 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1312 # By default use the ones specified by our build system,
1313 # but explicit override is possible.
1314 AC_MSG_CHECKING(for explicit AFLAGS)
1315 if test -n "$AFLAGS"; then
1316     AC_MSG_RESULT([$AFLAGS])
1317     x_AFLAGS=
1318 else
1319     AC_MSG_RESULT(no)
1320     x_AFLAGS=[\#]
1322 AC_MSG_CHECKING(for explicit CFLAGS)
1323 if test -n "$CFLAGS"; then
1324     AC_MSG_RESULT([$CFLAGS])
1325     x_CFLAGS=
1326 else
1327     AC_MSG_RESULT(no)
1328     x_CFLAGS=[\#]
1330 AC_MSG_CHECKING(for explicit CXXFLAGS)
1331 if test -n "$CXXFLAGS"; then
1332     AC_MSG_RESULT([$CXXFLAGS])
1333     x_CXXFLAGS=
1334 else
1335     AC_MSG_RESULT(no)
1336     x_CXXFLAGS=[\#]
1338 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1339 if test -n "$OBJCFLAGS"; then
1340     AC_MSG_RESULT([$OBJCFLAGS])
1341     x_OBJCFLAGS=
1342 else
1343     AC_MSG_RESULT(no)
1344     x_OBJCFLAGS=[\#]
1346 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1347 if test -n "$OBJCXXFLAGS"; then
1348     AC_MSG_RESULT([$OBJCXXFLAGS])
1349     x_OBJCXXFLAGS=
1350 else
1351     AC_MSG_RESULT(no)
1352     x_OBJCXXFLAGS=[\#]
1354 AC_MSG_CHECKING(for explicit LDFLAGS)
1355 if test -n "$LDFLAGS"; then
1356     AC_MSG_RESULT([$LDFLAGS])
1357     x_LDFLAGS=
1358 else
1359     AC_MSG_RESULT(no)
1360     x_LDFLAGS=[\#]
1362 AC_SUBST(AFLAGS)
1363 AC_SUBST(CFLAGS)
1364 AC_SUBST(CXXFLAGS)
1365 AC_SUBST(OBJCFLAGS)
1366 AC_SUBST(OBJCXXFLAGS)
1367 AC_SUBST(LDFLAGS)
1368 AC_SUBST(x_AFLAGS)
1369 AC_SUBST(x_CFLAGS)
1370 AC_SUBST(x_CXXFLAGS)
1371 AC_SUBST(x_OBJCFLAGS)
1372 AC_SUBST(x_OBJCXXFLAGS)
1373 AC_SUBST(x_LDFLAGS)
1375 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1376 my_original_CFLAGS=$CFLAGS
1377 my_original_CXXFLAGS=$CXXFLAGS
1378 my_original_CPPFLAGS=$CPPFLAGS
1380 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1381 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1382 dnl AC_PROG_CC internally.
1383 if test "$_os" != "WINNT"; then
1384     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CC,
1385     # Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
1386     save_CFLAGS=$CFLAGS
1387     CFLAGS=-g
1388     AC_PROG_CC
1389     CFLAGS=$save_CFLAGS
1390     if test -z "$CC_BASE"; then
1391         CC_BASE=`first_arg_basename "$CC"`
1392     fi
1395 if test "$_os" != "WINNT"; then
1396     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1397 else
1398     ENDIANNESS=little
1400 AC_SUBST(ENDIANNESS)
1402 if test "$usable_dlapi" != no; then
1403     AC_DEFINE([HAVE_DLAPI])
1404     if test "$test_unix_dlapi" != no; then
1405         save_LIBS="$LIBS"
1406         AC_SEARCH_LIBS([dlsym], [dl],
1407             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1408             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1409         LIBS="$save_LIBS"
1410         AC_DEFINE([HAVE_UNIX_DLAPI])
1411     fi
1413 AC_SUBST(UNIX_DLAPI_LIBS)
1415 # Check for a (GNU) backtrace implementation
1416 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1417 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1418 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1419     save_LIBS="$LIBS"
1420     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1421         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1422         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1423     LIBS="$save_LIBS"
1425 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1426     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1429 dnl ===================================================================
1430 dnl Sanity checks for Emscripten SDK setup
1431 dnl ===================================================================
1433 EMSCRIPTEN_MIN_MAJOR=2
1434 EMSCRIPTEN_MIN_MINOR=0
1435 EMSCRIPTEN_MIN_TINY=31
1436 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1438 if test "$_os" = "Emscripten"; then
1439     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1440     if test -z "$EMSCRIPTEN_VERSION_H"; then
1441         AS_IF([test -z "$EMSDK"],
1442               [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1443         EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1444     fi
1445     if test -f "$EMSCRIPTEN_VERSION_H"; then
1446         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1447         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1448         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1449     else
1450         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1451         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1452         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1453         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1454     fi
1456     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1458     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1459     if test $? -eq 0; then
1460         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1461     else
1462         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1463     fi
1465     EMSCRIPTEN_ERROR=0
1466     if ! command -v emconfigure >/dev/null 2>&1; then
1467         AC_MSG_WARN([emconfigure must be in your \$PATH])
1468         EMSCRIPTEN_ERROR=1
1469     fi
1470     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1471         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1472         EMSCRIPTEN_ERROR=1
1473     fi
1474     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1475     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1476         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1477         EMSCRIPTEN_ERROR=1
1478     fi
1479     if test $EMSCRIPTEN_ERROR -ne 0; then
1480         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1481     fi
1483     dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
1484     BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
1486 AC_SUBST(EMSDK_FILE_PACKAGER)
1488 ###############################################################################
1489 # Extensions switches --enable/--disable
1490 ###############################################################################
1491 # By default these should be enabled unless having extra dependencies.
1492 # If there is extra dependency over configure options then the enable should
1493 # be automagic based on whether the requiring feature is enabled or not.
1494 # All this options change anything only with --enable-extension-integration.
1496 # The name of this option and its help string makes it sound as if
1497 # extensions are built anyway, just not integrated in the installer,
1498 # if you use --disable-extension-integration. Is that really the
1499 # case?
1501 AC_ARG_ENABLE(ios-simulator,
1502     AS_HELP_STRING([--enable-ios-simulator],
1503         [build for iOS simulator])
1506 libo_FUZZ_ARG_ENABLE(extension-integration,
1507     AS_HELP_STRING([--disable-extension-integration],
1508         [Disable integration of the built extensions in the installer of the
1509          product. Use this switch to disable the integration.])
1512 AC_ARG_ENABLE(avmedia,
1513     AS_HELP_STRING([--disable-avmedia],
1514         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1515 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1517 AC_ARG_ENABLE(database-connectivity,
1518     AS_HELP_STRING([--disable-database-connectivity],
1519         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1522 # This doesn't mean not building (or "integrating") extensions
1523 # (although it probably should; i.e. it should imply
1524 # --disable-extension-integration I guess), it means not supporting
1525 # any extension mechanism at all
1526 libo_FUZZ_ARG_ENABLE(extensions,
1527     AS_HELP_STRING([--disable-extensions],
1528         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1531 AC_ARG_ENABLE(scripting,
1532     AS_HELP_STRING([--disable-scripting],
1533         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1534 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1536 # This is mainly for Android and iOS, but could potentially be used in some
1537 # special case otherwise, too, so factored out as a separate setting
1539 AC_ARG_ENABLE(dynamic-loading,
1540     AS_HELP_STRING([--disable-dynamic-loading],
1541         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1544 libo_FUZZ_ARG_ENABLE(report-builder,
1545     AS_HELP_STRING([--disable-report-builder],
1546         [Disable the Report Builder.])
1549 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1550     AS_HELP_STRING([--enable-ext-wiki-publisher],
1551         [Enable the Wiki Publisher extension.])
1554 libo_FUZZ_ARG_ENABLE(lpsolve,
1555     AS_HELP_STRING([--disable-lpsolve],
1556         [Disable compilation of the lp solve solver ])
1558 libo_FUZZ_ARG_ENABLE(coinmp,
1559     AS_HELP_STRING([--disable-coinmp],
1560         [Disable compilation of the CoinMP solver ])
1563 libo_FUZZ_ARG_ENABLE(pdfimport,
1564     AS_HELP_STRING([--disable-pdfimport],
1565         [Disable building the PDF import feature.])
1568 libo_FUZZ_ARG_ENABLE(pdfium,
1569     AS_HELP_STRING([--disable-pdfium],
1570         [Disable building PDFium. Results in insecure PDF signature verification.])
1573 libo_FUZZ_ARG_ENABLE(skia,
1574     AS_HELP_STRING([--disable-skia],
1575         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1578 ###############################################################################
1580 dnl ---------- *** ----------
1582 libo_FUZZ_ARG_ENABLE(mergelibs,
1583     AS_HELP_STRING([--enable-mergelibs=yes/no/more],
1584         [Merge several of the smaller libraries into one big "merged" library.
1585          The "more" option will link even more of the smaller libraries.
1586          "more" not appropriate for distros which split up LibreOffice into multiple packages.
1587          It is only appropriate for situations where all of LO is delivered in a single install/package. ])
1590 libo_FUZZ_ARG_ENABLE(breakpad,
1591     AS_HELP_STRING([--enable-breakpad],
1592         [Enables breakpad for crash reporting.])
1595 libo_FUZZ_ARG_ENABLE(crashdump,
1596     AS_HELP_STRING([--disable-crashdump],
1597         [Disable dump.ini and dump-file, when --enable-breakpad])
1600 AC_ARG_ENABLE(fetch-external,
1601     AS_HELP_STRING([--disable-fetch-external],
1602         [Disables fetching external tarballs from web sources.])
1605 AC_ARG_ENABLE(fuzzers,
1606     AS_HELP_STRING([--enable-fuzzers],
1607         [Enables building libfuzzer targets for fuzz testing.])
1610 libo_FUZZ_ARG_ENABLE(pch,
1611     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1612         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1613          Using 'system' will include only external headers, 'base' will add also headers
1614          from base modules, 'normal' will also add all headers except from the module built,
1615          'full' will use all suitable headers even from a module itself.])
1618 libo_FUZZ_ARG_ENABLE(epm,
1619     AS_HELP_STRING([--enable-epm],
1620         [LibreOffice includes self-packaging code, that requires epm, however epm is
1621          useless for large scale package building.])
1624 libo_FUZZ_ARG_ENABLE(odk,
1625     AS_HELP_STRING([--enable-odk],
1626         [Enable building the Office Development Kit, the part that extensions need to build against])
1629 AC_ARG_ENABLE(mpl-subset,
1630     AS_HELP_STRING([--enable-mpl-subset],
1631         [Don't compile any pieces which are not MPL or more liberally licensed])
1634 libo_FUZZ_ARG_ENABLE(evolution2,
1635     AS_HELP_STRING([--enable-evolution2],
1636         [Allows the built-in evolution 2 addressbook connectivity build to be
1637          enabled.])
1640 AC_ARG_ENABLE(avahi,
1641     AS_HELP_STRING([--enable-avahi],
1642         [Determines whether to use Avahi to advertise Impress to remote controls.])
1645 libo_FUZZ_ARG_ENABLE(werror,
1646     AS_HELP_STRING([--enable-werror],
1647         [Turn warnings to errors. (Has no effect in modules where the treating
1648          of warnings as errors is disabled explicitly.)]),
1651 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1652     AS_HELP_STRING([--enable-assert-always-abort],
1653         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1656 libo_FUZZ_ARG_ENABLE(dbgutil,
1657     AS_HELP_STRING([--enable-dbgutil],
1658         [Provide debugging support from --enable-debug and include additional debugging
1659          utilities such as object counting or more expensive checks.
1660          This is the recommended option for developers.
1661          Note that this makes the build ABI incompatible, it is not possible to mix object
1662          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1664 libo_FUZZ_ARG_ENABLE(debug,
1665     AS_HELP_STRING([--enable-debug],
1666         [Include debugging information, disable compiler optimization and inlining plus
1667          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1669 libo_FUZZ_ARG_ENABLE(split-debug,
1670     AS_HELP_STRING([--disable-split-debug],
1671         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1672          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1674 libo_FUZZ_ARG_ENABLE(gdb-index,
1675     AS_HELP_STRING([--disable-gdb-index],
1676         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1677          The feature requires a linker that supports the --gdb-index option.]))
1679 libo_FUZZ_ARG_ENABLE(sal-log,
1680     AS_HELP_STRING([--enable-sal-log],
1681         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1683 libo_FUZZ_ARG_ENABLE(symbols,
1684     AS_HELP_STRING([--enable-symbols],
1685         [Generate debug information.
1686          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1687          otherwise. It is possible to explicitly specify gbuild build targets
1688          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1689          everything in the directory; there is no ordering, more specific overrides
1690          more general, and disabling takes precedence).
1691          Example: --enable-symbols="all -sw/ -Library_sc".]))
1693 libo_FUZZ_ARG_ENABLE(optimized,
1694     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1695         [Whether to compile with optimization flags.
1696          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1697          otherwise. Using 'debug' will try to use only optimizations that should
1698          not interfere with debugging. For Emscripten we default to optimized (-O1)
1699          debug build, as otherwise binaries become too large.]))
1701 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1702     AS_HELP_STRING([--disable-runtime-optimizations],
1703         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1704          JVM JIT) that are known to interact badly with certain dynamic analysis
1705          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1706          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1707          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1709 AC_ARG_WITH(valgrind,
1710     AS_HELP_STRING([--with-valgrind],
1711         [Make availability of Valgrind headers a hard requirement.]))
1713 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1714     AS_HELP_STRING([--enable-compiler-plugins],
1715         [Enable compiler plugins that will perform additional checks during
1716          building. Enabled automatically by --enable-dbgutil.
1717          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1718 COMPILER_PLUGINS_DEBUG=
1719 if test "$enable_compiler_plugins" = debug; then
1720     enable_compiler_plugins=yes
1721     COMPILER_PLUGINS_DEBUG=TRUE
1724 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1725     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1726         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1727          relevant in the --disable-compiler-plugins case.]))
1729 libo_FUZZ_ARG_ENABLE(ooenv,
1730     AS_HELP_STRING([--enable-ooenv],
1731         [Enable ooenv for the instdir installation.]))
1733 AC_ARG_ENABLE(lto,
1734     AS_HELP_STRING([--enable-lto],
1735         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1736          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1737          linker.)]))
1739 AC_ARG_ENABLE(python,
1740     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1741         [Enables or disables Python support at run-time.
1742          Also specifies what Python to use at build-time.
1743          'fully-internal' even forces the internal version for uses of Python
1744          during the build.
1745          On macOS the only choices are
1746          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1747          ]))
1749 libo_FUZZ_ARG_ENABLE(gtk3,
1750     AS_HELP_STRING([--disable-gtk3],
1751         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1752 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1754 AC_ARG_ENABLE(gtk4,
1755     AS_HELP_STRING([--enable-gtk4],
1756         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1758 AC_ARG_ENABLE(atspi-tests,
1759     AS_HELP_STRING([--disable-atspi-tests],
1760         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1762 AC_ARG_ENABLE(introspection,
1763     AS_HELP_STRING([--enable-introspection],
1764         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1765          Linux distributions.)]))
1767 AC_ARG_ENABLE(split-app-modules,
1768     AS_HELP_STRING([--enable-split-app-modules],
1769         [Split file lists for app modules, e.g. base, calc.
1770          Has effect only with make distro-pack-install]),
1773 AC_ARG_ENABLE(split-opt-features,
1774     AS_HELP_STRING([--enable-split-opt-features],
1775         [Split file lists for some optional features, e.g. pyuno, testtool.
1776          Has effect only with make distro-pack-install]),
1779 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1780     AS_HELP_STRING([--disable-cairo-canvas],
1781         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1784 libo_FUZZ_ARG_ENABLE(dbus,
1785     AS_HELP_STRING([--disable-dbus],
1786         [Determines whether to enable features that depend on dbus.
1787          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1788 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1790 libo_FUZZ_ARG_ENABLE(sdremote,
1791     AS_HELP_STRING([--disable-sdremote],
1792         [Determines whether to enable Impress remote control (i.e. the server component).]),
1793 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1795 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1796     AS_HELP_STRING([--disable-sdremote-bluetooth],
1797         [Determines whether to build sdremote with bluetooth support.
1798          Requires dbus on Linux.]))
1800 libo_FUZZ_ARG_ENABLE(gio,
1801     AS_HELP_STRING([--disable-gio],
1802         [Determines whether to use the GIO support.]),
1803 ,test "${enable_gio+set}" = set || enable_gio=yes)
1805 AC_ARG_ENABLE(qt5,
1806     AS_HELP_STRING([--enable-qt5],
1807         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1808          available.]),
1811 AC_ARG_ENABLE(qt6,
1812     AS_HELP_STRING([--enable-qt6],
1813         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1814          available.]),
1817 AC_ARG_ENABLE(kf5,
1818     AS_HELP_STRING([--enable-kf5],
1819         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1820          KF5 are available.]),
1823 AC_ARG_ENABLE(kf6,
1824     AS_HELP_STRING([--enable-kf6],
1825         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1826          KF6 are available.]),
1830 AC_ARG_ENABLE(gtk3_kde5,
1831     AS_HELP_STRING([--enable-gtk3-kde5],
1832         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1833          platforms where Gtk3, Qt5 and Plasma is available.]),
1836 AC_ARG_ENABLE(gen,
1837     AS_HELP_STRING([--enable-gen],
1838         [To select the gen backend in case of --disable-dynamic-loading.
1839          Per default auto-enabled when X11 is used.]),
1840 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1842 AC_ARG_ENABLE(gui,
1843     AS_HELP_STRING([--disable-gui],
1844         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1845 ,enable_gui=yes)
1847 libo_FUZZ_ARG_ENABLE(randr,
1848     AS_HELP_STRING([--disable-randr],
1849         [Disable RandR support in the vcl project.]),
1850 ,test "${enable_randr+set}" = set || enable_randr=yes)
1852 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1853     AS_HELP_STRING([--disable-gstreamer-1-0],
1854         [Disable building with the gstreamer 1.0 avmedia backend.]),
1855 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1857 libo_FUZZ_ARG_ENABLE([eot],
1858     [AS_HELP_STRING([--enable-eot],
1859         [Enable support for Embedded OpenType fonts.])],
1860 ,test "${enable_eot+set}" = set || enable_eot=no)
1862 libo_FUZZ_ARG_ENABLE(cve-tests,
1863     AS_HELP_STRING([--disable-cve-tests],
1864         [Prevent CVE tests to be executed]),
1867 AC_ARG_ENABLE(build-opensymbol,
1868     AS_HELP_STRING([--enable-build-opensymbol],
1869         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1870          fontforge installed.]),
1873 AC_ARG_ENABLE(dependency-tracking,
1874     AS_HELP_STRING([--enable-dependency-tracking],
1875         [Do not reject slow dependency extractors.])[
1876   --disable-dependency-tracking
1877                           Disables generation of dependency information.
1878                           Speed up one-time builds.],
1881 AC_ARG_ENABLE(icecream,
1882     AS_HELP_STRING([--enable-icecream],
1883         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1884          It defaults to /opt/icecream for the location of the icecream gcc/g++
1885          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1888 AC_ARG_ENABLE(ld,
1889     AS_HELP_STRING([--enable-ld=<linker>],
1890         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1891          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1892          If <linker> contains any ':', the part before the first ':' is used as the value of
1893          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1894          needed for Clang 12).]),
1897 libo_FUZZ_ARG_ENABLE(cups,
1898     AS_HELP_STRING([--disable-cups],
1899         [Do not build cups support.])
1902 AC_ARG_ENABLE(ccache,
1903     AS_HELP_STRING([--disable-ccache],
1904         [Do not try to use ccache automatically.
1905          By default we will try to detect if ccache is available; in that case if
1906          CC/CXX are not yet set, and --enable-icecream is not given, we
1907          attempt to use ccache. --disable-ccache disables ccache completely.
1908          Additionally ccache's depend mode is enabled if possible,
1909          use --enable-ccache=nodepend to enable ccache without depend mode.
1913 AC_ARG_ENABLE(z7-debug,
1914     AS_HELP_STRING([--enable-z7-debug],
1915         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1916          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1917          Enabled by default if ccache is detected.]))
1919 libo_FUZZ_ARG_ENABLE(online-update,
1920     AS_HELP_STRING([--enable-online-update],
1921         [Enable the online update service that will check for new versions of
1922          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
1925 libo_FUZZ_ARG_ENABLE(online-update-mar,
1926     AS_HELP_STRING([--enable-online-update-mar],
1927         [Enable the experimental Mozilla-like online update service that will
1928          check for new versions of LibreOffice. Disabled by default.]),
1931 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1932     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1933         [Set the base URL value for --enable-online-update-mar.
1934          (Can be left off for debug purposes, even if that may render the feature
1935          non-functional.)]),
1938 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1939     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1940         [Set the certificate DER value for --enable-online-update-mar.
1941          (Can be left off for debug purposes, even if that may render the feature
1942          non-functional.)]),
1945 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1946     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1947         [Set the certificate name value for --enable-online-update-mar.
1948          (Can be left off for debug purposes, even if that may render the feature
1949          non-functional.)]),
1952 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1953     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1954         [Set the certificate path value for --enable-online-update-mar.
1955          (Can be left off for debug purposes, even if that may render the feature
1956          non-functional.)]),
1959 libo_FUZZ_ARG_ENABLE(extension-update,
1960     AS_HELP_STRING([--disable-extension-update],
1961         [Disable possibility to update installed extensions.]),
1964 libo_FUZZ_ARG_ENABLE(release-build,
1965     AS_HELP_STRING([--enable-release-build],
1966         [Enable release build. Note that the "release build" choice is orthogonal to
1967          whether symbols are present, debug info is generated, or optimization
1968          is done.
1969          See https://wiki.documentfoundation.org/Development/DevBuild]),
1972 libo_FUZZ_ARG_ENABLE(hardening-flags,
1973     AS_HELP_STRING([--enable-hardening-flags],
1974         [Enable automatically using hardening compiler flags. Distros typically
1975          instead use their default configuration via CXXFLAGS, etc. But this provides a
1976          convenient set of default hardening flags for non-distros]),
1979 AC_ARG_ENABLE(windows-build-signing,
1980     AS_HELP_STRING([--enable-windows-build-signing],
1981         [Enable signing of windows binaries (*.exe, *.dll)]),
1984 AC_ARG_ENABLE(silent-msi,
1985     AS_HELP_STRING([--enable-silent-msi],
1986         [Enable MSI with LIMITUI=1 (silent install).]),
1989 AC_ARG_ENABLE(wix,
1990     AS_HELP_STRING([--enable-wix],
1991         [Build Windows installer using WiX.]),
1994 AC_ARG_ENABLE(macosx-code-signing,
1995     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1996         [Sign executables, dylibs, frameworks and the app bundle. If you
1997          don't provide an identity the first suitable certificate
1998          in your keychain is used.]),
2001 AC_ARG_ENABLE(macosx-package-signing,
2002     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2003         [Create a .pkg suitable for uploading to the Mac App Store and sign
2004          it. If you don't provide an identity the first suitable certificate
2005          in your keychain is used.]),
2008 AC_ARG_ENABLE(macosx-sandbox,
2009     AS_HELP_STRING([--enable-macosx-sandbox],
2010         [Make the app bundle run in a sandbox. Requires code signing.
2011          Is required by apps distributed in the Mac App Store, and implies
2012          adherence to App Store rules.]),
2015 AC_ARG_WITH(macosx-bundle-identifier,
2016     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2017         [Define the macOS bundle identifier. Default is the somewhat weird
2018          org.libreoffice.script ("script", huh?).]),
2019 ,with_macosx_bundle_identifier=org.libreoffice.script)
2021 AC_ARG_WITH(macosx-provisioning-profile,
2022     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2023         [Specify the path to a provisioning profile to use]),
2026 AC_ARG_WITH(product-name,
2027     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2028         [Define the product name. Default is AC_PACKAGE_NAME.]),
2029 ,with_product_name=$PRODUCTNAME)
2031 libo_FUZZ_ARG_ENABLE(community-flavor,
2032     AS_HELP_STRING([--disable-community-flavor],
2033         [Disable the Community branding.]),
2036 AC_ARG_WITH(package-version,
2037     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2038         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2041 libo_FUZZ_ARG_ENABLE(readonly-installset,
2042     AS_HELP_STRING([--enable-readonly-installset],
2043         [Prevents any attempts by LibreOffice to write into its installation. That means
2044          at least that no "system-wide" extensions can be added. Partly experimental work in
2045          progress, probably not fully implemented. Always enabled for macOS.]),
2048 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2049     AS_HELP_STRING([--disable-mariadb-sdbc],
2050         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2053 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2054     AS_HELP_STRING([--disable-postgresql-sdbc],
2055         [Disable the build of the PostgreSQL-SDBC driver.])
2058 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2059     AS_HELP_STRING([--disable-lotuswordpro],
2060         [Disable the build of the Lotus Word Pro filter.]),
2061 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2063 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2064     AS_HELP_STRING([--disable-firebird-sdbc],
2065         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2066 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2068 AC_ARG_ENABLE(bogus-pkg-config,
2069     AS_HELP_STRING([--enable-bogus-pkg-config],
2070         [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.]),
2073 AC_ARG_ENABLE(openssl,
2074     AS_HELP_STRING([--disable-openssl],
2075         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2076          components will use NSS. Work in progress,
2077          use only if you are hacking on it.]),
2078 ,enable_openssl=yes)
2080 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2081     AS_HELP_STRING([--enable-cipher-openssl-backend],
2082         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2083          Requires --enable-openssl.]))
2085 AC_ARG_ENABLE(nss,
2086     AS_HELP_STRING([--disable-nss],
2087         [Disable using NSS. If disabled,
2088          components will use openssl. Work in progress,
2089          use only if you are hacking on it.]),
2090 ,enable_nss=yes)
2092 AC_ARG_ENABLE(library-bin-tar,
2093     AS_HELP_STRING([--enable-library-bin-tar],
2094         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2095         Some libraries can save their build result in a tarball
2096         stored in TARFILE_LOCATION. That binary tarball is
2097         uniquely identified by the source tarball,
2098         the content of the config_host.mk file and the content
2099         of the top-level directory in core for that library
2100         If this option is enabled, then if such a tarfile exist, it will be untarred
2101         instead of the source tarfile, and the build step will be skipped for that
2102         library.
2103         If a proper tarfile does not exist, then the normal source-based
2104         build is done for that library and a proper binary tarfile is created
2105         for the next time.]),
2108 AC_ARG_ENABLE(dconf,
2109     AS_HELP_STRING([--disable-dconf],
2110         [Disable the dconf configuration backend (enabled by default where
2111          available).]))
2113 libo_FUZZ_ARG_ENABLE(formula-logger,
2114     AS_HELP_STRING(
2115         [--enable-formula-logger],
2116         [Enable formula logger for logging formula calculation flow in Calc.]
2117     )
2120 AC_ARG_ENABLE(ldap,
2121     AS_HELP_STRING([--disable-ldap],
2122         [Disable LDAP support.]),
2123 ,enable_ldap=yes)
2125 AC_ARG_ENABLE(opencl,
2126     AS_HELP_STRING([--disable-opencl],
2127         [Disable OpenCL support.]),
2128 ,enable_opencl=yes)
2130 libo_FUZZ_ARG_ENABLE(librelogo,
2131     AS_HELP_STRING([--disable-librelogo],
2132         [Do not build LibreLogo.]),
2133 ,enable_librelogo=yes)
2135 AC_ARG_ENABLE(wasm-strip,
2136     AS_HELP_STRING([--enable-wasm-strip],
2137         [Strip the static build like for WASM/emscripten platform.]),
2140 AC_ARG_WITH(main-module,
2141     AS_HELP_STRING([--with-main-module=<writer/calc>],
2142         [Specify which main module to build for wasm.
2143         Default value is 'writer'.]),
2146 AC_ARG_ENABLE(wasm-exceptions,
2147     AS_HELP_STRING([--enable-wasm-exceptions],
2148         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2149         matter of fact, this is currently not finished by any implementation)
2150         (see https://webassembly.org/roadmap/ for the current state]),
2153 AC_ARG_ENABLE(xmlhelp,
2154     AS_HELP_STRING([--disable-xmlhelp],
2155         [Disable XML help support]),
2156 ,enable_xmlhelp=yes)
2158 AC_ARG_ENABLE(customtarget-components,
2159     AS_HELP_STRING([--enable-customtarget-components],
2160         [Generates the static UNO object constructor mapping from the build.]))
2162 dnl ===================================================================
2163 dnl Optional Packages (--with/without-)
2164 dnl ===================================================================
2166 AC_ARG_WITH(gcc-home,
2167     AS_HELP_STRING([--with-gcc-home],
2168         [Specify the location of gcc/g++ manually. This can be used in conjunction
2169          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2170          non-default path.]),
2173 AC_ARG_WITH(gnu-patch,
2174     AS_HELP_STRING([--with-gnu-patch],
2175         [Specify location of GNU patch on Solaris or FreeBSD.]),
2178 AC_ARG_WITH(build-platform-configure-options,
2179     AS_HELP_STRING([--with-build-platform-configure-options],
2180         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2183 AC_ARG_WITH(gnu-cp,
2184     AS_HELP_STRING([--with-gnu-cp],
2185         [Specify location of GNU cp on Solaris or FreeBSD.]),
2188 AC_ARG_WITH(external-tar,
2189     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2190         [Specify an absolute path of where to find (and store) tarfiles.]),
2191     TARFILE_LOCATION=$withval ,
2194 AC_ARG_WITH(referenced-git,
2195     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2196         [Specify another checkout directory to reference. This makes use of
2197                  git submodule update --reference, and saves a lot of diskspace
2198                  when having multiple trees side-by-side.]),
2199     GIT_REFERENCE_SRC=$withval ,
2202 AC_ARG_WITH(linked-git,
2203     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2204         [Specify a directory where the repositories of submodules are located.
2205          This uses a method similar to git-new-workdir to get submodules.]),
2206     GIT_LINK_SRC=$withval ,
2209 AC_ARG_WITH(galleries,
2210     AS_HELP_STRING([--with-galleries],
2211         [Specify how galleries should be built. It is possible either to
2212          build these internally from source ("build"),
2213          or to disable them ("no")]),
2216 AC_ARG_WITH(templates,
2217     AS_HELP_STRING([--with-templates],
2218         [Specify we build with or without template files. It is possible either to
2219          build with templates ("yes"),
2220          or to disable them ("no")]),
2223 AC_ARG_WITH(theme,
2224     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2225         [Choose which themes to include. By default those themes with an '*' are included.
2226          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2227          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2228          *elementary, *elementary_svg,
2229          *karasa_jaga, *karasa_jaga_svg,
2230          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2231          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2234 libo_FUZZ_ARG_WITH(helppack-integration,
2235     AS_HELP_STRING([--without-helppack-integration],
2236         [It will not integrate the helppacks to the installer
2237          of the product. Please use this switch to use the online help
2238          or separate help packages.]),
2241 libo_FUZZ_ARG_WITH(fonts,
2242     AS_HELP_STRING([--without-fonts],
2243         [LibreOffice includes some third-party fonts to provide a reliable basis for
2244          help content, templates, samples, etc. When these fonts are already
2245          known to be available on the system then you should use this option.]),
2248 AC_ARG_WITH(epm,
2249     AS_HELP_STRING([--with-epm],
2250         [Decides which epm to use. Default is to use the one from the system if
2251          one is built. When either this is not there or you say =internal epm
2252          will be built.]),
2255 AC_ARG_WITH(package-format,
2256     AS_HELP_STRING([--with-package-format],
2257         [Specify package format(s) for LibreOffice installation sets. The
2258          implicit --without-package-format leads to no installation sets being
2259          generated. Possible values: archive, bsd, deb, dmg,
2260          installed, msi, pkg, and rpm.
2261          Example: --with-package-format='deb rpm']),
2264 AC_ARG_WITH(tls,
2265     AS_HELP_STRING([--with-tls],
2266         [Decides which TLS/SSL and cryptographic implementations to use for
2267          LibreOffice's code. Default is to use NSS although OpenSSL is also
2268          possible. Notice that selecting NSS restricts the usage of OpenSSL
2269          in LO's code but selecting OpenSSL doesn't restrict by now the
2270          usage of NSS in LO's code. Possible values: openssl, nss.
2271          Example: --with-tls="nss"]),
2274 AC_ARG_WITH(system-libs,
2275     AS_HELP_STRING([--with-system-libs],
2276         [Use libraries already on system -- enables all --with-system-* flags.]),
2279 AC_ARG_WITH(system-bzip2,
2280     AS_HELP_STRING([--with-system-bzip2],
2281         [Use bzip2 already on system. Used when --enable-online-update-mar
2282         or --enable-python=internal]),,
2283     [with_system_bzip2="$with_system_libs"])
2285 AC_ARG_WITH(system-headers,
2286     AS_HELP_STRING([--with-system-headers],
2287         [Use headers already on system -- enables all --with-system-* flags for
2288          external packages whose headers are the only entities used i.e.
2289          boost/odbc/sane-header(s).]),,
2290     [with_system_headers="$with_system_libs"])
2292 AC_ARG_WITH(system-jars,
2293     AS_HELP_STRING([--without-system-jars],
2294         [When building with --with-system-libs, also the needed jars are expected
2295          on the system. Use this to disable that]),,
2296     [with_system_jars="$with_system_libs"])
2298 AC_ARG_WITH(system-cairo,
2299     AS_HELP_STRING([--with-system-cairo],
2300         [Use cairo libraries already on system.  Happens automatically for
2301          (implicit) --enable-gtk3.]))
2303 AC_ARG_WITH(system-epoxy,
2304     AS_HELP_STRING([--with-system-epoxy],
2305         [Use epoxy libraries already on system.  Happens automatically for
2306          (implicit) --enable-gtk3.]),,
2307        [with_system_epoxy="$with_system_libs"])
2309 AC_ARG_WITH(myspell-dicts,
2310     AS_HELP_STRING([--with-myspell-dicts],
2311         [Adds myspell dictionaries to the LibreOffice installation set]),
2314 AC_ARG_WITH(system-dicts,
2315     AS_HELP_STRING([--without-system-dicts],
2316         [Do not use dictionaries from system paths.]),
2319 AC_ARG_WITH(external-dict-dir,
2320     AS_HELP_STRING([--with-external-dict-dir],
2321         [Specify external dictionary dir.]),
2324 AC_ARG_WITH(external-hyph-dir,
2325     AS_HELP_STRING([--with-external-hyph-dir],
2326         [Specify external hyphenation pattern dir.]),
2329 AC_ARG_WITH(external-thes-dir,
2330     AS_HELP_STRING([--with-external-thes-dir],
2331         [Specify external thesaurus dir.]),
2334 AC_ARG_WITH(system-zlib,
2335     AS_HELP_STRING([--with-system-zlib],
2336         [Use zlib already on system.]),,
2337     [with_system_zlib=auto])
2339 AC_ARG_WITH(system-jpeg,
2340     AS_HELP_STRING([--with-system-jpeg],
2341         [Use jpeg already on system.]),,
2342     [with_system_jpeg="$with_system_libs"])
2344 AC_ARG_WITH(system-expat,
2345     AS_HELP_STRING([--with-system-expat],
2346         [Use expat already on system.]),,
2347     [with_system_expat="$with_system_libs"])
2349 AC_ARG_WITH(system-libxml,
2350     AS_HELP_STRING([--with-system-libxml],
2351         [Use libxml/libxslt already on system.]),,
2352     [with_system_libxml=auto])
2354 AC_ARG_WITH(system-openldap,
2355     AS_HELP_STRING([--with-system-openldap],
2356         [Use the OpenLDAP LDAP SDK already on system.]),,
2357     [with_system_openldap="$with_system_libs"])
2359 libo_FUZZ_ARG_ENABLE(poppler,
2360     AS_HELP_STRING([--disable-poppler],
2361         [Disable building Poppler.])
2364 AC_ARG_WITH(system-poppler,
2365     AS_HELP_STRING([--with-system-poppler],
2366         [Use system poppler (only needed for PDF import).]),,
2367     [with_system_poppler="$with_system_libs"])
2369 AC_ARG_WITH(system-abseil,
2370     AS_HELP_STRING([--with-system-abseil],
2371         [Use the abseil libraries already on system.]),,
2372     [with_system_abseil="$with_system_libs"])
2374 AC_ARG_WITH(system-openjpeg,
2375     AS_HELP_STRING([--with-system-openjpeg],
2376         [Use the OpenJPEG library already on system.]),,
2377     [with_system_openjpeg="$with_system_libs"])
2379 libo_FUZZ_ARG_ENABLE(gpgmepp,
2380     AS_HELP_STRING([--disable-gpgmepp],
2381         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2384 AC_ARG_WITH(system-gpgmepp,
2385     AS_HELP_STRING([--with-system-gpgmepp],
2386         [Use gpgmepp already on system]),,
2387     [with_system_gpgmepp="$with_system_libs"])
2389 AC_ARG_WITH(system-mariadb,
2390     AS_HELP_STRING([--with-system-mariadb],
2391         [Use MariaDB/MySQL libraries already on system.]),,
2392     [with_system_mariadb="$with_system_libs"])
2394 AC_ARG_ENABLE(bundle-mariadb,
2395     AS_HELP_STRING([--enable-bundle-mariadb],
2396         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2399 AC_ARG_WITH(system-postgresql,
2400     AS_HELP_STRING([--with-system-postgresql],
2401         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2402          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2403     [with_system_postgresql="$with_system_libs"])
2405 AC_ARG_WITH(libpq-path,
2406     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2407         [Use this PostgreSQL C interface (libpq) installation for building
2408          the PostgreSQL-SDBC extension.]),
2411 AC_ARG_WITH(system-firebird,
2412     AS_HELP_STRING([--with-system-firebird],
2413         [Use Firebird libraries already on system, for building the Firebird-SDBC
2414          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2415     [with_system_firebird="$with_system_libs"])
2417 AC_ARG_WITH(system-libtommath,
2418             AS_HELP_STRING([--with-system-libtommath],
2419                            [Use libtommath already on system]),,
2420             [with_system_libtommath="$with_system_libs"])
2422 AC_ARG_WITH(system-hsqldb,
2423     AS_HELP_STRING([--with-system-hsqldb],
2424         [Use hsqldb already on system.]))
2426 AC_ARG_WITH(hsqldb-jar,
2427     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2428         [Specify path to jarfile manually.]),
2429     HSQLDB_JAR=$withval)
2431 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2432     AS_HELP_STRING([--disable-scripting-beanshell],
2433         [Disable support for scripts in BeanShell.]),
2437 AC_ARG_WITH(system-beanshell,
2438     AS_HELP_STRING([--with-system-beanshell],
2439         [Use beanshell already on system.]),,
2440     [with_system_beanshell="$with_system_jars"])
2442 AC_ARG_WITH(beanshell-jar,
2443     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2444         [Specify path to jarfile manually.]),
2445     BSH_JAR=$withval)
2447 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2448     AS_HELP_STRING([--disable-scripting-javascript],
2449         [Disable support for scripts in JavaScript.]),
2453 AC_ARG_WITH(system-rhino,
2454     AS_HELP_STRING([--with-system-rhino],
2455         [Use rhino already on system.]),,
2456     [with_system_rhino="$with_system_jars"])
2458 AC_ARG_WITH(rhino-jar,
2459     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2460         [Specify path to jarfile manually.]),
2461     RHINO_JAR=$withval)
2463 AC_ARG_WITH(system-jfreereport,
2464     AS_HELP_STRING([--with-system-jfreereport],
2465         [Use JFreeReport already on system.]),,
2466     [with_system_jfreereport="$with_system_jars"])
2468 AC_ARG_WITH(sac-jar,
2469     AS_HELP_STRING([--with-sac-jar=JARFILE],
2470         [Specify path to jarfile manually.]),
2471     SAC_JAR=$withval)
2473 AC_ARG_WITH(libxml-jar,
2474     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2475         [Specify path to jarfile manually.]),
2476     LIBXML_JAR=$withval)
2478 AC_ARG_WITH(flute-jar,
2479     AS_HELP_STRING([--with-flute-jar=JARFILE],
2480         [Specify path to jarfile manually.]),
2481     FLUTE_JAR=$withval)
2483 AC_ARG_WITH(jfreereport-jar,
2484     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2485         [Specify path to jarfile manually.]),
2486     JFREEREPORT_JAR=$withval)
2488 AC_ARG_WITH(liblayout-jar,
2489     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2490         [Specify path to jarfile manually.]),
2491     LIBLAYOUT_JAR=$withval)
2493 AC_ARG_WITH(libloader-jar,
2494     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2495         [Specify path to jarfile manually.]),
2496     LIBLOADER_JAR=$withval)
2498 AC_ARG_WITH(libformula-jar,
2499     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2500         [Specify path to jarfile manually.]),
2501     LIBFORMULA_JAR=$withval)
2503 AC_ARG_WITH(librepository-jar,
2504     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2505         [Specify path to jarfile manually.]),
2506     LIBREPOSITORY_JAR=$withval)
2508 AC_ARG_WITH(libfonts-jar,
2509     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2510         [Specify path to jarfile manually.]),
2511     LIBFONTS_JAR=$withval)
2513 AC_ARG_WITH(libserializer-jar,
2514     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2515         [Specify path to jarfile manually.]),
2516     LIBSERIALIZER_JAR=$withval)
2518 AC_ARG_WITH(libbase-jar,
2519     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2520         [Specify path to jarfile manually.]),
2521     LIBBASE_JAR=$withval)
2523 AC_ARG_WITH(system-odbc,
2524     AS_HELP_STRING([--with-system-odbc],
2525         [Use the odbc headers already on system.]),,
2526     [with_system_odbc="auto"])
2528 AC_ARG_WITH(system-sane,
2529     AS_HELP_STRING([--with-system-sane],
2530         [Use sane.h already on system.]),,
2531     [with_system_sane="$with_system_headers"])
2533 AC_ARG_WITH(system-bluez,
2534     AS_HELP_STRING([--with-system-bluez],
2535         [Use bluetooth.h already on system.]),,
2536     [with_system_bluez="$with_system_headers"])
2538 AC_ARG_WITH(system-boost,
2539     AS_HELP_STRING([--with-system-boost],
2540         [Use boost already on system.]),,
2541     [with_system_boost="$with_system_headers"])
2543 AC_ARG_WITH(system-dragonbox,
2544     AS_HELP_STRING([--with-system-dragonbox],
2545         [Use dragonbox already on system.]),,
2546     [with_system_dragonbox="$with_system_headers"])
2548 AC_ARG_WITH(system-frozen,
2549     AS_HELP_STRING([--with-system-frozen],
2550         [Use frozen already on system.]),,
2551     [with_system_frozen="$with_system_headers"])
2553 AC_ARG_WITH(system-libfixmath,
2554     AS_HELP_STRING([--with-system-libfixmath],
2555         [Use libfixmath already on system.]),,
2556     [with_system_libfixmath="$with_system_libs"])
2558 AC_ARG_WITH(system-glm,
2559     AS_HELP_STRING([--with-system-glm],
2560         [Use glm already on system.]),,
2561     [with_system_glm="$with_system_headers"])
2563 AC_ARG_WITH(system-hunspell,
2564     AS_HELP_STRING([--with-system-hunspell],
2565         [Use libhunspell already on system.]),,
2566     [with_system_hunspell="$with_system_libs"])
2568 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2569     AS_HELP_STRING([--enable-cairo-rgba],
2570         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2572 libo_FUZZ_ARG_ENABLE(zxing,
2573     AS_HELP_STRING([--disable-zxing],
2574        [Disable use of zxing external library.]))
2576 AC_ARG_WITH(system-zxing,
2577     AS_HELP_STRING([--with-system-zxing],
2578         [Use libzxing already on system.]),,
2579     [with_system_zxing="$with_system_libs"])
2581 AC_ARG_WITH(system-zxcvbn,
2582     AS_HELP_STRING([--with-system-zxcvbn],
2583         [Use libzxcvbn already on system.]),,
2584     [with_system_zxcvbn="$with_system_libs"])
2586 AC_ARG_WITH(system-box2d,
2587     AS_HELP_STRING([--with-system-box2d],
2588         [Use box2d already on system.]),,
2589     [with_system_box2d="$with_system_libs"])
2591 AC_ARG_WITH(system-mythes,
2592     AS_HELP_STRING([--with-system-mythes],
2593         [Use mythes already on system.]),,
2594     [with_system_mythes="$with_system_libs"])
2596 AC_ARG_WITH(system-altlinuxhyph,
2597     AS_HELP_STRING([--with-system-altlinuxhyph],
2598         [Use ALTLinuxhyph already on system.]),,
2599     [with_system_altlinuxhyph="$with_system_libs"])
2601 AC_ARG_WITH(system-lpsolve,
2602     AS_HELP_STRING([--with-system-lpsolve],
2603         [Use lpsolve already on system.]),,
2604     [with_system_lpsolve="$with_system_libs"])
2606 AC_ARG_WITH(system-coinmp,
2607     AS_HELP_STRING([--with-system-coinmp],
2608         [Use CoinMP already on system.]),,
2609     [with_system_coinmp="$with_system_libs"])
2611 AC_ARG_WITH(system-liblangtag,
2612     AS_HELP_STRING([--with-system-liblangtag],
2613         [Use liblangtag library already on system.]),,
2614     [with_system_liblangtag="$with_system_libs"])
2616 AC_ARG_WITH(system-lockfile,
2617     AS_HELP_STRING([--with-system-lockfile[=file]],
2618         [Detect a system lockfile program or use the \$file argument.]))
2620 AC_ARG_WITH(webdav,
2621     AS_HELP_STRING([--without-webdav],
2622         [Disable WebDAV support in the UCB.]))
2624 AC_ARG_WITH(linker-hash-style,
2625     AS_HELP_STRING([--with-linker-hash-style],
2626         [Use linker with --hash-style=<style> when linking shared objects.
2627          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2628          if supported on the build system, and "sysv" otherwise.]))
2630 AC_ARG_WITH(jdk-home,
2631     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2632         [If you have installed JDK 8 or later on your system please supply the
2633          path here. Note that this is not the location of the java command but the
2634          location of the entire distribution. In case of cross-compiling, this
2635          is the JDK of the host os. Use --with-build-platform-configure-options
2636          to point to a different build platform JDK.]),
2639 AC_ARG_WITH(help,
2640     AS_HELP_STRING([--with-help],
2641         [Enable the build of help. There is a special parameter "common" that
2642          can be used to bundle only the common part, .e.g help-specific icons.
2643          This is useful when you build the helpcontent separately.])
2644     [
2645                           Usage:     --with-help    build the old local help
2646                                  --without-help     no local help (default)
2647                                  --with-help=html   build the new HTML local help
2648                                  --with-help=online build the new HTML online help
2649     ],
2652 AC_ARG_WITH(omindex,
2653    AS_HELP_STRING([--with-omindex],
2654         [Enable the support of xapian-omega index for online help.])
2655    [
2656                          Usage: --with-omindex=server prepare the pages for omindex
2657                                 but let xapian-omega be built in server.
2658                                 --with-omindex=noxap do not prepare online pages
2659                                 for xapian-omega
2660   ],
2663 libo_FUZZ_ARG_WITH(java,
2664     AS_HELP_STRING([--with-java=<java command>],
2665         [Specify the name of the Java interpreter command. Typically "java"
2666          which is the default.
2668          To build without support for Java components, applets, accessibility
2669          or the XML filters written in Java, use --without-java or --with-java=no.]),
2670     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2671     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2674 AC_ARG_WITH(jvm-path,
2675     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2676         [Use a specific JVM search path at runtime.
2677          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2680 AC_ARG_WITH(ant-home,
2681     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2682         [If you have installed Apache Ant on your system, please supply the path here.
2683          Note that this is not the location of the Ant binary but the location
2684          of the entire distribution.]),
2687 AC_ARG_WITH(symbol-config,
2688     AS_HELP_STRING([--with-symbol-config],
2689         [Configuration for the crashreport symbol upload]),
2690         [],
2691         [with_symbol_config=no])
2693 AC_ARG_WITH(export-validation,
2694     AS_HELP_STRING([--without-export-validation],
2695         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2696 ,with_export_validation=auto)
2698 AC_ARG_WITH(bffvalidator,
2699     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2700         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2701          Requires installed Microsoft Office Binary File Format Validator.
2702          Note: export-validation (--with-export-validation) is required to be turned on.
2703          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2704 ,with_bffvalidator=no)
2706 libo_FUZZ_ARG_WITH(junit,
2707     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2708         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2709          --without-junit disables those tests. Not relevant in the --without-java case.]),
2710 ,with_junit=yes)
2712 AC_ARG_WITH(hamcrest,
2713     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2714         [Specifies the hamcrest jar file to use for JUnit-based tests.
2715          --without-junit disables those tests. Not relevant in the --without-java case.]),
2716 ,with_hamcrest=yes)
2718 AC_ARG_WITH(perl-home,
2719     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2720         [If you have installed Perl 5 Distribution, on your system, please
2721          supply the path here. Note that this is not the location of the Perl
2722          binary but the location of the entire distribution.]),
2725 libo_FUZZ_ARG_WITH(doxygen,
2726     AS_HELP_STRING(
2727         [--with-doxygen=<absolute path to doxygen executable>],
2728         [Specifies the doxygen executable to use when generating ODK C/C++
2729          documentation. --without-doxygen disables generation of ODK C/C++
2730          documentation. Not relevant in the --disable-odk case.]),
2731 ,with_doxygen=yes)
2733 AC_ARG_WITH(visual-studio,
2734     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2735         [Specify which Visual Studio version to use in case several are
2736          installed. Currently 2019 (default) and 2022 are supported.]),
2739 AC_ARG_WITH(windows-sdk,
2740     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2741         [Specify which Windows SDK, or "Windows Kit", version to use
2742          in case the one that came with the selected Visual Studio
2743          is not what you want for some reason. Note that not all compiler/SDK
2744          combinations are supported. The intent is that this option should not
2745          be needed.]),
2748 AC_ARG_WITH(lang,
2749     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2750         [Use this option to build LibreOffice with additional UI language support.
2751          English (US) is always included by default.
2752          Separate multiple languages with space.
2753          For all languages, use --with-lang=ALL.]),
2756 AC_ARG_WITH(locales,
2757     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2758         [Use this option to limit the locale information built in.
2759          Separate multiple locales with space.
2760          Very experimental and might well break stuff.
2761          Just a desperate measure to shrink code and data size.
2762          By default all the locales available is included.
2763          Just works with --disable-dynloading. Defaults to "ALL".
2764          This option is completely unrelated to --with-lang.])
2765     [
2766                           Affects also our character encoding conversion
2767                           tables for encodings mainly targeted for a
2768                           particular locale, like EUC-CN and EUC-TW for
2769                           zh, ISO-2022-JP for ja.
2771                           Affects also our add-on break iterator data for
2772                           some languages.
2774                           For the default, all locales, don't use this switch at all.
2775                           Specifying just the language part of a locale means all matching
2776                           locales will be included.
2777     ],
2780 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2781 # and also by Mariadb/Mysql since LibO 24.8
2782 libo_FUZZ_ARG_WITH(krb5,
2783     AS_HELP_STRING([--with-krb5],
2784         [Enable MIT Kerberos 5 support in modules that support it.
2785          By default automatically enabled on platforms
2786          where a good system Kerberos 5 is available.]),
2789 libo_FUZZ_ARG_WITH(gssapi,
2790     AS_HELP_STRING([--with-gssapi],
2791         [Enable GSSAPI support in modules that support it.
2792          By default automatically enabled on platforms
2793          where a good system GSSAPI is available.]),
2796 libo_FUZZ_ARG_WITH(lxml,
2797     AS_HELP_STRING([--without-lxml],
2798         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2799          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2800          report widget classes and ids.]),
2803 libo_FUZZ_ARG_WITH(latest-c++,
2804     AS_HELP_STRING([--with-latest-c++],
2805         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2806          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2807         [with_latest_c__=no])
2809 AC_ARG_WITH(gtk3-build,
2810     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2811         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2812          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2814 AC_ARG_WITH(keep-awake,
2815     AS_HELP_STRING([--with-keep-awake],
2816         [command to prefix make with in order to prevent the system from going to sleep/suspend
2817          while building.
2818          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2819          and caffeinate on macOS]))
2821 dnl ===================================================================
2822 dnl Branding
2823 dnl ===================================================================
2825 AC_ARG_WITH(branding,
2826     AS_HELP_STRING([--with-branding=/path/to/images],
2827         [Use given path to retrieve branding images set.])
2828     [
2829                           Search for intro.png about.svg and logo.svg.
2830                           If any is missing, default ones will be used instead.
2832                           Search also progress.conf for progress
2833                           settings on intro screen :
2835                           PROGRESSBARCOLOR="255,255,255" Set color of
2836                           progress bar. Comma separated RGB decimal values.
2837                           PROGRESSSIZE="407,6" Set size of progress bar.
2838                           Comma separated decimal values (width, height).
2839                           PROGRESSPOSITION="61,317" Set position of progress
2840                           bar from left,top. Comma separated decimal values.
2841                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2842                           bar frame. Comma separated RGB decimal values.
2843                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2844                           bar text. Comma separated RGB decimal values.
2845                           PROGRESSTEXTBASELINE="287" Set vertical position of
2846                           progress bar text from top. Decimal value.
2848                           Default values will be used if not found.
2849     ],
2853 AC_ARG_WITH(extra-buildid,
2854     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2855         [Show addition build identification in about dialog.]),
2859 AC_ARG_WITH(vendor,
2860     AS_HELP_STRING([--with-vendor="John the Builder"],
2861         [Set vendor of the build.]),
2864 AC_ARG_WITH(privacy-policy-url,
2865     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2866         [The URL to your privacy policy (needed when
2867          enabling online-update or crashreporting via breakpad)]),
2868         [if test "x$with_privacy_policy_url" = "xyes"; then
2869             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2870          elif test "x$with_privacy_policy_url" = "xno"; then
2871             with_privacy_policy_url="undefined"
2872          fi]
2873 ,[with_privacy_policy_url="undefined"])
2875 AC_ARG_WITH(android-package-name,
2876     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2877         [Set Android package name of the build.]),
2880 AC_ARG_WITH(compat-oowrappers,
2881     AS_HELP_STRING([--with-compat-oowrappers],
2882         [Install oo* wrappers in parallel with
2883          lo* ones to keep backward compatibility.
2884          Has effect only with make distro-pack-install]),
2887 AC_ARG_WITH(os-version,
2888     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2889         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2892 AC_ARG_WITH(parallelism,
2893     AS_HELP_STRING([--with-parallelism],
2894         [Number of jobs to run simultaneously during build. Parallel builds can
2895         save a lot of time on multi-cpu machines. Defaults to the number of
2896         CPUs on the machine, unless you configure --enable-icecream - then to
2897         40.]),
2900 AC_ARG_WITH(all-tarballs,
2901     AS_HELP_STRING([--with-all-tarballs],
2902         [Download all external tarballs unconditionally]))
2904 AC_ARG_WITH(gdrive-client-id,
2905     AS_HELP_STRING([--with-gdrive-client-id],
2906         [Provides the client id of the application for OAuth2 authentication
2907         on Google Drive. If either this or --with-gdrive-client-secret is
2908         empty, the feature will be disabled]),
2911 AC_ARG_WITH(gdrive-client-secret,
2912     AS_HELP_STRING([--with-gdrive-client-secret],
2913         [Provides the client secret of the application for OAuth2
2914         authentication on Google Drive. If either this or
2915         --with-gdrive-client-id is empty, the feature will be disabled]),
2918 AC_ARG_WITH(alfresco-cloud-client-id,
2919     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2920         [Provides the client id of the application for OAuth2 authentication
2921         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2922         empty, the feature will be disabled]),
2925 AC_ARG_WITH(alfresco-cloud-client-secret,
2926     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2927         [Provides the client secret of the application for OAuth2
2928         authentication on Alfresco Cloud. If either this or
2929         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2932 AC_ARG_WITH(onedrive-client-id,
2933     AS_HELP_STRING([--with-onedrive-client-id],
2934         [Provides the client id of the application for OAuth2 authentication
2935         on OneDrive. If either this or --with-onedrive-client-secret is
2936         empty, the feature will be disabled]),
2939 AC_ARG_WITH(onedrive-client-secret,
2940     AS_HELP_STRING([--with-onedrive-client-secret],
2941         [Provides the client secret of the application for OAuth2
2942         authentication on OneDrive. If either this or
2943         --with-onedrive-client-id is empty, the feature will be disabled]),
2946 dnl Check for coredumpctl support to present information about crashing test processes:
2947 AC_ARG_WITH(coredumpctl,
2948     AS_HELP_STRING([--with-coredumpctl],
2949         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2950         processes.]))
2952 AC_ARG_WITH(buildconfig-recorded,
2953     AS_HELP_STRING([--with-buildconfig-recorded],
2954         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2957 AC_MSG_CHECKING([whether to record build config])
2958 if test -z "$with_buildconfig_recorded"; then
2959     with_buildconfig_recorded=no
2961 if test "$with_buildconfig_recorded" = no; then
2962     AC_MSG_RESULT([no])
2963 else
2964     AC_MSG_RESULT([yes])
2965     # replace backslashes, to get a valid c++ string
2966     config_args=$(echo $ac_configure_args | tr '\\' '/')
2967     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2968     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2971 dnl ===================================================================
2972 dnl Do we want to use pre-build binary tarball for recompile
2973 dnl ===================================================================
2975 if test "$enable_library_bin_tar" = "yes" ; then
2976     USE_LIBRARY_BIN_TAR=TRUE
2977 else
2978     USE_LIBRARY_BIN_TAR=
2980 AC_SUBST(USE_LIBRARY_BIN_TAR)
2982 dnl ===================================================================
2983 dnl Test whether build target is Release Build
2984 dnl ===================================================================
2985 AC_MSG_CHECKING([whether build target is Release Build])
2986 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2987     AC_MSG_RESULT([no])
2988     ENABLE_RELEASE_BUILD=
2989     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2990     dnl the newlines and then complains about spaces.
2991     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/>'
2992 else
2993     AC_MSG_RESULT([yes])
2994     ENABLE_RELEASE_BUILD=TRUE
2995     GET_TASK_ALLOW_ENTITLEMENT=
2997 AC_SUBST(ENABLE_RELEASE_BUILD)
2998 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
3000 dnl ===================================================================
3001 dnl Test whether build should auto use hardening compiler flags
3002 dnl ===================================================================
3003 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3004 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3005     AC_MSG_RESULT([no])
3006     ENABLE_HARDENING_FLAGS=
3007 else
3008     AC_MSG_RESULT([yes])
3009     ENABLE_HARDENING_FLAGS=TRUE
3011 AC_SUBST(ENABLE_HARDENING_FLAGS)
3013 AC_MSG_CHECKING([whether to build a Community flavor])
3014 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3015     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3016     AC_MSG_RESULT([yes])
3017 else
3018     AC_MSG_RESULT([no])
3021 dnl ===================================================================
3022 dnl Test whether to sign Windows Build
3023 dnl ===================================================================
3024 AC_MSG_CHECKING([whether to sign windows build])
3025 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3026     AC_MSG_RESULT([yes])
3027     WINDOWS_BUILD_SIGNING="TRUE"
3028 else
3029     AC_MSG_RESULT([no])
3030     WINDOWS_BUILD_SIGNING="FALSE"
3032 AC_SUBST(WINDOWS_BUILD_SIGNING)
3034 dnl ===================================================================
3035 dnl MacOSX build and runtime environment options
3036 dnl ===================================================================
3038 AC_ARG_WITH(macosx-version-min-required,
3039     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3040         [set the minimum OS version needed to run the built LibreOffice])
3041     [
3042                           e. g.: --with-macosx-version-min-required=10.15
3043     ],
3046 dnl ===================================================================
3047 dnl Check for incompatible options set by fuzzing, and reset those
3048 dnl automatically to working combinations
3049 dnl ===================================================================
3051 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3052         "$enable_dbus" != "$enable_avahi"; then
3053     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3054     enable_avahi=$enable_dbus
3057 add_lopath_after ()
3059     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3060         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3061     fi
3064 add_lopath_before ()
3066     local IFS=${P_SEP}
3067     local path_cleanup
3068     local dir
3069     for dir in $LO_PATH ; do
3070         if test "$dir" != "$1" ; then
3071             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3072         fi
3073     done
3074     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3077 dnl ===================================================================
3078 dnl check for required programs (grep, awk, sed, bash)
3079 dnl ===================================================================
3081 pathmunge ()
3083     local new_path
3084     if test -n "$1"; then
3085         if test "$build_os" = "cygwin"; then
3086             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3087                 PathFormat "$1"
3088                 new_path=`cygpath -sm "$formatted_path"`
3089             else
3090                 PathFormat "$1"
3091                 new_path=`cygpath -u "$formatted_path"`
3092             fi
3093         else
3094             new_path="$1"
3095         fi
3096         if test "$2" = "after"; then
3097             add_lopath_after "$new_path"
3098         else
3099             add_lopath_before "$new_path"
3100         fi
3101     fi
3104 AC_PROG_AWK
3105 AC_PATH_PROG( AWK, $AWK)
3106 if test -z "$AWK"; then
3107     AC_MSG_ERROR([install awk to run this script])
3110 AC_PATH_PROG(BASH, bash)
3111 if test -z "$BASH"; then
3112     AC_MSG_ERROR([bash not found in \$PATH])
3114 AC_SUBST(BASH)
3116 # prefer parallel compression tools, if available
3117 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3118 if test -z "$COMPRESSIONTOOL"; then
3119     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3120     if test -z "$COMPRESSIONTOOL"; then
3121         AC_MSG_ERROR([gzip not found in \$PATH])
3122     fi
3124 AC_SUBST(COMPRESSIONTOOL)
3126 AC_MSG_CHECKING([for GNU or BSD tar])
3127 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3128     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3129     if test $? -eq 0;  then
3130         GNUTAR=$a
3131         break
3132     fi
3133 done
3134 AC_MSG_RESULT($GNUTAR)
3135 if test -z "$GNUTAR"; then
3136     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3138 AC_SUBST(GNUTAR)
3140 AC_MSG_CHECKING([for tar's option to strip components])
3141 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3142 if test $? -eq 0; then
3143     STRIP_COMPONENTS="--strip-components"
3144 else
3145     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3146     if test $? -eq 0; then
3147         STRIP_COMPONENTS="--strip-path"
3148     else
3149         STRIP_COMPONENTS="unsupported"
3150     fi
3152 AC_MSG_RESULT($STRIP_COMPONENTS)
3153 if test x$STRIP_COMPONENTS = xunsupported; then
3154     AC_MSG_ERROR([you need a tar that is able to strip components.])
3156 AC_SUBST(STRIP_COMPONENTS)
3158 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3159 dnl desktop OSes from "mobile" ones.
3161 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3162 dnl In other words, that when building for an OS that is not a
3163 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3165 dnl Note the direction of the implication; there is no assumption that
3166 dnl cross-compiling would imply a non-desktop OS.
3168 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3169     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3170     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3171     if test "$_os" != Emscripten; then
3172         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3173     fi
3176 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3177 # also work with the default gtk3 plugin.
3178 if test "$enable_wasm_strip" = "yes"; then
3179     enable_avmedia=no
3180     enable_libcmis=no
3181     enable_coinmp=no
3182     enable_cups=no
3183     test "$_os" = Emscripten && enable_curl=no
3184     enable_database_connectivity=no
3185     enable_dbus=no
3186     enable_dconf=no
3187     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3188     enable_extension_integration=no
3189     enable_extensions=no
3190     enable_extension_update=no
3191     enable_gio=no
3192     enable_gpgmepp=no
3193     enable_ldap=no
3194     enable_lotuswordpro=no
3195     enable_lpsolve=no
3196     enable_nss=no
3197     enable_odk=no
3198     enable_online_update=no
3199     enable_opencl=no
3200     enable_pdfimport=no
3201     enable_randr=no
3202     enable_report_builder=no
3203     enable_scripting=no
3204     enable_sdremote_bluetooth=no
3205     enable_skia=no
3206     enable_xmlhelp=no
3207     enable_zxing=no
3208     test_libepubgen=no
3209     test_libcdr=no
3210     test_libcmis=no
3211     test_libetonyek=no
3212     test_libfreehand=no
3213     test_libmspub=no
3214     test_libpagemaker=no
3215     test_libqxp=no
3216     test_libvisio=no
3217     test_libzmf=no
3218     test_webdav=no
3219     with_galleries=no
3220     with_templates=no
3221     with_webdav=no
3222     with_x=no
3224     test "${with_fonts+set}" = set || with_fonts=yes
3225     test "${with_locales+set}" = set || with_locales=en
3227     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3228     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3229     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3230     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3231 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3232     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3233     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3234     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3235     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3236 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3237     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3238     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3239     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3240     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3241     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3242     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3243     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3244     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3247 EMSCRIPTEN_NEH_MAJOR=3
3248 EMSCRIPTEN_NEH_MINOR=1
3249 EMSCRIPTEN_NEH_TINY=3
3250 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3252 if test "$enable_wasm_exceptions" = yes; then
3253     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3254     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3255     if test $? -ne 0; then
3256         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3257     else
3258         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3259     fi
3260     ENABLE_WASM_EXCEPTIONS=TRUE
3262 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3264 # Whether to build "avmedia" functionality or not.
3266 if test "$enable_avmedia" = yes; then
3267     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3268     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3269 else
3270     test_gstreamer_1_0=no
3273 # Decide whether to build database connectivity stuff (including Base) or not.
3274 if test "$enable_database_connectivity" != no; then
3275     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3276     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3277 else
3278     if test "$_os" = iOS; then
3279         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3280     fi
3281     disable_database_connectivity_dependencies
3284 if test -z "$enable_extensions"; then
3285     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3286     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3287         enable_extensions=yes
3288     fi
3291 DISABLE_SCRIPTING=''
3292 if test "$enable_scripting" = yes; then
3293     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3294     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3295 else
3296     DISABLE_SCRIPTING='TRUE'
3297     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3300 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3301     # Disable dynamic_loading always for iOS and Android
3302     enable_dynamic_loading=no
3303 elif test -z "$enable_dynamic_loading"; then
3304     # Otherwise enable it unless specifically disabled
3305     enable_dynamic_loading=yes
3308 DISABLE_DYNLOADING=''
3309 if test "$enable_dynamic_loading" = yes; then
3310     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3311 else
3312     DISABLE_DYNLOADING='TRUE'
3313     if test $_os != iOS -a $_os != Android; then
3314         enable_database_connectivity=no
3315         enable_nss=no
3316         enable_odk=no
3317         enable_python=no
3318         enable_skia=no
3319         with_java=no
3320     fi
3322 AC_SUBST(DISABLE_DYNLOADING)
3324 ENABLE_CUSTOMTARGET_COMPONENTS=
3325 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3326     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3327     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3328         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3329     fi
3331 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3333 if test "$enable_extensions" = yes; then
3334     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3335     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3336 else
3337     enable_extension_integration=no
3338     enable_extension_update=no
3341 # remember SYSBASE value
3342 AC_SUBST(SYSBASE)
3344 dnl ===================================================================
3345 dnl  Sort out various gallery compilation options
3346 dnl ===================================================================
3347 WITH_GALLERY_BUILD=TRUE
3348 AC_MSG_CHECKING([how to build and package galleries])
3349 if test -n "${with_galleries}"; then
3350     if test "$with_galleries" = "build"; then
3351         if test "$enable_database_connectivity" = no; then
3352             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3353         fi
3354         AC_MSG_RESULT([build from source images internally])
3355     elif test "$with_galleries" = "no"; then
3356         WITH_GALLERY_BUILD=
3357         AC_MSG_RESULT([disable non-internal gallery build])
3358     else
3359         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3360     fi
3361 else
3362     if test $_os != iOS -a $_os != Android; then
3363         AC_MSG_RESULT([internal src images for desktop])
3364     else
3365         WITH_GALLERY_BUILD=
3366         AC_MSG_RESULT([disable src image build])
3367     fi
3369 AC_SUBST(WITH_GALLERY_BUILD)
3371 dnl ===================================================================
3372 dnl  Sort out various templates compilation options
3373 dnl ===================================================================
3374 WITH_TEMPLATES=TRUE
3375 AC_MSG_CHECKING([build with or without template files])
3376 if test -n "${with_templates}"; then
3377     if test "$with_templates" = "yes"; then
3378         AC_MSG_RESULT([enable all templates])
3379     elif test "$with_templates" = "no"; then
3380         WITH_TEMPLATES=
3381         AC_MSG_RESULT([disable non-internal templates])
3382     else
3383         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3384     fi
3385 else
3386     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3387         AC_MSG_RESULT([enable all templates])
3388     else
3389         WITH_TEMPLATES=
3390         AC_MSG_RESULT([disable non-internal templates])
3391     fi
3393 AC_SUBST(WITH_TEMPLATES)
3395 dnl ===================================================================
3396 dnl  Checks if ccache is available
3397 dnl ===================================================================
3398 CCACHE_DEPEND_MODE=
3399 if test "$enable_ccache" = "no"; then
3400     CCACHE=""
3401 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3402     case "%$CC%$CXX%" in
3403     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3404     # assume that's good then
3405     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3406         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3407         CCACHE_DEPEND_MODE=1
3408         ;;
3409     *)
3410         # try to use our own ccache if it is available and CCACHE was not already defined
3411         if test -z "$CCACHE"; then
3412             if test "$_os" = "WINNT"; then
3413                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3414             fi
3415             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3416                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3417             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3418                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3419             fi
3420         fi
3421         AC_PATH_PROG([CCACHE],[ccache],[not found])
3422         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3423             CCACHE=`win_short_path_for_make "$CCACHE"`
3424             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3425             rm -f conftest.txt
3426             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3427             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3428             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3429                 AC_MSG_RESULT(yes)
3430             else
3431                 AC_MSG_RESULT(no)
3432                 CCACHE="not found"
3433             fi
3434             rm -f conftest.txt
3435         fi
3436         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3437             # on windows/VC perhaps sccache is around?
3438             case "%$CC%$CXX%" in
3439             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3440             # assume that's good then
3441             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3442                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3443                 CCACHE_DEPEND_MODE=1
3444                 SCCACHE=1
3445                 ;;
3446             *)
3447                 # for sharing code below, reuse CCACHE env var
3448                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3449                 if test "$CCACHE" != "not found"; then
3450                     CCACHE=`win_short_path_for_make "$CCACHE"`
3451                     SCCACHE=1
3452                     CCACHE_DEPEND_MODE=1
3453                 fi
3454                 ;;
3455             esac
3456         fi
3457         if test "$CCACHE" = "not found"; then
3458             CCACHE=""
3459         fi
3460         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3461             CCACHE_DEPEND_MODE=1
3462             # Need to check for ccache version: otherwise prevents
3463             # caching of the results (like "-x objective-c++" for Mac)
3464             if test $_os = Darwin -o $_os = iOS; then
3465                 # Check ccache version
3466                 AC_MSG_CHECKING([whether version of ccache is suitable])
3467                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3468                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3469                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3470                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3471                 else
3472                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3473                     CCACHE=""
3474                     CCACHE_DEPEND_MODE=
3475                 fi
3476             fi
3477         fi
3478         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3479             AC_MSG_ERROR([No suitable ccache found])
3480         fi
3481         ;;
3482     esac
3483 else
3484     CCACHE=""
3486 if test "$enable_ccache" = "nodepend"; then
3487     CCACHE_DEPEND_MODE=""
3489 AC_SUBST(CCACHE_DEPEND_MODE)
3491 # sccache defaults are good enough
3492 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3493     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3494     # or (...) max_size = 20.0 G
3495     # -p works with both 4.2 and 4.4
3496     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3497     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3498     if test "$ccache_size" = ""; then
3499         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3500         if test "$ccache_size" = ""; then
3501             ccache_size=0
3502         fi
3503         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3504         if test $ccache_size -lt 1024; then
3505             CCACHE=""
3506             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3507             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3508         else
3509             # warn that ccache may be too small for debug build
3510             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3511             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3512         fi
3513     else
3514         if test $ccache_size -lt 5; then
3515             #warn that ccache may be too small for debug build
3516             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3517             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3518         fi
3519     fi
3522 ENABLE_Z7_DEBUG=
3523 if test "$enable_z7_debug" != no; then
3524     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3525         ENABLE_Z7_DEBUG=TRUE
3526     fi
3527 else
3528     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3529     add_warning "ccache will not work with --disable-z7-debug"
3531 AC_SUBST(ENABLE_Z7_DEBUG)
3533 dnl ===================================================================
3534 dnl  Checks for C compiler,
3535 dnl  The check for the C++ compiler is later on.
3536 dnl ===================================================================
3537 if test "$_os" != "WINNT"; then
3538     GCC_HOME_SET="true"
3539     AC_MSG_CHECKING([gcc home])
3540     if test -z "$with_gcc_home"; then
3541         if test "$enable_icecream" = "yes"; then
3542             if test -d "/usr/lib/icecc/bin"; then
3543                 GCC_HOME="/usr/lib/icecc/"
3544             elif test -d "/usr/libexec/icecc/bin"; then
3545                 GCC_HOME="/usr/libexec/icecc/"
3546             elif test -d "/opt/icecream/bin"; then
3547                 GCC_HOME="/opt/icecream/"
3548             else
3549                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3551             fi
3552         else
3553             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3554             GCC_HOME_SET="false"
3555         fi
3556     else
3557         GCC_HOME="$with_gcc_home"
3558     fi
3559     AC_MSG_RESULT($GCC_HOME)
3560     AC_SUBST(GCC_HOME)
3562     if test "$GCC_HOME_SET" = "true"; then
3563         if test -z "$CC"; then
3564             CC="$GCC_HOME/bin/gcc"
3565             CC_BASE="gcc"
3566         fi
3567         if test -z "$CXX"; then
3568             CXX="$GCC_HOME/bin/g++"
3569             CXX_BASE="g++"
3570         fi
3571     fi
3574 COMPATH=`dirname "$CC"`
3575 if test "$COMPATH" = "."; then
3576     AC_PATH_PROGS(COMPATH, $CC)
3577     dnl double square bracket to get single because of M4 quote...
3578     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3580 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3582 dnl ===================================================================
3583 dnl Java support
3584 dnl ===================================================================
3585 AC_MSG_CHECKING([whether to build with Java support])
3586 javacompiler="javac"
3587 javadoc="javadoc"
3588 if test "$with_java" != "no"; then
3589     if test "$DISABLE_SCRIPTING" = TRUE; then
3590         AC_MSG_RESULT([no, overridden by --disable-scripting])
3591         ENABLE_JAVA=""
3592         with_java=no
3593     else
3594         AC_MSG_RESULT([yes])
3595         ENABLE_JAVA="TRUE"
3596         AC_DEFINE(HAVE_FEATURE_JAVA)
3597     fi
3598 else
3599     AC_MSG_RESULT([no])
3600     ENABLE_JAVA=""
3603 AC_SUBST(ENABLE_JAVA)
3605 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3607 dnl ENABLE_JAVA="" indicate no Java support at all
3609 dnl ===================================================================
3610 dnl Check macOS SDK and compiler
3611 dnl ===================================================================
3613 if test $_os = Darwin; then
3615     # The SDK in the currently selected Xcode should be found.
3617     AC_MSG_CHECKING([what macOS SDK to use])
3618     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3619     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3620     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3621     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3622     # problems that existed in the PPC days with target versions not being respected or random
3623     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3624     # SDK version is enough, no need to do both...
3625     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3626     if test ! -d "$MACOSX_SDK_PATH"; then
3627         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3628     fi
3629     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3630     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3631     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3632     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3633     # 10.10.2 is 101002
3634     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3635     # correct version in case such an old SDK is specified, it will be rejected later anyway
3636     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3637     if test $MACOSX_SDK_VERSION -lt 101500; then
3638         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3639     fi
3640     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3641         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3642     fi
3643     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3645     AC_MSG_CHECKING([what minimum version of macOS to require])
3646     if test "$with_macosx_version_min_required" = "" ; then
3647         if test "$host_cpu" = x86_64; then
3648             with_macosx_version_min_required="10.15";
3649         else
3650             with_macosx_version_min_required="11.0";
3651         fi
3652     fi
3653     # see same notes about MACOSX_SDK_VERSION above
3654     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3655     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3656         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3657     fi
3658     AC_MSG_RESULT([$with_macosx_version_min_required])
3660     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3661     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3662         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3663     else
3664         AC_MSG_RESULT([yes])
3665     fi
3667     # export this so that "xcrun" invocations later return matching values
3668     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3669     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3670     export DEVELOPER_DIR
3671     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3672     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3674     AC_MSG_CHECKING([whether Xcode is new enough])
3675     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3676     my_xcode_ver2=${my_xcode_ver1#Xcode }
3677     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3678     if test "$my_xcode_ver3" -ge 1205; then
3679         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3680         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3681             if test "$my_xcode_ver3" -ge 1600; then
3682                 dnl the Xcode 15 relnotes state that the classic linker will disappear in the next version, but nothing about
3683                 dnl fixing the problem with weak symbols/macOS 11 compatibility, so assume for now that Xcode 16 will break it...
3684                 AC_MSG_ERROR([Check that Xcode 16 still supports the old linker/that it doesn't break macOS 11 compatibility, then remove this check]);
3685             fi
3686             if test "$my_xcode_ver3" -ge 1500; then
3687                 AC_MSG_WARN([Xcode 15 has a new linker that causes runtime crashes on macOS 11])
3688                 add_warning "Xcode 15 has a new linker that causes runtime crashes on macOS 11, forcing the old linker."
3689                 add_warning "see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking"
3690                 LDFLAGS="$LDFLAGS -Wl,-ld_classic"
3691                 # if LDFLAGS weren't set already, a check above sets x_LDFLAGS=[#] to comment-out the export LDFLAGS line in config_host.mk
3692                 x_LDFLAGS=
3693             fi
3694         fi
3695     else
3696         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3697     fi
3699     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3700     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3702     LIBTOOL=/usr/bin/libtool
3703     INSTALL_NAME_TOOL=install_name_tool
3704     if test -z "$save_CC"; then
3705         stdlib=-stdlib=libc++
3707         AC_MSG_CHECKING([what C compiler to use])
3708         CC="`xcrun -find clang`"
3709         CC_BASE=`first_arg_basename "$CC"`
3710         if test "$host_cpu" = x86_64; then
3711             CC+=" -target x86_64-apple-macos"
3712         else
3713             CC+=" -target arm64-apple-macos"
3714         fi
3715         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3716         AC_MSG_RESULT([$CC])
3718         AC_MSG_CHECKING([what C++ compiler to use])
3719         CXX="`xcrun -find clang++`"
3720         CXX_BASE=`first_arg_basename "$CXX"`
3721         if test "$host_cpu" = x86_64; then
3722             CXX+=" -target x86_64-apple-macos"
3723         else
3724             CXX+=" -target arm64-apple-macos"
3725         fi
3726         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3727         AC_MSG_RESULT([$CXX])
3729         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3730         AR=`xcrun -find ar`
3731         NM=`xcrun -find nm`
3732         STRIP=`xcrun -find strip`
3733         LIBTOOL=`xcrun -find libtool`
3734         RANLIB=`xcrun -find ranlib`
3735     fi
3737     AC_MSG_CHECKING([whether to do code signing])
3739     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3740         AC_MSG_RESULT([no])
3741     else
3742         if test "$enable_macosx_code_signing" = yes; then
3743             # By default use the first suitable certificate (?).
3745             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3746             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3747             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3748             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3749             # "Developer ID Application" one.
3750             identity="Developer ID Application:"
3751         else
3752             identity=$enable_macosx_code_signing
3753         fi
3754         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3755         if test -n "$identity"; then
3756             MACOSX_CODESIGNING_IDENTITY=$identity
3757             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3758             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3759         else
3760             AC_MSG_ERROR([cannot determine identity to use])
3761         fi
3762     fi
3764     AC_MSG_CHECKING([whether to create a Mac App Store package])
3766     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3767         AC_MSG_RESULT([no])
3768     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3769         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3770     else
3771         if test "$enable_macosx_package_signing" = yes; then
3772             # By default use the first suitable certificate.
3773             # It should be a "3rd Party Mac Developer Installer" one
3774             identity="3rd Party Mac Developer Installer:"
3775         else
3776             identity=$enable_macosx_package_signing
3777         fi
3778         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3779         if test -n "$identity"; then
3780             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3781             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3782             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3783         else
3784             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3785         fi
3786     fi
3788     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3789         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3790     fi
3792     AC_MSG_CHECKING([whether to sandbox the application])
3794     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3795         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3796     elif test "$enable_macosx_sandbox" = yes; then
3797         ENABLE_MACOSX_SANDBOX=TRUE
3798         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3799         AC_MSG_RESULT([yes])
3800     else
3801         AC_MSG_RESULT([no])
3802     fi
3804     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3805     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3806     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3808     if test -n "$with_macosx_provisioning_profile" ; then
3809         if test ! -f "$with_macosx_provisioning_profile"; then
3810             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3811         else
3812             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3813             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3814                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3815                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3816                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3817         fi
3818     fi
3820 AC_SUBST(MACOSX_SDK_PATH)
3821 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3822 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3823 AC_SUBST(INSTALL_NAME_TOOL)
3824 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3825 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3826 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3827 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3828 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3829 AC_SUBST(MACOSX_PROVISIONING_INFO)
3830 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3831 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3832 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3834 dnl ===================================================================
3835 dnl Check iOS SDK and compiler
3836 dnl ===================================================================
3838 if test $_os = iOS; then
3839     AC_MSG_CHECKING([what iOS SDK to use])
3841     if test "$enable_ios_simulator" = "yes"; then
3842         platformlc=iphonesimulator
3843         versionmin=-mios-simulator-version-min=14.5
3844     else
3845         platformlc=iphoneos
3846         versionmin=-miphoneos-version-min=14.5
3847     fi
3849     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3851     if ! test -d "$sysroot"; then
3852         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3853     fi
3855     AC_MSG_RESULT($sysroot)
3857     stdlib="-stdlib=libc++"
3859     AC_MSG_CHECKING([what C compiler to use])
3860     CC="`xcrun -find clang`"
3861     CC_BASE=`first_arg_basename "$CC"`
3862     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3863     AC_MSG_RESULT([$CC])
3865     AC_MSG_CHECKING([what C++ compiler to use])
3866     CXX="`xcrun -find clang++`"
3867     CXX_BASE=`first_arg_basename "$CXX"`
3868     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3869     AC_MSG_RESULT([$CXX])
3871     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3872     AR=`xcrun -find ar`
3873     NM=`xcrun -find nm`
3874     STRIP=`xcrun -find strip`
3875     LIBTOOL=`xcrun -find libtool`
3876     RANLIB=`xcrun -find ranlib`
3879 AC_MSG_CHECKING([whether to treat the installation as read-only])
3881 if test $_os = Darwin; then
3882     enable_readonly_installset=yes
3883 elif test "$enable_extensions" != yes; then
3884     enable_readonly_installset=yes
3886 if test "$enable_readonly_installset" = yes; then
3887     AC_MSG_RESULT([yes])
3888     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3889 else
3890     AC_MSG_RESULT([no])
3893 dnl ===================================================================
3894 dnl Structure of install set
3895 dnl ===================================================================
3897 if test $_os = Darwin; then
3898     LIBO_BIN_FOLDER=MacOS
3899     LIBO_ETC_FOLDER=Resources
3900     LIBO_LIBEXEC_FOLDER=MacOS
3901     LIBO_LIB_FOLDER=Frameworks
3902     LIBO_LIB_PYUNO_FOLDER=Resources
3903     LIBO_SHARE_FOLDER=Resources
3904     LIBO_SHARE_HELP_FOLDER=Resources/help
3905     LIBO_SHARE_JAVA_FOLDER=Resources/java
3906     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3907     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3908     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3909     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3910     LIBO_URE_BIN_FOLDER=MacOS
3911     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3912     LIBO_URE_LIB_FOLDER=Frameworks
3913     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3914     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3915 elif test $_os = WINNT; then
3916     LIBO_BIN_FOLDER=program
3917     LIBO_ETC_FOLDER=program
3918     LIBO_LIBEXEC_FOLDER=program
3919     LIBO_LIB_FOLDER=program
3920     LIBO_LIB_PYUNO_FOLDER=program
3921     LIBO_SHARE_FOLDER=share
3922     LIBO_SHARE_HELP_FOLDER=help
3923     LIBO_SHARE_JAVA_FOLDER=program/classes
3924     LIBO_SHARE_PRESETS_FOLDER=presets
3925     LIBO_SHARE_READMES_FOLDER=readmes
3926     LIBO_SHARE_RESOURCE_FOLDER=program/resource
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
3933 else
3934     LIBO_BIN_FOLDER=program
3935     LIBO_ETC_FOLDER=program
3936     LIBO_LIBEXEC_FOLDER=program
3937     LIBO_LIB_FOLDER=program
3938     LIBO_LIB_PYUNO_FOLDER=program
3939     LIBO_SHARE_FOLDER=share
3940     LIBO_SHARE_HELP_FOLDER=help
3941     LIBO_SHARE_JAVA_FOLDER=program/classes
3942     LIBO_SHARE_PRESETS_FOLDER=presets
3943     LIBO_SHARE_READMES_FOLDER=readmes
3944     if test "$enable_fuzzers" != yes; then
3945         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3946     else
3947         LIBO_SHARE_RESOURCE_FOLDER=resource
3948     fi
3949     LIBO_SHARE_SHELL_FOLDER=program/shell
3950     LIBO_URE_BIN_FOLDER=program
3951     LIBO_URE_ETC_FOLDER=program
3952     LIBO_URE_LIB_FOLDER=program
3953     LIBO_URE_MISC_FOLDER=program
3954     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3956 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3957 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3958 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3959 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3960 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3961 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3962 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3963 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3964 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3965 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3966 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3967 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3968 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3969 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3970 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3971 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3973 # Not all of them needed in config_host.mk, add more if need arises
3974 AC_SUBST(LIBO_BIN_FOLDER)
3975 AC_SUBST(LIBO_ETC_FOLDER)
3976 AC_SUBST(LIBO_LIB_FOLDER)
3977 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3978 AC_SUBST(LIBO_SHARE_FOLDER)
3979 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3980 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3981 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3982 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3983 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3984 AC_SUBST(LIBO_URE_BIN_FOLDER)
3985 AC_SUBST(LIBO_URE_ETC_FOLDER)
3986 AC_SUBST(LIBO_URE_LIB_FOLDER)
3987 AC_SUBST(LIBO_URE_MISC_FOLDER)
3988 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3990 dnl ===================================================================
3991 dnl Windows specific tests and stuff
3992 dnl ===================================================================
3994 reg_get_value()
3996     # Return value: $regvalue
3997     unset regvalue
3999     if test "$build_os" = "wsl"; then
4000         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
4001         return
4002     elif test -n "$WSL_ONLY_AS_HELPER"; then
4003         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
4004         return
4005     fi
4007     local _regentry="/proc/registry${1}/${2}/${3}"
4008     if test -f "$_regentry"; then
4009         # Stop bash complaining about \0 bytes in input, as it can't handle them.
4010         # Registry keys read via /proc/registry* are always \0 terminated!
4011         local _regvalue=$(tr -d '\0' < "$_regentry")
4012         if test $? -eq 0; then
4013             regvalue=$_regvalue
4014         fi
4015     fi
4018 # Get a value from the 32-bit side of the Registry
4019 reg_get_value_32()
4021     reg_get_value "32" "$1" "$2"
4024 # Get a value from the 64-bit side of the Registry
4025 reg_get_value_64()
4027     reg_get_value "64" "$1" "$2"
4030 reg_list_values()
4032     # Return value: $reglist
4033     unset reglist
4035     if test "$build_os" = "wsl"; then
4036         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4037         return
4038     fi
4040     reglist=$(ls "/proc/registry${1}/${2}")
4043 # List values from the 32-bit side of the Registry
4044 reg_list_values_32()
4046     reg_list_values "32" "$1"
4049 # List values from the 64-bit side of the Registry
4050 reg_list_values_64()
4052     reg_list_values "64" "$1"
4055 case "$host_os" in
4056 cygwin*|wsl*)
4057     COM=MSC
4058     OS=WNT
4059     RTL_OS=Windows
4060     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4061         P_SEP=";"
4062     else
4063         P_SEP=:
4064     fi
4065     case "$host_cpu" in
4066     x86_64)
4067         CPUNAME=X86_64
4068         RTL_ARCH=X86_64
4069         PLATFORMID=windows_x86_64
4070         WINDOWS_X64=1
4071         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4072         WIN_HOST_ARCH="x64"
4073         WIN_MULTI_ARCH="x86"
4074         WIN_HOST_BITS=64
4075         ;;
4076     i*86)
4077         CPUNAME=INTEL
4078         RTL_ARCH=x86
4079         PLATFORMID=windows_x86
4080         WIN_HOST_ARCH="x86"
4081         WIN_HOST_BITS=32
4082         WIN_OTHER_ARCH="x64"
4083         ;;
4084     aarch64)
4085         CPUNAME=AARCH64
4086         RTL_ARCH=AARCH64
4087         PLATFORMID=windows_aarch64
4088         WINDOWS_X64=1
4089         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4090         WIN_HOST_ARCH="arm64"
4091         WIN_HOST_BITS=64
4092         with_ucrt_dir=no
4093         ;;
4094     *)
4095         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4096         ;;
4097     esac
4099     case "$build_cpu" in
4100     x86_64) WIN_BUILD_ARCH="x64" ;;
4101     i*86) WIN_BUILD_ARCH="x86" ;;
4102     aarch64) WIN_BUILD_ARCH="arm64" ;;
4103     *)
4104         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4105         ;;
4106     esac
4108     SCPDEFS="$SCPDEFS -D_MSC_VER"
4109     ;;
4110 esac
4112 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4113 # other-arch won't, but wouldn't break the build (x64 on x86).
4114 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4115     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4119 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4120     # To allow building Windows multi-arch releases without cross-tooling
4121     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4122         cross_compiling="yes"
4123     fi
4126 if test "$cross_compiling" = "yes"; then
4127     export CROSS_COMPILING=TRUE
4128     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4129         ENABLE_WASM_STRIP=TRUE
4130     fi
4131     if test "$_os" = "Emscripten"; then
4132         if test "$with_main_module" = "calc"; then
4133             ENABLE_WASM_STRIP_WRITER=TRUE
4134         elif test "$with_main_module" = "writer"; then
4135             ENABLE_WASM_STRIP_CALC=TRUE
4136         fi
4137     fi
4138 else
4139     CROSS_COMPILING=
4140     BUILD_TYPE="$BUILD_TYPE NATIVE"
4142 AC_SUBST(CROSS_COMPILING)
4143 AC_SUBST(ENABLE_WASM_STRIP)
4144 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4145 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4147 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4148 # NOTE: must _not_ be used for bundled external libraries!
4149 ISYSTEM=
4150 if test "$GCC" = "yes"; then
4151     AC_MSG_CHECKING( for -isystem )
4152     save_CFLAGS=$CFLAGS
4153     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4154     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4155     CFLAGS=$save_CFLAGS
4156     if test -n "$ISYSTEM"; then
4157         AC_MSG_RESULT(yes)
4158     else
4159         AC_MSG_RESULT(no)
4160     fi
4162 if test -z "$ISYSTEM"; then
4163     # fall back to using -I
4164     ISYSTEM=-I
4166 AC_SUBST(ISYSTEM)
4168 dnl ===================================================================
4169 dnl  Check which Visual Studio compiler is used
4170 dnl ===================================================================
4172 map_vs_year_to_version()
4174     # Return value: $vsversion
4176     unset vsversion
4178     case $1 in
4179     2019)
4180         vsversion=16;;
4181     2022)
4182         vsversion=17;;
4183     2022preview)
4184         vsversion=17.10;;
4185     *)
4186         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4187     esac
4190 vs_versions_to_check()
4192     # Args: $1 (optional) : versions to check, in the order of preference
4193     # Return value: $vsversions
4195     unset vsversions
4197     if test -n "$1"; then
4198         map_vs_year_to_version "$1"
4199         vsversions=$vsversion
4200     else
4201         # Default version is 2019
4202         vsversions="16"
4203     fi
4206 win_get_env_from_vsdevcmdbat()
4208     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4209     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4210     PathFormat "$VC_PRODUCT_DIR"
4211     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4212     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4213     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4214     local result
4215     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4216         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4217     else
4218         chmod +x $WRAPPERBATCHFILEPATH
4219         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4220     fi
4221     rm -f $WRAPPERBATCHFILEPATH
4222     printf '%s' "$result"
4225 find_ucrt()
4227     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4228     if test -n "$regvalue"; then
4229         PathFormat "$regvalue"
4230         UCRTSDKDIR=$formatted_path_unix
4231         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4232         if test -n "$regvalue"; then
4233             UCRTVERSION="$regvalue".0
4234         fi
4236         # Rest if not exist
4237         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4238           UCRTSDKDIR=
4239         fi
4240     fi
4241     if test -z "$UCRTSDKDIR"; then
4242         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4243         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4244         if test -f "$ide_env_file"; then
4245             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4246             UCRTSDKDIR=$formatted_path_unix
4247             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4248             dnl Hack needed at least by tml:
4249             if test "$UCRTVERSION" = 10.0.15063.0 \
4250                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4251                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4252             then
4253                 UCRTVERSION=10.0.14393.0
4254             fi
4255         else
4256           AC_MSG_ERROR([No UCRT found])
4257         fi
4258     fi
4261 find_msvc()
4263     # Find Visual C++
4264     # Args: $1 (optional) : The VS version year
4265     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4267     unset vctest vctoolset vcnumwithdot vcbuildnumber
4269     vs_versions_to_check "$1"
4270     if test "$build_os" = wsl; then
4271         vswhere="$PROGRAMFILESX86"
4272         if test -z "$vswhere"; then
4273             vswhere="c:\\Program Files (x86)"
4274         fi
4275     elif test -n "$WSL_ONLY_AS_HELPER"; then
4276         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4277     else
4278         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4279     fi
4280     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4281     PathFormat "$vswhere"
4282     vswhere=$formatted_path_unix
4283     for ver in $vsversions; do
4284         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4285         if test -z "$vswhereoutput"; then
4286             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4287         fi
4288         # Fall back to all MS products (this includes VC++ Build Tools)
4289         if ! test -n "$vswhereoutput"; then
4290             AC_MSG_CHECKING([VC++ Build Tools and similar])
4291             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4292         fi
4293         if test -n "$vswhereoutput"; then
4294             PathFormat "$vswhereoutput"
4295             vctest=$formatted_path_unix
4296             break
4297         fi
4298     done
4300     if test -n "$vctest"; then
4301         vcnumwithdot="$ver"
4302         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4303             vcnumwithdot=$vcnumwithdot.0
4304         fi
4305         case "$vcnumwithdot" in
4306         16.0)
4307             vcyear=2019
4308             vctoolset=v142
4309             ;;
4310         17.0 | 17.10)
4311             vcyear=2022
4312             vctoolset=v143
4313             ;;
4314         esac
4315         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4317     fi
4320 test_cl_exe()
4322     AC_MSG_CHECKING([$1 compiler])
4324     CL_EXE_PATH="$2/cl.exe"
4326     if test ! -f "$CL_EXE_PATH"; then
4327         if test "$1" = "multi-arch"; then
4328             AC_MSG_WARN([no compiler (cl.exe) in $2])
4329             return 1
4330         else
4331             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4332         fi
4333     fi
4335     dnl ===========================================================
4336     dnl  Check for the corresponding mspdb*.dll
4337     dnl ===========================================================
4339     # MSVC 15.0 has libraries from 14.0?
4340     mspdbnum="140"
4342     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4343         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4344     fi
4346     # The compiles has to find its shared libraries
4347     OLD_PATH="$PATH"
4348     TEMP_PATH=`cygpath -d "$2"`
4349     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4351     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4352         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4353     fi
4355     PATH="$OLD_PATH"
4357     AC_MSG_RESULT([$CL_EXE_PATH])
4360 SOLARINC=
4361 MSBUILD_PATH=
4362 DEVENV=
4363 if test "$_os" = "WINNT"; then
4364     AC_MSG_CHECKING([Visual C++])
4365     find_msvc "$with_visual_studio"
4366     if test -z "$vctest"; then
4367         if test -n "$with_visual_studio"; then
4368             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4369         else
4370             AC_MSG_ERROR([no Visual Studio installation found])
4371         fi
4372     fi
4373     AC_MSG_RESULT([])
4375     VC_PRODUCT_DIR="$vctest/VC"
4376     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4378     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4379     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4380         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4381         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4382         if test $? -ne 0; then
4383             WIN_MULTI_ARCH=""
4384             WIN_OTHER_ARCH=""
4385         fi
4386     fi
4388     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4389         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4390         test_cl_exe "build" "$MSVC_BUILD_PATH"
4391     fi
4393     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4394         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4395         test_cl_exe "host" "$MSVC_HOST_PATH"
4396     else
4397         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4398     fi
4400     AC_MSG_CHECKING([for short pathname of VC product directory])
4401     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4402     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4404     UCRTSDKDIR=
4405     UCRTVERSION=
4407     AC_MSG_CHECKING([for UCRT location])
4408     find_ucrt
4409     # find_ucrt errors out if it doesn't find it
4410     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4411     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4412     ucrtincpath_formatted=$formatted_path
4413     # SOLARINC is used for external modules and must be set too.
4414     # And no, it's not sufficient to set SOLARINC only, as configure
4415     # itself doesn't honour it.
4416     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4417     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4418     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4419     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4421     AC_SUBST(UCRTSDKDIR)
4422     AC_SUBST(UCRTVERSION)
4424     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4425     # Find the proper version of MSBuild.exe to use based on the VS version
4426     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4427     if test -z "$regvalue" ; then
4428         if test "$WIN_BUILD_ARCH" != "x64"; then
4429             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4430         else
4431             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4432         fi
4433     fi
4434     if test -d "$regvalue" ; then
4435         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4436         AC_MSG_RESULT([$regvalue])
4437     else
4438         AC_MSG_ERROR([MSBuild.exe location not found])
4439     fi
4441     # Find the version of devenv.exe
4442     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4443     DEVENV="$formatted_path"
4444     DEVENV_unix="$formatted_path_unix"
4445     if test ! -e "$DEVENV_unix"; then
4446         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4447     fi
4449     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4450     dnl needed when building CLR code:
4451     if test -z "$MSVC_CXX"; then
4452         # This gives us a posix path with 8.3 filename restrictions
4453         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4454     fi
4456     if test -z "$CC"; then
4457         CC=$MSVC_CXX
4458         CC_BASE=`first_arg_basename "$CC"`
4459     fi
4460     if test -z "$CXX"; then
4461         CXX=$MSVC_CXX
4462         CXX_BASE=`first_arg_basename "$CXX"`
4463     fi
4465     if test -n "$CC"; then
4466         # Remove /cl.exe from CC case insensitive
4467         AC_MSG_NOTICE([found Visual C++ $vcyear])
4469         PathFormat "$COMPATH"
4470         COMPATH="$formatted_path"
4471         COMPATH_unix="$formatted_path_unix"
4472         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4474         VCVER=$vcnumwithdot
4475         VCTOOLSET=$vctoolset
4477         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4478         # are always "better", we list them in reverse chronological order.
4480         case "$vcnumwithdot" in
4481         16.0 | 17.0 | 17.10)
4482             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4483             ;;
4484         esac
4486         # The expectation is that --with-windows-sdk should not need to be used
4487         if test -n "$with_windows_sdk"; then
4488             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4489             *" "$with_windows_sdk" "*)
4490                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4491                 ;;
4492             *)
4493                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4494                 ;;
4495             esac
4496         fi
4498         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4499         ac_objext=obj
4500         ac_exeext=exe
4502     else
4503         AC_MSG_ERROR([Visual C++ not found after all, huh])
4504     fi
4506     # ERROR if VS version < 16.5
4507     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4508     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4509         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4510         // between Visual Studio versions and _MSC_VER:
4511         #if _MSC_VER < 1925
4512         #error
4513         #endif
4514     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4516     # WARN if VS version < 16.10
4517     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4518     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4519         #if _MSC_VER < 1929
4520         #error
4521         #endif
4522     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4524     if test $vs2019_recommended_version = yes; then
4525         AC_MSG_RESULT([yes])
4526     else
4527         AC_MSG_WARN([no])
4528         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."
4529     fi
4531     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4532     # version of the Explorer extension (and maybe other small
4533     # bits, too) needed when installing a 32-bit LibreOffice on a
4534     # 64-bit OS. The 64-bit Explorer extension is a feature that
4535     # has been present since long in OOo. Don't confuse it with
4536     # building LibreOffice itself as 64-bit code.
4538     BUILD_X64=
4539     CXX_X64_BINARY=
4541     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4542         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4543         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4544              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4545         then
4546             BUILD_X64=TRUE
4547             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4548             AC_MSG_RESULT([found])
4549         else
4550             AC_MSG_RESULT([not found])
4551             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4552         fi
4553     elif test "$WIN_HOST_ARCH" = "x64"; then
4554         CXX_X64_BINARY=$CXX
4555     fi
4556     AC_SUBST(BUILD_X64)
4558     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4559     AC_SUBST(CXX_X64_BINARY)
4561     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4562     # needed to support TWAIN scan on both 32- and 64-bit systems
4564     case "$WIN_HOST_ARCH" in
4565     x64)
4566         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4567         if test -n "$CXX_X86_BINARY"; then
4568             BUILD_X86=TRUE
4569             AC_MSG_RESULT([preset])
4570         elif test -n "$WIN_MULTI_ARCH"; then
4571             BUILD_X86=TRUE
4572             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4573             AC_MSG_RESULT([found])
4574         else
4575             AC_MSG_RESULT([not found])
4576             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4577         fi
4578         ;;
4579     x86)
4580         BUILD_X86=TRUE
4581         CXX_X86_BINARY=$MSVC_CXX
4582         ;;
4583     esac
4584     AC_SUBST(BUILD_X86)
4585     AC_SUBST(CXX_X86_BINARY)
4587 AC_SUBST(VCVER)
4588 AC_SUBST(VCTOOLSET)
4589 AC_SUBST(DEVENV)
4590 AC_SUBST(MSVC_CXX)
4592 COM_IS_CLANG=
4593 AC_MSG_CHECKING([whether the compiler is actually Clang])
4594 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4595     #ifndef __clang__
4596     you lose
4597     #endif
4598     int foo=42;
4599     ]])],
4600     [AC_MSG_RESULT([yes])
4601      COM_IS_CLANG=TRUE],
4602     [AC_MSG_RESULT([no])])
4603 AC_SUBST(COM_IS_CLANG)
4605 CLANGVER=
4606 if test "$COM_IS_CLANG" = TRUE; then
4607     AC_MSG_CHECKING([whether Clang is new enough])
4608     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4609         #if !defined __apple_build_version__
4610         #error
4611         #endif
4612         ]])],
4613         [my_apple_clang=yes],[my_apple_clang=])
4614     if test "$my_apple_clang" = yes; then
4615         AC_MSG_RESULT([assumed yes (Apple Clang)])
4616     elif test "$_os" = Emscripten; then
4617         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4618     else
4619         if test "$_os" = WINNT; then
4620             dnl In which case, assume clang-cl:
4621             my_args="/EP /TC"
4622         else
4623             my_args="-E -P"
4624         fi
4625         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4626         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4627         CLANGVER=`echo $clang_version \
4628             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4629         if test "$CLANGVER" -ge 120000; then
4630             AC_MSG_RESULT([yes ($clang_version)])
4631         else
4632             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4633         fi
4634         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4635         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4636     fi
4639 SHOWINCLUDES_PREFIX=
4640 if test "$_os" = WINNT; then
4641     dnl We need to guess the prefix of the -showIncludes output, it can be
4642     dnl localized
4643     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4644     echo "#include <stdlib.h>" > conftest.c
4645     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4646         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4647     rm -f conftest.c conftest.obj
4648     if test -z "$SHOWINCLUDES_PREFIX"; then
4649         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4650     else
4651         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4652     fi
4654 AC_SUBST(SHOWINCLUDES_PREFIX)
4657 # prefix C with ccache if needed
4659 if test "$CCACHE" != ""; then
4660     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4662     AC_LANG_PUSH([C])
4663     save_CFLAGS=$CFLAGS
4664     CFLAGS="$CFLAGS --ccache-skip -O2"
4665     # msvc does not fail on unknown options, check stdout
4666     if test "$COM" = MSC; then
4667         CFLAGS="$CFLAGS -nologo"
4668     fi
4669     save_ac_c_werror_flag=$ac_c_werror_flag
4670     ac_c_werror_flag=yes
4671     dnl an empty program will do, we're checking the compiler flags
4672     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4673                       [use_ccache=yes], [use_ccache=no])
4674     CFLAGS=$save_CFLAGS
4675     ac_c_werror_flag=$save_ac_c_werror_flag
4676     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4677         AC_MSG_RESULT([yes])
4678     else
4679         CC="$CCACHE $CC"
4680         CC_BASE="ccache $CC_BASE"
4681         AC_MSG_RESULT([no])
4682     fi
4683     AC_LANG_POP([C])
4686 # ===================================================================
4687 # check various GCC options that Clang does not support now but maybe
4688 # will somewhen in the future, check them even for GCC, so that the
4689 # flags are set
4690 # ===================================================================
4692 HAVE_GCC_GGDB2=
4693 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4694     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4695     save_CFLAGS=$CFLAGS
4696     CFLAGS="$CFLAGS -Werror -ggdb2"
4697     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4698     CFLAGS=$save_CFLAGS
4699     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4700         AC_MSG_RESULT([yes])
4701     else
4702         AC_MSG_RESULT([no])
4703     fi
4705     if test "$host_cpu" = "m68k"; then
4706         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4707         save_CFLAGS=$CFLAGS
4708         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4709         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4710         CFLAGS=$save_CFLAGS
4711         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4712             AC_MSG_RESULT([yes])
4713         else
4714             AC_MSG_ERROR([no])
4715         fi
4716     fi
4718 AC_SUBST(HAVE_GCC_GGDB2)
4720 dnl ===================================================================
4721 dnl  Test the gcc version
4722 dnl ===================================================================
4723 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4724     AC_MSG_CHECKING([the GCC version])
4725     _gcc_version=`$CC -dumpfullversion`
4726     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4727         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4728     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4730     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4732     if test "$gcc_full_version" -lt 120000; then
4733         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4734     fi
4735 else
4736     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4737     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4738     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4739     # (which reports itself as GCC 4.2.1).
4740     GCC_VERSION=
4742 AC_SUBST(GCC_VERSION)
4744 dnl Set the ENABLE_DBGUTIL variable
4745 dnl ===================================================================
4746 AC_MSG_CHECKING([whether to build with additional debug utilities])
4747 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4748     ENABLE_DBGUTIL="TRUE"
4749     # this is an extra var so it can have different default on different MSVC
4750     # versions (in case there are version specific problems with it)
4751     MSVC_USE_DEBUG_RUNTIME="TRUE"
4753     AC_MSG_RESULT([yes])
4754     # cppunit and graphite expose STL in public headers
4755     if test "$with_system_cppunit" = "yes"; then
4756         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4757     else
4758         with_system_cppunit=no
4759     fi
4760     if test "$with_system_graphite" = "yes"; then
4761         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4762     else
4763         with_system_graphite=no
4764     fi
4765     if test "$with_system_orcus" = "yes"; then
4766         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4767     else
4768         with_system_orcus=no
4769     fi
4770     if test "$with_system_libcmis" = "yes"; then
4771         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4772     else
4773         with_system_libcmis=no
4774     fi
4775     if test "$with_system_hunspell" = "yes"; then
4776         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4777     else
4778         with_system_hunspell=no
4779     fi
4780     if test "$with_system_gpgmepp" = "yes"; then
4781         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4782     else
4783         with_system_gpgmepp=no
4784     fi
4785     if test "$with_system_zxing" = "yes"; then
4786         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4787     else
4788         with_system_zxing=no
4789     fi
4790     if test "$with_system_poppler" = "yes"; then
4791         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4792     else
4793         with_system_poppler=no
4794     fi
4795     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4796     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4797     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4798     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4799     # of those two is using the system variant:
4800     if test "$with_system_libnumbertext" = "yes"; then
4801         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4802     else
4803         with_system_libnumbertext=no
4804     fi
4805     if test "$with_system_libwps" = "yes"; then
4806         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4807     else
4808         with_system_libwps=no
4809     fi
4810 else
4811     ENABLE_DBGUTIL=""
4812     MSVC_USE_DEBUG_RUNTIME=""
4813     AC_MSG_RESULT([no])
4815 AC_SUBST(ENABLE_DBGUTIL)
4816 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4818 dnl Set the ENABLE_DEBUG variable.
4819 dnl ===================================================================
4820 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4821     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4823 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4824     if test -z "$libo_fuzzed_enable_debug"; then
4825         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4826     else
4827         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4828         enable_debug=yes
4829     fi
4832 AC_MSG_CHECKING([whether to do a debug build])
4833 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4834     ENABLE_DEBUG="TRUE"
4835     if test -n "$ENABLE_DBGUTIL" ; then
4836         AC_MSG_RESULT([yes (dbgutil)])
4837     else
4838         AC_MSG_RESULT([yes])
4839     fi
4840 else
4841     ENABLE_DEBUG=""
4842     AC_MSG_RESULT([no])
4844 AC_SUBST(ENABLE_DEBUG)
4846 dnl ===================================================================
4847 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4848 dnl This is done only after compiler checks (need to know if Clang is
4849 dnl used, for different defaults) and after checking if a debug build
4850 dnl is wanted (non-debug builds get the default linker if not explicitly
4851 dnl specified otherwise).
4852 dnl All checks for linker features/options should come after this.
4853 dnl ===================================================================
4854 check_use_ld()
4856     use_ld=-fuse-ld=${1%%:*}
4857     use_ld_path=${1#*:}
4858     if test "$use_ld_path" != "$1"; then
4859         if test "$COM_IS_CLANG" = TRUE; then
4860             if test "$CLANGVER" -ge 120000; then
4861                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4862             else
4863                 use_ld="-fuse-ld=${use_ld_path}"
4864             fi
4865         else
4866             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4867             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4868             # pickup the alternative linker, when called by libtool for linking.
4869             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4870             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4871         fi
4872     fi
4873     use_ld_fail_if_error=$2
4874     use_ld_ok=
4875     AC_MSG_CHECKING([for $use_ld linker support])
4876     use_ld_ldflags_save="$LDFLAGS"
4877     LDFLAGS="$LDFLAGS $use_ld"
4878     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4879 #include <stdio.h>
4880         ],[
4881 printf ("hello world\n");
4882         ])], USE_LD=$use_ld, [])
4883     if test -n "$USE_LD"; then
4884         AC_MSG_RESULT( yes )
4885         use_ld_ok=yes
4886     else
4887         if test -n "$use_ld_fail_if_error"; then
4888             AC_MSG_ERROR( no )
4889         else
4890             AC_MSG_RESULT( no )
4891         fi
4892     fi
4893     if test -n "$use_ld_ok"; then
4894         dnl keep the value of LDFLAGS
4895         return 0
4896     fi
4897     LDFLAGS="$use_ld_ldflags_save"
4898     return 1
4900 USE_LD=
4901 if test "$enable_ld" != "no"; then
4902     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4903         if test -n "$enable_ld"; then
4904             check_use_ld "$enable_ld" fail_if_error
4905         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4906             dnl non-debug builds default to the default linker
4907             true
4908         elif test -n "$COM_IS_CLANG"; then
4909             check_use_ld lld
4910             if test $? -ne 0; then
4911                 check_use_ld gold
4912                 if test $? -ne 0; then
4913                     check_use_ld mold
4914                 fi
4915             fi
4916         else
4917             # For gcc first try gold, new versions also support lld/mold.
4918             check_use_ld gold
4919             if test $? -ne 0; then
4920                 check_use_ld lld
4921                 if test $? -ne 0; then
4922                     check_use_ld mold
4923                 fi
4924             fi
4925         fi
4926         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4927         rm conftest.out
4928         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4929         if test -z "$ld_used"; then
4930             ld_used="unknown"
4931         fi
4932         AC_MSG_CHECKING([for linker that is used])
4933         AC_MSG_RESULT([$ld_used])
4934         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4935             if echo "$ld_used" | grep -q "^GNU ld"; then
4936                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4937                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4938             fi
4939         fi
4940     else
4941         if test "$enable_ld" = "yes"; then
4942             AC_MSG_ERROR([--enable-ld not supported])
4943         fi
4944     fi
4946 AC_SUBST(USE_LD)
4947 AC_SUBST(LD)
4949 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4950 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4951     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4952     bsymbolic_functions_ldflags_save=$LDFLAGS
4953     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4954     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4955 #include <stdio.h>
4956         ],[
4957 printf ("hello world\n");
4958         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4959     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4960         AC_MSG_RESULT( found )
4961     else
4962         AC_MSG_RESULT( not found )
4963     fi
4964     LDFLAGS=$bsymbolic_functions_ldflags_save
4966 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4968 LD_GC_SECTIONS=
4969 if test "$GCC" = "yes"; then
4970     for flag in "--gc-sections" "-dead_strip"; do
4971         AC_MSG_CHECKING([for $flag linker support])
4972         ldflags_save=$LDFLAGS
4973         LDFLAGS="$LDFLAGS -Wl,$flag"
4974         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4975 #include <stdio.h>
4976             ],[
4977 printf ("hello world\n");
4978             ])],[
4979             LD_GC_SECTIONS="-Wl,$flag"
4980             AC_MSG_RESULT( found )
4981             ], [
4982             AC_MSG_RESULT( not found )
4983             ])
4984         LDFLAGS=$ldflags_save
4985         if test -n "$LD_GC_SECTIONS"; then
4986             break
4987         fi
4988     done
4990 AC_SUBST(LD_GC_SECTIONS)
4992 HAVE_EXTERNAL_DWARF=
4993 if test "$enable_split_debug" != no; then
4994     use_split_debug=
4995     if test -n "$ENABLE_LTO"; then
4996         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4997     elif test "$enable_split_debug" = yes; then
4998         use_split_debug=1
4999     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
5000     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5001         use_split_debug=1
5002     fi
5003     if test -n "$use_split_debug"; then
5004         if test "$_os" = "Emscripten"; then
5005             TEST_CC_FLAG=-gseparate-dwarf
5006         else
5007             TEST_CC_FLAG=-gsplit-dwarf
5008         fi
5009         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
5010         save_CFLAGS=$CFLAGS
5011         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
5012         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
5013         CFLAGS=$save_CFLAGS
5014         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
5015             AC_MSG_RESULT([yes])
5016         else
5017             if test "$enable_split_debug" = yes; then
5018                 AC_MSG_ERROR([no])
5019             else
5020                 AC_MSG_RESULT([no])
5021             fi
5022         fi
5023     fi
5024     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5025         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5026         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5027     fi
5029 AC_SUBST(HAVE_EXTERNAL_DWARF)
5031 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5032 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5033 save_CFLAGS=$CFLAGS
5034 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5035 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5036 CFLAGS=$save_CFLAGS
5037 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5038     AC_MSG_RESULT([yes])
5039 else
5040     AC_MSG_RESULT([no])
5042 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5044 ENABLE_GDB_INDEX=
5045 if test "$enable_gdb_index" != "no"; then
5046     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5047     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5048         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5049         save_CFLAGS=$CFLAGS
5050         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5051         have_ggnu_pubnames=
5052         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5053         if test "$have_ggnu_pubnames" != "TRUE"; then
5054             if test "$enable_gdb_index" = "yes"; then
5055                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5056             else
5057                 AC_MSG_RESULT( no )
5058             fi
5059         else
5060             AC_MSG_RESULT( yes )
5061             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5062             ldflags_save=$LDFLAGS
5063             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5064             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5065 #include <stdio.h>
5066                 ],[
5067 printf ("hello world\n");
5068                 ])], ENABLE_GDB_INDEX=TRUE, [])
5069             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5070                 AC_MSG_RESULT( yes )
5071             else
5072                 if test "$enable_gdb_index" = "yes"; then
5073                     AC_MSG_ERROR( no )
5074                 else
5075                     AC_MSG_RESULT( no )
5076                 fi
5077             fi
5078             LDFLAGS=$ldflags_save
5079         fi
5080         CFLAGS=$save_CFLAGS
5081         fi
5082     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5083         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5084         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5085     fi
5087 AC_SUBST(ENABLE_GDB_INDEX)
5089 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5090     enable_sal_log=yes
5092 if test "$enable_sal_log" = yes; then
5093     ENABLE_SAL_LOG=TRUE
5095 AC_SUBST(ENABLE_SAL_LOG)
5097 dnl Check for enable symbols option
5098 dnl ===================================================================
5099 AC_MSG_CHECKING([whether to generate debug information])
5100 if test -z "$enable_symbols"; then
5101     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5102         enable_symbols=yes
5103     else
5104         enable_symbols=no
5105     fi
5107 if test "$enable_symbols" = yes; then
5108     ENABLE_SYMBOLS_FOR=all
5109     AC_MSG_RESULT([yes])
5110 elif test "$enable_symbols" = no; then
5111     ENABLE_SYMBOLS_FOR=
5112     AC_MSG_RESULT([no])
5113 else
5114     # Selective debuginfo.
5115     ENABLE_SYMBOLS_FOR="$enable_symbols"
5116     AC_MSG_RESULT([for "$enable_symbols"])
5118 AC_SUBST(ENABLE_SYMBOLS_FOR)
5120 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5121     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5122     AC_MSG_CHECKING([whether enough memory is available for linking])
5123     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5124     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5125     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5126         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5127     else
5128         AC_MSG_RESULT([yes])
5129     fi
5132 ENABLE_OPTIMIZED=
5133 ENABLE_OPTIMIZED_DEBUG=
5134 AC_MSG_CHECKING([whether to compile with optimization flags])
5135 if test -z "$enable_optimized"; then
5136     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5137         enable_optimized=no
5138     else
5139         enable_optimized=yes
5140     fi
5142 if test "$enable_optimized" = yes; then
5143     ENABLE_OPTIMIZED=TRUE
5144     AC_MSG_RESULT([yes])
5145 elif test "$enable_optimized" = debug; then
5146     ENABLE_OPTIMIZED_DEBUG=TRUE
5147     AC_MSG_RESULT([yes (debug)])
5148     HAVE_GCC_OG=
5149     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5150         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5151         save_CFLAGS=$CFLAGS
5152         CFLAGS="$CFLAGS -Werror -Og"
5153         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5154         CFLAGS=$save_CFLAGS
5155         if test "$HAVE_GCC_OG" = "TRUE"; then
5156             AC_MSG_RESULT([yes])
5157         else
5158             AC_MSG_RESULT([no])
5159         fi
5160     fi
5161     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5162         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5163     fi
5164 else
5165     AC_MSG_RESULT([no])
5167 AC_SUBST(ENABLE_OPTIMIZED)
5168 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5171 # determine CPUNAME, OS, ...
5173 case "$host_os" in
5175 cygwin*|wsl*)
5176     # Already handled
5177     ;;
5179 darwin*)
5180     COM=GCC
5181     OS=MACOSX
5182     RTL_OS=MacOSX
5183     P_SEP=:
5185     case "$host_cpu" in
5186     aarch64|arm64)
5187         if test "$enable_ios_simulator" = "yes"; then
5188             OS=iOS
5189         else
5190             CPUNAME=AARCH64
5191             RTL_ARCH=AARCH64
5192             PLATFORMID=macosx_aarch64
5193         fi
5194         ;;
5195     x86_64)
5196         if test "$enable_ios_simulator" = "yes"; then
5197             OS=iOS
5198         fi
5199         CPUNAME=X86_64
5200         RTL_ARCH=X86_64
5201         PLATFORMID=macosx_x86_64
5202         ;;
5203     *)
5204         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5205         ;;
5206     esac
5207     ;;
5209 ios*)
5210     COM=GCC
5211     OS=iOS
5212     RTL_OS=iOS
5213     P_SEP=:
5215     case "$host_cpu" in
5216     aarch64|arm64)
5217         if test "$enable_ios_simulator" = "yes"; then
5218             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5219         fi
5220         ;;
5221     *)
5222         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5223         ;;
5224     esac
5225     CPUNAME=AARCH64
5226     RTL_ARCH=AARCH64
5227     PLATFORMID=ios_arm64
5228     ;;
5230 dragonfly*)
5231     COM=GCC
5232     OS=DRAGONFLY
5233     RTL_OS=DragonFly
5234     P_SEP=:
5236     case "$host_cpu" in
5237     i*86)
5238         CPUNAME=INTEL
5239         RTL_ARCH=x86
5240         PLATFORMID=dragonfly_x86
5241         ;;
5242     x86_64)
5243         CPUNAME=X86_64
5244         RTL_ARCH=X86_64
5245         PLATFORMID=dragonfly_x86_64
5246         ;;
5247     *)
5248         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5249         ;;
5250     esac
5251     ;;
5253 freebsd*)
5254     COM=GCC
5255     RTL_OS=FreeBSD
5256     OS=FREEBSD
5257     P_SEP=:
5259     case "$host_cpu" in
5260     aarch64)
5261         CPUNAME=AARCH64
5262         PLATFORMID=freebsd_aarch64
5263         RTL_ARCH=AARCH64
5264         ;;
5265     i*86)
5266         CPUNAME=INTEL
5267         RTL_ARCH=x86
5268         PLATFORMID=freebsd_x86
5269         ;;
5270     x86_64|amd64)
5271         CPUNAME=X86_64
5272         RTL_ARCH=X86_64
5273         PLATFORMID=freebsd_x86_64
5274         ;;
5275     powerpc64)
5276         CPUNAME=POWERPC64
5277         RTL_ARCH=PowerPC_64
5278         PLATFORMID=freebsd_powerpc64
5279         ;;
5280     powerpc|powerpcspe)
5281         CPUNAME=POWERPC
5282         RTL_ARCH=PowerPC
5283         PLATFORMID=freebsd_powerpc
5284         ;;
5285     *)
5286         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5287         ;;
5288     esac
5289     ;;
5291 haiku*)
5292     COM=GCC
5293     GUIBASE=haiku
5294     RTL_OS=Haiku
5295     OS=HAIKU
5296     P_SEP=:
5298     case "$host_cpu" in
5299     i*86)
5300         CPUNAME=INTEL
5301         RTL_ARCH=x86
5302         PLATFORMID=haiku_x86
5303         ;;
5304     x86_64|amd64)
5305         CPUNAME=X86_64
5306         RTL_ARCH=X86_64
5307         PLATFORMID=haiku_x86_64
5308         ;;
5309     *)
5310         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5311         ;;
5312     esac
5313     ;;
5315 kfreebsd*)
5316     COM=GCC
5317     OS=LINUX
5318     RTL_OS=kFreeBSD
5319     P_SEP=:
5321     case "$host_cpu" in
5323     i*86)
5324         CPUNAME=INTEL
5325         RTL_ARCH=x86
5326         PLATFORMID=kfreebsd_x86
5327         ;;
5328     x86_64)
5329         CPUNAME=X86_64
5330         RTL_ARCH=X86_64
5331         PLATFORMID=kfreebsd_x86_64
5332         ;;
5333     *)
5334         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5335         ;;
5336     esac
5337     ;;
5339 linux-gnu*|linux-musl*)
5340     COM=GCC
5341     OS=LINUX
5342     RTL_OS=Linux
5343     P_SEP=:
5345     case "$host_cpu" in
5347     aarch64)
5348         CPUNAME=AARCH64
5349         PLATFORMID=linux_aarch64
5350         RTL_ARCH=AARCH64
5351         EPM_FLAGS="-a arm64"
5352         ;;
5353     alpha)
5354         CPUNAME=AXP
5355         RTL_ARCH=ALPHA
5356         PLATFORMID=linux_alpha
5357         ;;
5358     arm*)
5359         CPUNAME=ARM
5360         EPM_FLAGS="-a arm"
5361         RTL_ARCH=ARM_EABI
5362         PLATFORMID=linux_arm_eabi
5363         case "$host_cpu" in
5364         arm*-linux)
5365             RTL_ARCH=ARM_OABI
5366             PLATFORMID=linux_arm_oabi
5367             ;;
5368         esac
5369         ;;
5370     hppa)
5371         CPUNAME=HPPA
5372         RTL_ARCH=HPPA
5373         EPM_FLAGS="-a hppa"
5374         PLATFORMID=linux_hppa
5375         ;;
5376     i*86)
5377         CPUNAME=INTEL
5378         RTL_ARCH=x86
5379         PLATFORMID=linux_x86
5380         ;;
5381     ia64)
5382         CPUNAME=IA64
5383         RTL_ARCH=IA64
5384         PLATFORMID=linux_ia64
5385         ;;
5386     mips)
5387         CPUNAME=MIPS
5388         RTL_ARCH=MIPS_EB
5389         EPM_FLAGS="-a mips"
5390         PLATFORMID=linux_mips_eb
5391         ;;
5392     mips64)
5393         CPUNAME=MIPS64
5394         RTL_ARCH=MIPS64_EB
5395         EPM_FLAGS="-a mips64"
5396         PLATFORMID=linux_mips64_eb
5397         ;;
5398     mips64el)
5399         CPUNAME=MIPS64
5400         RTL_ARCH=MIPS64_EL
5401         EPM_FLAGS="-a mips64el"
5402         PLATFORMID=linux_mips64_el
5403         ;;
5404     mipsel)
5405         CPUNAME=MIPS
5406         RTL_ARCH=MIPS_EL
5407         EPM_FLAGS="-a mipsel"
5408         PLATFORMID=linux_mips_el
5409         ;;
5410     riscv64)
5411         CPUNAME=RISCV64
5412         RTL_ARCH=RISCV64
5413         EPM_FLAGS="-a riscv64"
5414         PLATFORMID=linux_riscv64
5415         ;;
5416     m68k)
5417         CPUNAME=M68K
5418         RTL_ARCH=M68K
5419         PLATFORMID=linux_m68k
5420         ;;
5421     powerpc)
5422         CPUNAME=POWERPC
5423         RTL_ARCH=PowerPC
5424         PLATFORMID=linux_powerpc
5425         ;;
5426     powerpc64)
5427         CPUNAME=POWERPC64
5428         RTL_ARCH=PowerPC_64
5429         PLATFORMID=linux_powerpc64
5430         ;;
5431     powerpc64le)
5432         CPUNAME=POWERPC64
5433         RTL_ARCH=PowerPC_64_LE
5434         PLATFORMID=linux_powerpc64_le
5435         ;;
5436     sparc)
5437         CPUNAME=SPARC
5438         RTL_ARCH=SPARC
5439         PLATFORMID=linux_sparc
5440         ;;
5441     sparc64)
5442         CPUNAME=SPARC64
5443         RTL_ARCH=SPARC64
5444         PLATFORMID=linux_sparc64
5445         ;;
5446     s390x)
5447         CPUNAME=S390X
5448         RTL_ARCH=S390x
5449         PLATFORMID=linux_s390x
5450         ;;
5451     x86_64)
5452         CPUNAME=X86_64
5453         RTL_ARCH=X86_64
5454         PLATFORMID=linux_x86_64
5455         ;;
5456     loongarch64)
5457         CPUNAME=LOONGARCH64
5458         RTL_ARCH=LOONGARCH64
5459         PLATFORMID=linux_loongarch64
5460         ;;
5461     *)
5462         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5463         ;;
5464     esac
5465     ;;
5467 linux-android*)
5468     COM=GCC
5469     OS=ANDROID
5470     RTL_OS=Android
5471     P_SEP=:
5473     case "$host_cpu" in
5475     arm|armel)
5476         CPUNAME=ARM
5477         RTL_ARCH=ARM_EABI
5478         PLATFORMID=android_arm_eabi
5479         ;;
5480     aarch64)
5481         CPUNAME=AARCH64
5482         RTL_ARCH=AARCH64
5483         PLATFORMID=android_aarch64
5484         ;;
5485     i*86)
5486         CPUNAME=INTEL
5487         RTL_ARCH=x86
5488         PLATFORMID=android_x86
5489         ;;
5490     x86_64)
5491         CPUNAME=X86_64
5492         RTL_ARCH=X86_64
5493         PLATFORMID=android_x86_64
5494         ;;
5495     *)
5496         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5497         ;;
5498     esac
5499     ;;
5501 *netbsd*)
5502     COM=GCC
5503     OS=NETBSD
5504     RTL_OS=NetBSD
5505     P_SEP=:
5507     case "$host_cpu" in
5508     i*86)
5509         CPUNAME=INTEL
5510         RTL_ARCH=x86
5511         PLATFORMID=netbsd_x86
5512         ;;
5513     powerpc)
5514         CPUNAME=POWERPC
5515         RTL_ARCH=PowerPC
5516         PLATFORMID=netbsd_powerpc
5517         ;;
5518     sparc)
5519         CPUNAME=SPARC
5520         RTL_ARCH=SPARC
5521         PLATFORMID=netbsd_sparc
5522         ;;
5523     x86_64)
5524         CPUNAME=X86_64
5525         RTL_ARCH=X86_64
5526         PLATFORMID=netbsd_x86_64
5527         ;;
5528     *)
5529         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5530         ;;
5531     esac
5532     ;;
5534 openbsd*)
5535     COM=GCC
5536     OS=OPENBSD
5537     RTL_OS=OpenBSD
5538     P_SEP=:
5540     case "$host_cpu" in
5541     i*86)
5542         CPUNAME=INTEL
5543         RTL_ARCH=x86
5544         PLATFORMID=openbsd_x86
5545         ;;
5546     x86_64)
5547         CPUNAME=X86_64
5548         RTL_ARCH=X86_64
5549         PLATFORMID=openbsd_x86_64
5550         ;;
5551     *)
5552         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5553         ;;
5554     esac
5555     SOLARINC="$SOLARINC -I/usr/local/include"
5556     ;;
5558 solaris*)
5559     COM=GCC
5560     OS=SOLARIS
5561     RTL_OS=Solaris
5562     P_SEP=:
5564     case "$host_cpu" in
5565     i*86)
5566         CPUNAME=INTEL
5567         RTL_ARCH=x86
5568         PLATFORMID=solaris_x86
5569         ;;
5570     sparc)
5571         CPUNAME=SPARC
5572         RTL_ARCH=SPARC
5573         PLATFORMID=solaris_sparc
5574         ;;
5575     sparc64)
5576         CPUNAME=SPARC64
5577         RTL_ARCH=SPARC64
5578         PLATFORMID=solaris_sparc64
5579         ;;
5580     *)
5581         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5582         ;;
5583     esac
5584     SOLARINC="$SOLARINC -I/usr/local/include"
5585     ;;
5587 emscripten*)
5588     COM=GCC
5589     OS=EMSCRIPTEN
5590     RTL_OS=Emscripten
5591     P_SEP=:
5593     case "$host_cpu" in
5594     wasm32|wasm64)
5595         ;;
5596     *)
5597         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5598         ;;
5599     esac
5600     CPUNAME=INTEL
5601     RTL_ARCH=x86
5602     PLATFORMID=linux_x86
5603     ;;
5606     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5607     ;;
5608 esac
5610 DISABLE_GUI=""
5611 if test "$enable_gui" = "no"; then
5612     if test "$using_x11" != yes; then
5613         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5614     fi
5615     USING_X11=
5616     DISABLE_GUI=TRUE
5617     test_epoxy=no
5618 else
5619     AC_DEFINE(HAVE_FEATURE_UI)
5621 AC_SUBST(DISABLE_GUI)
5623 if test "$with_x" = "no"; then
5624     USING_X11=
5627 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5628     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5631 if test "$using_x11" = yes; then
5632     if test "$USING_X11" = TRUE; then
5633         AC_DEFINE(USING_X11)
5634     else
5635         disable_x11_tests
5636         if test "$DISABLE_DYNLOADING" = TRUE; then
5637             test_qt5=yes
5638             test_qt6=yes
5639         fi
5640     fi
5641 else
5642     if test "$USING_X11" = TRUE; then
5643         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5644     fi
5647 WORKDIR="${BUILDDIR}/workdir"
5648 INSTDIR="${BUILDDIR}/instdir"
5649 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5650 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5651 AC_SUBST(COM)
5652 AC_SUBST(CPUNAME)
5653 AC_SUBST(RTL_OS)
5654 AC_SUBST(RTL_ARCH)
5655 AC_SUBST(EPM_FLAGS)
5656 AC_SUBST(USING_X11)
5657 AC_SUBST([INSTDIR])
5658 AC_SUBST([INSTROOT])
5659 AC_SUBST([INSTROOTBASE])
5660 AC_SUBST(OS)
5661 AC_SUBST(P_SEP)
5662 AC_SUBST(WORKDIR)
5663 AC_SUBST(PLATFORMID)
5664 AC_SUBST(WINDOWS_X64)
5665 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5666 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5668 if test "$OS" = WNT -a "$COM" = MSC; then
5669     case "$CPUNAME" in
5670     INTEL) CPPU_ENV=msci ;;
5671     X86_64) CPPU_ENV=mscx ;;
5672     AARCH64) CPPU_ENV=msca ;;
5673     *)
5674         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5675         ;;
5676     esac
5677 else
5678     CPPU_ENV=gcc3
5680 AC_SUBST(CPPU_ENV)
5682 dnl ===================================================================
5683 dnl Test which package format to use
5684 dnl ===================================================================
5685 AC_MSG_CHECKING([which package format to use])
5686 if test -n "$with_package_format" -a "$with_package_format" != no; then
5687     for i in $with_package_format; do
5688         case "$i" in
5689         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5690             ;;
5691         *)
5692             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5693 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5694 deb - Debian software distribution
5695 pkg - Solaris software distribution
5696 rpm - RedHat software distribution
5698 LibreOffice additionally supports:
5699 archive - .tar.gz or .zip
5700 dmg - macOS .dmg
5701 installed - installation tree
5702 msi - Windows .msi
5703         ])
5704             ;;
5705         esac
5706     done
5707     # fakeroot is needed to ensure correct file ownerships/permissions
5708     # inside deb packages and tar archives created on Linux and Solaris.
5709     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5710         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5711         if test "$FAKEROOT" = "no"; then
5712             AC_MSG_ERROR(
5713                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5714         fi
5715     fi
5716     PKGFORMAT="$with_package_format"
5717     AC_MSG_RESULT([$PKGFORMAT])
5718 else
5719     PKGFORMAT=
5720     AC_MSG_RESULT([none])
5722 AC_SUBST(PKGFORMAT)
5724 dnl ===================================================================
5725 dnl handle help related options
5727 dnl If you change help related options, please update README.help
5728 dnl ===================================================================
5730 ENABLE_HTMLHELP=
5731 HELP_OMINDEX_PAGE=
5732 HELP_ONLINE=
5733 WITH_HELPPACKS=
5735 AC_MSG_CHECKING([which help to build])
5736 if test -n "$with_help" -a "$with_help" != "no"; then
5737     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5738     BUILD_TYPE="$BUILD_TYPE HELP"
5739     case "$with_help" in
5740     "html")
5741         ENABLE_HTMLHELP=TRUE
5742         WITH_HELPPACKS=TRUE
5743         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5744         AC_MSG_RESULT([HTML (local)])
5745         ;;
5746     "online")
5747         ENABLE_HTMLHELP=TRUE
5748         HELP_ONLINE=TRUE
5749         AC_MSG_RESULT([HTML (online)])
5750         ;;
5751     yes)
5752         WITH_HELPPACKS=TRUE
5753         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5754         AC_MSG_RESULT([XML (local)])
5755         ;;
5756     *)
5757         AC_MSG_ERROR([Unknown --with-help=$with_help])
5758         ;;
5759     esac
5760 else
5761     AC_MSG_RESULT([no])
5764 AC_MSG_CHECKING([if we need to build the help index tooling])
5765 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5766     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5767     test_clucene=yes
5768     AC_MSG_RESULT([yes])
5769 else
5770     AC_MSG_RESULT([no])
5773 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5774 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5775     if test "$HELP_ONLINE" != TRUE; then
5776         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5777     fi
5778     case "$with_omindex" in
5779     "server")
5780         HELP_OMINDEX_PAGE=TRUE
5781         AC_MSG_RESULT([SERVER])
5782         ;;
5783     "noxap")
5784         AC_MSG_RESULT([NOXAP])
5785         ;;
5786     *)
5787         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5788         ;;
5789     esac
5790 else
5791     AC_MSG_RESULT([no])
5794 AC_MSG_CHECKING([whether to include the XML-help support])
5795 if test "$enable_xmlhelp" = yes; then
5796     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5797     test_clucene=yes
5798     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5799     AC_MSG_RESULT([yes])
5800 else
5801     if test "$with_help" = yes; then
5802         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5803     fi
5804     AC_MSG_RESULT([no])
5807 dnl Test whether to integrate helppacks into the product's installer
5808 AC_MSG_CHECKING([for helppack integration])
5809 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5810     AC_MSG_RESULT([no integration])
5811 else
5812     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5813     AC_MSG_RESULT([integration])
5816 AC_SUBST([ENABLE_HTMLHELP])
5817 AC_SUBST([HELP_OMINDEX_PAGE])
5818 AC_SUBST([HELP_ONLINE])
5819 # WITH_HELPPACKS is used only in configure
5821 dnl ===================================================================
5822 dnl Set up a different compiler to produce tools to run on the build
5823 dnl machine when doing cross-compilation
5824 dnl ===================================================================
5826 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5827 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5828 if test "$cross_compiling" = "yes"; then
5829     AC_MSG_CHECKING([for BUILD platform configuration])
5830     echo
5831     rm -rf CONF-FOR-BUILD config_build.mk
5832     mkdir CONF-FOR-BUILD
5833     # Here must be listed all files needed when running the configure script. In particular, also
5834     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5835     # keep them in the same order as there.
5836     (cd $SRC_ROOT && tar cf - \
5837         config.guess \
5838         bin/get_config_variables \
5839         solenv/bin/getcompver.awk \
5840         solenv/inc/langlist.mk \
5841         download.lst \
5842         config_host.mk.in \
5843         config_host_lang.mk.in \
5844         Makefile.in \
5845         bin/bffvalidator.sh.in \
5846         bin/odfvalidator.sh.in \
5847         bin/officeotron.sh.in \
5848         instsetoo_native/util/openoffice.lst.in \
5849         config_host/*.in \
5850         sysui/desktop/macosx/Info.plist.in \
5851         sysui/desktop/macosx/hardened_runtime.xcent.in \
5852         sysui/desktop/macosx/lo.xcent.in \
5853         .vscode/vs-code-template.code-workspace.in \
5854         solenv/lockfile/autoconf.h.in \
5855         ) \
5856     | (cd CONF-FOR-BUILD && tar xf -)
5857     cp configure CONF-FOR-BUILD
5858     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5859     (
5860     unset COM USING_X11 OS CPUNAME
5861     unset CC CXX SYSBASE CFLAGS
5862     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5863     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5864     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5865     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5866     if test -n "$CC_FOR_BUILD"; then
5867         export CC="$CC_FOR_BUILD"
5868         CC_BASE=`first_arg_basename "$CC"`
5869     fi
5870     if test -n "$CXX_FOR_BUILD"; then
5871         export CXX="$CXX_FOR_BUILD"
5872         CXX_BASE=`first_arg_basename "$CXX"`
5873     fi
5874     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5875     cd CONF-FOR-BUILD
5877     # Handle host configuration, which affects the cross-toolset too
5878     sub_conf_opts=""
5879     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5880     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5881     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5882     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5883     if test -n "$ENABLE_JAVA"; then
5884         case "$_os" in
5885         Android)
5886             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5887             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5888             ;;
5889         *)
5890             if test -z "$with_jdk_home"; then
5891                 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.])
5892             fi
5893             ;;
5894         esac
5895     else
5896         sub_conf_opts="$sub_conf_opts --without-java"
5897     fi
5898     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5899     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5900     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5901     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5902     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5903     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5904     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5905     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5906     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5907     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5908     if test "$_os" = "Emscripten"; then
5909         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5910         if test "${with_main_module+set}" = set; then
5911             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5912         else
5913             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5914         fi
5915     fi
5916     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5917     # when cross-compiling for aarch64, overriding the defaults below
5918     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5920     # Don't bother having configure look for stuff not needed for the build platform anyway
5921     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5922     sub_conf_defaults=" \
5923         --build="$build_alias" \
5924         --disable-cairo-canvas \
5925         --disable-cups \
5926         --disable-customtarget-components \
5927         --disable-firebird-sdbc \
5928         --disable-gpgmepp \
5929         --disable-gstreamer-1-0 \
5930         --disable-gtk3 \
5931         --disable-gtk4 \
5932         --disable-libcmis \
5933         --disable-mariadb-sdbc \
5934         --disable-nss \
5935         --disable-online-update \
5936         --disable-opencl \
5937         --disable-openssl \
5938         --disable-pdfimport \
5939         --disable-postgresql-sdbc \
5940         --disable-skia \
5941         --disable-xmlhelp \
5942         --enable-dynamic-loading \
5943         --enable-icecream="$enable_icecream" \
5944         --without-doxygen \
5945         --without-tls \
5946         --without-webdav \
5947         --without-x \
5949     # single quotes added for better readability in case of spaces
5950     echo "    Running CONF-FOR-BUILD/configure" \
5951         $sub_conf_defaults \
5952         --with-parallelism="'$with_parallelism'" \
5953         --with-theme="'$with_theme'" \
5954         --with-vendor="'$with_vendor'" \
5955         $sub_conf_opts \
5956         $with_build_platform_configure_options \
5957         --srcdir=$srcdir
5959     ./configure \
5960         $sub_conf_defaults \
5961         --with-parallelism="$with_parallelism" \
5962         --with-theme="$with_theme" \
5963         "--with-vendor=$with_vendor" \
5964         $sub_conf_opts \
5965         $with_build_platform_configure_options \
5966         --srcdir=$srcdir \
5967         2>&1 | sed -e 's/^/    /'
5968     if test [${PIPESTATUS[0]}] -ne 0; then
5969         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5970     fi
5972     # filter permitted build targets
5973     PERMITTED_BUILD_TARGETS="
5974         ARGON2
5975         AVMEDIA
5976         BOOST
5977         BZIP2
5978         CAIRO
5979         CLUCENE
5980         CURL
5981         DBCONNECTIVITY
5982         DESKTOP
5983         DRAGONBOX
5984         DYNLOADING
5985         EPOXY
5986         EXPAT
5987         FROZEN
5988         GLM
5989         GRAPHITE
5990         HARFBUZZ
5991         HELPTOOLS
5992         ICU
5993         LCMS2
5994         LIBJPEG_TURBO
5995         LIBLANGTAG
5996         LibO
5997         LIBFFI
5998         LIBPN
5999         LIBTIFF
6000         LIBWEBP
6001         LIBXML2
6002         LIBXSLT
6003         MDDS
6004         NATIVE
6005         OPENSSL
6006         ORCUS
6007         PYTHON
6008         REPORTBUILDER
6009         SCRIPTING
6010         ZLIB
6011         ZXCVBN
6013     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
6014     # newlined lists, to use grep as a filter
6015     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
6016     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
6017     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
6018     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
6020     cp config_host.mk ../config_build.mk
6021     cp config_host_lang.mk ../config_build_lang.mk
6022     mv config.log ../config.Build.log
6023     mkdir -p ../config_build
6024     mv config_host/*.h ../config_build
6025     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6027     # all these will get a _FOR_BUILD postfix
6028     DIRECT_FOR_BUILD_SETTINGS="
6029         CC
6030         CPPU_ENV
6031         CXX
6032         ILIB
6033         JAVA_HOME
6034         JAVAIFLAGS
6035         JDK
6036         JDK_SECURITYMANAGER_DISALLOWED
6037         LIBO_BIN_FOLDER
6038         LIBO_LIB_FOLDER
6039         LIBO_URE_LIB_FOLDER
6040         LIBO_URE_MISC_FOLDER
6041         OS
6042         SDKDIRNAME
6043         SYSTEM_LIBXML
6044         SYSTEM_LIBXSLT
6046     # these overwrite host config with build config
6047     OVERWRITING_SETTINGS="
6048         ANT
6049         ANT_HOME
6050         ANT_LIB
6051         JAVA_SOURCE_VER
6052         JAVA_TARGET_VER
6053         JAVACFLAGS
6054         JAVACOMPILER
6055         JAVADOC
6056         JAVADOCISGJDOC
6057         LOCKFILE
6058         SYSTEM_GENBRK
6059         SYSTEM_GENCCODE
6060         SYSTEM_GENCMN
6062     # these need some special handling
6063     EXTRA_HANDLED_SETTINGS="
6064         INSTDIR
6065         INSTROOT
6066         PATH
6067         WORKDIR
6069     OLD_PATH=$PATH
6070     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6071     BUILD_PATH=$PATH
6072     PATH=$OLD_PATH
6074     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6075     echo "$line" >>build-config
6077     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6078         VV='$'$V
6079         VV=`eval "echo $VV"`
6080         if test -n "$VV"; then
6081             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6082             echo "$line" >>build-config
6083         fi
6084     done
6086     for V in $OVERWRITING_SETTINGS; do
6087         VV='$'$V
6088         VV=`eval "echo $VV"`
6089         if test -n "$VV"; then
6090             line=${V}='${'${V}:-$VV'}'
6091             echo "$line" >>build-config
6092         fi
6093     done
6095     for V in INSTDIR INSTROOT WORKDIR; do
6096         VV='$'$V
6097         VV=`eval "echo $VV"`
6098         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6099         if test -n "$VV"; then
6100             line="${V}_FOR_BUILD='$VV'"
6101             echo "$line" >>build-config
6102         fi
6103     done
6105     )
6106     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6107     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])
6108     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6109              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6111     eval `cat CONF-FOR-BUILD/build-config`
6113     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6115     rm -rf CONF-FOR-BUILD
6116 else
6117     OS_FOR_BUILD="$OS"
6118     CC_FOR_BUILD="$CC"
6119     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6120     CXX_FOR_BUILD="$CXX"
6121     INSTDIR_FOR_BUILD="$INSTDIR"
6122     INSTROOT_FOR_BUILD="$INSTROOT"
6123     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6124     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6125     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6126     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6127     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6128     WORKDIR_FOR_BUILD="$WORKDIR"
6130 AC_SUBST(OS_FOR_BUILD)
6131 AC_SUBST(INSTDIR_FOR_BUILD)
6132 AC_SUBST(INSTROOT_FOR_BUILD)
6133 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6134 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6135 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6136 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6137 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6138 AC_SUBST(WORKDIR_FOR_BUILD)
6139 AC_SUBST(CC_FOR_BUILD)
6140 AC_SUBST(CXX_FOR_BUILD)
6141 AC_SUBST(CPPU_ENV_FOR_BUILD)
6143 dnl ===================================================================
6144 dnl Check for lockfile deps
6145 dnl ===================================================================
6146 if test -z "$CROSS_COMPILING"; then
6147     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6148     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6149     AC_MSG_CHECKING([which lockfile binary to use])
6150     case "$with_system_lockfile" in
6151     yes)
6152         AC_MSG_RESULT([external])
6153         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6154         ;;
6155     no)
6156         AC_MSG_RESULT([internal])
6157         ;;
6158     *)
6159         if test -x "$with_system_lockfile"; then
6160             LOCKFILE="$with_system_lockfile"
6161         else
6162             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6163         fi
6164         AC_MSG_RESULT([$with_system_lockfile])
6165         ;;
6166     esac
6169 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6170     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6173 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6174 AC_CHECK_FUNCS([utime utimes])
6175 AC_SUBST(LOCKFILE)
6177 dnl ===================================================================
6178 dnl Check for syslog header
6179 dnl ===================================================================
6180 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6182 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6183 dnl ===================================================================
6184 AC_MSG_CHECKING([whether to turn warnings to errors])
6185 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6186     ENABLE_WERROR="TRUE"
6187     PYTHONWARNINGS="error"
6188     AC_MSG_RESULT([yes])
6189 else
6190     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6191         ENABLE_WERROR="TRUE"
6192         PYTHONWARNINGS="error"
6193         AC_MSG_RESULT([yes])
6194     else
6195         AC_MSG_RESULT([no])
6196     fi
6198 AC_SUBST(ENABLE_WERROR)
6199 AC_SUBST(PYTHONWARNINGS)
6201 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6202 dnl ===================================================================
6203 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6204 if test -z "$enable_assert_always_abort"; then
6205    if test "$ENABLE_DEBUG" = TRUE; then
6206        enable_assert_always_abort=yes
6207    else
6208        enable_assert_always_abort=no
6209    fi
6211 if test "$enable_assert_always_abort" = "yes"; then
6212     ASSERT_ALWAYS_ABORT="TRUE"
6213     AC_MSG_RESULT([yes])
6214 else
6215     ASSERT_ALWAYS_ABORT="FALSE"
6216     AC_MSG_RESULT([no])
6218 AC_SUBST(ASSERT_ALWAYS_ABORT)
6220 # Determine whether to use ooenv for the instdir installation
6221 # ===================================================================
6222 if test $_os != "WINNT" -a $_os != "Darwin"; then
6223     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6224     if test -z "$enable_ooenv"; then
6225         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6226             enable_ooenv=yes
6227         else
6228             enable_ooenv=no
6229         fi
6230     fi
6231     if test "$enable_ooenv" = "no"; then
6232         AC_MSG_RESULT([no])
6233     else
6234         ENABLE_OOENV="TRUE"
6235         AC_MSG_RESULT([yes])
6236     fi
6238 AC_SUBST(ENABLE_OOENV)
6240 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6241     if test "$enable_qt5" = "no"; then
6242         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6243     else
6244         enable_qt5=yes
6245     fi
6248 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6249     if test "$enable_qt6" = "no"; then
6250         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6251     else
6252         enable_qt6=yes
6253     fi
6257 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6258 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6259     AC_MSG_RESULT([yes])
6260     ENABLE_PAGEIN=TRUE
6261     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6262 else
6263     AC_MSG_RESULT([no])
6265 AC_SUBST(ENABLE_PAGEIN)
6267 dnl ===================================================================
6268 dnl check for cups support
6269 dnl ===================================================================
6271 AC_MSG_CHECKING([whether to enable CUPS support])
6272 if test "$test_cups" = yes -a "$enable_cups" != no; then
6273     ENABLE_CUPS=TRUE
6274     AC_MSG_RESULT([yes])
6276     AC_MSG_CHECKING([whether cups support is present])
6277     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6278     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6279     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6280         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6281     fi
6282 else
6283     AC_MSG_RESULT([no])
6286 AC_SUBST(ENABLE_CUPS)
6288 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6290 dnl whether to find & fetch external tarballs?
6291 dnl ===================================================================
6292 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6293    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6294        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6295    else
6296        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6297    fi
6299 if test -z "$TARFILE_LOCATION"; then
6300     if test -d "$SRC_ROOT/src" ; then
6301         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6302         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6303     fi
6304     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6305 else
6306     AbsolutePath "$TARFILE_LOCATION"
6307     PathFormat "${absolute_path}"
6308     TARFILE_LOCATION="${formatted_path_unix}"
6310 PathFormat "$TARFILE_LOCATION"
6311 TARFILE_LOCATION_NATIVE="$formatted_path"
6312 AC_SUBST(TARFILE_LOCATION)
6313 AC_SUBST(TARFILE_LOCATION_NATIVE)
6315 AC_MSG_CHECKING([whether we want to fetch tarballs])
6316 if test "$enable_fetch_external" != "no"; then
6317     if test "$with_all_tarballs" = "yes"; then
6318         AC_MSG_RESULT([yes, all of them])
6319         DO_FETCH_TARBALLS="ALL"
6320     else
6321         AC_MSG_RESULT([yes, if we use them])
6322         DO_FETCH_TARBALLS="TRUE"
6323     fi
6324 else
6325     AC_MSG_RESULT([no])
6326     DO_FETCH_TARBALLS=
6328 AC_SUBST(DO_FETCH_TARBALLS)
6330 dnl Test whether to include MySpell dictionaries
6331 dnl ===================================================================
6332 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6333 if test "$with_myspell_dicts" = "yes"; then
6334     AC_MSG_RESULT([yes])
6335     WITH_MYSPELL_DICTS=TRUE
6336     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6337     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6338 else
6339     AC_MSG_RESULT([no])
6340     WITH_MYSPELL_DICTS=
6342 AC_SUBST(WITH_MYSPELL_DICTS)
6344 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6345 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6346     if test "$with_system_dicts" = yes; then
6347         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6348     fi
6349     with_system_dicts=no
6352 AC_MSG_CHECKING([whether to use dicts from external paths])
6353 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6354     AC_MSG_RESULT([yes])
6355     SYSTEM_DICTS=TRUE
6356     AC_MSG_CHECKING([for spelling dictionary directory])
6357     if test -n "$with_external_dict_dir"; then
6358         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6359     else
6360         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6361         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6362             DICT_SYSTEM_DIR=file:///usr/share/myspell
6363         fi
6364     fi
6365     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6366     AC_MSG_CHECKING([for hyphenation patterns directory])
6367     if test -n "$with_external_hyph_dir"; then
6368         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6369     else
6370         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6371     fi
6372     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6373     AC_MSG_CHECKING([for thesaurus directory])
6374     if test -n "$with_external_thes_dir"; then
6375         THES_SYSTEM_DIR=file://$with_external_thes_dir
6376     else
6377         THES_SYSTEM_DIR=file:///usr/share/mythes
6378     fi
6379     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6380 else
6381     AC_MSG_RESULT([no])
6382     SYSTEM_DICTS=
6384 AC_SUBST(SYSTEM_DICTS)
6385 AC_SUBST(DICT_SYSTEM_DIR)
6386 AC_SUBST(HYPH_SYSTEM_DIR)
6387 AC_SUBST(THES_SYSTEM_DIR)
6389 dnl ===================================================================
6390 dnl Precompiled headers.
6391 ENABLE_PCH=""
6392 AC_MSG_CHECKING([whether to enable pch feature])
6393 if test -z "$enable_pch"; then
6394     if test "$_os" = "WINNT"; then
6395         # Enabled by default on Windows.
6396         enable_pch=yes
6397         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6398         if test -z "$enable_ccache" -a "$SCCACHE"; then
6399             CCACHE=""
6400         fi
6401     else
6402         enable_pch=no
6403     fi
6405 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6406     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6408 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6409     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6411 if test "$enable_pch" = "system"; then
6412     ENABLE_PCH="1"
6413     AC_MSG_RESULT([yes (system headers)])
6414 elif test "$enable_pch" = "base"; then
6415     ENABLE_PCH="2"
6416     AC_MSG_RESULT([yes (system and base headers)])
6417 elif test "$enable_pch" = "normal"; then
6418     ENABLE_PCH="3"
6419     AC_MSG_RESULT([yes (normal)])
6420 elif test "$enable_pch" = "full"; then
6421     ENABLE_PCH="4"
6422     AC_MSG_RESULT([yes (full)])
6423 elif test "$enable_pch" = "yes"; then
6424     # Pick a suitable default.
6425     if test "$GCC" = "yes"; then
6426         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6427         # while making the PCHs larger and rebuilds more likely.
6428         ENABLE_PCH="2"
6429         AC_MSG_RESULT([yes (system and base headers)])
6430     else
6431         # With MSVC the highest level makes a significant difference,
6432         # and it was the default when there used to be no PCH levels.
6433         ENABLE_PCH="4"
6434         AC_MSG_RESULT([yes (full)])
6435     fi
6436 elif test "$enable_pch" = "no"; then
6437     AC_MSG_RESULT([no])
6438 else
6439     AC_MSG_ERROR([Unknown value for --enable-pch])
6441 AC_SUBST(ENABLE_PCH)
6442 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6443 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6444     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6445     if test "$CCACHE_BIN" != "not found"; then
6446         AC_MSG_CHECKING([ccache version])
6447         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6448         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6449         AC_MSG_RESULT([$CCACHE_VERSION])
6450         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6451         if test "$CCACHE_NUMVER" -gt "030701"; then
6452             AC_MSG_RESULT([yes])
6453         else
6454             AC_MSG_RESULT([no (not newer than 3.7.1)])
6455             CCACHE_DEPEND_MODE=
6456         fi
6457     fi
6460 PCH_INSTANTIATE_TEMPLATES=
6461 if test -n "$ENABLE_PCH"; then
6462     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6463     save_CFLAGS=$CFLAGS
6464     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6465     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6466     CFLAGS=$save_CFLAGS
6467     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6468         AC_MSG_RESULT(yes)
6469     else
6470         AC_MSG_RESULT(no)
6471     fi
6473 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6475 BUILDING_PCH_WITH_OBJ=
6476 if test -n "$ENABLE_PCH"; then
6477     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6478     save_CFLAGS=$CFLAGS
6479     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6480     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6481     CFLAGS=$save_CFLAGS
6482     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6483         AC_MSG_RESULT(yes)
6484     else
6485         AC_MSG_RESULT(no)
6486     fi
6488 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6490 PCH_CODEGEN=
6491 PCH_NO_CODEGEN=
6492 fpch_prefix=
6493 if test "$COM" = MSC; then
6494     fpch_prefix="-Xclang "
6496 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6497     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6498     save_CFLAGS=$CFLAGS
6499     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6500     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6501         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6502     CFLAGS=$save_CFLAGS
6503     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6504     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6505         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6506     CFLAGS=$save_CFLAGS
6507     if test -n "$PCH_CODEGEN"; then
6508         AC_MSG_RESULT(yes)
6509     else
6510         AC_MSG_RESULT(no)
6511     fi
6513 AC_SUBST(PCH_CODEGEN)
6514 AC_SUBST(PCH_NO_CODEGEN)
6515 PCH_DEBUGINFO=
6516 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6517     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6518     save_CFLAGS=$CFLAGS
6519     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6520     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6521     CFLAGS=$save_CFLAGS
6522     if test -n "$PCH_DEBUGINFO"; then
6523         AC_MSG_RESULT(yes)
6524     else
6525         AC_MSG_RESULT(no)
6526     fi
6528 AC_SUBST(PCH_DEBUGINFO)
6530 TAB=`printf '\t'`
6532 AC_MSG_CHECKING([the GNU Make version])
6533 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6534 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6535 if test "$_make_longver" -ge "040000"; then
6536     AC_MSG_RESULT([$GNUMAKE $_make_version])
6537 else
6538     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6541 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6542 STALE_MAKE=
6543 if test "$_make_ver_check" = ""; then
6544    STALE_MAKE=TRUE
6547 HAVE_LD_HASH_STYLE=FALSE
6548 WITH_LINKER_HASH_STYLE=
6549 AC_MSG_CHECKING([for --hash-style gcc linker support])
6550 if test "$GCC" = "yes"; then
6551     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6552         hash_styles="gnu sysv"
6553     elif test "$with_linker_hash_style" = "no"; then
6554         hash_styles=
6555     else
6556         hash_styles="$with_linker_hash_style"
6557     fi
6559     for hash_style in $hash_styles; do
6560         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6561         hash_style_ldflags_save=$LDFLAGS
6562         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6564         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6565             [
6566 #include <stdio.h>
6567             ],[
6568 printf ("");
6569             ])],
6570             [
6571                   HAVE_LD_HASH_STYLE=TRUE
6572                   WITH_LINKER_HASH_STYLE=$hash_style
6573             ],
6574             [HAVE_LD_HASH_STYLE=FALSE],
6575             [HAVE_LD_HASH_STYLE=FALSE])
6576         LDFLAGS=$hash_style_ldflags_save
6577     done
6579     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6580         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6581     else
6582         AC_MSG_RESULT( no )
6583     fi
6584     LDFLAGS=$hash_style_ldflags_save
6585 else
6586     AC_MSG_RESULT( no )
6588 AC_SUBST(HAVE_LD_HASH_STYLE)
6589 AC_SUBST(WITH_LINKER_HASH_STYLE)
6591 dnl ===================================================================
6592 dnl Check whether there's a Perl version available.
6593 dnl ===================================================================
6594 if test -z "$with_perl_home"; then
6595     AC_PATH_PROG(PERL, perl)
6596 else
6597     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6598     _perl_path="$with_perl_home/bin/perl"
6599     if test -x "$_perl_path"; then
6600         PERL=$_perl_path
6601     else
6602         AC_MSG_ERROR([$_perl_path not found])
6603     fi
6606 dnl ===================================================================
6607 dnl Testing for Perl version 5 or greater.
6608 dnl $] is the Perl version variable, it is returned as an integer
6609 dnl ===================================================================
6610 if test "$PERL"; then
6611     AC_MSG_CHECKING([the Perl version])
6612     ${PERL} -e "exit($]);"
6613     _perl_version=$?
6614     if test "$_perl_version" -lt 5; then
6615         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6616     fi
6617     AC_MSG_RESULT([Perl $_perl_version])
6618 else
6619     AC_MSG_ERROR([Perl not found, install Perl 5])
6622 dnl ===================================================================
6623 dnl Testing for required Perl modules
6624 dnl ===================================================================
6626 AC_MSG_CHECKING([for required Perl modules])
6627 perl_use_string="use Cwd ; use Digest::MD5"
6628 if test "$_os" = "WINNT"; then
6629     if test -n "$PKGFORMAT"; then
6630         for i in $PKGFORMAT; do
6631             case "$i" in
6632             msi)
6633                 # for getting fonts versions to use in MSI
6634                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6635                 ;;
6636             esac
6637         done
6638     fi
6640 if test "$with_system_hsqldb" = "yes"; then
6641     perl_use_string="$perl_use_string ; use Archive::Zip"
6643 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6644     # OpenSSL needs that to build
6645     perl_use_string="$perl_use_string ; use FindBin"
6647 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6648     AC_MSG_RESULT([all modules found])
6649 else
6650     AC_MSG_RESULT([failed to find some modules])
6651     # Find out which modules are missing.
6652     for i in $perl_use_string; do
6653         if test "$i" != "use" -a "$i" != ";"; then
6654             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6655                 missing_perl_modules="$missing_perl_modules $i"
6656             fi
6657         fi
6658     done
6659     AC_MSG_ERROR([
6660     The missing Perl modules are: $missing_perl_modules
6661     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6664 dnl ===================================================================
6665 dnl Check for pkg-config
6666 dnl ===================================================================
6667 if test "$_os" != "WINNT"; then
6668     PKG_PROG_PKG_CONFIG
6670 AC_SUBST(PKG_CONFIG)
6671 AC_SUBST(PKG_CONFIG_PATH)
6672 AC_SUBST(PKG_CONFIG_LIBDIR)
6674 if test "$_os" != "WINNT"; then
6676     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6677     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6678     # explicitly. Or put /path/to/compiler in PATH yourself.
6680     toolprefix=gcc
6681     if test "$COM_IS_CLANG" = "TRUE"; then
6682         toolprefix=llvm
6683     fi
6684     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6685     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6686     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6687     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6688     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6689     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6691 AC_SUBST(AR)
6692 AC_SUBST(NM)
6693 AC_SUBST(OBJDUMP)
6694 AC_SUBST(RANLIB)
6695 AC_SUBST(READELF)
6696 AC_SUBST(STRIP)
6698 dnl ===================================================================
6699 dnl pkg-config checks on macOS
6700 dnl ===================================================================
6702 if test $_os = Darwin; then
6703     AC_MSG_CHECKING([for bogus pkg-config])
6704     if test -n "$PKG_CONFIG"; then
6705         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6706             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6707         else
6708             if test "$enable_bogus_pkg_config" = "yes"; then
6709                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6710             else
6711                 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.])
6712             fi
6713         fi
6714     else
6715         AC_MSG_RESULT([no, good])
6716     fi
6719 find_csc()
6721     # Return value: $csctest
6723     unset csctest
6725     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6726     if test -n "$regvalue"; then
6727         csctest=$regvalue
6728         return
6729     fi
6732 find_al()
6734     # Return value: $altest
6736     unset altest
6738     # We need this check to detect 4.6.1 or above.
6739     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6740         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6741         PathFormat "$regvalue"
6742         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6743             altest=$regvalue
6744             return
6745         fi
6746     done
6748     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6749     for x in $reglist; do
6750         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6751         PathFormat "$regvalue"
6752         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6753             altest=$regvalue
6754             return
6755         fi
6756     done
6759 find_dotnetsdk()
6761     unset frametest
6763     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
6764         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6765         if test -n "$regvalue"; then
6766             frametest=$regvalue
6767             return
6768         fi
6769     done
6770     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6773 find_winsdk_version()
6775     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6776     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6778     unset winsdktest winsdkbinsubdir winsdklibsubdir
6780     case "$1" in
6781     8.0|8.0A)
6782         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6783         if test -n "$regvalue"; then
6784             winsdktest=$regvalue
6785             winsdklibsubdir=win8
6786             return
6787         fi
6788         ;;
6789     8.1|8.1A)
6790         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6791         if test -n "$regvalue"; then
6792             winsdktest=$regvalue
6793             winsdklibsubdir=winv6.3
6794             return
6795         fi
6796         ;;
6797     10.0)
6798         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
6799         if test -n "$regvalue"; then
6800             winsdktest=$regvalue
6801             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
6802             if test -n "$regvalue"; then
6803                 winsdkbinsubdir="$regvalue".0
6804                 winsdklibsubdir=$winsdkbinsubdir
6805                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6806                 PathFormat "$tmppath"
6807                 local tmppath_unix=$formatted_path_unix
6808                 # test exist the SDK path
6809                 if test ! -d "$tmppath_unix"; then
6810                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6811                 fi
6812             fi
6813             return
6814         fi
6815         ;;
6816     esac
6819 find_winsdk()
6821     # Return value: From find_winsdk_version
6823     unset winsdktest
6825     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6826         find_winsdk_version $ver
6827         if test -n "$winsdktest"; then
6828             return
6829         fi
6830     done
6833 find_msms()
6835     # Return value: $msmdir
6836     local version="$1"
6838     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6839     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6840     local my_msm_dir
6842     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6844     msmdir=
6845     case "$VCVER" in
6846     16.0 | 17.0 | 17.10)
6847         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6848             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6849             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6850             if test -e "$my_msm_dir${my_msm_file}"; then
6851                 msmdir=$my_msm_dir
6852             fi
6853         done
6854         ;;
6855     esac
6857     if test -n "$msmdir"; then
6858         msmdir=`cygpath -m "$msmdir"`
6859         AC_MSG_RESULT([$msmdir])
6860     else
6861         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6862             AC_MSG_FAILURE([not found])
6863         else
6864             AC_MSG_WARN([not found (check config.log)])
6865             add_warning "MSM ${my_msm_file} not found"
6866         fi
6867     fi
6870 find_msvc_x64_dlls()
6872     # Return value: $msvcdllpath, $msvcdlls
6874     AC_MSG_CHECKING([for MSVC x64 DLL path])
6876     dnl Order crtver in increasing order. Then check the directories returned by
6877     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6878     dnl the result will be the highest CRT version found in the highest directory.
6880     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6881     case "$VCVER" in
6882     16.0 | 17.0 | 17.10)
6883         for crtver in 141 142 143; do
6884             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6885                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6886                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6887                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6888                 fi
6889             done
6890         done
6891         ;;
6892     esac
6893     AC_MSG_RESULT([$msvcdllpath])
6894     AC_MSG_CHECKING([for MSVC x64 DLLs])
6895     msvcdlls="msvcp140.dll vcruntime140.dll"
6896     for dll in $msvcdlls; do
6897         if ! test -f "$msvcdllpath/$dll"; then
6898             AC_MSG_FAILURE([missing $dll])
6899         fi
6900     done
6901     AC_MSG_RESULT([found all ($msvcdlls)])
6904 dnl =========================================
6905 dnl Check for the Windows  SDK.
6906 dnl =========================================
6907 if test "$_os" = "WINNT"; then
6908     AC_MSG_CHECKING([for Windows SDK])
6909     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6910         find_winsdk
6911         WINDOWS_SDK_HOME=$winsdktest
6913         # normalize if found
6914         if test -n "$WINDOWS_SDK_HOME"; then
6915             PathFormat "$WINDOWS_SDK_HOME"
6916             WINDOWS_SDK_HOME=$formatted_path_unix
6917         fi
6919         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6920         # The variable also contains the Windows SDK version
6921         echo $WINDOWS_SDK_LIB_SUBDIR
6922         IFS='.' read -r SDK_v1 SDK_v2 SDK_v3 SDK_v4 <<< "$WINDOWS_SDK_LIB_SUBDIR"
6923         # Assuming maximum of 5 digits for each part and ignoring last part
6924         SDK_NORMALIZED_VER=$((SDK_v1 * 10000000000 + SDK_v2 * 100000 + SDK_v3))
6925         # 10.0.20348.0 is the minimum required version
6926         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
6927             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
6928         fi
6929     fi
6931     if test -n "$WINDOWS_SDK_HOME"; then
6932         # Remove a possible trailing backslash
6933         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6935         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6936              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6937              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6938             have_windows_sdk_headers=yes
6939         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6940              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6941              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6942             have_windows_sdk_headers=yes
6943         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6944              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6945              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6946             have_windows_sdk_headers=yes
6947         else
6948             have_windows_sdk_headers=no
6949         fi
6951         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6952             have_windows_sdk_libs=yes
6953         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6954             have_windows_sdk_libs=yes
6955         else
6956             have_windows_sdk_libs=no
6957         fi
6959         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6960             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6961 the  Windows SDK are installed.])
6962         fi
6963     fi
6965     if test -z "$WINDOWS_SDK_HOME"; then
6966         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6967     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6968         WINDOWS_SDK_VERSION=80
6969         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6970     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6971         WINDOWS_SDK_VERSION=81
6972         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6973     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6974         WINDOWS_SDK_VERSION=10
6975         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6976     else
6977         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6978     fi
6979     PathFormat "$WINDOWS_SDK_HOME"
6980     WINDOWS_SDK_HOME="$formatted_path"
6981     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6982     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6983         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6984         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
6985             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6986         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
6987             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6988         fi
6989     fi
6991     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6992     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6993     dnl but not in v8.0), so allow this to be overridden with a
6994     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6995     dnl and configuration error if no WiLangId.vbs is found would arguably be
6996     dnl better, but I do not know under which conditions exactly it is needed by
6997     dnl msiglobal.pm:
6998     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6999         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
7000         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7001             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
7002         fi
7003         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7004             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
7005         fi
7006         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7007             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
7008         fi
7009         PathFormat "$WINDOWS_SDK_WILANGID_unix"
7010         WINDOWS_SDK_WILANGID="$formatted_path"
7011     fi
7012     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
7013         if test -n "$with_package_format" -a "$with_package_format" != no; then
7014             for i in "$with_package_format"; do
7015                 if test "$i" = "msi"; then
7016                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
7017                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
7018                     fi
7019                 fi
7020             done
7021         fi
7022     fi
7024 AC_SUBST(WINDOWS_SDK_HOME)
7025 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7026 AC_SUBST(WINDOWS_SDK_VERSION)
7027 AC_SUBST(WINDOWS_SDK_WILANGID)
7029 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7030     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7031     dnl dir, it also determines that dir's path w/o an arch segment if any,
7032     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7033     AC_MSG_CHECKING([for midl.exe])
7035     find_winsdk
7036     PathFormat "$winsdktest"
7037     winsdktest_unix="$formatted_path_unix"
7039     if test -n "$winsdkbinsubdir" \
7040         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7041     then
7042         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7043         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7044     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7045         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7046         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7047     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7048         MIDL_PATH=$winsdktest_unix/Bin
7049         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7050     fi
7051     PathFormat "$MIDL_PATH"
7052     if test ! -f "$formatted_path_unix/midl.exe"; then
7053         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7054     else
7055         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7056     fi
7058     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7059     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7061     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7062          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7063          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7064          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7065     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7066          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7067          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7068          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7069     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7070          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7071          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7072          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7073     else
7074         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7075     fi
7077     dnl Check csc.exe
7078     AC_MSG_CHECKING([for csc.exe])
7079     find_csc
7080     PathFormat "$csctest"
7081     csctest_unix="$formatted_path_unix"
7082     if test -f "$csctest_unix/csc.exe"; then
7083         CSC_PATH="$csctest"
7084     fi
7085     if test ! -f "$csctest_unix/csc.exe"; then
7086         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7087     else
7088         AC_MSG_RESULT([$CSC_PATH/csc.exe])
7089     fi
7091     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7093     dnl Check al.exe
7094     AC_MSG_CHECKING([for al.exe])
7095     if test -n "$winsdkbinsubdir" \
7096         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7097     then
7098         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7099     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7100         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7101     elif test -f "$winsdktest_unix/Bin/al.exe"; then
7102         AL_PATH="$winsdktest/Bin"
7103     fi
7105     if test -z "$AL_PATH"; then
7106         find_al
7107         PathFormat "$altest"
7108         altest_unix="$formatted_path_unix"
7109         if test -f "$altest_unix/bin/al.exe"; then
7110             AL_PATH="$altest/bin"
7111         elif test -f "$altest_unix/al.exe"; then
7112             AL_PATH="$altest"
7113         fi
7114     fi
7115     PathFormat "$AL_PATH"
7116     if test ! -f "$formatted_path_unix/al.exe"; then
7117         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7118     else
7119         AC_MSG_RESULT([$AL_PATH/al.exe])
7120     fi
7122     AL_PATH=`win_short_path_for_make "$AL_PATH"`
7124     dnl Check mscoree.lib / .NET Framework dir
7125     AC_MSG_CHECKING(.NET Framework)
7126     find_dotnetsdk
7127     PathFormat "$frametest"
7128     frametest="$formatted_path_unix"
7129     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7130         DOTNET_FRAMEWORK_HOME="$frametest"
7131     else
7132         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7133             DOTNET_FRAMEWORK_HOME="$winsdktest"
7134         fi
7135     fi
7136     PathFormat "$DOTNET_FRAMEWORK_HOME"
7137     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
7138         AC_MSG_ERROR([mscoree.lib not found])
7139     fi
7140     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7142     PathFormat "$MIDL_PATH"
7143     MIDL_PATH="$formatted_path"
7145     PathFormat "$AL_PATH"
7146     AL_PATH="$formatted_path"
7148     PathFormat "$DOTNET_FRAMEWORK_HOME"
7149     DOTNET_FRAMEWORK_HOME="$formatted_path"
7151     PathFormat "$CSC_PATH"
7152     CSC_PATH="$formatted_path"
7155 dnl ===================================================================
7156 dnl Testing for C++ compiler and version...
7157 dnl ===================================================================
7159 if test "$_os" != "WINNT"; then
7160     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7161     # see AC_PROG_CC above):
7162     save_CXXFLAGS=$CXXFLAGS
7163     CXXFLAGS=-g
7164     AC_PROG_CXX
7165     CXXFLAGS=$save_CXXFLAGS
7166     if test -z "$CXX_BASE"; then
7167         CXX_BASE=`first_arg_basename "$CXX"`
7168     fi
7171 dnl check for GNU C++ compiler version
7172 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7173     AC_MSG_CHECKING([the GNU C++ compiler version])
7175     _gpp_version=`$CXX -dumpversion`
7176     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7178     if test "$_gpp_majmin" -lt "700"; then
7179         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7180     else
7181         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7182     fi
7184     dnl see https://issuetracker.google.com/issues/36962819
7185         glibcxx_threads=no
7186         AC_LANG_PUSH([C++])
7187         AC_REQUIRE_CPP
7188         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7189         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7190             #include <bits/c++config.h>]],[[
7191             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7192             && !defined(_GLIBCXX__PTHREADS) \
7193             && !defined(_GLIBCXX_HAS_GTHREADS)
7194             choke me
7195             #endif
7196         ]])],[AC_MSG_RESULT([yes])
7197         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7198         AC_LANG_POP([C++])
7199         if test $glibcxx_threads = yes; then
7200             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7201         fi
7203 AC_SUBST(BOOST_CXXFLAGS)
7206 # prefx CXX with ccache if needed
7208 if test "$CCACHE" != ""; then
7209     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7210     AC_LANG_PUSH([C++])
7211     save_CXXFLAGS=$CXXFLAGS
7212     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7213     # msvc does not fail on unknown options, check stdout
7214     if test "$COM" = MSC; then
7215         CXXFLAGS="$CXXFLAGS -nologo"
7216     fi
7217     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7218     ac_cxx_werror_flag=yes
7219     dnl an empty program will do, we're checking the compiler flags
7220     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7221                       [use_ccache=yes], [use_ccache=no])
7222     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7223         AC_MSG_RESULT([yes])
7224     else
7225         CXX="$CCACHE $CXX"
7226         CXX_BASE="ccache $CXX_BASE"
7227         AC_MSG_RESULT([no])
7228     fi
7229     CXXFLAGS=$save_CXXFLAGS
7230     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7231     AC_LANG_POP([C++])
7234 dnl ===================================================================
7235 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7236 dnl ===================================================================
7238 if test "$_os" != "WINNT"; then
7239     AC_PROG_CXXCPP
7241     dnl Check whether there's a C pre-processor.
7242     AC_PROG_CPP
7246 dnl ===================================================================
7247 dnl Find integral type sizes and alignments
7248 dnl ===================================================================
7250 if test "$_os" != "WINNT"; then
7252     AC_CHECK_SIZEOF(long)
7253     AC_CHECK_SIZEOF(short)
7254     AC_CHECK_SIZEOF(int)
7255     AC_CHECK_SIZEOF(long long)
7256     AC_CHECK_SIZEOF(double)
7257     AC_CHECK_SIZEOF(void*)
7258     AC_CHECK_SIZEOF(size_t)
7260     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7261     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7262     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7263     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7264     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7265     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7267     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7268     m4_pattern_allow([AC_CHECK_ALIGNOF])
7269     m4_ifdef([AC_CHECK_ALIGNOF],
7270         [
7271             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7272             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7273             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7274             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7275         ],
7276         [
7277             case "$_os-$host_cpu" in
7278             Linux-i686)
7279                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7280                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7281                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7282                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7283                 ;;
7284             Linux-x86_64)
7285                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7286                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7287                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7288                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7289                 ;;
7290             *)
7291                 if test -z "$ac_cv_alignof_short" -o \
7292                         -z "$ac_cv_alignof_int" -o \
7293                         -z "$ac_cv_alignof_long" -o \
7294                         -z "$ac_cv_alignof_double"; then
7295                    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.])
7296                 fi
7297                 ;;
7298             esac
7299         ])
7301     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7302     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7303     if test $ac_cv_sizeof_long -eq 8; then
7304         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7305     elif test $ac_cv_sizeof_double -eq 8; then
7306         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7307     else
7308         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7309     fi
7311     dnl Check for large file support
7312     AC_SYS_LARGEFILE
7313     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
7314         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7315     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7316         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7317     fi
7318     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7319         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7320     fi
7321 else
7322     # Hardcode for MSVC
7323     SAL_TYPES_SIZEOFSHORT=2
7324     SAL_TYPES_SIZEOFINT=4
7325     SAL_TYPES_SIZEOFLONG=4
7326     SAL_TYPES_SIZEOFLONGLONG=8
7327     if test $WIN_HOST_BITS -eq 32; then
7328         SAL_TYPES_SIZEOFPOINTER=4
7329         SIZEOF_SIZE_T=4
7330     else
7331         SAL_TYPES_SIZEOFPOINTER=8
7332         SIZEOF_SIZE_T=8
7333     fi
7334     SAL_TYPES_ALIGNMENT2=2
7335     SAL_TYPES_ALIGNMENT4=4
7336     SAL_TYPES_ALIGNMENT8=8
7337     LFS_CFLAGS=''
7339 AC_SUBST(LFS_CFLAGS)
7340 AC_SUBST(SIZEOF_SIZE_T)
7342 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7343 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7344 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7345 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7346 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7347 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7348 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7349 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7351 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7352 AC_MSG_CHECKING([whether jumbo sheets are supported])
7353 if test "$_os" != "WINNT"; then
7354     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7355         AC_MSG_RESULT([yes])
7356         ENABLE_JUMBO_SHEETS=TRUE
7357         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7358     else
7359         AC_MSG_RESULT([no])
7360     fi
7361 else
7362     if test $WIN_HOST_BITS -gt 32; then
7363         # 64bit windows is special-cased for tools::Long because long is 32bit
7364         AC_MSG_RESULT([yes])
7365         ENABLE_JUMBO_SHEETS=TRUE
7366         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7367     else
7368         AC_MSG_RESULT([no])
7369     fi
7371 AC_SUBST(ENABLE_JUMBO_SHEETS)
7373 dnl ===================================================================
7374 dnl Check whether to enable runtime optimizations
7375 dnl ===================================================================
7376 ENABLE_RUNTIME_OPTIMIZATIONS=
7377 AC_MSG_CHECKING([whether to enable runtime optimizations])
7378 if test -z "$enable_runtime_optimizations"; then
7379     for i in $CC; do
7380         case $i in
7381         -fsanitize=*)
7382             enable_runtime_optimizations=no
7383             break
7384             ;;
7385         esac
7386     done
7388 if test "$enable_runtime_optimizations" != no; then
7389     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7390     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7391     AC_MSG_RESULT([yes])
7392 else
7393     AC_MSG_RESULT([no])
7395 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7397 dnl ===================================================================
7398 dnl Check if valgrind headers are available
7399 dnl ===================================================================
7400 ENABLE_VALGRIND=
7401 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7402     prev_cppflags=$CPPFLAGS
7403     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7404     # or where does it come from?
7405     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7406     AC_CHECK_HEADER([valgrind/valgrind.h],
7407         [ENABLE_VALGRIND=TRUE])
7408     CPPFLAGS=$prev_cppflags
7410 AC_SUBST([ENABLE_VALGRIND])
7411 if test -z "$ENABLE_VALGRIND"; then
7412     if test "$with_valgrind" = yes; then
7413         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7414     fi
7415     VALGRIND_CFLAGS=
7417 AC_SUBST([VALGRIND_CFLAGS])
7420 dnl ===================================================================
7421 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7422 dnl ===================================================================
7424 # We need at least the sys/sdt.h include header.
7425 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7426 if test "$SDT_H_FOUND" = "TRUE"; then
7427     # Found sys/sdt.h header, now make sure the c++ compiler works.
7428     # Old g++ versions had problems with probes in constructors/destructors.
7429     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7430     AC_LANG_PUSH([C++])
7431     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7432     #include <sys/sdt.h>
7433     class ProbeClass
7434     {
7435     private:
7436       int& ref;
7437       const char *name;
7439     public:
7440       ProbeClass(int& v, const char *n) : ref(v), name(n)
7441       {
7442         DTRACE_PROBE2(_test_, cons, name, ref);
7443       }
7445       void method(int min)
7446       {
7447         DTRACE_PROBE3(_test_, meth, name, ref, min);
7448         ref -= min;
7449       }
7451       ~ProbeClass()
7452       {
7453         DTRACE_PROBE2(_test_, dest, name, ref);
7454       }
7455     };
7456     ]],[[
7457     int i = 64;
7458     DTRACE_PROBE1(_test_, call, i);
7459     ProbeClass inst = ProbeClass(i, "call");
7460     inst.method(24);
7461     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7462           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7463     AC_LANG_POP([C++])
7465 AC_CONFIG_HEADERS([config_host/config_probes.h])
7467 dnl ===================================================================
7468 dnl GCC features
7469 dnl ===================================================================
7470 HAVE_GCC_STACK_CLASH_PROTECTION=
7471 HARDENING_CFLAGS=
7472 HARDENING_OPT_CFLAGS=
7473 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7474     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7475     save_CFLAGS=$CFLAGS
7476     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7477     AC_LINK_IFELSE(
7478         [AC_LANG_PROGRAM(, [[return 0;]])],
7479         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7480         [AC_MSG_RESULT([no])])
7481     CFLAGS=$save_CFLAGS
7483     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7484     save_CFLAGS=$CFLAGS
7485     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7486     if test "$ENABLE_OPTIMIZED" = TRUE; then
7487         CFLAGS="$CFLAGS -O2"
7488     fi
7489     AC_LINK_IFELSE(
7490         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7491         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7492         [AC_MSG_RESULT([no])])
7493     CFLAGS=$save_CFLAGS
7495     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7496     save_CFLAGS=$CFLAGS
7497     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7498     AC_LINK_IFELSE(
7499         [AC_LANG_PROGRAM(, [[return 0;]])],
7500         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7501         [AC_MSG_RESULT([no])])
7502     CFLAGS=$save_CFLAGS
7504     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7505     save_CFLAGS=$CFLAGS
7506     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7507     AC_LINK_IFELSE(
7508         [AC_LANG_PROGRAM(, [[return 0;]])],
7509         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7510         [AC_MSG_RESULT([no])])
7511     CFLAGS=$save_CFLAGS
7513     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7514     save_CFLAGS=$CFLAGS
7515     CFLAGS="$CFLAGS -Werror -fcf-protection"
7516     AC_LINK_IFELSE(
7517         [AC_LANG_PROGRAM(, [[return 0;]])],
7518         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7519         [AC_MSG_RESULT([no])])
7520     CFLAGS=$save_CFLAGS
7522     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7523     save_CFLAGS=$CFLAGS
7524     CFLAGS="$CFLAGS -Werror -mno-avx"
7525     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7526     CFLAGS=$save_CFLAGS
7527     if test "$HAVE_GCC_AVX" = "TRUE"; then
7528         AC_MSG_RESULT([yes])
7529     else
7530         AC_MSG_RESULT([no])
7531     fi
7533     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7534     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7535     int v = 0;
7536     if (__sync_add_and_fetch(&v, 1) != 1 ||
7537         __sync_sub_and_fetch(&v, 1) != 0)
7538         return 1;
7539     __sync_synchronize();
7540     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7541         v != 1)
7542         return 1;
7543     return 0;
7544 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7545     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7546         AC_MSG_RESULT([yes])
7547         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7548     else
7549         AC_MSG_RESULT([no])
7550     fi
7552     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7553     AC_LANG_PUSH([C++])
7554     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7555             #include <cstddef>
7556             #include <cxxabi.h>
7557             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7558         ])], [
7559             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7560             AC_MSG_RESULT([yes])
7561         ], [AC_MSG_RESULT([no])])
7562     AC_LANG_POP([C++])
7564     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7565     AC_LANG_PUSH([C++])
7566     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7567             #include <cstddef>
7568             #include <cxxabi.h>
7569             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7570         ])], [
7571             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7572             AC_MSG_RESULT([yes])
7573         ], [AC_MSG_RESULT([no])])
7574     AC_LANG_POP([C++])
7576     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7577     AC_LANG_PUSH([C++])
7578     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7579             #include <cxxabi.h>
7580             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7581         ])], [
7582             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7583             AC_MSG_RESULT([yes])
7584         ], [AC_MSG_RESULT([no])])
7585     AC_LANG_POP([C++])
7587     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7588     AC_LANG_PUSH([C++])
7589     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7590             #include <cstddef>
7591             #include <cxxabi.h>
7592             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7593         ])], [
7594             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7595             AC_MSG_RESULT([yes])
7596         ], [AC_MSG_RESULT([no])])
7597     AC_LANG_POP([C++])
7599     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7600     AC_LANG_PUSH([C++])
7601     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7602             #include <cstddef>
7603             #include <cxxabi.h>
7604             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7605         ])], [
7606             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7607             AC_MSG_RESULT([yes])
7608         ], [AC_MSG_RESULT([no])])
7609     AC_LANG_POP([C++])
7611     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7612     AC_LANG_PUSH([C++])
7613     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7614             #include <cxxabi.h>
7615             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7616         ])], [
7617             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7618             AC_MSG_RESULT([yes])
7619         ], [AC_MSG_RESULT([no])])
7620     AC_LANG_POP([C++])
7622     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7623     AC_LANG_PUSH([C++])
7624     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7625             #include <cxxabi.h>
7626             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7627         ])], [
7628             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7629             AC_MSG_RESULT([yes])
7630         ], [AC_MSG_RESULT([no])])
7631     AC_LANG_POP([C++])
7633     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7634     AC_LANG_PUSH([C++])
7635     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7636             #include <cxxabi.h>
7637             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7638         ])], [
7639             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7640             AC_MSG_RESULT([yes])
7641         ], [AC_MSG_RESULT([no])])
7642     AC_LANG_POP([C++])
7644     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7645     AC_LANG_PUSH([C++])
7646     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7647             #include <cstddef>
7648             #include <cxxabi.h>
7649             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7650         ])], [
7651             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7652             AC_MSG_RESULT([yes])
7653         ], [AC_MSG_RESULT([no])])
7654     AC_LANG_POP([C++])
7656     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7657     AC_LANG_PUSH([C++])
7658     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7659             #include <cstddef>
7660             #include <cxxabi.h>
7661             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7662         ])], [
7663             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7664             AC_MSG_RESULT([yes])
7665         ], [AC_MSG_RESULT([no])])
7666     AC_LANG_POP([C++])
7669 AC_SUBST(HAVE_GCC_AVX)
7670 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7671 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7672 AC_SUBST(HARDENING_CFLAGS)
7673 AC_SUBST(HARDENING_OPT_CFLAGS)
7675 dnl ===================================================================
7676 dnl Identify the C++ library
7677 dnl ===================================================================
7679 AC_MSG_CHECKING([what the C++ library is])
7680 HAVE_LIBSTDCPP=
7681 HAVE_LIBCPP=
7682 AC_LANG_PUSH([C++])
7683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7684 #include <utility>
7685 #ifndef __GLIBCXX__
7686 foo bar
7687 #endif
7688 ]])],
7689     [CPP_LIBRARY=GLIBCXX
7690      cpp_library_name="GNU libstdc++"
7691      HAVE_LIBSTDCPP=TRUE
7692     ],
7693     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7694 #include <utility>
7695 #ifndef _LIBCPP_VERSION
7696 foo bar
7697 #endif
7698 ]])],
7699     [CPP_LIBRARY=LIBCPP
7700      cpp_library_name="LLVM libc++"
7701      AC_DEFINE([HAVE_LIBCPP])
7702      HAVE_LIBCPP=TRUE
7703     ],
7704     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7705 #include <utility>
7706 #ifndef _MSC_VER
7707 foo bar
7708 #endif
7709 ]])],
7710     [CPP_LIBRARY=MSVCRT
7711      cpp_library_name="Microsoft"
7712     ],
7713     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7714 AC_MSG_RESULT([$cpp_library_name])
7715 AC_LANG_POP([C++])
7716 AC_SUBST([HAVE_LIBSTDCPP])
7717 AC_SUBST([HAVE_LIBCPP])
7719 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7720 then
7721     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7722     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7723     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7724     # although there will be backwards compatibility).
7725     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7726     # and there would be undefined references to debug functions.
7727     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7728     # So check if debug mode can be used and disable or downgrade it to assertions
7729     # if needed.
7730     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7731     AC_LANG_PUSH([C++])
7732     libcpp_debug_links=
7733     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7734 #define _LIBCPP_DEBUG 0 // only assertions
7735 #include <vector>
7736 int main()
7738     std::vector<int> v;
7739     v.push_back( 1 );
7740     return v[ 3 ];
7742 ]])], [libcpp_debug_links=1])
7743     if test -n "$libcpp_debug_links"; then
7744         # we can use at least assertions, check if debug mode works
7745         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7746 #define _LIBCPP_DEBUG 1 // debug mode
7747 #include <string>
7748 #include <vector>
7749 int foo(const std::vector<int>& v) { return *v.begin(); }
7750 int main()
7752     std::vector<int> v;
7753     v.push_back( 1 );
7754     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7755     return (foo(v) + s.size()) != 0 ? 0 : 1;
7757 ]])],
7758         [AC_MSG_RESULT(yes)
7759          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7760         ],
7761         [AC_MSG_RESULT(no, using only assertions)
7762          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7763         ]
7764         )
7765     else
7766         AC_MSG_RESULT(no)
7767     fi
7768     AC_LANG_POP([C++])
7770 AC_SUBST([LIBCPP_DEBUG])
7772 dnl ===================================================================
7773 dnl Check for gperf
7774 dnl ===================================================================
7775 AC_PATH_PROG(GPERF, gperf)
7776 if test -z "$GPERF"; then
7777     AC_MSG_ERROR([gperf not found but needed. Install it.])
7779 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7780     GPERF=`cygpath -m $GPERF`
7782 AC_MSG_CHECKING([whether gperf is new enough])
7783 my_gperf_ver1=$($GPERF --version | head -n 1)
7784 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7785 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7786 if test "$my_gperf_ver3" -ge 301; then
7787     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7788 else
7789     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7791 AC_SUBST(GPERF)
7793 dnl ===================================================================
7794 dnl Check for system libcmis
7795 dnl ===================================================================
7796 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7798 dnl ===================================================================
7799 dnl C++11
7800 dnl ===================================================================
7802 if test -z "${CXXFLAGS_CXX11+x}"; then
7803     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7804     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7805         if test "$with_latest_c__" = yes; then
7806             CXXFLAGS_CXX11=-std:c++latest
7807         else
7808             CXXFLAGS_CXX11=-std:c++20
7809         fi
7810         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7811     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7812         my_flags='-std=c++20 -std=c++2a'
7813         if test "$with_latest_c__" = yes; then
7814             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7815         fi
7816         for flag in $my_flags; do
7817             if test "$COM" = MSC; then
7818                 flag="-Xclang $flag"
7819             fi
7820             save_CXXFLAGS=$CXXFLAGS
7821             CXXFLAGS="$CXXFLAGS $flag -Werror"
7822             AC_LANG_PUSH([C++])
7823             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7824                 #include <algorithm>
7825                 #include <functional>
7826                 #include <vector>
7828                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7829                     std::sort(v.begin(), v.end(), fn);
7830                 }
7831                 ]])],[CXXFLAGS_CXX11=$flag])
7832             AC_LANG_POP([C++])
7833             CXXFLAGS=$save_CXXFLAGS
7834             if test -n "$CXXFLAGS_CXX11"; then
7835                 break
7836             fi
7837         done
7838     fi
7839     if test -n "$CXXFLAGS_CXX11"; then
7840         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7841     else
7842         AC_MSG_ERROR(no)
7843     fi
7845 AC_SUBST(CXXFLAGS_CXX11)
7847 if test "$GCC" = "yes"; then
7848     save_CXXFLAGS=$CXXFLAGS
7849     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7850     CHECK_L_ATOMIC
7851     CXXFLAGS=$save_CXXFLAGS
7852     AC_SUBST(ATOMIC_LIB)
7855 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7856 save_CXXFLAGS=$CXXFLAGS
7857 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7858 AC_LANG_PUSH([C++])
7860 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7861 #include <stddef.h>
7863 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7865 namespace
7867         struct b
7868         {
7869                 int i;
7870                 int j;
7871         };
7873 ]], [[
7874 struct a
7876         int i;
7877         int j;
7879 a thinga[]={{0,0}, {1,1}};
7880 b thingb[]={{0,0}, {1,1}};
7881 size_t i = sizeof(sal_n_array_size(thinga));
7882 size_t j = sizeof(sal_n_array_size(thingb));
7883 return !(i != 0 && j != 0);
7885     ], [ AC_MSG_RESULT(yes) ],
7886     [ AC_MSG_ERROR(no)])
7887 AC_LANG_POP([C++])
7888 CXXFLAGS=$save_CXXFLAGS
7890 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7891 if test "$GCC" = yes; then
7892     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7893     AC_LANG_PUSH([C++])
7894     save_CXXFLAGS=$CXXFLAGS
7895     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7896     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7897     CXXFLAGS=$save_CXXFLAGS
7898     AC_LANG_POP([C++])
7899     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7900         AC_MSG_RESULT([yes])
7901     else
7902         AC_MSG_RESULT([no])
7903     fi
7905 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7907 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7908 AC_LANG_PUSH([C++])
7909 save_CXXFLAGS=$CXXFLAGS
7910 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7911 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7912         #include <algorithm>
7913         #include <initializer_list>
7914         #include <vector>
7915         template<typename T> class S {
7916         private:
7917             std::vector<T> v_;
7918         public:
7919             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7920         };
7921         constinit S<int> s{3, 2, 1};
7922     ])], [
7923         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7924         AC_MSG_RESULT([yes])
7925     ], [AC_MSG_RESULT([no])])
7926 CXXFLAGS=$save_CXXFLAGS
7927 AC_LANG_POP([C++])
7929 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7930 AC_LANG_PUSH([C++])
7931 save_CXXFLAGS=$CXXFLAGS
7932 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7933 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7934         struct S1 { S1(S1 &&); };
7935         struct S2: S1 {};
7936         S1 f(S2 s) { return s; }
7937     ])], [
7938         AC_DEFINE([HAVE_P1155R3],[1])
7939         AC_MSG_RESULT([yes])
7940     ], [AC_MSG_RESULT([no])])
7941 CXXFLAGS=$save_CXXFLAGS
7942 AC_LANG_POP([C++])
7944 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7945 HAVE_CXX20_ATOMIC_REF=
7946 AC_LANG_PUSH([C++])
7947 save_CXXFLAGS=$CXXFLAGS
7948 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7949 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7950         #include <atomic>
7951         int x;
7952         std::atomic_ref<int> y(x);
7953     ])], [
7954         HAVE_CXX20_ATOMIC_REF=TRUE
7955         AC_MSG_RESULT([yes])
7956     ], [AC_MSG_RESULT([no])])
7957 CXXFLAGS=$save_CXXFLAGS
7958 AC_LANG_POP([C++])
7959 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7961 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7962 dnl which is included in -Wextra anyway):
7963 HAVE_WDEPRECATED_COPY_DTOR=
7964 if test "$GCC" = yes; then
7965     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7966     AC_LANG_PUSH([C++])
7967     save_CXXFLAGS=$CXXFLAGS
7968     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7969     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7970             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7971             AC_MSG_RESULT([yes])
7972         ], [AC_MSG_RESULT([no])])
7973     CXXFLAGS=$save_CXXFLAGS
7974     AC_LANG_POP([C++])
7976 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7978 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7979 dnl uninitialized warning for code like
7981 dnl   OString f();
7982 dnl   boost::optional<OString> * g(bool b) {
7983 dnl       boost::optional<OString> o;
7984 dnl       if (b) o = f();
7985 dnl       return new boost::optional<OString>(o);
7986 dnl   }
7988 dnl (as is e.g. present, in a slightly more elaborate form, in
7989 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7990 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7991 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7992 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7993     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7994     AC_LANG_PUSH([C++])
7995     save_CXXFLAGS=$CXXFLAGS
7996     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7997     if test "$ENABLE_OPTIMIZED" = TRUE; then
7998         CXXFLAGS="$CXXFLAGS -O2"
7999     else
8000         CXXFLAGS="$CXXFLAGS -O0"
8001     fi
8002     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8003             #include <new>
8004             void f1(int);
8005             struct S1 {
8006                 ~S1() { f1(n); }
8007                 int n = 0;
8008             };
8009             struct S2 {
8010                 S2() {}
8011                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
8012                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
8013                 void set(S1 s) {
8014                     new (stg) S1(s);
8015                     init = true;
8016                 }
8017                 bool init = false;
8018                 char stg[sizeof (S1)];
8019             } ;
8020             S1 f2();
8021             S2 * f3(bool b) {
8022                 S2 o;
8023                 if (b) o.set(f2());
8024                 return new S2(o);
8025             }
8026         ]])], [AC_MSG_RESULT([no])], [
8027             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8028             AC_MSG_RESULT([yes])
8029         ])
8030     CXXFLAGS=$save_CXXFLAGS
8031     AC_LANG_POP([C++])
8033 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8035 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8036 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8037 dnl hits us e.g. with GCC 10 and --enable-optimized at
8039 dnl   In file included from include/rtl/string.hxx:49,
8040 dnl                    from include/rtl/ustring.hxx:43,
8041 dnl                    from include/osl/file.hxx:35,
8042 dnl                    from include/codemaker/global.hxx:28,
8043 dnl                    from include/codemaker/options.hxx:23,
8044 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8045 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8046 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,
8047 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,
8048 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,
8049 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8050 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8051 dnl      78 |         memcpy( buffer, data, length );
8052 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8053 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8054 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8055     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8056     AC_LANG_PUSH([C++])
8057     save_CXXFLAGS=$CXXFLAGS
8058     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8059     if test "$ENABLE_OPTIMIZED" = TRUE; then
8060         CXXFLAGS="$CXXFLAGS -O2"
8061     else
8062         CXXFLAGS="$CXXFLAGS -O0"
8063     fi
8064     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8066             void fill(char const * begin, char const * end, char c);
8067             struct q {
8068                 char ids[4];
8069                 char username[6];
8070             };
8071             void test(q & c) {
8072                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8073                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8074             }
8075         ]])], [AC_MSG_RESULT([no])], [
8076             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8077             AC_MSG_RESULT([yes])
8078         ])
8079     CXXFLAGS=$save_CXXFLAGS
8080     AC_LANG_POP([C++])
8082 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8084 HAVE_DLLEXPORTINLINES=
8085 if test "$_os" = "WINNT"; then
8086     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8087     AC_LANG_PUSH([C++])
8088     save_CXXFLAGS=$CXXFLAGS
8089     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8090     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8091             HAVE_DLLEXPORTINLINES=TRUE
8092             AC_MSG_RESULT([yes])
8093         ], [AC_MSG_RESULT([no])])
8094     CXXFLAGS=$save_CXXFLAGS
8095     AC_LANG_POP([C++])
8097 AC_SUBST([HAVE_DLLEXPORTINLINES])
8099 dnl ===================================================================
8100 dnl CPU Intrinsics support - SSE, AVX
8101 dnl ===================================================================
8103 CXXFLAGS_INTRINSICS_SSE2=
8104 CXXFLAGS_INTRINSICS_SSSE3=
8105 CXXFLAGS_INTRINSICS_SSE41=
8106 CXXFLAGS_INTRINSICS_SSE42=
8107 CXXFLAGS_INTRINSICS_AVX=
8108 CXXFLAGS_INTRINSICS_AVX2=
8109 CXXFLAGS_INTRINSICS_AVX512=
8110 CXXFLAGS_INTRINSICS_AVX512F=
8111 CXXFLAGS_INTRINSICS_F16C=
8112 CXXFLAGS_INTRINSICS_FMA=
8114 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8115     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8116     flag_sse2=-msse2
8117     flag_ssse3=-mssse3
8118     flag_sse41=-msse4.1
8119     flag_sse42=-msse4.2
8120     flag_avx=-mavx
8121     flag_avx2=-mavx2
8122     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8123     flag_avx512f=-mavx512f
8124     flag_f16c=-mf16c
8125     flag_fma=-mfma
8126 else
8127     # With MSVC using -arch is in fact not necessary for being able
8128     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8129     # even if compiled with -arch:AVX, the -arch option really only affects
8130     # instructions generated for C/C++ code.
8131     # So use the matching same (or lower) -arch options, but only in order
8132     # to generate the best matching instructions for the C++ code surrounding
8133     # the intrinsics.
8134     # SSE2 is the default for x86/x64, so no need to specify the option.
8135     flag_sse2=
8136     # No specific options for these, use the next lower.
8137     flag_ssse3="$flag_sse2"
8138     flag_sse41="$flag_sse2"
8139     flag_sse42="$flag_sse2"
8140     flag_avx=-arch:AVX
8141     flag_avx2=-arch:AVX2
8142     flag_avx512=-arch:AVX512
8143     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8144     flag_avx512f=-arch:AVX2
8145     # No MSVC options for these.
8146     flag_f16c="$flag_sse2"
8147     flag_fma="$flag_sse2"
8150 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8151 AC_LANG_PUSH([C++])
8152 save_CXXFLAGS=$CXXFLAGS
8153 CXXFLAGS="$CXXFLAGS $flag_sse2"
8154 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8155     #include <emmintrin.h>
8156     int main () {
8157         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8158         c = _mm_xor_si128 (a, b);
8159         return 0;
8160     }
8161     ])],
8162     [can_compile_sse2=yes],
8163     [can_compile_sse2=no])
8164 AC_LANG_POP([C++])
8165 CXXFLAGS=$save_CXXFLAGS
8166 AC_MSG_RESULT([${can_compile_sse2}])
8167 if test "${can_compile_sse2}" = "yes" ; then
8168     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8171 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8172 AC_LANG_PUSH([C++])
8173 save_CXXFLAGS=$CXXFLAGS
8174 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8175 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8176     #include <tmmintrin.h>
8177     int main () {
8178         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8179         c = _mm_maddubs_epi16 (a, b);
8180         return 0;
8181     }
8182     ])],
8183     [can_compile_ssse3=yes],
8184     [can_compile_ssse3=no])
8185 AC_LANG_POP([C++])
8186 CXXFLAGS=$save_CXXFLAGS
8187 AC_MSG_RESULT([${can_compile_ssse3}])
8188 if test "${can_compile_ssse3}" = "yes" ; then
8189     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8192 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8193 AC_LANG_PUSH([C++])
8194 save_CXXFLAGS=$CXXFLAGS
8195 CXXFLAGS="$CXXFLAGS $flag_sse41"
8196 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8197     #include <smmintrin.h>
8198     int main () {
8199         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8200         c = _mm_cmpeq_epi64 (a, b);
8201         return 0;
8202     }
8203     ])],
8204     [can_compile_sse41=yes],
8205     [can_compile_sse41=no])
8206 AC_LANG_POP([C++])
8207 CXXFLAGS=$save_CXXFLAGS
8208 AC_MSG_RESULT([${can_compile_sse41}])
8209 if test "${can_compile_sse41}" = "yes" ; then
8210     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8213 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8214 AC_LANG_PUSH([C++])
8215 save_CXXFLAGS=$CXXFLAGS
8216 CXXFLAGS="$CXXFLAGS $flag_sse42"
8217 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8218     #include <nmmintrin.h>
8219     int main () {
8220         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8221         c = _mm_cmpgt_epi64 (a, b);
8222         return 0;
8223     }
8224     ])],
8225     [can_compile_sse42=yes],
8226     [can_compile_sse42=no])
8227 AC_LANG_POP([C++])
8228 CXXFLAGS=$save_CXXFLAGS
8229 AC_MSG_RESULT([${can_compile_sse42}])
8230 if test "${can_compile_sse42}" = "yes" ; then
8231     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8234 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8235 AC_LANG_PUSH([C++])
8236 save_CXXFLAGS=$CXXFLAGS
8237 CXXFLAGS="$CXXFLAGS $flag_avx"
8238 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8239     #include <immintrin.h>
8240     int main () {
8241         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8242         c = _mm256_xor_ps(a, b);
8243         return 0;
8244     }
8245     ])],
8246     [can_compile_avx=yes],
8247     [can_compile_avx=no])
8248 AC_LANG_POP([C++])
8249 CXXFLAGS=$save_CXXFLAGS
8250 AC_MSG_RESULT([${can_compile_avx}])
8251 if test "${can_compile_avx}" = "yes" ; then
8252     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8255 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8256 AC_LANG_PUSH([C++])
8257 save_CXXFLAGS=$CXXFLAGS
8258 CXXFLAGS="$CXXFLAGS $flag_avx2"
8259 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8260     #include <immintrin.h>
8261     int main () {
8262         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8263         c = _mm256_maddubs_epi16(a, b);
8264         return 0;
8265     }
8266     ])],
8267     [can_compile_avx2=yes],
8268     [can_compile_avx2=no])
8269 AC_LANG_POP([C++])
8270 CXXFLAGS=$save_CXXFLAGS
8271 AC_MSG_RESULT([${can_compile_avx2}])
8272 if test "${can_compile_avx2}" = "yes" ; then
8273     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8276 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8277 AC_LANG_PUSH([C++])
8278 save_CXXFLAGS=$CXXFLAGS
8279 CXXFLAGS="$CXXFLAGS $flag_avx512"
8280 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8281     #include <immintrin.h>
8282     int main () {
8283         __m512i a = _mm512_loadu_si512(0);
8284         __m512d v1 = _mm512_load_pd(0);
8285         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8286         __m512d v2 = _mm512_abs_pd(v1);
8287         return 0;
8288     }
8289     ])],
8290     [can_compile_avx512=yes],
8291     [can_compile_avx512=no])
8292 AC_LANG_POP([C++])
8293 CXXFLAGS=$save_CXXFLAGS
8294 AC_MSG_RESULT([${can_compile_avx512}])
8295 if test "${can_compile_avx512}" = "yes" ; then
8296     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8297     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8300 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8301 AC_LANG_PUSH([C++])
8302 save_CXXFLAGS=$CXXFLAGS
8303 CXXFLAGS="$CXXFLAGS $flag_f16c"
8304 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8305     #include <immintrin.h>
8306     int main () {
8307         __m128i a = _mm_set1_epi32 (0);
8308         __m128 c;
8309         c = _mm_cvtph_ps(a);
8310         return 0;
8311     }
8312     ])],
8313     [can_compile_f16c=yes],
8314     [can_compile_f16c=no])
8315 AC_LANG_POP([C++])
8316 CXXFLAGS=$save_CXXFLAGS
8317 AC_MSG_RESULT([${can_compile_f16c}])
8318 if test "${can_compile_f16c}" = "yes" ; then
8319     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8322 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8323 AC_LANG_PUSH([C++])
8324 save_CXXFLAGS=$CXXFLAGS
8325 CXXFLAGS="$CXXFLAGS $flag_fma"
8326 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8327     #include <immintrin.h>
8328     int main () {
8329         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8330         d = _mm256_fmadd_ps(a, b, c);
8331         return 0;
8332     }
8333     ])],
8334     [can_compile_fma=yes],
8335     [can_compile_fma=no])
8336 AC_LANG_POP([C++])
8337 CXXFLAGS=$save_CXXFLAGS
8338 AC_MSG_RESULT([${can_compile_fma}])
8339 if test "${can_compile_fma}" = "yes" ; then
8340     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8343 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8344 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8345 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8346 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8347 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8348 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8349 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8350 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8351 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8352 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8354 dnl ===================================================================
8355 dnl system stl sanity tests
8356 dnl ===================================================================
8357 if test "$_os" != "WINNT"; then
8359     AC_LANG_PUSH([C++])
8361     save_CPPFLAGS="$CPPFLAGS"
8362     if test -n "$MACOSX_SDK_PATH"; then
8363         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8364     fi
8366     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8367     # only.
8368     if test "$CPP_LIBRARY" = GLIBCXX; then
8369         dnl gcc#19664, gcc#22482, rhbz#162935
8370         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8371         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8372         AC_MSG_RESULT([$stlvisok])
8373         if test "$stlvisok" = "no"; then
8374             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8375         fi
8376     fi
8378     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8379     # when we don't make any dynamic libraries?
8380     if test "$DISABLE_DYNLOADING" = ""; then
8381         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8382         cat > conftestlib1.cc <<_ACEOF
8383 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8384 struct S2: S1<int> { virtual ~S2(); };
8385 S2::~S2() {}
8386 _ACEOF
8387         cat > conftestlib2.cc <<_ACEOF
8388 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8389 struct S2: S1<int> { virtual ~S2(); };
8390 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8391 _ACEOF
8392         gccvisinlineshiddenok=yes
8393         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8394             gccvisinlineshiddenok=no
8395         else
8396             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8397             dnl known to not work with -z defs (unsetting which makes the test
8398             dnl moot, though):
8399             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8400             if test "$COM_IS_CLANG" = TRUE; then
8401                 for i in $CXX $CXXFLAGS; do
8402                     case $i in
8403                     -fsanitize=*)
8404                         my_linkflagsnoundefs=
8405                         break
8406                         ;;
8407                     esac
8408                 done
8409             fi
8410             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8411                 gccvisinlineshiddenok=no
8412             fi
8413         fi
8415         rm -fr libconftest*
8416         AC_MSG_RESULT([$gccvisinlineshiddenok])
8417         if test "$gccvisinlineshiddenok" = "no"; then
8418             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8419         fi
8420     fi
8422    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8423     cat >visibility.cxx <<_ACEOF
8424 #pragma GCC visibility push(hidden)
8425 struct __attribute__ ((visibility ("default"))) TestStruct {
8426   static void Init();
8428 __attribute__ ((visibility ("default"))) void TestFunc() {
8429   TestStruct::Init();
8431 _ACEOF
8432     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8433         gccvisbroken=yes
8434     else
8435         case "$host_cpu" in
8436         i?86|x86_64)
8437             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8438                 gccvisbroken=no
8439             else
8440                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8441                     gccvisbroken=no
8442                 else
8443                     gccvisbroken=yes
8444                 fi
8445             fi
8446             ;;
8447         *)
8448             gccvisbroken=no
8449             ;;
8450         esac
8451     fi
8452     rm -f visibility.s visibility.cxx
8454     AC_MSG_RESULT([$gccvisbroken])
8455     if test "$gccvisbroken" = "yes"; then
8456         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8457     fi
8459     CPPFLAGS="$save_CPPFLAGS"
8461     AC_MSG_CHECKING([if CET endbranch is recognized])
8462 cat > endbr.s <<_ACEOF
8463 endbr32
8464 _ACEOF
8465     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8466     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8467         AC_MSG_RESULT([yes])
8468         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8469     else
8470         AC_MSG_RESULT([no])
8471     fi
8472     rm -f endbr.s endbr.o
8473     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8475     AC_LANG_POP([C++])
8478 dnl ===================================================================
8479 dnl  Clang++ tests
8480 dnl ===================================================================
8482 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8483 if test "$GCC" = "yes"; then
8484     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8485     AC_LANG_PUSH([C++])
8486     save_CXXFLAGS=$CXXFLAGS
8487     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8488     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8489     CXXFLAGS=$save_CXXFLAGS
8490     AC_LANG_POP([C++])
8491     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8492         AC_MSG_RESULT([yes])
8493     else
8494         AC_MSG_RESULT([no])
8495     fi
8497 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8499 dnl ===================================================================
8500 dnl Compiler plugins
8501 dnl ===================================================================
8503 COMPILER_PLUGINS=
8504 # currently only Clang
8506 if test "$COM_IS_CLANG" != "TRUE"; then
8507     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8508         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8509         enable_compiler_plugins=no
8510     fi
8513 COMPILER_PLUGINS_COM_IS_CLANG=
8514 if test "$COM_IS_CLANG" = "TRUE"; then
8515     if test -n "$enable_compiler_plugins"; then
8516         compiler_plugins="$enable_compiler_plugins"
8517     elif test -n "$ENABLE_DBGUTIL"; then
8518         compiler_plugins=test
8519     else
8520         compiler_plugins=no
8521     fi
8522     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8523         if test "$CLANGVER" -lt 120001; then
8524             if test "$compiler_plugins" = yes; then
8525                 AC_MSG_ERROR(
8526                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8527             else
8528                 compiler_plugins=no
8529             fi
8530         fi
8531     fi
8532     if test "$compiler_plugins" != "no"; then
8533         dnl The prefix where Clang resides, override to where Clang resides if
8534         dnl using a source build:
8535         if test -z "$CLANGDIR"; then
8536             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8537         fi
8538         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8539         if test -z "$COMPILER_PLUGINS_CXX"; then
8540             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8541         fi
8542         clangbindir=$CLANGDIR/bin
8543         if test "$build_os" = "cygwin"; then
8544             clangbindir=$(cygpath -u "$clangbindir")
8545         fi
8546         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8547         if test -n "$LLVM_CONFIG"; then
8548             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8549             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8550             if test -z "$CLANGLIBDIR"; then
8551                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8552             fi
8553             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8554             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8555             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8556                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8557                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8558                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8559                 fi
8560             fi
8561             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8562             clangobjdir=$($LLVM_CONFIG --obj-root)
8563             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8564                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8565             fi
8566         fi
8567         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8568         AC_LANG_PUSH([C++])
8569         save_CXX=$CXX
8570         save_CXXCPP=$CXXCPP
8571         save_CPPFLAGS=$CPPFLAGS
8572         save_CXXFLAGS=$CXXFLAGS
8573         save_LDFLAGS=$LDFLAGS
8574         save_LIBS=$LIBS
8575         CXX=$COMPILER_PLUGINS_CXX
8576         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8577         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8578         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8579         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8580             [COMPILER_PLUGINS=TRUE],
8581             [
8582             if test "$compiler_plugins" = "yes"; then
8583                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8584             else
8585                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8586                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8587             fi
8588             ])
8589         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8590         dnl comment in compilerplugins/Makefile-clang.mk:
8591         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8592             LDFLAGS=""
8593             AC_MSG_CHECKING([for clang libraries to use])
8594             if test -z "$CLANGTOOLLIBS"; then
8595                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8596                 AC_LINK_IFELSE([
8597                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8598                         [[ clang::FullSourceLoc().dump(); ]])
8599                 ],[CLANGTOOLLIBS="$LIBS"],[])
8600             fi
8601             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8602             dnl list of individual -lclang* (but note that that list can become outdated over time,
8603             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8604             dnl needs to include -lclangSupport now"):
8605             if test -z "$CLANGTOOLLIBS"; then
8606                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8607  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8608                 AC_LINK_IFELSE([
8609                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8610                         [[ clang::FullSourceLoc().dump(); ]])
8611                 ],[CLANGTOOLLIBS="$LIBS"],[])
8612             fi
8613             AC_MSG_RESULT([$CLANGTOOLLIBS])
8614             if test -z "$CLANGTOOLLIBS"; then
8615                 if test "$compiler_plugins" = "yes"; then
8616                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8617                 else
8618                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8619                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8620                 fi
8621                 COMPILER_PLUGINS=
8622             fi
8623             if test -n "$COMPILER_PLUGINS"; then
8624                 if test -z "$CLANGSYSINCLUDE"; then
8625                     if test -n "$LLVM_CONFIG"; then
8626                         # Path to the clang system headers (no idea if there's a better way to get it).
8627                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8628                     fi
8629                 fi
8630             fi
8631         fi
8632         CXX=$save_CXX
8633         CXXCPP=$save_CXXCPP
8634         CPPFLAGS=$save_CPPFLAGS
8635         CXXFLAGS=$save_CXXFLAGS
8636         LDFLAGS=$save_LDFLAGS
8637         LIBS="$save_LIBS"
8638         AC_LANG_POP([C++])
8640         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8641         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8642             #ifndef __clang__
8643             you lose
8644             #endif
8645             int foo=42;
8646             ]])],
8647             [AC_MSG_RESULT([yes])
8648              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8649             [AC_MSG_RESULT([no])])
8650         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8651     fi
8652 else
8653     if test "$enable_compiler_plugins" = "yes"; then
8654         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8655     fi
8657 COMPILER_PLUGINS_ANALYZER_PCH=
8658 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8659     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8661 AC_SUBST(COMPILER_PLUGINS)
8662 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8663 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8664 AC_SUBST(COMPILER_PLUGINS_CXX)
8665 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8666 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8667 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8668 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8669 AC_SUBST(CLANGDIR)
8670 AC_SUBST(CLANGLIBDIR)
8671 AC_SUBST(CLANGTOOLLIBS)
8672 AC_SUBST(CLANGSYSINCLUDE)
8674 # Plugin to help linker.
8675 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8676 # This makes --enable-lto build with clang work.
8677 AC_SUBST(LD_PLUGIN)
8679 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8680 AC_SUBST(HAVE_POSIX_FALLOCATE)
8682 JITC_PROCESSOR_TYPE=""
8683 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8684     # IBMs JDK needs this...
8685     JITC_PROCESSOR_TYPE=6
8686     export JITC_PROCESSOR_TYPE
8688 AC_SUBST([JITC_PROCESSOR_TYPE])
8690 # Misc Windows Stuff
8691 AC_ARG_WITH(ucrt-dir,
8692     AS_HELP_STRING([--with-ucrt-dir],
8693         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8694         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8695         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8696             Windows6.1-KB2999226-x64.msu
8697             Windows6.1-KB2999226-x86.msu
8698             Windows8.1-KB2999226-x64.msu
8699             Windows8.1-KB2999226-x86.msu
8700             Windows8-RT-KB2999226-x64.msu
8701             Windows8-RT-KB2999226-x86.msu
8702         A zip archive including those files is available from Microsoft site:
8703         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8706 UCRT_REDISTDIR="$with_ucrt_dir"
8707 if test $_os = "WINNT"; then
8708     find_msvc_x64_dlls
8709     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8710     MSVC_DLLS="$msvcdlls"
8711     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8712         with_redist=143
8713     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8714         with_redist=142
8715     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8716         with_redist=141
8717     fi
8718     for i in $PKGFORMAT; do
8719         if test "$i" = msi; then
8720             find_msms "$with_redist"
8721             if test -n "$msmdir"; then
8722                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8723                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8724             fi
8725             break
8726         fi
8727     done
8729     if test "$UCRT_REDISTDIR" = "no"; then
8730         dnl explicitly disabled
8731         UCRT_REDISTDIR=""
8732     else
8733         PathFormat "$UCRT_REDISTDIR"
8734         UCRT_REDISTDIR="$formatted_path"
8735         UCRT_REDISTDIR_unix="$formatted_path_unix"
8736         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8737                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8738                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8739                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8740                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8741                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8742             UCRT_REDISTDIR=""
8743             if test -n "$PKGFORMAT"; then
8744                for i in $PKGFORMAT; do
8745                    case "$i" in
8746                    msi)
8747                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8748                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8749                        ;;
8750                    esac
8751                done
8752             fi
8753         fi
8754     fi
8757 AC_SUBST(UCRT_REDISTDIR)
8758 AC_SUBST(MSVC_DLL_PATH)
8759 AC_SUBST(MSVC_DLLS)
8760 AC_SUBST(MSM_PATH)
8763 dnl ===================================================================
8764 dnl Checks for Java
8765 dnl ===================================================================
8766 if test "$ENABLE_JAVA" != ""; then
8768     # Windows-specific tests
8769     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8770         if test -z "$with_jdk_home"; then
8771             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8772             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8773             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8774             if test -n "$regvalue"; then
8775                 ver=$regvalue
8776                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8777                 with_jdk_home=$regvalue
8778             fi
8779             howfound="found automatically"
8780         else
8781             howfound="you passed"
8782         fi
8783         PathFormat "$with_jdk_home"
8784         with_jdk_home="$formatted_path_unix"
8786         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8787             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])
8788         fi
8789         with_java="java.exe"
8790         javacompiler="javac.exe"
8791         javadoc="javadoc.exe"
8792     fi
8794     # 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.
8795     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8796     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8797         with_jdk_home=`/usr/libexec/java_home`
8798     fi
8800     JAVA_HOME=; export JAVA_HOME
8801     if test -z "$with_jdk_home"; then
8802         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8803     else
8804         _java_path="$with_jdk_home/bin/$with_java"
8805         dnl Check if there is a Java interpreter at all.
8806         if test -x "$_java_path"; then
8807             JAVAINTERPRETER=$_java_path
8808         else
8809             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8810         fi
8811     fi
8813     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8814     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8815     dnl loaded by java to run JunitTests:
8816     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8817         shortjdkhome=`cygpath -d "$with_jdk_home"`
8818         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
8819             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8820             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8821         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
8822             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8823             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8824         fi
8826         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8827             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8828         fi
8829         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8830     elif test "$cross_compiling" != "yes"; then
8831         case $CPUNAME in
8832             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8833                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8834                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8835                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8836                 fi
8837                 ;;
8838             *) # assumption: everything else 32-bit
8839                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8840                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8841                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8842                 fi
8843                 ;;
8844         esac
8845     fi
8848 dnl ===================================================================
8849 dnl Checks for JDK.
8850 dnl ===================================================================
8852 # Whether all the complexity here actually is needed any more or not, no idea.
8854 JDK_SECURITYMANAGER_DISALLOWED=
8855 MODULAR_JAVA=
8856 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8857     _gij_longver=0
8858     AC_MSG_CHECKING([the installed JDK])
8859     if test -n "$JAVAINTERPRETER"; then
8860         dnl java -version sends output to stderr!
8861         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8862             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8863         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8864             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8865         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8866             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8867         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8868             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8869         else
8870             JDK=sun
8872             dnl Sun JDK specific tests
8873             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8874             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8876             if test "$_jdk_ver" -lt 10800; then
8877                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
8878             fi
8879             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8880             dnl completely removed in some Java version > 18 (see
8881             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8882             if test "$_jdk_ver" -ge 180000; then
8883                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8884             fi
8886             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8887             if test "$_os" = "WINNT"; then
8888                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8889             fi
8890             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8892             dnl Check whether the build Java supports modules
8893             if test "$_jdk_ver" -ge 90000; then
8894                 MODULAR_JAVA=TRUE
8895             else
8896                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
8897                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
8898             fi
8900             # set to limit VM usage for JunitTests
8901             JAVAIFLAGS=-Xmx64M
8902             # set to limit VM usage for javac
8903             JAVACFLAGS=-J-Xmx128M
8904         fi
8905     else
8906         AC_MSG_ERROR([Java not found. You need at least JDK 8])
8907     fi
8908 else
8909     if test -z "$ENABLE_JAVA"; then
8910         dnl Java disabled
8911         JAVA_HOME=
8912         export JAVA_HOME
8913     elif test "$cross_compiling" = "yes"; then
8914         # Just assume compatibility of build and host JDK
8915         JDK=$JDK_FOR_BUILD
8916         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8917     fi
8920 dnl ===================================================================
8921 dnl Checks for javac
8922 dnl ===================================================================
8923 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8924     : ${JAVA_SOURCE_VER=8}
8925     : ${JAVA_TARGET_VER=8}
8926     if test -z "$with_jdk_home"; then
8927         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8928     else
8929         _javac_path="$with_jdk_home/bin/$javacompiler"
8930         dnl Check if there is a Java compiler at all.
8931         if test -x "$_javac_path"; then
8932             JAVACOMPILER=$_javac_path
8933         fi
8934     fi
8935     if test -z "$JAVACOMPILER"; then
8936         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8937     fi
8938     if test "$build_os" = "cygwin"; then
8939         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8940             JAVACOMPILER="${JAVACOMPILER}.exe"
8941         fi
8942         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8943     fi
8946 dnl ===================================================================
8947 dnl Checks for javadoc
8948 dnl ===================================================================
8949 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8950     if test -z "$with_jdk_home"; then
8951         AC_PATH_PROG(JAVADOC, $javadoc)
8952     else
8953         _javadoc_path="$with_jdk_home/bin/$javadoc"
8954         dnl Check if there is a javadoc at all.
8955         if test -x "$_javadoc_path"; then
8956             JAVADOC=$_javadoc_path
8957         else
8958             AC_PATH_PROG(JAVADOC, $javadoc)
8959         fi
8960     fi
8961     if test -z "$JAVADOC"; then
8962         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8963     fi
8964     if test "$build_os" = "cygwin"; then
8965         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8966             JAVADOC="${JAVADOC}.exe"
8967         fi
8968         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8969     fi
8971     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8972     JAVADOCISGJDOC="yes"
8973     fi
8975 AC_SUBST(JAVADOC)
8976 AC_SUBST(JAVADOCISGJDOC)
8978 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8979     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8980     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8981         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8982            # try to recover first by looking whether we have an alternative
8983            # system as in Debian or newer SuSEs where following /usr/bin/javac
8984            # over /etc/alternatives/javac leads to the right bindir where we
8985            # just need to strip a bit away to get a valid JAVA_HOME
8986            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8987         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8988             # maybe only one level of symlink (e.g. on Mac)
8989             JAVA_HOME=$(readlink $JAVACOMPILER)
8990             if test "$(dirname $JAVA_HOME)" = "."; then
8991                 # we've got no path to trim back
8992                 JAVA_HOME=""
8993             fi
8994         else
8995             # else warn
8996             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8997             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8998             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8999             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
9000         fi
9001         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
9002         if test "$JAVA_HOME" != "/usr"; then
9003             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9004                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
9005                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
9006                 dnl Tiger already returns a JDK path...
9007                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
9008             else
9009                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
9010                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
9011                 dnl that checks which version to run
9012                 if test -f "$JAVA_HOME"; then
9013                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
9014                 fi
9015             fi
9016         fi
9017     fi
9018     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
9020     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9021     if test -z "$JAVA_HOME"; then
9022         if test "x$with_jdk_home" = "x"; then
9023             cat > findhome.java <<_ACEOF
9024 [import java.io.File;
9026 class findhome
9028     public static void main(String args[])
9029     {
9030         String jrelocation = System.getProperty("java.home");
9031         File jre = new File(jrelocation);
9032         System.out.println(jre.getParent());
9033     }
9035 _ACEOF
9036             AC_MSG_CHECKING([if javac works])
9037             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9038             AC_TRY_EVAL(javac_cmd)
9039             if test $? = 0 -a -f ./findhome.class; then
9040                 AC_MSG_RESULT([javac works])
9041             else
9042                 echo "configure: javac test failed" >&5
9043                 cat findhome.java >&5
9044                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9045             fi
9046             AC_MSG_CHECKING([if gij knows its java.home])
9047             JAVA_HOME=`$JAVAINTERPRETER findhome`
9048             if test $? = 0 -a "$JAVA_HOME" != ""; then
9049                 AC_MSG_RESULT([$JAVA_HOME])
9050             else
9051                 echo "configure: java test failed" >&5
9052                 cat findhome.java >&5
9053                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9054             fi
9055             # clean-up after ourselves
9056             rm -f ./findhome.java ./findhome.class
9057         else
9058             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9059         fi
9060     fi
9062     # now check if $JAVA_HOME is really valid
9063     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9064         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9065             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9066             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9067             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9068             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9069             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9070             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9071         fi
9072     fi
9073     PathFormat "$JAVA_HOME"
9074     JAVA_HOME="$formatted_path_unix"
9077 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9078     "$_os" != Darwin
9079 then
9080     AC_MSG_CHECKING([for JAWT lib])
9081     if test "$_os" = WINNT; then
9082         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9083         JAWTLIB=jawt.lib
9084     else
9085         case "$host_cpu" in
9086         arm*)
9087             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9088             JAVA_ARCH=$my_java_arch
9089             ;;
9090         i*86)
9091             my_java_arch=i386
9092             ;;
9093         m68k)
9094             my_java_arch=m68k
9095             ;;
9096         powerpc)
9097             my_java_arch=ppc
9098             ;;
9099         powerpc64)
9100             my_java_arch=ppc64
9101             ;;
9102         powerpc64le)
9103             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9104             JAVA_ARCH=$my_java_arch
9105             ;;
9106         sparc64)
9107             my_java_arch=sparcv9
9108             ;;
9109         x86_64)
9110             my_java_arch=amd64
9111             ;;
9112         *)
9113             my_java_arch=$host_cpu
9114             ;;
9115         esac
9116         # This is where JDK9 puts the library
9117         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9118             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9119         else
9120             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9121         fi
9122         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9123     fi
9124     AC_MSG_RESULT([$JAWTLIB])
9126 AC_SUBST(JAWTLIB)
9128 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9129     case "$host_os" in
9131     cygwin*|wsl*)
9132         JAVAINC="-I$JAVA_HOME/include/win32"
9133         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9134         ;;
9136     darwin*)
9137         if test -d "$JAVA_HOME/include/darwin"; then
9138             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9139         else
9140             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9141         fi
9142         ;;
9144     dragonfly*)
9145         JAVAINC="-I$JAVA_HOME/include"
9146         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9147         ;;
9149     freebsd*)
9150         JAVAINC="-I$JAVA_HOME/include"
9151         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9152         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9153         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9154         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9155         ;;
9157     k*bsd*-gnu*)
9158         JAVAINC="-I$JAVA_HOME/include"
9159         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9160         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9161         ;;
9163     linux-gnu*)
9164         JAVAINC="-I$JAVA_HOME/include"
9165         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9166         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9167         ;;
9169     *netbsd*)
9170         JAVAINC="-I$JAVA_HOME/include"
9171         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9172         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9173        ;;
9175     openbsd*)
9176         JAVAINC="-I$JAVA_HOME/include"
9177         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9178         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9179         ;;
9181     solaris*)
9182         JAVAINC="-I$JAVA_HOME/include"
9183         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9184         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9185         ;;
9186     esac
9188 SOLARINC="$SOLARINC $JAVAINC"
9190 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9191     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9192     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9193     JDK_FOR_BUILD=$JDK
9194     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9197 AC_SUBST(JAVACFLAGS)
9198 AC_SUBST(JAVACOMPILER)
9199 AC_SUBST(JAVAINTERPRETER)
9200 AC_SUBST(JAVAIFLAGS)
9201 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9202 AC_SUBST(JAVA_HOME)
9203 AC_SUBST(JAVA_HOME_FOR_BUILD)
9204 AC_SUBST(JDK)
9205 AC_SUBST(JDK_FOR_BUILD)
9206 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9207 AC_SUBST(JAVA_SOURCE_VER)
9208 AC_SUBST(JAVA_TARGET_VER)
9209 AC_SUBST(MODULAR_JAVA)
9212 dnl ===================================================================
9213 dnl Export file validation
9214 dnl ===================================================================
9215 AC_MSG_CHECKING([whether to enable export file validation])
9216 if test "$with_export_validation" != "no"; then
9217     if test -z "$ENABLE_JAVA"; then
9218         if test "$with_export_validation" = "yes"; then
9219             AC_MSG_ERROR([requested, but Java is disabled])
9220         else
9221             AC_MSG_RESULT([no, as Java is disabled])
9222         fi
9223     elif ! test -d "${SRC_ROOT}/schema"; then
9224         if test "$with_export_validation" = "yes"; then
9225             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9226         else
9227             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9228         fi
9229     else
9230         AC_MSG_RESULT([yes])
9231         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9233         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9234         if test -z "$ODFVALIDATOR"; then
9235             # remember to download the ODF toolkit with validator later
9236             AC_MSG_NOTICE([no odfvalidator found, will download it])
9237             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9238             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9240             # and fetch name of odfvalidator jar name from download.lst
9241             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9242             AC_SUBST(ODFVALIDATOR_JAR)
9244             if test -z "$ODFVALIDATOR_JAR"; then
9245                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9246             fi
9247         fi
9248         if test "$build_os" = "cygwin"; then
9249             # In case of Cygwin it will be executed from Windows,
9250             # so we need to run bash and absolute path to validator
9251             # so instead of "odfvalidator" it will be
9252             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9253             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9254         else
9255             ODFVALIDATOR="sh $ODFVALIDATOR"
9256         fi
9257         AC_SUBST(ODFVALIDATOR)
9260         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9261         if test -z "$OFFICEOTRON"; then
9262             # remember to download the officeotron with validator later
9263             AC_MSG_NOTICE([no officeotron found, will download it])
9264             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9265             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9267             # and fetch name of officeotron jar name from download.lst
9268             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9269             AC_SUBST(OFFICEOTRON_JAR)
9271             if test -z "$OFFICEOTRON_JAR"; then
9272                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9273             fi
9274         else
9275             # check version of existing officeotron
9276             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9277             if test 0"$OFFICEOTRON_VER" -lt 704; then
9278                 AC_MSG_ERROR([officeotron too old])
9279             fi
9280         fi
9281         if test "$build_os" = "cygwin"; then
9282             # In case of Cygwin it will be executed from Windows,
9283             # so we need to run bash and absolute path to validator
9284             # so instead of "odfvalidator" it will be
9285             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9286             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9287         else
9288             OFFICEOTRON="sh $OFFICEOTRON"
9289         fi
9290     fi
9291     AC_SUBST(OFFICEOTRON)
9292 else
9293     AC_MSG_RESULT([no])
9296 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9297 if test "$with_bffvalidator" != "no"; then
9298     AC_DEFINE(HAVE_BFFVALIDATOR)
9300     if test "$with_export_validation" = "no"; then
9301         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9302     fi
9304     if test "$with_bffvalidator" = "yes"; then
9305         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9306     else
9307         BFFVALIDATOR="$with_bffvalidator"
9308     fi
9310     if test "$build_os" = "cygwin"; then
9311         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9312             AC_MSG_RESULT($BFFVALIDATOR)
9313         else
9314             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9315         fi
9316     elif test -n "$BFFVALIDATOR"; then
9317         # We are not in Cygwin but need to run Windows binary with wine
9318         AC_PATH_PROGS(WINE, wine)
9320         # so swap in a shell wrapper that converts paths transparently
9321         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9322         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9323         AC_SUBST(BFFVALIDATOR_EXE)
9324         AC_MSG_RESULT($BFFVALIDATOR)
9325     else
9326         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9327     fi
9328     AC_SUBST(BFFVALIDATOR)
9329 else
9330     AC_MSG_RESULT([no])
9333 dnl ===================================================================
9334 dnl Check for epm (not needed for Windows)
9335 dnl ===================================================================
9336 AC_MSG_CHECKING([whether to enable EPM for packing])
9337 if test "$enable_epm" = "yes"; then
9338     AC_MSG_RESULT([yes])
9339     if test "$_os" != "WINNT"; then
9340         if test $_os = Darwin; then
9341             EPM=internal
9342         elif test -n "$with_epm"; then
9343             EPM=$with_epm
9344         else
9345             AC_PATH_PROG(EPM, epm, no)
9346         fi
9347         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9348             AC_MSG_NOTICE([EPM will be built.])
9349             BUILD_TYPE="$BUILD_TYPE EPM"
9350             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9351         else
9352             # Gentoo has some epm which is something different...
9353             AC_MSG_CHECKING([whether the found epm is the right epm])
9354             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9355                 AC_MSG_RESULT([yes])
9356             else
9357                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9358             fi
9359             AC_MSG_CHECKING([epm version])
9360             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9361             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9362                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9363                 AC_MSG_RESULT([OK, >= 3.7])
9364             else
9365                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9366                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9367             fi
9368         fi
9369     fi
9371     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9372         AC_MSG_CHECKING([for rpm])
9373         for a in "$RPM" rpmbuild rpm; do
9374             $a --usage >/dev/null 2> /dev/null
9375             if test $? -eq 0; then
9376                 RPM=$a
9377                 break
9378             else
9379                 $a --version >/dev/null 2> /dev/null
9380                 if test $? -eq 0; then
9381                     RPM=$a
9382                     break
9383                 fi
9384             fi
9385         done
9386         if test -z "$RPM"; then
9387             AC_MSG_ERROR([not found])
9388         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9389             RPM_PATH=`command -v $RPM`
9390             AC_MSG_RESULT([$RPM_PATH])
9391             SCPDEFS="$SCPDEFS -DWITH_RPM"
9392         else
9393             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9394         fi
9395     fi
9396     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9397         AC_PATH_PROG(DPKG, dpkg, no)
9398         if test "$DPKG" = "no"; then
9399             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9400         fi
9401     fi
9402     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9403        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9404         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9405             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9406                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9407                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9408                     AC_MSG_RESULT([yes])
9409                 else
9410                     AC_MSG_RESULT([no])
9411                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9412                         _pt="rpm"
9413                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9414                         add_warning "the rpms will need to be installed with --nodeps"
9415                     else
9416                         _pt="pkg"
9417                     fi
9418                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9419                     add_warning "the ${_pt}s will not be relocatable"
9420                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9421                                  relocation will work, you need to patch your epm with the
9422                                  patch in epm/epm-3.7.patch or build with
9423                                  --with-epm=internal which will build a suitable epm])
9424                 fi
9425             fi
9426         fi
9427     fi
9428     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9429         AC_PATH_PROG(PKGMK, pkgmk, no)
9430         if test "$PKGMK" = "no"; then
9431             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9432         fi
9433     fi
9434     AC_SUBST(RPM)
9435     AC_SUBST(DPKG)
9436     AC_SUBST(PKGMK)
9437 else
9438     for i in $PKGFORMAT; do
9439         case "$i" in
9440         bsd | deb | pkg | rpm | native | portable)
9441             AC_MSG_ERROR(
9442                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9443             ;;
9444         esac
9445     done
9446     AC_MSG_RESULT([no])
9447     EPM=NO
9449 AC_SUBST(EPM)
9451 ENABLE_LWP=
9452 if test "$enable_lotuswordpro" = "yes"; then
9453     ENABLE_LWP="TRUE"
9455 AC_SUBST(ENABLE_LWP)
9457 dnl ===================================================================
9458 dnl Check for building ODK
9459 dnl ===================================================================
9460 AC_MSG_CHECKING([whether to build the ODK])
9461 if test "$enable_odk" = yes; then
9462     if test "$DISABLE_DYNLOADING" = TRUE; then
9463         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9464     fi
9465     AC_MSG_RESULT([yes])
9466     BUILD_TYPE="$BUILD_TYPE ODK"
9467 else
9468     AC_MSG_RESULT([no])
9471 if test "$enable_odk" != yes; then
9472     unset DOXYGEN
9473 else
9474     if test "$with_doxygen" = no; then
9475         AC_MSG_CHECKING([for doxygen])
9476         unset DOXYGEN
9477         AC_MSG_RESULT([no])
9478     else
9479         if test "$with_doxygen" = yes; then
9480             AC_PATH_PROG([DOXYGEN], [doxygen])
9481             if test -z "$DOXYGEN"; then
9482                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9483             fi
9484             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9485                 if ! dot -V 2>/dev/null; then
9486                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9487                 fi
9488             fi
9489         else
9490             AC_MSG_CHECKING([for doxygen])
9491             DOXYGEN=$with_doxygen
9492             AC_MSG_RESULT([$DOXYGEN])
9493         fi
9494         if test -n "$DOXYGEN"; then
9495             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9496             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9497             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9498                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9499             fi
9500         fi
9501     fi
9503 AC_SUBST([DOXYGEN])
9505 dnl ==================================================================
9506 dnl libfuzzer
9507 dnl ==================================================================
9508 AC_MSG_CHECKING([whether to enable fuzzers])
9509 if test "$enable_fuzzers" != yes; then
9510     AC_MSG_RESULT([no])
9511 else
9512     if test -z $LIB_FUZZING_ENGINE; then
9513       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9514     fi
9515     AC_MSG_RESULT([yes])
9516     ENABLE_FUZZERS="TRUE"
9517     AC_DEFINE([ENABLE_FUZZERS],1)
9518     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9520 AC_SUBST(LIB_FUZZING_ENGINE)
9522 dnl ===================================================================
9523 dnl Check for system zlib
9524 dnl ===================================================================
9525 if test "$with_system_zlib" = "auto"; then
9526     case "$_os" in
9527     WINNT)
9528         with_system_zlib="$with_system_libs"
9529         ;;
9530     *)
9531         if test "$enable_fuzzers" != "yes"; then
9532             with_system_zlib=yes
9533         else
9534             with_system_zlib=no
9535         fi
9536         ;;
9537     esac
9540 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9541 dnl and has no pkg-config for it at least on some tinderboxes,
9542 dnl so leaving that out for now
9543 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9544 AC_MSG_CHECKING([which zlib to use])
9545 if test "$with_system_zlib" = "yes"; then
9546     AC_MSG_RESULT([external])
9547     SYSTEM_ZLIB=TRUE
9548     AC_CHECK_HEADER(zlib.h, [],
9549         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9550     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9551         [AC_MSG_ERROR(zlib not found or functional)], [])
9552 else
9553     AC_MSG_RESULT([internal])
9554     SYSTEM_ZLIB=
9555     BUILD_TYPE="$BUILD_TYPE ZLIB"
9556     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9557     if test "$COM" = "MSC"; then
9558         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9559     else
9560         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9561     fi
9563 AC_SUBST(ZLIB_CFLAGS)
9564 AC_SUBST(ZLIB_LIBS)
9565 AC_SUBST(SYSTEM_ZLIB)
9567 dnl ===================================================================
9568 dnl Check for system jpeg
9569 dnl ===================================================================
9570 AC_MSG_CHECKING([which libjpeg to use])
9571 if test "$with_system_jpeg" = "yes"; then
9572     AC_MSG_RESULT([external])
9573     SYSTEM_LIBJPEG=TRUE
9574     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9575         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9576     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9577         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9578 else
9579     SYSTEM_LIBJPEG=
9580     AC_MSG_RESULT([internal, libjpeg-turbo])
9581     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9583     case "$host_cpu" in
9584     x86_64 | amd64 | i*86 | x86 | ia32)
9585         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9586         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9587             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9588                 NASM="$LODE_HOME/opt/bin/nasm"
9589             elif test -x "/opt/lo/bin/nasm"; then
9590                 NASM="/opt/lo/bin/nasm"
9591             fi
9592         fi
9594         if test -n "$NASM"; then
9595             AC_MSG_CHECKING([for object file format of host system])
9596             case "$host_os" in
9597               cygwin* | mingw* | pw32* | wsl*)
9598                 case "$host_cpu" in
9599                   x86_64)
9600                     objfmt='Win64-COFF'
9601                     ;;
9602                   *)
9603                     objfmt='Win32-COFF'
9604                     ;;
9605                 esac
9606               ;;
9607               msdosdjgpp* | go32*)
9608                 objfmt='COFF'
9609               ;;
9610               os2-emx*) # not tested
9611                 objfmt='MSOMF' # obj
9612               ;;
9613               linux*coff* | linux*oldld*)
9614                 objfmt='COFF' # ???
9615               ;;
9616               linux*aout*)
9617                 objfmt='a.out'
9618               ;;
9619               linux*)
9620                 case "$host_cpu" in
9621                   x86_64)
9622                     objfmt='ELF64'
9623                     ;;
9624                   *)
9625                     objfmt='ELF'
9626                     ;;
9627                 esac
9628               ;;
9629               kfreebsd* | freebsd* | netbsd* | openbsd*)
9630                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9631                   objfmt='BSD-a.out'
9632                 else
9633                   case "$host_cpu" in
9634                     x86_64 | amd64)
9635                       objfmt='ELF64'
9636                       ;;
9637                     *)
9638                       objfmt='ELF'
9639                       ;;
9640                   esac
9641                 fi
9642               ;;
9643               solaris* | sunos* | sysv* | sco*)
9644                 case "$host_cpu" in
9645                   x86_64)
9646                     objfmt='ELF64'
9647                     ;;
9648                   *)
9649                     objfmt='ELF'
9650                     ;;
9651                 esac
9652               ;;
9653               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9654                 case "$host_cpu" in
9655                   x86_64)
9656                     objfmt='Mach-O64'
9657                     ;;
9658                   *)
9659                     objfmt='Mach-O'
9660                     ;;
9661                 esac
9662               ;;
9663               *)
9664                 objfmt='ELF ?'
9665               ;;
9666             esac
9668             AC_MSG_RESULT([$objfmt])
9669             if test "$objfmt" = 'ELF ?'; then
9670               objfmt='ELF'
9671               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9672             fi
9674             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9675             case "$objfmt" in
9676               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9677               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9678               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9679               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9680               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9681               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9682               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9683               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9684               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9685               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9686               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9687             esac
9688             AC_MSG_RESULT([$NAFLAGS])
9690             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9691             cat > conftest.asm << EOF
9692             [%line __oline__ "configure"
9693                     section .text
9694                     global  _main,main
9695             _main:
9696             main:   xor     eax,eax
9697                     ret
9698             ]
9700             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9701             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9702               AC_MSG_RESULT(yes)
9703             else
9704               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9705               cat conftest.asm >&AS_MESSAGE_LOG_FD
9706               rm -rf conftest*
9707               AC_MSG_RESULT(no)
9708               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9709               NASM=""
9710             fi
9712         fi
9714         if test -z "$NASM"; then
9715 cat << _EOS
9716 ****************************************************************************
9717 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9718 To get one please:
9720 _EOS
9721             if test "$build_os" = "cygwin"; then
9722 cat << _EOS
9723 install a pre-compiled binary for Win32
9725 mkdir -p /opt/lo/bin
9726 cd /opt/lo/bin
9727 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9728 chmod +x nasm
9730 or get and install one from https://www.nasm.us/
9732 Then re-run autogen.sh
9734 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9735 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9737 _EOS
9738             else
9739 cat << _EOS
9740 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9742 _EOS
9743             fi
9744             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9745             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9746         fi
9747       ;;
9748     esac
9751 AC_SUBST(NASM)
9752 AC_SUBST(NAFLAGS)
9753 AC_SUBST(LIBJPEG_CFLAGS)
9754 AC_SUBST(LIBJPEG_LIBS)
9755 AC_SUBST(SYSTEM_LIBJPEG)
9757 dnl ===================================================================
9758 dnl Check for system clucene
9759 dnl ===================================================================
9760 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9761 if test "$SYSTEM_CLUCENE" = TRUE; then
9762     AC_LANG_PUSH([C++])
9763     save_CXXFLAGS=$CXXFLAGS
9764     save_CPPFLAGS=$CPPFLAGS
9765     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9766     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9767     dnl https://sourceforge.net/p/clucene/bugs/200/
9768     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9769     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9770                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9771     CXXFLAGS=$save_CXXFLAGS
9772     CPPFLAGS=$save_CPPFLAGS
9773     AC_LANG_POP([C++])
9774     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9777 dnl ===================================================================
9778 dnl Check for system expat
9779 dnl ===================================================================
9780 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9782 dnl ===================================================================
9783 dnl Check for system xmlsec
9784 dnl ===================================================================
9785 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9787 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9788 if test "$enable_eot" = "yes"; then
9789     ENABLE_EOT="TRUE"
9790     AC_DEFINE([ENABLE_EOT])
9791     AC_MSG_RESULT([yes])
9793     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9794 else
9795     ENABLE_EOT=
9796     AC_MSG_RESULT([no])
9798 AC_SUBST([ENABLE_EOT])
9800 dnl ===================================================================
9801 dnl Check for DLP libs
9802 dnl ===================================================================
9803 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9804 AS_IF([test "$COM" = "MSC"],
9805       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9806       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9808 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9809 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9811 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9813 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9815 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9816 AS_IF([test "$COM" = "MSC"],
9817       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9818       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9820 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9821 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9823 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9825 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9826 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9828 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9830 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9832 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9834 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9835 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9837 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9838 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9840 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9842 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9843 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9845 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9847 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9849 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9851 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9853 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9854 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9856 dnl ===================================================================
9857 dnl Check for system lcms2
9858 dnl ===================================================================
9859 if test "$with_system_lcms2" != "yes"; then
9860     SYSTEM_LCMS2=
9862 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9863 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9864 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9865 if test "$GCC" = "yes"; then
9866     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9868 if test "$COM" = "MSC"; then # override the above
9869     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9872 dnl ===================================================================
9873 dnl Check for system cppunit
9874 dnl ===================================================================
9875 if test "$_os" != "Android" ; then
9876     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9879 dnl ===================================================================
9880 dnl Check whether freetype is available
9882 dnl FreeType has 3 different kinds of versions
9883 dnl * release, like 2.4.10
9884 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9885 dnl * soname
9886 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9888 dnl 9.9.3 is 2.2.0
9889 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9890 dnl ===================================================================
9891 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9892 if test "x$ac_config_site_64bit_host" = xYES; then
9893     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9894 else
9895     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9897 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9899 # ===================================================================
9900 # Check for system libxslt
9901 # to prevent incompatibilities between internal libxml2 and external libxslt,
9902 # or vice versa, use with_system_libxml here
9903 # ===================================================================
9904 if test "$with_system_libxml" = "auto"; then
9905     case "$_os" in
9906     WINNT|iOS|Android)
9907         with_system_libxml="$with_system_libs"
9908         ;;
9909     Emscripten)
9910         with_system_libxml=no
9911         ;;
9912     *)
9913         if test "$enable_fuzzers" != "yes"; then
9914             with_system_libxml=yes
9915         else
9916             with_system_libxml=no
9917         fi
9918         ;;
9919     esac
9922 AC_MSG_CHECKING([which libxslt to use])
9923 if test "$with_system_libxml" = "yes"; then
9924     AC_MSG_RESULT([external])
9925     SYSTEM_LIBXSLT=TRUE
9926     if test "$_os" = "Darwin"; then
9927         dnl make sure to use SDK path
9928         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9929         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9930         dnl omit -L/usr/lib
9931         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9932         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9933     else
9934         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9935         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9936         FilterLibs "${LIBXSLT_LIBS}"
9937         LIBXSLT_LIBS="${filteredlibs}"
9938         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9939         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9940         FilterLibs "${LIBEXSLT_LIBS}"
9941         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9942     fi
9944     dnl Check for xsltproc
9945     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9946     if test "$XSLTPROC" = "no"; then
9947         AC_MSG_ERROR([xsltproc is required])
9948     fi
9949 else
9950     AC_MSG_RESULT([internal])
9951     SYSTEM_LIBXSLT=
9952     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9954 AC_SUBST(SYSTEM_LIBXSLT)
9955 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9956     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9958 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9960 AC_SUBST(LIBEXSLT_CFLAGS)
9961 AC_SUBST(LIBEXSLT_LIBS)
9962 AC_SUBST(LIBXSLT_CFLAGS)
9963 AC_SUBST(LIBXSLT_LIBS)
9964 AC_SUBST(XSLTPROC)
9966 # ===================================================================
9967 # Check for system libxml
9968 # ===================================================================
9969 AC_MSG_CHECKING([which libxml to use])
9970 if test "$with_system_libxml" = "yes"; then
9971     AC_MSG_RESULT([external])
9972     SYSTEM_LIBXML=TRUE
9973     if test "$_os" = "Darwin"; then
9974         dnl make sure to use SDK path
9975         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9976         dnl omit -L/usr/lib
9977         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9978     elif test $_os = iOS; then
9979         dnl make sure to use SDK path
9980         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9981         LIBXML_CFLAGS="-I$usr/include/libxml2"
9982         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9983     else
9984         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9985         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9986         FilterLibs "${LIBXML_LIBS}"
9987         LIBXML_LIBS="${filteredlibs}"
9988     fi
9990     dnl Check for xmllint
9991     AC_PATH_PROG(XMLLINT, xmllint, no)
9992     if test "$XMLLINT" = "no"; then
9993         AC_MSG_ERROR([xmllint is required])
9994     fi
9995 else
9996     AC_MSG_RESULT([internal])
9997     SYSTEM_LIBXML=
9998     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9999     if test "$COM" = "MSC"; then
10000         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10001     fi
10002     if test "$COM" = "MSC"; then
10003         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
10004     else
10005         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10006         if test "$DISABLE_DYNLOADING" = TRUE; then
10007             LIBXML_LIBS="$LIBXML_LIBS -lm"
10008         fi
10009     fi
10010     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10012 AC_SUBST(SYSTEM_LIBXML)
10013 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10014     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10016 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10017 AC_SUBST(LIBXML_CFLAGS)
10018 AC_SUBST(LIBXML_LIBS)
10019 AC_SUBST(XMLLINT)
10021 # =====================================================================
10022 # Checking for a Python interpreter with version >= 3.3.
10023 # Optionally user can pass an option to configure, i. e.
10024 # ./configure PYTHON=/usr/bin/python
10025 # =====================================================================
10026 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10027     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10028     # unless PYTHON is defined as above which allows 'system'
10029     enable_python=internal
10031 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10032     if test -n "$PYTHON"; then
10033         PYTHON_FOR_BUILD=$PYTHON
10034     else
10035         # This allows a lack of system python with no error, we use internal one in that case.
10036         AM_PATH_PYTHON([3.3],, [:])
10037         # Clean PYTHON_VERSION checked below if cross-compiling
10038         PYTHON_VERSION=""
10039         if test "$PYTHON" != ":"; then
10040             PYTHON_FOR_BUILD=$PYTHON
10041         fi
10042     fi
10045 # Checks for Python to use for Pyuno
10046 AC_MSG_CHECKING([which Python to use for Pyuno])
10047 case "$enable_python" in
10048 no|disable)
10049     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10050         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10051         # requirement from the choice whether to include Python stuff in the installer, but why
10052         # bother?
10053         AC_MSG_ERROR([Python is required at build time.])
10054     fi
10055     enable_python=no
10056     AC_MSG_RESULT([none])
10057     ;;
10058 ""|yes|auto)
10059     if test "$DISABLE_SCRIPTING" = TRUE; then
10060         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10061             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10062         fi
10063         AC_MSG_RESULT([none, overridden by --disable-scripting])
10064         enable_python=no
10065     elif test $build_os = cygwin -o $build_os = wsl; then
10066         dnl When building on Windows we don't attempt to use any installed
10067         dnl "system"  Python.
10068         AC_MSG_RESULT([fully internal])
10069         enable_python=internal
10070     elif test "$cross_compiling" = yes; then
10071         AC_MSG_RESULT([system])
10072         enable_python=system
10073     else
10074         # Unset variables set by the above AM_PATH_PYTHON so that
10075         # we actually do check anew.
10076         AC_MSG_RESULT([])
10077         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
10078         AM_PATH_PYTHON([3.3],, [:])
10079         AC_MSG_CHECKING([which Python to use for Pyuno])
10080         if test "$PYTHON" = ":"; then
10081             if test -z "$PYTHON_FOR_BUILD"; then
10082                 AC_MSG_RESULT([fully internal])
10083             else
10084                 AC_MSG_RESULT([internal])
10085             fi
10086             enable_python=internal
10087         else
10088             AC_MSG_RESULT([system])
10089             enable_python=system
10090         fi
10091     fi
10092     ;;
10093 internal)
10094     AC_MSG_RESULT([internal])
10095     ;;
10096 fully-internal)
10097     AC_MSG_RESULT([fully internal])
10098     enable_python=internal
10099     ;;
10100 system)
10101     AC_MSG_RESULT([system])
10102     if test "$_os" = Darwin -a -z "$PYTHON"; then
10103         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10104     fi
10105     ;;
10107     AC_MSG_ERROR([Incorrect --enable-python option])
10108     ;;
10109 esac
10111 if test $enable_python != no; then
10112     BUILD_TYPE="$BUILD_TYPE PYUNO"
10115 if test $enable_python = system; then
10116     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10117         # Fallback: Accept these in the environment, or as set above
10118         # for MacOSX.
10119         :
10120     elif test "$cross_compiling" != yes; then
10121         # Unset variables set by the above AM_PATH_PYTHON so that
10122         # we actually do check anew.
10123         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
10124         # This causes an error if no python command is found
10125         AM_PATH_PYTHON([3.3])
10126         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10127         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10128         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10129         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10130         if test -z "$PKG_CONFIG"; then
10131             PYTHON_CFLAGS="-I$python_include"
10132             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10133         elif $PKG_CONFIG --exists python-$python_version-embed; then
10134             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10135             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10136         elif $PKG_CONFIG --exists python-$python_version; then
10137             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10138             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10139         else
10140             PYTHON_CFLAGS="-I$python_include"
10141             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10142         fi
10143         FilterLibs "${PYTHON_LIBS}"
10144         PYTHON_LIBS="${filteredlibs}"
10145     else
10146         dnl How to find out the cross-compilation Python installation path?
10147         AC_MSG_CHECKING([for python version])
10148         AS_IF([test -n "$PYTHON_VERSION"],
10149               [AC_MSG_RESULT([$PYTHON_VERSION])],
10150               [AC_MSG_RESULT([not found])
10151                AC_MSG_ERROR([no usable python found])])
10152         test -n "$PYTHON_CFLAGS" && break
10153     fi
10155     dnl Check if the headers really work
10156     save_CPPFLAGS="$CPPFLAGS"
10157     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10158     AC_CHECK_HEADER(Python.h)
10159     CPPFLAGS="$save_CPPFLAGS"
10161     # let the PYTHON_FOR_BUILD match the same python installation that
10162     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10163     # better for PythonTests.
10164     PYTHON_FOR_BUILD=$PYTHON
10167 if test "$with_lxml" != no; then
10168     if test -z "$PYTHON_FOR_BUILD"; then
10169         case $build_os in
10170             cygwin)
10171                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10172                 ;;
10173             *)
10174                 if test "$cross_compiling" != yes ; then
10175                     BUILD_TYPE="$BUILD_TYPE LXML"
10176                 fi
10177                 ;;
10178         esac
10179     else
10180         AC_MSG_CHECKING([for python lxml])
10181         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10182             AC_MSG_RESULT([yes])
10183         else
10184             case $build_os in
10185                 cygwin)
10186                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10187                     ;;
10188                 *)
10189                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10190                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10191                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10192                         else
10193                             BUILD_TYPE="$BUILD_TYPE LXML"
10194                             AC_MSG_RESULT([no, using internal lxml])
10195                         fi
10196                     else
10197                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10198                     fi
10199                     ;;
10200             esac
10201         fi
10202     fi
10205 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10206     SYSTEM_PYTHON=
10207     PYTHON_VERSION_MAJOR=3
10208     PYTHON_VERSION_MINOR=8
10209     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.19
10210     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10211         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10212     fi
10213     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10215     # Embedded Python dies without Home set
10216     if test "$HOME" = ""; then
10217         export HOME=""
10218     fi
10221 dnl By now enable_python should be "system", "internal" or "no"
10222 case $enable_python in
10223 system)
10224     SYSTEM_PYTHON=TRUE
10226     if test "x$ac_cv_header_Python_h" != "xyes"; then
10227        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10228     fi
10230     AC_LANG_PUSH(C)
10231     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10232     AC_MSG_CHECKING([for correct python library version])
10233        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10234 #include <Python.h>
10236 int main(int argc, char **argv) {
10237    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10238    else return 1;
10240        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10241     AC_LANG_POP(C)
10243     dnl FIXME Check if the Python library can be linked with, too?
10244     ;;
10246 internal)
10247     BUILD_TYPE="$BUILD_TYPE PYTHON"
10248     if test "$OS" = LINUX -o "$OS" = WNT ; then
10249         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10250     fi
10251     ;;
10253     DISABLE_PYTHON=TRUE
10254     SYSTEM_PYTHON=
10255     ;;
10257     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10258     ;;
10259 esac
10261 AC_SUBST(DISABLE_PYTHON)
10262 AC_SUBST(SYSTEM_PYTHON)
10263 AC_SUBST(PYTHON_CFLAGS)
10264 AC_SUBST(PYTHON_FOR_BUILD)
10265 AC_SUBST(PYTHON_LIBS)
10266 AC_SUBST(PYTHON_VERSION)
10267 AC_SUBST(PYTHON_VERSION_MAJOR)
10268 AC_SUBST(PYTHON_VERSION_MINOR)
10270 AC_MSG_CHECKING([whether to build LibreLogo])
10271 case "$enable_python" in
10272 no|disable)
10273     AC_MSG_RESULT([no; Python disabled])
10274     ;;
10276     if test "${enable_librelogo}" = "no"; then
10277         AC_MSG_RESULT([no])
10278     else
10279         AC_MSG_RESULT([yes])
10280         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10281         AC_DEFINE([ENABLE_LIBRELOGO],1)
10282     fi
10283     ;;
10284 esac
10285 AC_SUBST(ENABLE_LIBRELOGO)
10287 ENABLE_MARIADBC=
10288 MARIADBC_MAJOR=1
10289 MARIADBC_MINOR=0
10290 MARIADBC_MICRO=2
10291 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10292 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10293     ENABLE_MARIADBC=TRUE
10294     AC_MSG_RESULT([yes])
10295     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10296 else
10297     AC_MSG_RESULT([no])
10299 AC_SUBST(ENABLE_MARIADBC)
10300 AC_SUBST(MARIADBC_MAJOR)
10301 AC_SUBST(MARIADBC_MINOR)
10302 AC_SUBST(MARIADBC_MICRO)
10304 if test "$ENABLE_MARIADBC" = "TRUE"; then
10305     dnl ===================================================================
10306     dnl Check for system MariaDB
10307     dnl ===================================================================
10309     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10310         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10311     fi
10313     AC_MSG_CHECKING([which MariaDB to use])
10314     if test "$with_system_mariadb" = "yes"; then
10315         AC_MSG_RESULT([external])
10316         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10317         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10318         if test -z "$MARIADBCONFIG"; then
10319             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10320             if test -z "$MARIADBCONFIG"; then
10321                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10322                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10323             fi
10324         fi
10325         AC_MSG_CHECKING([MariaDB version])
10326         MARIADB_VERSION=`$MARIADBCONFIG --version`
10327         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10328         if test "$MARIADB_MAJOR" -ge "5"; then
10329             AC_MSG_RESULT([OK])
10330         else
10331             AC_MSG_ERROR([too old, use 5.0.x or later])
10332         fi
10333         AC_MSG_CHECKING([for MariaDB Client library])
10334         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10335         if test "$COM_IS_CLANG" = TRUE; then
10336             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10337         fi
10338         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10339         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10340         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10341         dnl linux32:
10342         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10343             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10344             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10345                 | sed -e 's|/lib64/|/lib/|')
10346         fi
10347         FilterLibs "${MARIADB_LIBS}"
10348         MARIADB_LIBS="${filteredlibs}"
10349         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10350         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10351         if test "$enable_bundle_mariadb" = "yes"; then
10352             AC_MSG_RESULT([yes])
10353             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10354             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10356 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10358 /g' | grep -E '(mysqlclient|mariadb)')
10359             if test "$_os" = "Darwin"; then
10360                 LIBMARIADB=${LIBMARIADB}.dylib
10361                 if test "$with_gssapi" != "no"; then
10362                     WITH_GSSAPI=TRUE
10363                     save_LIBS=$LIBS
10364                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10365                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10366                     GSSAPI_LIBS=$LIBS
10367                     LIBS=$save_LIBS
10368                 fi
10369             elif test "$_os" = "WINNT"; then
10370                 LIBMARIADB=${LIBMARIADB}.dll
10371             else
10372                 LIBMARIADB=${LIBMARIADB}.so
10373                 if test "$with_gssapi" != "no"; then
10374                     WITH_GSSAPI=TRUE
10375                     save_LIBS=$LIBS
10376                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10377                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10378                     GSSAPI_LIBS=$LIBS
10379                     LIBS=$save_LIBS
10380                 fi
10381             fi
10382             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10383             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10384             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10385                 AC_MSG_RESULT([found.])
10386                 PathFormat "$LIBMARIADB_PATH"
10387                 LIBMARIADB_PATH="$formatted_path"
10388             else
10389                 AC_MSG_ERROR([not found.])
10390             fi
10391         else
10392             AC_MSG_RESULT([no])
10393             BUNDLE_MARIADB_CONNECTOR_C=
10394         fi
10395     else
10396         AC_MSG_RESULT([internal])
10397         SYSTEM_MARIADB_CONNECTOR_C=
10398         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10399         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10400         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10401     fi
10403     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10404     AC_SUBST(MARIADB_CFLAGS)
10405     AC_SUBST(MARIADB_LIBS)
10406     AC_SUBST(LIBMARIADB)
10407     AC_SUBST(LIBMARIADB_PATH)
10408     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10411 dnl ===================================================================
10412 dnl Check for system hsqldb
10413 dnl ===================================================================
10414 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10415     AC_MSG_CHECKING([which hsqldb to use])
10416     if test "$with_system_hsqldb" = "yes"; then
10417         AC_MSG_RESULT([external])
10418         SYSTEM_HSQLDB=TRUE
10419         if test -z $HSQLDB_JAR; then
10420             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10421         fi
10422         if ! test -f $HSQLDB_JAR; then
10423                AC_MSG_ERROR(hsqldb.jar not found.)
10424         fi
10425         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10426         export HSQLDB_JAR
10427         if $PERL -e \
10428            'use Archive::Zip;
10429             my $file = "$ENV{'HSQLDB_JAR'}";
10430             my $zip = Archive::Zip->new( $file );
10431             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10432             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10433             {
10434                 push @l, split(/\n/, $mf);
10435                 foreach my $line (@l)
10436                 {
10437                     if ($line =~ m/Specification-Version:/)
10438                     {
10439                         ($t, $version) = split (/:/,$line);
10440                         $version =~ s/^\s//;
10441                         ($a, $b, $c, $d) = split (/\./,$version);
10442                         if ($c == "0" && $d > "8")
10443                         {
10444                             exit 0;
10445                         }
10446                         else
10447                         {
10448                             exit 1;
10449                         }
10450                     }
10451                 }
10452             }
10453             else
10454             {
10455                 exit 1;
10456             }'; then
10457             AC_MSG_RESULT([yes])
10458         else
10459             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10460         fi
10461     else
10462         AC_MSG_RESULT([internal])
10463         SYSTEM_HSQLDB=
10464         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10465         NEED_ANT=TRUE
10466     fi
10467 else
10468     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10469         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10470     fi
10472 AC_SUBST(SYSTEM_HSQLDB)
10473 AC_SUBST(HSQLDB_JAR)
10475 dnl ===================================================================
10476 dnl Check for PostgreSQL stuff
10477 dnl ===================================================================
10478 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10479 if test "x$enable_postgresql_sdbc" != "xno"; then
10480     AC_MSG_RESULT([yes])
10481     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10483     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10484         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10485     fi
10486     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10487         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10488     fi
10490     postgres_interface=""
10491     if test "$with_system_postgresql" = "yes"; then
10492         postgres_interface="external PostgreSQL"
10493         SYSTEM_POSTGRESQL=TRUE
10494         if test "$_os" = Darwin; then
10495             supp_path=''
10496             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10497                 pg_supp_path="$P_SEP$d$pg_supp_path"
10498             done
10499         fi
10500         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10501         if test -n "$PGCONFIG"; then
10502             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10503             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10504         else
10505             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10506               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10507               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10508             ],[
10509               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10510             ])
10511         fi
10512         FilterLibs "${POSTGRESQL_LIB}"
10513         POSTGRESQL_LIB="${filteredlibs}"
10514     else
10515         # if/when anything else than PostgreSQL uses Kerberos,
10516         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10517         WITH_KRB5=
10518         WITH_GSSAPI=
10519         case "$_os" in
10520         Darwin)
10521             # macOS has system MIT Kerberos 5 since 10.4
10522             if test "$with_krb5" != "no"; then
10523                 WITH_KRB5=TRUE
10524                 save_LIBS=$LIBS
10525                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10526                 # that the libraries where these functions are located on macOS will change, is it?
10527                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10528                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10529                 KRB5_LIBS=$LIBS
10530                 LIBS=$save_LIBS
10531                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10532                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10533                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10534                 LIBS=$save_LIBS
10535             fi
10536             if test "$with_gssapi" != "no"; then
10537                 WITH_GSSAPI=TRUE
10538                 save_LIBS=$LIBS
10539                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10540                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10541                 GSSAPI_LIBS=$LIBS
10542                 LIBS=$save_LIBS
10543             fi
10544             ;;
10545         WINNT)
10546             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10547                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10548             fi
10549             ;;
10550         Linux|GNU|*BSD|DragonFly)
10551             if test "$with_krb5" != "no"; then
10552                 WITH_KRB5=TRUE
10553                 save_LIBS=$LIBS
10554                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10555                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10556                 KRB5_LIBS=$LIBS
10557                 LIBS=$save_LIBS
10558                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10559                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10560                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10561                 LIBS=$save_LIBS
10562             fi
10563             if test "$with_gssapi" != "no"; then
10564                 WITH_GSSAPI=TRUE
10565                 save_LIBS=$LIBS
10566                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10567                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10568                 GSSAPI_LIBS=$LIBS
10569                 LIBS=$save_LIBS
10570             fi
10571             ;;
10572         *)
10573             if test "$with_krb5" = "yes"; then
10574                 WITH_KRB5=TRUE
10575                 save_LIBS=$LIBS
10576                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10577                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10578                 KRB5_LIBS=$LIBS
10579                 LIBS=$save_LIBS
10580                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10581                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10582                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10583                 LIBS=$save_LIBS
10584             fi
10585             if test "$with_gssapi" = "yes"; then
10586                 WITH_GSSAPI=TRUE
10587                 save_LIBS=$LIBS
10588                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10589                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10590                 LIBS=$save_LIBS
10591                 GSSAPI_LIBS=$LIBS
10592             fi
10593         esac
10595         if test -n "$with_libpq_path"; then
10596             SYSTEM_POSTGRESQL=TRUE
10597             postgres_interface="external libpq"
10598             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10599             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10600         else
10601             SYSTEM_POSTGRESQL=
10602             postgres_interface="internal"
10603             POSTGRESQL_LIB=""
10604             POSTGRESQL_INC="%OVERRIDE_ME%"
10605             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10606         fi
10607     fi
10609     AC_MSG_CHECKING([PostgreSQL C interface])
10610     AC_MSG_RESULT([$postgres_interface])
10612     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10613         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10614         save_CFLAGS=$CFLAGS
10615         save_CPPFLAGS=$CPPFLAGS
10616         save_LIBS=$LIBS
10617         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10618         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10619         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10620         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10621             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10622         CFLAGS=$save_CFLAGS
10623         CPPFLAGS=$save_CPPFLAGS
10624         LIBS=$save_LIBS
10625     fi
10626     BUILD_POSTGRESQL_SDBC=TRUE
10627 else
10628     AC_MSG_RESULT([no])
10630 AC_SUBST(WITH_KRB5)
10631 AC_SUBST(WITH_GSSAPI)
10632 AC_SUBST(GSSAPI_LIBS)
10633 AC_SUBST(KRB5_LIBS)
10634 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10635 AC_SUBST(SYSTEM_POSTGRESQL)
10636 AC_SUBST(POSTGRESQL_INC)
10637 AC_SUBST(POSTGRESQL_LIB)
10639 dnl ===================================================================
10640 dnl Check for Firebird stuff
10641 dnl ===================================================================
10642 ENABLE_FIREBIRD_SDBC=
10643 if test "$enable_firebird_sdbc" = "yes" ; then
10644     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10646     dnl ===================================================================
10647     dnl Check for system Firebird
10648     dnl ===================================================================
10649     AC_MSG_CHECKING([which Firebird to use])
10650     if test "$with_system_firebird" = "yes"; then
10651         AC_MSG_RESULT([external])
10652         SYSTEM_FIREBIRD=TRUE
10653         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10654         if test -z "$FIREBIRDCONFIG"; then
10655             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10656             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10657                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10658             ])
10659             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10660         else
10661             AC_MSG_NOTICE([fb_config found])
10662             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10663             AC_MSG_CHECKING([for Firebird Client library])
10664             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10665             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10666             FilterLibs "${FIREBIRD_LIBS}"
10667             FIREBIRD_LIBS="${filteredlibs}"
10668         fi
10669         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10670         AC_MSG_CHECKING([Firebird version])
10671         if test -n "${FIREBIRD_VERSION}"; then
10672             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10673             if test "$FIREBIRD_MAJOR" -ge "3"; then
10674                 AC_MSG_RESULT([OK])
10675             else
10676                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10677             fi
10678         else
10679             save_CFLAGS="${CFLAGS}"
10680             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10681             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10682 #if defined(FB_API_VER) && FB_API_VER == 30
10683 int fb_api_is_30(void) { return 0; }
10684 #else
10685 #error "Wrong Firebird API version"
10686 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10687             CFLAGS="$save_CFLAGS"
10688         fi
10689         ENABLE_FIREBIRD_SDBC=TRUE
10690         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10691     elif test "$enable_database_connectivity" = no; then
10692         AC_MSG_RESULT([none])
10693     elif test "$cross_compiling" = "yes"; then
10694         AC_MSG_RESULT([none])
10695     else
10696         dnl Embedded Firebird has version 3.0
10697         dnl We need libatomic_ops for any non X86/X64 system
10698         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10699             dnl ===================================================================
10700             dnl Check for system libatomic_ops
10701             dnl ===================================================================
10702             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10703             if test "$with_system_libatomic_ops" = "yes"; then
10704                 SYSTEM_LIBATOMIC_OPS=TRUE
10705                 AC_CHECK_HEADERS(atomic_ops.h, [],
10706                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10707             else
10708                 SYSTEM_LIBATOMIC_OPS=
10709                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10710                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10711                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10712             fi
10713         fi
10715         AC_MSG_RESULT([internal])
10716         SYSTEM_FIREBIRD=
10717         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10718         FIREBIRD_LIBS="-lfbclient"
10720         if test "$with_system_libtommath" = "yes"; then
10721             SYSTEM_LIBTOMMATH=TRUE
10722             dnl check for tommath presence
10723             save_LIBS=$LIBS
10724             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10725             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10726             LIBS=$save_LIBS
10727         else
10728             SYSTEM_LIBTOMMATH=
10729             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10730             LIBTOMMATH_LIBS="-ltommath"
10731             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10732         fi
10734         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10735         ENABLE_FIREBIRD_SDBC=TRUE
10736         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10737     fi
10739 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10740 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10741 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10742 AC_SUBST(LIBATOMIC_OPS_LIBS)
10743 AC_SUBST(SYSTEM_FIREBIRD)
10744 AC_SUBST(FIREBIRD_CFLAGS)
10745 AC_SUBST(FIREBIRD_LIBS)
10746 AC_SUBST(SYSTEM_LIBTOMMATH)
10747 AC_SUBST(LIBTOMMATH_CFLAGS)
10748 AC_SUBST(LIBTOMMATH_LIBS)
10750 dnl ===================================================================
10751 dnl Check for system curl
10752 dnl ===================================================================
10753 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10755 dnl ===================================================================
10756 dnl Check for system boost
10757 dnl ===================================================================
10758 AC_MSG_CHECKING([which boost to use])
10759 if test "$with_system_boost" = "yes"; then
10760     AC_MSG_RESULT([external])
10761     SYSTEM_BOOST=TRUE
10762     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10763     AX_BOOST_DATE_TIME
10764     AX_BOOST_FILESYSTEM
10765     AX_BOOST_IOSTREAMS
10766     AX_BOOST_LOCALE
10767     AC_LANG_PUSH([C++])
10768     save_CXXFLAGS=$CXXFLAGS
10769     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10770     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10771        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10772     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10773        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10774     CXXFLAGS=$save_CXXFLAGS
10775     AC_LANG_POP([C++])
10776     # this is in m4/ax_boost_base.m4
10777     FilterLibs "${BOOST_LDFLAGS}"
10778     BOOST_LDFLAGS="${filteredlibs}"
10779 else
10780     AC_MSG_RESULT([internal])
10781     BUILD_TYPE="$BUILD_TYPE BOOST"
10782     SYSTEM_BOOST=
10783     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10784         # use warning-suppressing wrapper headers
10785         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10786     else
10787         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10788     fi
10790 AC_SUBST(SYSTEM_BOOST)
10792 dnl ===================================================================
10793 dnl Check for system mdds
10794 dnl ===================================================================
10795 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10796 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10798 dnl ===================================================================
10799 dnl Check for system dragonbox
10800 dnl ===================================================================
10801 AC_MSG_CHECKING([which dragonbox to use])
10802 if test "$with_system_dragonbox" = "yes"; then
10803     AC_MSG_RESULT([external])
10804     SYSTEM_DRAGONBOX=TRUE
10805     AC_LANG_PUSH([C++])
10806     save_CPPFLAGS=$CPPFLAGS
10807     # This is where upstream installs to, unfortunately no .pc or so...
10808     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10809     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10810     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10811        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10812     AC_LANG_POP([C++])
10813     CPPFLAGS=$save_CPPFLAGS
10814 else
10815     AC_MSG_RESULT([internal])
10816     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10817     SYSTEM_DRAGONBOX=
10819 AC_SUBST([SYSTEM_DRAGONBOX])
10820 AC_SUBST([DRAGONBOX_CFLAGS])
10822 dnl ===================================================================
10823 dnl Check for system frozen
10824 dnl ===================================================================
10825 AC_MSG_CHECKING([which frozen to use])
10826 if test "$with_system_frozen" = "yes"; then
10827     AC_MSG_RESULT([external])
10828     SYSTEM_FROZEN=TRUE
10829     AC_LANG_PUSH([C++])
10830     save_CPPFLAGS=$CPPFLAGS
10831     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10832        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10833     AC_LANG_POP([C++])
10834     CPPFLAGS=$save_CPPFLAGS
10835 else
10836     AC_MSG_RESULT([internal])
10837     BUILD_TYPE="$BUILD_TYPE FROZEN"
10838     SYSTEM_FROZEN=
10840 AC_SUBST([SYSTEM_FROZEN])
10841 AC_SUBST([FROZEN_CFLAGS])
10843 dnl ===================================================================
10844 dnl Check for system libfixmath
10845 dnl ===================================================================
10846 AC_MSG_CHECKING([which libfixmath to use])
10847 if test "$with_system_libfixmath" = "yes"; then
10848     AC_MSG_RESULT([external])
10849     SYSTEM_LIBFIXMATH=TRUE
10850     AC_LANG_PUSH([C++])
10851     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10852        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10853     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10854                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10855                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10856     AC_LANG_POP([C++])
10857 else
10858     AC_MSG_RESULT([internal])
10859     SYSTEM_LIBFIXMATH=
10860     LIBFIXMATH_LIBS=
10862 AC_SUBST([SYSTEM_LIBFIXMATH])
10863 AC_SUBST([LIBFIXMATH_LIBS])
10865 dnl ===================================================================
10866 dnl Check for system glm
10867 dnl ===================================================================
10868 AC_MSG_CHECKING([which glm to use])
10869 if test "$with_system_glm" = "yes"; then
10870     AC_MSG_RESULT([external])
10871     SYSTEM_GLM=TRUE
10872     AC_LANG_PUSH([C++])
10873     AC_CHECK_HEADER([glm/glm.hpp], [],
10874        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10875     AC_LANG_POP([C++])
10876 else
10877     AC_MSG_RESULT([internal])
10878     BUILD_TYPE="$BUILD_TYPE GLM"
10879     SYSTEM_GLM=
10880     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10882 AC_SUBST([GLM_CFLAGS])
10883 AC_SUBST([SYSTEM_GLM])
10885 dnl ===================================================================
10886 dnl Check for system odbc
10887 dnl ===================================================================
10888 AC_MSG_CHECKING([which odbc headers to use])
10889 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
10890     AC_MSG_RESULT([external])
10891     SYSTEM_ODBC_HEADERS=TRUE
10893     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10894         save_CPPFLAGS=$CPPFLAGS
10895         find_winsdk
10896         PathFormat "$winsdktest"
10897         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"
10898         AC_CHECK_HEADER(sqlext.h, [],
10899             [AC_MSG_ERROR(odbc not found. install odbc)],
10900             [#include <windows.h>])
10901         CPPFLAGS=$save_CPPFLAGS
10902     else
10903         AC_CHECK_HEADER(sqlext.h, [],
10904             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10905     fi
10906 elif test "$enable_database_connectivity" = no; then
10907     AC_MSG_RESULT([none])
10908 else
10909     AC_MSG_RESULT([internal])
10910     SYSTEM_ODBC_HEADERS=
10912 AC_SUBST(SYSTEM_ODBC_HEADERS)
10914 dnl ===================================================================
10915 dnl Check for system NSS
10916 dnl ===================================================================
10917 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10918     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10919     AC_DEFINE(HAVE_FEATURE_NSS)
10920     ENABLE_NSS=TRUE
10921 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10922     with_tls=openssl
10924 AC_SUBST(ENABLE_NSS)
10926 dnl ===================================================================
10927 dnl Enable LDAP support
10928 dnl ===================================================================
10930 if test "$test_openldap" = yes; then
10931     AC_MSG_CHECKING([whether to enable LDAP support])
10932     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10933         AC_MSG_RESULT([yes])
10934         ENABLE_LDAP=TRUE
10935     else
10936         if test "$enable_ldap" != "yes"; then
10937             AC_MSG_RESULT([no])
10938         else
10939             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10940         fi
10941     fi
10943 dnl ===================================================================
10944 dnl Check for system openldap
10945 dnl ===================================================================
10947     if test "$ENABLE_LDAP" = TRUE; then
10948         AC_MSG_CHECKING([which openldap library to use])
10949         if test "$with_system_openldap" = yes; then
10950             AC_MSG_RESULT([external])
10951             SYSTEM_OPENLDAP=TRUE
10952             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10953             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10954             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10955         else
10956             AC_MSG_RESULT([internal])
10957             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10958         fi
10959     fi
10962 AC_SUBST(ENABLE_LDAP)
10963 AC_SUBST(SYSTEM_OPENLDAP)
10965 dnl ===================================================================
10966 dnl Check for TLS/SSL and cryptographic implementation to use
10967 dnl ===================================================================
10968 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10969 if test -n "$with_tls"; then
10970     case $with_tls in
10971     openssl)
10972         AC_DEFINE(USE_TLS_OPENSSL)
10973         TLS=OPENSSL
10974         AC_MSG_RESULT([$TLS])
10976         if test "$enable_openssl" != "yes"; then
10977             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10978         fi
10980         # warn that OpenSSL has been selected but not all TLS code has this option
10981         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10982         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10983         ;;
10984     nss)
10985         AC_DEFINE(USE_TLS_NSS)
10986         TLS=NSS
10987         AC_MSG_RESULT([$TLS])
10988         ;;
10989     no)
10990         AC_MSG_RESULT([none])
10991         AC_MSG_WARN([Skipping TLS/SSL])
10992         ;;
10993     *)
10994         AC_MSG_RESULT([])
10995         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10996 openssl - OpenSSL
10997 nss - Mozilla's Network Security Services (NSS)
10998     ])
10999         ;;
11000     esac
11001 else
11002     # default to using NSS, it results in smaller oox lib
11003     AC_DEFINE(USE_TLS_NSS)
11004     TLS=NSS
11005     AC_MSG_RESULT([$TLS])
11007 AC_SUBST(TLS)
11009 dnl ===================================================================
11010 dnl Check for system sane
11011 dnl ===================================================================
11012 AC_MSG_CHECKING([which sane header to use])
11013 if test "$with_system_sane" = "yes"; then
11014     AC_MSG_RESULT([external])
11015     AC_CHECK_HEADER(sane/sane.h, [],
11016       [AC_MSG_ERROR(sane not found. install sane)], [])
11017 else
11018     AC_MSG_RESULT([internal])
11019     BUILD_TYPE="$BUILD_TYPE SANE"
11022 dnl ===================================================================
11023 dnl Check for system icu
11024 dnl ===================================================================
11025 ICU_MAJOR=73
11026 ICU_MINOR=2
11027 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11028 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
11029 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11030 if test "$SYSTEM_ICU" = TRUE; then
11031     AC_LANG_PUSH([C++])
11032     AC_MSG_CHECKING([for unicode/rbbi.h])
11033     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11034     AC_LANG_POP([C++])
11036     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11037     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11038     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11040     if test "$CROSS_COMPILING" != TRUE; then
11041         # using the system icu tools can lead to version confusion, use the
11042         # ones from the build environment when cross-compiling
11043         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11044         if test -z "$SYSTEM_GENBRK"; then
11045             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11046         fi
11047         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11048         if test -z "$SYSTEM_GENCCODE"; then
11049             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11050         fi
11051         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11052         if test -z "$SYSTEM_GENCMN"; then
11053             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11054         fi
11055     fi
11058 AC_SUBST(SYSTEM_GENBRK)
11059 AC_SUBST(SYSTEM_GENCCODE)
11060 AC_SUBST(SYSTEM_GENCMN)
11061 AC_SUBST(ICU_MAJOR)
11062 AC_SUBST(ICU_MINOR)
11064 dnl ==================================================================
11065 dnl CURL
11066 dnl ==================================================================
11067 if test "$enable_curl" == "yes"; then
11068     AC_DEFINE([HAVE_FEATURE_CURL])
11071 dnl ==================================================================
11072 dnl Breakpad
11073 dnl ==================================================================
11074 DEFAULT_CRASHDUMP_VALUE="true"
11075 AC_MSG_CHECKING([whether to enable breakpad])
11076 if test "$enable_breakpad" != yes; then
11077     AC_MSG_RESULT([no])
11078 else
11079     if test "$enable_curl" != "yes"; then
11080         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11081     fi
11082     AC_MSG_RESULT([yes])
11083     ENABLE_BREAKPAD="TRUE"
11084     AC_DEFINE(ENABLE_BREAKPAD)
11085     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11086     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11088     AC_MSG_CHECKING([for disable crash dump])
11089     if test "$enable_crashdump" = no; then
11090         DEFAULT_CRASHDUMP_VALUE="false"
11091         AC_MSG_RESULT([yes])
11092     else
11093        AC_MSG_RESULT([no])
11094     fi
11096     AC_MSG_CHECKING([for crashreport config])
11097     if test "$with_symbol_config" = "no"; then
11098         BREAKPAD_SYMBOL_CONFIG="invalid"
11099         AC_MSG_RESULT([no])
11100     else
11101         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11102         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11103         AC_MSG_RESULT([yes])
11104     fi
11105     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11107 AC_SUBST(ENABLE_BREAKPAD)
11108 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11110 dnl ==================================================================
11111 dnl libcmis
11112 dnl ==================================================================
11113 if test "$enable_libcmis" == "yes"; then
11114     if test "$enable_curl" != "yes"; then
11115         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11116     fi
11119 dnl ===================================================================
11120 dnl Orcus
11121 dnl ===================================================================
11122 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11123 if test "$with_system_orcus" != "yes"; then
11124     if test "$SYSTEM_BOOST" = "TRUE"; then
11125         dnl Link with Boost.System
11126         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11127         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11128         dnl in documentation has no effect.
11129         AX_BOOST_SYSTEM
11130     fi
11132 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11133 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11134 AC_SUBST([BOOST_SYSTEM_LIB])
11135 AC_SUBST(SYSTEM_LIBORCUS)
11137 dnl ===================================================================
11138 dnl HarfBuzz
11139 dnl ===================================================================
11140 harfbuzz_required_version=5.1.0
11142 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11143 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11144 case "$_os" in
11145     Linux)
11146         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
11147         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11148         ;;
11149     *)
11150         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
11151         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11152         ;;
11153 esac
11154 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11155 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11157 if test "$COM" = "MSC"; then # override the above
11158     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
11159     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11162 if test "$with_system_harfbuzz" = "yes"; then
11163     if test "$with_system_graphite" = "no"; then
11164         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11165     fi
11166     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11167     save_LIBS="$LIBS"
11168     save_CFLAGS="$CFLAGS"
11169     LIBS="$LIBS $HARFBUZZ_LIBS"
11170     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11171     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11172     LIBS="$save_LIBS"
11173     CFLAGS="$save_CFLAGS"
11174 else
11175     if test "$with_system_graphite" = "yes"; then
11176         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11177     fi
11180 if test "$USING_X11" = TRUE; then
11181     AC_PATH_X
11182     AC_PATH_XTRA
11183     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11185     if test -z "$x_includes"; then
11186         x_includes="default_x_includes"
11187     fi
11188     if test -z "$x_libraries"; then
11189         x_libraries="default_x_libraries"
11190     fi
11191     CFLAGS="$CFLAGS $X_CFLAGS"
11192     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11193     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11194 else
11195     x_includes="no_x_includes"
11196     x_libraries="no_x_libraries"
11199 if test "$USING_X11" = TRUE; then
11200     dnl ===================================================================
11201     dnl Check for extension headers
11202     dnl ===================================================================
11203     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11204      [#include <X11/extensions/shape.h>])
11206     # vcl needs ICE and SM
11207     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11208     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11209         [AC_MSG_ERROR(ICE library not found)])
11210     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11211     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11212         [AC_MSG_ERROR(SM library not found)])
11215 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11216     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11217     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11220 dnl ===================================================================
11221 dnl Check for system Xrender
11222 dnl ===================================================================
11223 AC_MSG_CHECKING([whether to use Xrender])
11224 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11225     AC_MSG_RESULT([yes])
11226     PKG_CHECK_MODULES(XRENDER, xrender)
11227     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11228     FilterLibs "${XRENDER_LIBS}"
11229     XRENDER_LIBS="${filteredlibs}"
11230     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11231       [AC_MSG_ERROR(libXrender not found or functional)], [])
11232     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11233       [AC_MSG_ERROR(Xrender not found. install X)], [])
11234 else
11235     AC_MSG_RESULT([no])
11237 AC_SUBST(XRENDER_CFLAGS)
11238 AC_SUBST(XRENDER_LIBS)
11240 dnl ===================================================================
11241 dnl Check for XRandr
11242 dnl ===================================================================
11243 AC_MSG_CHECKING([whether to enable RandR support])
11244 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11245     AC_MSG_RESULT([yes])
11246     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11247     if test "$ENABLE_RANDR" != "TRUE"; then
11248         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11249                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11250         XRANDR_CFLAGS=" "
11251         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11252           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11253         XRANDR_LIBS="-lXrandr "
11254         ENABLE_RANDR="TRUE"
11255     fi
11256     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11257     FilterLibs "${XRANDR_LIBS}"
11258     XRANDR_LIBS="${filteredlibs}"
11259 else
11260     ENABLE_RANDR=""
11261     AC_MSG_RESULT([no])
11263 AC_SUBST(XRANDR_CFLAGS)
11264 AC_SUBST(XRANDR_LIBS)
11265 AC_SUBST(ENABLE_RANDR)
11267 if test -z "$with_webdav"; then
11268     with_webdav=$test_webdav
11271 AC_MSG_CHECKING([for WebDAV support])
11272 case "$with_webdav" in
11274     AC_MSG_RESULT([no])
11275     WITH_WEBDAV=""
11276     ;;
11278     AC_MSG_RESULT([yes])
11279     # curl is already mandatory (almost) and checked elsewhere
11280     if test "$enable_curl" = "no"; then
11281         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11282     fi
11283     WITH_WEBDAV=TRUE
11284     ;;
11285 esac
11286 AC_SUBST(WITH_WEBDAV)
11288 dnl ===================================================================
11289 dnl Check for disabling cve_tests
11290 dnl ===================================================================
11291 AC_MSG_CHECKING([whether to execute CVE tests])
11292 if test "$enable_cve_tests" = "no"; then
11293     AC_MSG_RESULT([no])
11294     DISABLE_CVE_TESTS=TRUE
11295     AC_SUBST(DISABLE_CVE_TESTS)
11296 else
11297     AC_MSG_RESULT([yes])
11300 dnl ===================================================================
11301 dnl Check for system openssl
11302 dnl ===================================================================
11303 ENABLE_OPENSSL=
11304 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11305 if test "$enable_openssl" = "yes"; then
11306     AC_MSG_RESULT([no])
11307     ENABLE_OPENSSL=TRUE
11308     if test "$_os" = Darwin ; then
11309         # OpenSSL is deprecated when building for 10.7 or later.
11310         #
11311         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11312         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11314         with_system_openssl=no
11315         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11316     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11317             && test "$with_system_openssl" != "no"; then
11318         with_system_openssl=yes
11319         SYSTEM_OPENSSL=TRUE
11320         OPENSSL_CFLAGS=
11321         OPENSSL_LIBS="-lssl -lcrypto"
11322     else
11323         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11324         if test -n "${SYSTEM_OPENSSL}"; then
11325             AC_DEFINE([SYSTEM_OPENSSL])
11326         fi
11327     fi
11328     if test "$with_system_openssl" = "yes"; then
11329         AC_MSG_CHECKING([whether openssl supports SHA512])
11330         AC_LANG_PUSH([C])
11331         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11332             SHA512_CTX context;
11333 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11334         AC_LANG_POP(C)
11335     fi
11336 else
11337     AC_MSG_RESULT([yes])
11339     # warn that although OpenSSL is disabled, system libraries may depend on it
11340     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11341     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11344 AC_SUBST([ENABLE_OPENSSL])
11346 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11347     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11348         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11349         enable_cipher_openssl_backend=no
11350     else
11351         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11352     fi
11354 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11355 ENABLE_CIPHER_OPENSSL_BACKEND=
11356 if test "$enable_cipher_openssl_backend" = yes; then
11357     AC_MSG_RESULT([yes])
11358     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11359 else
11360     AC_MSG_RESULT([no])
11362 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11364 dnl ===================================================================
11365 dnl Select the crypto backends used by LO
11366 dnl ===================================================================
11368 if test "$build_crypto" = yes; then
11369     if test "$OS" = WNT; then
11370         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11371         AC_DEFINE([USE_CRYPTO_MSCAPI])
11372     elif test "$ENABLE_NSS" = TRUE; then
11373         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11374         AC_DEFINE([USE_CRYPTO_NSS])
11375     fi
11378 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11379 if test "$COM" = "MSC"; then
11380     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11381 else
11382     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11384 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11386 dnl ===================================================================
11387 dnl Check for system redland
11388 dnl ===================================================================
11389 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11390 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11391 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11392 if test "$with_system_redland" = "yes"; then
11393     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11394             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11395 else
11396     RAPTOR_MAJOR="0"
11397     RASQAL_MAJOR="3"
11398     REDLAND_MAJOR="0"
11400 AC_SUBST(RAPTOR_MAJOR)
11401 AC_SUBST(RASQAL_MAJOR)
11402 AC_SUBST(REDLAND_MAJOR)
11404 dnl ===================================================================
11405 dnl Check for system hunspell
11406 dnl ===================================================================
11407 AC_MSG_CHECKING([which libhunspell to use])
11408 if test "$with_system_hunspell" = "yes"; then
11409     AC_MSG_RESULT([external])
11410     SYSTEM_HUNSPELL=TRUE
11411     AC_LANG_PUSH([C++])
11412     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11413     if test "$HUNSPELL_PC" != "TRUE"; then
11414         AC_CHECK_HEADER(hunspell.hxx, [],
11415             [
11416             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11417             [AC_MSG_ERROR(hunspell headers not found.)], [])
11418             ], [])
11419         AC_CHECK_LIB([hunspell], [main], [:],
11420            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11421         HUNSPELL_LIBS=-lhunspell
11422     fi
11423     AC_LANG_POP([C++])
11424     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11425     FilterLibs "${HUNSPELL_LIBS}"
11426     HUNSPELL_LIBS="${filteredlibs}"
11427 else
11428     AC_MSG_RESULT([internal])
11429     SYSTEM_HUNSPELL=
11430     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11431     if test "$COM" = "MSC"; then
11432         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11433     else
11434         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11435     fi
11436     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11438 AC_SUBST(SYSTEM_HUNSPELL)
11439 AC_SUBST(HUNSPELL_CFLAGS)
11440 AC_SUBST(HUNSPELL_LIBS)
11442 dnl ===================================================================
11443 dnl Check for system zxcvbn
11444 dnl ===================================================================
11445 AC_MSG_CHECKING([which zxcvbn to use])
11446 if test "$with_system_zxcvbn" = "yes"; then
11447     AC_MSG_RESULT([external])
11448     SYSTEM_ZXCVBN=TRUE
11449     AC_CHECK_HEADER(zxcvbn.h, [],
11450        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11451     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11452         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11453 else
11454    AC_MSG_RESULT([internal])
11455    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11456    SYSTEM_ZXCVBN=
11458 AC_SUBST(SYSTEM_ZXCVBN)
11460 dnl ===================================================================
11461 dnl Check for system zxing
11462 dnl ===================================================================
11463 AC_MSG_CHECKING([whether to use zxing])
11464 if test "$enable_zxing" = "no"; then
11465     AC_MSG_RESULT([no])
11466     ENABLE_ZXING=
11467     SYSTEM_ZXING=
11468 else
11469     AC_MSG_RESULT([yes])
11470     ENABLE_ZXING=TRUE
11471     AC_MSG_CHECKING([which libzxing to use])
11472     if test "$with_system_zxing" = "yes"; then
11473         AC_MSG_RESULT([external])
11474         SYSTEM_ZXING=TRUE
11475         ZXING_CFLAGS=
11476         AC_LANG_PUSH([C++])
11477         save_CXXFLAGS=$CXXFLAGS
11478         save_IFS=$IFS
11479         IFS=$P_SEP
11480         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11481             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11482             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11483             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11484             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11485             dnl unsetting IFS."):
11486             IFS=$save_IFS
11487             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11488             dnl ignore them here:
11489             if test -z "$i"; then
11490                 continue
11491             fi
11492             dnl TODO: White space in $i would cause problems:
11493             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11494             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11495                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11496         done
11497         CXXFLAGS=$save_CXXFLAGS
11498         if test -z "$ZXING_CFLAGS"; then
11499             AC_MSG_ERROR(zxing headers not found.)
11500         fi
11501         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11502             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11503             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11504         AC_LANG_POP([C++])
11505         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11506         FilterLibs "${ZXING_LIBS}"
11507         ZXING_LIBS="${filteredlibs}"
11508     else
11509         AC_MSG_RESULT([internal])
11510         SYSTEM_ZXING=
11511         BUILD_TYPE="$BUILD_TYPE ZXING"
11512         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11513     fi
11514     if test "$ENABLE_ZXING" = TRUE; then
11515         AC_DEFINE(ENABLE_ZXING)
11516     fi
11517     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11518     AC_LANG_PUSH([C++])
11519     save_CXXFLAGS=$CXXFLAGS
11520     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11521     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11522             #include <BitMatrix.h>
11523             #include <BitMatrixIO.h>
11524             int main(){
11525                 ZXing::BitMatrix matrix(1, 1);
11526                 matrix.set(0, 0, true);
11527                 ZXing::ToSVG(matrix);
11528                 return 0;
11529             }
11530         ])], [
11531             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11532             AC_MSG_RESULT([yes])
11533         ], [AC_MSG_RESULT([no])])
11534     CXXFLAGS=$save_CXXFLAGS
11535     AC_LANG_POP([C++])
11536     AC_SUBST(HAVE_ZXING_TOSVG)
11538 AC_SUBST(SYSTEM_ZXING)
11539 AC_SUBST(ENABLE_ZXING)
11540 AC_SUBST(ZXING_CFLAGS)
11541 AC_SUBST(ZXING_LIBS)
11543 dnl ===================================================================
11544 dnl Check for system box2d
11545 dnl ===================================================================
11546 AC_MSG_CHECKING([which box2d to use])
11547 if test "$with_system_box2d" = "yes"; then
11548     AC_MSG_RESULT([external])
11549     SYSTEM_BOX2D=TRUE
11550     AC_LANG_PUSH([C++])
11551     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11552         [BOX2D_H_FOUND='FALSE'])
11553     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11554         _BOX2D_LIB=box2d
11555         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11556     else
11557         # fail this. there's no other alternative to check when we are here.
11558         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11559             [AC_MSG_ERROR(box2d headers not found.)])
11560         _BOX2D_LIB=Box2D
11561         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11562     fi
11563     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11564         [ AC_MSG_ERROR(box2d library not found.) ], [])
11565     BOX2D_LIBS=-l$_BOX2D_LIB
11566     AC_LANG_POP([C++])
11567     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11568     FilterLibs "${BOX2D_LIBS}"
11569     BOX2D_LIBS="${filteredlibs}"
11570 else
11571     AC_MSG_RESULT([internal])
11572     SYSTEM_BOX2D=
11573     BUILD_TYPE="$BUILD_TYPE BOX2D"
11575 AC_SUBST(SYSTEM_BOX2D)
11576 AC_SUBST(BOX2D_CFLAGS)
11577 AC_SUBST(BOX2D_LIBS)
11579 dnl ===================================================================
11580 dnl Checking for altlinuxhyph
11581 dnl ===================================================================
11582 AC_MSG_CHECKING([which altlinuxhyph to use])
11583 if test "$with_system_altlinuxhyph" = "yes"; then
11584     AC_MSG_RESULT([external])
11585     SYSTEM_HYPH=TRUE
11586     AC_CHECK_HEADER(hyphen.h, [],
11587        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11588     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11589        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11590        [#include <hyphen.h>])
11591     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11592         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11593     if test -z "$HYPHEN_LIB"; then
11594         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11595            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11596     fi
11597     if test -z "$HYPHEN_LIB"; then
11598         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11599            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11600     fi
11601 else
11602     AC_MSG_RESULT([internal])
11603     SYSTEM_HYPH=
11604     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11605     if test "$COM" = "MSC"; then
11606         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11607     else
11608         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11609     fi
11611 AC_SUBST(SYSTEM_HYPH)
11612 AC_SUBST(HYPHEN_LIB)
11614 dnl ===================================================================
11615 dnl Checking for mythes
11616 dnl ===================================================================
11617 AC_MSG_CHECKING([which mythes to use])
11618 if test "$with_system_mythes" = "yes"; then
11619     AC_MSG_RESULT([external])
11620     SYSTEM_MYTHES=TRUE
11621     AC_LANG_PUSH([C++])
11622     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11623     if test "$MYTHES_PKGCONFIG" = "no"; then
11624         AC_CHECK_HEADER(mythes.hxx, [],
11625             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11626         AC_CHECK_LIB([mythes-1.2], [main], [:],
11627             [ MYTHES_FOUND=no], [])
11628     if test "$MYTHES_FOUND" = "no"; then
11629         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11630                 [ MYTHES_FOUND=no], [])
11631     fi
11632     if test "$MYTHES_FOUND" = "no"; then
11633         AC_MSG_ERROR([mythes library not found!.])
11634     fi
11635     fi
11636     AC_LANG_POP([C++])
11637     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11638     FilterLibs "${MYTHES_LIBS}"
11639     MYTHES_LIBS="${filteredlibs}"
11640 else
11641     AC_MSG_RESULT([internal])
11642     SYSTEM_MYTHES=
11643     BUILD_TYPE="$BUILD_TYPE MYTHES"
11644     if test "$COM" = "MSC"; then
11645         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11646     else
11647         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11648     fi
11650 AC_SUBST(SYSTEM_MYTHES)
11651 AC_SUBST(MYTHES_CFLAGS)
11652 AC_SUBST(MYTHES_LIBS)
11654 dnl ===================================================================
11655 dnl How should we build the linear programming solver ?
11656 dnl ===================================================================
11658 ENABLE_COINMP=
11659 AC_MSG_CHECKING([whether to build with CoinMP])
11660 if test "$enable_coinmp" != "no"; then
11661     ENABLE_COINMP=TRUE
11662     AC_MSG_RESULT([yes])
11663     if test "$with_system_coinmp" = "yes"; then
11664         SYSTEM_COINMP=TRUE
11665         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11666         FilterLibs "${COINMP_LIBS}"
11667         COINMP_LIBS="${filteredlibs}"
11668     else
11669         BUILD_TYPE="$BUILD_TYPE COINMP"
11670     fi
11671 else
11672     AC_MSG_RESULT([no])
11674 AC_SUBST(ENABLE_COINMP)
11675 AC_SUBST(SYSTEM_COINMP)
11676 AC_SUBST(COINMP_CFLAGS)
11677 AC_SUBST(COINMP_LIBS)
11679 ENABLE_LPSOLVE=
11680 AC_MSG_CHECKING([whether to build with lpsolve])
11681 if test "$enable_lpsolve" != "no"; then
11682     ENABLE_LPSOLVE=TRUE
11683     AC_MSG_RESULT([yes])
11684 else
11685     AC_MSG_RESULT([no])
11687 AC_SUBST(ENABLE_LPSOLVE)
11689 if test "$ENABLE_LPSOLVE" = TRUE; then
11690     AC_MSG_CHECKING([which lpsolve to use])
11691     if test "$with_system_lpsolve" = "yes"; then
11692         AC_MSG_RESULT([external])
11693         SYSTEM_LPSOLVE=TRUE
11694         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11695            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11696         save_LIBS=$LIBS
11697         # some systems need this. Like Ubuntu...
11698         AC_CHECK_LIB(m, floor)
11699         AC_CHECK_LIB(dl, dlopen)
11700         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11701             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11702         LIBS=$save_LIBS
11703     else
11704         AC_MSG_RESULT([internal])
11705         SYSTEM_LPSOLVE=
11706         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11707     fi
11709 AC_SUBST(SYSTEM_LPSOLVE)
11711 dnl ===================================================================
11712 dnl Checking for libexttextcat
11713 dnl ===================================================================
11714 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11715 if test "$with_system_libexttextcat" = "yes"; then
11716     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11718 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11720 dnl ===================================================================
11721 dnl Checking for libnumbertext
11722 dnl ===================================================================
11723 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11724 if test "$with_system_libnumbertext" = "yes"; then
11725     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11726     SYSTEM_LIBNUMBERTEXT=YES
11727 else
11728     SYSTEM_LIBNUMBERTEXT=
11730 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11731 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11733 dnl ***************************************
11734 dnl testing libc version for Linux...
11735 dnl ***************************************
11736 if test "$_os" = "Linux"; then
11737     AC_MSG_CHECKING([whether the libc is recent enough])
11738     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11739     #include <features.h>
11740     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11741     #error glibc >= 2.1 is required
11742     #endif
11743     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11746 dnl =========================================
11747 dnl Check for uuidgen
11748 dnl =========================================
11749 if test "$_os" = "WINNT"; then
11750     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11751     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11752     UUIDGEN=uuidgen.exe
11753     AC_SUBST(UUIDGEN)
11754 else
11755     AC_PATH_PROG([UUIDGEN], [uuidgen])
11756     if test -z "$UUIDGEN"; then
11757         AC_MSG_WARN([uuid is needed for building installation sets])
11758     fi
11761 dnl ***************************************
11762 dnl Checking for bison and flex
11763 dnl ***************************************
11764 AC_PATH_PROG(BISON, bison)
11765 if test -z "$BISON"; then
11766     AC_MSG_ERROR([no bison found in \$PATH, install it])
11767 else
11768     AC_MSG_CHECKING([the bison version])
11769     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11770     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11771     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11772     dnl cause
11773     dnl
11774     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]
11775     dnl   typedef union YYSTYPE
11776     dnl           ~~~~~~^~~~~~~
11777     dnl
11778     dnl while at least 3.4.1 is know to be good:
11779     if test "$COMPILER_PLUGINS" = TRUE; then
11780         if test "$_bison_longver" -lt 2004; then
11781             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11782         fi
11783     else
11784         if test "$_bison_longver" -lt 2000; then
11785             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11786         fi
11787     fi
11789 AC_SUBST([BISON])
11791 AC_PATH_PROG(FLEX, flex)
11792 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11793     FLEX=`cygpath -m $FLEX`
11795 if test -z "$FLEX"; then
11796     AC_MSG_ERROR([no flex found in \$PATH, install it])
11797 else
11798     AC_MSG_CHECKING([the flex version])
11799     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11800     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11801         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11802     fi
11804 AC_SUBST([FLEX])
11806 AC_PATH_PROG(DIFF, diff)
11807 if test -z "$DIFF"; then
11808     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11810 AC_SUBST([DIFF])
11812 AC_PATH_PROG(UNIQ, uniq)
11813 if test -z "$UNIQ"; then
11814     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11816 AC_SUBST([UNIQ])
11818 dnl ***************************************
11819 dnl Checking for patch
11820 dnl ***************************************
11821 AC_PATH_PROG(PATCH, patch)
11822 if test -z "$PATCH"; then
11823     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11826 dnl On Solaris or macOS, check if --with-gnu-patch was used
11827 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11828     if test -z "$with_gnu_patch"; then
11829         GNUPATCH=$PATCH
11830     else
11831         if test -x "$with_gnu_patch"; then
11832             GNUPATCH=$with_gnu_patch
11833         else
11834             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11835         fi
11836     fi
11838     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11839     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11840         AC_MSG_RESULT([yes])
11841     else
11842         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11843             AC_MSG_RESULT([no, but accepted (Apple patch)])
11844             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11845         else
11846             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11847         fi
11848     fi
11849 else
11850     GNUPATCH=$PATCH
11853 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11854     GNUPATCH=`cygpath -m $GNUPATCH`
11857 dnl We also need to check for --with-gnu-cp
11859 if test -z "$with_gnu_cp"; then
11860     # check the place where the good stuff is hidden on Solaris...
11861     if test -x /usr/gnu/bin/cp; then
11862         GNUCP=/usr/gnu/bin/cp
11863     else
11864         AC_PATH_PROGS(GNUCP, gnucp cp)
11865     fi
11866     if test -z $GNUCP; then
11867         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11868     fi
11869 else
11870     if test -x "$with_gnu_cp"; then
11871         GNUCP=$with_gnu_cp
11872     else
11873         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11874     fi
11877 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11878     GNUCP=`cygpath -m $GNUCP`
11881 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11882 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11883     AC_MSG_RESULT([yes])
11884 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11885     AC_MSG_RESULT([yes])
11886 else
11887     case "$build_os" in
11888     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11889         x_GNUCP=[\#]
11890         GNUCP=''
11891         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11892         ;;
11893     *)
11894         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11895         ;;
11896     esac
11899 AC_SUBST(GNUPATCH)
11900 AC_SUBST(GNUCP)
11901 AC_SUBST(x_GNUCP)
11903 dnl ***************************************
11904 dnl testing assembler path
11905 dnl ***************************************
11906 ML_EXE=""
11907 if test "$_os" = "WINNT"; then
11908     case "$WIN_HOST_ARCH" in
11909     x86) assembler=ml.exe ;;
11910     x64) assembler=ml64.exe ;;
11911     arm64) assembler=armasm64.exe ;;
11912     esac
11914     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11915     if test -f "$MSVC_HOST_PATH/$assembler"; then
11916         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11917         AC_MSG_RESULT([$ML_EXE])
11918     else
11919         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11920     fi
11923 AC_SUBST(ML_EXE)
11925 dnl ===================================================================
11926 dnl We need zip and unzip
11927 dnl ===================================================================
11928 AC_PATH_PROG(ZIP, zip)
11929 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11930 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11931     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],,)
11934 AC_PATH_PROG(UNZIP, unzip)
11935 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11937 dnl ===================================================================
11938 dnl Zip must be a specific type for different build types.
11939 dnl ===================================================================
11940 if test $build_os = cygwin; then
11941     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11942         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11943     fi
11946 dnl ===================================================================
11947 dnl We need touch with -h option support.
11948 dnl ===================================================================
11949 AC_PATH_PROG(TOUCH, touch)
11950 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11951 touch "$WARNINGS_FILE"
11952 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11953     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],,)
11956 dnl ===================================================================
11957 dnl Check for system epoxy
11958 dnl ===================================================================
11959 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11960 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11962 dnl ===================================================================
11963 dnl Show which vclplugs will be built.
11964 dnl ===================================================================
11965 R=""
11967 libo_ENABLE_VCLPLUG([gen])
11968 libo_ENABLE_VCLPLUG([gtk3])
11969 libo_ENABLE_VCLPLUG([gtk3_kde5])
11970 libo_ENABLE_VCLPLUG([gtk4])
11971 libo_ENABLE_VCLPLUG([kf5])
11972 libo_ENABLE_VCLPLUG([kf6])
11973 libo_ENABLE_VCLPLUG([qt5])
11974 libo_ENABLE_VCLPLUG([qt6])
11976 if test "$_os" = "WINNT"; then
11977     R="$R win"
11978 elif test "$_os" = "Darwin"; then
11979     R="$R osx"
11980 elif test "$_os" = "iOS"; then
11981     R="ios"
11982 elif test "$_os" = Android; then
11983     R="android"
11986 build_vcl_plugins="$R"
11987 if test -z "$build_vcl_plugins"; then
11988     build_vcl_plugins=" none"
11990 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11991 VCL_PLUGIN_INFO=$R
11992 AC_SUBST([VCL_PLUGIN_INFO])
11994 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11995     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11998 dnl ===================================================================
11999 dnl Check for GTK libraries
12000 dnl ===================================================================
12002 GTK3_CFLAGS=""
12003 GTK3_LIBS=""
12004 ENABLE_GTKTILEDVIEWER=""
12005 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12006     if test "$with_system_cairo" = no; then
12007         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.'
12008     fi
12009     : ${with_system_cairo:=yes}
12010     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)
12011     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12012     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12013     FilterLibs "${GTK3_LIBS}"
12014     GTK3_LIBS="${filteredlibs}"
12016     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12017     if test "$with_system_epoxy" != "yes"; then
12018         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12019         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12020                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12021     fi
12022 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12023     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12024     if test "$build_os" = "cygwin"; then
12025         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12026         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12027     fi
12029     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12030     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12031     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12032     FilterLibs "${GTK3_LIBS}"
12033     GTK3_LIBS="${filteredlibs}"
12034     ENABLE_GTKTILEDVIEWER="yes"
12036 AC_SUBST(GTK3_LIBS)
12037 AC_SUBST(GTK3_CFLAGS)
12038 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12040 GTK4_CFLAGS=""
12041 GTK4_LIBS=""
12042 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12043     if test "$with_system_cairo" = no; then
12044         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12045     fi
12046     : ${with_system_cairo:=yes}
12047     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12048     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12049     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12050     FilterLibs "${GTK4_LIBS}"
12051     GTK4_LIBS="${filteredlibs}"
12053     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12054     if test "$with_system_epoxy" != "yes"; then
12055         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12056         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12057                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12058     fi
12060 AC_SUBST(GTK4_LIBS)
12061 AC_SUBST(GTK4_CFLAGS)
12063 if test "$enable_introspection" = yes; then
12064     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12065         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12066     else
12067         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12068     fi
12071 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12072 if ! test "$ENABLE_GTK3" = TRUE; then
12073     if test "$enable_atspi_tests" = yes; then
12074         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12075     fi
12076     enable_atspi_tests=no
12078 if ! test "$enable_atspi_tests" = no; then
12079     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12080     if ! test "$XVFB_RUN" = no; then
12081         dnl make sure the found xvfb-run actually works
12082         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12083         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12084             AC_MSG_RESULT([yes])
12085         else
12086             AC_MSG_RESULT([no])
12087             XVFB_RUN=no
12088         fi
12089     fi
12090     if test "$XVFB_RUN" = no; then
12091         if test "$enable_atspi_tests" = yes; then
12092             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12093         fi
12094         enable_atspi_tests=no
12095     fi
12097 if ! test "$enable_atspi_tests" = no; then
12098     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12099     if test "$DBUS_LAUNCH" = no; then
12100         if test "$enable_atspi_tests" = yes; then
12101             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12102         fi
12103         enable_atspi_tests=no
12104     fi
12106 if ! test "$enable_atspi_tests" = no; then
12107     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12108                       [if test "$enable_atspi_tests" = yes; then
12109                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12110                        else
12111                            enable_atspi_tests=no
12112                        fi])
12114 if ! test "x$enable_atspi_tests" = xno; then
12115     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12116                       [have_atspi_scroll_to=1],
12117                       [have_atspi_scroll_to=0])
12118     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12119                        [Whether AT-SPI2 has the scrollTo API])
12121 ENABLE_ATSPI_TESTS=
12122 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12123 AC_SUBST([ENABLE_ATSPI_TESTS])
12125 dnl ===================================================================
12126 dnl check for dbus support
12127 dnl ===================================================================
12128 ENABLE_DBUS=""
12129 DBUS_CFLAGS=""
12130 DBUS_LIBS=""
12131 DBUS_GLIB_CFLAGS=""
12132 DBUS_GLIB_LIBS=""
12133 DBUS_HAVE_GLIB=""
12135 if test "$enable_dbus" = "no"; then
12136     test_dbus=no
12139 AC_MSG_CHECKING([whether to enable DBUS support])
12140 if test "$test_dbus" = "yes"; then
12141     ENABLE_DBUS="TRUE"
12142     AC_MSG_RESULT([yes])
12143     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12144     AC_DEFINE(ENABLE_DBUS)
12145     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12146     FilterLibs "${DBUS_LIBS}"
12147     DBUS_LIBS="${filteredlibs}"
12149     # Glib is needed for BluetoothServer
12150     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12151     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12152         [
12153             DBUS_HAVE_GLIB="TRUE"
12154             AC_DEFINE(DBUS_HAVE_GLIB,1)
12155         ],
12156         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12157     )
12158 else
12159     AC_MSG_RESULT([no])
12162 AC_SUBST(ENABLE_DBUS)
12163 AC_SUBST(DBUS_CFLAGS)
12164 AC_SUBST(DBUS_LIBS)
12165 AC_SUBST(DBUS_GLIB_CFLAGS)
12166 AC_SUBST(DBUS_GLIB_LIBS)
12167 AC_SUBST(DBUS_HAVE_GLIB)
12169 AC_MSG_CHECKING([whether to enable Impress remote control])
12170 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12171     AC_MSG_RESULT([yes])
12172     ENABLE_SDREMOTE=TRUE
12173     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12174         <true/>"
12175     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12177     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12178         # The Bluetooth code doesn't compile with macOS SDK 10.15
12179         if test "$enable_sdremote_bluetooth" = yes; then
12180             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12181         fi
12182         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12183         enable_sdremote_bluetooth=no
12184     fi
12185     # If not explicitly enabled or disabled, default
12186     if test -z "$enable_sdremote_bluetooth"; then
12187         case "$OS" in
12188         LINUX|MACOSX|WNT)
12189             # Default to yes for these
12190             enable_sdremote_bluetooth=yes
12191             ;;
12192         *)
12193             # otherwise no
12194             enable_sdremote_bluetooth=no
12195             ;;
12196         esac
12197     fi
12198     # $enable_sdremote_bluetooth is guaranteed non-empty now
12200     if test "$enable_sdremote_bluetooth" != "no"; then
12201         if test "$OS" = "LINUX"; then
12202             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12203                 AC_MSG_RESULT([yes])
12204                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12205                 dnl ===================================================================
12206                 dnl Check for system bluez
12207                 dnl ===================================================================
12208                 AC_MSG_CHECKING([which Bluetooth header to use])
12209                 if test "$with_system_bluez" = "yes"; then
12210                     AC_MSG_RESULT([external])
12211                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12212                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12213                     SYSTEM_BLUEZ=TRUE
12214                 else
12215                     AC_MSG_RESULT([internal])
12216                     SYSTEM_BLUEZ=
12217                 fi
12218             else
12219                 AC_MSG_RESULT([no, dbus disabled])
12220                 ENABLE_SDREMOTE_BLUETOOTH=
12221                 SYSTEM_BLUEZ=
12222             fi
12223         else
12224             AC_MSG_RESULT([yes])
12225             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12226             SYSTEM_BLUEZ=
12227             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12228         <key>com.apple.security.device.bluetooth</key>
12229         <true/>"
12230         fi
12231     else
12232         AC_MSG_RESULT([no])
12233         ENABLE_SDREMOTE_BLUETOOTH=
12234         SYSTEM_BLUEZ=
12235     fi
12236 else
12237     ENABLE_SDREMOTE=
12238     SYSTEM_BLUEZ=
12239     AC_MSG_RESULT([no])
12241 AC_SUBST(ENABLE_SDREMOTE)
12242 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12243 AC_SUBST(SDREMOTE_ENTITLEMENT)
12244 AC_SUBST(SYSTEM_BLUEZ)
12246 dnl ===================================================================
12247 dnl Check whether to enable GIO support
12248 dnl ===================================================================
12249 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12250     AC_MSG_CHECKING([whether to enable GIO support])
12251     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12252         dnl Need at least 2.26 for the dbus support.
12253         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12254                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12255         if test "$ENABLE_GIO" = "TRUE"; then
12256             AC_DEFINE(ENABLE_GIO)
12257             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12258             FilterLibs "${GIO_LIBS}"
12259             GIO_LIBS="${filteredlibs}"
12260         fi
12261     else
12262         AC_MSG_RESULT([no])
12263     fi
12265 AC_SUBST(ENABLE_GIO)
12266 AC_SUBST(GIO_CFLAGS)
12267 AC_SUBST(GIO_LIBS)
12270 dnl ===================================================================
12272 SPLIT_APP_MODULES=""
12273 if test "$enable_split_app_modules" = "yes"; then
12274     SPLIT_APP_MODULES="TRUE"
12276 AC_SUBST(SPLIT_APP_MODULES)
12278 SPLIT_OPT_FEATURES=""
12279 if test "$enable_split_opt_features" = "yes"; then
12280     SPLIT_OPT_FEATURES="TRUE"
12282 AC_SUBST(SPLIT_OPT_FEATURES)
12284 dnl ===================================================================
12285 dnl Check whether the GStreamer libraries are available.
12286 dnl ===================================================================
12288 ENABLE_GSTREAMER_1_0=""
12290 if test "$test_gstreamer_1_0" = yes; then
12292     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12293     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12294         ENABLE_GSTREAMER_1_0="TRUE"
12295         AC_MSG_RESULT([yes])
12296         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12297         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12298         FilterLibs "${GSTREAMER_1_0_LIBS}"
12299         GSTREAMER_1_0_LIBS="${filteredlibs}"
12300         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12301     else
12302         AC_MSG_RESULT([no])
12303     fi
12305 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12306 AC_SUBST(GSTREAMER_1_0_LIBS)
12307 AC_SUBST(ENABLE_GSTREAMER_1_0)
12309 ENABLE_OPENGL_TRANSITIONS=
12310 ENABLE_OPENGL_CANVAS=
12311 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12312    : # disable
12313 elif test "$_os" = "Darwin"; then
12314     # We use frameworks on macOS, no need for detail checks
12315     ENABLE_OPENGL_TRANSITIONS=TRUE
12316     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12317     ENABLE_OPENGL_CANVAS=TRUE
12318 elif test $_os = WINNT; then
12319     ENABLE_OPENGL_TRANSITIONS=TRUE
12320     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12321     ENABLE_OPENGL_CANVAS=TRUE
12322 else
12323     if test "$USING_X11" = TRUE; then
12324         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12325         ENABLE_OPENGL_TRANSITIONS=TRUE
12326         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12327         ENABLE_OPENGL_CANVAS=TRUE
12328     fi
12331 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12332 AC_SUBST(ENABLE_OPENGL_CANVAS)
12334 dnl =================================================
12335 dnl Check whether to build with OpenCL support.
12336 dnl =================================================
12338 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12339     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12340     # platform (optional at run-time, used through clew).
12341     BUILD_TYPE="$BUILD_TYPE OPENCL"
12342     AC_DEFINE(HAVE_FEATURE_OPENCL)
12345 dnl =================================================
12346 dnl Check whether to build with dconf support.
12347 dnl =================================================
12349 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12350     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12351         if test "$enable_dconf" = yes; then
12352             AC_MSG_ERROR([dconf not found])
12353         else
12354             enable_dconf=no
12355         fi])
12357 AC_MSG_CHECKING([whether to enable dconf])
12358 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12359     DCONF_CFLAGS=
12360     DCONF_LIBS=
12361     ENABLE_DCONF=
12362     AC_MSG_RESULT([no])
12363 else
12364     ENABLE_DCONF=TRUE
12365     AC_DEFINE(ENABLE_DCONF)
12366     AC_MSG_RESULT([yes])
12368 AC_SUBST([DCONF_CFLAGS])
12369 AC_SUBST([DCONF_LIBS])
12370 AC_SUBST([ENABLE_DCONF])
12372 # pdf import?
12373 AC_MSG_CHECKING([whether to build the PDF import feature])
12374 ENABLE_PDFIMPORT=
12375 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12376     AC_MSG_RESULT([yes])
12377     ENABLE_PDFIMPORT=TRUE
12378     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12379 else
12380     AC_MSG_RESULT([no])
12383 # Pdfium?
12384 AC_MSG_CHECKING([whether to build PDFium])
12385 ENABLE_PDFIUM=
12386 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12387     AC_MSG_RESULT([yes])
12388     ENABLE_PDFIUM=TRUE
12389     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12390 else
12391     AC_MSG_RESULT([no])
12393 AC_SUBST(ENABLE_PDFIUM)
12395 if test "$ENABLE_PDFIUM" = "TRUE"; then
12396     AC_MSG_CHECKING([which OpenJPEG library to use])
12397     if test "$with_system_openjpeg" = "yes"; then
12398         SYSTEM_OPENJPEG2=TRUE
12399         AC_MSG_RESULT([external])
12400         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12401         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12402         FilterLibs "${OPENJPEG2_LIBS}"
12403         OPENJPEG2_LIBS="${filteredlibs}"
12404     else
12405         SYSTEM_OPENJPEG2=FALSE
12406         AC_MSG_RESULT([internal])
12407     fi
12409     AC_MSG_CHECKING([which Abseil library to use])
12410     if test "$with_system_abseil" = "yes"; then
12411         AC_MSG_RESULT([external])
12412         SYSTEM_ABSEIL=TRUE
12413         AC_LANG_PUSH([C++])
12414         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12415         AC_LANG_POP([C++])
12416         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12417         FilterLibs "${ABSEIL_LIBS}"
12418         ABSEIL_LIBS="${filteredlibs}"
12419     else
12420         AC_MSG_RESULT([internal])
12421     fi
12423 AC_SUBST(SYSTEM_OPENJPEG2)
12424 AC_SUBST(SYSTEM_ABSEIL)
12425 AC_SUBST(ABSEIL_CFLAGS)
12426 AC_SUBST(ABSEIL_LIBS)
12428 dnl ===================================================================
12429 dnl Check for poppler
12430 dnl ===================================================================
12431 ENABLE_POPPLER=
12432 AC_MSG_CHECKING([whether to build Poppler])
12433 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12434     AC_MSG_RESULT([yes])
12435     ENABLE_POPPLER=TRUE
12436     AC_DEFINE(HAVE_FEATURE_POPPLER)
12437 else
12438     AC_MSG_RESULT([no])
12440 AC_SUBST(ENABLE_POPPLER)
12442 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12443     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12446 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12447     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12450 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12451     dnl ===================================================================
12452     dnl Check for system poppler
12453     dnl ===================================================================
12454     AC_MSG_CHECKING([which PDF import poppler to use])
12455     if test "$with_system_poppler" = "yes"; then
12456         AC_MSG_RESULT([external])
12457         SYSTEM_POPPLER=TRUE
12458         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12459         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12460         FilterLibs "${POPPLER_LIBS}"
12461         POPPLER_LIBS="${filteredlibs}"
12462     else
12463         AC_MSG_RESULT([internal])
12464         SYSTEM_POPPLER=
12465         BUILD_TYPE="$BUILD_TYPE POPPLER"
12466     fi
12467     AC_DEFINE([ENABLE_PDFIMPORT],1)
12469 AC_SUBST(ENABLE_PDFIMPORT)
12470 AC_SUBST(SYSTEM_POPPLER)
12471 AC_SUBST(POPPLER_CFLAGS)
12472 AC_SUBST(POPPLER_LIBS)
12474 # Skia?
12475 ENABLE_SKIA=
12476 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12477     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12478     if test "$SYSTEM_FREETYPE" = TRUE; then
12479         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12480             [skia_freetype_ok=yes],
12481             [skia_freetype_ok=no])
12482     else # internal is ok
12483         skia_freetype_ok=yes
12484     fi
12485     AC_MSG_CHECKING([whether to build Skia])
12486     if test "$skia_freetype_ok" = "yes"; then
12487         if test "$enable_skia" = "debug"; then
12488             AC_MSG_RESULT([yes (debug)])
12489             ENABLE_SKIA_DEBUG=TRUE
12490         else
12491             AC_MSG_RESULT([yes])
12492             ENABLE_SKIA_DEBUG=
12493         fi
12494         ENABLE_SKIA=TRUE
12495         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12496             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12497         fi
12499         AC_DEFINE(HAVE_FEATURE_SKIA)
12500         BUILD_TYPE="$BUILD_TYPE SKIA"
12502         if test "$OS" = "MACOSX"; then
12503             AC_DEFINE(SK_GANESH,1)
12504             AC_DEFINE(SK_METAL,1)
12505             SKIA_GPU=METAL
12506             AC_SUBST(SKIA_GPU)
12507         else
12508             AC_DEFINE(SK_GANESH,1)
12509             AC_DEFINE(SK_VULKAN,1)
12510             SKIA_GPU=VULKAN
12511             AC_SUBST(SKIA_GPU)
12512         fi
12513     else
12514         AC_MSG_RESULT([no (freetype too old)])
12515         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12516     fi
12518 else
12519     AC_MSG_CHECKING([whether to build Skia])
12520     AC_MSG_RESULT([no])
12522 AC_SUBST(ENABLE_SKIA)
12523 AC_SUBST(ENABLE_SKIA_DEBUG)
12525 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12526 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12527 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12528 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12529 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12530 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12531 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12532 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12533 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12534 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12535 LO_CLANG_VERSION=
12536 HAVE_LO_CLANG_DLLEXPORTINLINES=
12538 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12539     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12540         AC_MSG_CHECKING([for Clang])
12541         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12542     else
12543         if test "$_os" = "WINNT"; then
12544             AC_MSG_CHECKING([for clang-cl])
12545             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12546                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12547             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12548                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12549             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12550                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12551             fi
12552             if test -n "$LO_CLANG_CC"; then
12553                 dnl explicitly set -m32/-m64
12554                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12555                 LO_CLANG_CXX="$LO_CLANG_CC"
12556                 AC_MSG_RESULT([$LO_CLANG_CC])
12557             else
12558                 AC_MSG_RESULT([no])
12559             fi
12561             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12562             echo "#include <stdlib.h>" > conftest.c
12563             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12564                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12565             rm -f conftest.c conftest.obj
12566             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12567                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12568             else
12569                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12570             fi
12571         else
12572             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12573             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12574         fi
12575     fi
12576     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12577         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12578         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12579         if test "$LO_CLANG_VERSION" -lt 50002; then
12580             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12581             LO_CLANG_CC=
12582             LO_CLANG_CXX=
12583         fi
12584     fi
12585     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12586         save_CXX="$CXX"
12587         CXX="$LO_CLANG_CXX"
12588         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12589         AC_LANG_PUSH([C++])
12590         save_CXXFLAGS=$CXXFLAGS
12591         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12592         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12593                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12594                 AC_MSG_RESULT([yes])
12595             ], [AC_MSG_RESULT([no])])
12596         CXXFLAGS=$save_CXXFLAGS
12597         AC_LANG_POP([C++])
12598         CXX="$save_CXX"
12599         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12600             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.])
12601         fi
12602     fi
12603     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12604         # Skia is the default on Windows and Mac, so hard-require Clang.
12605         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12606         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12607             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12608         else
12609             AC_MSG_WARN([Clang compiler not found.])
12610         fi
12611     else
12613         save_CXX="$CXX"
12614         CXX="$LO_CLANG_CXX"
12615         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12616         flag_sse2=-msse2
12617         flag_ssse3=-mssse3
12618         flag_sse41=-msse4.1
12619         flag_sse42=-msse4.2
12620         flag_avx=-mavx
12621         flag_avx2=-mavx2
12622         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12623         flag_avx512f=-mavx512f
12624         flag_f16c=-mf16c
12625         flag_fma=-mfma
12627         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12628         AC_LANG_PUSH([C++])
12629         save_CXXFLAGS=$CXXFLAGS
12630         CXXFLAGS="$CXXFLAGS $flag_sse2"
12631         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12632             #include <emmintrin.h>
12633             int main () {
12634                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12635                 c = _mm_xor_si128 (a, b);
12636                 return 0;
12637             }
12638             ])],
12639             [can_compile_sse2=yes],
12640             [can_compile_sse2=no])
12641         AC_LANG_POP([C++])
12642         CXXFLAGS=$save_CXXFLAGS
12643         AC_MSG_RESULT([${can_compile_sse2}])
12644         if test "${can_compile_sse2}" = "yes" ; then
12645             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12646         fi
12648         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12649         AC_LANG_PUSH([C++])
12650         save_CXXFLAGS=$CXXFLAGS
12651         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12652         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12653             #include <tmmintrin.h>
12654             int main () {
12655                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12656                 c = _mm_maddubs_epi16 (a, b);
12657                 return 0;
12658             }
12659             ])],
12660             [can_compile_ssse3=yes],
12661             [can_compile_ssse3=no])
12662         AC_LANG_POP([C++])
12663         CXXFLAGS=$save_CXXFLAGS
12664         AC_MSG_RESULT([${can_compile_ssse3}])
12665         if test "${can_compile_ssse3}" = "yes" ; then
12666             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12667         fi
12669         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12670         AC_LANG_PUSH([C++])
12671         save_CXXFLAGS=$CXXFLAGS
12672         CXXFLAGS="$CXXFLAGS $flag_sse41"
12673         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12674             #include <smmintrin.h>
12675             int main () {
12676                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12677                 c = _mm_cmpeq_epi64 (a, b);
12678                 return 0;
12679             }
12680             ])],
12681             [can_compile_sse41=yes],
12682             [can_compile_sse41=no])
12683         AC_LANG_POP([C++])
12684         CXXFLAGS=$save_CXXFLAGS
12685         AC_MSG_RESULT([${can_compile_sse41}])
12686         if test "${can_compile_sse41}" = "yes" ; then
12687             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12688         fi
12690         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12691         AC_LANG_PUSH([C++])
12692         save_CXXFLAGS=$CXXFLAGS
12693         CXXFLAGS="$CXXFLAGS $flag_sse42"
12694         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12695             #include <nmmintrin.h>
12696             int main () {
12697                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12698                 c = _mm_cmpgt_epi64 (a, b);
12699                 return 0;
12700             }
12701             ])],
12702             [can_compile_sse42=yes],
12703             [can_compile_sse42=no])
12704         AC_LANG_POP([C++])
12705         CXXFLAGS=$save_CXXFLAGS
12706         AC_MSG_RESULT([${can_compile_sse42}])
12707         if test "${can_compile_sse42}" = "yes" ; then
12708             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12709         fi
12711         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12712         AC_LANG_PUSH([C++])
12713         save_CXXFLAGS=$CXXFLAGS
12714         CXXFLAGS="$CXXFLAGS $flag_avx"
12715         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12716             #include <immintrin.h>
12717             int main () {
12718                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12719                 c = _mm256_xor_ps(a, b);
12720                 return 0;
12721             }
12722             ])],
12723             [can_compile_avx=yes],
12724             [can_compile_avx=no])
12725         AC_LANG_POP([C++])
12726         CXXFLAGS=$save_CXXFLAGS
12727         AC_MSG_RESULT([${can_compile_avx}])
12728         if test "${can_compile_avx}" = "yes" ; then
12729             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12730         fi
12732         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12733         AC_LANG_PUSH([C++])
12734         save_CXXFLAGS=$CXXFLAGS
12735         CXXFLAGS="$CXXFLAGS $flag_avx2"
12736         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12737             #include <immintrin.h>
12738             int main () {
12739                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12740                 c = _mm256_maddubs_epi16(a, b);
12741                 return 0;
12742             }
12743             ])],
12744             [can_compile_avx2=yes],
12745             [can_compile_avx2=no])
12746         AC_LANG_POP([C++])
12747         CXXFLAGS=$save_CXXFLAGS
12748         AC_MSG_RESULT([${can_compile_avx2}])
12749         if test "${can_compile_avx2}" = "yes" ; then
12750             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12751         fi
12753         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12754         AC_LANG_PUSH([C++])
12755         save_CXXFLAGS=$CXXFLAGS
12756         CXXFLAGS="$CXXFLAGS $flag_avx512"
12757         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12758             #include <immintrin.h>
12759             int main () {
12760                 __m512i a = _mm512_loadu_si512(0);
12761                 __m512d v1 = _mm512_load_pd(0);
12762                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12763                 __m512d v2 = _mm512_abs_pd(v1);
12764                 return 0;
12765             }
12766             ])],
12767             [can_compile_avx512=yes],
12768             [can_compile_avx512=no])
12769         AC_LANG_POP([C++])
12770         CXXFLAGS=$save_CXXFLAGS
12771         AC_MSG_RESULT([${can_compile_avx512}])
12772         if test "${can_compile_avx512}" = "yes" ; then
12773             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12774             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12775         fi
12777         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12778         AC_LANG_PUSH([C++])
12779         save_CXXFLAGS=$CXXFLAGS
12780         CXXFLAGS="$CXXFLAGS $flag_f16c"
12781         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12782             #include <immintrin.h>
12783             int main () {
12784                 __m128i a = _mm_set1_epi32 (0);
12785                 __m128 c;
12786                 c = _mm_cvtph_ps(a);
12787                 return 0;
12788             }
12789             ])],
12790             [can_compile_f16c=yes],
12791             [can_compile_f16c=no])
12792         AC_LANG_POP([C++])
12793         CXXFLAGS=$save_CXXFLAGS
12794         AC_MSG_RESULT([${can_compile_f16c}])
12795         if test "${can_compile_f16c}" = "yes" ; then
12796             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12797         fi
12799         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12800         AC_LANG_PUSH([C++])
12801         save_CXXFLAGS=$CXXFLAGS
12802         CXXFLAGS="$CXXFLAGS $flag_fma"
12803         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12804             #include <immintrin.h>
12805             int main () {
12806                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12807                 d = _mm256_fmadd_ps(a, b, c);
12808                 return 0;
12809             }
12810             ])],
12811             [can_compile_fma=yes],
12812             [can_compile_fma=no])
12813         AC_LANG_POP([C++])
12814         CXXFLAGS=$save_CXXFLAGS
12815         AC_MSG_RESULT([${can_compile_fma}])
12816         if test "${can_compile_fma}" = "yes" ; then
12817             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12818         fi
12820         CXX="$save_CXX"
12821     fi
12824 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12826 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12827     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12828     AC_LANG_PUSH([C])
12829     save_CC="$CC"
12830     CC="$LO_CLANG_CC"
12831     save_CFLAGS=$CFLAGS
12832     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12833     dnl an empty program will do, we're checking the compiler flags
12834     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12835                       [use_ccache=yes], [use_ccache=no])
12836     CFLAGS=$save_CFLAGS
12837     CC=$save_CC
12838     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12839         AC_MSG_RESULT([yes])
12840     else
12841         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12842         AC_MSG_RESULT([no])
12843     fi
12844     AC_LANG_POP([C])
12846     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12847     AC_LANG_PUSH([C++])
12848     save_CXX="$CXX"
12849     CXX="$LO_CLANG_CXX"
12850     save_CXXFLAGS=$CXXFLAGS
12851     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12852     dnl an empty program will do, we're checking the compiler flags
12853     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12854                       [use_ccache=yes], [use_ccache=no])
12855     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12856         AC_MSG_RESULT([yes])
12857     else
12858         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12859         AC_MSG_RESULT([no])
12860     fi
12861     CXXFLAGS=$save_CXXFLAGS
12862     CXX=$save_CXX
12863     AC_LANG_POP([C++])
12866 AC_SUBST(LO_CLANG_CC)
12867 AC_SUBST(LO_CLANG_CXX)
12868 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12869 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12870 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12871 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12872 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12873 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12874 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12875 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12876 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12877 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12878 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12879 AC_SUBST(LO_CLANG_VERSION)
12880 AC_SUBST(CLANG_USE_LD)
12881 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12883 SYSTEM_GPGMEPP=
12885 AC_MSG_CHECKING([whether to enable gpgmepp])
12886 if test "$enable_gpgmepp" = no; then
12887     AC_MSG_RESULT([no])
12888 elif test "$enable_mpl_subset" = "yes"; then
12889     AC_MSG_RESULT([no (MPL only)])
12890 elif test "$enable_fuzzers" = "yes"; then
12891     AC_MSG_RESULT([no (oss-fuzz)])
12892 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12893     AC_MSG_RESULT([yes])
12894     dnl ===================================================================
12895     dnl Check for system gpgme
12896     dnl ===================================================================
12897     AC_MSG_CHECKING([which gpgmepp to use])
12898     if test "$with_system_gpgmepp" = "yes"; then
12899         AC_MSG_RESULT([external])
12900         SYSTEM_GPGMEPP=TRUE
12902         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12903         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12904             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12905         AC_CHECK_HEADER(gpgme.h, [],
12906             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12907         AC_CHECK_LIB(gpgmepp, main, [],
12908             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12909         GPGMEPP_LIBS=-lgpgmepp
12910     else
12911         AC_MSG_RESULT([internal])
12912         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12914         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12915         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12916         if test "$_os" != "WINNT"; then
12917             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12918             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12919         fi
12920     fi
12921     ENABLE_GPGMEPP=TRUE
12922     AC_DEFINE([HAVE_FEATURE_GPGME])
12923     AC_PATH_PROG(GPG, gpg)
12924     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12925     # so let's exclude that manually for the moment
12926     if test -n "$GPG" -a "$_os" != "WINNT"; then
12927         # make sure we not only have a working gpgme, but a full working
12928         # gpg installation to run OpenPGP signature verification
12929         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12930     fi
12931     if test "$_os" = "Linux"; then
12932       uid=`id -u`
12933       AC_MSG_CHECKING([for /run/user/$uid])
12934       if test -d /run/user/$uid; then
12935         AC_MSG_RESULT([yes])
12936         AC_PATH_PROG(GPGCONF, gpgconf)
12938         # Older versions of gpgconf are not working as expected, since
12939         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12940         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12941         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12942         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12943         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12944         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12945         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12946           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12947           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12948           if $GPGCONF --dump-options > /dev/null ; then
12949             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12950               AC_MSG_RESULT([yes])
12951               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12952               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12953             else
12954               AC_MSG_RESULT([no])
12955             fi
12956           else
12957             AC_MSG_RESULT([no. missing or broken gpgconf?])
12958           fi
12959         else
12960           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12961         fi
12962       else
12963         AC_MSG_RESULT([no])
12964      fi
12965    fi
12966 else
12967     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12969 AC_SUBST(ENABLE_GPGMEPP)
12970 AC_SUBST(SYSTEM_GPGMEPP)
12971 AC_SUBST(GPG_ERROR_CFLAGS)
12972 AC_SUBST(GPG_ERROR_LIBS)
12973 AC_SUBST(LIBASSUAN_CFLAGS)
12974 AC_SUBST(LIBASSUAN_LIBS)
12975 AC_SUBST(GPGMEPP_CFLAGS)
12976 AC_SUBST(GPGMEPP_LIBS)
12978 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12979 if test "$with_java" != "no"; then
12980     AC_MSG_RESULT([yes])
12981     ENABLE_JAVA_WEBSOCKET=TRUE
12982     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12983     NEED_ANT=TRUE
12984 else
12985     AC_MSG_RESULT([no])
12986     ENABLE_JAVA_WEBSOCKET=
12988 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12990 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12991 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12992     AC_MSG_RESULT([yes])
12993     ENABLE_MEDIAWIKI=TRUE
12994     BUILD_TYPE="$BUILD_TYPE XSLTML"
12995     if test  "x$with_java" = "xno"; then
12996         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12997     fi
12998 else
12999     AC_MSG_RESULT([no])
13000     ENABLE_MEDIAWIKI=
13001     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13003 AC_SUBST(ENABLE_MEDIAWIKI)
13005 AC_MSG_CHECKING([whether to build the Report Builder])
13006 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13007     AC_MSG_RESULT([yes])
13008     ENABLE_REPORTBUILDER=TRUE
13009     AC_MSG_CHECKING([which jfreereport libs to use])
13010     if test "$with_system_jfreereport" = "yes"; then
13011         SYSTEM_JFREEREPORT=TRUE
13012         AC_MSG_RESULT([external])
13013         if test -z $SAC_JAR; then
13014             SAC_JAR=/usr/share/java/sac.jar
13015         fi
13016         if ! test -f $SAC_JAR; then
13017              AC_MSG_ERROR(sac.jar not found.)
13018         fi
13020         if test -z $LIBXML_JAR; then
13021             if test -f /usr/share/java/libxml-1.0.0.jar; then
13022                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13023             elif test -f /usr/share/java/libxml.jar; then
13024                 LIBXML_JAR=/usr/share/java/libxml.jar
13025             else
13026                 AC_MSG_ERROR(libxml.jar replacement not found.)
13027             fi
13028         elif ! test -f $LIBXML_JAR; then
13029             AC_MSG_ERROR(libxml.jar not found.)
13030         fi
13032         if test -z $FLUTE_JAR; then
13033             if test -f /usr/share/java/flute-1.3.0.jar; then
13034                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13035             elif test -f /usr/share/java/flute.jar; then
13036                 FLUTE_JAR=/usr/share/java/flute.jar
13037             else
13038                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13039             fi
13040         elif ! test -f $FLUTE_JAR; then
13041             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13042         fi
13044         if test -z $JFREEREPORT_JAR; then
13045             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13046                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13047             elif test -f /usr/share/java/flow-engine.jar; then
13048                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13049             else
13050                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13051             fi
13052         elif ! test -f  $JFREEREPORT_JAR; then
13053                 AC_MSG_ERROR(jfreereport.jar not found.)
13054         fi
13056         if test -z $LIBLAYOUT_JAR; then
13057             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13058                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13059             elif test -f /usr/share/java/liblayout.jar; then
13060                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13061             else
13062                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13063             fi
13064         elif ! test -f $LIBLAYOUT_JAR; then
13065                 AC_MSG_ERROR(liblayout.jar not found.)
13066         fi
13068         if test -z $LIBLOADER_JAR; then
13069             if test -f /usr/share/java/libloader-1.0.0.jar; then
13070                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13071             elif test -f /usr/share/java/libloader.jar; then
13072                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13073             else
13074                 AC_MSG_ERROR(libloader.jar replacement not found.)
13075             fi
13076         elif ! test -f  $LIBLOADER_JAR; then
13077             AC_MSG_ERROR(libloader.jar not found.)
13078         fi
13080         if test -z $LIBFORMULA_JAR; then
13081             if test -f /usr/share/java/libformula-0.2.0.jar; then
13082                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13083             elif test -f /usr/share/java/libformula.jar; then
13084                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13085             else
13086                 AC_MSG_ERROR(libformula.jar replacement not found.)
13087             fi
13088         elif ! test -f $LIBFORMULA_JAR; then
13089                 AC_MSG_ERROR(libformula.jar not found.)
13090         fi
13092         if test -z $LIBREPOSITORY_JAR; then
13093             if test -f /usr/share/java/librepository-1.0.0.jar; then
13094                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13095             elif test -f /usr/share/java/librepository.jar; then
13096                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13097             else
13098                 AC_MSG_ERROR(librepository.jar replacement not found.)
13099             fi
13100         elif ! test -f $LIBREPOSITORY_JAR; then
13101             AC_MSG_ERROR(librepository.jar not found.)
13102         fi
13104         if test -z $LIBFONTS_JAR; then
13105             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13106                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13107             elif test -f /usr/share/java/libfonts.jar; then
13108                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13109             else
13110                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13111             fi
13112         elif ! test -f $LIBFONTS_JAR; then
13113                 AC_MSG_ERROR(libfonts.jar not found.)
13114         fi
13116         if test -z $LIBSERIALIZER_JAR; then
13117             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13118                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13119             elif test -f /usr/share/java/libserializer.jar; then
13120                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13121             else
13122                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13123             fi
13124         elif ! test -f $LIBSERIALIZER_JAR; then
13125                 AC_MSG_ERROR(libserializer.jar not found.)
13126         fi
13128         if test -z $LIBBASE_JAR; then
13129             if test -f /usr/share/java/libbase-1.0.0.jar; then
13130                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13131             elif test -f /usr/share/java/libbase.jar; then
13132                 LIBBASE_JAR=/usr/share/java/libbase.jar
13133             else
13134                 AC_MSG_ERROR(libbase.jar replacement not found.)
13135             fi
13136         elif ! test -f $LIBBASE_JAR; then
13137             AC_MSG_ERROR(libbase.jar not found.)
13138         fi
13140     else
13141         AC_MSG_RESULT([internal])
13142         SYSTEM_JFREEREPORT=
13143         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13144         NEED_ANT=TRUE
13145     fi
13146     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13147 else
13148     AC_MSG_RESULT([no])
13149     ENABLE_REPORTBUILDER=
13150     SYSTEM_JFREEREPORT=
13152 AC_SUBST(ENABLE_REPORTBUILDER)
13153 AC_SUBST(SYSTEM_JFREEREPORT)
13154 AC_SUBST(SAC_JAR)
13155 AC_SUBST(LIBXML_JAR)
13156 AC_SUBST(FLUTE_JAR)
13157 AC_SUBST(JFREEREPORT_JAR)
13158 AC_SUBST(LIBBASE_JAR)
13159 AC_SUBST(LIBLAYOUT_JAR)
13160 AC_SUBST(LIBLOADER_JAR)
13161 AC_SUBST(LIBFORMULA_JAR)
13162 AC_SUBST(LIBREPOSITORY_JAR)
13163 AC_SUBST(LIBFONTS_JAR)
13164 AC_SUBST(LIBSERIALIZER_JAR)
13166 # scripting provider for BeanShell?
13167 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13168 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13169     AC_MSG_RESULT([yes])
13170     ENABLE_SCRIPTING_BEANSHELL=TRUE
13172     dnl ===================================================================
13173     dnl Check for system beanshell
13174     dnl ===================================================================
13175     AC_MSG_CHECKING([which beanshell to use])
13176     if test "$with_system_beanshell" = "yes"; then
13177         AC_MSG_RESULT([external])
13178         SYSTEM_BSH=TRUE
13179         if test -z $BSH_JAR; then
13180             BSH_JAR=/usr/share/java/bsh.jar
13181         fi
13182         if ! test -f $BSH_JAR; then
13183             AC_MSG_ERROR(bsh.jar not found.)
13184         fi
13185     else
13186         AC_MSG_RESULT([internal])
13187         SYSTEM_BSH=
13188         BUILD_TYPE="$BUILD_TYPE BSH"
13189     fi
13190 else
13191     AC_MSG_RESULT([no])
13192     ENABLE_SCRIPTING_BEANSHELL=
13193     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13195 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13196 AC_SUBST(SYSTEM_BSH)
13197 AC_SUBST(BSH_JAR)
13199 # scripting provider for JavaScript?
13200 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13201 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13202     AC_MSG_RESULT([yes])
13203     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13205     dnl ===================================================================
13206     dnl Check for system rhino
13207     dnl ===================================================================
13208     AC_MSG_CHECKING([which rhino to use])
13209     if test "$with_system_rhino" = "yes"; then
13210         AC_MSG_RESULT([external])
13211         SYSTEM_RHINO=TRUE
13212         if test -z $RHINO_JAR; then
13213             RHINO_JAR=/usr/share/java/js.jar
13214         fi
13215         if ! test -f $RHINO_JAR; then
13216             AC_MSG_ERROR(js.jar not found.)
13217         fi
13218     else
13219         AC_MSG_RESULT([internal])
13220         SYSTEM_RHINO=
13221         BUILD_TYPE="$BUILD_TYPE RHINO"
13222         NEED_ANT=TRUE
13223     fi
13224 else
13225     AC_MSG_RESULT([no])
13226     ENABLE_SCRIPTING_JAVASCRIPT=
13227     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13229 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13230 AC_SUBST(SYSTEM_RHINO)
13231 AC_SUBST(RHINO_JAR)
13233 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13234 # paths should be added to library search path. So lets put all 64-bit
13235 # platforms there.
13236 supports_multilib=
13237 case "$host_cpu" in
13238 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13239     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13240         supports_multilib="yes"
13241     fi
13242     ;;
13244     ;;
13245 esac
13247 dnl ===================================================================
13248 dnl QT5 Integration
13249 dnl ===================================================================
13251 QT5_CFLAGS=""
13252 QT5_LIBS=""
13253 QT5_GOBJECT_CFLAGS=""
13254 QT5_GOBJECT_LIBS=""
13255 QT5_HAVE_GOBJECT=""
13256 QT5_PLATFORMS_SRCDIR=""
13257 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13258         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13259         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13260 then
13261     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13262     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13264     if test -n "$supports_multilib"; then
13265         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13266     fi
13268     qt5_test_include="QtWidgets/qapplication.h"
13269     if test "$_os" = "Emscripten"; then
13270         qt5_test_library="libQt5Widgets.a"
13271     else
13272         qt5_test_library="libQt5Widgets.so"
13273     fi
13275     dnl Check for qmake5
13276     if test -n "$QT5DIR"; then
13277         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13278     else
13279         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13280     fi
13281     if test "$QMAKE5" = "no"; then
13282         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13283     else
13284         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13285         if test -z "$qmake5_test_ver"; then
13286             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13287         fi
13288         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13289         qt5_minimal_minor="15"
13290         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13291             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13292         else
13293             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13294         fi
13295     fi
13297     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13298     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13299     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13300     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13302     AC_MSG_CHECKING([for Qt5 headers])
13303     qt5_incdir="no"
13304     for inc_dir in $qt5_incdirs; do
13305         if test -r "$inc_dir/$qt5_test_include"; then
13306             qt5_incdir="$inc_dir"
13307             break
13308         fi
13309     done
13310     AC_MSG_RESULT([$qt5_incdir])
13311     if test "x$qt5_incdir" = "xno"; then
13312         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13313     fi
13314     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13315     AC_LANG_PUSH([C++])
13316     save_CPPFLAGS=$CPPFLAGS
13317     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13318     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13319         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13320     CPPFLAGS=$save_CPPFLAGS
13321     AC_LANG_POP([C++])
13323     AC_MSG_CHECKING([for Qt5 libraries])
13324     qt5_libdir="no"
13325     for lib_dir in $qt5_libdirs; do
13326         if test -r "$lib_dir/$qt5_test_library"; then
13327             qt5_libdir="$lib_dir"
13328             break
13329         fi
13330     done
13331     AC_MSG_RESULT([$qt5_libdir])
13332     if test "x$qt5_libdir" = "xno"; then
13333         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13334     fi
13336     if test "$_os" = "Emscripten"; then
13337         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13338             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13339         fi
13340         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13341             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13342         fi
13344         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13345         if ! test -x "$EMSDK_LLVM_NM"; then
13346             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13347         fi
13348         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13349             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13350         fi
13351         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13352         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
13353             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13354         fi
13355         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
13356             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
13357         fi
13358     fi
13360     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13361     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13362     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13363     if test "$_os" = "Emscripten"; then
13364         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13365     fi
13367     if test "$USING_X11" = TRUE; then
13368         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13369         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13370         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13371         QT5_USING_X11=1
13372         AC_DEFINE(QT5_USING_X11)
13373     fi
13375     dnl Check for Meta Object Compiler
13377     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13378     if test "$MOC5" = "no"; then
13379         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13380 the root of your Qt installation by exporting QT5DIR before running "configure".])
13381     fi
13383     if test "$test_gstreamer_1_0" = yes; then
13384         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13385                 QT5_HAVE_GOBJECT=1
13386                 AC_DEFINE(QT5_HAVE_GOBJECT)
13387             ],
13388             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13389         )
13390     fi
13392 AC_SUBST(QT5_CFLAGS)
13393 AC_SUBST(QT5_LIBS)
13394 AC_SUBST(MOC5)
13395 AC_SUBST(QT5_GOBJECT_CFLAGS)
13396 AC_SUBST(QT5_GOBJECT_LIBS)
13397 AC_SUBST(QT5_HAVE_GOBJECT)
13398 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13400 dnl ===================================================================
13401 dnl QT6 Integration
13402 dnl ===================================================================
13404 QT6_CFLAGS=""
13405 QT6_LIBS=""
13406 QT6_PLATFORMS_SRCDIR=""
13407 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13408         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13409 then
13410     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13411     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13413     if test -n "$supports_multilib"; then
13414         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13415     fi
13417     qt6_test_include="QtWidgets/qapplication.h"
13418     if test "$_os" = "Emscripten"; then
13419         qt6_test_library="libQt6Widgets.a"
13420     else
13421         qt6_test_library="libQt6Widgets.so"
13422     fi
13424     dnl Check for qmake6
13425     if test -n "$QT6DIR"; then
13426         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13427     else
13428         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13429     fi
13430     if test "$QMAKE6" = "no"; then
13431         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13432     else
13433         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13434         if test -z "$qmake6_test_ver"; then
13435             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13436         fi
13437         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13438     fi
13440     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13441     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13442     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13443     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13445     AC_MSG_CHECKING([for Qt6 headers])
13446     qt6_incdir="no"
13447     for inc_dir in $qt6_incdirs; do
13448         if test -r "$inc_dir/$qt6_test_include"; then
13449             qt6_incdir="$inc_dir"
13450             break
13451         fi
13452     done
13453     AC_MSG_RESULT([$qt6_incdir])
13454     if test "x$qt6_incdir" = "xno"; then
13455         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13456     fi
13457     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13458     AC_LANG_PUSH([C++])
13459     save_CPPFLAGS=$CPPFLAGS
13460     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13461     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13462         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13463     CPPFLAGS=$save_CPPFLAGS
13464     AC_LANG_POP([C++])
13466     AC_MSG_CHECKING([for Qt6 libraries])
13467     qt6_libdir="no"
13468     for lib_dir in $qt6_libdirs; do
13469         if test -r "$lib_dir/$qt6_test_library"; then
13470             qt6_libdir="$lib_dir"
13471             break
13472         fi
13473     done
13474     AC_MSG_RESULT([$qt6_libdir])
13475     if test "x$qt6_libdir" = "xno"; then
13476         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13477     fi
13479     if test "$_os" = "Emscripten"; then
13480         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13481             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13482         fi
13483         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13484             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13485         fi
13486     fi
13488     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13489     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13490     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13491     if test "$_os" = "Emscripten"; then
13492         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13493     fi
13495     if test "$USING_X11" = TRUE; then
13496         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13497         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13498         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13499         QT6_USING_X11=1
13500         AC_DEFINE(QT6_USING_X11)
13501     fi
13503     dnl Check for Meta Object Compiler
13505     for lib_dir in $qt6_libdirs; do
13506         if test -z "$qt6_libexec_dirs"; then
13507             qt6_libexec_dirs="$lib_dir/libexec"
13508         else
13509             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13510         fi
13511     done
13512     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])
13513     if test "$MOC6" = "no"; then
13514         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13515 the root of your Qt installation by exporting QT6DIR before running "configure".])
13516     else
13517         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13518         if test -z "$moc6_test_ver"; then
13519             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13520         fi
13521         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13522     fi
13524 AC_SUBST(QT6_CFLAGS)
13525 AC_SUBST(QT6_LIBS)
13526 AC_SUBST(MOC6)
13527 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13529 dnl ===================================================================
13530 dnl KF5 Integration
13531 dnl ===================================================================
13533 KF5_CFLAGS=""
13534 KF5_LIBS=""
13535 KF5_CONFIG="kf5-config"
13536 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13537         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13538 then
13539     if test "$OS" = "HAIKU"; then
13540         haiku_arch="`echo $RTL_ARCH | tr X x`"
13541         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13542         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13543     fi
13545     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13546     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13547     if test -n "$supports_multilib"; then
13548         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13549     fi
13551     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13552     kf5_test_library="libKF5KIOFileWidgets.so"
13553     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13555     dnl kf5 KDE4 support compatibility installed
13556     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13557     if test "$KF5_CONFIG" != "no"; then
13558         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13559         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13560     fi
13562     dnl Check for KF5 headers
13563     AC_MSG_CHECKING([for KF5 headers])
13564     kf5_incdir="no"
13565     for kf5_check in $kf5_incdirs; do
13566         if test -r "$kf5_check/$kf5_test_include"; then
13567             kf5_incdir="$kf5_check/KF5"
13568             break
13569         fi
13570     done
13571     AC_MSG_RESULT([$kf5_incdir])
13572     if test "x$kf5_incdir" = "xno"; then
13573         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13574     fi
13576     dnl Check for KF5 libraries
13577     AC_MSG_CHECKING([for KF5 libraries])
13578     kf5_libdir="no"
13579     for kf5_check in $kf5_libdirs; do
13580         if test -r "$kf5_check/$kf5_test_library"; then
13581             kf5_libdir="$kf5_check"
13582             break
13583         fi
13584     done
13586     AC_MSG_RESULT([$kf5_libdir])
13587     if test "x$kf5_libdir" = "xno"; then
13588         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13589     fi
13591     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"
13592     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13593     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13595     if test "$USING_X11" = TRUE; then
13596         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13597     fi
13599     AC_LANG_PUSH([C++])
13600     save_CXXFLAGS=$CXXFLAGS
13601     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13602     AC_MSG_CHECKING([whether KDE is >= 5.0])
13603        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13604 #include <kcoreaddons_version.h>
13606 int main(int argc, char **argv) {
13607        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13608        else return 1;
13610        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13611     CXXFLAGS=$save_CXXFLAGS
13612     AC_LANG_POP([C++])
13614 AC_SUBST(KF5_CFLAGS)
13615 AC_SUBST(KF5_LIBS)
13617 dnl ===================================================================
13618 dnl KF6 Integration
13619 dnl ===================================================================
13621 KF6_CFLAGS=""
13622 KF6_LIBS=""
13623 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13624 then
13625     if test "$OS" = "HAIKU"; then
13626         haiku_arch="`echo $RTL_ARCH | tr X x`"
13627         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13628         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13629     fi
13631     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13632     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13633     if test -n "$supports_multilib"; then
13634         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13635     fi
13637     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13638     kf6_test_library="libKF6KIOFileWidgets.so"
13639     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13641     dnl Check for KF6 headers
13642     AC_MSG_CHECKING([for KF6 headers])
13643     kf6_incdir="no"
13644     for kf6_check in $kf6_incdirs; do
13645         if test -r "$kf6_check/$kf6_test_include"; then
13646             kf6_incdir="$kf6_check/KF6"
13647             break
13648         fi
13649     done
13650     AC_MSG_RESULT([$kf6_incdir])
13651     if test "x$kf6_incdir" = "xno"; then
13652         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13653     fi
13655     dnl Check for KF6 libraries
13656     AC_MSG_CHECKING([for KF6 libraries])
13657     kf6_libdir="no"
13658     for kf6_check in $kf6_libdirs; do
13659         if test -r "$kf6_check/$kf6_test_library"; then
13660             kf6_libdir="$kf6_check"
13661             break
13662         fi
13663     done
13665     AC_MSG_RESULT([$kf6_libdir])
13666     if test "x$kf6_libdir" = "xno"; then
13667         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13668     fi
13670     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"
13671     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13672     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13674     AC_LANG_PUSH([C++])
13675     save_CXXFLAGS=$CXXFLAGS
13676     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13677     dnl KF6 development version as of 2023-06 uses version number 5.240
13678     AC_MSG_CHECKING([whether KDE is >= 5.240])
13679        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13680 #include <kcoreaddons_version.h>
13682 int main(int argc, char **argv) {
13683        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13684        else return 1;
13686        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13687     CXXFLAGS=$save_CXXFLAGS
13688     AC_LANG_POP([C++])
13690 AC_SUBST(KF6_CFLAGS)
13691 AC_SUBST(KF6_LIBS)
13693 dnl ===================================================================
13694 dnl Test whether to include Evolution 2 support
13695 dnl ===================================================================
13696 AC_MSG_CHECKING([whether to enable evolution 2 support])
13697 if test "$enable_evolution2" = yes; then
13698     AC_MSG_RESULT([yes])
13699     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13700     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13701     FilterLibs "${GOBJECT_LIBS}"
13702     GOBJECT_LIBS="${filteredlibs}"
13703     ENABLE_EVOAB2="TRUE"
13704 else
13705     AC_MSG_RESULT([no])
13707 AC_SUBST(ENABLE_EVOAB2)
13708 AC_SUBST(GOBJECT_CFLAGS)
13709 AC_SUBST(GOBJECT_LIBS)
13711 dnl ===================================================================
13712 dnl Test which themes to include
13713 dnl ===================================================================
13714 AC_MSG_CHECKING([which themes to include])
13715 # if none given use default subset of available themes
13716 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13717     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"
13720 WITH_THEMES=""
13721 if test "x$with_theme" != "xno"; then
13722     for theme in $with_theme; do
13723         case $theme in
13724         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" ;;
13725         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13726         esac
13727     done
13729 AC_MSG_RESULT([$WITH_THEMES])
13730 AC_SUBST([WITH_THEMES])
13732 ###############################################################################
13733 # Extensions checking
13734 ###############################################################################
13735 AC_MSG_CHECKING([for extensions integration])
13736 if test "x$enable_extension_integration" != "xno"; then
13737     WITH_EXTENSION_INTEGRATION=TRUE
13738     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13739     AC_MSG_RESULT([yes, use integration])
13740 else
13741     WITH_EXTENSION_INTEGRATION=
13742     AC_MSG_RESULT([no, do not integrate])
13744 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13746 dnl Should any extra extensions be included?
13747 dnl There are standalone tests for each of these below.
13748 WITH_EXTRA_EXTENSIONS=
13749 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13751 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13752 if test "x$with_java" != "xno"; then
13753     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13756 AC_MSG_CHECKING([whether to build opens___.ttf])
13757 if test "$enable_build_opensymbol" = "yes"; then
13758     AC_MSG_RESULT([yes])
13759     AC_PATH_PROG(FONTFORGE, fontforge)
13760     if test -z "$FONTFORGE"; then
13761         AC_MSG_ERROR([fontforge not installed])
13762     fi
13763 else
13764     AC_MSG_RESULT([no])
13765     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13767 AC_SUBST(FONTFORGE)
13769 dnl ===================================================================
13770 dnl Test whether to include fonts
13771 dnl ===================================================================
13772 AC_MSG_CHECKING([whether to include third-party fonts])
13773 if test "$with_fonts" != "no"; then
13774     AC_MSG_RESULT([yes])
13775     WITH_FONTS=TRUE
13776     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13777     AC_DEFINE(HAVE_MORE_FONTS)
13778 else
13779     AC_MSG_RESULT([no])
13780     WITH_FONTS=
13781     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13783 AC_SUBST(WITH_FONTS)
13786 dnl ===================================================================
13787 dnl Test whether to enable online update service
13788 dnl ===================================================================
13789 AC_MSG_CHECKING([whether to enable online update])
13790 ENABLE_ONLINE_UPDATE=
13791 if test "$enable_online_update" = ""; then
13792     AC_MSG_RESULT([no])
13793 else
13794     if test "$enable_online_update" = "mar"; then
13795         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13796     elif test "$enable_online_update" = "yes"; then
13797         if test "$enable_curl" != "yes"; then
13798             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13799         fi
13800         AC_MSG_RESULT([yes])
13801         ENABLE_ONLINE_UPDATE="TRUE"
13802     else
13803         AC_MSG_RESULT([no])
13804     fi
13806 AC_SUBST(ENABLE_ONLINE_UPDATE)
13809 dnl ===================================================================
13810 dnl Test whether to enable mar online update service
13811 dnl ===================================================================
13812 AC_MSG_CHECKING([whether to enable mar online update])
13813 ENABLE_ONLINE_UPDATE_MAR=
13814 if test "$enable_online_update_mar" = yes; then
13815     AC_MSG_RESULT([yes])
13816     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13817     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13818     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13819 else
13820     AC_MSG_RESULT([no])
13822 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13824 AC_MSG_CHECKING([for mar online update baseurl])
13825 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13826 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13827     AC_MSG_RESULT([yes])
13828 else
13829     AC_MSG_RESULT([no])
13831 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13833 AC_MSG_CHECKING([for mar online update certificateder])
13834 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13835 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13836     AC_MSG_RESULT([yes])
13837 else
13838     AC_MSG_RESULT([no])
13840 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13842 AC_MSG_CHECKING([for mar online update certificatename])
13843 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13844 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13845     AC_MSG_RESULT([yes])
13846 else
13847     AC_MSG_RESULT([no])
13849 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13851 AC_MSG_CHECKING([for mar online update certificatepath])
13852 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13853 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13854     AC_MSG_RESULT([yes])
13855 else
13856     AC_MSG_RESULT([no])
13858 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13861 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13862 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13863     if test "x$with_privacy_policy_url" = "xundefined"; then
13864         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13865     fi
13867 AC_SUBST(PRIVACY_POLICY_URL)
13868 dnl ===================================================================
13869 dnl Test whether we need bzip2
13870 dnl ===================================================================
13871 SYSTEM_BZIP2=
13872 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13873     AC_MSG_CHECKING([whether to use system bzip2])
13874     if test "$with_system_bzip2" = yes; then
13875         SYSTEM_BZIP2=TRUE
13876         AC_MSG_RESULT([yes])
13877         PKG_CHECK_MODULES(BZIP2, bzip2)
13878         FilterLibs "${BZIP2_LIBS}"
13879         BZIP2_LIBS="${filteredlibs}"
13880     else
13881         AC_MSG_RESULT([no])
13882         BUILD_TYPE="$BUILD_TYPE BZIP2"
13883     fi
13885 AC_SUBST(SYSTEM_BZIP2)
13886 AC_SUBST(BZIP2_CFLAGS)
13887 AC_SUBST(BZIP2_LIBS)
13889 dnl ===================================================================
13890 dnl Test whether to enable extension update
13891 dnl ===================================================================
13892 AC_MSG_CHECKING([whether to enable extension update])
13893 ENABLE_EXTENSION_UPDATE=
13894 if test "x$enable_extension_update" = "xno"; then
13895     AC_MSG_RESULT([no])
13896 else
13897     AC_MSG_RESULT([yes])
13898     ENABLE_EXTENSION_UPDATE="TRUE"
13899     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13900     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13902 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13905 dnl ===================================================================
13906 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13907 dnl ===================================================================
13908 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13909 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13910     AC_MSG_RESULT([no])
13911     ENABLE_SILENT_MSI=
13912 else
13913     AC_MSG_RESULT([yes])
13914     ENABLE_SILENT_MSI=TRUE
13915     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13917 AC_SUBST(ENABLE_SILENT_MSI)
13919 dnl ===================================================================
13920 dnl Check for WiX tools.
13921 dnl ===================================================================
13922 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13923     AC_MSG_RESULT([no])
13924     ENABLE_WIX=
13925 else
13926     AC_MSG_RESULT([yes])
13927     # FIXME: this should do proper detection, but the path is currently
13928     # hardcoded in msicreator/createmsi.py
13929     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13930       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13931     fi
13932     ENABLE_WIX=TRUE
13934 AC_SUBST(ENABLE_WIX)
13936 AC_MSG_CHECKING([whether and how to use Xinerama])
13937 if test "$USING_X11" = TRUE; then
13938     if test "$x_libraries" = "default_x_libraries"; then
13939         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13940         if test "x$XINERAMALIB" = x; then
13941            XINERAMALIB="/usr/lib"
13942         fi
13943     else
13944         XINERAMALIB="$x_libraries"
13945     fi
13946     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13947         # we have both versions, let the user decide but use the dynamic one
13948         # per default
13949         USE_XINERAMA=TRUE
13950         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13951             XINERAMA_LINK=dynamic
13952         else
13953             XINERAMA_LINK=static
13954         fi
13955     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13956         # we have only the dynamic version
13957         USE_XINERAMA=TRUE
13958         XINERAMA_LINK=dynamic
13959     elif test -e "$XINERAMALIB/libXinerama.a"; then
13960         # static version
13961         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13962             USE_XINERAMA=TRUE
13963             XINERAMA_LINK=static
13964         else
13965             USE_XINERAMA=
13966             XINERAMA_LINK=none
13967         fi
13968     else
13969         # no Xinerama
13970         USE_XINERAMA=
13971         XINERAMA_LINK=none
13972     fi
13973     if test "$USE_XINERAMA" = "TRUE"; then
13974         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13975         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13976             [AC_MSG_ERROR(Xinerama header not found.)], [])
13977         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13978         if test "x$XEXTLIB" = x; then
13979            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13980         fi
13981         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13982         if test "$_os" = "FreeBSD"; then
13983             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13984         fi
13985         if test "$_os" = "Linux"; then
13986             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13987         fi
13988         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13989             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13990     else
13991         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
13992     fi
13993 else
13994     USE_XINERAMA=
13995     XINERAMA_LINK=none
13996     AC_MSG_RESULT([no])
13998 AC_SUBST(XINERAMA_LINK)
14000 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14001 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14002     enable_cairo_rgba=yes
14004 if test "$enable_cairo_rgba" = yes; then
14005     AC_DEFINE(ENABLE_CAIRO_RGBA)
14006     ENABLE_CAIRO_RGBA=TRUE
14007     AC_MSG_RESULT([yes])
14008 else
14009     ENABLE_CAIRO_RGBA=
14010     AC_MSG_RESULT([no])
14012 AC_SUBST(ENABLE_CAIRO_RGBA)
14014 dnl ===================================================================
14015 dnl Test whether to build cairo or rely on the system version
14016 dnl ===================================================================
14018 if test "$test_cairo" = "yes"; then
14019     AC_MSG_CHECKING([whether to use the system cairo])
14021     : ${with_system_cairo:=$with_system_libs}
14022     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14023         SYSTEM_CAIRO=TRUE
14024         AC_MSG_RESULT([yes])
14026         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14027         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14028         FilterLibs "${CAIRO_LIBS}"
14029         CAIRO_LIBS="${filteredlibs}"
14031         if test "$test_xrender" = "yes"; then
14032             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14033             AC_LANG_PUSH([C])
14034             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14035 #ifdef PictStandardA8
14036 #else
14037       return fail;
14038 #endif
14039 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14041             AC_LANG_POP([C])
14042         fi
14043     else
14044         AC_MSG_RESULT([no])
14045         BUILD_TYPE="$BUILD_TYPE CAIRO"
14046     fi
14048     if test "$enable_cairo_canvas" != no; then
14049         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14050         ENABLE_CAIRO_CANVAS=TRUE
14051     fi
14054 AC_SUBST(CAIRO_CFLAGS)
14055 AC_SUBST(CAIRO_LIBS)
14056 AC_SUBST(ENABLE_CAIRO_CANVAS)
14057 AC_SUBST(SYSTEM_CAIRO)
14059 dnl ===================================================================
14060 dnl Test whether to use avahi
14061 dnl ===================================================================
14062 if test "$_os" = "WINNT"; then
14063     # Windows uses bundled mDNSResponder
14064     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14065 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14066     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14067                       [ENABLE_AVAHI="TRUE"])
14068     AC_DEFINE(HAVE_FEATURE_AVAHI)
14069     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14070     FilterLibs "${AVAHI_LIBS}"
14071     AVAHI_LIBS="${filteredlibs}"
14074 AC_SUBST(ENABLE_AVAHI)
14075 AC_SUBST(AVAHI_CFLAGS)
14076 AC_SUBST(AVAHI_LIBS)
14078 dnl ===================================================================
14079 dnl Test whether to use liblangtag
14080 dnl ===================================================================
14081 SYSTEM_LIBLANGTAG=
14082 AC_MSG_CHECKING([whether to use system liblangtag])
14083 if test "$with_system_liblangtag" = yes; then
14084     SYSTEM_LIBLANGTAG=TRUE
14085     AC_MSG_RESULT([yes])
14086     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14087     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14088     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14089     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14090     FilterLibs "${LIBLANGTAG_LIBS}"
14091     LIBLANGTAG_LIBS="${filteredlibs}"
14092 else
14093     SYSTEM_LIBLANGTAG=
14094     AC_MSG_RESULT([no])
14095     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14096     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14097     if test "$COM" = "MSC"; then
14098         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14099     else
14100         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14101     fi
14103 AC_SUBST(SYSTEM_LIBLANGTAG)
14104 AC_SUBST(LIBLANGTAG_CFLAGS)
14105 AC_SUBST(LIBLANGTAG_LIBS)
14107 dnl ===================================================================
14108 dnl Test whether to build libpng or rely on the system version
14109 dnl ===================================================================
14111 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14112 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
14113 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14115 dnl ===================================================================
14116 dnl Test whether to build libtiff or rely on the system version
14117 dnl ===================================================================
14119 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14121 dnl ===================================================================
14122 dnl Test whether to build libwebp or rely on the system version
14123 dnl ===================================================================
14125 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14127 dnl ===================================================================
14128 dnl Check for runtime JVM search path
14129 dnl ===================================================================
14130 if test "$ENABLE_JAVA" != ""; then
14131     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14132     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14133         AC_MSG_RESULT([yes])
14134         if ! test -d "$with_jvm_path"; then
14135             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14136         fi
14137         if ! test -d "$with_jvm_path"jvm; then
14138             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14139         fi
14140         JVM_ONE_PATH_CHECK="$with_jvm_path"
14141         AC_SUBST(JVM_ONE_PATH_CHECK)
14142     else
14143         AC_MSG_RESULT([no])
14144     fi
14147 dnl ===================================================================
14148 dnl Test for the presence of Ant and that it works
14149 dnl ===================================================================
14151 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14152 # breaks filename decoding, so for the ant section, set it to LANG
14153 LC_ALL=$LANG
14154 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14155     ANT_HOME=; export ANT_HOME
14156     WITH_ANT_HOME=; export WITH_ANT_HOME
14157     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14158         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14159             if test "$_os" = "WINNT"; then
14160                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14161             else
14162                 with_ant_home="$LODE_HOME/opt/ant"
14163             fi
14164         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14165             with_ant_home="$LODE_HOME/opt/ant"
14166         fi
14167     fi
14168     if test -z "$with_ant_home"; then
14169         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14170     else
14171         if test "$_os" = "WINNT"; then
14172             # AC_PATH_PROGS needs unix path
14173             PathFormat "$with_ant_home"
14174             with_ant_home="$formatted_path_unix"
14175         fi
14176         AbsolutePath "$with_ant_home"
14177         with_ant_home=$absolute_path
14178         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14179         WITH_ANT_HOME=$with_ant_home
14180         ANT_HOME=$with_ant_home
14181     fi
14183     if test -z "$ANT"; then
14184         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14185     else
14186         # resolve relative or absolute symlink
14187         while test -h "$ANT"; do
14188             a_cwd=`pwd`
14189             a_basename=`basename "$ANT"`
14190             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14191             cd "`dirname "$ANT"`"
14192             cd "`dirname "$a_script"`"
14193             ANT="`pwd`"/"`basename "$a_script"`"
14194             cd "$a_cwd"
14195         done
14197         AC_MSG_CHECKING([if $ANT works])
14198         mkdir -p conftest.dir
14199         a_cwd=$(pwd)
14200         cd conftest.dir
14201         cat > conftest.java << EOF
14202         public class conftest {
14203             int testmethod(int a, int b) {
14204                     return a + b;
14205             }
14206         }
14209         cat > conftest.xml << EOF
14210         <project name="conftest" default="conftest">
14211         <target name="conftest">
14212             <javac srcdir="." includes="conftest.java">
14213             </javac>
14214         </target>
14215         </project>
14218         if test -n "$WSL_ONLY_AS_HELPER"; then
14219             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14220             export JAVACMD="$JAVAINTERPRETER"
14221             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14222             # building the classpath, but we need the windows-style one for the windows-java
14223             PathFormat "$ANT_HOME"
14224             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14225         fi
14226         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14227         if test $? = 0 -a -f ./conftest.class; then
14228             AC_MSG_RESULT([Ant works])
14229             if test -z "$WITH_ANT_HOME"; then
14230                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14231                 if test -z "$ANT_HOME"; then
14232                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14233                 fi
14234             else
14235                 ANT_HOME="$WITH_ANT_HOME"
14236             fi
14237         else
14238             echo "configure: Ant test failed" >&5
14239             cat conftest.java >&5
14240             cat conftest.xml >&5
14241             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14242         fi
14243         cd "$a_cwd"
14244         rm -fr conftest.dir
14245     fi
14246     if test -z "$ANT_HOME"; then
14247         ANT_HOME="NO_ANT_HOME"
14248     else
14249         PathFormat "$ANT_HOME"
14250         ANT_HOME="$formatted_path_unix"
14251         PathFormat "$ANT"
14252         ANT="$formatted_path_unix"
14253     fi
14255     dnl Checking for ant.jar
14256     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14257         AC_MSG_CHECKING([Ant lib directory])
14258         if test -f $ANT_HOME/lib/ant.jar; then
14259             ANT_LIB="$ANT_HOME/lib"
14260         else
14261             if test -f $ANT_HOME/ant.jar; then
14262                 ANT_LIB="$ANT_HOME"
14263             else
14264                 if test -f /usr/share/java/ant.jar; then
14265                     ANT_LIB=/usr/share/java
14266                 else
14267                     if test -f /usr/share/ant-core/lib/ant.jar; then
14268                         ANT_LIB=/usr/share/ant-core/lib
14269                     else
14270                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14271                             ANT_LIB="$ANT_HOME/lib/ant"
14272                         else
14273                             if test -f /usr/share/lib/ant/ant.jar; then
14274                                 ANT_LIB=/usr/share/lib/ant
14275                             else
14276                                 AC_MSG_ERROR([Ant libraries not found!])
14277                             fi
14278                         fi
14279                     fi
14280                 fi
14281             fi
14282         fi
14283         PathFormat "$ANT_LIB"
14284         ANT_LIB="$formatted_path"
14285         AC_MSG_RESULT([Ant lib directory found.])
14286     fi
14288     ant_minver=1.6.0
14289     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14291     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14292     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14293     ant_version_major=`echo $ant_version | cut -d. -f1`
14294     ant_version_minor=`echo $ant_version | cut -d. -f2`
14295     echo "configure: ant_version $ant_version " >&5
14296     echo "configure: ant_version_major $ant_version_major " >&5
14297     echo "configure: ant_version_minor $ant_version_minor " >&5
14298     if test "$ant_version_major" -ge "2"; then
14299         AC_MSG_RESULT([yes, $ant_version])
14300     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14301         AC_MSG_RESULT([yes, $ant_version])
14302     else
14303         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14304     fi
14306     rm -f conftest* core core.* *.core
14308 AC_SUBST(ANT)
14309 AC_SUBST(ANT_HOME)
14310 AC_SUBST(ANT_LIB)
14312 OOO_JUNIT_JAR=
14313 HAMCREST_JAR=
14314 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14315     AC_MSG_CHECKING([for JUnit 4])
14316     if test "$with_junit" = "yes"; then
14317         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14318             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14319         elif test -e /usr/share/java/junit4.jar; then
14320             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14321         else
14322            if test -e /usr/share/lib/java/junit.jar; then
14323               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14324            else
14325               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14326            fi
14327         fi
14328     else
14329         OOO_JUNIT_JAR=$with_junit
14330     fi
14331     if test "$_os" = "WINNT"; then
14332         PathFormat "$OOO_JUNIT_JAR"
14333         OOO_JUNIT_JAR="$formatted_path"
14334     fi
14335     printf 'import org.junit.Before;' > conftest.java
14336     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14337         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14338     else
14339         AC_MSG_ERROR(
14340 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14341  specify its pathname via --with-junit=..., or disable it via --without-junit])
14342     fi
14343     rm -f conftest.class conftest.java
14344     if test $OOO_JUNIT_JAR != ""; then
14345         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14346     fi
14348     AC_MSG_CHECKING([for included Hamcrest])
14349     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14350     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14351         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14352     else
14353         AC_MSG_RESULT([Not included])
14354         AC_MSG_CHECKING([for standalone hamcrest jar.])
14355         if test "$with_hamcrest" = "yes"; then
14356             if test -e /usr/share/lib/java/hamcrest.jar; then
14357                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14358             elif test -e /usr/share/java/hamcrest/core.jar; then
14359                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14360             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14361                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14362             else
14363                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14364             fi
14365         else
14366             HAMCREST_JAR=$with_hamcrest
14367         fi
14368         if test "$_os" = "WINNT"; then
14369             PathFormat "$HAMCREST_JAR"
14370             HAMCREST_JAR="$formatted_path"
14371         fi
14372         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14373             AC_MSG_RESULT([$HAMCREST_JAR])
14374         else
14375             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),
14376                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14377         fi
14378     fi
14379     rm -f conftest.class conftest.java
14381 AC_SUBST(OOO_JUNIT_JAR)
14382 AC_SUBST(HAMCREST_JAR)
14383 # set back LC_ALL to C after the java related tests...
14384 LC_ALL=C
14386 AC_SUBST(SCPDEFS)
14389 # check for wget and curl
14391 WGET=
14392 CURL=
14394 if test "$enable_fetch_external" != "no"; then
14396 CURL=`command -v curl`
14398 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14399     # wget new enough?
14400     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14401     if test $? -eq 0; then
14402         WGET=$i
14403         break
14404     fi
14405 done
14407 if test -z "$WGET" -a -z "$CURL"; then
14408     AC_MSG_ERROR([neither wget nor curl found!])
14413 AC_SUBST(WGET)
14414 AC_SUBST(CURL)
14417 # check for sha256sum
14419 SHA256SUM=
14421 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14422     eval "$i -a 256 --version" > /dev/null 2>&1
14423     ret=$?
14424     if test $ret -eq 0; then
14425         SHA256SUM="$i -a 256"
14426         break
14427     fi
14428 done
14430 if test -z "$SHA256SUM"; then
14431     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14432         eval "$i --version" > /dev/null 2>&1
14433         ret=$?
14434         if test $ret -eq 0; then
14435             SHA256SUM=$i
14436             break
14437         fi
14438     done
14441 if test -z "$SHA256SUM"; then
14442     AC_MSG_ERROR([no sha256sum found!])
14445 AC_SUBST(SHA256SUM)
14447 dnl ===================================================================
14448 dnl Dealing with l10n options
14449 dnl ===================================================================
14450 AC_MSG_CHECKING([which languages to be built])
14451 # get list of all languages
14452 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14453 # the sed command does the following:
14454 #   + if a line ends with a backslash, append the next line to it
14455 #   + adds " on the beginning of the value (after =)
14456 #   + adds " at the end of the value
14457 #   + removes en-US; we want to put it on the beginning
14458 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
14459 [eval $(sed -e :a -e '/\\$/N; s/\\\n//; ta' -n -e 's/=/="/;s/\([^\\]\)$/\1"/;s/en-US//;/^completelangiso/p' $SRC_ROOT/solenv/inc/langlist.mk)]
14460 ALL_LANGS="en-US $completelangiso"
14461 # check the configured localizations
14462 WITH_LANG="$with_lang"
14464 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14465 # (Norwegian is "nb" and "nn".)
14466 if test "$WITH_LANG" = "no"; then
14467     WITH_LANG=
14470 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14471     AC_MSG_RESULT([en-US])
14472 else
14473     AC_MSG_RESULT([$WITH_LANG])
14474     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14475     if test -z "$MSGFMT"; then
14476         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14477             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14478         elif test -x "/opt/lo/bin/msgfmt"; then
14479             MSGFMT="/opt/lo/bin/msgfmt"
14480         else
14481             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14482             if test -z "$MSGFMT"; then
14483                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14484             fi
14485         fi
14486     fi
14487     if test -z "$MSGUNIQ"; then
14488         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14489             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14490         elif test -x "/opt/lo/bin/msguniq"; then
14491             MSGUNIQ="/opt/lo/bin/msguniq"
14492         else
14493             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14494             if test -z "$MSGUNIQ"; then
14495                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14496             fi
14497         fi
14498     fi
14500 AC_SUBST(MSGFMT)
14501 AC_SUBST(MSGUNIQ)
14502 # check that the list is valid
14503 for lang in $WITH_LANG; do
14504     test "$lang" = "ALL" && continue
14505     # need to check for the exact string, so add space before and after the list of all languages
14506     for vl in $ALL_LANGS; do
14507         if test "$vl" = "$lang"; then
14508            break
14509         fi
14510     done
14511     if test "$vl" != "$lang"; then
14512         # if you're reading this - you prolly quoted your languages remove the quotes ...
14513         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14514     fi
14515 done
14516 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14517     echo $WITH_LANG | grep -q en-US
14518     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14520 # list with substituted ALL
14521 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14522 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14523 test "$WITH_LANG" = "en-US" && WITH_LANG=
14524 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14525     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14526     ALL_LANGS=`echo $ALL_LANGS qtz`
14528 AC_SUBST(ALL_LANGS)
14529 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14530 AC_SUBST(WITH_LANG)
14531 AC_SUBST(WITH_LANG_LIST)
14532 AC_SUBST(GIT_NEEDED_SUBMODULES)
14534 WITH_POOR_HELP_LOCALIZATIONS=
14535 if test -d "$SRC_ROOT/translations/source"; then
14536     for l in `ls -1 $SRC_ROOT/translations/source`; do
14537         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14538             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14539         fi
14540     done
14542 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14544 if test -n "$with_locales" -a "$with_locales" != ALL; then
14545     WITH_LOCALES="$with_locales"
14547     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14548     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14549     # config_host/config_locales.h.in
14550     for locale in $WITH_LOCALES; do
14551         lang=${locale%_*}
14553         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14555         case $lang in
14556         hi|mr*ne)
14557             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14558             ;;
14559         bg|ru)
14560             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14561             ;;
14562         esac
14563     done
14564 else
14565     AC_DEFINE(WITH_LOCALE_ALL)
14567 AC_SUBST(WITH_LOCALES)
14569 dnl git submodule update --reference
14570 dnl ===================================================================
14571 if test -n "${GIT_REFERENCE_SRC}"; then
14572     for repo in ${GIT_NEEDED_SUBMODULES}; do
14573         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14574             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14575         fi
14576     done
14578 AC_SUBST(GIT_REFERENCE_SRC)
14580 dnl git submodules linked dirs
14581 dnl ===================================================================
14582 if test -n "${GIT_LINK_SRC}"; then
14583     for repo in ${GIT_NEEDED_SUBMODULES}; do
14584         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14585             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14586         fi
14587     done
14589 AC_SUBST(GIT_LINK_SRC)
14591 dnl branding
14592 dnl ===================================================================
14593 AC_MSG_CHECKING([for alternative branding images directory])
14594 # initialize mapped arrays
14595 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14596 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14598 if test -z "$with_branding" -o "$with_branding" = "no"; then
14599     AC_MSG_RESULT([none])
14600     DEFAULT_BRAND_IMAGES="$brand_files"
14601 else
14602     if ! test -d $with_branding ; then
14603         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14604     else
14605         AC_MSG_RESULT([$with_branding])
14606         CUSTOM_BRAND_DIR="$with_branding"
14607         for lfile in $brand_files
14608         do
14609             if ! test -f $with_branding/$lfile ; then
14610                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14611                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14612             else
14613                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14614             fi
14615         done
14616         check_for_progress="yes"
14617     fi
14619 AC_SUBST([BRAND_INTRO_IMAGES])
14620 AC_SUBST([CUSTOM_BRAND_DIR])
14621 AC_SUBST([CUSTOM_BRAND_IMAGES])
14622 AC_SUBST([DEFAULT_BRAND_IMAGES])
14625 AC_MSG_CHECKING([for 'intro' progress settings])
14626 PROGRESSBARCOLOR=
14627 PROGRESSSIZE=
14628 PROGRESSPOSITION=
14629 PROGRESSFRAMECOLOR=
14630 PROGRESSTEXTCOLOR=
14631 PROGRESSTEXTBASELINE=
14633 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14634     source "$with_branding/progress.conf"
14635     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14636 else
14637     AC_MSG_RESULT([none])
14640 AC_SUBST(PROGRESSBARCOLOR)
14641 AC_SUBST(PROGRESSSIZE)
14642 AC_SUBST(PROGRESSPOSITION)
14643 AC_SUBST(PROGRESSFRAMECOLOR)
14644 AC_SUBST(PROGRESSTEXTCOLOR)
14645 AC_SUBST(PROGRESSTEXTBASELINE)
14648 dnl ===================================================================
14649 dnl Custom build version
14650 dnl ===================================================================
14651 AC_MSG_CHECKING([for extra build ID])
14652 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14653     EXTRA_BUILDID="$with_extra_buildid"
14655 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14656 if test -n "$EXTRA_BUILDID" ; then
14657     AC_MSG_RESULT([$EXTRA_BUILDID])
14658 else
14659     AC_MSG_RESULT([not set])
14661 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14663 OOO_VENDOR=
14664 AC_MSG_CHECKING([for vendor])
14665 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14666     OOO_VENDOR="$USERNAME"
14668     if test -z "$OOO_VENDOR"; then
14669         OOO_VENDOR="$USER"
14670     fi
14672     if test -z "$OOO_VENDOR"; then
14673         OOO_VENDOR="`id -u -n`"
14674     fi
14676     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14677 else
14678     OOO_VENDOR="$with_vendor"
14679     AC_MSG_RESULT([$OOO_VENDOR])
14681 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14682 AC_SUBST(OOO_VENDOR)
14684 if test "$_os" = "Android" ; then
14685     ANDROID_PACKAGE_NAME=
14686     AC_MSG_CHECKING([for Android package name])
14687     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14688         if test -n "$ENABLE_DEBUG"; then
14689             # Default to the package name that makes ndk-gdb happy.
14690             ANDROID_PACKAGE_NAME="org.libreoffice"
14691         else
14692             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14693         fi
14695         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14696     else
14697         ANDROID_PACKAGE_NAME="$with_android_package_name"
14698         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14699     fi
14700     AC_SUBST(ANDROID_PACKAGE_NAME)
14703 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14704 if test "$with_compat_oowrappers" = "yes"; then
14705     WITH_COMPAT_OOWRAPPERS=TRUE
14706     AC_MSG_RESULT(yes)
14707 else
14708     WITH_COMPAT_OOWRAPPERS=
14709     AC_MSG_RESULT(no)
14711 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14713 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14714 AC_MSG_CHECKING([for install dirname])
14715 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14716     INSTALLDIRNAME="$with_install_dirname"
14718 AC_MSG_RESULT([$INSTALLDIRNAME])
14719 AC_SUBST(INSTALLDIRNAME)
14721 AC_MSG_CHECKING([for prefix])
14722 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14723 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14724 PREFIXDIR="$prefix"
14725 AC_MSG_RESULT([$PREFIXDIR])
14726 AC_SUBST(PREFIXDIR)
14728 LIBDIR=[$(eval echo $(eval echo $libdir))]
14729 AC_SUBST(LIBDIR)
14731 DATADIR=[$(eval echo $(eval echo $datadir))]
14732 AC_SUBST(DATADIR)
14734 MANDIR=[$(eval echo $(eval echo $mandir))]
14735 AC_SUBST(MANDIR)
14737 DOCDIR=[$(eval echo $(eval echo $docdir))]
14738 AC_SUBST(DOCDIR)
14740 BINDIR=[$(eval echo $(eval echo $bindir))]
14741 AC_SUBST(BINDIR)
14743 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14744 AC_SUBST(INSTALLDIR)
14746 TESTINSTALLDIR="${BUILDDIR}/test-install"
14747 AC_SUBST(TESTINSTALLDIR)
14750 # ===================================================================
14751 # OAuth2 id and secrets
14752 # ===================================================================
14754 AC_MSG_CHECKING([for Google Drive client id and secret])
14755 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14756     AC_MSG_RESULT([not set])
14757     GDRIVE_CLIENT_ID="\"\""
14758     GDRIVE_CLIENT_SECRET="\"\""
14759 else
14760     AC_MSG_RESULT([set])
14761     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14762     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14764 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14765 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14767 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14768 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14769     AC_MSG_RESULT([not set])
14770     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14771     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14772 else
14773     AC_MSG_RESULT([set])
14774     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14775     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14777 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14778 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14780 AC_MSG_CHECKING([for OneDrive client id and secret])
14781 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14782     AC_MSG_RESULT([not set])
14783     ONEDRIVE_CLIENT_ID="\"\""
14784     ONEDRIVE_CLIENT_SECRET="\"\""
14785 else
14786     AC_MSG_RESULT([set])
14787     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14788     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14790 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14791 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14794 dnl ===================================================================
14795 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14796 dnl --enable-dependency-tracking configure option
14797 dnl ===================================================================
14798 AC_MSG_CHECKING([whether to enable dependency tracking])
14799 if test "$enable_dependency_tracking" = "no"; then
14800     nodep=TRUE
14801     AC_MSG_RESULT([no])
14802 else
14803     AC_MSG_RESULT([yes])
14805 AC_SUBST(nodep)
14807 dnl ===================================================================
14808 dnl Number of CPUs to use during the build
14809 dnl ===================================================================
14810 AC_MSG_CHECKING([for number of processors to use])
14811 # plain --with-parallelism is just the default
14812 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14813     if test "$with_parallelism" = "no"; then
14814         PARALLELISM=0
14815     else
14816         PARALLELISM=$with_parallelism
14817     fi
14818 else
14819     if test "$enable_icecream" = "yes"; then
14820         PARALLELISM="40"
14821     else
14822         case `uname -s` in
14824         Darwin|FreeBSD|NetBSD|OpenBSD)
14825             PARALLELISM=`sysctl -n hw.ncpu`
14826             ;;
14828         Linux)
14829             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14830         ;;
14831         # what else than above does profit here *and* has /proc?
14832         *)
14833             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14834             ;;
14835         esac
14837         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14838         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14839     fi
14842 if test $PARALLELISM -eq 0; then
14843     AC_MSG_RESULT([explicit make -j option needed])
14844 else
14845     AC_MSG_RESULT([$PARALLELISM])
14847 AC_SUBST(PARALLELISM)
14850 # Set up ILIB for MSVC build
14852 ILIB1=
14853 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14854     ILIB="."
14855     if test -n "$JAVA_HOME"; then
14856         ILIB="$ILIB;$JAVA_HOME/lib"
14857     fi
14858     ILIB1=-link
14859     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14860     ILIB="$ILIB;$formatted_path"
14861     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14862     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14863     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14864     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14865         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14866         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14867     fi
14868     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14869     ucrtlibpath_formatted=$formatted_path
14870     ILIB="$ILIB;$ucrtlibpath_formatted"
14871     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14872     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14873         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14874         ILIB="$ILIB;$formatted_path"
14875     else
14876         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14877         ILIB="$ILIB;$formatted_path"
14878     fi
14880     if test "$cross_compiling" != "yes"; then
14881         ILIB_FOR_BUILD="$ILIB"
14882     fi
14884 AC_SUBST(ILIB)
14885 AC_SUBST(ILIB_FOR_BUILD)
14887 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14888 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14889 dnl from consteval constructor initializing const variable",
14890 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14891 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14892 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14893 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14894 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14895 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
14896 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
14897 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14898 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14899 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14900 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
14901 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
14902 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
14903 have_cpp_consteval=
14904 AC_LANG_PUSH([C++])
14905 save_CXX=$CXX
14906 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14907     CXX="env LIB=$ILIB $CXX"
14909 save_CXXFLAGS=$CXXFLAGS
14910 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14911 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14912         struct S {
14913             consteval S() { i = 1; }
14914             int i = 0;
14915         };
14916         S const s;
14918         struct S1 {
14919              int a;
14920              consteval S1(int n): a(n) {}
14921         };
14922         struct S2 {
14923             S1 x;
14924             S2(): x(0) {}
14925         };
14927         struct S3 {
14928             consteval S3() {}
14929             union {
14930                 int a;
14931                 unsigned b = 0;
14932             };
14933         };
14934         void f() { S3(); }
14936         struct S4 { consteval S4() = default; };
14937         void f4(bool b) { b ? S4() : S4(); }
14939         struct S5 {
14940             consteval S5() { c = 0; }
14941             char * f() { return &c; }
14942             union {
14943                 char c;
14944                 int i;
14945             };
14946         };
14947         auto s5 = S5().f();
14949         struct S6 {
14950             consteval S6(char const (&lit)[[2]]) {
14951                 buf[[0]] = lit[[0]];
14952                 buf[[1]] = lit[[1]];
14953             }
14954             union {
14955                 int x;
14956                 char buf[[2]];
14957             };
14958         };
14959         void f6() { S6("a"); }
14960     ], [
14961         return (s.i == 1) ? 0 : 1;
14962     ])], [
14963         have_cpp_consteval=1
14964         AC_MSG_RESULT([yes])
14965     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14966 CXX=$save_CXX
14967 CXXFLAGS=$save_CXXFLAGS
14968 AC_LANG_POP([C++])
14969 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
14970 then
14971     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
14972     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
14973     dnl reference to consteval constructor exported from module" (which also affects PCH, see
14974     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
14975     dnl --enable-pch setup is known broken"):
14976     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
14977     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
14978     rm conftest.cppm
14979     AC_LANG_PUSH([C++])
14980     save_CXXFLAGS=$CXXFLAGS
14981     save_LDFLAGS=$LDFLAGS
14982     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14983     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
14984     AC_LINK_IFELSE([AC_LANG_PROGRAM([
14985         import M;
14986     ], [
14987         struct S2 { S1 s = 0; };
14988         S2 s;
14989     ])], [
14990         AC_MSG_RESULT([yes])
14991     ], [
14992         have_cpp_consteval=
14993         AC_MSG_RESULT([no])])
14994     CXXFLAGS=$save_CXXFLAGS
14995     LDFLAGS=$save_LDFLAGS
14996     AC_LANG_POP([C++])
14997     rm conftest.pcm
14999 if test -n "$have_cpp_consteval"; then
15000     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15003 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15004 dnl ...which is known to not be implemented in libc++ prior to
15005 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15006 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15007 AC_LANG_PUSH([C++])
15008 save_CXX=$CXX
15009 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15010     CXX="env LIB=$ILIB $CXX"
15012 save_CXXFLAGS=$CXXFLAGS
15013 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15014 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15015         #include <compare>
15016     ], [
15017         (void) (std::strong_order(1.0, 2.0) < 0);
15018     ])], [
15019         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15020         AC_MSG_RESULT([yes])
15021     ], [AC_MSG_RESULT([no])])
15022 CXX=$save_CXX
15023 CXXFLAGS=$save_CXXFLAGS
15024 AC_LANG_POP([C++])
15026 # ===================================================================
15027 # Creating bigger shared library to link against
15028 # ===================================================================
15029 AC_MSG_CHECKING([whether to create huge library])
15030 MERGELIBS=
15031 MERGELIBS_MORE=
15033 if test $_os = iOS -o $_os = Android; then
15034     # Never any point in mergelibs for these as we build just static
15035     # libraries anyway...
15036     enable_mergelibs=no
15039 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15040     if test "$enable_mergelibs" = "more"; then
15041         MERGELIBS="TRUE"
15042         MERGELIBS_MORE="TRUE"
15043         AC_MSG_RESULT([yes (more)])
15044         AC_DEFINE(ENABLE_MERGELIBS)
15045         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15046     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15047         MERGELIBS="TRUE"
15048         AC_MSG_RESULT([yes])
15049         AC_DEFINE(ENABLE_MERGELIBS)
15050     else
15051         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15052     fi
15053 else
15054     AC_MSG_RESULT([no])
15056 AC_SUBST([MERGELIBS])
15057 AC_SUBST([MERGELIBS_MORE])
15059 dnl ===================================================================
15060 dnl icerun is a wrapper that stops us spawning tens of processes
15061 dnl locally - for tools that can't be executed on the compile cluster
15062 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15063 dnl ===================================================================
15064 AC_MSG_CHECKING([whether to use icerun wrapper])
15065 ICECREAM_RUN=
15066 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15067     ICECREAM_RUN=icerun
15068     AC_MSG_RESULT([yes])
15069 else
15070     AC_MSG_RESULT([no])
15072 AC_SUBST(ICECREAM_RUN)
15074 dnl ===================================================================
15075 dnl Setup the ICECC_VERSION for the build the same way it was set for
15076 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15077 dnl ===================================================================
15078 x_ICECC_VERSION=[\#]
15079 if test -n "$ICECC_VERSION" ; then
15080     x_ICECC_VERSION=
15082 AC_SUBST(x_ICECC_VERSION)
15083 AC_SUBST(ICECC_VERSION)
15085 dnl ===================================================================
15087 AC_MSG_CHECKING([MPL subset])
15088 MPL_SUBSET=
15089 LICENSE="LGPL"
15091 if test "$enable_mpl_subset" = "yes"; then
15092     mpl_error_string=
15093     newline=$'\n    *'
15094     warn_report=false
15095     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15096         warn_report=true
15097     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15098         warn_report=true
15099     fi
15100     if test "$warn_report" = "true"; then
15101         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15102     fi
15103     if test "x$enable_postgresql_sdbc" != "xno"; then
15104         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15105     fi
15106     if test "$enable_lotuswordpro" = "yes"; then
15107         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15108     fi
15109     if test -n "$ENABLE_POPPLER"; then
15110         if test "x$SYSTEM_POPPLER" = "x"; then
15111             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15112         fi
15113     fi
15114     # cf. m4/libo_check_extension.m4
15115     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15116         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15117     fi
15118     denied_themes=
15119     filtered_themes=
15120     for theme in $WITH_THEMES; do
15121         case $theme in
15122         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15123             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15124         *)
15125             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15126         esac
15127     done
15128     if test "x$denied_themes" != "x"; then
15129         if test "x$filtered_themes" == "x"; then
15130             filtered_themes="colibre"
15131         fi
15132         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15133     fi
15135     ENABLE_OPENGL_TRANSITIONS=
15137     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15138         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15139     fi
15141     if test "x$mpl_error_string" != "x"; then
15142         AC_MSG_ERROR([$mpl_error_string])
15143     fi
15145     MPL_SUBSET="TRUE"
15146     LICENSE="MPL-2.0"
15147     AC_DEFINE(MPL_HAVE_SUBSET)
15148     AC_MSG_RESULT([only])
15149 else
15150     AC_MSG_RESULT([no restrictions])
15152 AC_SUBST(MPL_SUBSET)
15153 AC_SUBST(LICENSE)
15155 dnl ===================================================================
15157 AC_MSG_CHECKING([formula logger])
15158 ENABLE_FORMULA_LOGGER=
15160 if test "x$enable_formula_logger" = "xyes"; then
15161     AC_MSG_RESULT([yes])
15162     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15163     ENABLE_FORMULA_LOGGER=TRUE
15164 elif test -n "$ENABLE_DBGUTIL" ; then
15165     AC_MSG_RESULT([yes])
15166     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15167     ENABLE_FORMULA_LOGGER=TRUE
15168 else
15169     AC_MSG_RESULT([no])
15172 AC_SUBST(ENABLE_FORMULA_LOGGER)
15174 dnl ===================================================================
15175 dnl Checking for active Antivirus software.
15176 dnl ===================================================================
15178 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15179     AC_MSG_CHECKING([for active Antivirus software])
15180     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15181     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15182     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15183         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15184             AC_MSG_RESULT([found])
15185             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15186             echo $EICAR_STRING > $SRC_ROOT/eicar
15187             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15188             rm $SRC_ROOT/eicar
15189             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15190                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15191             fi
15192             echo $EICAR_STRING > $BUILDDIR/eicar
15193             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15194             rm $BUILDDIR/eicar
15195             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15196                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15197             fi
15198             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"
15199         else
15200             AC_MSG_RESULT([not found])
15201         fi
15202     else
15203         AC_MSG_RESULT([n/a])
15204     fi
15207 dnl ===================================================================
15209 AC_MSG_CHECKING([for coredumpctl support])
15210 if test -z "$with_coredumpctl" && test $_os != Linux; then
15211     with_coredumpctl=no
15213 if test "$with_coredumpctl" = no; then
15214     WITH_COREDUMPCTL=
15215 else
15216     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15217     AC_PATH_PROG(JQ, jq)
15218     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15219     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15220     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15221         || test -z "$SYSTEMD_RUN"
15222     then
15223         if test -z "$with_coredumpctl"; then
15224             WITH_COREDUMPCTL=
15225         else
15226             if test -z "$COREDUMPCTL"; then
15227                 AC_MSG_ERROR([coredumpctl not found])
15228             fi
15229             if test -z "$JQ"; then
15230                 AC_MSG_ERROR([jq not found])
15231             fi
15232             if test -z "$SYSTEMD_ESCAPE"; then
15233                 AC_MSG_ERROR([systemd-escape not found])
15234             fi
15235             if test -z "$SYSTEMD_RUN"; then
15236                 AC_MSG_ERROR([systemd-run not found])
15237             fi
15238         fi
15239     else
15240         WITH_COREDUMPCTL=TRUE
15241     fi
15243 if test -z "$WITH_COREDUMPCTL"; then
15244     AC_MSG_RESULT([no])
15245 else
15246     AC_MSG_RESULT([yes])
15248 AC_SUBST(COREDUMPCTL)
15249 AC_SUBST(JQ)
15250 AC_SUBST(SYSTEMD_ESCAPE)
15251 AC_SUBST(SYSTEMD_RUN)
15252 AC_SUBST(WITH_COREDUMPCTL)
15254 dnl ===================================================================
15255 dnl Checking whether to use a keep-awake helper
15256 dnl ===================================================================
15258 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15259 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15260     AC_MSG_RESULT([no])
15261 elif test "$with_keep_awake" = "yes"; then
15262     AC_MSG_RESULT([yes (autodetect)])
15263     AC_MSG_CHECKING([for a suitable keep-awake command])
15264     if test "$_os" = "WINNT"; then
15265         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15266         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15267             AC_MSG_RESULT([using "Awake"])
15268             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15269             # make's PID and then use that to get the windows-PID.
15270             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15271             # much scarier looking than it actually is. Using make's shell instead of subshells in
15272             # the recipe to keep the command that's echoed by make short.
15273             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}'"'"') &'
15274         else
15275             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15276         fi
15277     elif test "$_os" = "Darwin"; then
15278         AC_MSG_RESULT([using "caffeinate"])
15279         KEEP_AWAKE_CMD="caffeinate"
15280     else
15281         AC_MSG_ERROR([no default available for $_os, please specify manually])
15282     fi
15283 else
15284     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15286 AC_SUBST(KEEP_AWAKE_CMD)
15288 dnl ===================================================================
15289 dnl Setting up the environment.
15290 dnl ===================================================================
15291 AC_MSG_NOTICE([setting up the build environment variables...])
15293 AC_SUBST(COMPATH)
15295 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15296     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15297         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15298         ATL_INCLUDE="$COMPATH/atlmfc/include"
15299     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15300         ATL_LIB="$COMPATH/atlmfc/lib"
15301         ATL_INCLUDE="$COMPATH/atlmfc/include"
15302     else
15303         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15304         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15305     fi
15306     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15307     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15308     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15311 if test "$build_os" = "cygwin"; then
15312     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15313     PathFormat "/usr/bin/find.exe"
15314     FIND="$formatted_path"
15315     PathFormat "/usr/bin/sort.exe"
15316     SORT="$formatted_path"
15317     PathFormat "/usr/bin/grep.exe"
15318     WIN_GREP="$formatted_path"
15319     PathFormat "/usr/bin/ls.exe"
15320     WIN_LS="$formatted_path"
15321     PathFormat "/usr/bin/touch.exe"
15322     WIN_TOUCH="$formatted_path"
15323 else
15324     FIND=find
15325     SORT=sort
15328 AC_SUBST(ATL_INCLUDE)
15329 AC_SUBST(ATL_LIB)
15330 AC_SUBST(FIND)
15331 AC_SUBST(SORT)
15332 AC_SUBST(WIN_GREP)
15333 AC_SUBST(WIN_LS)
15334 AC_SUBST(WIN_TOUCH)
15336 AC_SUBST(BUILD_TYPE)
15338 AC_SUBST(SOLARINC)
15340 PathFormat "$PERL"
15341 PERL="$formatted_path"
15342 AC_SUBST(PERL)
15344 if test -n "$TMPDIR"; then
15345     TEMP_DIRECTORY="$TMPDIR"
15346     if test -n "$WSL_ONLY_AS_HELPER"; then
15347        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15348     fi
15349 else
15350     TEMP_DIRECTORY="/tmp"
15352 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15353 if test "$build_os" = "cygwin"; then
15354     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15355     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15357 AC_SUBST(TEMP_DIRECTORY)
15358 AC_SUBST(CYGWIN_BASH)
15360 # setup the PATH for the environment
15361 if test -n "$LO_PATH_FOR_BUILD"; then
15362     LO_PATH="$LO_PATH_FOR_BUILD"
15363     case "$host_os" in
15364     cygwin*|wsl*)
15365         pathmunge "$MSVC_HOST_PATH" "before"
15366         ;;
15367     esac
15368 else
15369     LO_PATH="$PATH"
15371     case "$host_os" in
15373     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15374         if test "$ENABLE_JAVA" != ""; then
15375             pathmunge "$JAVA_HOME/bin" "after"
15376         fi
15377         ;;
15379     cygwin*|wsl*)
15380         # Win32 make needs native paths
15381         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15382             LO_PATH=`cygpath -p -m "$PATH"`
15383         fi
15384         if test "$WIN_BUILD_ARCH" = "x64"; then
15385             # needed for msi packaging
15386             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15387         fi
15388         if test "$WIN_BUILD_ARCH" = "arm64"; then
15389             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15390             # the x86 ones probably would work just as well...
15391             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15392         fi
15393         # .NET 4.6 and higher don't have bin directory
15394         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15395             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15396         fi
15397         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15398         pathmunge "$CSC_PATH" "before"
15399         pathmunge "$MIDL_PATH" "before"
15400         pathmunge "$AL_PATH" "before"
15401         pathmunge "$MSVC_MULTI_PATH" "before"
15402         pathmunge "$MSVC_BUILD_PATH" "before"
15403         if test -n "$MSBUILD_PATH" ; then
15404             pathmunge "$MSBUILD_PATH" "before"
15405         fi
15406         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15407         if test "$ENABLE_JAVA" != ""; then
15408             if test -d "$JAVA_HOME/jre/bin/client"; then
15409                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15410             fi
15411             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15412                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15413             fi
15414             pathmunge "$JAVA_HOME/bin" "before"
15415         fi
15416         pathmunge "$MSVC_HOST_PATH" "before"
15417         ;;
15419     solaris*)
15420         pathmunge "/usr/css/bin" "before"
15421         if test "$ENABLE_JAVA" != ""; then
15422             pathmunge "$JAVA_HOME/bin" "after"
15423         fi
15424         ;;
15425     esac
15428 AC_SUBST(LO_PATH)
15430 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15431 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15432     x_LO_ELFCHECK_ALLOWLIST=
15433 else
15434     x_LO_ELFCHECK_ALLOWLIST=[\#]
15436 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15437 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15439 libo_FUZZ_SUMMARY
15441 # Generate a configuration sha256 we can use for deps
15442 if test -f config_host.mk; then
15443     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15445 if test -f config_host_lang.mk; then
15446     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15449 CFLAGS=$my_original_CFLAGS
15450 CXXFLAGS=$my_original_CXXFLAGS
15451 CPPFLAGS=$my_original_CPPFLAGS
15453 AC_CONFIG_LINKS([include:include])
15455 if test -n "$WSL_ONLY_AS_HELPER"; then
15456     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15457     build=$host
15458     PathFormat "$SRC_ROOT"
15459     SRC_ROOT="$formatted_path"
15460     PathFormat "$BUILDDIR"
15461     BUILDDIR="$formatted_path"
15462     # git-bash has (gnu) tar, curl and sha256sum
15463     CURL="curl.exe"
15464     WGET=
15465     GNUTAR="tar.exe"
15466     SHA256SUM="sha256sum.exe"
15467     # TODO: maybe switch to strawberry-perl right away?
15468     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15469     PERL="perl.exe"
15470     # use flex, gperf and nasm from wsl-container
15471     # if using absolute path, would need to use double-leading slash for the msys path mangling
15472     FLEX="$WSL $FLEX"
15473     NASM="$WSL $NASM"
15474     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15475     # with an absolute path/requires the value to begin with a slash
15476     GPERF="/c/Windows/system32/$WSL gperf"
15477     # append strawberry tools dir to PATH (for e.g. windres, ar)
15478     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15479     # temp-dir needs to be in windows realm, hardcode for now
15480     if test "$TEMP_DIRECTORY" = /tmp; then
15481         mkdir -p tmp
15482         TEMP_DIRECTORY="$BUILDDIR/tmp"
15483     fi
15486 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15487 # BUILD platform configuration] - otherwise breaks cross building
15488 AC_CONFIG_FILES([
15489                  config_host_lang.mk
15490                  Makefile
15491                  bin/bffvalidator.sh
15492                  bin/odfvalidator.sh
15493                  bin/officeotron.sh
15494                  instsetoo_native/util/openoffice.lst
15495                  sysui/desktop/macosx/Info.plist
15496                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15497                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15498                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15499 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15500 # easier to do it in a postprocessing command than to modify every single variable
15501 AC_CONFIG_FILES([config_host.mk], [
15502     if test -n "$WSL_ONLY_AS_HELPER"; then
15503         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15504     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15506 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15507 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15508 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15509 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15510 AC_CONFIG_HEADERS([config_host/config_clang.h])
15511 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15512 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15513 AC_CONFIG_HEADERS([config_host/config_eot.h])
15514 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15515 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15516 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15517 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15518 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15519 AC_CONFIG_HEADERS([config_host/config_features.h])
15520 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15521 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15522 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15523 AC_CONFIG_HEADERS([config_host/config_folders.h])
15524 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15525 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15526 AC_CONFIG_HEADERS([config_host/config_gio.h])
15527 AC_CONFIG_HEADERS([config_host/config_global.h])
15528 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15529 AC_CONFIG_HEADERS([config_host/config_java.h])
15530 AC_CONFIG_HEADERS([config_host/config_langs.h])
15531 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15532 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15533 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15534 AC_CONFIG_HEADERS([config_host/config_locales.h])
15535 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15536 AC_CONFIG_HEADERS([config_host/config_oox.h])
15537 AC_CONFIG_HEADERS([config_host/config_options.h])
15538 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15539 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15540 AC_CONFIG_HEADERS([config_host/config_skia.h])
15541 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15542 AC_CONFIG_HEADERS([config_host/config_validation.h])
15543 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15544 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15545 AC_CONFIG_HEADERS([config_host/config_version.h])
15546 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15547 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15548 AC_CONFIG_HEADERS([config_host/config_python.h])
15549 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15550 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15551 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15552 AC_OUTPUT
15554 if test "$CROSS_COMPILING" = TRUE; then
15555     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15558 # touch the config timestamp file
15559 if test ! -f config_host.mk.stamp; then
15560     echo > config_host.mk.stamp
15561 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15562     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15563 else
15564     echo > config_host.mk.stamp
15567 # touch the config lang timestamp file
15568 if test ! -f config_host_lang.mk.stamp; then
15569     echo > config_host_lang.mk.stamp
15570 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15571     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15572 else
15573     echo > config_host_lang.mk.stamp
15577 if test \( "$STALE_MAKE" = "TRUE" \) \
15578         -a "$build_os" = "cygwin"; then
15580 cat << _EOS
15581 ****************************************************************************
15582 WARNING:
15583 Your make version is known to be horribly slow, and hard to debug
15584 problems with. To get a reasonably functional make please do:
15586 to install a pre-compiled binary make for Win32
15588  mkdir -p /opt/lo/bin
15589  cd /opt/lo/bin
15590  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15591  cp make-4.2.1-msvc.exe make
15592  chmod +x make
15594 to install from source:
15595 place yourself in a working directory of you choice.
15597  git clone git://git.savannah.gnu.org/make.git
15599  [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"]
15600  set PATH=%PATH%;C:\Cygwin\bin
15601  [or Cygwin64, if that is what you have]
15602  cd path-to-make-repo-you-cloned-above
15603  build_w32.bat --without-guile
15605 should result in a WinRel/gnumake.exe.
15606 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15608 Then re-run autogen.sh
15610 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15611 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15613 _EOS
15617 cat << _EOF
15618 ****************************************************************************
15620 To show information on various make targets and make flags, run:
15621 $GNUMAKE help
15623 To just build, run:
15624 $GNUMAKE
15626 _EOF
15628 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15629     cat << _EOF
15630 After the build has finished successfully, you can immediately run what you built using the command:
15631 _EOF
15633     if test $_os = Darwin; then
15634         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15635     else
15636         echo instdir/program/soffice
15637     fi
15638     cat << _EOF
15640 If you want to run the unit tests, run:
15641 $GNUMAKE check
15643 _EOF
15646 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15647     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15648     cat "$WARNINGS_FILE_FOR_BUILD"
15649     echo
15652 if test -s "$WARNINGS_FILE"; then
15653     echo "HOST config ($WARNINGS_FILE)"
15654     cat "$WARNINGS_FILE"
15657 # Remove unneeded emconfigure artifacts
15658 rm -f a.out a.wasm a.out.js a.out.wasm
15660 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: