odk: classes in java.lang package do not need to be fully qualified
[LibreOffice.git] / configure.ac
blob5954533a7f1bc73617a3e295c56aa7a3a0c33685
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             PathFormat "$with_doxygen"
9492             DOXYGEN="$formatted_path_unix"
9493             AC_MSG_RESULT([$formatted_path])
9494         fi
9495         if test -n "$DOXYGEN"; then
9496             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9497             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9498             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9499                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9500             fi
9501         fi
9502         if test -n "$WSL_ONLY_AS_HELPER"; then
9503             dnl what really should be tested is whether it is doxygen from windows-realm
9504             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9505             dnl using doxygen from wsl container would be possible, but there's a performance
9506             dnl penalty when accessing the files outside the container
9507             AC_MSG_CHECKING([whether doxygen is a windows executable])
9508             if $(file "$DOXYGEN" | grep -q "PE32"); then
9509                 AC_MSG_RESULT([yes])
9510             else
9511                 AC_MSG_RESULT([no])
9512                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9513             fi
9514         fi
9515     fi
9517 AC_SUBST([DOXYGEN])
9519 dnl ==================================================================
9520 dnl libfuzzer
9521 dnl ==================================================================
9522 AC_MSG_CHECKING([whether to enable fuzzers])
9523 if test "$enable_fuzzers" != yes; then
9524     AC_MSG_RESULT([no])
9525 else
9526     if test -z $LIB_FUZZING_ENGINE; then
9527       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9528     fi
9529     AC_MSG_RESULT([yes])
9530     ENABLE_FUZZERS="TRUE"
9531     AC_DEFINE([ENABLE_FUZZERS],1)
9532     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9534 AC_SUBST(LIB_FUZZING_ENGINE)
9536 dnl ===================================================================
9537 dnl Check for system zlib
9538 dnl ===================================================================
9539 if test "$with_system_zlib" = "auto"; then
9540     case "$_os" in
9541     WINNT)
9542         with_system_zlib="$with_system_libs"
9543         ;;
9544     *)
9545         if test "$enable_fuzzers" != "yes"; then
9546             with_system_zlib=yes
9547         else
9548             with_system_zlib=no
9549         fi
9550         ;;
9551     esac
9554 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9555 dnl and has no pkg-config for it at least on some tinderboxes,
9556 dnl so leaving that out for now
9557 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9558 AC_MSG_CHECKING([which zlib to use])
9559 if test "$with_system_zlib" = "yes"; then
9560     AC_MSG_RESULT([external])
9561     SYSTEM_ZLIB=TRUE
9562     AC_CHECK_HEADER(zlib.h, [],
9563         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9564     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9565         [AC_MSG_ERROR(zlib not found or functional)], [])
9566 else
9567     AC_MSG_RESULT([internal])
9568     SYSTEM_ZLIB=
9569     BUILD_TYPE="$BUILD_TYPE ZLIB"
9570     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9571     if test "$COM" = "MSC"; then
9572         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9573     else
9574         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9575     fi
9577 AC_SUBST(ZLIB_CFLAGS)
9578 AC_SUBST(ZLIB_LIBS)
9579 AC_SUBST(SYSTEM_ZLIB)
9581 dnl ===================================================================
9582 dnl Check for system jpeg
9583 dnl ===================================================================
9584 AC_MSG_CHECKING([which libjpeg to use])
9585 if test "$with_system_jpeg" = "yes"; then
9586     AC_MSG_RESULT([external])
9587     SYSTEM_LIBJPEG=TRUE
9588     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9589         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9590     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9591         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9592 else
9593     SYSTEM_LIBJPEG=
9594     AC_MSG_RESULT([internal, libjpeg-turbo])
9595     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9597     case "$host_cpu" in
9598     x86_64 | amd64 | i*86 | x86 | ia32)
9599         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9600         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9601             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9602                 NASM="$LODE_HOME/opt/bin/nasm"
9603             elif test -x "/opt/lo/bin/nasm"; then
9604                 NASM="/opt/lo/bin/nasm"
9605             fi
9606         fi
9608         if test -n "$NASM"; then
9609             AC_MSG_CHECKING([for object file format of host system])
9610             case "$host_os" in
9611               cygwin* | mingw* | pw32* | wsl*)
9612                 case "$host_cpu" in
9613                   x86_64)
9614                     objfmt='Win64-COFF'
9615                     ;;
9616                   *)
9617                     objfmt='Win32-COFF'
9618                     ;;
9619                 esac
9620               ;;
9621               msdosdjgpp* | go32*)
9622                 objfmt='COFF'
9623               ;;
9624               os2-emx*) # not tested
9625                 objfmt='MSOMF' # obj
9626               ;;
9627               linux*coff* | linux*oldld*)
9628                 objfmt='COFF' # ???
9629               ;;
9630               linux*aout*)
9631                 objfmt='a.out'
9632               ;;
9633               linux*)
9634                 case "$host_cpu" in
9635                   x86_64)
9636                     objfmt='ELF64'
9637                     ;;
9638                   *)
9639                     objfmt='ELF'
9640                     ;;
9641                 esac
9642               ;;
9643               kfreebsd* | freebsd* | netbsd* | openbsd*)
9644                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9645                   objfmt='BSD-a.out'
9646                 else
9647                   case "$host_cpu" in
9648                     x86_64 | amd64)
9649                       objfmt='ELF64'
9650                       ;;
9651                     *)
9652                       objfmt='ELF'
9653                       ;;
9654                   esac
9655                 fi
9656               ;;
9657               solaris* | sunos* | sysv* | sco*)
9658                 case "$host_cpu" in
9659                   x86_64)
9660                     objfmt='ELF64'
9661                     ;;
9662                   *)
9663                     objfmt='ELF'
9664                     ;;
9665                 esac
9666               ;;
9667               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9668                 case "$host_cpu" in
9669                   x86_64)
9670                     objfmt='Mach-O64'
9671                     ;;
9672                   *)
9673                     objfmt='Mach-O'
9674                     ;;
9675                 esac
9676               ;;
9677               *)
9678                 objfmt='ELF ?'
9679               ;;
9680             esac
9682             AC_MSG_RESULT([$objfmt])
9683             if test "$objfmt" = 'ELF ?'; then
9684               objfmt='ELF'
9685               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9686             fi
9688             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9689             case "$objfmt" in
9690               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9691               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9692               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9693               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9694               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9695               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9696               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9697               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9698               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9699               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9700               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9701             esac
9702             AC_MSG_RESULT([$NAFLAGS])
9704             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9705             cat > conftest.asm << EOF
9706             [%line __oline__ "configure"
9707                     section .text
9708                     global  _main,main
9709             _main:
9710             main:   xor     eax,eax
9711                     ret
9712             ]
9714             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9715             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9716               AC_MSG_RESULT(yes)
9717             else
9718               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9719               cat conftest.asm >&AS_MESSAGE_LOG_FD
9720               rm -rf conftest*
9721               AC_MSG_RESULT(no)
9722               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9723               NASM=""
9724             fi
9726         fi
9728         if test -z "$NASM"; then
9729 cat << _EOS
9730 ****************************************************************************
9731 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9732 To get one please:
9734 _EOS
9735             if test "$build_os" = "cygwin"; then
9736 cat << _EOS
9737 install a pre-compiled binary for Win32
9739 mkdir -p /opt/lo/bin
9740 cd /opt/lo/bin
9741 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9742 chmod +x nasm
9744 or get and install one from https://www.nasm.us/
9746 Then re-run autogen.sh
9748 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9749 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9751 _EOS
9752             else
9753 cat << _EOS
9754 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9756 _EOS
9757             fi
9758             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9759             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9760         fi
9761       ;;
9762     esac
9765 AC_SUBST(NASM)
9766 AC_SUBST(NAFLAGS)
9767 AC_SUBST(LIBJPEG_CFLAGS)
9768 AC_SUBST(LIBJPEG_LIBS)
9769 AC_SUBST(SYSTEM_LIBJPEG)
9771 dnl ===================================================================
9772 dnl Check for system clucene
9773 dnl ===================================================================
9774 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9775 if test "$SYSTEM_CLUCENE" = TRUE; then
9776     AC_LANG_PUSH([C++])
9777     save_CXXFLAGS=$CXXFLAGS
9778     save_CPPFLAGS=$CPPFLAGS
9779     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9780     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9781     dnl https://sourceforge.net/p/clucene/bugs/200/
9782     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9783     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9784                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9785     CXXFLAGS=$save_CXXFLAGS
9786     CPPFLAGS=$save_CPPFLAGS
9787     AC_LANG_POP([C++])
9788     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9791 dnl ===================================================================
9792 dnl Check for system expat
9793 dnl ===================================================================
9794 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9796 dnl ===================================================================
9797 dnl Check for system xmlsec
9798 dnl ===================================================================
9799 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9801 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9802 if test "$enable_eot" = "yes"; then
9803     ENABLE_EOT="TRUE"
9804     AC_DEFINE([ENABLE_EOT])
9805     AC_MSG_RESULT([yes])
9807     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9808 else
9809     ENABLE_EOT=
9810     AC_MSG_RESULT([no])
9812 AC_SUBST([ENABLE_EOT])
9814 dnl ===================================================================
9815 dnl Check for DLP libs
9816 dnl ===================================================================
9817 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9818 AS_IF([test "$COM" = "MSC"],
9819       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9820       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9822 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9823 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9825 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9827 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9829 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9830 AS_IF([test "$COM" = "MSC"],
9831       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9832       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9834 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9835 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9837 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9839 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9840 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9842 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9844 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9846 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9848 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9849 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9851 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9852 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9854 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9856 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9857 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9859 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9861 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9863 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9865 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9867 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9868 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9870 dnl ===================================================================
9871 dnl Check for system lcms2
9872 dnl ===================================================================
9873 if test "$with_system_lcms2" != "yes"; then
9874     SYSTEM_LCMS2=
9876 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9877 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9878 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9879 if test "$GCC" = "yes"; then
9880     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9882 if test "$COM" = "MSC"; then # override the above
9883     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9886 dnl ===================================================================
9887 dnl Check for system cppunit
9888 dnl ===================================================================
9889 if test "$_os" != "Android" ; then
9890     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9893 dnl ===================================================================
9894 dnl Check whether freetype is available
9896 dnl FreeType has 3 different kinds of versions
9897 dnl * release, like 2.4.10
9898 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9899 dnl * soname
9900 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9902 dnl 9.9.3 is 2.2.0
9903 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9904 dnl ===================================================================
9905 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9906 if test "x$ac_config_site_64bit_host" = xYES; then
9907     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9908 else
9909     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9911 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9913 # ===================================================================
9914 # Check for system libxslt
9915 # to prevent incompatibilities between internal libxml2 and external libxslt,
9916 # or vice versa, use with_system_libxml here
9917 # ===================================================================
9918 if test "$with_system_libxml" = "auto"; then
9919     case "$_os" in
9920     WINNT|iOS|Android)
9921         with_system_libxml="$with_system_libs"
9922         ;;
9923     Emscripten)
9924         with_system_libxml=no
9925         ;;
9926     *)
9927         if test "$enable_fuzzers" != "yes"; then
9928             with_system_libxml=yes
9929         else
9930             with_system_libxml=no
9931         fi
9932         ;;
9933     esac
9936 AC_MSG_CHECKING([which libxslt to use])
9937 if test "$with_system_libxml" = "yes"; then
9938     AC_MSG_RESULT([external])
9939     SYSTEM_LIBXSLT=TRUE
9940     if test "$_os" = "Darwin"; then
9941         dnl make sure to use SDK path
9942         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9943         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9944         dnl omit -L/usr/lib
9945         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9946         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9947     else
9948         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9949         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9950         FilterLibs "${LIBXSLT_LIBS}"
9951         LIBXSLT_LIBS="${filteredlibs}"
9952         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9953         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9954         FilterLibs "${LIBEXSLT_LIBS}"
9955         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9956     fi
9958     dnl Check for xsltproc
9959     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9960     if test "$XSLTPROC" = "no"; then
9961         AC_MSG_ERROR([xsltproc is required])
9962     fi
9963 else
9964     AC_MSG_RESULT([internal])
9965     SYSTEM_LIBXSLT=
9966     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9968 AC_SUBST(SYSTEM_LIBXSLT)
9969 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9970     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9972 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9974 AC_SUBST(LIBEXSLT_CFLAGS)
9975 AC_SUBST(LIBEXSLT_LIBS)
9976 AC_SUBST(LIBXSLT_CFLAGS)
9977 AC_SUBST(LIBXSLT_LIBS)
9978 AC_SUBST(XSLTPROC)
9980 # ===================================================================
9981 # Check for system libxml
9982 # ===================================================================
9983 AC_MSG_CHECKING([which libxml to use])
9984 if test "$with_system_libxml" = "yes"; then
9985     AC_MSG_RESULT([external])
9986     SYSTEM_LIBXML=TRUE
9987     if test "$_os" = "Darwin"; then
9988         dnl make sure to use SDK path
9989         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9990         dnl omit -L/usr/lib
9991         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9992     elif test $_os = iOS; then
9993         dnl make sure to use SDK path
9994         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9995         LIBXML_CFLAGS="-I$usr/include/libxml2"
9996         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9997     else
9998         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9999         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10000         FilterLibs "${LIBXML_LIBS}"
10001         LIBXML_LIBS="${filteredlibs}"
10002     fi
10004     dnl Check for xmllint
10005     AC_PATH_PROG(XMLLINT, xmllint, no)
10006     if test "$XMLLINT" = "no"; then
10007         AC_MSG_ERROR([xmllint is required])
10008     fi
10009 else
10010     AC_MSG_RESULT([internal])
10011     SYSTEM_LIBXML=
10012     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
10013     if test "$COM" = "MSC"; then
10014         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10015     fi
10016     if test "$COM" = "MSC"; then
10017         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
10018     else
10019         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10020         if test "$DISABLE_DYNLOADING" = TRUE; then
10021             LIBXML_LIBS="$LIBXML_LIBS -lm"
10022         fi
10023     fi
10024     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10026 AC_SUBST(SYSTEM_LIBXML)
10027 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10028     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10030 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10031 AC_SUBST(LIBXML_CFLAGS)
10032 AC_SUBST(LIBXML_LIBS)
10033 AC_SUBST(XMLLINT)
10035 # =====================================================================
10036 # Checking for a Python interpreter with version >= 3.3.
10037 # Optionally user can pass an option to configure, i. e.
10038 # ./configure PYTHON=/usr/bin/python
10039 # =====================================================================
10040 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10041     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10042     # unless PYTHON is defined as above which allows 'system'
10043     enable_python=internal
10045 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10046     if test -n "$PYTHON"; then
10047         PYTHON_FOR_BUILD=$PYTHON
10048     else
10049         # This allows a lack of system python with no error, we use internal one in that case.
10050         AM_PATH_PYTHON([3.3],, [:])
10051         # Clean PYTHON_VERSION checked below if cross-compiling
10052         PYTHON_VERSION=""
10053         if test "$PYTHON" != ":"; then
10054             PYTHON_FOR_BUILD=$PYTHON
10055         fi
10056     fi
10059 # Checks for Python to use for Pyuno
10060 AC_MSG_CHECKING([which Python to use for Pyuno])
10061 case "$enable_python" in
10062 no|disable)
10063     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10064         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10065         # requirement from the choice whether to include Python stuff in the installer, but why
10066         # bother?
10067         AC_MSG_ERROR([Python is required at build time.])
10068     fi
10069     enable_python=no
10070     AC_MSG_RESULT([none])
10071     ;;
10072 ""|yes|auto)
10073     if test "$DISABLE_SCRIPTING" = TRUE; then
10074         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10075             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10076         fi
10077         AC_MSG_RESULT([none, overridden by --disable-scripting])
10078         enable_python=no
10079     elif test $build_os = cygwin -o $build_os = wsl; then
10080         dnl When building on Windows we don't attempt to use any installed
10081         dnl "system"  Python.
10082         AC_MSG_RESULT([fully internal])
10083         enable_python=internal
10084     elif test "$cross_compiling" = yes; then
10085         AC_MSG_RESULT([system])
10086         enable_python=system
10087     else
10088         # Unset variables set by the above AM_PATH_PYTHON so that
10089         # we actually do check anew.
10090         AC_MSG_RESULT([])
10091         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
10092         AM_PATH_PYTHON([3.3],, [:])
10093         AC_MSG_CHECKING([which Python to use for Pyuno])
10094         if test "$PYTHON" = ":"; then
10095             if test -z "$PYTHON_FOR_BUILD"; then
10096                 AC_MSG_RESULT([fully internal])
10097             else
10098                 AC_MSG_RESULT([internal])
10099             fi
10100             enable_python=internal
10101         else
10102             AC_MSG_RESULT([system])
10103             enable_python=system
10104         fi
10105     fi
10106     ;;
10107 internal)
10108     AC_MSG_RESULT([internal])
10109     ;;
10110 fully-internal)
10111     AC_MSG_RESULT([fully internal])
10112     enable_python=internal
10113     ;;
10114 system)
10115     AC_MSG_RESULT([system])
10116     if test "$_os" = Darwin -a -z "$PYTHON"; then
10117         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10118     fi
10119     ;;
10121     AC_MSG_ERROR([Incorrect --enable-python option])
10122     ;;
10123 esac
10125 if test $enable_python != no; then
10126     BUILD_TYPE="$BUILD_TYPE PYUNO"
10129 if test $enable_python = system; then
10130     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10131         # Fallback: Accept these in the environment, or as set above
10132         # for MacOSX.
10133         :
10134     elif test "$cross_compiling" != yes; then
10135         # Unset variables set by the above AM_PATH_PYTHON so that
10136         # we actually do check anew.
10137         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
10138         # This causes an error if no python command is found
10139         AM_PATH_PYTHON([3.3])
10140         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10141         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10142         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10143         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10144         if test -z "$PKG_CONFIG"; then
10145             PYTHON_CFLAGS="-I$python_include"
10146             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10147         elif $PKG_CONFIG --exists python-$python_version-embed; then
10148             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10149             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10150         elif $PKG_CONFIG --exists python-$python_version; then
10151             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10152             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10153         else
10154             PYTHON_CFLAGS="-I$python_include"
10155             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10156         fi
10157         FilterLibs "${PYTHON_LIBS}"
10158         PYTHON_LIBS="${filteredlibs}"
10159     else
10160         dnl How to find out the cross-compilation Python installation path?
10161         AC_MSG_CHECKING([for python version])
10162         AS_IF([test -n "$PYTHON_VERSION"],
10163               [AC_MSG_RESULT([$PYTHON_VERSION])],
10164               [AC_MSG_RESULT([not found])
10165                AC_MSG_ERROR([no usable python found])])
10166         test -n "$PYTHON_CFLAGS" && break
10167     fi
10169     dnl Check if the headers really work
10170     save_CPPFLAGS="$CPPFLAGS"
10171     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10172     AC_CHECK_HEADER(Python.h)
10173     CPPFLAGS="$save_CPPFLAGS"
10175     # let the PYTHON_FOR_BUILD match the same python installation that
10176     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10177     # better for PythonTests.
10178     PYTHON_FOR_BUILD=$PYTHON
10181 if test "$with_lxml" != no; then
10182     if test -z "$PYTHON_FOR_BUILD"; then
10183         case $build_os in
10184             cygwin)
10185                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10186                 ;;
10187             *)
10188                 if test "$cross_compiling" != yes ; then
10189                     BUILD_TYPE="$BUILD_TYPE LXML"
10190                 fi
10191                 ;;
10192         esac
10193     else
10194         AC_MSG_CHECKING([for python lxml])
10195         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10196             AC_MSG_RESULT([yes])
10197         else
10198             case $build_os in
10199                 cygwin)
10200                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10201                     ;;
10202                 *)
10203                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10204                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10205                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10206                         else
10207                             BUILD_TYPE="$BUILD_TYPE LXML"
10208                             AC_MSG_RESULT([no, using internal lxml])
10209                         fi
10210                     else
10211                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10212                     fi
10213                     ;;
10214             esac
10215         fi
10216     fi
10219 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10220     SYSTEM_PYTHON=
10221     PYTHON_VERSION_MAJOR=3
10222     PYTHON_VERSION_MINOR=8
10223     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.19
10224     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10225         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10226     fi
10227     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10229     # Embedded Python dies without Home set
10230     if test "$HOME" = ""; then
10231         export HOME=""
10232     fi
10235 dnl By now enable_python should be "system", "internal" or "no"
10236 case $enable_python in
10237 system)
10238     SYSTEM_PYTHON=TRUE
10240     if test "x$ac_cv_header_Python_h" != "xyes"; then
10241        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10242     fi
10244     AC_LANG_PUSH(C)
10245     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10246     AC_MSG_CHECKING([for correct python library version])
10247        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10248 #include <Python.h>
10250 int main(int argc, char **argv) {
10251    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10252    else return 1;
10254        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10255     AC_LANG_POP(C)
10257     dnl FIXME Check if the Python library can be linked with, too?
10258     ;;
10260 internal)
10261     BUILD_TYPE="$BUILD_TYPE PYTHON"
10262     if test "$OS" = LINUX -o "$OS" = WNT ; then
10263         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10264     fi
10265     ;;
10267     DISABLE_PYTHON=TRUE
10268     SYSTEM_PYTHON=
10269     ;;
10271     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10272     ;;
10273 esac
10275 AC_SUBST(DISABLE_PYTHON)
10276 AC_SUBST(SYSTEM_PYTHON)
10277 AC_SUBST(PYTHON_CFLAGS)
10278 AC_SUBST(PYTHON_FOR_BUILD)
10279 AC_SUBST(PYTHON_LIBS)
10280 AC_SUBST(PYTHON_VERSION)
10281 AC_SUBST(PYTHON_VERSION_MAJOR)
10282 AC_SUBST(PYTHON_VERSION_MINOR)
10284 AC_MSG_CHECKING([whether to build LibreLogo])
10285 case "$enable_python" in
10286 no|disable)
10287     AC_MSG_RESULT([no; Python disabled])
10288     ;;
10290     if test "${enable_librelogo}" = "no"; then
10291         AC_MSG_RESULT([no])
10292     else
10293         AC_MSG_RESULT([yes])
10294         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10295         AC_DEFINE([ENABLE_LIBRELOGO],1)
10296     fi
10297     ;;
10298 esac
10299 AC_SUBST(ENABLE_LIBRELOGO)
10301 ENABLE_MARIADBC=
10302 MARIADBC_MAJOR=1
10303 MARIADBC_MINOR=0
10304 MARIADBC_MICRO=2
10305 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10306 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10307     ENABLE_MARIADBC=TRUE
10308     AC_MSG_RESULT([yes])
10309     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10310 else
10311     AC_MSG_RESULT([no])
10313 AC_SUBST(ENABLE_MARIADBC)
10314 AC_SUBST(MARIADBC_MAJOR)
10315 AC_SUBST(MARIADBC_MINOR)
10316 AC_SUBST(MARIADBC_MICRO)
10318 if test "$ENABLE_MARIADBC" = "TRUE"; then
10319     dnl ===================================================================
10320     dnl Check for system MariaDB
10321     dnl ===================================================================
10323     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10324         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10325     fi
10327     AC_MSG_CHECKING([which MariaDB to use])
10328     if test "$with_system_mariadb" = "yes"; then
10329         AC_MSG_RESULT([external])
10330         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10331         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10332         if test -z "$MARIADBCONFIG"; then
10333             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10334             if test -z "$MARIADBCONFIG"; then
10335                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10336                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10337             fi
10338         fi
10339         AC_MSG_CHECKING([MariaDB version])
10340         MARIADB_VERSION=`$MARIADBCONFIG --version`
10341         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10342         if test "$MARIADB_MAJOR" -ge "5"; then
10343             AC_MSG_RESULT([OK])
10344         else
10345             AC_MSG_ERROR([too old, use 5.0.x or later])
10346         fi
10347         AC_MSG_CHECKING([for MariaDB Client library])
10348         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10349         if test "$COM_IS_CLANG" = TRUE; then
10350             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10351         fi
10352         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10353         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10354         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10355         dnl linux32:
10356         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10357             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10358             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10359                 | sed -e 's|/lib64/|/lib/|')
10360         fi
10361         FilterLibs "${MARIADB_LIBS}"
10362         MARIADB_LIBS="${filteredlibs}"
10363         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10364         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10365         if test "$enable_bundle_mariadb" = "yes"; then
10366             AC_MSG_RESULT([yes])
10367             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10368             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10370 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10372 /g' | grep -E '(mysqlclient|mariadb)')
10373             if test "$_os" = "Darwin"; then
10374                 LIBMARIADB=${LIBMARIADB}.dylib
10375                 if test "$with_gssapi" != "no"; then
10376                     WITH_GSSAPI=TRUE
10377                     save_LIBS=$LIBS
10378                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10379                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10380                     GSSAPI_LIBS=$LIBS
10381                     LIBS=$save_LIBS
10382                 fi
10383             elif test "$_os" = "WINNT"; then
10384                 LIBMARIADB=${LIBMARIADB}.dll
10385             else
10386                 LIBMARIADB=${LIBMARIADB}.so
10387                 if test "$with_gssapi" != "no"; then
10388                     WITH_GSSAPI=TRUE
10389                     save_LIBS=$LIBS
10390                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10391                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10392                     GSSAPI_LIBS=$LIBS
10393                     LIBS=$save_LIBS
10394                 fi
10395             fi
10396             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10397             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10398             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10399                 AC_MSG_RESULT([found.])
10400                 PathFormat "$LIBMARIADB_PATH"
10401                 LIBMARIADB_PATH="$formatted_path"
10402             else
10403                 AC_MSG_ERROR([not found.])
10404             fi
10405         else
10406             AC_MSG_RESULT([no])
10407             BUNDLE_MARIADB_CONNECTOR_C=
10408         fi
10409     else
10410         AC_MSG_RESULT([internal])
10411         SYSTEM_MARIADB_CONNECTOR_C=
10412         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10413         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10414         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10415     fi
10417     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10418     AC_SUBST(MARIADB_CFLAGS)
10419     AC_SUBST(MARIADB_LIBS)
10420     AC_SUBST(LIBMARIADB)
10421     AC_SUBST(LIBMARIADB_PATH)
10422     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10425 dnl ===================================================================
10426 dnl Check for system hsqldb
10427 dnl ===================================================================
10428 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10429     AC_MSG_CHECKING([which hsqldb to use])
10430     if test "$with_system_hsqldb" = "yes"; then
10431         AC_MSG_RESULT([external])
10432         SYSTEM_HSQLDB=TRUE
10433         if test -z $HSQLDB_JAR; then
10434             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10435         fi
10436         if ! test -f $HSQLDB_JAR; then
10437                AC_MSG_ERROR(hsqldb.jar not found.)
10438         fi
10439         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10440         export HSQLDB_JAR
10441         if $PERL -e \
10442            'use Archive::Zip;
10443             my $file = "$ENV{'HSQLDB_JAR'}";
10444             my $zip = Archive::Zip->new( $file );
10445             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10446             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10447             {
10448                 push @l, split(/\n/, $mf);
10449                 foreach my $line (@l)
10450                 {
10451                     if ($line =~ m/Specification-Version:/)
10452                     {
10453                         ($t, $version) = split (/:/,$line);
10454                         $version =~ s/^\s//;
10455                         ($a, $b, $c, $d) = split (/\./,$version);
10456                         if ($c == "0" && $d > "8")
10457                         {
10458                             exit 0;
10459                         }
10460                         else
10461                         {
10462                             exit 1;
10463                         }
10464                     }
10465                 }
10466             }
10467             else
10468             {
10469                 exit 1;
10470             }'; then
10471             AC_MSG_RESULT([yes])
10472         else
10473             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10474         fi
10475     else
10476         AC_MSG_RESULT([internal])
10477         SYSTEM_HSQLDB=
10478         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10479         NEED_ANT=TRUE
10480     fi
10481 else
10482     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10483         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10484     fi
10486 AC_SUBST(SYSTEM_HSQLDB)
10487 AC_SUBST(HSQLDB_JAR)
10489 dnl ===================================================================
10490 dnl Check for PostgreSQL stuff
10491 dnl ===================================================================
10492 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10493 if test "x$enable_postgresql_sdbc" != "xno"; then
10494     AC_MSG_RESULT([yes])
10495     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10497     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10498         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10499     fi
10500     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10501         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10502     fi
10504     postgres_interface=""
10505     if test "$with_system_postgresql" = "yes"; then
10506         postgres_interface="external PostgreSQL"
10507         SYSTEM_POSTGRESQL=TRUE
10508         if test "$_os" = Darwin; then
10509             supp_path=''
10510             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10511                 pg_supp_path="$P_SEP$d$pg_supp_path"
10512             done
10513         fi
10514         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10515         if test -n "$PGCONFIG"; then
10516             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10517             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10518         else
10519             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10520               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10521               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10522             ],[
10523               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10524             ])
10525         fi
10526         FilterLibs "${POSTGRESQL_LIB}"
10527         POSTGRESQL_LIB="${filteredlibs}"
10528     else
10529         # if/when anything else than PostgreSQL uses Kerberos,
10530         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10531         WITH_KRB5=
10532         WITH_GSSAPI=
10533         case "$_os" in
10534         Darwin)
10535             # macOS has system MIT Kerberos 5 since 10.4
10536             if test "$with_krb5" != "no"; then
10537                 WITH_KRB5=TRUE
10538                 save_LIBS=$LIBS
10539                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10540                 # that the libraries where these functions are located on macOS will change, is it?
10541                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10542                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10543                 KRB5_LIBS=$LIBS
10544                 LIBS=$save_LIBS
10545                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10546                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10547                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10548                 LIBS=$save_LIBS
10549             fi
10550             if test "$with_gssapi" != "no"; then
10551                 WITH_GSSAPI=TRUE
10552                 save_LIBS=$LIBS
10553                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10554                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10555                 GSSAPI_LIBS=$LIBS
10556                 LIBS=$save_LIBS
10557             fi
10558             ;;
10559         WINNT)
10560             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10561                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10562             fi
10563             ;;
10564         Linux|GNU|*BSD|DragonFly)
10565             if test "$with_krb5" != "no"; then
10566                 WITH_KRB5=TRUE
10567                 save_LIBS=$LIBS
10568                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10569                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10570                 KRB5_LIBS=$LIBS
10571                 LIBS=$save_LIBS
10572                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10573                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10574                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10575                 LIBS=$save_LIBS
10576             fi
10577             if test "$with_gssapi" != "no"; then
10578                 WITH_GSSAPI=TRUE
10579                 save_LIBS=$LIBS
10580                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10581                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10582                 GSSAPI_LIBS=$LIBS
10583                 LIBS=$save_LIBS
10584             fi
10585             ;;
10586         *)
10587             if test "$with_krb5" = "yes"; then
10588                 WITH_KRB5=TRUE
10589                 save_LIBS=$LIBS
10590                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10591                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10592                 KRB5_LIBS=$LIBS
10593                 LIBS=$save_LIBS
10594                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10595                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10596                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10597                 LIBS=$save_LIBS
10598             fi
10599             if test "$with_gssapi" = "yes"; then
10600                 WITH_GSSAPI=TRUE
10601                 save_LIBS=$LIBS
10602                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10603                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10604                 LIBS=$save_LIBS
10605                 GSSAPI_LIBS=$LIBS
10606             fi
10607         esac
10609         if test -n "$with_libpq_path"; then
10610             SYSTEM_POSTGRESQL=TRUE
10611             postgres_interface="external libpq"
10612             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10613             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10614         else
10615             SYSTEM_POSTGRESQL=
10616             postgres_interface="internal"
10617             POSTGRESQL_LIB=""
10618             POSTGRESQL_INC="%OVERRIDE_ME%"
10619             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10620         fi
10621     fi
10623     AC_MSG_CHECKING([PostgreSQL C interface])
10624     AC_MSG_RESULT([$postgres_interface])
10626     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10627         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10628         save_CFLAGS=$CFLAGS
10629         save_CPPFLAGS=$CPPFLAGS
10630         save_LIBS=$LIBS
10631         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10632         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10633         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10634         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10635             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10636         CFLAGS=$save_CFLAGS
10637         CPPFLAGS=$save_CPPFLAGS
10638         LIBS=$save_LIBS
10639     fi
10640     BUILD_POSTGRESQL_SDBC=TRUE
10641 else
10642     AC_MSG_RESULT([no])
10644 AC_SUBST(WITH_KRB5)
10645 AC_SUBST(WITH_GSSAPI)
10646 AC_SUBST(GSSAPI_LIBS)
10647 AC_SUBST(KRB5_LIBS)
10648 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10649 AC_SUBST(SYSTEM_POSTGRESQL)
10650 AC_SUBST(POSTGRESQL_INC)
10651 AC_SUBST(POSTGRESQL_LIB)
10653 dnl ===================================================================
10654 dnl Check for Firebird stuff
10655 dnl ===================================================================
10656 ENABLE_FIREBIRD_SDBC=
10657 if test "$enable_firebird_sdbc" = "yes" ; then
10658     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10660     dnl ===================================================================
10661     dnl Check for system Firebird
10662     dnl ===================================================================
10663     AC_MSG_CHECKING([which Firebird to use])
10664     if test "$with_system_firebird" = "yes"; then
10665         AC_MSG_RESULT([external])
10666         SYSTEM_FIREBIRD=TRUE
10667         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10668         if test -z "$FIREBIRDCONFIG"; then
10669             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10670             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10671                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10672             ])
10673             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10674         else
10675             AC_MSG_NOTICE([fb_config found])
10676             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10677             AC_MSG_CHECKING([for Firebird Client library])
10678             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10679             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10680             FilterLibs "${FIREBIRD_LIBS}"
10681             FIREBIRD_LIBS="${filteredlibs}"
10682         fi
10683         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10684         AC_MSG_CHECKING([Firebird version])
10685         if test -n "${FIREBIRD_VERSION}"; then
10686             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10687             if test "$FIREBIRD_MAJOR" -ge "3"; then
10688                 AC_MSG_RESULT([OK])
10689             else
10690                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10691             fi
10692         else
10693             save_CFLAGS="${CFLAGS}"
10694             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10695             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10696 #if defined(FB_API_VER) && FB_API_VER == 30
10697 int fb_api_is_30(void) { return 0; }
10698 #else
10699 #error "Wrong Firebird API version"
10700 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10701             CFLAGS="$save_CFLAGS"
10702         fi
10703         ENABLE_FIREBIRD_SDBC=TRUE
10704         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10705     elif test "$enable_database_connectivity" = no; then
10706         AC_MSG_RESULT([none])
10707     elif test "$cross_compiling" = "yes"; then
10708         AC_MSG_RESULT([none])
10709     else
10710         dnl Embedded Firebird has version 3.0
10711         dnl We need libatomic_ops for any non X86/X64 system
10712         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10713             dnl ===================================================================
10714             dnl Check for system libatomic_ops
10715             dnl ===================================================================
10716             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10717             if test "$with_system_libatomic_ops" = "yes"; then
10718                 SYSTEM_LIBATOMIC_OPS=TRUE
10719                 AC_CHECK_HEADERS(atomic_ops.h, [],
10720                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10721             else
10722                 SYSTEM_LIBATOMIC_OPS=
10723                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10724                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10725                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10726             fi
10727         fi
10729         AC_MSG_RESULT([internal])
10730         SYSTEM_FIREBIRD=
10731         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10732         FIREBIRD_LIBS="-lfbclient"
10734         if test "$with_system_libtommath" = "yes"; then
10735             SYSTEM_LIBTOMMATH=TRUE
10736             dnl check for tommath presence
10737             save_LIBS=$LIBS
10738             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10739             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10740             LIBS=$save_LIBS
10741         else
10742             SYSTEM_LIBTOMMATH=
10743             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10744             LIBTOMMATH_LIBS="-ltommath"
10745             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10746         fi
10748         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10749         ENABLE_FIREBIRD_SDBC=TRUE
10750         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10751     fi
10753 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10754 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10755 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10756 AC_SUBST(LIBATOMIC_OPS_LIBS)
10757 AC_SUBST(SYSTEM_FIREBIRD)
10758 AC_SUBST(FIREBIRD_CFLAGS)
10759 AC_SUBST(FIREBIRD_LIBS)
10760 AC_SUBST(SYSTEM_LIBTOMMATH)
10761 AC_SUBST(LIBTOMMATH_CFLAGS)
10762 AC_SUBST(LIBTOMMATH_LIBS)
10764 dnl ===================================================================
10765 dnl Check for system curl
10766 dnl ===================================================================
10767 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10769 dnl ===================================================================
10770 dnl Check for system boost
10771 dnl ===================================================================
10772 AC_MSG_CHECKING([which boost to use])
10773 if test "$with_system_boost" = "yes"; then
10774     AC_MSG_RESULT([external])
10775     SYSTEM_BOOST=TRUE
10776     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10777     AX_BOOST_DATE_TIME
10778     AX_BOOST_FILESYSTEM
10779     AX_BOOST_IOSTREAMS
10780     AX_BOOST_LOCALE
10781     AC_LANG_PUSH([C++])
10782     save_CXXFLAGS=$CXXFLAGS
10783     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10784     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10785        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10786     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10787        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10788     CXXFLAGS=$save_CXXFLAGS
10789     AC_LANG_POP([C++])
10790     # this is in m4/ax_boost_base.m4
10791     FilterLibs "${BOOST_LDFLAGS}"
10792     BOOST_LDFLAGS="${filteredlibs}"
10793 else
10794     AC_MSG_RESULT([internal])
10795     BUILD_TYPE="$BUILD_TYPE BOOST"
10796     SYSTEM_BOOST=
10797     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10798         # use warning-suppressing wrapper headers
10799         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10800     else
10801         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10802     fi
10804 AC_SUBST(SYSTEM_BOOST)
10806 dnl ===================================================================
10807 dnl Check for system mdds
10808 dnl ===================================================================
10809 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10810 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10812 dnl ===================================================================
10813 dnl Check for system dragonbox
10814 dnl ===================================================================
10815 AC_MSG_CHECKING([which dragonbox to use])
10816 if test "$with_system_dragonbox" = "yes"; then
10817     AC_MSG_RESULT([external])
10818     SYSTEM_DRAGONBOX=TRUE
10819     AC_LANG_PUSH([C++])
10820     save_CPPFLAGS=$CPPFLAGS
10821     # This is where upstream installs to, unfortunately no .pc or so...
10822     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10823     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10824     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10825        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10826     AC_LANG_POP([C++])
10827     CPPFLAGS=$save_CPPFLAGS
10828 else
10829     AC_MSG_RESULT([internal])
10830     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10831     SYSTEM_DRAGONBOX=
10833 AC_SUBST([SYSTEM_DRAGONBOX])
10834 AC_SUBST([DRAGONBOX_CFLAGS])
10836 dnl ===================================================================
10837 dnl Check for system frozen
10838 dnl ===================================================================
10839 AC_MSG_CHECKING([which frozen to use])
10840 if test "$with_system_frozen" = "yes"; then
10841     AC_MSG_RESULT([external])
10842     SYSTEM_FROZEN=TRUE
10843     AC_LANG_PUSH([C++])
10844     save_CPPFLAGS=$CPPFLAGS
10845     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10846        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10847     AC_LANG_POP([C++])
10848     CPPFLAGS=$save_CPPFLAGS
10849 else
10850     AC_MSG_RESULT([internal])
10851     BUILD_TYPE="$BUILD_TYPE FROZEN"
10852     SYSTEM_FROZEN=
10854 AC_SUBST([SYSTEM_FROZEN])
10855 AC_SUBST([FROZEN_CFLAGS])
10857 dnl ===================================================================
10858 dnl Check for system libfixmath
10859 dnl ===================================================================
10860 AC_MSG_CHECKING([which libfixmath to use])
10861 if test "$with_system_libfixmath" = "yes"; then
10862     AC_MSG_RESULT([external])
10863     SYSTEM_LIBFIXMATH=TRUE
10864     AC_LANG_PUSH([C++])
10865     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10866        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10867     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10868                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10869                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10870     AC_LANG_POP([C++])
10871 else
10872     AC_MSG_RESULT([internal])
10873     SYSTEM_LIBFIXMATH=
10874     LIBFIXMATH_LIBS=
10876 AC_SUBST([SYSTEM_LIBFIXMATH])
10877 AC_SUBST([LIBFIXMATH_LIBS])
10879 dnl ===================================================================
10880 dnl Check for system glm
10881 dnl ===================================================================
10882 AC_MSG_CHECKING([which glm to use])
10883 if test "$with_system_glm" = "yes"; then
10884     AC_MSG_RESULT([external])
10885     SYSTEM_GLM=TRUE
10886     AC_LANG_PUSH([C++])
10887     AC_CHECK_HEADER([glm/glm.hpp], [],
10888        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10889     AC_LANG_POP([C++])
10890 else
10891     AC_MSG_RESULT([internal])
10892     BUILD_TYPE="$BUILD_TYPE GLM"
10893     SYSTEM_GLM=
10894     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10896 AC_SUBST([GLM_CFLAGS])
10897 AC_SUBST([SYSTEM_GLM])
10899 dnl ===================================================================
10900 dnl Check for system odbc
10901 dnl ===================================================================
10902 AC_MSG_CHECKING([which odbc headers to use])
10903 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
10904     AC_MSG_RESULT([external])
10905     SYSTEM_ODBC_HEADERS=TRUE
10907     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10908         save_CPPFLAGS=$CPPFLAGS
10909         find_winsdk
10910         PathFormat "$winsdktest"
10911         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"
10912         AC_CHECK_HEADER(sqlext.h, [],
10913             [AC_MSG_ERROR(odbc not found. install odbc)],
10914             [#include <windows.h>])
10915         CPPFLAGS=$save_CPPFLAGS
10916     else
10917         AC_CHECK_HEADER(sqlext.h, [],
10918             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10919     fi
10920 elif test "$enable_database_connectivity" = no; then
10921     AC_MSG_RESULT([none])
10922 else
10923     AC_MSG_RESULT([internal])
10924     SYSTEM_ODBC_HEADERS=
10926 AC_SUBST(SYSTEM_ODBC_HEADERS)
10928 dnl ===================================================================
10929 dnl Check for system NSS
10930 dnl ===================================================================
10931 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10932     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10933     AC_DEFINE(HAVE_FEATURE_NSS)
10934     ENABLE_NSS=TRUE
10935 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10936     with_tls=openssl
10938 AC_SUBST(ENABLE_NSS)
10940 dnl ===================================================================
10941 dnl Enable LDAP support
10942 dnl ===================================================================
10944 if test "$test_openldap" = yes; then
10945     AC_MSG_CHECKING([whether to enable LDAP support])
10946     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10947         AC_MSG_RESULT([yes])
10948         ENABLE_LDAP=TRUE
10949     else
10950         if test "$enable_ldap" != "yes"; then
10951             AC_MSG_RESULT([no])
10952         else
10953             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10954         fi
10955     fi
10957 dnl ===================================================================
10958 dnl Check for system openldap
10959 dnl ===================================================================
10961     if test "$ENABLE_LDAP" = TRUE; then
10962         AC_MSG_CHECKING([which openldap library to use])
10963         if test "$with_system_openldap" = yes; then
10964             AC_MSG_RESULT([external])
10965             SYSTEM_OPENLDAP=TRUE
10966             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10967             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10968             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10969         else
10970             AC_MSG_RESULT([internal])
10971             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10972         fi
10973     fi
10976 AC_SUBST(ENABLE_LDAP)
10977 AC_SUBST(SYSTEM_OPENLDAP)
10979 dnl ===================================================================
10980 dnl Check for TLS/SSL and cryptographic implementation to use
10981 dnl ===================================================================
10982 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10983 if test -n "$with_tls"; then
10984     case $with_tls in
10985     openssl)
10986         AC_DEFINE(USE_TLS_OPENSSL)
10987         TLS=OPENSSL
10988         AC_MSG_RESULT([$TLS])
10990         if test "$enable_openssl" != "yes"; then
10991             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10992         fi
10994         # warn that OpenSSL has been selected but not all TLS code has this option
10995         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10996         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10997         ;;
10998     nss)
10999         AC_DEFINE(USE_TLS_NSS)
11000         TLS=NSS
11001         AC_MSG_RESULT([$TLS])
11002         ;;
11003     no)
11004         AC_MSG_RESULT([none])
11005         AC_MSG_WARN([Skipping TLS/SSL])
11006         ;;
11007     *)
11008         AC_MSG_RESULT([])
11009         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
11010 openssl - OpenSSL
11011 nss - Mozilla's Network Security Services (NSS)
11012     ])
11013         ;;
11014     esac
11015 else
11016     # default to using NSS, it results in smaller oox lib
11017     AC_DEFINE(USE_TLS_NSS)
11018     TLS=NSS
11019     AC_MSG_RESULT([$TLS])
11021 AC_SUBST(TLS)
11023 dnl ===================================================================
11024 dnl Check for system sane
11025 dnl ===================================================================
11026 AC_MSG_CHECKING([which sane header to use])
11027 if test "$with_system_sane" = "yes"; then
11028     AC_MSG_RESULT([external])
11029     AC_CHECK_HEADER(sane/sane.h, [],
11030       [AC_MSG_ERROR(sane not found. install sane)], [])
11031 else
11032     AC_MSG_RESULT([internal])
11033     BUILD_TYPE="$BUILD_TYPE SANE"
11036 dnl ===================================================================
11037 dnl Check for system icu
11038 dnl ===================================================================
11039 ICU_MAJOR=73
11040 ICU_MINOR=2
11041 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11042 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
11043 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11044 if test "$SYSTEM_ICU" = TRUE; then
11045     AC_LANG_PUSH([C++])
11046     AC_MSG_CHECKING([for unicode/rbbi.h])
11047     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11048     AC_LANG_POP([C++])
11050     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11051     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11052     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11054     if test "$CROSS_COMPILING" != TRUE; then
11055         # using the system icu tools can lead to version confusion, use the
11056         # ones from the build environment when cross-compiling
11057         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11058         if test -z "$SYSTEM_GENBRK"; then
11059             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11060         fi
11061         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11062         if test -z "$SYSTEM_GENCCODE"; then
11063             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11064         fi
11065         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11066         if test -z "$SYSTEM_GENCMN"; then
11067             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11068         fi
11069     fi
11072 AC_SUBST(SYSTEM_GENBRK)
11073 AC_SUBST(SYSTEM_GENCCODE)
11074 AC_SUBST(SYSTEM_GENCMN)
11075 AC_SUBST(ICU_MAJOR)
11076 AC_SUBST(ICU_MINOR)
11078 dnl ==================================================================
11079 dnl CURL
11080 dnl ==================================================================
11081 if test "$enable_curl" == "yes"; then
11082     AC_DEFINE([HAVE_FEATURE_CURL])
11085 dnl ==================================================================
11086 dnl Breakpad
11087 dnl ==================================================================
11088 DEFAULT_CRASHDUMP_VALUE="true"
11089 AC_MSG_CHECKING([whether to enable breakpad])
11090 if test "$enable_breakpad" != yes; then
11091     AC_MSG_RESULT([no])
11092 else
11093     if test "$enable_curl" != "yes"; then
11094         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11095     fi
11096     AC_MSG_RESULT([yes])
11097     ENABLE_BREAKPAD="TRUE"
11098     AC_DEFINE(ENABLE_BREAKPAD)
11099     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11100     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11102     AC_MSG_CHECKING([for disable crash dump])
11103     if test "$enable_crashdump" = no; then
11104         DEFAULT_CRASHDUMP_VALUE="false"
11105         AC_MSG_RESULT([yes])
11106     else
11107        AC_MSG_RESULT([no])
11108     fi
11110     AC_MSG_CHECKING([for crashreport config])
11111     if test "$with_symbol_config" = "no"; then
11112         BREAKPAD_SYMBOL_CONFIG="invalid"
11113         AC_MSG_RESULT([no])
11114     else
11115         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11116         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11117         AC_MSG_RESULT([yes])
11118     fi
11119     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11121 AC_SUBST(ENABLE_BREAKPAD)
11122 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11124 dnl ==================================================================
11125 dnl libcmis
11126 dnl ==================================================================
11127 if test "$enable_libcmis" == "yes"; then
11128     if test "$enable_curl" != "yes"; then
11129         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11130     fi
11133 dnl ===================================================================
11134 dnl Orcus
11135 dnl ===================================================================
11136 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11137 if test "$with_system_orcus" != "yes"; then
11138     if test "$SYSTEM_BOOST" = "TRUE"; then
11139         dnl Link with Boost.System
11140         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11141         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11142         dnl in documentation has no effect.
11143         AX_BOOST_SYSTEM
11144     fi
11146 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11147 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11148 AC_SUBST([BOOST_SYSTEM_LIB])
11149 AC_SUBST(SYSTEM_LIBORCUS)
11151 dnl ===================================================================
11152 dnl HarfBuzz
11153 dnl ===================================================================
11154 harfbuzz_required_version=5.1.0
11156 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11157 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11158 case "$_os" in
11159     Linux)
11160         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
11161         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11162         ;;
11163     *)
11164         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
11165         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11166         ;;
11167 esac
11168 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11169 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11171 if test "$COM" = "MSC"; then # override the above
11172     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
11173     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11176 if test "$with_system_harfbuzz" = "yes"; then
11177     if test "$with_system_graphite" = "no"; then
11178         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11179     fi
11180     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11181     save_LIBS="$LIBS"
11182     save_CFLAGS="$CFLAGS"
11183     LIBS="$LIBS $HARFBUZZ_LIBS"
11184     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11185     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11186     LIBS="$save_LIBS"
11187     CFLAGS="$save_CFLAGS"
11188 else
11189     if test "$with_system_graphite" = "yes"; then
11190         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11191     fi
11194 if test "$USING_X11" = TRUE; then
11195     AC_PATH_X
11196     AC_PATH_XTRA
11197     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11199     if test -z "$x_includes"; then
11200         x_includes="default_x_includes"
11201     fi
11202     if test -z "$x_libraries"; then
11203         x_libraries="default_x_libraries"
11204     fi
11205     CFLAGS="$CFLAGS $X_CFLAGS"
11206     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11207     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11208 else
11209     x_includes="no_x_includes"
11210     x_libraries="no_x_libraries"
11213 if test "$USING_X11" = TRUE; then
11214     dnl ===================================================================
11215     dnl Check for extension headers
11216     dnl ===================================================================
11217     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11218      [#include <X11/extensions/shape.h>])
11220     # vcl needs ICE and SM
11221     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11222     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11223         [AC_MSG_ERROR(ICE library not found)])
11224     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11225     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11226         [AC_MSG_ERROR(SM library not found)])
11229 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11230     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11231     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11234 dnl ===================================================================
11235 dnl Check for system Xrender
11236 dnl ===================================================================
11237 AC_MSG_CHECKING([whether to use Xrender])
11238 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11239     AC_MSG_RESULT([yes])
11240     PKG_CHECK_MODULES(XRENDER, xrender)
11241     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11242     FilterLibs "${XRENDER_LIBS}"
11243     XRENDER_LIBS="${filteredlibs}"
11244     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11245       [AC_MSG_ERROR(libXrender not found or functional)], [])
11246     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11247       [AC_MSG_ERROR(Xrender not found. install X)], [])
11248 else
11249     AC_MSG_RESULT([no])
11251 AC_SUBST(XRENDER_CFLAGS)
11252 AC_SUBST(XRENDER_LIBS)
11254 dnl ===================================================================
11255 dnl Check for XRandr
11256 dnl ===================================================================
11257 AC_MSG_CHECKING([whether to enable RandR support])
11258 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11259     AC_MSG_RESULT([yes])
11260     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11261     if test "$ENABLE_RANDR" != "TRUE"; then
11262         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11263                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11264         XRANDR_CFLAGS=" "
11265         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11266           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11267         XRANDR_LIBS="-lXrandr "
11268         ENABLE_RANDR="TRUE"
11269     fi
11270     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11271     FilterLibs "${XRANDR_LIBS}"
11272     XRANDR_LIBS="${filteredlibs}"
11273 else
11274     ENABLE_RANDR=""
11275     AC_MSG_RESULT([no])
11277 AC_SUBST(XRANDR_CFLAGS)
11278 AC_SUBST(XRANDR_LIBS)
11279 AC_SUBST(ENABLE_RANDR)
11281 if test -z "$with_webdav"; then
11282     with_webdav=$test_webdav
11285 AC_MSG_CHECKING([for WebDAV support])
11286 case "$with_webdav" in
11288     AC_MSG_RESULT([no])
11289     WITH_WEBDAV=""
11290     ;;
11292     AC_MSG_RESULT([yes])
11293     # curl is already mandatory (almost) and checked elsewhere
11294     if test "$enable_curl" = "no"; then
11295         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11296     fi
11297     WITH_WEBDAV=TRUE
11298     ;;
11299 esac
11300 AC_SUBST(WITH_WEBDAV)
11302 dnl ===================================================================
11303 dnl Check for disabling cve_tests
11304 dnl ===================================================================
11305 AC_MSG_CHECKING([whether to execute CVE tests])
11306 if test "$enable_cve_tests" = "no"; then
11307     AC_MSG_RESULT([no])
11308     DISABLE_CVE_TESTS=TRUE
11309     AC_SUBST(DISABLE_CVE_TESTS)
11310 else
11311     AC_MSG_RESULT([yes])
11314 dnl ===================================================================
11315 dnl Check for system openssl
11316 dnl ===================================================================
11317 ENABLE_OPENSSL=
11318 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11319 if test "$enable_openssl" = "yes"; then
11320     AC_MSG_RESULT([no])
11321     ENABLE_OPENSSL=TRUE
11322     if test "$_os" = Darwin ; then
11323         # OpenSSL is deprecated when building for 10.7 or later.
11324         #
11325         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11326         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11328         with_system_openssl=no
11329         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11330     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11331             && test "$with_system_openssl" != "no"; then
11332         with_system_openssl=yes
11333         SYSTEM_OPENSSL=TRUE
11334         OPENSSL_CFLAGS=
11335         OPENSSL_LIBS="-lssl -lcrypto"
11336     else
11337         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11338         if test -n "${SYSTEM_OPENSSL}"; then
11339             AC_DEFINE([SYSTEM_OPENSSL])
11340         fi
11341     fi
11342     if test "$with_system_openssl" = "yes"; then
11343         AC_MSG_CHECKING([whether openssl supports SHA512])
11344         AC_LANG_PUSH([C])
11345         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11346             SHA512_CTX context;
11347 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11348         AC_LANG_POP(C)
11349     fi
11350 else
11351     AC_MSG_RESULT([yes])
11353     # warn that although OpenSSL is disabled, system libraries may depend on it
11354     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11355     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11358 AC_SUBST([ENABLE_OPENSSL])
11360 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11361     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11362         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11363         enable_cipher_openssl_backend=no
11364     else
11365         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11366     fi
11368 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11369 ENABLE_CIPHER_OPENSSL_BACKEND=
11370 if test "$enable_cipher_openssl_backend" = yes; then
11371     AC_MSG_RESULT([yes])
11372     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11373 else
11374     AC_MSG_RESULT([no])
11376 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11378 dnl ===================================================================
11379 dnl Select the crypto backends used by LO
11380 dnl ===================================================================
11382 if test "$build_crypto" = yes; then
11383     if test "$OS" = WNT; then
11384         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11385         AC_DEFINE([USE_CRYPTO_MSCAPI])
11386     elif test "$ENABLE_NSS" = TRUE; then
11387         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11388         AC_DEFINE([USE_CRYPTO_NSS])
11389     fi
11392 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11393 if test "$COM" = "MSC"; then
11394     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11395 else
11396     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11398 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11400 dnl ===================================================================
11401 dnl Check for system redland
11402 dnl ===================================================================
11403 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11404 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11405 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11406 if test "$with_system_redland" = "yes"; then
11407     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11408             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11409 else
11410     RAPTOR_MAJOR="0"
11411     RASQAL_MAJOR="3"
11412     REDLAND_MAJOR="0"
11414 AC_SUBST(RAPTOR_MAJOR)
11415 AC_SUBST(RASQAL_MAJOR)
11416 AC_SUBST(REDLAND_MAJOR)
11418 dnl ===================================================================
11419 dnl Check for system hunspell
11420 dnl ===================================================================
11421 AC_MSG_CHECKING([which libhunspell to use])
11422 if test "$with_system_hunspell" = "yes"; then
11423     AC_MSG_RESULT([external])
11424     SYSTEM_HUNSPELL=TRUE
11425     AC_LANG_PUSH([C++])
11426     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11427     if test "$HUNSPELL_PC" != "TRUE"; then
11428         AC_CHECK_HEADER(hunspell.hxx, [],
11429             [
11430             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11431             [AC_MSG_ERROR(hunspell headers not found.)], [])
11432             ], [])
11433         AC_CHECK_LIB([hunspell], [main], [:],
11434            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11435         HUNSPELL_LIBS=-lhunspell
11436     fi
11437     AC_LANG_POP([C++])
11438     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11439     FilterLibs "${HUNSPELL_LIBS}"
11440     HUNSPELL_LIBS="${filteredlibs}"
11441 else
11442     AC_MSG_RESULT([internal])
11443     SYSTEM_HUNSPELL=
11444     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11445     if test "$COM" = "MSC"; then
11446         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11447     else
11448         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11449     fi
11450     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11452 AC_SUBST(SYSTEM_HUNSPELL)
11453 AC_SUBST(HUNSPELL_CFLAGS)
11454 AC_SUBST(HUNSPELL_LIBS)
11456 dnl ===================================================================
11457 dnl Check for system zxcvbn
11458 dnl ===================================================================
11459 AC_MSG_CHECKING([which zxcvbn to use])
11460 if test "$with_system_zxcvbn" = "yes"; then
11461     AC_MSG_RESULT([external])
11462     SYSTEM_ZXCVBN=TRUE
11463     AC_CHECK_HEADER(zxcvbn.h, [],
11464        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11465     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11466         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11467 else
11468    AC_MSG_RESULT([internal])
11469    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11470    SYSTEM_ZXCVBN=
11472 AC_SUBST(SYSTEM_ZXCVBN)
11474 dnl ===================================================================
11475 dnl Check for system zxing
11476 dnl ===================================================================
11477 AC_MSG_CHECKING([whether to use zxing])
11478 if test "$enable_zxing" = "no"; then
11479     AC_MSG_RESULT([no])
11480     ENABLE_ZXING=
11481     SYSTEM_ZXING=
11482 else
11483     AC_MSG_RESULT([yes])
11484     ENABLE_ZXING=TRUE
11485     AC_MSG_CHECKING([which libzxing to use])
11486     if test "$with_system_zxing" = "yes"; then
11487         AC_MSG_RESULT([external])
11488         SYSTEM_ZXING=TRUE
11489         ZXING_CFLAGS=
11490         AC_LANG_PUSH([C++])
11491         save_CXXFLAGS=$CXXFLAGS
11492         save_IFS=$IFS
11493         IFS=$P_SEP
11494         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11495             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11496             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11497             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11498             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11499             dnl unsetting IFS."):
11500             IFS=$save_IFS
11501             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11502             dnl ignore them here:
11503             if test -z "$i"; then
11504                 continue
11505             fi
11506             dnl TODO: White space in $i would cause problems:
11507             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11508             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11509                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11510         done
11511         CXXFLAGS=$save_CXXFLAGS
11512         if test -z "$ZXING_CFLAGS"; then
11513             AC_MSG_ERROR(zxing headers not found.)
11514         fi
11515         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11516             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11517             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11518         AC_LANG_POP([C++])
11519         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11520         FilterLibs "${ZXING_LIBS}"
11521         ZXING_LIBS="${filteredlibs}"
11522     else
11523         AC_MSG_RESULT([internal])
11524         SYSTEM_ZXING=
11525         BUILD_TYPE="$BUILD_TYPE ZXING"
11526         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11527     fi
11528     if test "$ENABLE_ZXING" = TRUE; then
11529         AC_DEFINE(ENABLE_ZXING)
11530     fi
11531     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11532     AC_LANG_PUSH([C++])
11533     save_CXXFLAGS=$CXXFLAGS
11534     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11535     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11536             #include <BitMatrix.h>
11537             #include <BitMatrixIO.h>
11538             int main(){
11539                 ZXing::BitMatrix matrix(1, 1);
11540                 matrix.set(0, 0, true);
11541                 ZXing::ToSVG(matrix);
11542                 return 0;
11543             }
11544         ])], [
11545             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11546             AC_MSG_RESULT([yes])
11547         ], [AC_MSG_RESULT([no])])
11548     CXXFLAGS=$save_CXXFLAGS
11549     AC_LANG_POP([C++])
11550     AC_SUBST(HAVE_ZXING_TOSVG)
11552 AC_SUBST(SYSTEM_ZXING)
11553 AC_SUBST(ENABLE_ZXING)
11554 AC_SUBST(ZXING_CFLAGS)
11555 AC_SUBST(ZXING_LIBS)
11557 dnl ===================================================================
11558 dnl Check for system box2d
11559 dnl ===================================================================
11560 AC_MSG_CHECKING([which box2d to use])
11561 if test "$with_system_box2d" = "yes"; then
11562     AC_MSG_RESULT([external])
11563     SYSTEM_BOX2D=TRUE
11564     AC_LANG_PUSH([C++])
11565     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11566         [BOX2D_H_FOUND='FALSE'])
11567     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11568         _BOX2D_LIB=box2d
11569         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11570     else
11571         # fail this. there's no other alternative to check when we are here.
11572         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11573             [AC_MSG_ERROR(box2d headers not found.)])
11574         _BOX2D_LIB=Box2D
11575         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11576     fi
11577     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11578         [ AC_MSG_ERROR(box2d library not found.) ], [])
11579     BOX2D_LIBS=-l$_BOX2D_LIB
11580     AC_LANG_POP([C++])
11581     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11582     FilterLibs "${BOX2D_LIBS}"
11583     BOX2D_LIBS="${filteredlibs}"
11584 else
11585     AC_MSG_RESULT([internal])
11586     SYSTEM_BOX2D=
11587     BUILD_TYPE="$BUILD_TYPE BOX2D"
11589 AC_SUBST(SYSTEM_BOX2D)
11590 AC_SUBST(BOX2D_CFLAGS)
11591 AC_SUBST(BOX2D_LIBS)
11593 dnl ===================================================================
11594 dnl Checking for altlinuxhyph
11595 dnl ===================================================================
11596 AC_MSG_CHECKING([which altlinuxhyph to use])
11597 if test "$with_system_altlinuxhyph" = "yes"; then
11598     AC_MSG_RESULT([external])
11599     SYSTEM_HYPH=TRUE
11600     AC_CHECK_HEADER(hyphen.h, [],
11601        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11602     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11603        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11604        [#include <hyphen.h>])
11605     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11606         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11607     if test -z "$HYPHEN_LIB"; then
11608         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11609            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11610     fi
11611     if test -z "$HYPHEN_LIB"; then
11612         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11613            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11614     fi
11615 else
11616     AC_MSG_RESULT([internal])
11617     SYSTEM_HYPH=
11618     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11619     if test "$COM" = "MSC"; then
11620         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11621     else
11622         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11623     fi
11625 AC_SUBST(SYSTEM_HYPH)
11626 AC_SUBST(HYPHEN_LIB)
11628 dnl ===================================================================
11629 dnl Checking for mythes
11630 dnl ===================================================================
11631 AC_MSG_CHECKING([which mythes to use])
11632 if test "$with_system_mythes" = "yes"; then
11633     AC_MSG_RESULT([external])
11634     SYSTEM_MYTHES=TRUE
11635     AC_LANG_PUSH([C++])
11636     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11637     if test "$MYTHES_PKGCONFIG" = "no"; then
11638         AC_CHECK_HEADER(mythes.hxx, [],
11639             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11640         AC_CHECK_LIB([mythes-1.2], [main], [:],
11641             [ MYTHES_FOUND=no], [])
11642     if test "$MYTHES_FOUND" = "no"; then
11643         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11644                 [ MYTHES_FOUND=no], [])
11645     fi
11646     if test "$MYTHES_FOUND" = "no"; then
11647         AC_MSG_ERROR([mythes library not found!.])
11648     fi
11649     fi
11650     AC_LANG_POP([C++])
11651     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11652     FilterLibs "${MYTHES_LIBS}"
11653     MYTHES_LIBS="${filteredlibs}"
11654 else
11655     AC_MSG_RESULT([internal])
11656     SYSTEM_MYTHES=
11657     BUILD_TYPE="$BUILD_TYPE MYTHES"
11658     if test "$COM" = "MSC"; then
11659         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11660     else
11661         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11662     fi
11664 AC_SUBST(SYSTEM_MYTHES)
11665 AC_SUBST(MYTHES_CFLAGS)
11666 AC_SUBST(MYTHES_LIBS)
11668 dnl ===================================================================
11669 dnl How should we build the linear programming solver ?
11670 dnl ===================================================================
11672 ENABLE_COINMP=
11673 AC_MSG_CHECKING([whether to build with CoinMP])
11674 if test "$enable_coinmp" != "no"; then
11675     ENABLE_COINMP=TRUE
11676     AC_MSG_RESULT([yes])
11677     if test "$with_system_coinmp" = "yes"; then
11678         SYSTEM_COINMP=TRUE
11679         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11680         FilterLibs "${COINMP_LIBS}"
11681         COINMP_LIBS="${filteredlibs}"
11682     else
11683         BUILD_TYPE="$BUILD_TYPE COINMP"
11684     fi
11685 else
11686     AC_MSG_RESULT([no])
11688 AC_SUBST(ENABLE_COINMP)
11689 AC_SUBST(SYSTEM_COINMP)
11690 AC_SUBST(COINMP_CFLAGS)
11691 AC_SUBST(COINMP_LIBS)
11693 ENABLE_LPSOLVE=
11694 AC_MSG_CHECKING([whether to build with lpsolve])
11695 if test "$enable_lpsolve" != "no"; then
11696     ENABLE_LPSOLVE=TRUE
11697     AC_MSG_RESULT([yes])
11698 else
11699     AC_MSG_RESULT([no])
11701 AC_SUBST(ENABLE_LPSOLVE)
11703 if test "$ENABLE_LPSOLVE" = TRUE; then
11704     AC_MSG_CHECKING([which lpsolve to use])
11705     if test "$with_system_lpsolve" = "yes"; then
11706         AC_MSG_RESULT([external])
11707         SYSTEM_LPSOLVE=TRUE
11708         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11709            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11710         save_LIBS=$LIBS
11711         # some systems need this. Like Ubuntu...
11712         AC_CHECK_LIB(m, floor)
11713         AC_CHECK_LIB(dl, dlopen)
11714         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11715             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11716         LIBS=$save_LIBS
11717     else
11718         AC_MSG_RESULT([internal])
11719         SYSTEM_LPSOLVE=
11720         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11721     fi
11723 AC_SUBST(SYSTEM_LPSOLVE)
11725 dnl ===================================================================
11726 dnl Checking for libexttextcat
11727 dnl ===================================================================
11728 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11729 if test "$with_system_libexttextcat" = "yes"; then
11730     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11732 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11734 dnl ===================================================================
11735 dnl Checking for libnumbertext
11736 dnl ===================================================================
11737 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11738 if test "$with_system_libnumbertext" = "yes"; then
11739     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11740     SYSTEM_LIBNUMBERTEXT=YES
11741 else
11742     SYSTEM_LIBNUMBERTEXT=
11744 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11745 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11747 dnl ***************************************
11748 dnl testing libc version for Linux...
11749 dnl ***************************************
11750 if test "$_os" = "Linux"; then
11751     AC_MSG_CHECKING([whether the libc is recent enough])
11752     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11753     #include <features.h>
11754     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11755     #error glibc >= 2.1 is required
11756     #endif
11757     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11760 dnl =========================================
11761 dnl Check for uuidgen
11762 dnl =========================================
11763 if test "$_os" = "WINNT"; then
11764     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11765     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11766     UUIDGEN=uuidgen.exe
11767     AC_SUBST(UUIDGEN)
11768 else
11769     AC_PATH_PROG([UUIDGEN], [uuidgen])
11770     if test -z "$UUIDGEN"; then
11771         AC_MSG_WARN([uuid is needed for building installation sets])
11772     fi
11775 dnl ***************************************
11776 dnl Checking for bison and flex
11777 dnl ***************************************
11778 AC_PATH_PROG(BISON, bison)
11779 if test -z "$BISON"; then
11780     AC_MSG_ERROR([no bison found in \$PATH, install it])
11781 else
11782     AC_MSG_CHECKING([the bison version])
11783     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11784     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11785     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11786     dnl cause
11787     dnl
11788     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]
11789     dnl   typedef union YYSTYPE
11790     dnl           ~~~~~~^~~~~~~
11791     dnl
11792     dnl while at least 3.4.1 is know to be good:
11793     if test "$COMPILER_PLUGINS" = TRUE; then
11794         if test "$_bison_longver" -lt 2004; then
11795             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11796         fi
11797     else
11798         if test "$_bison_longver" -lt 2000; then
11799             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11800         fi
11801     fi
11803 AC_SUBST([BISON])
11805 AC_PATH_PROG(FLEX, flex)
11806 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11807     FLEX=`cygpath -m $FLEX`
11809 if test -z "$FLEX"; then
11810     AC_MSG_ERROR([no flex found in \$PATH, install it])
11811 else
11812     AC_MSG_CHECKING([the flex version])
11813     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11814     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11815         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11816     fi
11818 AC_SUBST([FLEX])
11820 AC_PATH_PROG(DIFF, diff)
11821 if test -z "$DIFF"; then
11822     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11824 AC_SUBST([DIFF])
11826 AC_PATH_PROG(UNIQ, uniq)
11827 if test -z "$UNIQ"; then
11828     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11830 AC_SUBST([UNIQ])
11832 dnl ***************************************
11833 dnl Checking for patch
11834 dnl ***************************************
11835 AC_PATH_PROG(PATCH, patch)
11836 if test -z "$PATCH"; then
11837     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11840 dnl On Solaris or macOS, check if --with-gnu-patch was used
11841 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11842     if test -z "$with_gnu_patch"; then
11843         GNUPATCH=$PATCH
11844     else
11845         if test -x "$with_gnu_patch"; then
11846             GNUPATCH=$with_gnu_patch
11847         else
11848             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11849         fi
11850     fi
11852     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11853     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11854         AC_MSG_RESULT([yes])
11855     else
11856         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11857             AC_MSG_RESULT([no, but accepted (Apple patch)])
11858             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11859         else
11860             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11861         fi
11862     fi
11863 else
11864     GNUPATCH=$PATCH
11867 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11868     GNUPATCH=`cygpath -m $GNUPATCH`
11871 dnl We also need to check for --with-gnu-cp
11873 if test -z "$with_gnu_cp"; then
11874     # check the place where the good stuff is hidden on Solaris...
11875     if test -x /usr/gnu/bin/cp; then
11876         GNUCP=/usr/gnu/bin/cp
11877     else
11878         AC_PATH_PROGS(GNUCP, gnucp cp)
11879     fi
11880     if test -z $GNUCP; then
11881         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11882     fi
11883 else
11884     if test -x "$with_gnu_cp"; then
11885         GNUCP=$with_gnu_cp
11886     else
11887         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11888     fi
11891 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11892     GNUCP=`cygpath -m $GNUCP`
11895 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11896 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11897     AC_MSG_RESULT([yes])
11898 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11899     AC_MSG_RESULT([yes])
11900 else
11901     case "$build_os" in
11902     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11903         x_GNUCP=[\#]
11904         GNUCP=''
11905         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11906         ;;
11907     *)
11908         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11909         ;;
11910     esac
11913 AC_SUBST(GNUPATCH)
11914 AC_SUBST(GNUCP)
11915 AC_SUBST(x_GNUCP)
11917 dnl ***************************************
11918 dnl testing assembler path
11919 dnl ***************************************
11920 ML_EXE=""
11921 if test "$_os" = "WINNT"; then
11922     case "$WIN_HOST_ARCH" in
11923     x86) assembler=ml.exe ;;
11924     x64) assembler=ml64.exe ;;
11925     arm64) assembler=armasm64.exe ;;
11926     esac
11928     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11929     if test -f "$MSVC_HOST_PATH/$assembler"; then
11930         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11931         AC_MSG_RESULT([$ML_EXE])
11932     else
11933         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11934     fi
11937 AC_SUBST(ML_EXE)
11939 dnl ===================================================================
11940 dnl We need zip and unzip
11941 dnl ===================================================================
11942 AC_PATH_PROG(ZIP, zip)
11943 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11944 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11945     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],,)
11948 AC_PATH_PROG(UNZIP, unzip)
11949 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11951 dnl ===================================================================
11952 dnl Zip must be a specific type for different build types.
11953 dnl ===================================================================
11954 if test $build_os = cygwin; then
11955     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11956         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11957     fi
11960 dnl ===================================================================
11961 dnl We need touch with -h option support.
11962 dnl ===================================================================
11963 AC_PATH_PROG(TOUCH, touch)
11964 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11965 touch "$WARNINGS_FILE"
11966 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11967     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],,)
11970 dnl ===================================================================
11971 dnl Check for system epoxy
11972 dnl ===================================================================
11973 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11974 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11976 dnl ===================================================================
11977 dnl Show which vclplugs will be built.
11978 dnl ===================================================================
11979 R=""
11981 libo_ENABLE_VCLPLUG([gen])
11982 libo_ENABLE_VCLPLUG([gtk3])
11983 libo_ENABLE_VCLPLUG([gtk3_kde5])
11984 libo_ENABLE_VCLPLUG([gtk4])
11985 libo_ENABLE_VCLPLUG([kf5])
11986 libo_ENABLE_VCLPLUG([kf6])
11987 libo_ENABLE_VCLPLUG([qt5])
11988 libo_ENABLE_VCLPLUG([qt6])
11990 if test "$_os" = "WINNT"; then
11991     R="$R win"
11992 elif test "$_os" = "Darwin"; then
11993     R="$R osx"
11994 elif test "$_os" = "iOS"; then
11995     R="ios"
11996 elif test "$_os" = Android; then
11997     R="android"
12000 build_vcl_plugins="$R"
12001 if test -z "$build_vcl_plugins"; then
12002     build_vcl_plugins=" none"
12004 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
12005 VCL_PLUGIN_INFO=$R
12006 AC_SUBST([VCL_PLUGIN_INFO])
12008 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
12009     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
12012 dnl ===================================================================
12013 dnl Check for GTK libraries
12014 dnl ===================================================================
12016 GTK3_CFLAGS=""
12017 GTK3_LIBS=""
12018 ENABLE_GTKTILEDVIEWER=""
12019 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12020     if test "$with_system_cairo" = no; then
12021         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.'
12022     fi
12023     : ${with_system_cairo:=yes}
12024     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)
12025     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12026     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12027     FilterLibs "${GTK3_LIBS}"
12028     GTK3_LIBS="${filteredlibs}"
12030     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12031     if test "$with_system_epoxy" != "yes"; then
12032         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12033         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12034                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12035     fi
12036 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12037     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12038     if test "$build_os" = "cygwin"; then
12039         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12040         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12041     fi
12043     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12044     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12045     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12046     FilterLibs "${GTK3_LIBS}"
12047     GTK3_LIBS="${filteredlibs}"
12048     ENABLE_GTKTILEDVIEWER="yes"
12050 AC_SUBST(GTK3_LIBS)
12051 AC_SUBST(GTK3_CFLAGS)
12052 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12054 GTK4_CFLAGS=""
12055 GTK4_LIBS=""
12056 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12057     if test "$with_system_cairo" = no; then
12058         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12059     fi
12060     : ${with_system_cairo:=yes}
12061     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12062     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12063     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12064     FilterLibs "${GTK4_LIBS}"
12065     GTK4_LIBS="${filteredlibs}"
12067     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12068     if test "$with_system_epoxy" != "yes"; then
12069         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12070         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12071                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12072     fi
12074 AC_SUBST(GTK4_LIBS)
12075 AC_SUBST(GTK4_CFLAGS)
12077 if test "$enable_introspection" = yes; then
12078     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12079         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12080     else
12081         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12082     fi
12085 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12086 if ! test "$ENABLE_GTK3" = TRUE; then
12087     if test "$enable_atspi_tests" = yes; then
12088         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12089     fi
12090     enable_atspi_tests=no
12092 if ! test "$enable_atspi_tests" = no; then
12093     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12094     if ! test "$XVFB_RUN" = no; then
12095         dnl make sure the found xvfb-run actually works
12096         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12097         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12098             AC_MSG_RESULT([yes])
12099         else
12100             AC_MSG_RESULT([no])
12101             XVFB_RUN=no
12102         fi
12103     fi
12104     if test "$XVFB_RUN" = no; then
12105         if test "$enable_atspi_tests" = yes; then
12106             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12107         fi
12108         enable_atspi_tests=no
12109     fi
12111 if ! test "$enable_atspi_tests" = no; then
12112     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12113     if test "$DBUS_LAUNCH" = no; then
12114         if test "$enable_atspi_tests" = yes; then
12115             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12116         fi
12117         enable_atspi_tests=no
12118     fi
12120 if ! test "$enable_atspi_tests" = no; then
12121     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12122                       [if test "$enable_atspi_tests" = yes; then
12123                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12124                        else
12125                            enable_atspi_tests=no
12126                        fi])
12128 if ! test "x$enable_atspi_tests" = xno; then
12129     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12130                       [have_atspi_scroll_to=1],
12131                       [have_atspi_scroll_to=0])
12132     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12133                        [Whether AT-SPI2 has the scrollTo API])
12135 ENABLE_ATSPI_TESTS=
12136 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12137 AC_SUBST([ENABLE_ATSPI_TESTS])
12139 dnl ===================================================================
12140 dnl check for dbus support
12141 dnl ===================================================================
12142 ENABLE_DBUS=""
12143 DBUS_CFLAGS=""
12144 DBUS_LIBS=""
12145 DBUS_GLIB_CFLAGS=""
12146 DBUS_GLIB_LIBS=""
12147 DBUS_HAVE_GLIB=""
12149 if test "$enable_dbus" = "no"; then
12150     test_dbus=no
12153 AC_MSG_CHECKING([whether to enable DBUS support])
12154 if test "$test_dbus" = "yes"; then
12155     ENABLE_DBUS="TRUE"
12156     AC_MSG_RESULT([yes])
12157     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12158     AC_DEFINE(ENABLE_DBUS)
12159     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12160     FilterLibs "${DBUS_LIBS}"
12161     DBUS_LIBS="${filteredlibs}"
12163     # Glib is needed for BluetoothServer
12164     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12165     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12166         [
12167             DBUS_HAVE_GLIB="TRUE"
12168             AC_DEFINE(DBUS_HAVE_GLIB,1)
12169         ],
12170         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12171     )
12172 else
12173     AC_MSG_RESULT([no])
12176 AC_SUBST(ENABLE_DBUS)
12177 AC_SUBST(DBUS_CFLAGS)
12178 AC_SUBST(DBUS_LIBS)
12179 AC_SUBST(DBUS_GLIB_CFLAGS)
12180 AC_SUBST(DBUS_GLIB_LIBS)
12181 AC_SUBST(DBUS_HAVE_GLIB)
12183 AC_MSG_CHECKING([whether to enable Impress remote control])
12184 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12185     AC_MSG_RESULT([yes])
12186     ENABLE_SDREMOTE=TRUE
12187     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12188         <true/>"
12189     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12191     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12192         # The Bluetooth code doesn't compile with macOS SDK 10.15
12193         if test "$enable_sdremote_bluetooth" = yes; then
12194             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12195         fi
12196         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12197         enable_sdremote_bluetooth=no
12198     fi
12199     # If not explicitly enabled or disabled, default
12200     if test -z "$enable_sdremote_bluetooth"; then
12201         case "$OS" in
12202         LINUX|MACOSX|WNT)
12203             # Default to yes for these
12204             enable_sdremote_bluetooth=yes
12205             ;;
12206         *)
12207             # otherwise no
12208             enable_sdremote_bluetooth=no
12209             ;;
12210         esac
12211     fi
12212     # $enable_sdremote_bluetooth is guaranteed non-empty now
12214     if test "$enable_sdremote_bluetooth" != "no"; then
12215         if test "$OS" = "LINUX"; then
12216             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12217                 AC_MSG_RESULT([yes])
12218                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12219                 dnl ===================================================================
12220                 dnl Check for system bluez
12221                 dnl ===================================================================
12222                 AC_MSG_CHECKING([which Bluetooth header to use])
12223                 if test "$with_system_bluez" = "yes"; then
12224                     AC_MSG_RESULT([external])
12225                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12226                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12227                     SYSTEM_BLUEZ=TRUE
12228                 else
12229                     AC_MSG_RESULT([internal])
12230                     SYSTEM_BLUEZ=
12231                 fi
12232             else
12233                 AC_MSG_RESULT([no, dbus disabled])
12234                 ENABLE_SDREMOTE_BLUETOOTH=
12235                 SYSTEM_BLUEZ=
12236             fi
12237         else
12238             AC_MSG_RESULT([yes])
12239             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12240             SYSTEM_BLUEZ=
12241             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12242         <key>com.apple.security.device.bluetooth</key>
12243         <true/>"
12244         fi
12245     else
12246         AC_MSG_RESULT([no])
12247         ENABLE_SDREMOTE_BLUETOOTH=
12248         SYSTEM_BLUEZ=
12249     fi
12250 else
12251     ENABLE_SDREMOTE=
12252     SYSTEM_BLUEZ=
12253     AC_MSG_RESULT([no])
12255 AC_SUBST(ENABLE_SDREMOTE)
12256 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12257 AC_SUBST(SDREMOTE_ENTITLEMENT)
12258 AC_SUBST(SYSTEM_BLUEZ)
12260 dnl ===================================================================
12261 dnl Check whether to enable GIO support
12262 dnl ===================================================================
12263 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12264     AC_MSG_CHECKING([whether to enable GIO support])
12265     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12266         dnl Need at least 2.26 for the dbus support.
12267         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12268                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12269         if test "$ENABLE_GIO" = "TRUE"; then
12270             AC_DEFINE(ENABLE_GIO)
12271             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12272             FilterLibs "${GIO_LIBS}"
12273             GIO_LIBS="${filteredlibs}"
12274         fi
12275     else
12276         AC_MSG_RESULT([no])
12277     fi
12279 AC_SUBST(ENABLE_GIO)
12280 AC_SUBST(GIO_CFLAGS)
12281 AC_SUBST(GIO_LIBS)
12284 dnl ===================================================================
12286 SPLIT_APP_MODULES=""
12287 if test "$enable_split_app_modules" = "yes"; then
12288     SPLIT_APP_MODULES="TRUE"
12290 AC_SUBST(SPLIT_APP_MODULES)
12292 SPLIT_OPT_FEATURES=""
12293 if test "$enable_split_opt_features" = "yes"; then
12294     SPLIT_OPT_FEATURES="TRUE"
12296 AC_SUBST(SPLIT_OPT_FEATURES)
12298 dnl ===================================================================
12299 dnl Check whether the GStreamer libraries are available.
12300 dnl ===================================================================
12302 ENABLE_GSTREAMER_1_0=""
12304 if test "$test_gstreamer_1_0" = yes; then
12306     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12307     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12308         ENABLE_GSTREAMER_1_0="TRUE"
12309         AC_MSG_RESULT([yes])
12310         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12311         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12312         FilterLibs "${GSTREAMER_1_0_LIBS}"
12313         GSTREAMER_1_0_LIBS="${filteredlibs}"
12314         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12315     else
12316         AC_MSG_RESULT([no])
12317     fi
12319 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12320 AC_SUBST(GSTREAMER_1_0_LIBS)
12321 AC_SUBST(ENABLE_GSTREAMER_1_0)
12323 ENABLE_OPENGL_TRANSITIONS=
12324 ENABLE_OPENGL_CANVAS=
12325 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12326    : # disable
12327 elif test "$_os" = "Darwin"; then
12328     # We use frameworks on macOS, no need for detail checks
12329     ENABLE_OPENGL_TRANSITIONS=TRUE
12330     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12331     ENABLE_OPENGL_CANVAS=TRUE
12332 elif test $_os = WINNT; then
12333     ENABLE_OPENGL_TRANSITIONS=TRUE
12334     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12335     ENABLE_OPENGL_CANVAS=TRUE
12336 else
12337     if test "$USING_X11" = TRUE; then
12338         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12339         ENABLE_OPENGL_TRANSITIONS=TRUE
12340         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12341         ENABLE_OPENGL_CANVAS=TRUE
12342     fi
12345 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12346 AC_SUBST(ENABLE_OPENGL_CANVAS)
12348 dnl =================================================
12349 dnl Check whether to build with OpenCL support.
12350 dnl =================================================
12352 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12353     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12354     # platform (optional at run-time, used through clew).
12355     BUILD_TYPE="$BUILD_TYPE OPENCL"
12356     AC_DEFINE(HAVE_FEATURE_OPENCL)
12359 dnl =================================================
12360 dnl Check whether to build with dconf support.
12361 dnl =================================================
12363 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12364     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12365         if test "$enable_dconf" = yes; then
12366             AC_MSG_ERROR([dconf not found])
12367         else
12368             enable_dconf=no
12369         fi])
12371 AC_MSG_CHECKING([whether to enable dconf])
12372 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12373     DCONF_CFLAGS=
12374     DCONF_LIBS=
12375     ENABLE_DCONF=
12376     AC_MSG_RESULT([no])
12377 else
12378     ENABLE_DCONF=TRUE
12379     AC_DEFINE(ENABLE_DCONF)
12380     AC_MSG_RESULT([yes])
12382 AC_SUBST([DCONF_CFLAGS])
12383 AC_SUBST([DCONF_LIBS])
12384 AC_SUBST([ENABLE_DCONF])
12386 # pdf import?
12387 AC_MSG_CHECKING([whether to build the PDF import feature])
12388 ENABLE_PDFIMPORT=
12389 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12390     AC_MSG_RESULT([yes])
12391     ENABLE_PDFIMPORT=TRUE
12392     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12393 else
12394     AC_MSG_RESULT([no])
12397 # Pdfium?
12398 AC_MSG_CHECKING([whether to build PDFium])
12399 ENABLE_PDFIUM=
12400 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12401     AC_MSG_RESULT([yes])
12402     ENABLE_PDFIUM=TRUE
12403     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12404 else
12405     AC_MSG_RESULT([no])
12407 AC_SUBST(ENABLE_PDFIUM)
12409 if test "$ENABLE_PDFIUM" = "TRUE"; then
12410     AC_MSG_CHECKING([which OpenJPEG library to use])
12411     if test "$with_system_openjpeg" = "yes"; then
12412         SYSTEM_OPENJPEG2=TRUE
12413         AC_MSG_RESULT([external])
12414         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12415         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12416         FilterLibs "${OPENJPEG2_LIBS}"
12417         OPENJPEG2_LIBS="${filteredlibs}"
12418     else
12419         SYSTEM_OPENJPEG2=FALSE
12420         AC_MSG_RESULT([internal])
12421     fi
12423     AC_MSG_CHECKING([which Abseil library to use])
12424     if test "$with_system_abseil" = "yes"; then
12425         AC_MSG_RESULT([external])
12426         SYSTEM_ABSEIL=TRUE
12427         AC_LANG_PUSH([C++])
12428         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12429         AC_LANG_POP([C++])
12430         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12431         FilterLibs "${ABSEIL_LIBS}"
12432         ABSEIL_LIBS="${filteredlibs}"
12433     else
12434         AC_MSG_RESULT([internal])
12435     fi
12437 AC_SUBST(SYSTEM_OPENJPEG2)
12438 AC_SUBST(SYSTEM_ABSEIL)
12439 AC_SUBST(ABSEIL_CFLAGS)
12440 AC_SUBST(ABSEIL_LIBS)
12442 dnl ===================================================================
12443 dnl Check for poppler
12444 dnl ===================================================================
12445 ENABLE_POPPLER=
12446 AC_MSG_CHECKING([whether to build Poppler])
12447 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12448     AC_MSG_RESULT([yes])
12449     ENABLE_POPPLER=TRUE
12450     AC_DEFINE(HAVE_FEATURE_POPPLER)
12451 else
12452     AC_MSG_RESULT([no])
12454 AC_SUBST(ENABLE_POPPLER)
12456 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12457     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12460 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12461     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12464 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12465     dnl ===================================================================
12466     dnl Check for system poppler
12467     dnl ===================================================================
12468     AC_MSG_CHECKING([which PDF import poppler to use])
12469     if test "$with_system_poppler" = "yes"; then
12470         AC_MSG_RESULT([external])
12471         SYSTEM_POPPLER=TRUE
12472         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12473         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12474         FilterLibs "${POPPLER_LIBS}"
12475         POPPLER_LIBS="${filteredlibs}"
12476     else
12477         AC_MSG_RESULT([internal])
12478         SYSTEM_POPPLER=
12479         BUILD_TYPE="$BUILD_TYPE POPPLER"
12480     fi
12481     AC_DEFINE([ENABLE_PDFIMPORT],1)
12483 AC_SUBST(ENABLE_PDFIMPORT)
12484 AC_SUBST(SYSTEM_POPPLER)
12485 AC_SUBST(POPPLER_CFLAGS)
12486 AC_SUBST(POPPLER_LIBS)
12488 # Skia?
12489 ENABLE_SKIA=
12490 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12491     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12492     if test "$SYSTEM_FREETYPE" = TRUE; then
12493         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12494             [skia_freetype_ok=yes],
12495             [skia_freetype_ok=no])
12496     else # internal is ok
12497         skia_freetype_ok=yes
12498     fi
12499     AC_MSG_CHECKING([whether to build Skia])
12500     if test "$skia_freetype_ok" = "yes"; then
12501         if test "$enable_skia" = "debug"; then
12502             AC_MSG_RESULT([yes (debug)])
12503             ENABLE_SKIA_DEBUG=TRUE
12504         else
12505             AC_MSG_RESULT([yes])
12506             ENABLE_SKIA_DEBUG=
12507         fi
12508         ENABLE_SKIA=TRUE
12509         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12510             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12511         fi
12513         AC_DEFINE(HAVE_FEATURE_SKIA)
12514         BUILD_TYPE="$BUILD_TYPE SKIA"
12516         if test "$OS" = "MACOSX"; then
12517             AC_DEFINE(SK_GANESH,1)
12518             AC_DEFINE(SK_METAL,1)
12519             SKIA_GPU=METAL
12520             AC_SUBST(SKIA_GPU)
12521         else
12522             AC_DEFINE(SK_GANESH,1)
12523             AC_DEFINE(SK_VULKAN,1)
12524             SKIA_GPU=VULKAN
12525             AC_SUBST(SKIA_GPU)
12526         fi
12527     else
12528         AC_MSG_RESULT([no (freetype too old)])
12529         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12530     fi
12532 else
12533     AC_MSG_CHECKING([whether to build Skia])
12534     AC_MSG_RESULT([no])
12536 AC_SUBST(ENABLE_SKIA)
12537 AC_SUBST(ENABLE_SKIA_DEBUG)
12539 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12540 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12541 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12542 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12543 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12544 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12545 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12546 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12547 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12548 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12549 LO_CLANG_VERSION=
12550 HAVE_LO_CLANG_DLLEXPORTINLINES=
12552 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12553     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12554         AC_MSG_CHECKING([for Clang])
12555         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12556     else
12557         if test "$_os" = "WINNT"; then
12558             AC_MSG_CHECKING([for clang-cl])
12559             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12560                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12561             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12562                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12563             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12564                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12565             fi
12566             if test -n "$LO_CLANG_CC"; then
12567                 dnl explicitly set -m32/-m64
12568                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12569                 LO_CLANG_CXX="$LO_CLANG_CC"
12570                 AC_MSG_RESULT([$LO_CLANG_CC])
12571             else
12572                 AC_MSG_RESULT([no])
12573             fi
12575             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12576             echo "#include <stdlib.h>" > conftest.c
12577             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12578                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12579             rm -f conftest.c conftest.obj
12580             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12581                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12582             else
12583                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12584             fi
12585         else
12586             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12587             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12588         fi
12589     fi
12590     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12591         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12592         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12593         if test "$LO_CLANG_VERSION" -lt 50002; then
12594             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12595             LO_CLANG_CC=
12596             LO_CLANG_CXX=
12597         fi
12598     fi
12599     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12600         save_CXX="$CXX"
12601         CXX="$LO_CLANG_CXX"
12602         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12603         AC_LANG_PUSH([C++])
12604         save_CXXFLAGS=$CXXFLAGS
12605         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12606         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12607                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12608                 AC_MSG_RESULT([yes])
12609             ], [AC_MSG_RESULT([no])])
12610         CXXFLAGS=$save_CXXFLAGS
12611         AC_LANG_POP([C++])
12612         CXX="$save_CXX"
12613         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12614             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.])
12615         fi
12616     fi
12617     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12618         # Skia is the default on Windows and Mac, so hard-require Clang.
12619         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12620         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12621             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12622         else
12623             AC_MSG_WARN([Clang compiler not found.])
12624         fi
12625     else
12627         save_CXX="$CXX"
12628         CXX="$LO_CLANG_CXX"
12629         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12630         flag_sse2=-msse2
12631         flag_ssse3=-mssse3
12632         flag_sse41=-msse4.1
12633         flag_sse42=-msse4.2
12634         flag_avx=-mavx
12635         flag_avx2=-mavx2
12636         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12637         flag_avx512f=-mavx512f
12638         flag_f16c=-mf16c
12639         flag_fma=-mfma
12641         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12642         AC_LANG_PUSH([C++])
12643         save_CXXFLAGS=$CXXFLAGS
12644         CXXFLAGS="$CXXFLAGS $flag_sse2"
12645         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12646             #include <emmintrin.h>
12647             int main () {
12648                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12649                 c = _mm_xor_si128 (a, b);
12650                 return 0;
12651             }
12652             ])],
12653             [can_compile_sse2=yes],
12654             [can_compile_sse2=no])
12655         AC_LANG_POP([C++])
12656         CXXFLAGS=$save_CXXFLAGS
12657         AC_MSG_RESULT([${can_compile_sse2}])
12658         if test "${can_compile_sse2}" = "yes" ; then
12659             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12660         fi
12662         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12663         AC_LANG_PUSH([C++])
12664         save_CXXFLAGS=$CXXFLAGS
12665         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12666         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12667             #include <tmmintrin.h>
12668             int main () {
12669                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12670                 c = _mm_maddubs_epi16 (a, b);
12671                 return 0;
12672             }
12673             ])],
12674             [can_compile_ssse3=yes],
12675             [can_compile_ssse3=no])
12676         AC_LANG_POP([C++])
12677         CXXFLAGS=$save_CXXFLAGS
12678         AC_MSG_RESULT([${can_compile_ssse3}])
12679         if test "${can_compile_ssse3}" = "yes" ; then
12680             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12681         fi
12683         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12684         AC_LANG_PUSH([C++])
12685         save_CXXFLAGS=$CXXFLAGS
12686         CXXFLAGS="$CXXFLAGS $flag_sse41"
12687         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12688             #include <smmintrin.h>
12689             int main () {
12690                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12691                 c = _mm_cmpeq_epi64 (a, b);
12692                 return 0;
12693             }
12694             ])],
12695             [can_compile_sse41=yes],
12696             [can_compile_sse41=no])
12697         AC_LANG_POP([C++])
12698         CXXFLAGS=$save_CXXFLAGS
12699         AC_MSG_RESULT([${can_compile_sse41}])
12700         if test "${can_compile_sse41}" = "yes" ; then
12701             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12702         fi
12704         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12705         AC_LANG_PUSH([C++])
12706         save_CXXFLAGS=$CXXFLAGS
12707         CXXFLAGS="$CXXFLAGS $flag_sse42"
12708         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12709             #include <nmmintrin.h>
12710             int main () {
12711                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12712                 c = _mm_cmpgt_epi64 (a, b);
12713                 return 0;
12714             }
12715             ])],
12716             [can_compile_sse42=yes],
12717             [can_compile_sse42=no])
12718         AC_LANG_POP([C++])
12719         CXXFLAGS=$save_CXXFLAGS
12720         AC_MSG_RESULT([${can_compile_sse42}])
12721         if test "${can_compile_sse42}" = "yes" ; then
12722             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12723         fi
12725         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12726         AC_LANG_PUSH([C++])
12727         save_CXXFLAGS=$CXXFLAGS
12728         CXXFLAGS="$CXXFLAGS $flag_avx"
12729         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12730             #include <immintrin.h>
12731             int main () {
12732                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12733                 c = _mm256_xor_ps(a, b);
12734                 return 0;
12735             }
12736             ])],
12737             [can_compile_avx=yes],
12738             [can_compile_avx=no])
12739         AC_LANG_POP([C++])
12740         CXXFLAGS=$save_CXXFLAGS
12741         AC_MSG_RESULT([${can_compile_avx}])
12742         if test "${can_compile_avx}" = "yes" ; then
12743             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12744         fi
12746         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12747         AC_LANG_PUSH([C++])
12748         save_CXXFLAGS=$CXXFLAGS
12749         CXXFLAGS="$CXXFLAGS $flag_avx2"
12750         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12751             #include <immintrin.h>
12752             int main () {
12753                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12754                 c = _mm256_maddubs_epi16(a, b);
12755                 return 0;
12756             }
12757             ])],
12758             [can_compile_avx2=yes],
12759             [can_compile_avx2=no])
12760         AC_LANG_POP([C++])
12761         CXXFLAGS=$save_CXXFLAGS
12762         AC_MSG_RESULT([${can_compile_avx2}])
12763         if test "${can_compile_avx2}" = "yes" ; then
12764             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12765         fi
12767         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12768         AC_LANG_PUSH([C++])
12769         save_CXXFLAGS=$CXXFLAGS
12770         CXXFLAGS="$CXXFLAGS $flag_avx512"
12771         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12772             #include <immintrin.h>
12773             int main () {
12774                 __m512i a = _mm512_loadu_si512(0);
12775                 __m512d v1 = _mm512_load_pd(0);
12776                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12777                 __m512d v2 = _mm512_abs_pd(v1);
12778                 return 0;
12779             }
12780             ])],
12781             [can_compile_avx512=yes],
12782             [can_compile_avx512=no])
12783         AC_LANG_POP([C++])
12784         CXXFLAGS=$save_CXXFLAGS
12785         AC_MSG_RESULT([${can_compile_avx512}])
12786         if test "${can_compile_avx512}" = "yes" ; then
12787             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12788             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12789         fi
12791         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12792         AC_LANG_PUSH([C++])
12793         save_CXXFLAGS=$CXXFLAGS
12794         CXXFLAGS="$CXXFLAGS $flag_f16c"
12795         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12796             #include <immintrin.h>
12797             int main () {
12798                 __m128i a = _mm_set1_epi32 (0);
12799                 __m128 c;
12800                 c = _mm_cvtph_ps(a);
12801                 return 0;
12802             }
12803             ])],
12804             [can_compile_f16c=yes],
12805             [can_compile_f16c=no])
12806         AC_LANG_POP([C++])
12807         CXXFLAGS=$save_CXXFLAGS
12808         AC_MSG_RESULT([${can_compile_f16c}])
12809         if test "${can_compile_f16c}" = "yes" ; then
12810             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12811         fi
12813         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12814         AC_LANG_PUSH([C++])
12815         save_CXXFLAGS=$CXXFLAGS
12816         CXXFLAGS="$CXXFLAGS $flag_fma"
12817         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12818             #include <immintrin.h>
12819             int main () {
12820                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12821                 d = _mm256_fmadd_ps(a, b, c);
12822                 return 0;
12823             }
12824             ])],
12825             [can_compile_fma=yes],
12826             [can_compile_fma=no])
12827         AC_LANG_POP([C++])
12828         CXXFLAGS=$save_CXXFLAGS
12829         AC_MSG_RESULT([${can_compile_fma}])
12830         if test "${can_compile_fma}" = "yes" ; then
12831             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12832         fi
12834         CXX="$save_CXX"
12835     fi
12838 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12840 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12841     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12842     AC_LANG_PUSH([C])
12843     save_CC="$CC"
12844     CC="$LO_CLANG_CC"
12845     save_CFLAGS=$CFLAGS
12846     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12847     dnl an empty program will do, we're checking the compiler flags
12848     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12849                       [use_ccache=yes], [use_ccache=no])
12850     CFLAGS=$save_CFLAGS
12851     CC=$save_CC
12852     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12853         AC_MSG_RESULT([yes])
12854     else
12855         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12856         AC_MSG_RESULT([no])
12857     fi
12858     AC_LANG_POP([C])
12860     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12861     AC_LANG_PUSH([C++])
12862     save_CXX="$CXX"
12863     CXX="$LO_CLANG_CXX"
12864     save_CXXFLAGS=$CXXFLAGS
12865     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12866     dnl an empty program will do, we're checking the compiler flags
12867     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12868                       [use_ccache=yes], [use_ccache=no])
12869     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12870         AC_MSG_RESULT([yes])
12871     else
12872         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12873         AC_MSG_RESULT([no])
12874     fi
12875     CXXFLAGS=$save_CXXFLAGS
12876     CXX=$save_CXX
12877     AC_LANG_POP([C++])
12880 AC_SUBST(LO_CLANG_CC)
12881 AC_SUBST(LO_CLANG_CXX)
12882 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12883 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12884 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12885 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12886 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12887 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12888 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12889 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12890 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12891 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12892 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12893 AC_SUBST(LO_CLANG_VERSION)
12894 AC_SUBST(CLANG_USE_LD)
12895 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12897 SYSTEM_GPGMEPP=
12899 AC_MSG_CHECKING([whether to enable gpgmepp])
12900 if test "$enable_gpgmepp" = no; then
12901     AC_MSG_RESULT([no])
12902 elif test "$enable_mpl_subset" = "yes"; then
12903     AC_MSG_RESULT([no (MPL only)])
12904 elif test "$enable_fuzzers" = "yes"; then
12905     AC_MSG_RESULT([no (oss-fuzz)])
12906 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12907     AC_MSG_RESULT([yes])
12908     dnl ===================================================================
12909     dnl Check for system gpgme
12910     dnl ===================================================================
12911     AC_MSG_CHECKING([which gpgmepp to use])
12912     if test "$with_system_gpgmepp" = "yes"; then
12913         AC_MSG_RESULT([external])
12914         SYSTEM_GPGMEPP=TRUE
12916         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12917         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12918             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12919         AC_CHECK_HEADER(gpgme.h, [],
12920             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12921         AC_CHECK_LIB(gpgmepp, main, [],
12922             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12923         GPGMEPP_LIBS=-lgpgmepp
12924     else
12925         AC_MSG_RESULT([internal])
12926         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12928         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12929         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12930         if test "$_os" != "WINNT"; then
12931             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12932             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12933         fi
12934     fi
12935     ENABLE_GPGMEPP=TRUE
12936     AC_DEFINE([HAVE_FEATURE_GPGME])
12937     AC_PATH_PROG(GPG, gpg)
12938     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12939     # so let's exclude that manually for the moment
12940     if test -n "$GPG" -a "$_os" != "WINNT"; then
12941         # make sure we not only have a working gpgme, but a full working
12942         # gpg installation to run OpenPGP signature verification
12943         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12944     fi
12945     if test "$_os" = "Linux"; then
12946       uid=`id -u`
12947       AC_MSG_CHECKING([for /run/user/$uid])
12948       if test -d /run/user/$uid; then
12949         AC_MSG_RESULT([yes])
12950         AC_PATH_PROG(GPGCONF, gpgconf)
12952         # Older versions of gpgconf are not working as expected, since
12953         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12954         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12955         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12956         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12957         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12958         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12959         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12960           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12961           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12962           if $GPGCONF --dump-options > /dev/null ; then
12963             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12964               AC_MSG_RESULT([yes])
12965               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12966               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12967             else
12968               AC_MSG_RESULT([no])
12969             fi
12970           else
12971             AC_MSG_RESULT([no. missing or broken gpgconf?])
12972           fi
12973         else
12974           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12975         fi
12976       else
12977         AC_MSG_RESULT([no])
12978      fi
12979    fi
12980 else
12981     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12983 AC_SUBST(ENABLE_GPGMEPP)
12984 AC_SUBST(SYSTEM_GPGMEPP)
12985 AC_SUBST(GPG_ERROR_CFLAGS)
12986 AC_SUBST(GPG_ERROR_LIBS)
12987 AC_SUBST(LIBASSUAN_CFLAGS)
12988 AC_SUBST(LIBASSUAN_LIBS)
12989 AC_SUBST(GPGMEPP_CFLAGS)
12990 AC_SUBST(GPGMEPP_LIBS)
12992 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12993 if test "$with_java" != "no"; then
12994     AC_MSG_RESULT([yes])
12995     ENABLE_JAVA_WEBSOCKET=TRUE
12996     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12997     NEED_ANT=TRUE
12998 else
12999     AC_MSG_RESULT([no])
13000     ENABLE_JAVA_WEBSOCKET=
13002 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
13004 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
13005 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
13006     AC_MSG_RESULT([yes])
13007     ENABLE_MEDIAWIKI=TRUE
13008     BUILD_TYPE="$BUILD_TYPE XSLTML"
13009     if test  "x$with_java" = "xno"; then
13010         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
13011     fi
13012 else
13013     AC_MSG_RESULT([no])
13014     ENABLE_MEDIAWIKI=
13015     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
13017 AC_SUBST(ENABLE_MEDIAWIKI)
13019 AC_MSG_CHECKING([whether to build the Report Builder])
13020 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13021     AC_MSG_RESULT([yes])
13022     ENABLE_REPORTBUILDER=TRUE
13023     AC_MSG_CHECKING([which jfreereport libs to use])
13024     if test "$with_system_jfreereport" = "yes"; then
13025         SYSTEM_JFREEREPORT=TRUE
13026         AC_MSG_RESULT([external])
13027         if test -z $SAC_JAR; then
13028             SAC_JAR=/usr/share/java/sac.jar
13029         fi
13030         if ! test -f $SAC_JAR; then
13031              AC_MSG_ERROR(sac.jar not found.)
13032         fi
13034         if test -z $LIBXML_JAR; then
13035             if test -f /usr/share/java/libxml-1.0.0.jar; then
13036                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13037             elif test -f /usr/share/java/libxml.jar; then
13038                 LIBXML_JAR=/usr/share/java/libxml.jar
13039             else
13040                 AC_MSG_ERROR(libxml.jar replacement not found.)
13041             fi
13042         elif ! test -f $LIBXML_JAR; then
13043             AC_MSG_ERROR(libxml.jar not found.)
13044         fi
13046         if test -z $FLUTE_JAR; then
13047             if test -f /usr/share/java/flute-1.3.0.jar; then
13048                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13049             elif test -f /usr/share/java/flute.jar; then
13050                 FLUTE_JAR=/usr/share/java/flute.jar
13051             else
13052                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13053             fi
13054         elif ! test -f $FLUTE_JAR; then
13055             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13056         fi
13058         if test -z $JFREEREPORT_JAR; then
13059             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13060                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13061             elif test -f /usr/share/java/flow-engine.jar; then
13062                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13063             else
13064                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13065             fi
13066         elif ! test -f  $JFREEREPORT_JAR; then
13067                 AC_MSG_ERROR(jfreereport.jar not found.)
13068         fi
13070         if test -z $LIBLAYOUT_JAR; then
13071             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13072                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13073             elif test -f /usr/share/java/liblayout.jar; then
13074                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13075             else
13076                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13077             fi
13078         elif ! test -f $LIBLAYOUT_JAR; then
13079                 AC_MSG_ERROR(liblayout.jar not found.)
13080         fi
13082         if test -z $LIBLOADER_JAR; then
13083             if test -f /usr/share/java/libloader-1.0.0.jar; then
13084                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13085             elif test -f /usr/share/java/libloader.jar; then
13086                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13087             else
13088                 AC_MSG_ERROR(libloader.jar replacement not found.)
13089             fi
13090         elif ! test -f  $LIBLOADER_JAR; then
13091             AC_MSG_ERROR(libloader.jar not found.)
13092         fi
13094         if test -z $LIBFORMULA_JAR; then
13095             if test -f /usr/share/java/libformula-0.2.0.jar; then
13096                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13097             elif test -f /usr/share/java/libformula.jar; then
13098                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13099             else
13100                 AC_MSG_ERROR(libformula.jar replacement not found.)
13101             fi
13102         elif ! test -f $LIBFORMULA_JAR; then
13103                 AC_MSG_ERROR(libformula.jar not found.)
13104         fi
13106         if test -z $LIBREPOSITORY_JAR; then
13107             if test -f /usr/share/java/librepository-1.0.0.jar; then
13108                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13109             elif test -f /usr/share/java/librepository.jar; then
13110                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13111             else
13112                 AC_MSG_ERROR(librepository.jar replacement not found.)
13113             fi
13114         elif ! test -f $LIBREPOSITORY_JAR; then
13115             AC_MSG_ERROR(librepository.jar not found.)
13116         fi
13118         if test -z $LIBFONTS_JAR; then
13119             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13120                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13121             elif test -f /usr/share/java/libfonts.jar; then
13122                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13123             else
13124                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13125             fi
13126         elif ! test -f $LIBFONTS_JAR; then
13127                 AC_MSG_ERROR(libfonts.jar not found.)
13128         fi
13130         if test -z $LIBSERIALIZER_JAR; then
13131             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13132                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13133             elif test -f /usr/share/java/libserializer.jar; then
13134                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13135             else
13136                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13137             fi
13138         elif ! test -f $LIBSERIALIZER_JAR; then
13139                 AC_MSG_ERROR(libserializer.jar not found.)
13140         fi
13142         if test -z $LIBBASE_JAR; then
13143             if test -f /usr/share/java/libbase-1.0.0.jar; then
13144                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13145             elif test -f /usr/share/java/libbase.jar; then
13146                 LIBBASE_JAR=/usr/share/java/libbase.jar
13147             else
13148                 AC_MSG_ERROR(libbase.jar replacement not found.)
13149             fi
13150         elif ! test -f $LIBBASE_JAR; then
13151             AC_MSG_ERROR(libbase.jar not found.)
13152         fi
13154     else
13155         AC_MSG_RESULT([internal])
13156         SYSTEM_JFREEREPORT=
13157         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13158         NEED_ANT=TRUE
13159     fi
13160     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13161 else
13162     AC_MSG_RESULT([no])
13163     ENABLE_REPORTBUILDER=
13164     SYSTEM_JFREEREPORT=
13166 AC_SUBST(ENABLE_REPORTBUILDER)
13167 AC_SUBST(SYSTEM_JFREEREPORT)
13168 AC_SUBST(SAC_JAR)
13169 AC_SUBST(LIBXML_JAR)
13170 AC_SUBST(FLUTE_JAR)
13171 AC_SUBST(JFREEREPORT_JAR)
13172 AC_SUBST(LIBBASE_JAR)
13173 AC_SUBST(LIBLAYOUT_JAR)
13174 AC_SUBST(LIBLOADER_JAR)
13175 AC_SUBST(LIBFORMULA_JAR)
13176 AC_SUBST(LIBREPOSITORY_JAR)
13177 AC_SUBST(LIBFONTS_JAR)
13178 AC_SUBST(LIBSERIALIZER_JAR)
13180 # scripting provider for BeanShell?
13181 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13182 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13183     AC_MSG_RESULT([yes])
13184     ENABLE_SCRIPTING_BEANSHELL=TRUE
13186     dnl ===================================================================
13187     dnl Check for system beanshell
13188     dnl ===================================================================
13189     AC_MSG_CHECKING([which beanshell to use])
13190     if test "$with_system_beanshell" = "yes"; then
13191         AC_MSG_RESULT([external])
13192         SYSTEM_BSH=TRUE
13193         if test -z $BSH_JAR; then
13194             BSH_JAR=/usr/share/java/bsh.jar
13195         fi
13196         if ! test -f $BSH_JAR; then
13197             AC_MSG_ERROR(bsh.jar not found.)
13198         fi
13199     else
13200         AC_MSG_RESULT([internal])
13201         SYSTEM_BSH=
13202         BUILD_TYPE="$BUILD_TYPE BSH"
13203     fi
13204 else
13205     AC_MSG_RESULT([no])
13206     ENABLE_SCRIPTING_BEANSHELL=
13207     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13209 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13210 AC_SUBST(SYSTEM_BSH)
13211 AC_SUBST(BSH_JAR)
13213 # scripting provider for JavaScript?
13214 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13215 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13216     AC_MSG_RESULT([yes])
13217     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13219     dnl ===================================================================
13220     dnl Check for system rhino
13221     dnl ===================================================================
13222     AC_MSG_CHECKING([which rhino to use])
13223     if test "$with_system_rhino" = "yes"; then
13224         AC_MSG_RESULT([external])
13225         SYSTEM_RHINO=TRUE
13226         if test -z $RHINO_JAR; then
13227             RHINO_JAR=/usr/share/java/js.jar
13228         fi
13229         if ! test -f $RHINO_JAR; then
13230             AC_MSG_ERROR(js.jar not found.)
13231         fi
13232     else
13233         AC_MSG_RESULT([internal])
13234         SYSTEM_RHINO=
13235         BUILD_TYPE="$BUILD_TYPE RHINO"
13236         NEED_ANT=TRUE
13237     fi
13238 else
13239     AC_MSG_RESULT([no])
13240     ENABLE_SCRIPTING_JAVASCRIPT=
13241     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13243 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13244 AC_SUBST(SYSTEM_RHINO)
13245 AC_SUBST(RHINO_JAR)
13247 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13248 # paths should be added to library search path. So lets put all 64-bit
13249 # platforms there.
13250 supports_multilib=
13251 case "$host_cpu" in
13252 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13253     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13254         supports_multilib="yes"
13255     fi
13256     ;;
13258     ;;
13259 esac
13261 dnl ===================================================================
13262 dnl QT5 Integration
13263 dnl ===================================================================
13265 QT5_CFLAGS=""
13266 QT5_LIBS=""
13267 QT5_GOBJECT_CFLAGS=""
13268 QT5_GOBJECT_LIBS=""
13269 QT5_HAVE_GOBJECT=""
13270 QT5_PLATFORMS_SRCDIR=""
13271 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13272         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13273         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13274 then
13275     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13276     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13278     if test -n "$supports_multilib"; then
13279         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13280     fi
13282     qt5_test_include="QtWidgets/qapplication.h"
13283     if test "$_os" = "Emscripten"; then
13284         qt5_test_library="libQt5Widgets.a"
13285     else
13286         qt5_test_library="libQt5Widgets.so"
13287     fi
13289     dnl Check for qmake5
13290     if test -n "$QT5DIR"; then
13291         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13292     else
13293         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13294     fi
13295     if test "$QMAKE5" = "no"; then
13296         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13297     else
13298         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13299         if test -z "$qmake5_test_ver"; then
13300             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13301         fi
13302         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13303         qt5_minimal_minor="15"
13304         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13305             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13306         else
13307             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13308         fi
13309     fi
13311     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13312     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13313     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13314     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13316     AC_MSG_CHECKING([for Qt5 headers])
13317     qt5_incdir="no"
13318     for inc_dir in $qt5_incdirs; do
13319         if test -r "$inc_dir/$qt5_test_include"; then
13320             qt5_incdir="$inc_dir"
13321             break
13322         fi
13323     done
13324     AC_MSG_RESULT([$qt5_incdir])
13325     if test "x$qt5_incdir" = "xno"; then
13326         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13327     fi
13328     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13329     AC_LANG_PUSH([C++])
13330     save_CPPFLAGS=$CPPFLAGS
13331     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13332     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13333         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13334     CPPFLAGS=$save_CPPFLAGS
13335     AC_LANG_POP([C++])
13337     AC_MSG_CHECKING([for Qt5 libraries])
13338     qt5_libdir="no"
13339     for lib_dir in $qt5_libdirs; do
13340         if test -r "$lib_dir/$qt5_test_library"; then
13341             qt5_libdir="$lib_dir"
13342             break
13343         fi
13344     done
13345     AC_MSG_RESULT([$qt5_libdir])
13346     if test "x$qt5_libdir" = "xno"; then
13347         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13348     fi
13350     if test "$_os" = "Emscripten"; then
13351         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13352             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13353         fi
13354         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13355             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13356         fi
13358         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13359         if ! test -x "$EMSDK_LLVM_NM"; then
13360             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13361         fi
13362         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13363             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13364         fi
13365         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13366         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
13367             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13368         fi
13369         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
13370             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
13371         fi
13372     fi
13374     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13375     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13376     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13377     if test "$_os" = "Emscripten"; then
13378         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13379     fi
13381     if test "$USING_X11" = TRUE; then
13382         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13383         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13384         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13385         QT5_USING_X11=1
13386         AC_DEFINE(QT5_USING_X11)
13387     fi
13389     dnl Check for Meta Object Compiler
13391     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13392     if test "$MOC5" = "no"; then
13393         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13394 the root of your Qt installation by exporting QT5DIR before running "configure".])
13395     fi
13397     if test "$test_gstreamer_1_0" = yes; then
13398         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13399                 QT5_HAVE_GOBJECT=1
13400                 AC_DEFINE(QT5_HAVE_GOBJECT)
13401             ],
13402             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13403         )
13404     fi
13406 AC_SUBST(QT5_CFLAGS)
13407 AC_SUBST(QT5_LIBS)
13408 AC_SUBST(MOC5)
13409 AC_SUBST(QT5_GOBJECT_CFLAGS)
13410 AC_SUBST(QT5_GOBJECT_LIBS)
13411 AC_SUBST(QT5_HAVE_GOBJECT)
13412 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13414 dnl ===================================================================
13415 dnl QT6 Integration
13416 dnl ===================================================================
13418 QT6_CFLAGS=""
13419 QT6_LIBS=""
13420 QT6_PLATFORMS_SRCDIR=""
13421 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13422         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13423 then
13424     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13425     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13427     if test -n "$supports_multilib"; then
13428         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13429     fi
13431     qt6_test_include="QtWidgets/qapplication.h"
13432     if test "$_os" = "Emscripten"; then
13433         qt6_test_library="libQt6Widgets.a"
13434     else
13435         qt6_test_library="libQt6Widgets.so"
13436     fi
13438     dnl Check for qmake6
13439     if test -n "$QT6DIR"; then
13440         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13441     else
13442         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13443     fi
13444     if test "$QMAKE6" = "no"; then
13445         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13446     else
13447         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13448         if test -z "$qmake6_test_ver"; then
13449             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13450         fi
13451         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13452     fi
13454     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13455     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13456     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13457     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13459     AC_MSG_CHECKING([for Qt6 headers])
13460     qt6_incdir="no"
13461     for inc_dir in $qt6_incdirs; do
13462         if test -r "$inc_dir/$qt6_test_include"; then
13463             qt6_incdir="$inc_dir"
13464             break
13465         fi
13466     done
13467     AC_MSG_RESULT([$qt6_incdir])
13468     if test "x$qt6_incdir" = "xno"; then
13469         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13470     fi
13471     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13472     AC_LANG_PUSH([C++])
13473     save_CPPFLAGS=$CPPFLAGS
13474     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13475     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13476         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13477     CPPFLAGS=$save_CPPFLAGS
13478     AC_LANG_POP([C++])
13480     AC_MSG_CHECKING([for Qt6 libraries])
13481     qt6_libdir="no"
13482     for lib_dir in $qt6_libdirs; do
13483         if test -r "$lib_dir/$qt6_test_library"; then
13484             qt6_libdir="$lib_dir"
13485             break
13486         fi
13487     done
13488     AC_MSG_RESULT([$qt6_libdir])
13489     if test "x$qt6_libdir" = "xno"; then
13490         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13491     fi
13493     if test "$_os" = "Emscripten"; then
13494         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13495             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13496         fi
13497         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13498             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13499         fi
13500     fi
13502     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13503     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13504     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13505     if test "$_os" = "Emscripten"; then
13506         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13507     fi
13509     if test "$USING_X11" = TRUE; then
13510         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13511         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13512         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13513         QT6_USING_X11=1
13514         AC_DEFINE(QT6_USING_X11)
13515     fi
13517     dnl Check for Meta Object Compiler
13519     for lib_dir in $qt6_libdirs; do
13520         if test -z "$qt6_libexec_dirs"; then
13521             qt6_libexec_dirs="$lib_dir/libexec"
13522         else
13523             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13524         fi
13525     done
13526     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])
13527     if test "$MOC6" = "no"; then
13528         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13529 the root of your Qt installation by exporting QT6DIR before running "configure".])
13530     else
13531         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13532         if test -z "$moc6_test_ver"; then
13533             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13534         fi
13535         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13536     fi
13538 AC_SUBST(QT6_CFLAGS)
13539 AC_SUBST(QT6_LIBS)
13540 AC_SUBST(MOC6)
13541 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13543 dnl ===================================================================
13544 dnl KF5 Integration
13545 dnl ===================================================================
13547 KF5_CFLAGS=""
13548 KF5_LIBS=""
13549 KF5_CONFIG="kf5-config"
13550 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13551         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13552 then
13553     if test "$OS" = "HAIKU"; then
13554         haiku_arch="`echo $RTL_ARCH | tr X x`"
13555         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13556         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13557     fi
13559     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13560     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13561     if test -n "$supports_multilib"; then
13562         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13563     fi
13565     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13566     kf5_test_library="libKF5KIOFileWidgets.so"
13567     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13569     dnl kf5 KDE4 support compatibility installed
13570     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13571     if test "$KF5_CONFIG" != "no"; then
13572         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13573         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13574     fi
13576     dnl Check for KF5 headers
13577     AC_MSG_CHECKING([for KF5 headers])
13578     kf5_incdir="no"
13579     for kf5_check in $kf5_incdirs; do
13580         if test -r "$kf5_check/$kf5_test_include"; then
13581             kf5_incdir="$kf5_check/KF5"
13582             break
13583         fi
13584     done
13585     AC_MSG_RESULT([$kf5_incdir])
13586     if test "x$kf5_incdir" = "xno"; then
13587         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13588     fi
13590     dnl Check for KF5 libraries
13591     AC_MSG_CHECKING([for KF5 libraries])
13592     kf5_libdir="no"
13593     for kf5_check in $kf5_libdirs; do
13594         if test -r "$kf5_check/$kf5_test_library"; then
13595             kf5_libdir="$kf5_check"
13596             break
13597         fi
13598     done
13600     AC_MSG_RESULT([$kf5_libdir])
13601     if test "x$kf5_libdir" = "xno"; then
13602         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13603     fi
13605     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"
13606     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13607     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13609     if test "$USING_X11" = TRUE; then
13610         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13611     fi
13613     AC_LANG_PUSH([C++])
13614     save_CXXFLAGS=$CXXFLAGS
13615     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13616     AC_MSG_CHECKING([whether KDE is >= 5.0])
13617        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13618 #include <kcoreaddons_version.h>
13620 int main(int argc, char **argv) {
13621        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13622        else return 1;
13624        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13625     CXXFLAGS=$save_CXXFLAGS
13626     AC_LANG_POP([C++])
13628 AC_SUBST(KF5_CFLAGS)
13629 AC_SUBST(KF5_LIBS)
13631 dnl ===================================================================
13632 dnl KF6 Integration
13633 dnl ===================================================================
13635 KF6_CFLAGS=""
13636 KF6_LIBS=""
13637 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13638 then
13639     if test "$OS" = "HAIKU"; then
13640         haiku_arch="`echo $RTL_ARCH | tr X x`"
13641         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13642         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13643     fi
13645     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13646     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13647     if test -n "$supports_multilib"; then
13648         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13649     fi
13651     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13652     kf6_test_library="libKF6KIOFileWidgets.so"
13653     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13655     dnl Check for KF6 headers
13656     AC_MSG_CHECKING([for KF6 headers])
13657     kf6_incdir="no"
13658     for kf6_check in $kf6_incdirs; do
13659         if test -r "$kf6_check/$kf6_test_include"; then
13660             kf6_incdir="$kf6_check/KF6"
13661             break
13662         fi
13663     done
13664     AC_MSG_RESULT([$kf6_incdir])
13665     if test "x$kf6_incdir" = "xno"; then
13666         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13667     fi
13669     dnl Check for KF6 libraries
13670     AC_MSG_CHECKING([for KF6 libraries])
13671     kf6_libdir="no"
13672     for kf6_check in $kf6_libdirs; do
13673         if test -r "$kf6_check/$kf6_test_library"; then
13674             kf6_libdir="$kf6_check"
13675             break
13676         fi
13677     done
13679     AC_MSG_RESULT([$kf6_libdir])
13680     if test "x$kf6_libdir" = "xno"; then
13681         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13682     fi
13684     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"
13685     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13686     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13688     AC_LANG_PUSH([C++])
13689     save_CXXFLAGS=$CXXFLAGS
13690     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13691     dnl KF6 development version as of 2023-06 uses version number 5.240
13692     AC_MSG_CHECKING([whether KDE is >= 5.240])
13693        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13694 #include <kcoreaddons_version.h>
13696 int main(int argc, char **argv) {
13697        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13698        else return 1;
13700        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13701     CXXFLAGS=$save_CXXFLAGS
13702     AC_LANG_POP([C++])
13704 AC_SUBST(KF6_CFLAGS)
13705 AC_SUBST(KF6_LIBS)
13707 dnl ===================================================================
13708 dnl Test whether to include Evolution 2 support
13709 dnl ===================================================================
13710 AC_MSG_CHECKING([whether to enable evolution 2 support])
13711 if test "$enable_evolution2" = yes; then
13712     AC_MSG_RESULT([yes])
13713     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13714     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13715     FilterLibs "${GOBJECT_LIBS}"
13716     GOBJECT_LIBS="${filteredlibs}"
13717     ENABLE_EVOAB2="TRUE"
13718 else
13719     AC_MSG_RESULT([no])
13721 AC_SUBST(ENABLE_EVOAB2)
13722 AC_SUBST(GOBJECT_CFLAGS)
13723 AC_SUBST(GOBJECT_LIBS)
13725 dnl ===================================================================
13726 dnl Test which themes to include
13727 dnl ===================================================================
13728 AC_MSG_CHECKING([which themes to include])
13729 # if none given use default subset of available themes
13730 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13731     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"
13734 WITH_THEMES=""
13735 if test "x$with_theme" != "xno"; then
13736     for theme in $with_theme; do
13737         case $theme in
13738         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" ;;
13739         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13740         esac
13741     done
13743 AC_MSG_RESULT([$WITH_THEMES])
13744 AC_SUBST([WITH_THEMES])
13746 ###############################################################################
13747 # Extensions checking
13748 ###############################################################################
13749 AC_MSG_CHECKING([for extensions integration])
13750 if test "x$enable_extension_integration" != "xno"; then
13751     WITH_EXTENSION_INTEGRATION=TRUE
13752     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13753     AC_MSG_RESULT([yes, use integration])
13754 else
13755     WITH_EXTENSION_INTEGRATION=
13756     AC_MSG_RESULT([no, do not integrate])
13758 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13760 dnl Should any extra extensions be included?
13761 dnl There are standalone tests for each of these below.
13762 WITH_EXTRA_EXTENSIONS=
13763 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13765 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13766 if test "x$with_java" != "xno"; then
13767     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13770 AC_MSG_CHECKING([whether to build opens___.ttf])
13771 if test "$enable_build_opensymbol" = "yes"; then
13772     AC_MSG_RESULT([yes])
13773     AC_PATH_PROG(FONTFORGE, fontforge)
13774     if test -z "$FONTFORGE"; then
13775         AC_MSG_ERROR([fontforge not installed])
13776     fi
13777 else
13778     AC_MSG_RESULT([no])
13779     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13781 AC_SUBST(FONTFORGE)
13783 dnl ===================================================================
13784 dnl Test whether to include fonts
13785 dnl ===================================================================
13786 AC_MSG_CHECKING([whether to include third-party fonts])
13787 if test "$with_fonts" != "no"; then
13788     AC_MSG_RESULT([yes])
13789     WITH_FONTS=TRUE
13790     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13791     AC_DEFINE(HAVE_MORE_FONTS)
13792 else
13793     AC_MSG_RESULT([no])
13794     WITH_FONTS=
13795     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13797 AC_SUBST(WITH_FONTS)
13800 dnl ===================================================================
13801 dnl Test whether to enable online update service
13802 dnl ===================================================================
13803 AC_MSG_CHECKING([whether to enable online update])
13804 ENABLE_ONLINE_UPDATE=
13805 if test "$enable_online_update" = ""; then
13806     AC_MSG_RESULT([no])
13807 else
13808     if test "$enable_online_update" = "mar"; then
13809         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13810     elif test "$enable_online_update" = "yes"; then
13811         if test "$enable_curl" != "yes"; then
13812             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13813         fi
13814         AC_MSG_RESULT([yes])
13815         ENABLE_ONLINE_UPDATE="TRUE"
13816     else
13817         AC_MSG_RESULT([no])
13818     fi
13820 AC_SUBST(ENABLE_ONLINE_UPDATE)
13823 dnl ===================================================================
13824 dnl Test whether to enable mar online update service
13825 dnl ===================================================================
13826 AC_MSG_CHECKING([whether to enable mar online update])
13827 ENABLE_ONLINE_UPDATE_MAR=
13828 if test "$enable_online_update_mar" = yes; then
13829     AC_MSG_RESULT([yes])
13830     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13831     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13832     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13833 else
13834     AC_MSG_RESULT([no])
13836 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13838 AC_MSG_CHECKING([for mar online update baseurl])
13839 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13840 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13841     AC_MSG_RESULT([yes])
13842 else
13843     AC_MSG_RESULT([no])
13845 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13847 AC_MSG_CHECKING([for mar online update certificateder])
13848 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13849 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13850     AC_MSG_RESULT([yes])
13851 else
13852     AC_MSG_RESULT([no])
13854 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13856 AC_MSG_CHECKING([for mar online update certificatename])
13857 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13858 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13859     AC_MSG_RESULT([yes])
13860 else
13861     AC_MSG_RESULT([no])
13863 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13865 AC_MSG_CHECKING([for mar online update certificatepath])
13866 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13867 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13868     AC_MSG_RESULT([yes])
13869 else
13870     AC_MSG_RESULT([no])
13872 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13875 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13876 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13877     if test "x$with_privacy_policy_url" = "xundefined"; then
13878         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13879     fi
13881 AC_SUBST(PRIVACY_POLICY_URL)
13882 dnl ===================================================================
13883 dnl Test whether we need bzip2
13884 dnl ===================================================================
13885 SYSTEM_BZIP2=
13886 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13887     AC_MSG_CHECKING([whether to use system bzip2])
13888     if test "$with_system_bzip2" = yes; then
13889         SYSTEM_BZIP2=TRUE
13890         AC_MSG_RESULT([yes])
13891         PKG_CHECK_MODULES(BZIP2, bzip2)
13892         FilterLibs "${BZIP2_LIBS}"
13893         BZIP2_LIBS="${filteredlibs}"
13894     else
13895         AC_MSG_RESULT([no])
13896         BUILD_TYPE="$BUILD_TYPE BZIP2"
13897     fi
13899 AC_SUBST(SYSTEM_BZIP2)
13900 AC_SUBST(BZIP2_CFLAGS)
13901 AC_SUBST(BZIP2_LIBS)
13903 dnl ===================================================================
13904 dnl Test whether to enable extension update
13905 dnl ===================================================================
13906 AC_MSG_CHECKING([whether to enable extension update])
13907 ENABLE_EXTENSION_UPDATE=
13908 if test "x$enable_extension_update" = "xno"; then
13909     AC_MSG_RESULT([no])
13910 else
13911     AC_MSG_RESULT([yes])
13912     ENABLE_EXTENSION_UPDATE="TRUE"
13913     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13914     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13916 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13919 dnl ===================================================================
13920 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13921 dnl ===================================================================
13922 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13923 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13924     AC_MSG_RESULT([no])
13925     ENABLE_SILENT_MSI=
13926 else
13927     AC_MSG_RESULT([yes])
13928     ENABLE_SILENT_MSI=TRUE
13929     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13931 AC_SUBST(ENABLE_SILENT_MSI)
13933 dnl ===================================================================
13934 dnl Check for WiX tools.
13935 dnl ===================================================================
13936 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13937     AC_MSG_RESULT([no])
13938     ENABLE_WIX=
13939 else
13940     AC_MSG_RESULT([yes])
13941     # FIXME: this should do proper detection, but the path is currently
13942     # hardcoded in msicreator/createmsi.py
13943     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13944       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13945     fi
13946     ENABLE_WIX=TRUE
13948 AC_SUBST(ENABLE_WIX)
13950 AC_MSG_CHECKING([whether and how to use Xinerama])
13951 if test "$USING_X11" = TRUE; then
13952     if test "$x_libraries" = "default_x_libraries"; then
13953         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13954         if test "x$XINERAMALIB" = x; then
13955            XINERAMALIB="/usr/lib"
13956         fi
13957     else
13958         XINERAMALIB="$x_libraries"
13959     fi
13960     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13961         # we have both versions, let the user decide but use the dynamic one
13962         # per default
13963         USE_XINERAMA=TRUE
13964         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13965             XINERAMA_LINK=dynamic
13966         else
13967             XINERAMA_LINK=static
13968         fi
13969     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13970         # we have only the dynamic version
13971         USE_XINERAMA=TRUE
13972         XINERAMA_LINK=dynamic
13973     elif test -e "$XINERAMALIB/libXinerama.a"; then
13974         # static version
13975         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13976             USE_XINERAMA=TRUE
13977             XINERAMA_LINK=static
13978         else
13979             USE_XINERAMA=
13980             XINERAMA_LINK=none
13981         fi
13982     else
13983         # no Xinerama
13984         USE_XINERAMA=
13985         XINERAMA_LINK=none
13986     fi
13987     if test "$USE_XINERAMA" = "TRUE"; then
13988         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13989         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13990             [AC_MSG_ERROR(Xinerama header not found.)], [])
13991         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13992         if test "x$XEXTLIB" = x; then
13993            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13994         fi
13995         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13996         if test "$_os" = "FreeBSD"; then
13997             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13998         fi
13999         if test "$_os" = "Linux"; then
14000             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
14001         fi
14002         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
14003             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
14004     else
14005         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
14006     fi
14007 else
14008     USE_XINERAMA=
14009     XINERAMA_LINK=none
14010     AC_MSG_RESULT([no])
14012 AC_SUBST(XINERAMA_LINK)
14014 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14015 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14016     enable_cairo_rgba=yes
14018 if test "$enable_cairo_rgba" = yes; then
14019     AC_DEFINE(ENABLE_CAIRO_RGBA)
14020     ENABLE_CAIRO_RGBA=TRUE
14021     AC_MSG_RESULT([yes])
14022 else
14023     ENABLE_CAIRO_RGBA=
14024     AC_MSG_RESULT([no])
14026 AC_SUBST(ENABLE_CAIRO_RGBA)
14028 dnl ===================================================================
14029 dnl Test whether to build cairo or rely on the system version
14030 dnl ===================================================================
14032 if test "$test_cairo" = "yes"; then
14033     AC_MSG_CHECKING([whether to use the system cairo])
14035     : ${with_system_cairo:=$with_system_libs}
14036     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14037         SYSTEM_CAIRO=TRUE
14038         AC_MSG_RESULT([yes])
14040         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14041         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14042         FilterLibs "${CAIRO_LIBS}"
14043         CAIRO_LIBS="${filteredlibs}"
14045         if test "$test_xrender" = "yes"; then
14046             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14047             AC_LANG_PUSH([C])
14048             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14049 #ifdef PictStandardA8
14050 #else
14051       return fail;
14052 #endif
14053 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14055             AC_LANG_POP([C])
14056         fi
14057     else
14058         AC_MSG_RESULT([no])
14059         BUILD_TYPE="$BUILD_TYPE CAIRO"
14060     fi
14062     if test "$enable_cairo_canvas" != no; then
14063         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14064         ENABLE_CAIRO_CANVAS=TRUE
14065     fi
14068 AC_SUBST(CAIRO_CFLAGS)
14069 AC_SUBST(CAIRO_LIBS)
14070 AC_SUBST(ENABLE_CAIRO_CANVAS)
14071 AC_SUBST(SYSTEM_CAIRO)
14073 dnl ===================================================================
14074 dnl Test whether to use avahi
14075 dnl ===================================================================
14076 if test "$_os" = "WINNT"; then
14077     # Windows uses bundled mDNSResponder
14078     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14079 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14080     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14081                       [ENABLE_AVAHI="TRUE"])
14082     AC_DEFINE(HAVE_FEATURE_AVAHI)
14083     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14084     FilterLibs "${AVAHI_LIBS}"
14085     AVAHI_LIBS="${filteredlibs}"
14088 AC_SUBST(ENABLE_AVAHI)
14089 AC_SUBST(AVAHI_CFLAGS)
14090 AC_SUBST(AVAHI_LIBS)
14092 dnl ===================================================================
14093 dnl Test whether to use liblangtag
14094 dnl ===================================================================
14095 SYSTEM_LIBLANGTAG=
14096 AC_MSG_CHECKING([whether to use system liblangtag])
14097 if test "$with_system_liblangtag" = yes; then
14098     SYSTEM_LIBLANGTAG=TRUE
14099     AC_MSG_RESULT([yes])
14100     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14101     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14102     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14103     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14104     FilterLibs "${LIBLANGTAG_LIBS}"
14105     LIBLANGTAG_LIBS="${filteredlibs}"
14106 else
14107     SYSTEM_LIBLANGTAG=
14108     AC_MSG_RESULT([no])
14109     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14110     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14111     if test "$COM" = "MSC"; then
14112         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14113     else
14114         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14115     fi
14117 AC_SUBST(SYSTEM_LIBLANGTAG)
14118 AC_SUBST(LIBLANGTAG_CFLAGS)
14119 AC_SUBST(LIBLANGTAG_LIBS)
14121 dnl ===================================================================
14122 dnl Test whether to build libpng or rely on the system version
14123 dnl ===================================================================
14125 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14126 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
14127 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14129 dnl ===================================================================
14130 dnl Test whether to build libtiff or rely on the system version
14131 dnl ===================================================================
14133 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14135 dnl ===================================================================
14136 dnl Test whether to build libwebp or rely on the system version
14137 dnl ===================================================================
14139 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14141 dnl ===================================================================
14142 dnl Check for runtime JVM search path
14143 dnl ===================================================================
14144 if test "$ENABLE_JAVA" != ""; then
14145     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14146     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14147         AC_MSG_RESULT([yes])
14148         if ! test -d "$with_jvm_path"; then
14149             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14150         fi
14151         if ! test -d "$with_jvm_path"jvm; then
14152             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14153         fi
14154         JVM_ONE_PATH_CHECK="$with_jvm_path"
14155         AC_SUBST(JVM_ONE_PATH_CHECK)
14156     else
14157         AC_MSG_RESULT([no])
14158     fi
14161 dnl ===================================================================
14162 dnl Test for the presence of Ant and that it works
14163 dnl ===================================================================
14165 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14166 # breaks filename decoding, so for the ant section, set it to LANG
14167 LC_ALL=$LANG
14168 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14169     ANT_HOME=; export ANT_HOME
14170     WITH_ANT_HOME=; export WITH_ANT_HOME
14171     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14172         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14173             if test "$_os" = "WINNT"; then
14174                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14175             else
14176                 with_ant_home="$LODE_HOME/opt/ant"
14177             fi
14178         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14179             with_ant_home="$LODE_HOME/opt/ant"
14180         fi
14181     fi
14182     if test -z "$with_ant_home"; then
14183         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14184     else
14185         if test "$_os" = "WINNT"; then
14186             # AC_PATH_PROGS needs unix path
14187             PathFormat "$with_ant_home"
14188             with_ant_home="$formatted_path_unix"
14189         fi
14190         AbsolutePath "$with_ant_home"
14191         with_ant_home=$absolute_path
14192         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14193         WITH_ANT_HOME=$with_ant_home
14194         ANT_HOME=$with_ant_home
14195     fi
14197     if test -z "$ANT"; then
14198         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14199     else
14200         # resolve relative or absolute symlink
14201         while test -h "$ANT"; do
14202             a_cwd=`pwd`
14203             a_basename=`basename "$ANT"`
14204             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14205             cd "`dirname "$ANT"`"
14206             cd "`dirname "$a_script"`"
14207             ANT="`pwd`"/"`basename "$a_script"`"
14208             cd "$a_cwd"
14209         done
14211         AC_MSG_CHECKING([if $ANT works])
14212         mkdir -p conftest.dir
14213         a_cwd=$(pwd)
14214         cd conftest.dir
14215         cat > conftest.java << EOF
14216         public class conftest {
14217             int testmethod(int a, int b) {
14218                     return a + b;
14219             }
14220         }
14223         cat > conftest.xml << EOF
14224         <project name="conftest" default="conftest">
14225         <target name="conftest">
14226             <javac srcdir="." includes="conftest.java">
14227             </javac>
14228         </target>
14229         </project>
14232         if test -n "$WSL_ONLY_AS_HELPER"; then
14233             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14234             export JAVACMD="$JAVAINTERPRETER"
14235             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14236             # building the classpath, but we need the windows-style one for the windows-java
14237             PathFormat "$ANT_HOME"
14238             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14239         fi
14240         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14241         if test $? = 0 -a -f ./conftest.class; then
14242             AC_MSG_RESULT([Ant works])
14243             if test -z "$WITH_ANT_HOME"; then
14244                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14245                 if test -z "$ANT_HOME"; then
14246                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14247                 fi
14248             else
14249                 ANT_HOME="$WITH_ANT_HOME"
14250             fi
14251         else
14252             echo "configure: Ant test failed" >&5
14253             cat conftest.java >&5
14254             cat conftest.xml >&5
14255             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14256         fi
14257         cd "$a_cwd"
14258         rm -fr conftest.dir
14259     fi
14260     if test -z "$ANT_HOME"; then
14261         ANT_HOME="NO_ANT_HOME"
14262     else
14263         PathFormat "$ANT_HOME"
14264         ANT_HOME="$formatted_path_unix"
14265         PathFormat "$ANT"
14266         ANT="$formatted_path_unix"
14267     fi
14269     dnl Checking for ant.jar
14270     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14271         AC_MSG_CHECKING([Ant lib directory])
14272         if test -f $ANT_HOME/lib/ant.jar; then
14273             ANT_LIB="$ANT_HOME/lib"
14274         else
14275             if test -f $ANT_HOME/ant.jar; then
14276                 ANT_LIB="$ANT_HOME"
14277             else
14278                 if test -f /usr/share/java/ant.jar; then
14279                     ANT_LIB=/usr/share/java
14280                 else
14281                     if test -f /usr/share/ant-core/lib/ant.jar; then
14282                         ANT_LIB=/usr/share/ant-core/lib
14283                     else
14284                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14285                             ANT_LIB="$ANT_HOME/lib/ant"
14286                         else
14287                             if test -f /usr/share/lib/ant/ant.jar; then
14288                                 ANT_LIB=/usr/share/lib/ant
14289                             else
14290                                 AC_MSG_ERROR([Ant libraries not found!])
14291                             fi
14292                         fi
14293                     fi
14294                 fi
14295             fi
14296         fi
14297         PathFormat "$ANT_LIB"
14298         ANT_LIB="$formatted_path"
14299         AC_MSG_RESULT([Ant lib directory found.])
14300     fi
14302     ant_minver=1.6.0
14303     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14305     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14306     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14307     ant_version_major=`echo $ant_version | cut -d. -f1`
14308     ant_version_minor=`echo $ant_version | cut -d. -f2`
14309     echo "configure: ant_version $ant_version " >&5
14310     echo "configure: ant_version_major $ant_version_major " >&5
14311     echo "configure: ant_version_minor $ant_version_minor " >&5
14312     if test "$ant_version_major" -ge "2"; then
14313         AC_MSG_RESULT([yes, $ant_version])
14314     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14315         AC_MSG_RESULT([yes, $ant_version])
14316     else
14317         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14318     fi
14320     rm -f conftest* core core.* *.core
14322 AC_SUBST(ANT)
14323 AC_SUBST(ANT_HOME)
14324 AC_SUBST(ANT_LIB)
14326 OOO_JUNIT_JAR=
14327 HAMCREST_JAR=
14328 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14329     AC_MSG_CHECKING([for JUnit 4])
14330     if test "$with_junit" = "yes"; then
14331         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14332             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14333         elif test -e /usr/share/java/junit4.jar; then
14334             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14335         else
14336            if test -e /usr/share/lib/java/junit.jar; then
14337               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14338            else
14339               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14340            fi
14341         fi
14342     else
14343         OOO_JUNIT_JAR=$with_junit
14344     fi
14345     if test "$_os" = "WINNT"; then
14346         PathFormat "$OOO_JUNIT_JAR"
14347         OOO_JUNIT_JAR="$formatted_path"
14348     fi
14349     printf 'import org.junit.Before;' > conftest.java
14350     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14351         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14352     else
14353         AC_MSG_ERROR(
14354 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14355  specify its pathname via --with-junit=..., or disable it via --without-junit])
14356     fi
14357     rm -f conftest.class conftest.java
14358     if test $OOO_JUNIT_JAR != ""; then
14359         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14360     fi
14362     AC_MSG_CHECKING([for included Hamcrest])
14363     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14364     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14365         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14366     else
14367         AC_MSG_RESULT([Not included])
14368         AC_MSG_CHECKING([for standalone hamcrest jar.])
14369         if test "$with_hamcrest" = "yes"; then
14370             if test -e /usr/share/lib/java/hamcrest.jar; then
14371                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14372             elif test -e /usr/share/java/hamcrest/core.jar; then
14373                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14374             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14375                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14376             else
14377                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14378             fi
14379         else
14380             HAMCREST_JAR=$with_hamcrest
14381         fi
14382         if test "$_os" = "WINNT"; then
14383             PathFormat "$HAMCREST_JAR"
14384             HAMCREST_JAR="$formatted_path"
14385         fi
14386         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14387             AC_MSG_RESULT([$HAMCREST_JAR])
14388         else
14389             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),
14390                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14391         fi
14392     fi
14393     rm -f conftest.class conftest.java
14395 AC_SUBST(OOO_JUNIT_JAR)
14396 AC_SUBST(HAMCREST_JAR)
14397 # set back LC_ALL to C after the java related tests...
14398 LC_ALL=C
14400 AC_SUBST(SCPDEFS)
14403 # check for wget and curl
14405 WGET=
14406 CURL=
14408 if test "$enable_fetch_external" != "no"; then
14410 CURL=`command -v curl`
14412 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14413     # wget new enough?
14414     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14415     if test $? -eq 0; then
14416         WGET=$i
14417         break
14418     fi
14419 done
14421 if test -z "$WGET" -a -z "$CURL"; then
14422     AC_MSG_ERROR([neither wget nor curl found!])
14427 AC_SUBST(WGET)
14428 AC_SUBST(CURL)
14431 # check for sha256sum
14433 SHA256SUM=
14435 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14436     eval "$i -a 256 --version" > /dev/null 2>&1
14437     ret=$?
14438     if test $ret -eq 0; then
14439         SHA256SUM="$i -a 256"
14440         break
14441     fi
14442 done
14444 if test -z "$SHA256SUM"; then
14445     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14446         eval "$i --version" > /dev/null 2>&1
14447         ret=$?
14448         if test $ret -eq 0; then
14449             SHA256SUM=$i
14450             break
14451         fi
14452     done
14455 if test -z "$SHA256SUM"; then
14456     AC_MSG_ERROR([no sha256sum found!])
14459 AC_SUBST(SHA256SUM)
14461 dnl ===================================================================
14462 dnl Dealing with l10n options
14463 dnl ===================================================================
14464 AC_MSG_CHECKING([which languages to be built])
14465 # get list of all languages
14466 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14467 # the sed command does the following:
14468 #   + if a line ends with a backslash, append the next line to it
14469 #   + adds " on the beginning of the value (after =)
14470 #   + adds " at the end of the value
14471 #   + removes en-US; we want to put it on the beginning
14472 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
14473 [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)]
14474 ALL_LANGS="en-US $completelangiso"
14475 # check the configured localizations
14476 WITH_LANG="$with_lang"
14478 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14479 # (Norwegian is "nb" and "nn".)
14480 if test "$WITH_LANG" = "no"; then
14481     WITH_LANG=
14484 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14485     AC_MSG_RESULT([en-US])
14486 else
14487     AC_MSG_RESULT([$WITH_LANG])
14488     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14489     if test -z "$MSGFMT"; then
14490         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14491             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14492         elif test -x "/opt/lo/bin/msgfmt"; then
14493             MSGFMT="/opt/lo/bin/msgfmt"
14494         else
14495             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14496             if test -z "$MSGFMT"; then
14497                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14498             fi
14499         fi
14500     fi
14501     if test -z "$MSGUNIQ"; then
14502         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14503             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14504         elif test -x "/opt/lo/bin/msguniq"; then
14505             MSGUNIQ="/opt/lo/bin/msguniq"
14506         else
14507             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14508             if test -z "$MSGUNIQ"; then
14509                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14510             fi
14511         fi
14512     fi
14514 AC_SUBST(MSGFMT)
14515 AC_SUBST(MSGUNIQ)
14516 # check that the list is valid
14517 for lang in $WITH_LANG; do
14518     test "$lang" = "ALL" && continue
14519     # need to check for the exact string, so add space before and after the list of all languages
14520     for vl in $ALL_LANGS; do
14521         if test "$vl" = "$lang"; then
14522            break
14523         fi
14524     done
14525     if test "$vl" != "$lang"; then
14526         # if you're reading this - you prolly quoted your languages remove the quotes ...
14527         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14528     fi
14529 done
14530 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14531     echo $WITH_LANG | grep -q en-US
14532     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14534 # list with substituted ALL
14535 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14536 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14537 test "$WITH_LANG" = "en-US" && WITH_LANG=
14538 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14539     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14540     ALL_LANGS=`echo $ALL_LANGS qtz`
14542 AC_SUBST(ALL_LANGS)
14543 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14544 AC_SUBST(WITH_LANG)
14545 AC_SUBST(WITH_LANG_LIST)
14546 AC_SUBST(GIT_NEEDED_SUBMODULES)
14548 WITH_POOR_HELP_LOCALIZATIONS=
14549 if test -d "$SRC_ROOT/translations/source"; then
14550     for l in `ls -1 $SRC_ROOT/translations/source`; do
14551         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14552             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14553         fi
14554     done
14556 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14558 if test -n "$with_locales" -a "$with_locales" != ALL; then
14559     WITH_LOCALES="$with_locales"
14561     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14562     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14563     # config_host/config_locales.h.in
14564     for locale in $WITH_LOCALES; do
14565         lang=${locale%_*}
14567         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14569         case $lang in
14570         hi|mr*ne)
14571             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14572             ;;
14573         bg|ru)
14574             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14575             ;;
14576         esac
14577     done
14578 else
14579     AC_DEFINE(WITH_LOCALE_ALL)
14581 AC_SUBST(WITH_LOCALES)
14583 dnl git submodule update --reference
14584 dnl ===================================================================
14585 if test -n "${GIT_REFERENCE_SRC}"; then
14586     for repo in ${GIT_NEEDED_SUBMODULES}; do
14587         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14588             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14589         fi
14590     done
14592 AC_SUBST(GIT_REFERENCE_SRC)
14594 dnl git submodules linked dirs
14595 dnl ===================================================================
14596 if test -n "${GIT_LINK_SRC}"; then
14597     for repo in ${GIT_NEEDED_SUBMODULES}; do
14598         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14599             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14600         fi
14601     done
14603 AC_SUBST(GIT_LINK_SRC)
14605 dnl branding
14606 dnl ===================================================================
14607 AC_MSG_CHECKING([for alternative branding images directory])
14608 # initialize mapped arrays
14609 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14610 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14612 if test -z "$with_branding" -o "$with_branding" = "no"; then
14613     AC_MSG_RESULT([none])
14614     DEFAULT_BRAND_IMAGES="$brand_files"
14615 else
14616     if ! test -d $with_branding ; then
14617         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14618     else
14619         AC_MSG_RESULT([$with_branding])
14620         CUSTOM_BRAND_DIR="$with_branding"
14621         for lfile in $brand_files
14622         do
14623             if ! test -f $with_branding/$lfile ; then
14624                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14625                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14626             else
14627                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14628             fi
14629         done
14630         check_for_progress="yes"
14631     fi
14633 AC_SUBST([BRAND_INTRO_IMAGES])
14634 AC_SUBST([CUSTOM_BRAND_DIR])
14635 AC_SUBST([CUSTOM_BRAND_IMAGES])
14636 AC_SUBST([DEFAULT_BRAND_IMAGES])
14639 AC_MSG_CHECKING([for 'intro' progress settings])
14640 PROGRESSBARCOLOR=
14641 PROGRESSSIZE=
14642 PROGRESSPOSITION=
14643 PROGRESSFRAMECOLOR=
14644 PROGRESSTEXTCOLOR=
14645 PROGRESSTEXTBASELINE=
14647 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14648     source "$with_branding/progress.conf"
14649     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14650 else
14651     AC_MSG_RESULT([none])
14654 AC_SUBST(PROGRESSBARCOLOR)
14655 AC_SUBST(PROGRESSSIZE)
14656 AC_SUBST(PROGRESSPOSITION)
14657 AC_SUBST(PROGRESSFRAMECOLOR)
14658 AC_SUBST(PROGRESSTEXTCOLOR)
14659 AC_SUBST(PROGRESSTEXTBASELINE)
14662 dnl ===================================================================
14663 dnl Custom build version
14664 dnl ===================================================================
14665 AC_MSG_CHECKING([for extra build ID])
14666 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14667     EXTRA_BUILDID="$with_extra_buildid"
14669 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14670 if test -n "$EXTRA_BUILDID" ; then
14671     AC_MSG_RESULT([$EXTRA_BUILDID])
14672 else
14673     AC_MSG_RESULT([not set])
14675 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14677 OOO_VENDOR=
14678 AC_MSG_CHECKING([for vendor])
14679 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14680     OOO_VENDOR="$USERNAME"
14682     if test -z "$OOO_VENDOR"; then
14683         OOO_VENDOR="$USER"
14684     fi
14686     if test -z "$OOO_VENDOR"; then
14687         OOO_VENDOR="`id -u -n`"
14688     fi
14690     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14691 else
14692     OOO_VENDOR="$with_vendor"
14693     AC_MSG_RESULT([$OOO_VENDOR])
14695 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14696 AC_SUBST(OOO_VENDOR)
14698 if test "$_os" = "Android" ; then
14699     ANDROID_PACKAGE_NAME=
14700     AC_MSG_CHECKING([for Android package name])
14701     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14702         if test -n "$ENABLE_DEBUG"; then
14703             # Default to the package name that makes ndk-gdb happy.
14704             ANDROID_PACKAGE_NAME="org.libreoffice"
14705         else
14706             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14707         fi
14709         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14710     else
14711         ANDROID_PACKAGE_NAME="$with_android_package_name"
14712         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14713     fi
14714     AC_SUBST(ANDROID_PACKAGE_NAME)
14717 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14718 if test "$with_compat_oowrappers" = "yes"; then
14719     WITH_COMPAT_OOWRAPPERS=TRUE
14720     AC_MSG_RESULT(yes)
14721 else
14722     WITH_COMPAT_OOWRAPPERS=
14723     AC_MSG_RESULT(no)
14725 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14727 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14728 AC_MSG_CHECKING([for install dirname])
14729 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14730     INSTALLDIRNAME="$with_install_dirname"
14732 AC_MSG_RESULT([$INSTALLDIRNAME])
14733 AC_SUBST(INSTALLDIRNAME)
14735 AC_MSG_CHECKING([for prefix])
14736 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14737 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14738 PREFIXDIR="$prefix"
14739 AC_MSG_RESULT([$PREFIXDIR])
14740 AC_SUBST(PREFIXDIR)
14742 LIBDIR=[$(eval echo $(eval echo $libdir))]
14743 AC_SUBST(LIBDIR)
14745 DATADIR=[$(eval echo $(eval echo $datadir))]
14746 AC_SUBST(DATADIR)
14748 MANDIR=[$(eval echo $(eval echo $mandir))]
14749 AC_SUBST(MANDIR)
14751 DOCDIR=[$(eval echo $(eval echo $docdir))]
14752 AC_SUBST(DOCDIR)
14754 BINDIR=[$(eval echo $(eval echo $bindir))]
14755 AC_SUBST(BINDIR)
14757 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14758 AC_SUBST(INSTALLDIR)
14760 TESTINSTALLDIR="${BUILDDIR}/test-install"
14761 AC_SUBST(TESTINSTALLDIR)
14764 # ===================================================================
14765 # OAuth2 id and secrets
14766 # ===================================================================
14768 AC_MSG_CHECKING([for Google Drive client id and secret])
14769 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14770     AC_MSG_RESULT([not set])
14771     GDRIVE_CLIENT_ID="\"\""
14772     GDRIVE_CLIENT_SECRET="\"\""
14773 else
14774     AC_MSG_RESULT([set])
14775     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14776     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14778 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14779 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14781 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14782 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14783     AC_MSG_RESULT([not set])
14784     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14785     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14786 else
14787     AC_MSG_RESULT([set])
14788     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14789     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14791 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14792 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14794 AC_MSG_CHECKING([for OneDrive client id and secret])
14795 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14796     AC_MSG_RESULT([not set])
14797     ONEDRIVE_CLIENT_ID="\"\""
14798     ONEDRIVE_CLIENT_SECRET="\"\""
14799 else
14800     AC_MSG_RESULT([set])
14801     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14802     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14804 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14805 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14808 dnl ===================================================================
14809 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14810 dnl --enable-dependency-tracking configure option
14811 dnl ===================================================================
14812 AC_MSG_CHECKING([whether to enable dependency tracking])
14813 if test "$enable_dependency_tracking" = "no"; then
14814     nodep=TRUE
14815     AC_MSG_RESULT([no])
14816 else
14817     AC_MSG_RESULT([yes])
14819 AC_SUBST(nodep)
14821 dnl ===================================================================
14822 dnl Number of CPUs to use during the build
14823 dnl ===================================================================
14824 AC_MSG_CHECKING([for number of processors to use])
14825 # plain --with-parallelism is just the default
14826 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14827     if test "$with_parallelism" = "no"; then
14828         PARALLELISM=0
14829     else
14830         PARALLELISM=$with_parallelism
14831     fi
14832 else
14833     if test "$enable_icecream" = "yes"; then
14834         PARALLELISM="40"
14835     else
14836         case `uname -s` in
14838         Darwin|FreeBSD|NetBSD|OpenBSD)
14839             PARALLELISM=`sysctl -n hw.ncpu`
14840             ;;
14842         Linux)
14843             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14844         ;;
14845         # what else than above does profit here *and* has /proc?
14846         *)
14847             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14848             ;;
14849         esac
14851         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14852         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14853     fi
14856 if test $PARALLELISM -eq 0; then
14857     AC_MSG_RESULT([explicit make -j option needed])
14858 else
14859     AC_MSG_RESULT([$PARALLELISM])
14861 AC_SUBST(PARALLELISM)
14864 # Set up ILIB for MSVC build
14866 ILIB1=
14867 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14868     ILIB="."
14869     if test -n "$JAVA_HOME"; then
14870         ILIB="$ILIB;$JAVA_HOME/lib"
14871     fi
14872     ILIB1=-link
14873     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14874     ILIB="$ILIB;$formatted_path"
14875     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14876     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14877     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14878     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14879         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14880         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14881     fi
14882     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14883     ucrtlibpath_formatted=$formatted_path
14884     ILIB="$ILIB;$ucrtlibpath_formatted"
14885     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14886     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14887         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14888         ILIB="$ILIB;$formatted_path"
14889     else
14890         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14891         ILIB="$ILIB;$formatted_path"
14892     fi
14894     if test "$cross_compiling" != "yes"; then
14895         ILIB_FOR_BUILD="$ILIB"
14896     fi
14898 AC_SUBST(ILIB)
14899 AC_SUBST(ILIB_FOR_BUILD)
14901 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14902 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14903 dnl from consteval constructor initializing const variable",
14904 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14905 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14906 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14907 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14908 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14909 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
14910 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
14911 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14912 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14913 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14914 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
14915 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
14916 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
14917 have_cpp_consteval=
14918 AC_LANG_PUSH([C++])
14919 save_CXX=$CXX
14920 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14921     CXX="env LIB=$ILIB $CXX"
14923 save_CXXFLAGS=$CXXFLAGS
14924 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14925 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14926         struct S {
14927             consteval S() { i = 1; }
14928             int i = 0;
14929         };
14930         S const s;
14932         struct S1 {
14933              int a;
14934              consteval S1(int n): a(n) {}
14935         };
14936         struct S2 {
14937             S1 x;
14938             S2(): x(0) {}
14939         };
14941         struct S3 {
14942             consteval S3() {}
14943             union {
14944                 int a;
14945                 unsigned b = 0;
14946             };
14947         };
14948         void f() { S3(); }
14950         struct S4 { consteval S4() = default; };
14951         void f4(bool b) { b ? S4() : S4(); }
14953         struct S5 {
14954             consteval S5() { c = 0; }
14955             char * f() { return &c; }
14956             union {
14957                 char c;
14958                 int i;
14959             };
14960         };
14961         auto s5 = S5().f();
14963         struct S6 {
14964             consteval S6(char const (&lit)[[2]]) {
14965                 buf[[0]] = lit[[0]];
14966                 buf[[1]] = lit[[1]];
14967             }
14968             union {
14969                 int x;
14970                 char buf[[2]];
14971             };
14972         };
14973         void f6() { S6("a"); }
14974     ], [
14975         return (s.i == 1) ? 0 : 1;
14976     ])], [
14977         have_cpp_consteval=1
14978         AC_MSG_RESULT([yes])
14979     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14980 CXX=$save_CXX
14981 CXXFLAGS=$save_CXXFLAGS
14982 AC_LANG_POP([C++])
14983 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
14984 then
14985     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
14986     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
14987     dnl reference to consteval constructor exported from module" (which also affects PCH, see
14988     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
14989     dnl --enable-pch setup is known broken"):
14990     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
14991     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
14992     rm conftest.cppm
14993     AC_LANG_PUSH([C++])
14994     save_CXXFLAGS=$CXXFLAGS
14995     save_LDFLAGS=$LDFLAGS
14996     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14997     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
14998     AC_LINK_IFELSE([AC_LANG_PROGRAM([
14999         import M;
15000     ], [
15001         struct S2 { S1 s = 0; };
15002         S2 s;
15003     ])], [
15004         AC_MSG_RESULT([yes])
15005     ], [
15006         have_cpp_consteval=
15007         AC_MSG_RESULT([no])])
15008     CXXFLAGS=$save_CXXFLAGS
15009     LDFLAGS=$save_LDFLAGS
15010     AC_LANG_POP([C++])
15011     rm conftest.pcm
15013 if test -n "$have_cpp_consteval"; then
15014     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15017 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15018 dnl ...which is known to not be implemented in libc++ prior to
15019 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15020 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15021 AC_LANG_PUSH([C++])
15022 save_CXX=$CXX
15023 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15024     CXX="env LIB=$ILIB $CXX"
15026 save_CXXFLAGS=$CXXFLAGS
15027 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15028 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15029         #include <compare>
15030     ], [
15031         (void) (std::strong_order(1.0, 2.0) < 0);
15032     ])], [
15033         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15034         AC_MSG_RESULT([yes])
15035     ], [AC_MSG_RESULT([no])])
15036 CXX=$save_CXX
15037 CXXFLAGS=$save_CXXFLAGS
15038 AC_LANG_POP([C++])
15040 # ===================================================================
15041 # Creating bigger shared library to link against
15042 # ===================================================================
15043 AC_MSG_CHECKING([whether to create huge library])
15044 MERGELIBS=
15045 MERGELIBS_MORE=
15047 if test $_os = iOS -o $_os = Android; then
15048     # Never any point in mergelibs for these as we build just static
15049     # libraries anyway...
15050     enable_mergelibs=no
15053 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15054     if test "$enable_mergelibs" = "more"; then
15055         MERGELIBS="TRUE"
15056         MERGELIBS_MORE="TRUE"
15057         AC_MSG_RESULT([yes (more)])
15058         AC_DEFINE(ENABLE_MERGELIBS)
15059         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15060     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15061         MERGELIBS="TRUE"
15062         AC_MSG_RESULT([yes])
15063         AC_DEFINE(ENABLE_MERGELIBS)
15064     else
15065         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15066     fi
15067 else
15068     AC_MSG_RESULT([no])
15070 AC_SUBST([MERGELIBS])
15071 AC_SUBST([MERGELIBS_MORE])
15073 dnl ===================================================================
15074 dnl icerun is a wrapper that stops us spawning tens of processes
15075 dnl locally - for tools that can't be executed on the compile cluster
15076 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15077 dnl ===================================================================
15078 AC_MSG_CHECKING([whether to use icerun wrapper])
15079 ICECREAM_RUN=
15080 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15081     ICECREAM_RUN=icerun
15082     AC_MSG_RESULT([yes])
15083 else
15084     AC_MSG_RESULT([no])
15086 AC_SUBST(ICECREAM_RUN)
15088 dnl ===================================================================
15089 dnl Setup the ICECC_VERSION for the build the same way it was set for
15090 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15091 dnl ===================================================================
15092 x_ICECC_VERSION=[\#]
15093 if test -n "$ICECC_VERSION" ; then
15094     x_ICECC_VERSION=
15096 AC_SUBST(x_ICECC_VERSION)
15097 AC_SUBST(ICECC_VERSION)
15099 dnl ===================================================================
15101 AC_MSG_CHECKING([MPL subset])
15102 MPL_SUBSET=
15103 LICENSE="LGPL"
15105 if test "$enable_mpl_subset" = "yes"; then
15106     mpl_error_string=
15107     newline=$'\n    *'
15108     warn_report=false
15109     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15110         warn_report=true
15111     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15112         warn_report=true
15113     fi
15114     if test "$warn_report" = "true"; then
15115         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15116     fi
15117     if test "x$enable_postgresql_sdbc" != "xno"; then
15118         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15119     fi
15120     if test "$enable_lotuswordpro" = "yes"; then
15121         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15122     fi
15123     if test -n "$ENABLE_POPPLER"; then
15124         if test "x$SYSTEM_POPPLER" = "x"; then
15125             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15126         fi
15127     fi
15128     # cf. m4/libo_check_extension.m4
15129     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15130         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15131     fi
15132     denied_themes=
15133     filtered_themes=
15134     for theme in $WITH_THEMES; do
15135         case $theme in
15136         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15137             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15138         *)
15139             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15140         esac
15141     done
15142     if test "x$denied_themes" != "x"; then
15143         if test "x$filtered_themes" == "x"; then
15144             filtered_themes="colibre"
15145         fi
15146         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15147     fi
15149     ENABLE_OPENGL_TRANSITIONS=
15151     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15152         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15153     fi
15155     if test "x$mpl_error_string" != "x"; then
15156         AC_MSG_ERROR([$mpl_error_string])
15157     fi
15159     MPL_SUBSET="TRUE"
15160     LICENSE="MPL-2.0"
15161     AC_DEFINE(MPL_HAVE_SUBSET)
15162     AC_MSG_RESULT([only])
15163 else
15164     AC_MSG_RESULT([no restrictions])
15166 AC_SUBST(MPL_SUBSET)
15167 AC_SUBST(LICENSE)
15169 dnl ===================================================================
15171 AC_MSG_CHECKING([formula logger])
15172 ENABLE_FORMULA_LOGGER=
15174 if test "x$enable_formula_logger" = "xyes"; then
15175     AC_MSG_RESULT([yes])
15176     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15177     ENABLE_FORMULA_LOGGER=TRUE
15178 elif test -n "$ENABLE_DBGUTIL" ; then
15179     AC_MSG_RESULT([yes])
15180     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15181     ENABLE_FORMULA_LOGGER=TRUE
15182 else
15183     AC_MSG_RESULT([no])
15186 AC_SUBST(ENABLE_FORMULA_LOGGER)
15188 dnl ===================================================================
15189 dnl Checking for active Antivirus software.
15190 dnl ===================================================================
15192 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15193     AC_MSG_CHECKING([for active Antivirus software])
15194     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15195     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15196     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15197         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15198             AC_MSG_RESULT([found])
15199             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15200             echo $EICAR_STRING > $SRC_ROOT/eicar
15201             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15202             rm $SRC_ROOT/eicar
15203             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15204                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15205             fi
15206             echo $EICAR_STRING > $BUILDDIR/eicar
15207             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15208             rm $BUILDDIR/eicar
15209             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15210                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15211             fi
15212             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"
15213         else
15214             AC_MSG_RESULT([not found])
15215         fi
15216     else
15217         AC_MSG_RESULT([n/a])
15218     fi
15221 dnl ===================================================================
15223 AC_MSG_CHECKING([for coredumpctl support])
15224 if test -z "$with_coredumpctl" && test $_os != Linux; then
15225     with_coredumpctl=no
15227 if test "$with_coredumpctl" = no; then
15228     WITH_COREDUMPCTL=
15229 else
15230     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15231     AC_PATH_PROG(JQ, jq)
15232     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15233     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15234     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15235         || test -z "$SYSTEMD_RUN"
15236     then
15237         if test -z "$with_coredumpctl"; then
15238             WITH_COREDUMPCTL=
15239         else
15240             if test -z "$COREDUMPCTL"; then
15241                 AC_MSG_ERROR([coredumpctl not found])
15242             fi
15243             if test -z "$JQ"; then
15244                 AC_MSG_ERROR([jq not found])
15245             fi
15246             if test -z "$SYSTEMD_ESCAPE"; then
15247                 AC_MSG_ERROR([systemd-escape not found])
15248             fi
15249             if test -z "$SYSTEMD_RUN"; then
15250                 AC_MSG_ERROR([systemd-run not found])
15251             fi
15252         fi
15253     else
15254         WITH_COREDUMPCTL=TRUE
15255     fi
15257 if test -z "$WITH_COREDUMPCTL"; then
15258     AC_MSG_RESULT([no])
15259 else
15260     AC_MSG_RESULT([yes])
15262 AC_SUBST(COREDUMPCTL)
15263 AC_SUBST(JQ)
15264 AC_SUBST(SYSTEMD_ESCAPE)
15265 AC_SUBST(SYSTEMD_RUN)
15266 AC_SUBST(WITH_COREDUMPCTL)
15268 dnl ===================================================================
15269 dnl Checking whether to use a keep-awake helper
15270 dnl ===================================================================
15272 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15273 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15274     AC_MSG_RESULT([no])
15275 elif test "$with_keep_awake" = "yes"; then
15276     AC_MSG_RESULT([yes (autodetect)])
15277     AC_MSG_CHECKING([for a suitable keep-awake command])
15278     if test "$_os" = "WINNT"; then
15279         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15280         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15281             AC_MSG_RESULT([using "Awake"])
15282             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15283             # make's PID and then use that to get the windows-PID.
15284             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15285             # much scarier looking than it actually is. Using make's shell instead of subshells in
15286             # the recipe to keep the command that's echoed by make short.
15287             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}'"'"') &'
15288         else
15289             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15290         fi
15291     elif test "$_os" = "Darwin"; then
15292         AC_MSG_RESULT([using "caffeinate"])
15293         KEEP_AWAKE_CMD="caffeinate"
15294     else
15295         AC_MSG_ERROR([no default available for $_os, please specify manually])
15296     fi
15297 else
15298     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15300 AC_SUBST(KEEP_AWAKE_CMD)
15302 dnl ===================================================================
15303 dnl Setting up the environment.
15304 dnl ===================================================================
15305 AC_MSG_NOTICE([setting up the build environment variables...])
15307 AC_SUBST(COMPATH)
15309 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15310     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15311         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15312         ATL_INCLUDE="$COMPATH/atlmfc/include"
15313     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15314         ATL_LIB="$COMPATH/atlmfc/lib"
15315         ATL_INCLUDE="$COMPATH/atlmfc/include"
15316     else
15317         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15318         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15319     fi
15320     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15321     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15322     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15325 if test "$build_os" = "cygwin"; then
15326     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15327     PathFormat "/usr/bin/find.exe"
15328     FIND="$formatted_path"
15329     PathFormat "/usr/bin/sort.exe"
15330     SORT="$formatted_path"
15331     PathFormat "/usr/bin/grep.exe"
15332     WIN_GREP="$formatted_path"
15333     PathFormat "/usr/bin/ls.exe"
15334     WIN_LS="$formatted_path"
15335     PathFormat "/usr/bin/touch.exe"
15336     WIN_TOUCH="$formatted_path"
15337 else
15338     FIND=find
15339     SORT=sort
15342 AC_SUBST(ATL_INCLUDE)
15343 AC_SUBST(ATL_LIB)
15344 AC_SUBST(FIND)
15345 AC_SUBST(SORT)
15346 AC_SUBST(WIN_GREP)
15347 AC_SUBST(WIN_LS)
15348 AC_SUBST(WIN_TOUCH)
15350 AC_SUBST(BUILD_TYPE)
15352 AC_SUBST(SOLARINC)
15354 PathFormat "$PERL"
15355 PERL="$formatted_path"
15356 AC_SUBST(PERL)
15358 if test -n "$TMPDIR"; then
15359     TEMP_DIRECTORY="$TMPDIR"
15360     if test -n "$WSL_ONLY_AS_HELPER"; then
15361        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15362     fi
15363 else
15364     TEMP_DIRECTORY="/tmp"
15366 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15367 if test "$build_os" = "cygwin"; then
15368     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15369     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15371 AC_SUBST(TEMP_DIRECTORY)
15372 AC_SUBST(CYGWIN_BASH)
15374 # setup the PATH for the environment
15375 if test -n "$LO_PATH_FOR_BUILD"; then
15376     LO_PATH="$LO_PATH_FOR_BUILD"
15377     case "$host_os" in
15378     cygwin*|wsl*)
15379         pathmunge "$MSVC_HOST_PATH" "before"
15380         ;;
15381     esac
15382 else
15383     LO_PATH="$PATH"
15385     case "$host_os" in
15387     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15388         if test "$ENABLE_JAVA" != ""; then
15389             pathmunge "$JAVA_HOME/bin" "after"
15390         fi
15391         ;;
15393     cygwin*|wsl*)
15394         # Win32 make needs native paths
15395         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15396             LO_PATH=`cygpath -p -m "$PATH"`
15397         fi
15398         if test "$WIN_BUILD_ARCH" = "x64"; then
15399             # needed for msi packaging
15400             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15401         fi
15402         if test "$WIN_BUILD_ARCH" = "arm64"; then
15403             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15404             # the x86 ones probably would work just as well...
15405             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15406         fi
15407         # .NET 4.6 and higher don't have bin directory
15408         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15409             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15410         fi
15411         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15412         pathmunge "$CSC_PATH" "before"
15413         pathmunge "$MIDL_PATH" "before"
15414         pathmunge "$AL_PATH" "before"
15415         pathmunge "$MSVC_MULTI_PATH" "before"
15416         pathmunge "$MSVC_BUILD_PATH" "before"
15417         if test -n "$MSBUILD_PATH" ; then
15418             pathmunge "$MSBUILD_PATH" "before"
15419         fi
15420         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15421         if test "$ENABLE_JAVA" != ""; then
15422             if test -d "$JAVA_HOME/jre/bin/client"; then
15423                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15424             fi
15425             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15426                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15427             fi
15428             pathmunge "$JAVA_HOME/bin" "before"
15429         fi
15430         pathmunge "$MSVC_HOST_PATH" "before"
15431         ;;
15433     solaris*)
15434         pathmunge "/usr/css/bin" "before"
15435         if test "$ENABLE_JAVA" != ""; then
15436             pathmunge "$JAVA_HOME/bin" "after"
15437         fi
15438         ;;
15439     esac
15442 AC_SUBST(LO_PATH)
15444 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15445 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15446     x_LO_ELFCHECK_ALLOWLIST=
15447 else
15448     x_LO_ELFCHECK_ALLOWLIST=[\#]
15450 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15451 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15453 libo_FUZZ_SUMMARY
15455 # Generate a configuration sha256 we can use for deps
15456 if test -f config_host.mk; then
15457     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15459 if test -f config_host_lang.mk; then
15460     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15463 CFLAGS=$my_original_CFLAGS
15464 CXXFLAGS=$my_original_CXXFLAGS
15465 CPPFLAGS=$my_original_CPPFLAGS
15467 AC_CONFIG_LINKS([include:include])
15469 if test -n "$WSL_ONLY_AS_HELPER"; then
15470     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15471     build=$host
15472     PathFormat "$SRC_ROOT"
15473     SRC_ROOT="$formatted_path"
15474     PathFormat "$BUILDDIR"
15475     BUILDDIR="$formatted_path"
15476     # git-bash has (gnu) tar, curl and sha256sum
15477     CURL="curl.exe"
15478     WGET=
15479     GNUTAR="tar.exe"
15480     SHA256SUM="sha256sum.exe"
15481     # TODO: maybe switch to strawberry-perl right away?
15482     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15483     PERL="perl.exe"
15484     # use flex, gperf and nasm from wsl-container
15485     # if using absolute path, would need to use double-leading slash for the msys path mangling
15486     FLEX="$WSL $FLEX"
15487     NASM="$WSL $NASM"
15488     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15489     # with an absolute path/requires the value to begin with a slash
15490     GPERF="/c/Windows/system32/$WSL gperf"
15491     # append strawberry tools dir to PATH (for e.g. windres, ar)
15492     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15493     # temp-dir needs to be in windows realm, hardcode for now
15494     if test "$TEMP_DIRECTORY" = /tmp; then
15495         mkdir -p tmp
15496         TEMP_DIRECTORY="$BUILDDIR/tmp"
15497     fi
15500 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15501 # BUILD platform configuration] - otherwise breaks cross building
15502 AC_CONFIG_FILES([
15503                  config_host_lang.mk
15504                  Makefile
15505                  bin/bffvalidator.sh
15506                  bin/odfvalidator.sh
15507                  bin/officeotron.sh
15508                  instsetoo_native/util/openoffice.lst
15509                  sysui/desktop/macosx/Info.plist
15510                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15511                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15512                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15513 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15514 # easier to do it in a postprocessing command than to modify every single variable
15515 AC_CONFIG_FILES([config_host.mk], [
15516     if test -n "$WSL_ONLY_AS_HELPER"; then
15517         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15518     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15520 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15521 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15522 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15523 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15524 AC_CONFIG_HEADERS([config_host/config_clang.h])
15525 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15526 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15527 AC_CONFIG_HEADERS([config_host/config_eot.h])
15528 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15529 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15530 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15531 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15532 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15533 AC_CONFIG_HEADERS([config_host/config_features.h])
15534 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15535 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15536 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15537 AC_CONFIG_HEADERS([config_host/config_folders.h])
15538 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15539 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15540 AC_CONFIG_HEADERS([config_host/config_gio.h])
15541 AC_CONFIG_HEADERS([config_host/config_global.h])
15542 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15543 AC_CONFIG_HEADERS([config_host/config_java.h])
15544 AC_CONFIG_HEADERS([config_host/config_langs.h])
15545 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15546 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15547 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15548 AC_CONFIG_HEADERS([config_host/config_locales.h])
15549 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15550 AC_CONFIG_HEADERS([config_host/config_oox.h])
15551 AC_CONFIG_HEADERS([config_host/config_options.h])
15552 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15553 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15554 AC_CONFIG_HEADERS([config_host/config_skia.h])
15555 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15556 AC_CONFIG_HEADERS([config_host/config_validation.h])
15557 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15558 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15559 AC_CONFIG_HEADERS([config_host/config_version.h])
15560 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15561 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15562 AC_CONFIG_HEADERS([config_host/config_python.h])
15563 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15564 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15565 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15566 AC_OUTPUT
15568 if test "$CROSS_COMPILING" = TRUE; then
15569     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15572 # touch the config timestamp file
15573 if test ! -f config_host.mk.stamp; then
15574     echo > config_host.mk.stamp
15575 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15576     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15577 else
15578     echo > config_host.mk.stamp
15581 # touch the config lang timestamp file
15582 if test ! -f config_host_lang.mk.stamp; then
15583     echo > config_host_lang.mk.stamp
15584 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15585     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15586 else
15587     echo > config_host_lang.mk.stamp
15591 if test \( "$STALE_MAKE" = "TRUE" \) \
15592         -a "$build_os" = "cygwin"; then
15594 cat << _EOS
15595 ****************************************************************************
15596 WARNING:
15597 Your make version is known to be horribly slow, and hard to debug
15598 problems with. To get a reasonably functional make please do:
15600 to install a pre-compiled binary make for Win32
15602  mkdir -p /opt/lo/bin
15603  cd /opt/lo/bin
15604  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15605  cp make-4.2.1-msvc.exe make
15606  chmod +x make
15608 to install from source:
15609 place yourself in a working directory of you choice.
15611  git clone git://git.savannah.gnu.org/make.git
15613  [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"]
15614  set PATH=%PATH%;C:\Cygwin\bin
15615  [or Cygwin64, if that is what you have]
15616  cd path-to-make-repo-you-cloned-above
15617  build_w32.bat --without-guile
15619 should result in a WinRel/gnumake.exe.
15620 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15622 Then re-run autogen.sh
15624 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15625 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15627 _EOS
15631 cat << _EOF
15632 ****************************************************************************
15634 To show information on various make targets and make flags, run:
15635 $GNUMAKE help
15637 To just build, run:
15638 $GNUMAKE
15640 _EOF
15642 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15643     cat << _EOF
15644 After the build has finished successfully, you can immediately run what you built using the command:
15645 _EOF
15647     if test $_os = Darwin; then
15648         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15649     else
15650         echo instdir/program/soffice
15651     fi
15652     cat << _EOF
15654 If you want to run the unit tests, run:
15655 $GNUMAKE check
15657 _EOF
15660 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15661     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15662     cat "$WARNINGS_FILE_FOR_BUILD"
15663     echo
15666 if test -s "$WARNINGS_FILE"; then
15667     echo "HOST config ($WARNINGS_FILE)"
15668     cat "$WARNINGS_FILE"
15671 # Remove unneeded emconfigure artifacts
15672 rm -f a.out a.wasm a.out.js a.out.wasm
15674 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: