tdf#161354: drop incorrect assertion
[libreoffice.git] / configure.ac
blob900f8227c01f37492c14e6082ef9af0753b7df04
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.alpha1+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
45 FilterLibs()
47     # Return value: $filteredlibs
49     filteredlibs=
50     if test "$COM" = "MSC"; then
51         for f in $1; do
52             if test "x$f" != "x${f#-L}"; then
53                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
54             elif test "x$f" != "x${f#-l}"; then
55                 filteredlibs="$filteredlibs ${f:2}.lib"
56             else
57                 filteredlibs="$filteredlibs $f"
58             fi
59         done
60     else
61         for f in $1; do
62             case "$f" in
63                 # let's start with Fedora's paths for now
64                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
65                     # ignore it: on UNIXoids it is searched by default anyway
66                     # but if it's given explicitly then it may override other paths
67                     # (on macOS it would be an error to use it instead of SDK)
68                     ;;
69                 *)
70                     filteredlibs="$filteredlibs $f"
71                     ;;
72             esac
73         done
74     fi
77 PathFormat()
79     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
80     # function is called also on Unix.
81     #
82     # Return value: $formatted_path and $formatted_path_unix.
83     #
84     # $formatted_path is the argument in Windows format, but using forward slashes instead of
85     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
86     # or shell metacharacters).
87     #
88     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
89     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
90     # Unix pathname.
91     #
92     # Errors out if 8.3 names are needed but aren't present for some of the path components.
94     # Examples:
95     #
96     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
97     #
98     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
99     #
100     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
101     #
102     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
103     #
104     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
105     #
106     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
107     #
108     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
110     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
111         printf "PathFormat $1 ==> "
112     fi
114     formatted_path="$1"
115     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
116         if test "$build_os" = "wsl"; then
117             formatted_path=$(echo "$formatted_path" | tr -d '\r')
118         fi
120         pf_conv_to_dos=
121         # spaces,parentheses,brackets,braces are problematic in pathname
122         # so are backslashes
123         case "$formatted_path" in
124             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
125                 pf_conv_to_dos="yes"
126             ;;
127         esac
128         if test "$pf_conv_to_dos" = "yes"; then
129             if test "$build_os" = "wsl"; then
130                 case "$formatted_path" in
131                     /*)
132                         formatted_path=$(wslpath -w "$formatted_path")
133                         ;;
134                 esac
135                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
136             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
137                 formatted_path=`cygpath -sm "$formatted_path"`
138             else
139                 formatted_path=`cygpath -d "$formatted_path"`
140             fi
141             if test $? -ne 0;  then
142                 AC_MSG_ERROR([path conversion failed for "$1".])
143             fi
144         fi
145         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
146         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
147         if test "$fp_count_slash$fp_count_colon" != "00"; then
148             if test "$fp_count_colon" = "0"; then
149                 new_formatted_path=`realpath "$formatted_path"`
150                 if test $? -ne 0;  then
151                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
152                 else
153                     formatted_path="$new_formatted_path"
154                 fi
155             fi
156             if test "$build_os" = "wsl"; then
157                 if test "$fp_count_colon" != "0"; then
158                     formatted_path=$(wslpath "$formatted_path")
159                     local final_slash=
160                     case "$formatted_path" in
161                         */)
162                             final_slash=/
163                             ;;
164                     esac
165                     formatted_path=$(wslpath -m $formatted_path)
166                     case "$formatted_path" in
167                         */)
168                             ;;
169                         *)
170                             formatted_path="$formatted_path"$final_slash
171                             ;;
172                     esac
173                 else
174                     formatted_path=$(wslpath -m "$formatted_path")
175                 fi
176             else
177                 formatted_path=`cygpath -m "$formatted_path"`
178             fi
179             if test $? -ne 0;  then
180                 AC_MSG_ERROR([path conversion failed for "$1".])
181             fi
182         fi
183         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
184         if test "$fp_count_space" != "0"; then
185             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
186         fi
187     fi
188     if test "$build_os" = "wsl"; then
189         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
190         formatted_path_unix=$(wslpath "$formatted_path")
191     else
192         # But Cygwin can
193         formatted_path_unix="$formatted_path"
194     fi
195     if test -n "$WSL_ONLY_AS_HELPER"; then
196         # if already in unix format, switch to windows format to create shortened path
197         case "$formatted_path" in
198             /*)
199                 formatted_path=$(wslpath -m "$formatted_path")
200                 ;;
201         esac
203         # cd to /mnt/c to avoid wsl/cmd complaining about not supporting UNC paths/the current working directory
204         formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
205         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
206         formatted_path=$(wslpath -m "$formatted_path_unix")
207     fi
210 AbsolutePath()
212     # There appears to be no simple and portable method to get an absolute and
213     # canonical path, so we try creating the directory if does not exist and
214     # utilizing the shell and pwd.
216     # Args: $1: A possibly relative pathname
217     # Return value: $absolute_path
219     # Convert to unix path, mkdir would treat c:/path as a relative path.
220     PathFormat "$1"
221     local rel="$formatted_path_unix"
222     absolute_path=""
223     test ! -e "$rel" && mkdir -p "$rel"
224     if test -d "$rel" ; then
225         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
226         absolute_path="$(pwd)"
227         cd - > /dev/null
228     else
229         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
230     fi
233 WARNINGS_FILE=config.warn
234 WARNINGS_FILE_FOR_BUILD=config.Build.warn
235 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
236 have_WARNINGS="no"
237 add_warning()
239     if test "$have_WARNINGS" = "no"; then
240         echo "*************************************" > "$WARNINGS_FILE"
241         have_WARNINGS="yes"
242         if command -v tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
243             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
244             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
245         else
246             COLORWARN="* WARNING :"
247         fi
248     fi
249     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
252 dnl Some Mac User have the bad habit of letting a lot of crap
253 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
254 dnl that confuse the build.
255 dnl For the ones that use LODE, let's be nice and protect them
256 dnl from themselves
258 mac_sanitize_path()
260     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
261 dnl a common but nevertheless necessary thing that may be in a fancy
262 dnl path location is git, so make sure we have it
263     mac_git_path=`command -v git`
264     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
265         mac_path="$mac_path:`dirname $mac_git_path`"
266     fi
267 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
268 dnl path location is gpg, so make sure we find it
269     mac_gpg_path=`command -v gpg`
270     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
271         mac_path="$mac_path:`dirname $mac_gpg_path`"
272     fi
273     PATH="$mac_path"
274     unset mac_path
275     unset mac_git_path
276     unset mac_gpg_path
279 dnl semantically test a three digits version
280 dnl $1 - $3 = minimal version
281 dnl $4 - $6 = current version
283 check_semantic_version_three()
285     test "$4" -gt "$1" \
286         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
287         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
288     return $?
291 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
292 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
293 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
295 check_semantic_version_three_prefixed()
297     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
298     eval local MIN_MINOR="\$${1}_${2}_MINOR"
299     eval local MIN_TINY="\$${1}_${2}_TINY"
300     eval local CUR_MAJOR="\$${1}_MAJOR"
301     eval local CUR_MINOR="\$${1}_MINOR"
302     eval local CUR_TINY="\$${1}_TINY"
303     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
304     return $?
307 echo "********************************************************************"
308 echo "*"
309 echo "*   Running ${PACKAGE_NAME} build configuration."
310 echo "*"
311 echo "********************************************************************"
312 echo ""
314 dnl ===================================================================
315 dnl checks build and host OSes
316 dnl do this before argument processing to allow for platform dependent defaults
317 dnl ===================================================================
319 # are we running in wsl but are called from git-bash/env with mingw64 in path?
320 # if so, we aim to run nearly everything in the Windows realm, and only run autogen/configure
321 # in wsl and run a few tools via wsl
322 WSL_ONLY_AS_HELPER=
323 if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then
324     WSL_ONLY_AS_HELPER=TRUE
325     AC_ARG_WITH([strawberry-perl-portable],
326         [AS_HELP_STRING([--with-strawberry-perl-portable],
327             [Specify the base path to strawberry perl portable])],
328         [],
329         [AC_MSG_ERROR(
330             [for the moment strawberry-perl-portable is a requirement, feel free to replace it])])
331     shortpath_cmd=$(wslpath -m $srcdir/solenv/bin/shortpath.cmd)
332     PathFormat "$with_strawberry_perl_portable"
333     if test ! -f "$formatted_path_unix/perl/bin/perl.exe" -o ! -d "$formatted_path_unix/c/bin"; then
334         AC_MSG_ERROR([$formatted_path doesn't contain perl or the utilities - sure you provided the base path?])
335     fi
336     STRAWBERRY_TOOLS="$formatted_path/c/bin"
337     STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
338     AC_ARG_WITH([wsl-command],
339         [AS_HELP_STRING([--with-wsl-command],
340             [Specify your wsl distro command if it isn't the default/the one used with just wsl.exe â€“
341              for example: wsl.exe -d MyDistro -u NonDefaultUser])],
342         [],
343         [with_wsl_command="wsl.exe"])
344     WSL="$with_wsl_command"
346 AC_SUBST([STRAWBERRY_PERL])
347 AC_SUBST([WSL])
349 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
350 # Linux on WSL) trust that.
351 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
352     ac_cv_host="x86_64-pc-wsl"
353     ac_cv_host_cpu="x86_64"
354     ac_cv_host_os="wsl"
355     ac_cv_build="$ac_cv_host"
356     ac_cv_build_cpu="$ac_cv_host_cpu"
357     ac_cv_build_os="$ac_cv_host_os"
359     # Emulation of Cygwin's cygpath command for WSL.
360     cygpath()
361     {
362         if test -n "$UNITTEST_WSL_CYGPATH"; then
363             echo -n cygpath "$@" "==> "
364         fi
366         # Cygwin's real cygpath has a plethora of options but we use only a few here.
367         local args="$@"
368         local opt
369         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
370         OPTIND=1
372         while getopts dmuwlsp opt; do
373             case "$opt" in
374                 \?)
375                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
376                     ;;
377                 ?)
378                     eval opt_$opt=yes
379                     ;;
380             esac
381         done
383         shift $((OPTIND-1))
385         if test $# -ne 1; then
386             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
387         fi
389         local input="$1"
391         local result
393         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
394             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
396             if test -n "$opt_u"; then
397                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
398             fi
400             case "$input" in
401                 /mnt/*)
402                     # A Windows file in WSL format
403                     input=$(wslpath -w "$input")
404                     ;;
405                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
406                     # Already in Windows format
407                     ;;
408                 /*)
409                     input=$(wslpath -w "$input")
410                     ;;
411                 *)
412                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
413                     ;;
414             esac
415             if test -n "$opt_d" -o -n "$opt_s"; then
416                 input=$($WSL_LO_HELPER --8.3 "$input")
417             fi
418             if test -n "$opt_m"; then
419                 input="${input//\\//}"
420             fi
421             echo "$input"
422         else
423             # Print Unix path
425             case "$input" in
426                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
427                     wslpath -u "$input"
428                     ;;
429                 /)
430                     echo "$input"
431                     ;;
432                 *)
433                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
434                     ;;
435             esac
436         fi
437     }
439     if test -n "$UNITTEST_WSL_CYGPATH"; then
440         BUILDDIR=.
442         # Nothing special with these file names, just arbitrary ones picked to test with
443         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
444         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
445         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
446         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
447         # At least on my machine for instance this file does have an 8.3 name
448         cygpath -d /mnt/c/windows/WindowsUpdate.log
449         # But for instance this one doesn't
450         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
451         cygpath -ws /mnt/c/windows/WindowsUpdate.log
452         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
453         cygpath -ms /mnt/c/windows/WindowsUpdate.log
455         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
456         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
458         exit 0
459     fi
461     if test -z "$WSL_LO_HELPER"; then
462         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
463             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
464         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
465             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
466         fi
467     fi
468     if test -z "$WSL_LO_HELPER"; then
469         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
470     fi
473 AC_CANONICAL_HOST
474 AC_CANONICAL_BUILD
476 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
477     BUILDDIR=.
478     GREP=grep
480     # Use of PathFormat must be after AC_CANONICAL_BUILD above
481     PathFormat /
482     printf "$formatted_path , $formatted_path_unix\n"
484     PathFormat $PWD
485     printf "$formatted_path , $formatted_path_unix\n"
487     PathFormat "$PROGRAMFILESX86"
488     printf "$formatted_path , $formatted_path_unix\n"
490     exit 0
493 AC_MSG_CHECKING([for product name])
494 PRODUCTNAME="AC_PACKAGE_NAME"
495 if test -n "$with_product_name" -a "$with_product_name" != no; then
496     PRODUCTNAME="$with_product_name"
498 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
499     PRODUCTNAME="${PRODUCTNAME}Dev"
501 AC_MSG_RESULT([$PRODUCTNAME])
502 AC_SUBST(PRODUCTNAME)
503 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
504 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
506 dnl ===================================================================
507 dnl Our version is defined by the AC_INIT() at the top of this script.
508 dnl ===================================================================
510 AC_MSG_CHECKING([for package version])
511 if test -n "$with_package_version" -a "$with_package_version" != no; then
512     PACKAGE_VERSION="$with_package_version"
514 AC_MSG_RESULT([$PACKAGE_VERSION])
516 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
518 LIBO_VERSION_MAJOR=$1
519 LIBO_VERSION_MINOR=$2
520 LIBO_VERSION_MICRO=$3
521 LIBO_VERSION_PATCH=$4
523 LIBO_VERSION_SUFFIX=$5
525 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
526 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
527 # they get undoubled before actually passed to sed.
528 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
529 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
530 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
531 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
533 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
534 # three non-negative integers. Please find more information about CFBundleVersion at
535 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
537 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
538 # of at most three non-negative integers. Please find more information about
539 # CFBundleShortVersionString at
540 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
542 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
544 if test "$enable_macosx_sandbox" = yes; then
545     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
546     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
547 else
548     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
549     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
552 AC_SUBST(LIBO_VERSION_MAJOR)
553 AC_SUBST(LIBO_VERSION_MINOR)
554 AC_SUBST(LIBO_VERSION_MICRO)
555 AC_SUBST(LIBO_VERSION_PATCH)
556 AC_SUBST(LIBO_VERSION_SUFFIX)
557 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
558 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
559 AC_SUBST(MACOSX_BUNDLE_VERSION)
561 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
562 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
563 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
564 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
566 git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>/dev/null`
567 LIBO_THIS_YEAR=${git_date:-2024}
568 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
570 dnl ===================================================================
571 dnl Product version
572 dnl ===================================================================
573 AC_MSG_CHECKING([for product version])
574 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
575 AC_MSG_RESULT([$PRODUCTVERSION])
576 AC_SUBST(PRODUCTVERSION)
578 AC_PROG_EGREP
579 # AC_PROG_EGREP doesn't set GREP on all systems as well
580 AC_PATH_PROG(GREP, grep)
582 BUILDDIR=`pwd`
583 cd $srcdir
584 SRC_ROOT=`pwd`
585 cd $BUILDDIR
586 x_Cygwin=[\#]
588 dnl ======================================
589 dnl Required GObject introspection version
590 dnl ======================================
591 INTROSPECTION_REQUIRED_VERSION=1.32.0
593 dnl ===================================================================
594 dnl Search all the common names for GNU Make
595 dnl ===================================================================
596 AC_MSG_CHECKING([for GNU Make])
598 # try to use our own make if it is available and GNUMAKE was not already defined
599 if test -z "$GNUMAKE"; then
600     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
601         GNUMAKE="$LODE_HOME/opt/bin/make"
602     elif test -x "/opt/lo/bin/make"; then
603         GNUMAKE="/opt/lo/bin/make"
604     fi
607 GNUMAKE_WIN_NATIVE=
608 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
609     if test -n "$a"; then
610         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
611         if test $? -eq 0;  then
612             if test "$build_os" = "cygwin"; then
613                 if test -n "$($a -v | grep 'Built for Windows')" ; then
614                     GNUMAKE="$(cygpath -m "$(command -v "$(cygpath -u $a)")")"
615                     GNUMAKE_WIN_NATIVE="TRUE"
616                 else
617                     GNUMAKE=`command -v $a`
618                 fi
619             else
620                 GNUMAKE=`command -v $a`
621             fi
622             break
623         fi
624     fi
625 done
626 AC_MSG_RESULT($GNUMAKE)
627 if test -z "$GNUMAKE"; then
628     AC_MSG_ERROR([not found. install GNU Make.])
629 else
630     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
631         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
632     fi
635 win_short_path_for_make()
637     local short_path="$1"
638     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
639         cygpath -sm "$short_path"
640     elif test -n "$WSL_ONLY_AS_HELPER"; then
641         # when already unix-style path, wslpath doesn't return anything
642         case "$short_path" in
643         /*)
644             echo $short_path
645             exit
646             ;;
647         esac
648         wslpath -m "$(wslpath -u "$short_path")"
649     else
650         cygpath -u "$(cygpath -d "$short_path")"
651     fi
655 if test "$build_os" = "cygwin"; then
656     PathFormat "$SRC_ROOT"
657     SRC_ROOT="$formatted_path"
658     PathFormat "$BUILDDIR"
659     BUILDDIR="$formatted_path"
660     x_Cygwin=
661     AC_MSG_CHECKING(for explicit COMSPEC)
662     if test -z "$COMSPEC"; then
663         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
664     else
665         AC_MSG_RESULT([found: $COMSPEC])
666     fi
669 AC_SUBST(SRC_ROOT)
670 AC_SUBST(BUILDDIR)
671 AC_SUBST(x_Cygwin)
672 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
673 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
674 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
676 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
677     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
680 # need sed in os checks...
681 AC_PATH_PROGS(SED, sed)
682 if test -z "$SED"; then
683     AC_MSG_ERROR([install sed to run this script])
686 # Set the ENABLE_LTO variable
687 # ===================================================================
688 AC_MSG_CHECKING([whether to use link-time optimization])
689 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
690     ENABLE_LTO="TRUE"
691     AC_MSG_RESULT([yes])
692 else
693     ENABLE_LTO=""
694     AC_MSG_RESULT([no])
696 AC_SUBST(ENABLE_LTO)
698 AC_ARG_ENABLE(fuzz-options,
699     AS_HELP_STRING([--enable-fuzz-options],
700         [Randomly enable or disable each of those configurable options
701          that are supposed to be freely selectable without interdependencies,
702          or where bad interaction from interdependencies is automatically avoided.])
705 dnl ===================================================================
706 dnl When building for Android, --with-android-ndk,
707 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
708 dnl mandatory
709 dnl ===================================================================
711 AC_ARG_WITH(android-ndk,
712     AS_HELP_STRING([--with-android-ndk],
713         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
716 AC_ARG_WITH(android-ndk-toolchain-version,
717     AS_HELP_STRING([--with-android-ndk-toolchain-version],
718         [Specify which toolchain version to use, of those present in the
719         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
720         with_android_ndk_toolchain_version=clang5.0)
722 AC_ARG_WITH(android-sdk,
723     AS_HELP_STRING([--with-android-sdk],
724         [Specify location of the Android SDK. Mandatory when building for Android.]),
727 AC_ARG_WITH(android-api-level,
728     AS_HELP_STRING([--with-android-api-level],
729         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
732 ANDROID_NDK_DIR=
733 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
734     with_android_ndk="$SRC_ROOT/external/android-ndk"
736 if test -n "$with_android_ndk"; then
737     eval ANDROID_NDK_DIR=$with_android_ndk
739     ANDROID_API_LEVEL=21
740     if test -n "$with_android_api_level" ; then
741         ANDROID_API_LEVEL="$with_android_api_level"
742     fi
744     if test $host_cpu = arm; then
745         LLVM_TRIPLE=armv7a-linux-androideabi
746         ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
747         ANDROID_APP_ABI=armeabi-v7a
748         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
749     elif test $host_cpu = aarch64; then
750         LLVM_TRIPLE=aarch64-linux-android
751         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
752         ANDROID_APP_ABI=arm64-v8a
753     elif test $host_cpu = x86_64; then
754         LLVM_TRIPLE=x86_64-linux-android
755         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
756         ANDROID_APP_ABI=x86_64
757     else
758         # host_cpu is something like "i386" or "i686" I guess, NDK uses
759         # "x86" in some contexts
760         LLVM_TRIPLE=i686-linux-android
761         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
762         ANDROID_APP_ABI=x86
763     fi
765     # Set up a lot of pre-canned defaults
767     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
768         if test ! -f $ANDROID_NDK_DIR/source.properties; then
769             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
770         fi
771         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
772     else
773         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
774     fi
775     if test -z "$ANDROID_NDK_VERSION";  then
776         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
777     fi
778     case $ANDROID_NDK_VERSION in
779     r9*|r10*)
780         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
781         ;;
782     11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
783         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
784         ;;
785     23.*|24.*|25.*)
786         ;;
787     *)
788         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
789         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
790         ;;
791     esac
793     case "$with_android_ndk_toolchain_version" in
794     clang5.0)
795         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
796         ;;
797     *)
798         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
799     esac
801     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
803     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
804     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
805     # manage to link the (app-specific) single huge .so that is built for the app in
806     # android/source/ if there is debug information in a significant part of the object files.
807     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
808     # all objects have been built with debug information.)
809     case $build_os in
810     linux-gnu*)
811         android_HOST_TAG=linux-x86_64
812         ;;
813     darwin*)
814         android_HOST_TAG=darwin-x86_64
815         ;;
816     *)
817         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
818         # ndk would also support windows and windows-x86_64
819         ;;
820     esac
821     ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
822     ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
824     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
825     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
826     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
827     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
828     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
830     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
831     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
832     if test "$ENABLE_LTO" = TRUE; then
833         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
834         # $CC and $CXX when building external libraries
835         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
836     fi
838     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
840     if test -z "$CC"; then
841         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
842         CC_BASE="clang"
843     fi
844     if test -z "$CXX"; then
845         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
846         CXX_BASE="clang++"
847     fi
849 AC_SUBST(ANDROID_NDK_DIR)
850 AC_SUBST(ANDROID_NDK_VERSION)
851 AC_SUBST(ANDROID_API_LEVEL)
852 AC_SUBST(ANDROID_APP_ABI)
853 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
854 AC_SUBST(ANDROID_SYSROOT_PLATFORM)
855 AC_SUBST(ANDROID_TOOLCHAIN)
857 dnl ===================================================================
858 dnl --with-android-sdk
859 dnl ===================================================================
860 ANDROID_SDK_DIR=
861 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
862     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
864 if test -n "$with_android_sdk"; then
865     eval ANDROID_SDK_DIR=$with_android_sdk
866     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
868 AC_SUBST(ANDROID_SDK_DIR)
870 AC_ARG_ENABLE([android-lok],
871     AS_HELP_STRING([--enable-android-lok],
872         [The Android app from the android/ subdir needs several tweaks all
873          over the place that break the LOK when used in the Online-based
874          Android app.  This switch indicates that the intent of this build is
875          actually the Online-based, non-modified LOK.])
877 ENABLE_ANDROID_LOK=
878 if test -n "$ANDROID_NDK_DIR" ; then
879     if test "$enable_android_lok" = yes; then
880         ENABLE_ANDROID_LOK=TRUE
881         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
882         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
883     else
884         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
885     fi
887 AC_SUBST([ENABLE_ANDROID_LOK])
889 libo_FUZZ_ARG_ENABLE([android-editing],
890     AS_HELP_STRING([--enable-android-editing],
891         [Enable the experimental editing feature on Android.])
893 ENABLE_ANDROID_EDITING=
894 if test "$enable_android_editing" = yes; then
895     ENABLE_ANDROID_EDITING=TRUE
897 AC_SUBST([ENABLE_ANDROID_EDITING])
899 disable_database_connectivity_dependencies()
901     enable_evolution2=no
902     enable_firebird_sdbc=no
903     enable_mariadb_sdbc=no
904     enable_postgresql_sdbc=no
905     enable_report_builder=no
908 # ===================================================================
910 # Start initial platform setup
912 # The using_* variables reflect platform support and should not be
913 # changed after the "End initial platform setup" block.
914 # This is also true for most test_* variables.
915 # ===================================================================
916 build_crypto=yes
917 test_clucene=no
918 test_gdb_index=no
919 test_openldap=yes
920 test_split_debug=no
921 test_webdav=yes
922 usable_dlapi=yes
924 # There is currently just iOS not using salplug, so this explicitly enables it.
925 # must: using_freetype_fontconfig
926 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
927 # must: using_x11
929 # Default values, as such probably valid just for Linux, set
930 # differently below just for Mac OSX, but at least better than
931 # hardcoding these as we used to do. Much of this is duplicated also
932 # in solenv for old build system and for gbuild, ideally we should
933 # perhaps define stuff like this only here in configure.ac?
935 LINKFLAGSSHL="-shared"
936 PICSWITCH="-fpic"
937 DLLPOST=".so"
939 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
941 INSTROOTBASESUFFIX=
942 INSTROOTCONTENTSUFFIX=
943 SDKDIRNAME=sdk
945 HOST_PLATFORM="$host"
947 host_cpu_for_clang="$host_cpu"
949 case "$host_os" in
951 solaris*)
952     using_freetype_fontconfig=yes
953     using_x11=yes
954     build_skia=yes
955     _os=SunOS
957     dnl ===========================================================
958     dnl Check whether we're using Solaris 10 - SPARC or Intel.
959     dnl ===========================================================
960     AC_MSG_CHECKING([the Solaris operating system release])
961     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
962     if test "$_os_release" -lt "10"; then
963         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
964     else
965         AC_MSG_RESULT([ok ($_os_release)])
966     fi
968     dnl Check whether we're using a SPARC or i386 processor
969     AC_MSG_CHECKING([the processor type])
970     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
971         AC_MSG_RESULT([ok ($host_cpu)])
972     else
973         AC_MSG_ERROR([only SPARC and i386 processors are supported])
974     fi
975     ;;
977 linux-gnu*|k*bsd*-gnu*|linux-musl*)
978     using_freetype_fontconfig=yes
979     using_x11=yes
980     build_skia=yes
981     test_gdb_index=yes
982     test_split_debug=yes
983     if test "$enable_fuzzers" = yes; then
984         test_system_freetype=no
985     fi
986     _os=Linux
987     ;;
989 gnu)
990     using_freetype_fontconfig=yes
991     using_x11=no
992     _os=GNU
993      ;;
995 cygwin*|wsl*)
996     # When building on Windows normally with MSVC under Cygwin,
997     # configure thinks that the host platform (the platform the
998     # built code will run on) is Cygwin, even if it obviously is
999     # Windows, which in Autoconf terminology is called
1000     # "mingw32". (Which is misleading as MinGW is the name of the
1001     # tool-chain, not an operating system.)
1003     # Somewhat confusing, yes. But this configure script doesn't
1004     # look at $host etc that much, it mostly uses its own $_os
1005     # variable, set here in this case statement.
1007     using_freetype_fontconfig=no
1008     using_x11=no
1009     test_unix_dlapi=no
1010     test_openldap=no
1011     enable_pagein=no
1012     build_skia=yes
1013     _os=WINNT
1015     DLLPOST=".dll"
1016     LINKFLAGSNOUNDEFS=
1018     if test "$host_cpu" = "aarch64"; then
1019         build_skia=no
1020         enable_gpgmepp=no
1021         enable_coinmp=no
1022         enable_firebird_sdbc=no
1023     fi
1024     ;;
1026 darwin*) # macOS
1027     using_freetype_fontconfig=no
1028     using_x11=no
1029     build_skia=yes
1030     enable_pagein=no
1031     if test -n "$LODE_HOME" ; then
1032         mac_sanitize_path
1033         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1034     fi
1035     _os=Darwin
1036     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
1037     INSTROOTCONTENTSUFFIX=/Contents
1038     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1039     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1040     LINKFLAGSSHL="-dynamiclib"
1042     # -fPIC is default
1043     PICSWITCH=""
1045     DLLPOST=".dylib"
1047     # -undefined error is the default
1048     LINKFLAGSNOUNDEFS=""
1049     case "$host_cpu" in
1050     aarch64|arm64)
1051         # Apple's Clang uses "arm64"
1052         host_cpu_for_clang=arm64
1053     esac
1056 ios*) # iOS
1057     using_freetype_fontconfig=no
1058     using_x11=no
1059     build_crypto=no
1060     test_libcmis=no
1061     test_openldap=no
1062     test_webdav=no
1063     if test -n "$LODE_HOME" ; then
1064         mac_sanitize_path
1065         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1066     fi
1067     enable_gpgmepp=no
1068     _os=iOS
1069     enable_mpl_subset=yes
1070     enable_lotuswordpro=no
1071     disable_database_connectivity_dependencies
1072     enable_coinmp=no
1073     enable_lpsolve=no
1074     enable_extension_integration=no
1075     enable_xmlhelp=no
1076     with_ppds=no
1077     if test "$enable_ios_simulator" = "yes"; then
1078         host=x86_64-apple-darwin
1079     fi
1080     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1081     LINKFLAGSSHL="-dynamiclib"
1083     # -fPIC is default
1084     PICSWITCH=""
1086     DLLPOST=".dylib"
1088     # -undefined error is the default
1089     LINKFLAGSNOUNDEFS=""
1091     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1092     # part, so use aarch64-apple-darwin for now.
1093     HOST_PLATFORM=aarch64-apple-darwin
1095     # Apple's Clang uses "arm64"
1096     host_cpu_for_clang=arm64
1099 freebsd*)
1100     using_freetype_fontconfig=yes
1101     using_x11=yes
1102     build_skia=yes
1103     AC_MSG_CHECKING([the FreeBSD operating system release])
1104     if test -n "$with_os_version"; then
1105         OSVERSION="$with_os_version"
1106     else
1107         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1108     fi
1109     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1110     AC_MSG_CHECKING([which thread library to use])
1111     if test "$OSVERSION" -lt "500016"; then
1112         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1113         PTHREAD_LIBS="-pthread"
1114     elif test "$OSVERSION" -lt "502102"; then
1115         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1116         PTHREAD_LIBS="-lc_r"
1117     else
1118         PTHREAD_CFLAGS=""
1119         PTHREAD_LIBS="-pthread"
1120     fi
1121     AC_MSG_RESULT([$PTHREAD_LIBS])
1122     _os=FreeBSD
1123     ;;
1125 *netbsd*)
1126     using_freetype_fontconfig=yes
1127     using_x11=yes
1128     test_gtk3_kde5=no
1129     build_skia=yes
1130     PTHREAD_LIBS="-pthread -lpthread"
1131     _os=NetBSD
1132     ;;
1134 openbsd*)
1135     using_freetype_fontconfig=yes
1136     using_x11=yes
1137     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1138     PTHREAD_LIBS="-pthread"
1139     _os=OpenBSD
1140     ;;
1142 dragonfly*)
1143     using_freetype_fontconfig=yes
1144     using_x11=yes
1145     build_skia=yes
1146     PTHREAD_LIBS="-pthread"
1147     _os=DragonFly
1148     ;;
1150 linux-android*)
1151     # API exists, but seems not really usable since Android 7 AFAIK
1152     usable_dlapi=no
1153     using_freetype_fontconfig=yes
1154     using_headless_plugin=no
1155     using_x11=no
1156     build_crypto=no
1157     test_openldap=no
1158     test_system_freetype=no
1159     test_webdav=no
1160     disable_database_connectivity_dependencies
1161     enable_lotuswordpro=no
1162     enable_mpl_subset=yes
1163     enable_cairo_canvas=no
1164     enable_coinmp=yes
1165     enable_lpsolve=no
1166     enable_odk=no
1167     enable_python=no
1168     enable_xmlhelp=no
1169     _os=Android
1170     ;;
1172 haiku*)
1173     using_freetype_fontconfig=yes
1174     using_x11=no
1175     test_gtk3=no
1176     test_gtk3_kde5=no
1177     test_kf5=yes
1178     test_kf6=yes
1179     enable_odk=no
1180     enable_coinmp=no
1181     enable_pdfium=no
1182     enable_sdremote=no
1183     enable_postgresql_sdbc=no
1184     enable_firebird_sdbc=no
1185     _os=Haiku
1186     ;;
1188 emscripten)
1189     # API currently just exists in headers, not code
1190     usable_dlapi=no
1191     using_freetype_fontconfig=yes
1192     using_x11=yes
1193     test_openldap=no
1194     test_qt5=yes
1195     test_split_debug=yes
1196     test_system_freetype=no
1197     enable_compiler_plugins=no
1198     enable_customtarget_components=yes
1199     enable_split_debug=yes
1200     enable_wasm_strip=yes
1201     with_system_zlib=no
1202     with_theme="colibre"
1203     _os=Emscripten
1204     ;;
1207     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1208     ;;
1209 esac
1211 AC_SUBST(HOST_PLATFORM)
1213 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1214     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1217 # Set defaults, if not set by platform
1218 test "${test_cups+set}" = set || test_cups="$using_x11"
1219 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1220 test "${test_gen+set}" = set || test_gen="$using_x11"
1221 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1222 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1223 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1224 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1225 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1226 # don't handle test_qt5, so it can disable test_kf5 later
1227 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1228 test "${test_randr+set}" = set || test_randr="$using_x11"
1229 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1230 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1232 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1233 # Make sure fontconfig and freetype test both either system or not
1234 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1235 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1237 # convenience / platform overriding "fixes"
1238 # Don't sort!
1239 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1240 test "$test_kf5" = yes && test_qt5=yes
1241 test "$test_gtk3" != yes && enable_gtk3=no
1242 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1243 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1244 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1246 # Keep in sync with the above $using_x11 depending test default list
1247 disable_x11_tests()
1249     test_cups=no
1250     test_dbus=no
1251     test_gen=no
1252     test_gstreamer_1_0=no
1253     test_gtk3_kde5=no
1254     test_gtk3=no
1255     test_gtk4=no
1256     test_kf5=no
1257     test_kf6=no
1258     test_qt5=no
1259     test_qt6=no
1260     test_randr=no
1261     test_xrender=no
1264 test "$using_x11" = yes && USING_X11=TRUE
1266 if test "$using_freetype_fontconfig" = yes; then
1267     AC_DEFINE(USE_HEADLESS_CODE)
1268     USE_HEADLESS_CODE=TRUE
1269     if test "$using_headless_plugin" = yes; then
1270         AC_DEFINE(ENABLE_HEADLESS)
1271         ENABLE_HEADLESS=TRUE
1272     fi
1273 else
1274     test_fontconfig=no
1275     test_freetype=no
1278 AC_SUBST(ENABLE_HEADLESS)
1279 AC_SUBST(USE_HEADLESS_CODE)
1281 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1282 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1283 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1284 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1286 # ===================================================================
1288 # End initial platform setup
1290 # ===================================================================
1292 if test "$_os" = "Android" ; then
1293     # Verify that the NDK and SDK options are proper
1294     if test -z "$with_android_ndk"; then
1295         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1296     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1297         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1298     fi
1300     if test -z "$ANDROID_SDK_DIR"; then
1301         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1302     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1303         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1304     fi
1307 AC_SUBST(SDKDIRNAME)
1309 AC_SUBST(PTHREAD_CFLAGS)
1310 AC_SUBST(PTHREAD_LIBS)
1312 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1313 # By default use the ones specified by our build system,
1314 # but explicit override is possible.
1315 AC_MSG_CHECKING(for explicit AFLAGS)
1316 if test -n "$AFLAGS"; then
1317     AC_MSG_RESULT([$AFLAGS])
1318     x_AFLAGS=
1319 else
1320     AC_MSG_RESULT(no)
1321     x_AFLAGS=[\#]
1323 AC_MSG_CHECKING(for explicit CFLAGS)
1324 if test -n "$CFLAGS"; then
1325     AC_MSG_RESULT([$CFLAGS])
1326     x_CFLAGS=
1327 else
1328     AC_MSG_RESULT(no)
1329     x_CFLAGS=[\#]
1331 AC_MSG_CHECKING(for explicit CXXFLAGS)
1332 if test -n "$CXXFLAGS"; then
1333     AC_MSG_RESULT([$CXXFLAGS])
1334     x_CXXFLAGS=
1335 else
1336     AC_MSG_RESULT(no)
1337     x_CXXFLAGS=[\#]
1339 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1340 if test -n "$OBJCFLAGS"; then
1341     AC_MSG_RESULT([$OBJCFLAGS])
1342     x_OBJCFLAGS=
1343 else
1344     AC_MSG_RESULT(no)
1345     x_OBJCFLAGS=[\#]
1347 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1348 if test -n "$OBJCXXFLAGS"; then
1349     AC_MSG_RESULT([$OBJCXXFLAGS])
1350     x_OBJCXXFLAGS=
1351 else
1352     AC_MSG_RESULT(no)
1353     x_OBJCXXFLAGS=[\#]
1355 AC_MSG_CHECKING(for explicit LDFLAGS)
1356 if test -n "$LDFLAGS"; then
1357     AC_MSG_RESULT([$LDFLAGS])
1358     x_LDFLAGS=
1359 else
1360     AC_MSG_RESULT(no)
1361     x_LDFLAGS=[\#]
1363 AC_SUBST(AFLAGS)
1364 AC_SUBST(CFLAGS)
1365 AC_SUBST(CXXFLAGS)
1366 AC_SUBST(OBJCFLAGS)
1367 AC_SUBST(OBJCXXFLAGS)
1368 AC_SUBST(LDFLAGS)
1369 AC_SUBST(x_AFLAGS)
1370 AC_SUBST(x_CFLAGS)
1371 AC_SUBST(x_CXXFLAGS)
1372 AC_SUBST(x_OBJCFLAGS)
1373 AC_SUBST(x_OBJCXXFLAGS)
1374 AC_SUBST(x_LDFLAGS)
1376 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1377 my_original_CFLAGS=$CFLAGS
1378 my_original_CXXFLAGS=$CXXFLAGS
1379 my_original_CPPFLAGS=$CPPFLAGS
1381 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1382 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1383 dnl AC_PROG_CC internally.
1384 if test "$_os" != "WINNT"; then
1385     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CC,
1386     # Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
1387     save_CFLAGS=$CFLAGS
1388     CFLAGS=-g
1389     AC_PROG_CC
1390     CFLAGS=$save_CFLAGS
1391     if test -z "$CC_BASE"; then
1392         CC_BASE=`first_arg_basename "$CC"`
1393     fi
1396 if test "$_os" != "WINNT"; then
1397     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1398 else
1399     ENDIANNESS=little
1401 AC_SUBST(ENDIANNESS)
1403 if test "$usable_dlapi" != no; then
1404     AC_DEFINE([HAVE_DLAPI])
1405     if test "$test_unix_dlapi" != no; then
1406         save_LIBS="$LIBS"
1407         AC_SEARCH_LIBS([dlsym], [dl],
1408             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1409             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1410         LIBS="$save_LIBS"
1411         AC_DEFINE([HAVE_UNIX_DLAPI])
1412     fi
1414 AC_SUBST(UNIX_DLAPI_LIBS)
1416 # Check for a (GNU) backtrace implementation
1417 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1418 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1419 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1420     save_LIBS="$LIBS"
1421     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1422         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1423         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1424     LIBS="$save_LIBS"
1426 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1427     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1430 dnl ===================================================================
1431 dnl Sanity checks for Emscripten SDK setup
1432 dnl ===================================================================
1434 EMSCRIPTEN_MIN_MAJOR=3
1435 EMSCRIPTEN_MIN_MINOR=1
1436 EMSCRIPTEN_MIN_TINY=3
1437 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1439 if test "$_os" = "Emscripten"; then
1440     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1441     if test -z "$EMSCRIPTEN_VERSION_H"; then
1442         AS_IF([test -z "$EMSDK"],
1443               [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1444         EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1445     fi
1446     if test -f "$EMSCRIPTEN_VERSION_H"; then
1447         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1448         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1449         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1450     else
1451         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1452         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1453         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1454         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1455     fi
1457     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1459     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1460     if test $? -eq 0; then
1461         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1462     else
1463         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1464     fi
1466     EMSCRIPTEN_ERROR=0
1467     if ! command -v emconfigure >/dev/null 2>&1; then
1468         AC_MSG_WARN([emconfigure must be in your \$PATH])
1469         EMSCRIPTEN_ERROR=1
1470     fi
1471     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1472         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1473         EMSCRIPTEN_ERROR=1
1474     fi
1475     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1476     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1477         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1478         EMSCRIPTEN_ERROR=1
1479     fi
1480     if test $EMSCRIPTEN_ERROR -ne 0; then
1481         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1482     fi
1484     dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
1485     BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
1487 AC_SUBST(EMSDK_FILE_PACKAGER)
1489 ###############################################################################
1490 # Extensions switches --enable/--disable
1491 ###############################################################################
1492 # By default these should be enabled unless having extra dependencies.
1493 # If there is extra dependency over configure options then the enable should
1494 # be automagic based on whether the requiring feature is enabled or not.
1495 # All this options change anything only with --enable-extension-integration.
1497 # The name of this option and its help string makes it sound as if
1498 # extensions are built anyway, just not integrated in the installer,
1499 # if you use --disable-extension-integration. Is that really the
1500 # case?
1502 AC_ARG_ENABLE(ios-simulator,
1503     AS_HELP_STRING([--enable-ios-simulator],
1504         [build for iOS simulator])
1507 libo_FUZZ_ARG_ENABLE(extension-integration,
1508     AS_HELP_STRING([--disable-extension-integration],
1509         [Disable integration of the built extensions in the installer of the
1510          product. Use this switch to disable the integration.])
1513 AC_ARG_ENABLE(avmedia,
1514     AS_HELP_STRING([--disable-avmedia],
1515         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1516 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1518 AC_ARG_ENABLE(database-connectivity,
1519     AS_HELP_STRING([--disable-database-connectivity],
1520         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1523 # This doesn't mean not building (or "integrating") extensions
1524 # (although it probably should; i.e. it should imply
1525 # --disable-extension-integration I guess), it means not supporting
1526 # any extension mechanism at all
1527 libo_FUZZ_ARG_ENABLE(extensions,
1528     AS_HELP_STRING([--disable-extensions],
1529         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1532 AC_ARG_ENABLE(scripting,
1533     AS_HELP_STRING([--disable-scripting],
1534         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1535 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1537 # This is mainly for Android and iOS, but could potentially be used in some
1538 # special case otherwise, too, so factored out as a separate setting
1540 AC_ARG_ENABLE(dynamic-loading,
1541     AS_HELP_STRING([--disable-dynamic-loading],
1542         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1545 libo_FUZZ_ARG_ENABLE(report-builder,
1546     AS_HELP_STRING([--disable-report-builder],
1547         [Disable the Report Builder.])
1550 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1551     AS_HELP_STRING([--enable-ext-wiki-publisher],
1552         [Enable the Wiki Publisher extension.])
1555 libo_FUZZ_ARG_ENABLE(lpsolve,
1556     AS_HELP_STRING([--disable-lpsolve],
1557         [Disable compilation of the lp solve solver ])
1559 libo_FUZZ_ARG_ENABLE(coinmp,
1560     AS_HELP_STRING([--disable-coinmp],
1561         [Disable compilation of the CoinMP solver ])
1564 libo_FUZZ_ARG_ENABLE(pdfimport,
1565     AS_HELP_STRING([--disable-pdfimport],
1566         [Disable building the PDF import feature.])
1569 libo_FUZZ_ARG_ENABLE(pdfium,
1570     AS_HELP_STRING([--disable-pdfium],
1571         [Disable building PDFium. Results in insecure PDF signature verification.])
1574 libo_FUZZ_ARG_ENABLE(skia,
1575     AS_HELP_STRING([--disable-skia],
1576         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1579 ###############################################################################
1581 dnl ---------- *** ----------
1583 libo_FUZZ_ARG_ENABLE(mergelibs,
1584     AS_HELP_STRING([--enable-mergelibs=yes/no/more],
1585         [Merge several of the smaller libraries into one big "merged" library.
1586          The "more" option will link even more of the smaller libraries.
1587          "more" not appropriate for distros which split up LibreOffice into multiple packages.
1588          It is only appropriate for situations where all of LO is delivered in a single install/package. ])
1591 libo_FUZZ_ARG_ENABLE(breakpad,
1592     AS_HELP_STRING([--enable-breakpad],
1593         [Enables breakpad for crash reporting.])
1596 libo_FUZZ_ARG_ENABLE(crashdump,
1597     AS_HELP_STRING([--disable-crashdump],
1598         [Disable dump.ini and dump-file, when --enable-breakpad])
1601 AC_ARG_ENABLE(fetch-external,
1602     AS_HELP_STRING([--disable-fetch-external],
1603         [Disables fetching external tarballs from web sources.])
1606 AC_ARG_ENABLE(fuzzers,
1607     AS_HELP_STRING([--enable-fuzzers],
1608         [Enables building libfuzzer targets for fuzz testing.])
1611 libo_FUZZ_ARG_ENABLE(pch,
1612     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1613         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1614          Using 'system' will include only external headers, 'base' will add also headers
1615          from base modules, 'normal' will also add all headers except from the module built,
1616          'full' will use all suitable headers even from a module itself.])
1619 libo_FUZZ_ARG_ENABLE(epm,
1620     AS_HELP_STRING([--enable-epm],
1621         [LibreOffice includes self-packaging code, that requires epm, however epm is
1622          useless for large scale package building.])
1625 libo_FUZZ_ARG_ENABLE(odk,
1626     AS_HELP_STRING([--enable-odk],
1627         [Enable building the Office Development Kit, the part that extensions need to build against])
1630 AC_ARG_ENABLE(mpl-subset,
1631     AS_HELP_STRING([--enable-mpl-subset],
1632         [Don't compile any pieces which are not MPL or more liberally licensed])
1635 libo_FUZZ_ARG_ENABLE(evolution2,
1636     AS_HELP_STRING([--enable-evolution2],
1637         [Allows the built-in evolution 2 addressbook connectivity build to be
1638          enabled.])
1641 AC_ARG_ENABLE(avahi,
1642     AS_HELP_STRING([--enable-avahi],
1643         [Determines whether to use Avahi to advertise Impress to remote controls.])
1646 libo_FUZZ_ARG_ENABLE(werror,
1647     AS_HELP_STRING([--enable-werror],
1648         [Turn warnings to errors. (Has no effect in modules where the treating
1649          of warnings as errors is disabled explicitly.)]),
1652 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1653     AS_HELP_STRING([--enable-assert-always-abort],
1654         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1657 libo_FUZZ_ARG_ENABLE(dbgutil,
1658     AS_HELP_STRING([--enable-dbgutil],
1659         [Provide debugging support from --enable-debug and include additional debugging
1660          utilities such as object counting or more expensive checks.
1661          This is the recommended option for developers.
1662          Note that this makes the build ABI incompatible, it is not possible to mix object
1663          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1665 libo_FUZZ_ARG_ENABLE(debug,
1666     AS_HELP_STRING([--enable-debug],
1667         [Include debugging information, disable compiler optimization and inlining plus
1668          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1670 libo_FUZZ_ARG_ENABLE(split-debug,
1671     AS_HELP_STRING([--disable-split-debug],
1672         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1673          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1675 libo_FUZZ_ARG_ENABLE(gdb-index,
1676     AS_HELP_STRING([--disable-gdb-index],
1677         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1678          The feature requires a linker that supports the --gdb-index option.]))
1680 libo_FUZZ_ARG_ENABLE(sal-log,
1681     AS_HELP_STRING([--enable-sal-log],
1682         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1684 libo_FUZZ_ARG_ENABLE(symbols,
1685     AS_HELP_STRING([--enable-symbols],
1686         [Generate debug information.
1687          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1688          otherwise. It is possible to explicitly specify gbuild build targets
1689          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1690          everything in the directory; there is no ordering, more specific overrides
1691          more general, and disabling takes precedence).
1692          Example: --enable-symbols="all -sw/ -Library_sc".]))
1694 libo_FUZZ_ARG_ENABLE(optimized,
1695     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1696         [Whether to compile with optimization flags.
1697          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1698          otherwise. Using 'debug' will try to use only optimizations that should
1699          not interfere with debugging. For Emscripten we default to optimized (-O1)
1700          debug build, as otherwise binaries become too large.]))
1702 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1703     AS_HELP_STRING([--disable-runtime-optimizations],
1704         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1705          JVM JIT) that are known to interact badly with certain dynamic analysis
1706          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1707          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1708          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1710 AC_ARG_WITH(valgrind,
1711     AS_HELP_STRING([--with-valgrind],
1712         [Make availability of Valgrind headers a hard requirement.]))
1714 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1715     AS_HELP_STRING([--enable-compiler-plugins],
1716         [Enable compiler plugins that will perform additional checks during
1717          building. Enabled automatically by --enable-dbgutil.
1718          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1719 COMPILER_PLUGINS_DEBUG=
1720 if test "$enable_compiler_plugins" = debug; then
1721     enable_compiler_plugins=yes
1722     COMPILER_PLUGINS_DEBUG=TRUE
1725 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1726     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1727         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1728          relevant in the --disable-compiler-plugins case.]))
1730 libo_FUZZ_ARG_ENABLE(ooenv,
1731     AS_HELP_STRING([--enable-ooenv],
1732         [Enable ooenv for the instdir installation.]))
1734 AC_ARG_ENABLE(lto,
1735     AS_HELP_STRING([--enable-lto],
1736         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1737          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1738          linker.)]))
1740 AC_ARG_ENABLE(python,
1741     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1742         [Enables or disables Python support at run-time.
1743          Also specifies what Python to use at build-time.
1744          'fully-internal' even forces the internal version for uses of Python
1745          during the build.
1746          On macOS the only choices are
1747          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1748          ]))
1750 libo_FUZZ_ARG_ENABLE(gtk3,
1751     AS_HELP_STRING([--disable-gtk3],
1752         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1753 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1755 AC_ARG_ENABLE(gtk4,
1756     AS_HELP_STRING([--enable-gtk4],
1757         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1759 AC_ARG_ENABLE(atspi-tests,
1760     AS_HELP_STRING([--disable-atspi-tests],
1761         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1763 AC_ARG_ENABLE(introspection,
1764     AS_HELP_STRING([--enable-introspection],
1765         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1766          Linux distributions.)]))
1768 AC_ARG_ENABLE(split-app-modules,
1769     AS_HELP_STRING([--enable-split-app-modules],
1770         [Split file lists for app modules, e.g. base, calc.
1771          Has effect only with make distro-pack-install]),
1774 AC_ARG_ENABLE(split-opt-features,
1775     AS_HELP_STRING([--enable-split-opt-features],
1776         [Split file lists for some optional features, e.g. pyuno, testtool.
1777          Has effect only with make distro-pack-install]),
1780 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1781     AS_HELP_STRING([--disable-cairo-canvas],
1782         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1785 libo_FUZZ_ARG_ENABLE(dbus,
1786     AS_HELP_STRING([--disable-dbus],
1787         [Determines whether to enable features that depend on dbus.
1788          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1789 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1791 libo_FUZZ_ARG_ENABLE(sdremote,
1792     AS_HELP_STRING([--disable-sdremote],
1793         [Determines whether to enable Impress remote control (i.e. the server component).]),
1794 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1796 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1797     AS_HELP_STRING([--disable-sdremote-bluetooth],
1798         [Determines whether to build sdremote with bluetooth support.
1799          Requires dbus on Linux.]))
1801 libo_FUZZ_ARG_ENABLE(gio,
1802     AS_HELP_STRING([--disable-gio],
1803         [Determines whether to use the GIO support.]),
1804 ,test "${enable_gio+set}" = set || enable_gio=yes)
1806 AC_ARG_ENABLE(qt5,
1807     AS_HELP_STRING([--enable-qt5],
1808         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1809          available.]),
1812 AC_ARG_ENABLE(qt6,
1813     AS_HELP_STRING([--enable-qt6],
1814         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1815          available.]),
1818 AC_ARG_ENABLE(qt6-multimedia,
1819     AS_HELP_STRING([--disable-qt6-multimedia],
1820         [Determines whether to enable media playback using QtMultimedia when using the qt6/kf6 VCL plugins.]))
1822 AC_ARG_ENABLE(kf5,
1823     AS_HELP_STRING([--enable-kf5],
1824         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1825          KF5 are available.]),
1828 AC_ARG_ENABLE(kf6,
1829     AS_HELP_STRING([--enable-kf6],
1830         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1831          KF6 are available.]),
1835 AC_ARG_ENABLE(gtk3_kde5,
1836     AS_HELP_STRING([--enable-gtk3-kde5],
1837         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1838          platforms where Gtk3, Qt5 and Plasma is available.]),
1841 AC_ARG_ENABLE(gen,
1842     AS_HELP_STRING([--enable-gen],
1843         [To select the gen backend in case of --disable-dynamic-loading.
1844          Per default auto-enabled when X11 is used.]),
1845 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1847 AC_ARG_ENABLE(gui,
1848     AS_HELP_STRING([--disable-gui],
1849         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1850 ,enable_gui=yes)
1852 libo_FUZZ_ARG_ENABLE(randr,
1853     AS_HELP_STRING([--disable-randr],
1854         [Disable RandR support in the vcl project.]),
1855 ,test "${enable_randr+set}" = set || enable_randr=yes)
1857 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1858     AS_HELP_STRING([--disable-gstreamer-1-0],
1859         [Disable building with the gstreamer 1.0 avmedia backend.]),
1860 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1862 libo_FUZZ_ARG_ENABLE([eot],
1863     [AS_HELP_STRING([--enable-eot],
1864         [Enable support for Embedded OpenType fonts.])],
1865 ,test "${enable_eot+set}" = set || enable_eot=no)
1867 libo_FUZZ_ARG_ENABLE(cve-tests,
1868     AS_HELP_STRING([--disable-cve-tests],
1869         [Prevent CVE tests to be executed]),
1872 AC_ARG_ENABLE(build-opensymbol,
1873     AS_HELP_STRING([--enable-build-opensymbol],
1874         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1875          fontforge installed.]),
1878 AC_ARG_ENABLE(dependency-tracking,
1879     AS_HELP_STRING([--enable-dependency-tracking],
1880         [Do not reject slow dependency extractors.])[
1881   --disable-dependency-tracking
1882                           Disables generation of dependency information.
1883                           Speed up one-time builds.],
1886 AC_ARG_ENABLE(icecream,
1887     AS_HELP_STRING([--enable-icecream],
1888         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1889          It defaults to /opt/icecream for the location of the icecream gcc/g++
1890          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1893 AC_ARG_ENABLE(ld,
1894     AS_HELP_STRING([--enable-ld=<linker>],
1895         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1896          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1897          If <linker> contains any ':', the part before the first ':' is used as the value of
1898          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1899          needed for Clang 12).]),
1902 libo_FUZZ_ARG_ENABLE(cups,
1903     AS_HELP_STRING([--disable-cups],
1904         [Do not build cups support.])
1907 AC_ARG_ENABLE(ccache,
1908     AS_HELP_STRING([--disable-ccache],
1909         [Do not try to use ccache automatically.
1910          By default we will try to detect if ccache is available; in that case if
1911          CC/CXX are not yet set, and --enable-icecream is not given, we
1912          attempt to use ccache. --disable-ccache disables ccache completely.
1913          Additionally ccache's depend mode is enabled if possible,
1914          use --enable-ccache=nodepend to enable ccache without depend mode.
1918 AC_ARG_ENABLE(z7-debug,
1919     AS_HELP_STRING([--enable-z7-debug],
1920         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1921          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1922          Enabled by default if ccache is detected.]))
1924 libo_FUZZ_ARG_ENABLE(online-update,
1925     AS_HELP_STRING([--enable-online-update],
1926         [Enable the online update service that will check for new versions of
1927          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
1930 libo_FUZZ_ARG_ENABLE(online-update-mar,
1931     AS_HELP_STRING([--enable-online-update-mar],
1932         [Enable the experimental Mozilla-like online update service that will
1933          check for new versions of LibreOffice. Disabled by default.]),
1936 libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
1937     AS_HELP_STRING([--with-online-update-mar-baseurl=...],
1938         [Set the base URL value for --enable-online-update-mar.
1939          (Can be left off for debug purposes, even if that may render the feature
1940          non-functional.)]),
1943 libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
1944     AS_HELP_STRING([--with-online-update-mar-certificateder=...],
1945         [Set the certificate DER value for --enable-online-update-mar.
1946          (Can be left off for debug purposes, even if that may render the feature
1947          non-functional.)]),
1950 libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
1951     AS_HELP_STRING([--with-online-update-mar-certificatename=...],
1952         [Set the certificate name value for --enable-online-update-mar.
1953          (Can be left off for debug purposes, even if that may render the feature
1954          non-functional.)]),
1957 libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
1958     AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
1959         [Set the certificate path value for --enable-online-update-mar.
1960          (Can be left off for debug purposes, even if that may render the feature
1961          non-functional.)]),
1964 libo_FUZZ_ARG_ENABLE(extension-update,
1965     AS_HELP_STRING([--disable-extension-update],
1966         [Disable possibility to update installed extensions.]),
1969 libo_FUZZ_ARG_ENABLE(release-build,
1970     AS_HELP_STRING([--enable-release-build],
1971         [Enable release build. Note that the "release build" choice is orthogonal to
1972          whether symbols are present, debug info is generated, or optimization
1973          is done.
1974          See https://wiki.documentfoundation.org/Development/DevBuild]),
1977 libo_FUZZ_ARG_ENABLE(hardening-flags,
1978     AS_HELP_STRING([--enable-hardening-flags],
1979         [Enable automatically using hardening compiler flags. Distros typically
1980          instead use their default configuration via CXXFLAGS, etc. But this provides a
1981          convenient set of default hardening flags for non-distros]),
1984 AC_ARG_ENABLE(windows-build-signing,
1985     AS_HELP_STRING([--enable-windows-build-signing],
1986         [Enable signing of windows binaries (*.exe, *.dll)]),
1989 AC_ARG_ENABLE(silent-msi,
1990     AS_HELP_STRING([--enable-silent-msi],
1991         [Enable MSI with LIMITUI=1 (silent install).]),
1994 AC_ARG_ENABLE(wix,
1995     AS_HELP_STRING([--enable-wix],
1996         [Build Windows installer using WiX.]),
1999 AC_ARG_ENABLE(macosx-code-signing,
2000     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
2001         [Sign executables, dylibs, frameworks and the app bundle. If you
2002          don't provide an identity the first suitable certificate
2003          in your keychain is used.]),
2006 AC_ARG_ENABLE(macosx-package-signing,
2007     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
2008         [Create a .pkg suitable for uploading to the Mac App Store and sign
2009          it. If you don't provide an identity the first suitable certificate
2010          in your keychain is used.]),
2013 AC_ARG_ENABLE(macosx-sandbox,
2014     AS_HELP_STRING([--enable-macosx-sandbox],
2015         [Make the app bundle run in a sandbox. Requires code signing.
2016          Is required by apps distributed in the Mac App Store, and implies
2017          adherence to App Store rules.]),
2020 AC_ARG_WITH(macosx-bundle-identifier,
2021     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
2022         [Define the macOS bundle identifier. Default is the somewhat weird
2023          org.libreoffice.script ("script", huh?).]),
2024 ,with_macosx_bundle_identifier=org.libreoffice.script)
2026 AC_ARG_WITH(macosx-provisioning-profile,
2027     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
2028         [Specify the path to a provisioning profile to use]),
2031 AC_ARG_WITH(product-name,
2032     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
2033         [Define the product name. Default is AC_PACKAGE_NAME.]),
2034 ,with_product_name=$PRODUCTNAME)
2036 libo_FUZZ_ARG_ENABLE(community-flavor,
2037     AS_HELP_STRING([--disable-community-flavor],
2038         [Disable the Community branding.]),
2041 AC_ARG_WITH(package-version,
2042     AS_HELP_STRING([--with-package-version='3.1.4.5'],
2043         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
2046 libo_FUZZ_ARG_ENABLE(readonly-installset,
2047     AS_HELP_STRING([--enable-readonly-installset],
2048         [Prevents any attempts by LibreOffice to write into its installation. That means
2049          at least that no "system-wide" extensions can be added. Partly experimental work in
2050          progress, probably not fully implemented. Always enabled for macOS.]),
2053 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
2054     AS_HELP_STRING([--disable-mariadb-sdbc],
2055         [Disable the build of the MariaDB/MySQL-SDBC driver.])
2058 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
2059     AS_HELP_STRING([--disable-postgresql-sdbc],
2060         [Disable the build of the PostgreSQL-SDBC driver.])
2063 libo_FUZZ_ARG_ENABLE(lotuswordpro,
2064     AS_HELP_STRING([--disable-lotuswordpro],
2065         [Disable the build of the Lotus Word Pro filter.]),
2066 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
2068 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
2069     AS_HELP_STRING([--disable-firebird-sdbc],
2070         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
2071 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
2073 AC_ARG_ENABLE(bogus-pkg-config,
2074     AS_HELP_STRING([--enable-bogus-pkg-config],
2075         [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.]),
2078 AC_ARG_ENABLE(openssl,
2079     AS_HELP_STRING([--disable-openssl],
2080         [Disable using libssl/libcrypto from OpenSSL. If disabled,
2081          components will use NSS. Work in progress,
2082          use only if you are hacking on it.]),
2083 ,enable_openssl=yes)
2085 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2086     AS_HELP_STRING([--enable-cipher-openssl-backend],
2087         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2088          Requires --enable-openssl.]))
2090 AC_ARG_ENABLE(nss,
2091     AS_HELP_STRING([--disable-nss],
2092         [Disable using NSS. If disabled,
2093          components will use openssl. Work in progress,
2094          use only if you are hacking on it.]),
2095 ,enable_nss=yes)
2097 AC_ARG_ENABLE(library-bin-tar,
2098     AS_HELP_STRING([--enable-library-bin-tar],
2099         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2100         Some libraries can save their build result in a tarball
2101         stored in TARFILE_LOCATION. That binary tarball is
2102         uniquely identified by the source tarball,
2103         the content of the config_host.mk file and the content
2104         of the top-level directory in core for that library
2105         If this option is enabled, then if such a tarfile exist, it will be untarred
2106         instead of the source tarfile, and the build step will be skipped for that
2107         library.
2108         If a proper tarfile does not exist, then the normal source-based
2109         build is done for that library and a proper binary tarfile is created
2110         for the next time.]),
2113 AC_ARG_ENABLE(dconf,
2114     AS_HELP_STRING([--disable-dconf],
2115         [Disable the dconf configuration backend (enabled by default where
2116          available).]))
2118 libo_FUZZ_ARG_ENABLE(formula-logger,
2119     AS_HELP_STRING(
2120         [--enable-formula-logger],
2121         [Enable formula logger for logging formula calculation flow in Calc.]
2122     )
2125 AC_ARG_ENABLE(ldap,
2126     AS_HELP_STRING([--disable-ldap],
2127         [Disable LDAP support.]),
2128 ,enable_ldap=yes)
2130 AC_ARG_ENABLE(opencl,
2131     AS_HELP_STRING([--disable-opencl],
2132         [Disable OpenCL support.]),
2133 ,enable_opencl=yes)
2135 libo_FUZZ_ARG_ENABLE(librelogo,
2136     AS_HELP_STRING([--disable-librelogo],
2137         [Do not build LibreLogo.]),
2138 ,enable_librelogo=yes)
2140 AC_ARG_ENABLE(wasm-strip,
2141     AS_HELP_STRING([--enable-wasm-strip],
2142         [Strip the static build like for WASM/emscripten platform.]),
2145 AC_ARG_WITH(main-module,
2146     AS_HELP_STRING([--with-main-module=<writer/calc>],
2147         [Specify which main module to build for wasm.
2148         Default value is 'writer'.]),
2151 AC_ARG_ENABLE(xmlhelp,
2152     AS_HELP_STRING([--disable-xmlhelp],
2153         [Disable XML help support]),
2154 ,enable_xmlhelp=yes)
2156 AC_ARG_ENABLE(customtarget-components,
2157     AS_HELP_STRING([--enable-customtarget-components],
2158         [Generates the static UNO object constructor mapping from the build.]))
2160 dnl ===================================================================
2161 dnl Optional Packages (--with/without-)
2162 dnl ===================================================================
2164 AC_ARG_WITH(gcc-home,
2165     AS_HELP_STRING([--with-gcc-home],
2166         [Specify the location of gcc/g++ manually. This can be used in conjunction
2167          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2168          non-default path.]),
2171 AC_ARG_WITH(gnu-patch,
2172     AS_HELP_STRING([--with-gnu-patch],
2173         [Specify location of GNU patch on Solaris or FreeBSD.]),
2176 AC_ARG_WITH(build-platform-configure-options,
2177     AS_HELP_STRING([--with-build-platform-configure-options],
2178         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2181 AC_ARG_WITH(gnu-cp,
2182     AS_HELP_STRING([--with-gnu-cp],
2183         [Specify location of GNU cp on Solaris or FreeBSD.]),
2186 AC_ARG_WITH(external-tar,
2187     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2188         [Specify an absolute path of where to find (and store) tarfiles.]),
2189     TARFILE_LOCATION=$withval ,
2192 AC_ARG_WITH(referenced-git,
2193     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2194         [Specify another checkout directory to reference. This makes use of
2195                  git submodule update --reference, and saves a lot of diskspace
2196                  when having multiple trees side-by-side.]),
2197     GIT_REFERENCE_SRC=$withval ,
2200 AC_ARG_WITH(linked-git,
2201     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2202         [Specify a directory where the repositories of submodules are located.
2203          This uses a method similar to git-new-workdir to get submodules.]),
2204     GIT_LINK_SRC=$withval ,
2207 AC_ARG_WITH(galleries,
2208     AS_HELP_STRING([--with-galleries],
2209         [Specify how galleries should be built. It is possible either to
2210          build these internally from source ("build"),
2211          or to disable them ("no")]),
2214 AC_ARG_WITH(templates,
2215     AS_HELP_STRING([--with-templates],
2216         [Specify we build with or without template files. It is possible either to
2217          build with templates ("yes"),
2218          or to disable them ("no")]),
2221 AC_ARG_WITH(theme,
2222     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2223         [Choose which themes to include. By default those themes with an '*' are included.
2224          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2225          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2226          *elementary, *elementary_svg,
2227          *karasa_jaga, *karasa_jaga_svg,
2228          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2229          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2232 libo_FUZZ_ARG_WITH(helppack-integration,
2233     AS_HELP_STRING([--without-helppack-integration],
2234         [It will not integrate the helppacks to the installer
2235          of the product. Please use this switch to use the online help
2236          or separate help packages.]),
2239 libo_FUZZ_ARG_WITH(fonts,
2240     AS_HELP_STRING([--without-fonts],
2241         [LibreOffice includes some third-party fonts to provide a reliable basis for
2242          help content, templates, samples, etc. When these fonts are already
2243          known to be available on the system then you should use this option.]),
2246 AC_ARG_WITH(epm,
2247     AS_HELP_STRING([--with-epm],
2248         [Decides which epm to use. Default is to use the one from the system if
2249          one is built. When either this is not there or you say =internal epm
2250          will be built.]),
2253 AC_ARG_WITH(package-format,
2254     AS_HELP_STRING([--with-package-format],
2255         [Specify package format(s) for LibreOffice installation sets. The
2256          implicit --without-package-format leads to no installation sets being
2257          generated. Possible values: archive, bsd, deb, dmg,
2258          installed, msi, pkg, and rpm.
2259          Example: --with-package-format='deb rpm']),
2262 AC_ARG_WITH(tls,
2263     AS_HELP_STRING([--with-tls],
2264         [Decides which TLS/SSL and cryptographic implementations to use for
2265          LibreOffice's code. Default is to use NSS although OpenSSL is also
2266          possible. Notice that selecting NSS restricts the usage of OpenSSL
2267          in LO's code but selecting OpenSSL doesn't restrict by now the
2268          usage of NSS in LO's code. Possible values: openssl, nss.
2269          Example: --with-tls="nss"]),
2272 AC_ARG_WITH(system-libs,
2273     AS_HELP_STRING([--with-system-libs],
2274         [Use libraries already on system -- enables all --with-system-* flags.]),
2277 AC_ARG_WITH(system-bzip2,
2278     AS_HELP_STRING([--with-system-bzip2],
2279         [Use bzip2 already on system. Used when --enable-online-update-mar
2280         or --enable-python=internal]),,
2281     [with_system_bzip2="$with_system_libs"])
2283 AC_ARG_WITH(system-headers,
2284     AS_HELP_STRING([--with-system-headers],
2285         [Use headers already on system -- enables all --with-system-* flags for
2286          external packages whose headers are the only entities used i.e.
2287          boost/odbc/sane-header(s).]),,
2288     [with_system_headers="$with_system_libs"])
2290 AC_ARG_WITH(system-jars,
2291     AS_HELP_STRING([--without-system-jars],
2292         [When building with --with-system-libs, also the needed jars are expected
2293          on the system. Use this to disable that]),,
2294     [with_system_jars="$with_system_libs"])
2296 AC_ARG_WITH(system-cairo,
2297     AS_HELP_STRING([--with-system-cairo],
2298         [Use cairo libraries already on system.  Happens automatically for
2299          (implicit) --enable-gtk3.]))
2301 AC_ARG_WITH(system-epoxy,
2302     AS_HELP_STRING([--with-system-epoxy],
2303         [Use epoxy libraries already on system.  Happens automatically for
2304          (implicit) --enable-gtk3.]),,
2305        [with_system_epoxy="$with_system_libs"])
2307 AC_ARG_WITH(myspell-dicts,
2308     AS_HELP_STRING([--with-myspell-dicts],
2309         [Adds myspell dictionaries to the LibreOffice installation set]),
2312 AC_ARG_WITH(system-dicts,
2313     AS_HELP_STRING([--without-system-dicts],
2314         [Do not use dictionaries from system paths.]),
2317 AC_ARG_WITH(external-dict-dir,
2318     AS_HELP_STRING([--with-external-dict-dir],
2319         [Specify external dictionary dir.]),
2322 AC_ARG_WITH(external-hyph-dir,
2323     AS_HELP_STRING([--with-external-hyph-dir],
2324         [Specify external hyphenation pattern dir.]),
2327 AC_ARG_WITH(external-thes-dir,
2328     AS_HELP_STRING([--with-external-thes-dir],
2329         [Specify external thesaurus dir.]),
2332 AC_ARG_WITH(system-zlib,
2333     AS_HELP_STRING([--with-system-zlib],
2334         [Use zlib already on system.]),,
2335     [with_system_zlib=auto])
2337 AC_ARG_WITH(system-jpeg,
2338     AS_HELP_STRING([--with-system-jpeg],
2339         [Use jpeg already on system.]),,
2340     [with_system_jpeg="$with_system_libs"])
2342 AC_ARG_WITH(system-expat,
2343     AS_HELP_STRING([--with-system-expat],
2344         [Use expat already on system.]),,
2345     [with_system_expat="$with_system_libs"])
2347 AC_ARG_WITH(system-libxml,
2348     AS_HELP_STRING([--with-system-libxml],
2349         [Use libxml/libxslt already on system.]),,
2350     [with_system_libxml=auto])
2352 AC_ARG_WITH(system-openldap,
2353     AS_HELP_STRING([--with-system-openldap],
2354         [Use the OpenLDAP LDAP SDK already on system.]),,
2355     [with_system_openldap="$with_system_libs"])
2357 libo_FUZZ_ARG_ENABLE(poppler,
2358     AS_HELP_STRING([--disable-poppler],
2359         [Disable building Poppler.])
2362 AC_ARG_WITH(system-poppler,
2363     AS_HELP_STRING([--with-system-poppler],
2364         [Use system poppler (only needed for PDF import).]),,
2365     [with_system_poppler="$with_system_libs"])
2367 AC_ARG_WITH(system-abseil,
2368     AS_HELP_STRING([--with-system-abseil],
2369         [Use the abseil libraries already on system.]),,
2370     [with_system_abseil="$with_system_libs"])
2372 AC_ARG_WITH(system-openjpeg,
2373     AS_HELP_STRING([--with-system-openjpeg],
2374         [Use the OpenJPEG library already on system.]),,
2375     [with_system_openjpeg="$with_system_libs"])
2377 libo_FUZZ_ARG_ENABLE(gpgmepp,
2378     AS_HELP_STRING([--disable-gpgmepp],
2379         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2382 AC_ARG_WITH(system-gpgmepp,
2383     AS_HELP_STRING([--with-system-gpgmepp],
2384         [Use gpgmepp already on system]),,
2385     [with_system_gpgmepp="$with_system_libs"])
2387 AC_ARG_WITH(system-mariadb,
2388     AS_HELP_STRING([--with-system-mariadb],
2389         [Use MariaDB/MySQL libraries already on system.]),,
2390     [with_system_mariadb="$with_system_libs"])
2392 AC_ARG_ENABLE(bundle-mariadb,
2393     AS_HELP_STRING([--enable-bundle-mariadb],
2394         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2397 AC_ARG_WITH(system-postgresql,
2398     AS_HELP_STRING([--with-system-postgresql],
2399         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2400          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2401     [with_system_postgresql="$with_system_libs"])
2403 AC_ARG_WITH(libpq-path,
2404     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2405         [Use this PostgreSQL C interface (libpq) installation for building
2406          the PostgreSQL-SDBC extension.]),
2409 AC_ARG_WITH(system-firebird,
2410     AS_HELP_STRING([--with-system-firebird],
2411         [Use Firebird libraries already on system, for building the Firebird-SDBC
2412          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2413     [with_system_firebird="$with_system_libs"])
2415 AC_ARG_WITH(system-libtommath,
2416             AS_HELP_STRING([--with-system-libtommath],
2417                            [Use libtommath already on system]),,
2418             [with_system_libtommath="$with_system_libs"])
2420 AC_ARG_WITH(system-hsqldb,
2421     AS_HELP_STRING([--with-system-hsqldb],
2422         [Use hsqldb already on system.]))
2424 AC_ARG_WITH(hsqldb-jar,
2425     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2426         [Specify path to jarfile manually.]),
2427     HSQLDB_JAR=$withval)
2429 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2430     AS_HELP_STRING([--disable-scripting-beanshell],
2431         [Disable support for scripts in BeanShell.]),
2435 AC_ARG_WITH(system-beanshell,
2436     AS_HELP_STRING([--with-system-beanshell],
2437         [Use beanshell already on system.]),,
2438     [with_system_beanshell="$with_system_jars"])
2440 AC_ARG_WITH(beanshell-jar,
2441     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2442         [Specify path to jarfile manually.]),
2443     BSH_JAR=$withval)
2445 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2446     AS_HELP_STRING([--disable-scripting-javascript],
2447         [Disable support for scripts in JavaScript.]),
2451 AC_ARG_WITH(system-rhino,
2452     AS_HELP_STRING([--with-system-rhino],
2453         [Use rhino already on system.]),,
2454     [with_system_rhino="$with_system_jars"])
2456 AC_ARG_WITH(rhino-jar,
2457     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2458         [Specify path to jarfile manually.]),
2459     RHINO_JAR=$withval)
2461 AC_ARG_WITH(system-jfreereport,
2462     AS_HELP_STRING([--with-system-jfreereport],
2463         [Use JFreeReport already on system.]),,
2464     [with_system_jfreereport="$with_system_jars"])
2466 AC_ARG_WITH(sac-jar,
2467     AS_HELP_STRING([--with-sac-jar=JARFILE],
2468         [Specify path to jarfile manually.]),
2469     SAC_JAR=$withval)
2471 AC_ARG_WITH(libxml-jar,
2472     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2473         [Specify path to jarfile manually.]),
2474     LIBXML_JAR=$withval)
2476 AC_ARG_WITH(flute-jar,
2477     AS_HELP_STRING([--with-flute-jar=JARFILE],
2478         [Specify path to jarfile manually.]),
2479     FLUTE_JAR=$withval)
2481 AC_ARG_WITH(jfreereport-jar,
2482     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2483         [Specify path to jarfile manually.]),
2484     JFREEREPORT_JAR=$withval)
2486 AC_ARG_WITH(liblayout-jar,
2487     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2488         [Specify path to jarfile manually.]),
2489     LIBLAYOUT_JAR=$withval)
2491 AC_ARG_WITH(libloader-jar,
2492     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2493         [Specify path to jarfile manually.]),
2494     LIBLOADER_JAR=$withval)
2496 AC_ARG_WITH(libformula-jar,
2497     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2498         [Specify path to jarfile manually.]),
2499     LIBFORMULA_JAR=$withval)
2501 AC_ARG_WITH(librepository-jar,
2502     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2503         [Specify path to jarfile manually.]),
2504     LIBREPOSITORY_JAR=$withval)
2506 AC_ARG_WITH(libfonts-jar,
2507     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2508         [Specify path to jarfile manually.]),
2509     LIBFONTS_JAR=$withval)
2511 AC_ARG_WITH(libserializer-jar,
2512     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2513         [Specify path to jarfile manually.]),
2514     LIBSERIALIZER_JAR=$withval)
2516 AC_ARG_WITH(libbase-jar,
2517     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2518         [Specify path to jarfile manually.]),
2519     LIBBASE_JAR=$withval)
2521 AC_ARG_WITH(system-odbc,
2522     AS_HELP_STRING([--with-system-odbc],
2523         [Use the odbc headers already on system.]),,
2524     [with_system_odbc="auto"])
2526 AC_ARG_WITH(system-sane,
2527     AS_HELP_STRING([--with-system-sane],
2528         [Use sane.h already on system.]),,
2529     [with_system_sane="$with_system_headers"])
2531 AC_ARG_WITH(system-bluez,
2532     AS_HELP_STRING([--with-system-bluez],
2533         [Use bluetooth.h already on system.]),,
2534     [with_system_bluez="$with_system_headers"])
2536 AC_ARG_WITH(system-boost,
2537     AS_HELP_STRING([--with-system-boost],
2538         [Use boost already on system.]),,
2539     [with_system_boost="$with_system_headers"])
2541 AC_ARG_WITH(system-dragonbox,
2542     AS_HELP_STRING([--with-system-dragonbox],
2543         [Use dragonbox already on system.]),,
2544     [with_system_dragonbox="$with_system_headers"])
2546 AC_ARG_WITH(system-frozen,
2547     AS_HELP_STRING([--with-system-frozen],
2548         [Use frozen already on system.]),,
2549     [with_system_frozen="$with_system_headers"])
2551 AC_ARG_WITH(system-libfixmath,
2552     AS_HELP_STRING([--with-system-libfixmath],
2553         [Use libfixmath already on system.]),,
2554     [with_system_libfixmath="$with_system_libs"])
2556 AC_ARG_WITH(system-glm,
2557     AS_HELP_STRING([--with-system-glm],
2558         [Use glm already on system.]),,
2559     [with_system_glm="$with_system_headers"])
2561 AC_ARG_WITH(system-hunspell,
2562     AS_HELP_STRING([--with-system-hunspell],
2563         [Use libhunspell already on system.]),,
2564     [with_system_hunspell="$with_system_libs"])
2566 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2567     AS_HELP_STRING([--enable-cairo-rgba],
2568         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2570 libo_FUZZ_ARG_ENABLE(zxing,
2571     AS_HELP_STRING([--disable-zxing],
2572        [Disable use of zxing external library.]))
2574 AC_ARG_WITH(system-zxing,
2575     AS_HELP_STRING([--with-system-zxing],
2576         [Use libzxing already on system.]),,
2577     [with_system_zxing="$with_system_libs"])
2579 AC_ARG_WITH(system-zxcvbn,
2580     AS_HELP_STRING([--with-system-zxcvbn],
2581         [Use libzxcvbn already on system.]),,
2582     [with_system_zxcvbn="$with_system_libs"])
2584 AC_ARG_WITH(system-box2d,
2585     AS_HELP_STRING([--with-system-box2d],
2586         [Use box2d already on system.]),,
2587     [with_system_box2d="$with_system_libs"])
2589 AC_ARG_WITH(system-mythes,
2590     AS_HELP_STRING([--with-system-mythes],
2591         [Use mythes already on system.]),,
2592     [with_system_mythes="$with_system_libs"])
2594 AC_ARG_WITH(system-altlinuxhyph,
2595     AS_HELP_STRING([--with-system-altlinuxhyph],
2596         [Use ALTLinuxhyph already on system.]),,
2597     [with_system_altlinuxhyph="$with_system_libs"])
2599 AC_ARG_WITH(system-lpsolve,
2600     AS_HELP_STRING([--with-system-lpsolve],
2601         [Use lpsolve already on system.]),,
2602     [with_system_lpsolve="$with_system_libs"])
2604 AC_ARG_WITH(system-coinmp,
2605     AS_HELP_STRING([--with-system-coinmp],
2606         [Use CoinMP already on system.]),,
2607     [with_system_coinmp="$with_system_libs"])
2609 AC_ARG_WITH(system-liblangtag,
2610     AS_HELP_STRING([--with-system-liblangtag],
2611         [Use liblangtag library already on system.]),,
2612     [with_system_liblangtag="$with_system_libs"])
2614 AC_ARG_WITH(system-lockfile,
2615     AS_HELP_STRING([--with-system-lockfile[=file]],
2616         [Detect a system lockfile program or use the \$file argument.]))
2618 AC_ARG_WITH(webdav,
2619     AS_HELP_STRING([--without-webdav],
2620         [Disable WebDAV support in the UCB.]))
2622 AC_ARG_WITH(linker-hash-style,
2623     AS_HELP_STRING([--with-linker-hash-style],
2624         [Use linker with --hash-style=<style> when linking shared objects.
2625          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2626          if supported on the build system, and "sysv" otherwise.]))
2628 AC_ARG_WITH(jdk-home,
2629     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2630         [If you have installed JDK 8 or later on your system please supply the
2631          path here. Note that this is not the location of the java command but the
2632          location of the entire distribution. In case of cross-compiling, this
2633          is the JDK of the host os. Use --with-build-platform-configure-options
2634          to point to a different build platform JDK.]),
2637 AC_ARG_WITH(help,
2638     AS_HELP_STRING([--with-help],
2639         [Enable the build of help. There is a special parameter "common" that
2640          can be used to bundle only the common part, .e.g help-specific icons.
2641          This is useful when you build the helpcontent separately.])
2642     [
2643                           Usage:     --with-help    build the old local help
2644                                  --without-help     no local help (default)
2645                                  --with-help=html   build the new HTML local help
2646                                  --with-help=online build the new HTML online help
2647     ],
2650 AC_ARG_WITH(omindex,
2651    AS_HELP_STRING([--with-omindex],
2652         [Enable the support of xapian-omega index for online help.])
2653    [
2654                          Usage: --with-omindex=server prepare the pages for omindex
2655                                 but let xapian-omega be built in server.
2656                                 --with-omindex=noxap do not prepare online pages
2657                                 for xapian-omega
2658   ],
2661 libo_FUZZ_ARG_WITH(java,
2662     AS_HELP_STRING([--with-java=<java command>],
2663         [Specify the name of the Java interpreter command. Typically "java"
2664          which is the default.
2666          To build without support for Java components, applets, accessibility
2667          or the XML filters written in Java, use --without-java or --with-java=no.]),
2668     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2669     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2672 AC_ARG_WITH(jvm-path,
2673     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2674         [Use a specific JVM search path at runtime.
2675          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2678 AC_ARG_WITH(ant-home,
2679     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2680         [If you have installed Apache Ant on your system, please supply the path here.
2681          Note that this is not the location of the Ant binary but the location
2682          of the entire distribution.]),
2685 AC_ARG_WITH(symbol-config,
2686     AS_HELP_STRING([--with-symbol-config],
2687         [Configuration for the crashreport symbol upload]),
2688         [],
2689         [with_symbol_config=no])
2691 AC_ARG_WITH(export-validation,
2692     AS_HELP_STRING([--without-export-validation],
2693         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2694 ,with_export_validation=auto)
2696 AC_ARG_WITH(bffvalidator,
2697     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2698         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2699          Requires installed Microsoft Office Binary File Format Validator.
2700          Note: export-validation (--with-export-validation) is required to be turned on.
2701          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2702 ,with_bffvalidator=no)
2704 libo_FUZZ_ARG_WITH(junit,
2705     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2706         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2707          --without-junit disables those tests. Not relevant in the --without-java case.]),
2708 ,with_junit=yes)
2710 AC_ARG_WITH(hamcrest,
2711     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2712         [Specifies the hamcrest jar file to use for JUnit-based tests.
2713          --without-junit disables those tests. Not relevant in the --without-java case.]),
2714 ,with_hamcrest=yes)
2716 AC_ARG_WITH(perl-home,
2717     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2718         [If you have installed Perl 5 Distribution, on your system, please
2719          supply the path here. Note that this is not the location of the Perl
2720          binary but the location of the entire distribution.]),
2723 libo_FUZZ_ARG_WITH(doxygen,
2724     AS_HELP_STRING(
2725         [--with-doxygen=<absolute path to doxygen executable>],
2726         [Specifies the doxygen executable to use when generating ODK C/C++
2727          documentation. --without-doxygen disables generation of ODK C/C++
2728          documentation. Not relevant in the --disable-odk case.]),
2729 ,with_doxygen=yes)
2731 AC_ARG_WITH(visual-studio,
2732     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2733         [Specify which Visual Studio version to use in case several are
2734          installed. Currently 2019 (default) and 2022 are supported.]),
2737 AC_ARG_WITH(windows-sdk,
2738     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2739         [Specify which Windows SDK, or "Windows Kit", version to use
2740          in case the one that came with the selected Visual Studio
2741          is not what you want for some reason. Note that not all compiler/SDK
2742          combinations are supported. The intent is that this option should not
2743          be needed.]),
2746 AC_ARG_WITH(lang,
2747     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2748         [Use this option to build LibreOffice with additional UI language support.
2749          English (US) is always included by default.
2750          Separate multiple languages with space.
2751          For all languages, use --with-lang=ALL.]),
2754 AC_ARG_WITH(locales,
2755     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2756         [Use this option to limit the locale information built in.
2757          Separate multiple locales with space.
2758          Very experimental and might well break stuff.
2759          Just a desperate measure to shrink code and data size.
2760          By default all the locales available is included.
2761          Just works with --disable-dynloading. Defaults to "ALL".
2762          This option is completely unrelated to --with-lang.])
2763     [
2764                           Affects also our character encoding conversion
2765                           tables for encodings mainly targeted for a
2766                           particular locale, like EUC-CN and EUC-TW for
2767                           zh, ISO-2022-JP for ja.
2769                           Affects also our add-on break iterator data for
2770                           some languages.
2772                           For the default, all locales, don't use this switch at all.
2773                           Specifying just the language part of a locale means all matching
2774                           locales will be included.
2775     ],
2778 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2779 # and also by Mariadb/Mysql since LibO 24.8
2780 libo_FUZZ_ARG_WITH(krb5,
2781     AS_HELP_STRING([--with-krb5],
2782         [Enable MIT Kerberos 5 support in modules that support it.
2783          By default automatically enabled on platforms
2784          where a good system Kerberos 5 is available.]),
2787 libo_FUZZ_ARG_WITH(gssapi,
2788     AS_HELP_STRING([--with-gssapi],
2789         [Enable GSSAPI support in modules that support it.
2790          By default automatically enabled on platforms
2791          where a good system GSSAPI is available.]),
2794 libo_FUZZ_ARG_WITH(lxml,
2795     AS_HELP_STRING([--without-lxml],
2796         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2797          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2798          report widget classes and ids.]),
2801 libo_FUZZ_ARG_WITH(latest-c++,
2802     AS_HELP_STRING([--with-latest-c++],
2803         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2804          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2805         [with_latest_c__=no])
2807 AC_ARG_WITH(gtk3-build,
2808     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2809         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2810          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2812 AC_ARG_WITH(keep-awake,
2813     AS_HELP_STRING([--with-keep-awake],
2814         [command to prefix make with in order to prevent the system from going to sleep/suspend
2815          while building.
2816          If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
2817          and caffeinate on macOS]))
2819 dnl ===================================================================
2820 dnl Branding
2821 dnl ===================================================================
2823 AC_ARG_WITH(branding,
2824     AS_HELP_STRING([--with-branding=/path/to/images],
2825         [Use given path to retrieve branding images set.])
2826     [
2827                           Search for intro.png about.svg and logo.svg.
2828                           If any is missing, default ones will be used instead.
2830                           Search also progress.conf for progress
2831                           settings on intro screen :
2833                           PROGRESSBARCOLOR="255,255,255" Set color of
2834                           progress bar. Comma separated RGB decimal values.
2835                           PROGRESSSIZE="407,6" Set size of progress bar.
2836                           Comma separated decimal values (width, height).
2837                           PROGRESSPOSITION="61,317" Set position of progress
2838                           bar from left,top. Comma separated decimal values.
2839                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2840                           bar frame. Comma separated RGB decimal values.
2841                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2842                           bar text. Comma separated RGB decimal values.
2843                           PROGRESSTEXTBASELINE="287" Set vertical position of
2844                           progress bar text from top. Decimal value.
2846                           Default values will be used if not found.
2847     ],
2851 AC_ARG_WITH(extra-buildid,
2852     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2853         [Show addition build identification in about dialog.]),
2857 AC_ARG_WITH(vendor,
2858     AS_HELP_STRING([--with-vendor="John the Builder"],
2859         [Set vendor of the build.]),
2862 AC_ARG_WITH(privacy-policy-url,
2863     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2864         [The URL to your privacy policy (needed when
2865          enabling online-update or crashreporting via breakpad)]),
2866         [if test "x$with_privacy_policy_url" = "xyes"; then
2867             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2868          elif test "x$with_privacy_policy_url" = "xno"; then
2869             with_privacy_policy_url="undefined"
2870          fi]
2871 ,[with_privacy_policy_url="undefined"])
2873 AC_ARG_WITH(android-package-name,
2874     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2875         [Set Android package name of the build.]),
2878 AC_ARG_WITH(compat-oowrappers,
2879     AS_HELP_STRING([--with-compat-oowrappers],
2880         [Install oo* wrappers in parallel with
2881          lo* ones to keep backward compatibility.
2882          Has effect only with make distro-pack-install]),
2885 AC_ARG_WITH(os-version,
2886     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2887         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2890 AC_ARG_WITH(parallelism,
2891     AS_HELP_STRING([--with-parallelism],
2892         [Number of jobs to run simultaneously during build. Parallel builds can
2893         save a lot of time on multi-cpu machines. Defaults to the number of
2894         CPUs on the machine, unless you configure --enable-icecream - then to
2895         40.]),
2898 AC_ARG_WITH(all-tarballs,
2899     AS_HELP_STRING([--with-all-tarballs],
2900         [Download all external tarballs unconditionally]))
2902 AC_ARG_WITH(gdrive-client-id,
2903     AS_HELP_STRING([--with-gdrive-client-id],
2904         [Provides the client id of the application for OAuth2 authentication
2905         on Google Drive. If either this or --with-gdrive-client-secret is
2906         empty, the feature will be disabled]),
2909 AC_ARG_WITH(gdrive-client-secret,
2910     AS_HELP_STRING([--with-gdrive-client-secret],
2911         [Provides the client secret of the application for OAuth2
2912         authentication on Google Drive. If either this or
2913         --with-gdrive-client-id is empty, the feature will be disabled]),
2916 AC_ARG_WITH(alfresco-cloud-client-id,
2917     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2918         [Provides the client id of the application for OAuth2 authentication
2919         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2920         empty, the feature will be disabled]),
2923 AC_ARG_WITH(alfresco-cloud-client-secret,
2924     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2925         [Provides the client secret of the application for OAuth2
2926         authentication on Alfresco Cloud. If either this or
2927         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2930 AC_ARG_WITH(onedrive-client-id,
2931     AS_HELP_STRING([--with-onedrive-client-id],
2932         [Provides the client id of the application for OAuth2 authentication
2933         on OneDrive. If either this or --with-onedrive-client-secret is
2934         empty, the feature will be disabled]),
2937 AC_ARG_WITH(onedrive-client-secret,
2938     AS_HELP_STRING([--with-onedrive-client-secret],
2939         [Provides the client secret of the application for OAuth2
2940         authentication on OneDrive. If either this or
2941         --with-onedrive-client-id is empty, the feature will be disabled]),
2944 dnl Check for coredumpctl support to present information about crashing test processes:
2945 AC_ARG_WITH(coredumpctl,
2946     AS_HELP_STRING([--with-coredumpctl],
2947         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2948         processes.]))
2950 AC_ARG_WITH(buildconfig-recorded,
2951     AS_HELP_STRING([--with-buildconfig-recorded],
2952         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2955 AC_MSG_CHECKING([whether to record build config])
2956 if test -z "$with_buildconfig_recorded"; then
2957     with_buildconfig_recorded=no
2959 if test "$with_buildconfig_recorded" = no; then
2960     AC_MSG_RESULT([no])
2961 else
2962     AC_MSG_RESULT([yes])
2963     # replace backslashes, to get a valid c++ string
2964     config_args=$(echo $ac_configure_args | tr '\\' '/')
2965     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2966     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2969 dnl ===================================================================
2970 dnl Do we want to use pre-build binary tarball for recompile
2971 dnl ===================================================================
2973 if test "$enable_library_bin_tar" = "yes" ; then
2974     USE_LIBRARY_BIN_TAR=TRUE
2975 else
2976     USE_LIBRARY_BIN_TAR=
2978 AC_SUBST(USE_LIBRARY_BIN_TAR)
2980 dnl ===================================================================
2981 dnl Test whether build target is Release Build
2982 dnl ===================================================================
2983 AC_MSG_CHECKING([whether build target is Release Build])
2984 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2985     AC_MSG_RESULT([no])
2986     ENABLE_RELEASE_BUILD=
2987     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2988     dnl the newlines and then complains about spaces.
2989     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/>'
2990 else
2991     AC_MSG_RESULT([yes])
2992     ENABLE_RELEASE_BUILD=TRUE
2993     GET_TASK_ALLOW_ENTITLEMENT=
2995 AC_SUBST(ENABLE_RELEASE_BUILD)
2996 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2998 dnl ===================================================================
2999 dnl Test whether build should auto use hardening compiler flags
3000 dnl ===================================================================
3001 AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
3002 if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
3003     AC_MSG_RESULT([no])
3004     ENABLE_HARDENING_FLAGS=
3005 else
3006     AC_MSG_RESULT([yes])
3007     ENABLE_HARDENING_FLAGS=TRUE
3009 AC_SUBST(ENABLE_HARDENING_FLAGS)
3011 AC_MSG_CHECKING([whether to build a Community flavor])
3012 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
3013     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
3014     AC_MSG_RESULT([yes])
3015 else
3016     AC_MSG_RESULT([no])
3019 dnl ===================================================================
3020 dnl Test whether to sign Windows Build
3021 dnl ===================================================================
3022 AC_MSG_CHECKING([whether to sign windows build])
3023 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
3024     AC_MSG_RESULT([yes])
3025     WINDOWS_BUILD_SIGNING="TRUE"
3026 else
3027     AC_MSG_RESULT([no])
3028     WINDOWS_BUILD_SIGNING="FALSE"
3030 AC_SUBST(WINDOWS_BUILD_SIGNING)
3032 dnl ===================================================================
3033 dnl MacOSX build and runtime environment options
3034 dnl ===================================================================
3036 AC_ARG_WITH(macosx-version-min-required,
3037     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
3038         [set the minimum OS version needed to run the built LibreOffice])
3039     [
3040                           e. g.: --with-macosx-version-min-required=10.15
3041     ],
3044 dnl ===================================================================
3045 dnl Check for incompatible options set by fuzzing, and reset those
3046 dnl automatically to working combinations
3047 dnl ===================================================================
3049 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
3050         "$enable_dbus" != "$enable_avahi"; then
3051     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
3052     enable_avahi=$enable_dbus
3055 add_lopath_after ()
3057     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
3058         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
3059     fi
3062 add_lopath_before ()
3064     local IFS=${P_SEP}
3065     local path_cleanup
3066     local dir
3067     for dir in $LO_PATH ; do
3068         if test "$dir" != "$1" ; then
3069             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
3070         fi
3071     done
3072     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
3075 dnl ===================================================================
3076 dnl check for required programs (grep, awk, sed, bash)
3077 dnl ===================================================================
3079 pathmunge ()
3081     local new_path
3082     if test -n "$1"; then
3083         if test "$build_os" = "cygwin"; then
3084             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3085                 PathFormat "$1"
3086                 new_path=`cygpath -sm "$formatted_path"`
3087             else
3088                 PathFormat "$1"
3089                 new_path=`cygpath -u "$formatted_path"`
3090             fi
3091         else
3092             new_path="$1"
3093         fi
3094         if test "$2" = "after"; then
3095             add_lopath_after "$new_path"
3096         else
3097             add_lopath_before "$new_path"
3098         fi
3099     fi
3102 AC_PROG_AWK
3103 AC_PATH_PROG( AWK, $AWK)
3104 if test -z "$AWK"; then
3105     AC_MSG_ERROR([install awk to run this script])
3108 AC_PATH_PROG(BASH, bash)
3109 if test -z "$BASH"; then
3110     AC_MSG_ERROR([bash not found in \$PATH])
3112 AC_SUBST(BASH)
3114 # prefer parallel compression tools, if available
3115 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3116 if test -z "$COMPRESSIONTOOL"; then
3117     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3118     if test -z "$COMPRESSIONTOOL"; then
3119         AC_MSG_ERROR([gzip not found in \$PATH])
3120     fi
3122 AC_SUBST(COMPRESSIONTOOL)
3124 AC_MSG_CHECKING([for GNU or BSD tar])
3125 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3126     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3127     if test $? -eq 0;  then
3128         GNUTAR=$a
3129         break
3130     fi
3131 done
3132 AC_MSG_RESULT($GNUTAR)
3133 if test -z "$GNUTAR"; then
3134     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3136 AC_SUBST(GNUTAR)
3138 AC_MSG_CHECKING([for tar's option to strip components])
3139 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3140 if test $? -eq 0; then
3141     STRIP_COMPONENTS="--strip-components"
3142 else
3143     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3144     if test $? -eq 0; then
3145         STRIP_COMPONENTS="--strip-path"
3146     else
3147         STRIP_COMPONENTS="unsupported"
3148     fi
3150 AC_MSG_RESULT($STRIP_COMPONENTS)
3151 if test x$STRIP_COMPONENTS = xunsupported; then
3152     AC_MSG_ERROR([you need a tar that is able to strip components.])
3154 AC_SUBST(STRIP_COMPONENTS)
3156 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3157 dnl desktop OSes from "mobile" ones.
3159 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3160 dnl In other words, that when building for an OS that is not a
3161 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3163 dnl Note the direction of the implication; there is no assumption that
3164 dnl cross-compiling would imply a non-desktop OS.
3166 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3167     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3168     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3169     if test "$_os" != Emscripten; then
3170         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3171     fi
3174 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3175 # also work with the default gtk3 plugin.
3176 if test "$enable_wasm_strip" = "yes"; then
3177     enable_avmedia=no
3178     enable_libcmis=no
3179     enable_coinmp=no
3180     enable_cups=no
3181     test "$_os" = Emscripten && enable_curl=no
3182     enable_database_connectivity=no
3183     enable_dbus=no
3184     enable_dconf=no
3185     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3186     enable_extension_integration=no
3187     enable_extensions=no
3188     enable_extension_update=no
3189     enable_gio=no
3190     enable_gpgmepp=no
3191     enable_ldap=no
3192     enable_lotuswordpro=no
3193     enable_lpsolve=no
3194     enable_nss=no
3195     enable_odk=no
3196     enable_online_update=no
3197     enable_opencl=no
3198     enable_pdfimport=no
3199     enable_randr=no
3200     enable_report_builder=no
3201     enable_scripting=no
3202     enable_sdremote_bluetooth=no
3203     enable_skia=no
3204     enable_xmlhelp=no
3205     enable_zxing=no
3206     test_libepubgen=no
3207     test_libcdr=no
3208     test_libcmis=no
3209     test_libetonyek=no
3210     test_libfreehand=no
3211     test_libmspub=no
3212     test_libpagemaker=no
3213     test_libqxp=no
3214     test_libvisio=no
3215     test_libzmf=no
3216     test_webdav=no
3217     with_galleries=no
3218     with_templates=no
3219     with_webdav=no
3220     with_x=no
3222     test "${with_fonts+set}" = set || with_fonts=yes
3223     test "${with_locales+set}" = set || with_locales=en
3225     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3226     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3227     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3228     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3229 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3230     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3231     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3232     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3233     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3234 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3235     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3236     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3237     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3238     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3239     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3240     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3241     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3242     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3245 # Whether to build "avmedia" functionality or not.
3247 if test "$enable_avmedia" = yes; then
3248     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3249     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3250 else
3251     test_gstreamer_1_0=no
3254 # Decide whether to build database connectivity stuff (including Base) or not.
3255 if test "$enable_database_connectivity" != no; then
3256     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3257     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3258 else
3259     if test "$_os" = iOS; then
3260         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3261     fi
3262     disable_database_connectivity_dependencies
3265 if test -z "$enable_extensions"; then
3266     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3267     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3268         enable_extensions=yes
3269     fi
3272 DISABLE_SCRIPTING=''
3273 if test "$enable_scripting" = yes; then
3274     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3275     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3276 else
3277     DISABLE_SCRIPTING='TRUE'
3278     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3281 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3282     # Disable dynamic_loading always for iOS and Android
3283     enable_dynamic_loading=no
3284 elif test -z "$enable_dynamic_loading"; then
3285     # Otherwise enable it unless specifically disabled
3286     enable_dynamic_loading=yes
3289 DISABLE_DYNLOADING=''
3290 if test "$enable_dynamic_loading" = yes; then
3291     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3292 else
3293     DISABLE_DYNLOADING='TRUE'
3294     if test $_os != iOS -a $_os != Android; then
3295         enable_database_connectivity=no
3296         enable_nss=no
3297         enable_odk=no
3298         enable_python=no
3299         enable_skia=no
3300         with_java=no
3301     fi
3303 AC_SUBST(DISABLE_DYNLOADING)
3305 ENABLE_CUSTOMTARGET_COMPONENTS=
3306 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3307     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3308     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3309         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3310     fi
3312 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3314 if test "$enable_extensions" = yes; then
3315     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3316     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3317 else
3318     enable_extension_integration=no
3319     enable_extension_update=no
3322 # remember SYSBASE value
3323 AC_SUBST(SYSBASE)
3325 dnl ===================================================================
3326 dnl  Sort out various gallery compilation options
3327 dnl ===================================================================
3328 WITH_GALLERY_BUILD=TRUE
3329 AC_MSG_CHECKING([how to build and package galleries])
3330 if test -n "${with_galleries}"; then
3331     if test "$with_galleries" = "build"; then
3332         if test "$enable_database_connectivity" = no; then
3333             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3334         fi
3335         AC_MSG_RESULT([build from source images internally])
3336     elif test "$with_galleries" = "no"; then
3337         WITH_GALLERY_BUILD=
3338         AC_MSG_RESULT([disable non-internal gallery build])
3339     else
3340         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3341     fi
3342 else
3343     if test $_os != iOS -a $_os != Android; then
3344         AC_MSG_RESULT([internal src images for desktop])
3345     else
3346         WITH_GALLERY_BUILD=
3347         AC_MSG_RESULT([disable src image build])
3348     fi
3350 AC_SUBST(WITH_GALLERY_BUILD)
3352 dnl ===================================================================
3353 dnl  Sort out various templates compilation options
3354 dnl ===================================================================
3355 WITH_TEMPLATES=TRUE
3356 AC_MSG_CHECKING([build with or without template files])
3357 if test -n "${with_templates}"; then
3358     if test "$with_templates" = "yes"; then
3359         AC_MSG_RESULT([enable all templates])
3360     elif test "$with_templates" = "no"; then
3361         WITH_TEMPLATES=
3362         AC_MSG_RESULT([disable non-internal templates])
3363     else
3364         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3365     fi
3366 else
3367     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3368         AC_MSG_RESULT([enable all templates])
3369     else
3370         WITH_TEMPLATES=
3371         AC_MSG_RESULT([disable non-internal templates])
3372     fi
3374 AC_SUBST(WITH_TEMPLATES)
3376 dnl ===================================================================
3377 dnl  Checks if ccache is available
3378 dnl ===================================================================
3379 CCACHE_DEPEND_MODE=
3380 if test "$enable_ccache" = "no"; then
3381     CCACHE=""
3382 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3383     case "%$CC%$CXX%" in
3384     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3385     # assume that's good then
3386     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3387         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3388         CCACHE_DEPEND_MODE=1
3389         ;;
3390     *)
3391         # try to use our own ccache if it is available and CCACHE was not already defined
3392         if test -z "$CCACHE"; then
3393             if test "$_os" = "WINNT"; then
3394                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3395             fi
3396             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3397                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3398             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3399                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3400             fi
3401         fi
3402         AC_PATH_PROG([CCACHE],[ccache],[not found])
3403         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3404             CCACHE=`win_short_path_for_make "$CCACHE"`
3405             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3406             rm -f conftest.txt
3407             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3408             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3409             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3410                 AC_MSG_RESULT(yes)
3411             else
3412                 AC_MSG_RESULT(no)
3413                 CCACHE="not found"
3414             fi
3415             rm -f conftest.txt
3416         fi
3417         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3418             # on windows/VC perhaps sccache is around?
3419             case "%$CC%$CXX%" in
3420             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3421             # assume that's good then
3422             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3423                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3424                 CCACHE_DEPEND_MODE=1
3425                 SCCACHE=1
3426                 ;;
3427             *)
3428                 # for sharing code below, reuse CCACHE env var
3429                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3430                 if test "$CCACHE" != "not found"; then
3431                     CCACHE=`win_short_path_for_make "$CCACHE"`
3432                     SCCACHE=1
3433                     CCACHE_DEPEND_MODE=1
3434                 fi
3435                 ;;
3436             esac
3437         fi
3438         if test "$CCACHE" = "not found"; then
3439             CCACHE=""
3440         fi
3441         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3442             CCACHE_DEPEND_MODE=1
3443             # Need to check for ccache version: otherwise prevents
3444             # caching of the results (like "-x objective-c++" for Mac)
3445             if test $_os = Darwin -o $_os = iOS; then
3446                 # Check ccache version
3447                 AC_MSG_CHECKING([whether version of ccache is suitable])
3448                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3449                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3450                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3451                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3452                 else
3453                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3454                     CCACHE=""
3455                     CCACHE_DEPEND_MODE=
3456                 fi
3457             fi
3458         fi
3459         if test "$enable_ccache" = yes && test -z "$CCACHE"; then
3460             AC_MSG_ERROR([No suitable ccache found])
3461         fi
3462         ;;
3463     esac
3464 else
3465     CCACHE=""
3467 if test "$enable_ccache" = "nodepend"; then
3468     CCACHE_DEPEND_MODE=""
3470 AC_SUBST(CCACHE_DEPEND_MODE)
3472 # sccache defaults are good enough
3473 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3474     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3475     # or (...) max_size = 20.0 G
3476     # -p works with both 4.2 and 4.4
3477     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3478     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3479     if test "$ccache_size" = ""; then
3480         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3481         if test "$ccache_size" = ""; then
3482             ccache_size=0
3483         fi
3484         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3485         if test $ccache_size -lt 1024; then
3486             CCACHE=""
3487             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3488             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3489         else
3490             # warn that ccache may be too small for debug build
3491             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3492             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3493         fi
3494     else
3495         if test $ccache_size -lt 5; then
3496             #warn that ccache may be too small for debug build
3497             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3498             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3499         fi
3500     fi
3503 ENABLE_Z7_DEBUG=
3504 if test "$enable_z7_debug" != no; then
3505     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3506         ENABLE_Z7_DEBUG=TRUE
3507     fi
3508 else
3509     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3510     add_warning "ccache will not work with --disable-z7-debug"
3512 AC_SUBST(ENABLE_Z7_DEBUG)
3514 dnl ===================================================================
3515 dnl  Checks for C compiler,
3516 dnl  The check for the C++ compiler is later on.
3517 dnl ===================================================================
3518 if test "$_os" != "WINNT"; then
3519     GCC_HOME_SET="true"
3520     AC_MSG_CHECKING([gcc home])
3521     if test -z "$with_gcc_home"; then
3522         if test "$enable_icecream" = "yes"; then
3523             if test -d "/usr/lib/icecc/bin"; then
3524                 GCC_HOME="/usr/lib/icecc/"
3525             elif test -d "/usr/libexec/icecc/bin"; then
3526                 GCC_HOME="/usr/libexec/icecc/"
3527             elif test -d "/opt/icecream/bin"; then
3528                 GCC_HOME="/opt/icecream/"
3529             else
3530                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3532             fi
3533         else
3534             GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
3535             GCC_HOME_SET="false"
3536         fi
3537     else
3538         GCC_HOME="$with_gcc_home"
3539     fi
3540     AC_MSG_RESULT($GCC_HOME)
3541     AC_SUBST(GCC_HOME)
3543     if test "$GCC_HOME_SET" = "true"; then
3544         if test -z "$CC"; then
3545             CC="$GCC_HOME/bin/gcc"
3546             CC_BASE="gcc"
3547         fi
3548         if test -z "$CXX"; then
3549             CXX="$GCC_HOME/bin/g++"
3550             CXX_BASE="g++"
3551         fi
3552     fi
3555 COMPATH=`dirname "$CC"`
3556 if test "$COMPATH" = "."; then
3557     AC_PATH_PROGS(COMPATH, $CC)
3558     dnl double square bracket to get single because of M4 quote...
3559     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3561 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3563 dnl ===================================================================
3564 dnl Java support
3565 dnl ===================================================================
3566 AC_MSG_CHECKING([whether to build with Java support])
3567 javacompiler="javac"
3568 javadoc="javadoc"
3569 if test "$with_java" != "no"; then
3570     if test "$DISABLE_SCRIPTING" = TRUE; then
3571         AC_MSG_RESULT([no, overridden by --disable-scripting])
3572         ENABLE_JAVA=""
3573         with_java=no
3574     else
3575         AC_MSG_RESULT([yes])
3576         ENABLE_JAVA="TRUE"
3577         AC_DEFINE(HAVE_FEATURE_JAVA)
3578     fi
3579 else
3580     AC_MSG_RESULT([no])
3581     ENABLE_JAVA=""
3584 AC_SUBST(ENABLE_JAVA)
3586 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3588 dnl ENABLE_JAVA="" indicate no Java support at all
3590 dnl ===================================================================
3591 dnl Check macOS SDK and compiler
3592 dnl ===================================================================
3594 if test $_os = Darwin; then
3596     # The SDK in the currently selected Xcode should be found.
3598     AC_MSG_CHECKING([what macOS SDK to use])
3599     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3600     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3601     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3602     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3603     # problems that existed in the PPC days with target versions not being respected or random
3604     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3605     # SDK version is enough, no need to do both...
3606     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3607     if test ! -d "$MACOSX_SDK_PATH"; then
3608         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3609     fi
3610     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3611     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3612     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3613     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3614     # 10.10.2 is 101002
3615     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3616     # correct version in case such an old SDK is specified, it will be rejected later anyway
3617     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3618     if test $MACOSX_SDK_VERSION -lt 101500; then
3619         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3620     fi
3621     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3622         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3623     fi
3624     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3626     AC_MSG_CHECKING([what minimum version of macOS to require])
3627     if test "$with_macosx_version_min_required" = "" ; then
3628         if test "$host_cpu" = x86_64; then
3629             with_macosx_version_min_required="10.15";
3630         else
3631             with_macosx_version_min_required="11.0";
3632         fi
3633     fi
3634     # see same notes about MACOSX_SDK_VERSION above
3635     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3636     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3637         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3638     fi
3639     AC_MSG_RESULT([$with_macosx_version_min_required])
3641     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3642     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3643         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3644     else
3645         AC_MSG_RESULT([yes])
3646     fi
3648     # export this so that "xcrun" invocations later return matching values
3649     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3650     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3651     export DEVELOPER_DIR
3652     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3653     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3655     AC_MSG_CHECKING([whether Xcode is new enough])
3656     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3657     my_xcode_ver2=${my_xcode_ver1#Xcode }
3658     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3659     if test "$my_xcode_ver3" -ge 1205; then
3660         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3661         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3662             if test "$my_xcode_ver3" -ge 1600; then
3663                 dnl the Xcode 15 relnotes state that the classic linker will disappear in the next version, but nothing about
3664                 dnl fixing the problem with weak symbols/macOS 11 compatibility, so assume for now that Xcode 16 will break it...
3665                 AC_MSG_ERROR([Check that Xcode 16 still supports the old linker/that it doesn't break macOS 11 compatibility, then remove this check]);
3666             fi
3667             if test "$my_xcode_ver3" -ge 1500; then
3668                 AC_MSG_WARN([Xcode 15 has a new linker that causes runtime crashes on macOS 11])
3669                 add_warning "Xcode 15 has a new linker that causes runtime crashes on macOS 11, forcing the old linker."
3670                 add_warning "see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking"
3671                 LDFLAGS="$LDFLAGS -Wl,-ld_classic"
3672                 # if LDFLAGS weren't set already, a check above sets x_LDFLAGS=[#] to comment-out the export LDFLAGS line in config_host.mk
3673                 x_LDFLAGS=
3674             fi
3675         fi
3676     else
3677         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3678     fi
3680     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3681     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3683     LIBTOOL=/usr/bin/libtool
3684     INSTALL_NAME_TOOL=install_name_tool
3685     if test -z "$save_CC"; then
3686         stdlib=-stdlib=libc++
3688         AC_MSG_CHECKING([what C compiler to use])
3689         CC="`xcrun -find clang`"
3690         CC_BASE=`first_arg_basename "$CC"`
3691         if test "$host_cpu" = x86_64; then
3692             CC+=" -target x86_64-apple-macos"
3693         else
3694             CC+=" -target arm64-apple-macos"
3695         fi
3696         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3697         AC_MSG_RESULT([$CC])
3699         AC_MSG_CHECKING([what C++ compiler to use])
3700         CXX="`xcrun -find clang++`"
3701         CXX_BASE=`first_arg_basename "$CXX"`
3702         if test "$host_cpu" = x86_64; then
3703             CXX+=" -target x86_64-apple-macos"
3704         else
3705             CXX+=" -target arm64-apple-macos"
3706         fi
3707         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3708         AC_MSG_RESULT([$CXX])
3710         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3711         AR=`xcrun -find ar`
3712         NM=`xcrun -find nm`
3713         STRIP=`xcrun -find strip`
3714         LIBTOOL=`xcrun -find libtool`
3715         RANLIB=`xcrun -find ranlib`
3716     fi
3718     AC_MSG_CHECKING([whether to do code signing])
3720     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3721         AC_MSG_RESULT([no])
3722     else
3723         if test "$enable_macosx_code_signing" = yes; then
3724             # By default use the first suitable certificate (?).
3726             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3727             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3728             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3729             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3730             # "Developer ID Application" one.
3731             identity="Developer ID Application:"
3732         else
3733             identity=$enable_macosx_code_signing
3734         fi
3735         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3736         if test -n "$identity"; then
3737             MACOSX_CODESIGNING_IDENTITY=$identity
3738             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3739             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3740         else
3741             AC_MSG_ERROR([cannot determine identity to use])
3742         fi
3743     fi
3745     AC_MSG_CHECKING([whether to create a Mac App Store package])
3747     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3748         AC_MSG_RESULT([no])
3749     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3750         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3751     else
3752         if test "$enable_macosx_package_signing" = yes; then
3753             # By default use the first suitable certificate.
3754             # It should be a "3rd Party Mac Developer Installer" one
3755             identity="3rd Party Mac Developer Installer:"
3756         else
3757             identity=$enable_macosx_package_signing
3758         fi
3759         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3760         if test -n "$identity"; then
3761             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3762             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3763             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3764         else
3765             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3766         fi
3767     fi
3769     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3770         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3771     fi
3773     AC_MSG_CHECKING([whether to sandbox the application])
3775     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3776         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3777     elif test "$enable_macosx_sandbox" = yes; then
3778         ENABLE_MACOSX_SANDBOX=TRUE
3779         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3780         AC_MSG_RESULT([yes])
3781     else
3782         AC_MSG_RESULT([no])
3783     fi
3785     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3786     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3787     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3789     if test -n "$with_macosx_provisioning_profile" ; then
3790         if test ! -f "$with_macosx_provisioning_profile"; then
3791             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3792         else
3793             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3794             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3795                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3796                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3797                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3798         fi
3799     fi
3801 AC_SUBST(MACOSX_SDK_PATH)
3802 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3803 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3804 AC_SUBST(INSTALL_NAME_TOOL)
3805 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3806 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3807 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3808 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3809 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3810 AC_SUBST(MACOSX_PROVISIONING_INFO)
3811 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3812 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3813 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3815 dnl ===================================================================
3816 dnl Check iOS SDK and compiler
3817 dnl ===================================================================
3819 if test $_os = iOS; then
3820     AC_MSG_CHECKING([what iOS SDK to use])
3822     if test "$enable_ios_simulator" = "yes"; then
3823         platformlc=iphonesimulator
3824         versionmin=-mios-simulator-version-min=14.5
3825     else
3826         platformlc=iphoneos
3827         versionmin=-miphoneos-version-min=14.5
3828     fi
3830     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3832     if ! test -d "$sysroot"; then
3833         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3834     fi
3836     AC_MSG_RESULT($sysroot)
3838     stdlib="-stdlib=libc++"
3840     AC_MSG_CHECKING([what C compiler to use])
3841     CC="`xcrun -find clang`"
3842     CC_BASE=`first_arg_basename "$CC"`
3843     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3844     AC_MSG_RESULT([$CC])
3846     AC_MSG_CHECKING([what C++ compiler to use])
3847     CXX="`xcrun -find clang++`"
3848     CXX_BASE=`first_arg_basename "$CXX"`
3849     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3850     AC_MSG_RESULT([$CXX])
3852     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3853     AR=`xcrun -find ar`
3854     NM=`xcrun -find nm`
3855     STRIP=`xcrun -find strip`
3856     LIBTOOL=`xcrun -find libtool`
3857     RANLIB=`xcrun -find ranlib`
3860 AC_MSG_CHECKING([whether to treat the installation as read-only])
3862 if test $_os = Darwin; then
3863     enable_readonly_installset=yes
3864 elif test "$enable_extensions" != yes; then
3865     enable_readonly_installset=yes
3867 if test "$enable_readonly_installset" = yes; then
3868     AC_MSG_RESULT([yes])
3869     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3870 else
3871     AC_MSG_RESULT([no])
3874 dnl ===================================================================
3875 dnl Structure of install set
3876 dnl ===================================================================
3878 if test $_os = Darwin; then
3879     LIBO_BIN_FOLDER=MacOS
3880     LIBO_ETC_FOLDER=Resources
3881     LIBO_LIBEXEC_FOLDER=MacOS
3882     LIBO_LIB_FOLDER=Frameworks
3883     LIBO_LIB_PYUNO_FOLDER=Resources
3884     LIBO_SHARE_FOLDER=Resources
3885     LIBO_SHARE_HELP_FOLDER=Resources/help
3886     LIBO_SHARE_JAVA_FOLDER=Resources/java
3887     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3888     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3889     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3890     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3891     LIBO_URE_BIN_FOLDER=MacOS
3892     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3893     LIBO_URE_LIB_FOLDER=Frameworks
3894     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3895     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3896 elif test $_os = WINNT; then
3897     LIBO_BIN_FOLDER=program
3898     LIBO_ETC_FOLDER=program
3899     LIBO_LIBEXEC_FOLDER=program
3900     LIBO_LIB_FOLDER=program
3901     LIBO_LIB_PYUNO_FOLDER=program
3902     LIBO_SHARE_FOLDER=share
3903     LIBO_SHARE_HELP_FOLDER=help
3904     LIBO_SHARE_JAVA_FOLDER=program/classes
3905     LIBO_SHARE_PRESETS_FOLDER=presets
3906     LIBO_SHARE_READMES_FOLDER=readmes
3907     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3908     LIBO_SHARE_SHELL_FOLDER=program/shell
3909     LIBO_URE_BIN_FOLDER=program
3910     LIBO_URE_ETC_FOLDER=program
3911     LIBO_URE_LIB_FOLDER=program
3912     LIBO_URE_MISC_FOLDER=program
3913     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3914 else
3915     LIBO_BIN_FOLDER=program
3916     LIBO_ETC_FOLDER=program
3917     LIBO_LIBEXEC_FOLDER=program
3918     LIBO_LIB_FOLDER=program
3919     LIBO_LIB_PYUNO_FOLDER=program
3920     LIBO_SHARE_FOLDER=share
3921     LIBO_SHARE_HELP_FOLDER=help
3922     LIBO_SHARE_JAVA_FOLDER=program/classes
3923     LIBO_SHARE_PRESETS_FOLDER=presets
3924     LIBO_SHARE_READMES_FOLDER=readmes
3925     if test "$enable_fuzzers" != yes; then
3926         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3927     else
3928         LIBO_SHARE_RESOURCE_FOLDER=resource
3929     fi
3930     LIBO_SHARE_SHELL_FOLDER=program/shell
3931     LIBO_URE_BIN_FOLDER=program
3932     LIBO_URE_ETC_FOLDER=program
3933     LIBO_URE_LIB_FOLDER=program
3934     LIBO_URE_MISC_FOLDER=program
3935     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3937 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3938 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3939 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3940 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3941 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3942 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3943 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3944 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3945 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3946 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3947 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3948 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3949 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3950 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3951 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3952 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3954 # Not all of them needed in config_host.mk, add more if need arises
3955 AC_SUBST(LIBO_BIN_FOLDER)
3956 AC_SUBST(LIBO_ETC_FOLDER)
3957 AC_SUBST(LIBO_LIB_FOLDER)
3958 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3959 AC_SUBST(LIBO_SHARE_FOLDER)
3960 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3961 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3962 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3963 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3964 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3965 AC_SUBST(LIBO_URE_BIN_FOLDER)
3966 AC_SUBST(LIBO_URE_ETC_FOLDER)
3967 AC_SUBST(LIBO_URE_LIB_FOLDER)
3968 AC_SUBST(LIBO_URE_MISC_FOLDER)
3969 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3971 dnl ===================================================================
3972 dnl Windows specific tests and stuff
3973 dnl ===================================================================
3975 reg_get_value()
3977     # Return value: $regvalue
3978     unset regvalue
3980     if test "$build_os" = "wsl"; then
3981         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
3982         return
3983     elif test -n "$WSL_ONLY_AS_HELPER"; then
3984         regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
3985         return
3986     fi
3988     local _regentry="/proc/registry${1}/${2}/${3}"
3989     if test -f "$_regentry"; then
3990         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3991         # Registry keys read via /proc/registry* are always \0 terminated!
3992         local _regvalue=$(tr -d '\0' < "$_regentry")
3993         if test $? -eq 0; then
3994             regvalue=$_regvalue
3995         fi
3996     fi
3999 # Get a value from the 32-bit side of the Registry
4000 reg_get_value_32()
4002     reg_get_value "32" "$1" "$2"
4005 # Get a value from the 64-bit side of the Registry
4006 reg_get_value_64()
4008     reg_get_value "64" "$1" "$2"
4011 reg_list_values()
4013     # Return value: $reglist
4014     unset reglist
4016     if test "$build_os" = "wsl"; then
4017         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
4018         return
4019     fi
4021     reglist=$(ls "/proc/registry${1}/${2}")
4024 # List values from the 32-bit side of the Registry
4025 reg_list_values_32()
4027     reg_list_values "32" "$1"
4030 # List values from the 64-bit side of the Registry
4031 reg_list_values_64()
4033     reg_list_values "64" "$1"
4036 case "$host_os" in
4037 cygwin*|wsl*)
4038     COM=MSC
4039     OS=WNT
4040     RTL_OS=Windows
4041     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4042         P_SEP=";"
4043     else
4044         P_SEP=:
4045     fi
4046     case "$host_cpu" in
4047     x86_64)
4048         CPUNAME=X86_64
4049         RTL_ARCH=X86_64
4050         PLATFORMID=windows_x86_64
4051         WINDOWS_X64=1
4052         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4053         WIN_HOST_ARCH="x64"
4054         WIN_MULTI_ARCH="x86"
4055         WIN_HOST_BITS=64
4056         ;;
4057     i*86)
4058         CPUNAME=INTEL
4059         RTL_ARCH=x86
4060         PLATFORMID=windows_x86
4061         WIN_HOST_ARCH="x86"
4062         WIN_HOST_BITS=32
4063         WIN_OTHER_ARCH="x64"
4064         ;;
4065     aarch64)
4066         CPUNAME=AARCH64
4067         RTL_ARCH=AARCH64
4068         PLATFORMID=windows_aarch64
4069         WINDOWS_X64=1
4070         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
4071         WIN_HOST_ARCH="arm64"
4072         WIN_HOST_BITS=64
4073         with_ucrt_dir=no
4074         ;;
4075     *)
4076         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4077         ;;
4078     esac
4080     case "$build_cpu" in
4081     x86_64) WIN_BUILD_ARCH="x64" ;;
4082     i*86) WIN_BUILD_ARCH="x86" ;;
4083     aarch64) WIN_BUILD_ARCH="arm64" ;;
4084     *)
4085         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
4086         ;;
4087     esac
4089     SCPDEFS="$SCPDEFS -D_MSC_VER"
4090     ;;
4091 esac
4093 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4094 # other-arch won't, but wouldn't break the build (x64 on x86).
4095 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4096     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4100 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4101     # To allow building Windows multi-arch releases without cross-tooling
4102     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4103         cross_compiling="yes"
4104     fi
4107 if test "$cross_compiling" = "yes"; then
4108     export CROSS_COMPILING=TRUE
4109     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4110         ENABLE_WASM_STRIP=TRUE
4111     fi
4112     if test "$_os" = "Emscripten"; then
4113         if test "$with_main_module" = "calc"; then
4114             ENABLE_WASM_STRIP_WRITER=TRUE
4115         elif test "$with_main_module" = "writer"; then
4116             ENABLE_WASM_STRIP_CALC=TRUE
4117         fi
4118     fi
4119 else
4120     CROSS_COMPILING=
4121     BUILD_TYPE="$BUILD_TYPE NATIVE"
4123 AC_SUBST(CROSS_COMPILING)
4124 AC_SUBST(ENABLE_WASM_STRIP)
4125 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4126 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4128 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4129 # NOTE: must _not_ be used for bundled external libraries!
4130 ISYSTEM=
4131 if test "$GCC" = "yes"; then
4132     AC_MSG_CHECKING( for -isystem )
4133     save_CFLAGS=$CFLAGS
4134     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4135     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4136     CFLAGS=$save_CFLAGS
4137     if test -n "$ISYSTEM"; then
4138         AC_MSG_RESULT(yes)
4139     else
4140         AC_MSG_RESULT(no)
4141     fi
4143 if test -z "$ISYSTEM"; then
4144     # fall back to using -I
4145     ISYSTEM=-I
4147 AC_SUBST(ISYSTEM)
4149 dnl ===================================================================
4150 dnl  Check which Visual Studio compiler is used
4151 dnl ===================================================================
4153 map_vs_year_to_version()
4155     # Return value: $vsversion
4157     unset vsversion
4159     case $1 in
4160     2019)
4161         vsversion=16;;
4162     2022)
4163         vsversion=17;;
4164     2022preview)
4165         vsversion=17.10;;
4166     *)
4167         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4168     esac
4171 vs_versions_to_check()
4173     # Args: $1 (optional) : versions to check, in the order of preference
4174     # Return value: $vsversions
4176     unset vsversions
4178     if test -n "$1"; then
4179         map_vs_year_to_version "$1"
4180         vsversions=$vsversion
4181     else
4182         # Default version is 2019
4183         vsversions="16"
4184     fi
4187 win_get_env_from_vsdevcmdbat()
4189     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4190     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4191     PathFormat "$VC_PRODUCT_DIR"
4192     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
4193     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4194     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4195     local result
4196     if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
4197         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4198     else
4199         chmod +x $WRAPPERBATCHFILEPATH
4200         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4201     fi
4202     rm -f $WRAPPERBATCHFILEPATH
4203     printf '%s' "$result"
4206 find_ucrt()
4208     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
4209     if test -n "$regvalue"; then
4210         PathFormat "$regvalue"
4211         UCRTSDKDIR=$formatted_path_unix
4212         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
4213         if test -n "$regvalue"; then
4214             UCRTVERSION="$regvalue".0
4215         fi
4217         # Rest if not exist
4218         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4219           UCRTSDKDIR=
4220         fi
4221     fi
4222     if test -z "$UCRTSDKDIR"; then
4223         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4224         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4225         if test -f "$ide_env_file"; then
4226             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4227             UCRTSDKDIR=$formatted_path_unix
4228             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4229             dnl Hack needed at least by tml:
4230             if test "$UCRTVERSION" = 10.0.15063.0 \
4231                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4232                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4233             then
4234                 UCRTVERSION=10.0.14393.0
4235             fi
4236         else
4237           AC_MSG_ERROR([No UCRT found])
4238         fi
4239     fi
4242 find_msvc()
4244     # Find Visual C++
4245     # Args: $1 (optional) : The VS version year
4246     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4248     unset vctest vctoolset vcnumwithdot vcbuildnumber
4250     vs_versions_to_check "$1"
4251     if test "$build_os" = wsl; then
4252         vswhere="$PROGRAMFILESX86"
4253         if test -z "$vswhere"; then
4254             vswhere="c:\\Program Files (x86)"
4255         fi
4256     elif test -n "$WSL_ONLY_AS_HELPER"; then
4257         vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
4258     else
4259         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4260     fi
4261     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4262     PathFormat "$vswhere"
4263     vswhere=$formatted_path_unix
4264     for ver in $vsversions; do
4265         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4266         if test -z "$vswhereoutput"; then
4267             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4268         fi
4269         # Fall back to all MS products (this includes VC++ Build Tools)
4270         if ! test -n "$vswhereoutput"; then
4271             AC_MSG_CHECKING([VC++ Build Tools and similar])
4272             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4273         fi
4274         if test -n "$vswhereoutput"; then
4275             PathFormat "$vswhereoutput"
4276             vctest=$formatted_path_unix
4277             break
4278         fi
4279     done
4281     if test -n "$vctest"; then
4282         vcnumwithdot="$ver"
4283         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4284             vcnumwithdot=$vcnumwithdot.0
4285         fi
4286         case "$vcnumwithdot" in
4287         16.0)
4288             vcyear=2019
4289             vctoolset=v142
4290             ;;
4291         17.0 | 17.10)
4292             vcyear=2022
4293             vctoolset=v143
4294             ;;
4295         esac
4296         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4298     fi
4301 test_cl_exe()
4303     AC_MSG_CHECKING([$1 compiler])
4305     CL_EXE_PATH="$2/cl.exe"
4307     if test ! -f "$CL_EXE_PATH"; then
4308         if test "$1" = "multi-arch"; then
4309             AC_MSG_WARN([no compiler (cl.exe) in $2])
4310             return 1
4311         else
4312             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4313         fi
4314     fi
4316     dnl ===========================================================
4317     dnl  Check for the corresponding mspdb*.dll
4318     dnl ===========================================================
4320     # MSVC 15.0 has libraries from 14.0?
4321     mspdbnum="140"
4323     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4324         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4325     fi
4327     # The compiles has to find its shared libraries
4328     OLD_PATH="$PATH"
4329     TEMP_PATH=`cygpath -d "$2"`
4330     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4332     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4333         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4334     fi
4336     PATH="$OLD_PATH"
4338     AC_MSG_RESULT([$CL_EXE_PATH])
4341 SOLARINC=
4342 MSBUILD_PATH=
4343 DEVENV=
4344 if test "$_os" = "WINNT"; then
4345     AC_MSG_CHECKING([Visual C++])
4346     find_msvc "$with_visual_studio"
4347     if test -z "$vctest"; then
4348         if test -n "$with_visual_studio"; then
4349             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4350         else
4351             AC_MSG_ERROR([no Visual Studio installation found])
4352         fi
4353     fi
4354     AC_MSG_RESULT([])
4356     VC_PRODUCT_DIR="$vctest/VC"
4357     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4359     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4360     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4361         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4362         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4363         if test $? -ne 0; then
4364             WIN_MULTI_ARCH=""
4365             WIN_OTHER_ARCH=""
4366         fi
4367     fi
4369     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4370         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4371         test_cl_exe "build" "$MSVC_BUILD_PATH"
4372     fi
4374     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4375         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4376         test_cl_exe "host" "$MSVC_HOST_PATH"
4377     else
4378         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4379     fi
4381     AC_MSG_CHECKING([for short pathname of VC product directory])
4382     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4383     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4385     UCRTSDKDIR=
4386     UCRTVERSION=
4388     AC_MSG_CHECKING([for UCRT location])
4389     find_ucrt
4390     # find_ucrt errors out if it doesn't find it
4391     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4392     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4393     ucrtincpath_formatted=$formatted_path
4394     # SOLARINC is used for external modules and must be set too.
4395     # And no, it's not sufficient to set SOLARINC only, as configure
4396     # itself doesn't honour it.
4397     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4398     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4399     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4400     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4402     AC_SUBST(UCRTSDKDIR)
4403     AC_SUBST(UCRTVERSION)
4405     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4406     # Find the proper version of MSBuild.exe to use based on the VS version
4407     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
4408     if test -z "$regvalue" ; then
4409         if test "$WIN_BUILD_ARCH" != "x64"; then
4410             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4411         else
4412             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4413         fi
4414     fi
4415     if test -d "$regvalue" ; then
4416         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4417         AC_MSG_RESULT([$regvalue])
4418     else
4419         AC_MSG_ERROR([MSBuild.exe location not found])
4420     fi
4422     # Find the version of devenv.exe
4423     PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
4424     DEVENV="$formatted_path"
4425     DEVENV_unix="$formatted_path_unix"
4426     if test ! -e "$DEVENV_unix"; then
4427         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4428     fi
4430     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4431     dnl needed when building CLR code:
4432     if test -z "$MSVC_CXX"; then
4433         # This gives us a posix path with 8.3 filename restrictions
4434         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4435     fi
4437     if test -z "$CC"; then
4438         CC=$MSVC_CXX
4439         CC_BASE=`first_arg_basename "$CC"`
4440     fi
4441     if test -z "$CXX"; then
4442         CXX=$MSVC_CXX
4443         CXX_BASE=`first_arg_basename "$CXX"`
4444     fi
4446     if test -n "$CC"; then
4447         # Remove /cl.exe from CC case insensitive
4448         AC_MSG_NOTICE([found Visual C++ $vcyear])
4450         PathFormat "$COMPATH"
4451         COMPATH="$formatted_path"
4452         COMPATH_unix="$formatted_path_unix"
4453         CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
4455         VCVER=$vcnumwithdot
4456         VCTOOLSET=$vctoolset
4458         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4459         # are always "better", we list them in reverse chronological order.
4461         case "$vcnumwithdot" in
4462         16.0 | 17.0 | 17.10)
4463             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4464             ;;
4465         esac
4467         # The expectation is that --with-windows-sdk should not need to be used
4468         if test -n "$with_windows_sdk"; then
4469             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4470             *" "$with_windows_sdk" "*)
4471                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4472                 ;;
4473             *)
4474                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4475                 ;;
4476             esac
4477         fi
4479         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4480         ac_objext=obj
4481         ac_exeext=exe
4483     else
4484         AC_MSG_ERROR([Visual C++ not found after all, huh])
4485     fi
4487     # ERROR if VS version < 16.5
4488     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4489     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4490         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4491         // between Visual Studio versions and _MSC_VER:
4492         #if _MSC_VER < 1925
4493         #error
4494         #endif
4495     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4497     # WARN if VS version < 16.10
4498     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4499     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4500         #if _MSC_VER < 1929
4501         #error
4502         #endif
4503     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4505     if test $vs2019_recommended_version = yes; then
4506         AC_MSG_RESULT([yes])
4507     else
4508         AC_MSG_WARN([no])
4509         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."
4510     fi
4512     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4513     # version of the Explorer extension (and maybe other small
4514     # bits, too) needed when installing a 32-bit LibreOffice on a
4515     # 64-bit OS. The 64-bit Explorer extension is a feature that
4516     # has been present since long in OOo. Don't confuse it with
4517     # building LibreOffice itself as 64-bit code.
4519     BUILD_X64=
4520     CXX_X64_BINARY=
4522     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4523         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4524         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4525              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4526         then
4527             BUILD_X64=TRUE
4528             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4529             AC_MSG_RESULT([found])
4530         else
4531             AC_MSG_RESULT([not found])
4532             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4533         fi
4534     elif test "$WIN_HOST_ARCH" = "x64"; then
4535         CXX_X64_BINARY=$CXX
4536     fi
4537     AC_SUBST(BUILD_X64)
4539     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4540     AC_SUBST(CXX_X64_BINARY)
4542     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4543     # needed to support TWAIN scan on both 32- and 64-bit systems
4545     case "$WIN_HOST_ARCH" in
4546     x64)
4547         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4548         if test -n "$CXX_X86_BINARY"; then
4549             BUILD_X86=TRUE
4550             AC_MSG_RESULT([preset])
4551         elif test -n "$WIN_MULTI_ARCH"; then
4552             BUILD_X86=TRUE
4553             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4554             AC_MSG_RESULT([found])
4555         else
4556             AC_MSG_RESULT([not found])
4557             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4558         fi
4559         ;;
4560     x86)
4561         BUILD_X86=TRUE
4562         CXX_X86_BINARY=$MSVC_CXX
4563         ;;
4564     esac
4565     AC_SUBST(BUILD_X86)
4566     AC_SUBST(CXX_X86_BINARY)
4568 AC_SUBST(VCVER)
4569 AC_SUBST(VCTOOLSET)
4570 AC_SUBST(DEVENV)
4571 AC_SUBST(MSVC_CXX)
4573 COM_IS_CLANG=
4574 AC_MSG_CHECKING([whether the compiler is actually Clang])
4575 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4576     #ifndef __clang__
4577     you lose
4578     #endif
4579     int foo=42;
4580     ]])],
4581     [AC_MSG_RESULT([yes])
4582      COM_IS_CLANG=TRUE],
4583     [AC_MSG_RESULT([no])])
4584 AC_SUBST(COM_IS_CLANG)
4586 CLANGVER=
4587 if test "$COM_IS_CLANG" = TRUE; then
4588     AC_MSG_CHECKING([whether Clang is new enough])
4589     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4590         #if !defined __apple_build_version__
4591         #error
4592         #endif
4593         ]])],
4594         [my_apple_clang=yes],[my_apple_clang=])
4595     if test "$my_apple_clang" = yes; then
4596         AC_MSG_RESULT([assumed yes (Apple Clang)])
4597     elif test "$_os" = Emscripten; then
4598         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4599     else
4600         if test "$_os" = WINNT; then
4601             dnl In which case, assume clang-cl:
4602             my_args="/EP /TC"
4603         else
4604             my_args="-E -P"
4605         fi
4606         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4607         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4608         CLANGVER=`echo $clang_version \
4609             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4610         if test "$CLANGVER" -ge 120000; then
4611             AC_MSG_RESULT([yes ($clang_version)])
4612         else
4613             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4614         fi
4615         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4616         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4617     fi
4620 SHOWINCLUDES_PREFIX=
4621 if test "$_os" = WINNT; then
4622     dnl We need to guess the prefix of the -showIncludes output, it can be
4623     dnl localized
4624     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4625     echo "#include <stdlib.h>" > conftest.c
4626     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4627         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4628     rm -f conftest.c conftest.obj
4629     if test -z "$SHOWINCLUDES_PREFIX"; then
4630         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4631     else
4632         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4633     fi
4635 AC_SUBST(SHOWINCLUDES_PREFIX)
4638 # prefix C with ccache if needed
4640 if test "$CCACHE" != ""; then
4641     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4643     AC_LANG_PUSH([C])
4644     save_CFLAGS=$CFLAGS
4645     CFLAGS="$CFLAGS --ccache-skip -O2"
4646     # msvc does not fail on unknown options, check stdout
4647     if test "$COM" = MSC; then
4648         CFLAGS="$CFLAGS -nologo"
4649     fi
4650     save_ac_c_werror_flag=$ac_c_werror_flag
4651     ac_c_werror_flag=yes
4652     dnl an empty program will do, we're checking the compiler flags
4653     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4654                       [use_ccache=yes], [use_ccache=no])
4655     CFLAGS=$save_CFLAGS
4656     ac_c_werror_flag=$save_ac_c_werror_flag
4657     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4658         AC_MSG_RESULT([yes])
4659     else
4660         CC="$CCACHE $CC"
4661         CC_BASE="ccache $CC_BASE"
4662         AC_MSG_RESULT([no])
4663     fi
4664     AC_LANG_POP([C])
4667 # ===================================================================
4668 # check various GCC options that Clang does not support now but maybe
4669 # will somewhen in the future, check them even for GCC, so that the
4670 # flags are set
4671 # ===================================================================
4673 HAVE_GCC_GGDB2=
4674 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4675     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4676     save_CFLAGS=$CFLAGS
4677     CFLAGS="$CFLAGS -Werror -ggdb2"
4678     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4679     CFLAGS=$save_CFLAGS
4680     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4681         AC_MSG_RESULT([yes])
4682     else
4683         AC_MSG_RESULT([no])
4684     fi
4686     if test "$host_cpu" = "m68k"; then
4687         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4688         save_CFLAGS=$CFLAGS
4689         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4690         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4691         CFLAGS=$save_CFLAGS
4692         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4693             AC_MSG_RESULT([yes])
4694         else
4695             AC_MSG_ERROR([no])
4696         fi
4697     fi
4699 AC_SUBST(HAVE_GCC_GGDB2)
4701 dnl ===================================================================
4702 dnl  Test the gcc version
4703 dnl ===================================================================
4704 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4705     AC_MSG_CHECKING([the GCC version])
4706     _gcc_version=`$CC -dumpfullversion`
4707     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4708         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4709     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4711     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4713     if test "$gcc_full_version" -lt 120000; then
4714         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4715     fi
4716 else
4717     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4718     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4719     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4720     # (which reports itself as GCC 4.2.1).
4721     GCC_VERSION=
4723 AC_SUBST(GCC_VERSION)
4725 dnl Set the ENABLE_DBGUTIL variable
4726 dnl ===================================================================
4727 AC_MSG_CHECKING([whether to build with additional debug utilities])
4728 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4729     ENABLE_DBGUTIL="TRUE"
4730     # this is an extra var so it can have different default on different MSVC
4731     # versions (in case there are version specific problems with it)
4732     MSVC_USE_DEBUG_RUNTIME="TRUE"
4734     AC_MSG_RESULT([yes])
4735     # cppunit and graphite expose STL in public headers
4736     if test "$with_system_cppunit" = "yes"; then
4737         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4738     else
4739         with_system_cppunit=no
4740     fi
4741     if test "$with_system_graphite" = "yes"; then
4742         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4743     else
4744         with_system_graphite=no
4745     fi
4746     if test "$with_system_orcus" = "yes"; then
4747         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4748     else
4749         with_system_orcus=no
4750     fi
4751     if test "$with_system_libcmis" = "yes"; then
4752         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4753     else
4754         with_system_libcmis=no
4755     fi
4756     if test "$with_system_hunspell" = "yes"; then
4757         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4758     else
4759         with_system_hunspell=no
4760     fi
4761     if test "$with_system_gpgmepp" = "yes"; then
4762         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4763     else
4764         with_system_gpgmepp=no
4765     fi
4766     if test "$with_system_zxing" = "yes"; then
4767         AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
4768     else
4769         with_system_zxing=no
4770     fi
4771     if test "$with_system_poppler" = "yes"; then
4772         AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
4773     else
4774         with_system_poppler=no
4775     fi
4776     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4777     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4778     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4779     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4780     # of those two is using the system variant:
4781     if test "$with_system_libnumbertext" = "yes"; then
4782         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4783     else
4784         with_system_libnumbertext=no
4785     fi
4786     if test "$with_system_libwps" = "yes"; then
4787         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4788     else
4789         with_system_libwps=no
4790     fi
4791 else
4792     ENABLE_DBGUTIL=""
4793     MSVC_USE_DEBUG_RUNTIME=""
4794     AC_MSG_RESULT([no])
4796 AC_SUBST(ENABLE_DBGUTIL)
4797 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4799 dnl Set the ENABLE_DEBUG variable.
4800 dnl ===================================================================
4801 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4802     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4804 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4805     if test -z "$libo_fuzzed_enable_debug"; then
4806         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4807     else
4808         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4809         enable_debug=yes
4810     fi
4813 AC_MSG_CHECKING([whether to do a debug build])
4814 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4815     ENABLE_DEBUG="TRUE"
4816     if test -n "$ENABLE_DBGUTIL" ; then
4817         AC_MSG_RESULT([yes (dbgutil)])
4818     else
4819         AC_MSG_RESULT([yes])
4820     fi
4821 else
4822     ENABLE_DEBUG=""
4823     AC_MSG_RESULT([no])
4825 AC_SUBST(ENABLE_DEBUG)
4827 dnl ===================================================================
4828 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4829 dnl This is done only after compiler checks (need to know if Clang is
4830 dnl used, for different defaults) and after checking if a debug build
4831 dnl is wanted (non-debug builds get the default linker if not explicitly
4832 dnl specified otherwise).
4833 dnl All checks for linker features/options should come after this.
4834 dnl ===================================================================
4835 check_use_ld()
4837     use_ld=-fuse-ld=${1%%:*}
4838     use_ld_path=${1#*:}
4839     if test "$use_ld_path" != "$1"; then
4840         if test "$COM_IS_CLANG" = TRUE; then
4841             if test "$CLANGVER" -ge 120000; then
4842                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4843             else
4844                 use_ld="-fuse-ld=${use_ld_path}"
4845             fi
4846         else
4847             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4848             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4849             # pickup the alternative linker, when called by libtool for linking.
4850             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4851             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4852         fi
4853     fi
4854     use_ld_fail_if_error=$2
4855     use_ld_ok=
4856     AC_MSG_CHECKING([for $use_ld linker support])
4857     use_ld_ldflags_save="$LDFLAGS"
4858     LDFLAGS="$LDFLAGS $use_ld"
4859     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4860 #include <stdio.h>
4861         ],[
4862 printf ("hello world\n");
4863         ])], USE_LD=$use_ld, [])
4864     if test -n "$USE_LD"; then
4865         AC_MSG_RESULT( yes )
4866         use_ld_ok=yes
4867     else
4868         if test -n "$use_ld_fail_if_error"; then
4869             AC_MSG_ERROR( no )
4870         else
4871             AC_MSG_RESULT( no )
4872         fi
4873     fi
4874     if test -n "$use_ld_ok"; then
4875         dnl keep the value of LDFLAGS
4876         return 0
4877     fi
4878     LDFLAGS="$use_ld_ldflags_save"
4879     return 1
4881 USE_LD=
4882 if test "$enable_ld" != "no"; then
4883     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4884         if test -n "$enable_ld"; then
4885             check_use_ld "$enable_ld" fail_if_error
4886         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4887             dnl non-debug builds default to the default linker
4888             true
4889         elif test -n "$COM_IS_CLANG"; then
4890             check_use_ld lld
4891             if test $? -ne 0; then
4892                 check_use_ld gold
4893                 if test $? -ne 0; then
4894                     check_use_ld mold
4895                 fi
4896             fi
4897         else
4898             # For gcc first try gold, new versions also support lld/mold.
4899             check_use_ld gold
4900             if test $? -ne 0; then
4901                 check_use_ld lld
4902                 if test $? -ne 0; then
4903                     check_use_ld mold
4904                 fi
4905             fi
4906         fi
4907         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4908         rm conftest.out
4909         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4910         if test -z "$ld_used"; then
4911             ld_used="unknown"
4912         fi
4913         AC_MSG_CHECKING([for linker that is used])
4914         AC_MSG_RESULT([$ld_used])
4915         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4916             if echo "$ld_used" | grep -q "^GNU ld"; then
4917                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4918                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4919             fi
4920         fi
4921     else
4922         if test "$enable_ld" = "yes"; then
4923             AC_MSG_ERROR([--enable-ld not supported])
4924         fi
4925     fi
4927 AC_SUBST(USE_LD)
4928 AC_SUBST(LD)
4930 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4931 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4932     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4933     bsymbolic_functions_ldflags_save=$LDFLAGS
4934     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4935     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4936 #include <stdio.h>
4937         ],[
4938 printf ("hello world\n");
4939         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4940     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4941         AC_MSG_RESULT( found )
4942     else
4943         AC_MSG_RESULT( not found )
4944     fi
4945     LDFLAGS=$bsymbolic_functions_ldflags_save
4947 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4949 LD_GC_SECTIONS=
4950 if test "$GCC" = "yes"; then
4951     for flag in "--gc-sections" "-dead_strip"; do
4952         AC_MSG_CHECKING([for $flag linker support])
4953         ldflags_save=$LDFLAGS
4954         LDFLAGS="$LDFLAGS -Wl,$flag"
4955         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4956 #include <stdio.h>
4957             ],[
4958 printf ("hello world\n");
4959             ])],[
4960             LD_GC_SECTIONS="-Wl,$flag"
4961             AC_MSG_RESULT( found )
4962             ], [
4963             AC_MSG_RESULT( not found )
4964             ])
4965         LDFLAGS=$ldflags_save
4966         if test -n "$LD_GC_SECTIONS"; then
4967             break
4968         fi
4969     done
4971 AC_SUBST(LD_GC_SECTIONS)
4973 HAVE_EXTERNAL_DWARF=
4974 if test "$enable_split_debug" != no; then
4975     use_split_debug=
4976     if test -n "$ENABLE_LTO"; then
4977         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4978     elif test "$enable_split_debug" = yes; then
4979         use_split_debug=1
4980     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4981     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4982         use_split_debug=1
4983     fi
4984     if test -n "$use_split_debug"; then
4985         if test "$_os" = "Emscripten"; then
4986             TEST_CC_FLAG=-gseparate-dwarf
4987         else
4988             TEST_CC_FLAG=-gsplit-dwarf
4989         fi
4990         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4991         save_CFLAGS=$CFLAGS
4992         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4993         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4994         CFLAGS=$save_CFLAGS
4995         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4996             AC_MSG_RESULT([yes])
4997         else
4998             if test "$enable_split_debug" = yes; then
4999                 AC_MSG_ERROR([no])
5000             else
5001                 AC_MSG_RESULT([no])
5002             fi
5003         fi
5004     fi
5005     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
5006         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
5007         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
5008     fi
5010 AC_SUBST(HAVE_EXTERNAL_DWARF)
5012 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
5013 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
5014 save_CFLAGS=$CFLAGS
5015 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
5016 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
5017 CFLAGS=$save_CFLAGS
5018 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
5019     AC_MSG_RESULT([yes])
5020 else
5021     AC_MSG_RESULT([no])
5023 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
5025 ENABLE_GDB_INDEX=
5026 if test "$enable_gdb_index" != "no"; then
5027     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
5028     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
5029         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
5030         save_CFLAGS=$CFLAGS
5031         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
5032         have_ggnu_pubnames=
5033         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
5034         if test "$have_ggnu_pubnames" != "TRUE"; then
5035             if test "$enable_gdb_index" = "yes"; then
5036                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
5037             else
5038                 AC_MSG_RESULT( no )
5039             fi
5040         else
5041             AC_MSG_RESULT( yes )
5042             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
5043             ldflags_save=$LDFLAGS
5044             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
5045             AC_LINK_IFELSE([AC_LANG_PROGRAM([
5046 #include <stdio.h>
5047                 ],[
5048 printf ("hello world\n");
5049                 ])], ENABLE_GDB_INDEX=TRUE, [])
5050             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
5051                 AC_MSG_RESULT( yes )
5052             else
5053                 if test "$enable_gdb_index" = "yes"; then
5054                     AC_MSG_ERROR( no )
5055                 else
5056                     AC_MSG_RESULT( no )
5057                 fi
5058             fi
5059             LDFLAGS=$ldflags_save
5060         fi
5061         CFLAGS=$save_CFLAGS
5062         fi
5063     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5064         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
5065         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
5066     fi
5068 AC_SUBST(ENABLE_GDB_INDEX)
5070 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
5071     enable_sal_log=yes
5073 if test "$enable_sal_log" = yes; then
5074     ENABLE_SAL_LOG=TRUE
5076 AC_SUBST(ENABLE_SAL_LOG)
5078 dnl Check for enable symbols option
5079 dnl ===================================================================
5080 AC_MSG_CHECKING([whether to generate debug information])
5081 if test -z "$enable_symbols"; then
5082     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5083         enable_symbols=yes
5084     else
5085         enable_symbols=no
5086     fi
5088 if test "$enable_symbols" = yes; then
5089     ENABLE_SYMBOLS_FOR=all
5090     AC_MSG_RESULT([yes])
5091 elif test "$enable_symbols" = no; then
5092     ENABLE_SYMBOLS_FOR=
5093     AC_MSG_RESULT([no])
5094 else
5095     # Selective debuginfo.
5096     ENABLE_SYMBOLS_FOR="$enable_symbols"
5097     AC_MSG_RESULT([for "$enable_symbols"])
5099 AC_SUBST(ENABLE_SYMBOLS_FOR)
5101 if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
5102     # Building on Android with full symbols: without enough memory the linker never finishes currently.
5103     AC_MSG_CHECKING([whether enough memory is available for linking])
5104     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5105     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5106     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5107         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5108     else
5109         AC_MSG_RESULT([yes])
5110     fi
5113 ENABLE_OPTIMIZED=
5114 ENABLE_OPTIMIZED_DEBUG=
5115 AC_MSG_CHECKING([whether to compile with optimization flags])
5116 if test -z "$enable_optimized"; then
5117     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5118         enable_optimized=no
5119     else
5120         enable_optimized=yes
5121     fi
5123 if test "$enable_optimized" = yes; then
5124     ENABLE_OPTIMIZED=TRUE
5125     AC_MSG_RESULT([yes])
5126 elif test "$enable_optimized" = debug; then
5127     ENABLE_OPTIMIZED_DEBUG=TRUE
5128     AC_MSG_RESULT([yes (debug)])
5129     HAVE_GCC_OG=
5130     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5131         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5132         save_CFLAGS=$CFLAGS
5133         CFLAGS="$CFLAGS -Werror -Og"
5134         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5135         CFLAGS=$save_CFLAGS
5136         if test "$HAVE_GCC_OG" = "TRUE"; then
5137             AC_MSG_RESULT([yes])
5138         else
5139             AC_MSG_RESULT([no])
5140         fi
5141     fi
5142     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5143         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5144     fi
5145 else
5146     AC_MSG_RESULT([no])
5148 AC_SUBST(ENABLE_OPTIMIZED)
5149 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5152 # determine CPUNAME, OS, ...
5154 case "$host_os" in
5156 cygwin*|wsl*)
5157     # Already handled
5158     ;;
5160 darwin*)
5161     COM=GCC
5162     OS=MACOSX
5163     RTL_OS=MacOSX
5164     P_SEP=:
5166     case "$host_cpu" in
5167     aarch64|arm64)
5168         if test "$enable_ios_simulator" = "yes"; then
5169             OS=iOS
5170         else
5171             CPUNAME=AARCH64
5172             RTL_ARCH=AARCH64
5173             PLATFORMID=macosx_aarch64
5174         fi
5175         ;;
5176     x86_64)
5177         if test "$enable_ios_simulator" = "yes"; then
5178             OS=iOS
5179         fi
5180         CPUNAME=X86_64
5181         RTL_ARCH=X86_64
5182         PLATFORMID=macosx_x86_64
5183         ;;
5184     *)
5185         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5186         ;;
5187     esac
5188     ;;
5190 ios*)
5191     COM=GCC
5192     OS=iOS
5193     RTL_OS=iOS
5194     P_SEP=:
5196     case "$host_cpu" in
5197     aarch64|arm64)
5198         if test "$enable_ios_simulator" = "yes"; then
5199             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5200         fi
5201         ;;
5202     *)
5203         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5204         ;;
5205     esac
5206     CPUNAME=AARCH64
5207     RTL_ARCH=AARCH64
5208     PLATFORMID=ios_arm64
5209     ;;
5211 dragonfly*)
5212     COM=GCC
5213     OS=DRAGONFLY
5214     RTL_OS=DragonFly
5215     P_SEP=:
5217     case "$host_cpu" in
5218     i*86)
5219         CPUNAME=INTEL
5220         RTL_ARCH=x86
5221         PLATFORMID=dragonfly_x86
5222         ;;
5223     x86_64)
5224         CPUNAME=X86_64
5225         RTL_ARCH=X86_64
5226         PLATFORMID=dragonfly_x86_64
5227         ;;
5228     *)
5229         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5230         ;;
5231     esac
5232     ;;
5234 freebsd*)
5235     COM=GCC
5236     RTL_OS=FreeBSD
5237     OS=FREEBSD
5238     P_SEP=:
5240     case "$host_cpu" in
5241     aarch64)
5242         CPUNAME=AARCH64
5243         PLATFORMID=freebsd_aarch64
5244         RTL_ARCH=AARCH64
5245         ;;
5246     i*86)
5247         CPUNAME=INTEL
5248         RTL_ARCH=x86
5249         PLATFORMID=freebsd_x86
5250         ;;
5251     x86_64|amd64)
5252         CPUNAME=X86_64
5253         RTL_ARCH=X86_64
5254         PLATFORMID=freebsd_x86_64
5255         ;;
5256     powerpc64)
5257         CPUNAME=POWERPC64
5258         RTL_ARCH=PowerPC_64
5259         PLATFORMID=freebsd_powerpc64
5260         ;;
5261     powerpc|powerpcspe)
5262         CPUNAME=POWERPC
5263         RTL_ARCH=PowerPC
5264         PLATFORMID=freebsd_powerpc
5265         ;;
5266     *)
5267         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5268         ;;
5269     esac
5270     ;;
5272 haiku*)
5273     COM=GCC
5274     GUIBASE=haiku
5275     RTL_OS=Haiku
5276     OS=HAIKU
5277     P_SEP=:
5279     case "$host_cpu" in
5280     i*86)
5281         CPUNAME=INTEL
5282         RTL_ARCH=x86
5283         PLATFORMID=haiku_x86
5284         ;;
5285     x86_64|amd64)
5286         CPUNAME=X86_64
5287         RTL_ARCH=X86_64
5288         PLATFORMID=haiku_x86_64
5289         ;;
5290     *)
5291         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5292         ;;
5293     esac
5294     ;;
5296 kfreebsd*)
5297     COM=GCC
5298     OS=LINUX
5299     RTL_OS=kFreeBSD
5300     P_SEP=:
5302     case "$host_cpu" in
5304     i*86)
5305         CPUNAME=INTEL
5306         RTL_ARCH=x86
5307         PLATFORMID=kfreebsd_x86
5308         ;;
5309     x86_64)
5310         CPUNAME=X86_64
5311         RTL_ARCH=X86_64
5312         PLATFORMID=kfreebsd_x86_64
5313         ;;
5314     *)
5315         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5316         ;;
5317     esac
5318     ;;
5320 linux-gnu*|linux-musl*)
5321     COM=GCC
5322     OS=LINUX
5323     RTL_OS=Linux
5324     P_SEP=:
5326     case "$host_cpu" in
5328     aarch64)
5329         CPUNAME=AARCH64
5330         PLATFORMID=linux_aarch64
5331         RTL_ARCH=AARCH64
5332         EPM_FLAGS="-a arm64"
5333         ;;
5334     alpha)
5335         CPUNAME=AXP
5336         RTL_ARCH=ALPHA
5337         PLATFORMID=linux_alpha
5338         ;;
5339     arm*)
5340         CPUNAME=ARM
5341         EPM_FLAGS="-a arm"
5342         RTL_ARCH=ARM_EABI
5343         PLATFORMID=linux_arm_eabi
5344         case "$host_cpu" in
5345         arm*-linux)
5346             RTL_ARCH=ARM_OABI
5347             PLATFORMID=linux_arm_oabi
5348             ;;
5349         esac
5350         ;;
5351     hppa)
5352         CPUNAME=HPPA
5353         RTL_ARCH=HPPA
5354         EPM_FLAGS="-a hppa"
5355         PLATFORMID=linux_hppa
5356         ;;
5357     i*86)
5358         CPUNAME=INTEL
5359         RTL_ARCH=x86
5360         PLATFORMID=linux_x86
5361         ;;
5362     ia64)
5363         CPUNAME=IA64
5364         RTL_ARCH=IA64
5365         PLATFORMID=linux_ia64
5366         ;;
5367     mips)
5368         CPUNAME=MIPS
5369         RTL_ARCH=MIPS_EB
5370         EPM_FLAGS="-a mips"
5371         PLATFORMID=linux_mips_eb
5372         ;;
5373     mips64)
5374         CPUNAME=MIPS64
5375         RTL_ARCH=MIPS64_EB
5376         EPM_FLAGS="-a mips64"
5377         PLATFORMID=linux_mips64_eb
5378         ;;
5379     mips64el)
5380         CPUNAME=MIPS64
5381         RTL_ARCH=MIPS64_EL
5382         EPM_FLAGS="-a mips64el"
5383         PLATFORMID=linux_mips64_el
5384         ;;
5385     mipsel)
5386         CPUNAME=MIPS
5387         RTL_ARCH=MIPS_EL
5388         EPM_FLAGS="-a mipsel"
5389         PLATFORMID=linux_mips_el
5390         ;;
5391     riscv64)
5392         CPUNAME=RISCV64
5393         RTL_ARCH=RISCV64
5394         EPM_FLAGS="-a riscv64"
5395         PLATFORMID=linux_riscv64
5396         ;;
5397     m68k)
5398         CPUNAME=M68K
5399         RTL_ARCH=M68K
5400         PLATFORMID=linux_m68k
5401         ;;
5402     powerpc)
5403         CPUNAME=POWERPC
5404         RTL_ARCH=PowerPC
5405         PLATFORMID=linux_powerpc
5406         ;;
5407     powerpc64)
5408         CPUNAME=POWERPC64
5409         RTL_ARCH=PowerPC_64
5410         PLATFORMID=linux_powerpc64
5411         ;;
5412     powerpc64le)
5413         CPUNAME=POWERPC64
5414         RTL_ARCH=PowerPC_64_LE
5415         PLATFORMID=linux_powerpc64_le
5416         ;;
5417     sparc)
5418         CPUNAME=SPARC
5419         RTL_ARCH=SPARC
5420         PLATFORMID=linux_sparc
5421         ;;
5422     sparc64)
5423         CPUNAME=SPARC64
5424         RTL_ARCH=SPARC64
5425         PLATFORMID=linux_sparc64
5426         ;;
5427     s390x)
5428         CPUNAME=S390X
5429         RTL_ARCH=S390x
5430         PLATFORMID=linux_s390x
5431         ;;
5432     x86_64)
5433         CPUNAME=X86_64
5434         RTL_ARCH=X86_64
5435         PLATFORMID=linux_x86_64
5436         ;;
5437     loongarch64)
5438         CPUNAME=LOONGARCH64
5439         RTL_ARCH=LOONGARCH64
5440         PLATFORMID=linux_loongarch64
5441         ;;
5442     *)
5443         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5444         ;;
5445     esac
5446     ;;
5448 linux-android*)
5449     COM=GCC
5450     OS=ANDROID
5451     RTL_OS=Android
5452     P_SEP=:
5454     case "$host_cpu" in
5456     arm|armel)
5457         CPUNAME=ARM
5458         RTL_ARCH=ARM_EABI
5459         PLATFORMID=android_arm_eabi
5460         ;;
5461     aarch64)
5462         CPUNAME=AARCH64
5463         RTL_ARCH=AARCH64
5464         PLATFORMID=android_aarch64
5465         ;;
5466     i*86)
5467         CPUNAME=INTEL
5468         RTL_ARCH=x86
5469         PLATFORMID=android_x86
5470         ;;
5471     x86_64)
5472         CPUNAME=X86_64
5473         RTL_ARCH=X86_64
5474         PLATFORMID=android_x86_64
5475         ;;
5476     *)
5477         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5478         ;;
5479     esac
5480     ;;
5482 *netbsd*)
5483     COM=GCC
5484     OS=NETBSD
5485     RTL_OS=NetBSD
5486     P_SEP=:
5488     case "$host_cpu" in
5489     i*86)
5490         CPUNAME=INTEL
5491         RTL_ARCH=x86
5492         PLATFORMID=netbsd_x86
5493         ;;
5494     powerpc)
5495         CPUNAME=POWERPC
5496         RTL_ARCH=PowerPC
5497         PLATFORMID=netbsd_powerpc
5498         ;;
5499     sparc)
5500         CPUNAME=SPARC
5501         RTL_ARCH=SPARC
5502         PLATFORMID=netbsd_sparc
5503         ;;
5504     x86_64)
5505         CPUNAME=X86_64
5506         RTL_ARCH=X86_64
5507         PLATFORMID=netbsd_x86_64
5508         ;;
5509     *)
5510         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5511         ;;
5512     esac
5513     ;;
5515 openbsd*)
5516     COM=GCC
5517     OS=OPENBSD
5518     RTL_OS=OpenBSD
5519     P_SEP=:
5521     case "$host_cpu" in
5522     i*86)
5523         CPUNAME=INTEL
5524         RTL_ARCH=x86
5525         PLATFORMID=openbsd_x86
5526         ;;
5527     x86_64)
5528         CPUNAME=X86_64
5529         RTL_ARCH=X86_64
5530         PLATFORMID=openbsd_x86_64
5531         ;;
5532     *)
5533         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5534         ;;
5535     esac
5536     SOLARINC="$SOLARINC -I/usr/local/include"
5537     ;;
5539 solaris*)
5540     COM=GCC
5541     OS=SOLARIS
5542     RTL_OS=Solaris
5543     P_SEP=:
5545     case "$host_cpu" in
5546     i*86)
5547         CPUNAME=INTEL
5548         RTL_ARCH=x86
5549         PLATFORMID=solaris_x86
5550         ;;
5551     sparc)
5552         CPUNAME=SPARC
5553         RTL_ARCH=SPARC
5554         PLATFORMID=solaris_sparc
5555         ;;
5556     sparc64)
5557         CPUNAME=SPARC64
5558         RTL_ARCH=SPARC64
5559         PLATFORMID=solaris_sparc64
5560         ;;
5561     *)
5562         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5563         ;;
5564     esac
5565     SOLARINC="$SOLARINC -I/usr/local/include"
5566     ;;
5568 emscripten*)
5569     COM=GCC
5570     OS=EMSCRIPTEN
5571     RTL_OS=Emscripten
5572     P_SEP=:
5574     case "$host_cpu" in
5575     wasm32|wasm64)
5576         ;;
5577     *)
5578         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5579         ;;
5580     esac
5581     CPUNAME=INTEL
5582     RTL_ARCH=x86
5583     PLATFORMID=linux_x86
5584     ;;
5587     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5588     ;;
5589 esac
5591 DISABLE_GUI=""
5592 if test "$enable_gui" = "no"; then
5593     if test "$using_x11" != yes; then
5594         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5595     fi
5596     USING_X11=
5597     DISABLE_GUI=TRUE
5598     test_epoxy=no
5599 else
5600     AC_DEFINE(HAVE_FEATURE_UI)
5602 AC_SUBST(DISABLE_GUI)
5604 if test "$with_x" = "no"; then
5605     USING_X11=
5608 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5609     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5612 if test "$using_x11" = yes; then
5613     if test "$USING_X11" = TRUE; then
5614         AC_DEFINE(USING_X11)
5615     else
5616         disable_x11_tests
5617         if test "$DISABLE_DYNLOADING" = TRUE; then
5618             test_qt5=yes
5619             test_qt6=yes
5620         fi
5621     fi
5622 else
5623     if test "$USING_X11" = TRUE; then
5624         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5625     fi
5628 WORKDIR="${BUILDDIR}/workdir"
5629 INSTDIR="${BUILDDIR}/instdir"
5630 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5631 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5632 AC_SUBST(COM)
5633 AC_SUBST(CPUNAME)
5634 AC_SUBST(RTL_OS)
5635 AC_SUBST(RTL_ARCH)
5636 AC_SUBST(EPM_FLAGS)
5637 AC_SUBST(USING_X11)
5638 AC_SUBST([INSTDIR])
5639 AC_SUBST([INSTROOT])
5640 AC_SUBST([INSTROOTBASE])
5641 AC_SUBST(OS)
5642 AC_SUBST(P_SEP)
5643 AC_SUBST(WORKDIR)
5644 AC_SUBST(PLATFORMID)
5645 AC_SUBST(WINDOWS_X64)
5646 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5647 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5649 if test "$OS" = WNT -a "$COM" = MSC; then
5650     case "$CPUNAME" in
5651     INTEL) CPPU_ENV=msci ;;
5652     X86_64) CPPU_ENV=mscx ;;
5653     AARCH64) CPPU_ENV=msca ;;
5654     *)
5655         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5656         ;;
5657     esac
5658 else
5659     CPPU_ENV=gcc3
5661 AC_SUBST(CPPU_ENV)
5663 dnl ===================================================================
5664 dnl Test which package format to use
5665 dnl ===================================================================
5666 AC_MSG_CHECKING([which package format to use])
5667 if test -n "$with_package_format" -a "$with_package_format" != no; then
5668     for i in $with_package_format; do
5669         case "$i" in
5670         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5671             ;;
5672         *)
5673             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5674 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5675 deb - Debian software distribution
5676 pkg - Solaris software distribution
5677 rpm - RedHat software distribution
5679 LibreOffice additionally supports:
5680 archive - .tar.gz or .zip
5681 dmg - macOS .dmg
5682 installed - installation tree
5683 msi - Windows .msi
5684         ])
5685             ;;
5686         esac
5687     done
5688     # fakeroot is needed to ensure correct file ownerships/permissions
5689     # inside deb packages and tar archives created on Linux and Solaris.
5690     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5691         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5692         if test "$FAKEROOT" = "no"; then
5693             AC_MSG_ERROR(
5694                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5695         fi
5696     fi
5697     PKGFORMAT="$with_package_format"
5698     AC_MSG_RESULT([$PKGFORMAT])
5699 else
5700     PKGFORMAT=
5701     AC_MSG_RESULT([none])
5703 AC_SUBST(PKGFORMAT)
5705 dnl ===================================================================
5706 dnl handle help related options
5708 dnl If you change help related options, please update README.help
5709 dnl ===================================================================
5711 ENABLE_HTMLHELP=
5712 HELP_OMINDEX_PAGE=
5713 HELP_ONLINE=
5714 WITH_HELPPACKS=
5716 AC_MSG_CHECKING([which help to build])
5717 if test -n "$with_help" -a "$with_help" != "no"; then
5718     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5719     BUILD_TYPE="$BUILD_TYPE HELP"
5720     case "$with_help" in
5721     "html")
5722         ENABLE_HTMLHELP=TRUE
5723         WITH_HELPPACKS=TRUE
5724         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5725         AC_MSG_RESULT([HTML (local)])
5726         ;;
5727     "online")
5728         ENABLE_HTMLHELP=TRUE
5729         HELP_ONLINE=TRUE
5730         AC_MSG_RESULT([HTML (online)])
5731         ;;
5732     yes)
5733         WITH_HELPPACKS=TRUE
5734         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5735         AC_MSG_RESULT([XML (local)])
5736         ;;
5737     *)
5738         AC_MSG_ERROR([Unknown --with-help=$with_help])
5739         ;;
5740     esac
5741 else
5742     AC_MSG_RESULT([no])
5745 AC_MSG_CHECKING([if we need to build the help index tooling])
5746 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5747     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5748     test_clucene=yes
5749     AC_MSG_RESULT([yes])
5750 else
5751     AC_MSG_RESULT([no])
5754 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5755 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5756     if test "$HELP_ONLINE" != TRUE; then
5757         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5758     fi
5759     case "$with_omindex" in
5760     "server")
5761         HELP_OMINDEX_PAGE=TRUE
5762         AC_MSG_RESULT([SERVER])
5763         ;;
5764     "noxap")
5765         AC_MSG_RESULT([NOXAP])
5766         ;;
5767     *)
5768         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5769         ;;
5770     esac
5771 else
5772     AC_MSG_RESULT([no])
5775 AC_MSG_CHECKING([whether to include the XML-help support])
5776 if test "$enable_xmlhelp" = yes; then
5777     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5778     test_clucene=yes
5779     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5780     AC_MSG_RESULT([yes])
5781 else
5782     if test "$with_help" = yes; then
5783         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5784     fi
5785     AC_MSG_RESULT([no])
5788 dnl Test whether to integrate helppacks into the product's installer
5789 AC_MSG_CHECKING([for helppack integration])
5790 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5791     AC_MSG_RESULT([no integration])
5792 else
5793     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5794     AC_MSG_RESULT([integration])
5797 AC_SUBST([ENABLE_HTMLHELP])
5798 AC_SUBST([HELP_OMINDEX_PAGE])
5799 AC_SUBST([HELP_ONLINE])
5800 # WITH_HELPPACKS is used only in configure
5802 dnl ===================================================================
5803 dnl Set up a different compiler to produce tools to run on the build
5804 dnl machine when doing cross-compilation
5805 dnl ===================================================================
5807 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5808 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5809 if test "$cross_compiling" = "yes"; then
5810     AC_MSG_CHECKING([for BUILD platform configuration])
5811     echo
5812     rm -rf CONF-FOR-BUILD config_build.mk
5813     mkdir CONF-FOR-BUILD
5814     # Here must be listed all files needed when running the configure script. In particular, also
5815     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5816     # keep them in the same order as there.
5817     (cd $SRC_ROOT && tar cf - \
5818         config.guess \
5819         bin/get_config_variables \
5820         solenv/bin/getcompver.awk \
5821         solenv/inc/langlist.mk \
5822         download.lst \
5823         config_host.mk.in \
5824         config_host_lang.mk.in \
5825         Makefile.in \
5826         bin/bffvalidator.sh.in \
5827         bin/odfvalidator.sh.in \
5828         bin/officeotron.sh.in \
5829         instsetoo_native/util/openoffice.lst.in \
5830         config_host/*.in \
5831         sysui/desktop/macosx/Info.plist.in \
5832         sysui/desktop/macosx/hardened_runtime.xcent.in \
5833         sysui/desktop/macosx/lo.xcent.in \
5834         .vscode/vs-code-template.code-workspace.in \
5835         solenv/lockfile/autoconf.h.in \
5836         ) \
5837     | (cd CONF-FOR-BUILD && tar xf -)
5838     cp configure CONF-FOR-BUILD
5839     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5840     (
5841     unset COM USING_X11 OS CPUNAME
5842     unset CC CXX SYSBASE CFLAGS
5843     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5844     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5845     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5846     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5847     if test -n "$CC_FOR_BUILD"; then
5848         export CC="$CC_FOR_BUILD"
5849         CC_BASE=`first_arg_basename "$CC"`
5850     fi
5851     if test -n "$CXX_FOR_BUILD"; then
5852         export CXX="$CXX_FOR_BUILD"
5853         CXX_BASE=`first_arg_basename "$CXX"`
5854     fi
5855     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5856     cd CONF-FOR-BUILD
5858     # Handle host configuration, which affects the cross-toolset too
5859     sub_conf_opts=""
5860     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5861     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5862     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5863     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5864     if test -n "$ENABLE_JAVA"; then
5865         case "$_os" in
5866         Android)
5867             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5868             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5869             ;;
5870         *)
5871             if test -z "$with_jdk_home"; then
5872                 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.])
5873             fi
5874             ;;
5875         esac
5876     else
5877         sub_conf_opts="$sub_conf_opts --without-java"
5878     fi
5879     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5880     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5881     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5882     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5883     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5884     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5885     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5886     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5887     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5888     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5889     if test "$_os" = "Emscripten"; then
5890         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5891         if test "${with_main_module+set}" = set; then
5892             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5893         else
5894             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5895         fi
5896     fi
5897     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5898     # when cross-compiling for aarch64, overriding the defaults below
5899     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5901     # Don't bother having configure look for stuff not needed for the build platform anyway
5902     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5903     sub_conf_defaults=" \
5904         --build="$build_alias" \
5905         --disable-cairo-canvas \
5906         --disable-cups \
5907         --disable-customtarget-components \
5908         --disable-firebird-sdbc \
5909         --disable-gpgmepp \
5910         --disable-gstreamer-1-0 \
5911         --disable-gtk3 \
5912         --disable-gtk4 \
5913         --disable-libcmis \
5914         --disable-mariadb-sdbc \
5915         --disable-nss \
5916         --disable-online-update \
5917         --disable-opencl \
5918         --disable-openssl \
5919         --disable-pdfimport \
5920         --disable-postgresql-sdbc \
5921         --disable-skia \
5922         --disable-xmlhelp \
5923         --enable-dynamic-loading \
5924         --enable-icecream="$enable_icecream" \
5925         --without-doxygen \
5926         --without-tls \
5927         --without-webdav \
5928         --without-x \
5930     # single quotes added for better readability in case of spaces
5931     echo "    Running CONF-FOR-BUILD/configure" \
5932         $sub_conf_defaults \
5933         --with-parallelism="'$with_parallelism'" \
5934         --with-theme="'$with_theme'" \
5935         --with-vendor="'$with_vendor'" \
5936         $sub_conf_opts \
5937         $with_build_platform_configure_options \
5938         --srcdir=$srcdir
5940     ./configure \
5941         $sub_conf_defaults \
5942         --with-parallelism="$with_parallelism" \
5943         --with-theme="$with_theme" \
5944         "--with-vendor=$with_vendor" \
5945         $sub_conf_opts \
5946         $with_build_platform_configure_options \
5947         --srcdir=$srcdir \
5948         2>&1 | sed -e 's/^/    /'
5949     if test [${PIPESTATUS[0]}] -ne 0; then
5950         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5951     fi
5953     # filter permitted build targets
5954     PERMITTED_BUILD_TARGETS="
5955         ARGON2
5956         AVMEDIA
5957         BOOST
5958         BZIP2
5959         CAIRO
5960         CLUCENE
5961         CURL
5962         DBCONNECTIVITY
5963         DESKTOP
5964         DRAGONBOX
5965         DYNLOADING
5966         EPOXY
5967         EXPAT
5968         FROZEN
5969         GLM
5970         GRAPHITE
5971         HARFBUZZ
5972         HELPTOOLS
5973         ICU
5974         LCMS2
5975         LIBJPEG_TURBO
5976         LIBLANGTAG
5977         LibO
5978         LIBFFI
5979         LIBPN
5980         LIBTIFF
5981         LIBWEBP
5982         LIBXML2
5983         LIBXSLT
5984         MDDS
5985         NATIVE
5986         OPENSSL
5987         ORCUS
5988         PYTHON
5989         REPORTBUILDER
5990         SCRIPTING
5991         ZLIB
5992         ZXCVBN
5994     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5995     # newlined lists, to use grep as a filter
5996     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5997     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5998     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5999     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
6001     cp config_host.mk ../config_build.mk
6002     cp config_host_lang.mk ../config_build_lang.mk
6003     mv config.log ../config.Build.log
6004     mkdir -p ../config_build
6005     mv config_host/*.h ../config_build
6006     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
6008     # all these will get a _FOR_BUILD postfix
6009     DIRECT_FOR_BUILD_SETTINGS="
6010         CC
6011         CPPU_ENV
6012         CXX
6013         ILIB
6014         JAVA_HOME
6015         JAVAIFLAGS
6016         JDK
6017         JDK_SECURITYMANAGER_DISALLOWED
6018         LIBO_BIN_FOLDER
6019         LIBO_LIB_FOLDER
6020         LIBO_URE_LIB_FOLDER
6021         LIBO_URE_MISC_FOLDER
6022         OS
6023         SDKDIRNAME
6024         SYSTEM_LIBXML
6025         SYSTEM_LIBXSLT
6027     # these overwrite host config with build config
6028     OVERWRITING_SETTINGS="
6029         ANT
6030         ANT_HOME
6031         ANT_LIB
6032         JAVA_SOURCE_VER
6033         JAVA_TARGET_VER
6034         JAVACFLAGS
6035         JAVACOMPILER
6036         JAVADOC
6037         JAVADOCISGJDOC
6038         LOCKFILE
6039         SYSTEM_GENBRK
6040         SYSTEM_GENCCODE
6041         SYSTEM_GENCMN
6043     # these need some special handling
6044     EXTRA_HANDLED_SETTINGS="
6045         INSTDIR
6046         INSTROOT
6047         PATH
6048         WORKDIR
6050     OLD_PATH=$PATH
6051     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
6052     BUILD_PATH=$PATH
6053     PATH=$OLD_PATH
6055     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
6056     echo "$line" >>build-config
6058     for V in $DIRECT_FOR_BUILD_SETTINGS; do
6059         VV='$'$V
6060         VV=`eval "echo $VV"`
6061         if test -n "$VV"; then
6062             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
6063             echo "$line" >>build-config
6064         fi
6065     done
6067     for V in $OVERWRITING_SETTINGS; do
6068         VV='$'$V
6069         VV=`eval "echo $VV"`
6070         if test -n "$VV"; then
6071             line=${V}='${'${V}:-$VV'}'
6072             echo "$line" >>build-config
6073         fi
6074     done
6076     for V in INSTDIR INSTROOT WORKDIR; do
6077         VV='$'$V
6078         VV=`eval "echo $VV"`
6079         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
6080         if test -n "$VV"; then
6081             line="${V}_FOR_BUILD='$VV'"
6082             echo "$line" >>build-config
6083         fi
6084     done
6086     )
6087     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
6088     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])
6089     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
6090              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
6092     eval `cat CONF-FOR-BUILD/build-config`
6094     AC_MSG_RESULT([checking for BUILD platform configuration... done])
6096     rm -rf CONF-FOR-BUILD
6097 else
6098     OS_FOR_BUILD="$OS"
6099     CC_FOR_BUILD="$CC"
6100     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
6101     CXX_FOR_BUILD="$CXX"
6102     INSTDIR_FOR_BUILD="$INSTDIR"
6103     INSTROOT_FOR_BUILD="$INSTROOT"
6104     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
6105     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
6106     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6107     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6108     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6109     WORKDIR_FOR_BUILD="$WORKDIR"
6111 AC_SUBST(OS_FOR_BUILD)
6112 AC_SUBST(INSTDIR_FOR_BUILD)
6113 AC_SUBST(INSTROOT_FOR_BUILD)
6114 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6115 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6116 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6117 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6118 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6119 AC_SUBST(WORKDIR_FOR_BUILD)
6120 AC_SUBST(CC_FOR_BUILD)
6121 AC_SUBST(CXX_FOR_BUILD)
6122 AC_SUBST(CPPU_ENV_FOR_BUILD)
6124 dnl ===================================================================
6125 dnl Check for lockfile deps
6126 dnl ===================================================================
6127 if test -z "$CROSS_COMPILING"; then
6128     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6129     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6130     AC_MSG_CHECKING([which lockfile binary to use])
6131     case "$with_system_lockfile" in
6132     yes)
6133         AC_MSG_RESULT([external])
6134         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6135         ;;
6136     no)
6137         AC_MSG_RESULT([internal])
6138         ;;
6139     *)
6140         if test -x "$with_system_lockfile"; then
6141             LOCKFILE="$with_system_lockfile"
6142         else
6143             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6144         fi
6145         AC_MSG_RESULT([$with_system_lockfile])
6146         ;;
6147     esac
6150 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6151     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6154 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6155 AC_CHECK_FUNCS([utime utimes])
6156 AC_SUBST(LOCKFILE)
6158 dnl ===================================================================
6159 dnl Check for syslog header
6160 dnl ===================================================================
6161 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6163 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6164 dnl ===================================================================
6165 AC_MSG_CHECKING([whether to turn warnings to errors])
6166 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6167     ENABLE_WERROR="TRUE"
6168     PYTHONWARNINGS="error"
6169     AC_MSG_RESULT([yes])
6170 else
6171     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6172         ENABLE_WERROR="TRUE"
6173         PYTHONWARNINGS="error"
6174         AC_MSG_RESULT([yes])
6175     else
6176         AC_MSG_RESULT([no])
6177     fi
6179 AC_SUBST(ENABLE_WERROR)
6180 AC_SUBST(PYTHONWARNINGS)
6182 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6183 dnl ===================================================================
6184 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6185 if test -z "$enable_assert_always_abort"; then
6186    if test "$ENABLE_DEBUG" = TRUE; then
6187        enable_assert_always_abort=yes
6188    else
6189        enable_assert_always_abort=no
6190    fi
6192 if test "$enable_assert_always_abort" = "yes"; then
6193     ASSERT_ALWAYS_ABORT="TRUE"
6194     AC_MSG_RESULT([yes])
6195 else
6196     ASSERT_ALWAYS_ABORT="FALSE"
6197     AC_MSG_RESULT([no])
6199 AC_SUBST(ASSERT_ALWAYS_ABORT)
6201 # Determine whether to use ooenv for the instdir installation
6202 # ===================================================================
6203 if test $_os != "WINNT" -a $_os != "Darwin"; then
6204     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6205     if test -z "$enable_ooenv"; then
6206         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6207             enable_ooenv=yes
6208         else
6209             enable_ooenv=no
6210         fi
6211     fi
6212     if test "$enable_ooenv" = "no"; then
6213         AC_MSG_RESULT([no])
6214     else
6215         ENABLE_OOENV="TRUE"
6216         AC_MSG_RESULT([yes])
6217     fi
6219 AC_SUBST(ENABLE_OOENV)
6221 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6222     if test "$enable_qt5" = "no"; then
6223         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6224     else
6225         enable_qt5=yes
6226     fi
6229 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6230     if test "$enable_qt6" = "no"; then
6231         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6232     else
6233         enable_qt6=yes
6234     fi
6238 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6239 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6240     AC_MSG_RESULT([yes])
6241     ENABLE_PAGEIN=TRUE
6242     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6243 else
6244     AC_MSG_RESULT([no])
6246 AC_SUBST(ENABLE_PAGEIN)
6248 dnl ===================================================================
6249 dnl check for cups support
6250 dnl ===================================================================
6252 AC_MSG_CHECKING([whether to enable CUPS support])
6253 if test "$test_cups" = yes -a "$enable_cups" != no; then
6254     ENABLE_CUPS=TRUE
6255     AC_MSG_RESULT([yes])
6257     AC_MSG_CHECKING([whether cups support is present])
6258     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6259     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6260     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6261         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6262     fi
6263 else
6264     AC_MSG_RESULT([no])
6267 AC_SUBST(ENABLE_CUPS)
6269 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6271 dnl whether to find & fetch external tarballs?
6272 dnl ===================================================================
6273 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6274    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6275        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6276    else
6277        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6278    fi
6280 if test -z "$TARFILE_LOCATION"; then
6281     if test -d "$SRC_ROOT/src" ; then
6282         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6283         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6284     fi
6285     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6286 else
6287     AbsolutePath "$TARFILE_LOCATION"
6288     PathFormat "${absolute_path}"
6289     TARFILE_LOCATION="${formatted_path_unix}"
6291 PathFormat "$TARFILE_LOCATION"
6292 TARFILE_LOCATION_NATIVE="$formatted_path"
6293 AC_SUBST(TARFILE_LOCATION)
6294 AC_SUBST(TARFILE_LOCATION_NATIVE)
6296 AC_MSG_CHECKING([whether we want to fetch tarballs])
6297 if test "$enable_fetch_external" != "no"; then
6298     if test "$with_all_tarballs" = "yes"; then
6299         AC_MSG_RESULT([yes, all of them])
6300         DO_FETCH_TARBALLS="ALL"
6301     else
6302         AC_MSG_RESULT([yes, if we use them])
6303         DO_FETCH_TARBALLS="TRUE"
6304     fi
6305 else
6306     AC_MSG_RESULT([no])
6307     DO_FETCH_TARBALLS=
6309 AC_SUBST(DO_FETCH_TARBALLS)
6311 dnl Test whether to include MySpell dictionaries
6312 dnl ===================================================================
6313 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6314 if test "$with_myspell_dicts" = "yes"; then
6315     AC_MSG_RESULT([yes])
6316     WITH_MYSPELL_DICTS=TRUE
6317     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6318     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6319 else
6320     AC_MSG_RESULT([no])
6321     WITH_MYSPELL_DICTS=
6323 AC_SUBST(WITH_MYSPELL_DICTS)
6325 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6326 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6327     if test "$with_system_dicts" = yes; then
6328         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6329     fi
6330     with_system_dicts=no
6333 AC_MSG_CHECKING([whether to use dicts from external paths])
6334 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6335     AC_MSG_RESULT([yes])
6336     SYSTEM_DICTS=TRUE
6337     AC_MSG_CHECKING([for spelling dictionary directory])
6338     if test -n "$with_external_dict_dir"; then
6339         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6340     else
6341         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6342         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6343             DICT_SYSTEM_DIR=file:///usr/share/myspell
6344         fi
6345     fi
6346     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6347     AC_MSG_CHECKING([for hyphenation patterns directory])
6348     if test -n "$with_external_hyph_dir"; then
6349         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6350     else
6351         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6352     fi
6353     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6354     AC_MSG_CHECKING([for thesaurus directory])
6355     if test -n "$with_external_thes_dir"; then
6356         THES_SYSTEM_DIR=file://$with_external_thes_dir
6357     else
6358         THES_SYSTEM_DIR=file:///usr/share/mythes
6359     fi
6360     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6361 else
6362     AC_MSG_RESULT([no])
6363     SYSTEM_DICTS=
6365 AC_SUBST(SYSTEM_DICTS)
6366 AC_SUBST(DICT_SYSTEM_DIR)
6367 AC_SUBST(HYPH_SYSTEM_DIR)
6368 AC_SUBST(THES_SYSTEM_DIR)
6370 dnl ===================================================================
6371 dnl Precompiled headers.
6372 ENABLE_PCH=""
6373 AC_MSG_CHECKING([whether to enable pch feature])
6374 if test -z "$enable_pch"; then
6375     if test "$_os" = "WINNT"; then
6376         # Enabled by default on Windows.
6377         enable_pch=yes
6378         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6379         if test -z "$enable_ccache" -a "$SCCACHE"; then
6380             CCACHE=""
6381         fi
6382     else
6383         enable_pch=no
6384     fi
6386 if test "$enable_pch" != no -a "$_os" = Emscripten; then
6387     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6389 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6390     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6392 if test "$enable_pch" = "system"; then
6393     ENABLE_PCH="1"
6394     AC_MSG_RESULT([yes (system headers)])
6395 elif test "$enable_pch" = "base"; then
6396     ENABLE_PCH="2"
6397     AC_MSG_RESULT([yes (system and base headers)])
6398 elif test "$enable_pch" = "normal"; then
6399     ENABLE_PCH="3"
6400     AC_MSG_RESULT([yes (normal)])
6401 elif test "$enable_pch" = "full"; then
6402     ENABLE_PCH="4"
6403     AC_MSG_RESULT([yes (full)])
6404 elif test "$enable_pch" = "yes"; then
6405     # Pick a suitable default.
6406     if test "$GCC" = "yes"; then
6407         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6408         # while making the PCHs larger and rebuilds more likely.
6409         ENABLE_PCH="2"
6410         AC_MSG_RESULT([yes (system and base headers)])
6411     else
6412         # With MSVC the highest level makes a significant difference,
6413         # and it was the default when there used to be no PCH levels.
6414         ENABLE_PCH="4"
6415         AC_MSG_RESULT([yes (full)])
6416     fi
6417 elif test "$enable_pch" = "no"; then
6418     AC_MSG_RESULT([no])
6419 else
6420     AC_MSG_ERROR([Unknown value for --enable-pch])
6422 AC_SUBST(ENABLE_PCH)
6423 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6424 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6425     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6426     if test "$CCACHE_BIN" != "not found"; then
6427         AC_MSG_CHECKING([ccache version])
6428         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6429         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6430         AC_MSG_RESULT([$CCACHE_VERSION])
6431         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6432         if test "$CCACHE_NUMVER" -gt "030701"; then
6433             AC_MSG_RESULT([yes])
6434         else
6435             AC_MSG_RESULT([no (not newer than 3.7.1)])
6436             CCACHE_DEPEND_MODE=
6437         fi
6438     fi
6441 PCH_INSTANTIATE_TEMPLATES=
6442 if test -n "$ENABLE_PCH"; then
6443     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6444     save_CFLAGS=$CFLAGS
6445     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6446     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6447     CFLAGS=$save_CFLAGS
6448     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6449         AC_MSG_RESULT(yes)
6450     else
6451         AC_MSG_RESULT(no)
6452     fi
6454 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6456 BUILDING_PCH_WITH_OBJ=
6457 if test -n "$ENABLE_PCH"; then
6458     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6459     save_CFLAGS=$CFLAGS
6460     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6461     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6462     CFLAGS=$save_CFLAGS
6463     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6464         AC_MSG_RESULT(yes)
6465     else
6466         AC_MSG_RESULT(no)
6467     fi
6469 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6471 PCH_CODEGEN=
6472 PCH_NO_CODEGEN=
6473 fpch_prefix=
6474 if test "$COM" = MSC; then
6475     fpch_prefix="-Xclang "
6477 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6478     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6479     save_CFLAGS=$CFLAGS
6480     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6481     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6482         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6483     CFLAGS=$save_CFLAGS
6484     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6485     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6486         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6487     CFLAGS=$save_CFLAGS
6488     if test -n "$PCH_CODEGEN"; then
6489         AC_MSG_RESULT(yes)
6490     else
6491         AC_MSG_RESULT(no)
6492     fi
6494 AC_SUBST(PCH_CODEGEN)
6495 AC_SUBST(PCH_NO_CODEGEN)
6496 PCH_DEBUGINFO=
6497 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6498     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6499     save_CFLAGS=$CFLAGS
6500     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6501     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6502     CFLAGS=$save_CFLAGS
6503     if test -n "$PCH_DEBUGINFO"; then
6504         AC_MSG_RESULT(yes)
6505     else
6506         AC_MSG_RESULT(no)
6507     fi
6509 AC_SUBST(PCH_DEBUGINFO)
6511 TAB=`printf '\t'`
6513 AC_MSG_CHECKING([the GNU Make version])
6514 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6515 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6516 if test "$_make_longver" -ge "040000"; then
6517     AC_MSG_RESULT([$GNUMAKE $_make_version])
6518 else
6519     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6522 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6523 STALE_MAKE=
6524 if test "$_make_ver_check" = ""; then
6525    STALE_MAKE=TRUE
6528 HAVE_LD_HASH_STYLE=FALSE
6529 WITH_LINKER_HASH_STYLE=
6530 AC_MSG_CHECKING([for --hash-style gcc linker support])
6531 if test "$GCC" = "yes"; then
6532     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6533         hash_styles="gnu sysv"
6534     elif test "$with_linker_hash_style" = "no"; then
6535         hash_styles=
6536     else
6537         hash_styles="$with_linker_hash_style"
6538     fi
6540     for hash_style in $hash_styles; do
6541         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6542         hash_style_ldflags_save=$LDFLAGS
6543         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6545         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6546             [
6547 #include <stdio.h>
6548             ],[
6549 printf ("");
6550             ])],
6551             [
6552                   HAVE_LD_HASH_STYLE=TRUE
6553                   WITH_LINKER_HASH_STYLE=$hash_style
6554             ],
6555             [HAVE_LD_HASH_STYLE=FALSE],
6556             [HAVE_LD_HASH_STYLE=FALSE])
6557         LDFLAGS=$hash_style_ldflags_save
6558     done
6560     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6561         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6562     else
6563         AC_MSG_RESULT( no )
6564     fi
6565     LDFLAGS=$hash_style_ldflags_save
6566 else
6567     AC_MSG_RESULT( no )
6569 AC_SUBST(HAVE_LD_HASH_STYLE)
6570 AC_SUBST(WITH_LINKER_HASH_STYLE)
6572 dnl ===================================================================
6573 dnl Check whether there's a Perl version available.
6574 dnl ===================================================================
6575 if test -z "$with_perl_home"; then
6576     AC_PATH_PROG(PERL, perl)
6577 else
6578     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6579     _perl_path="$with_perl_home/bin/perl"
6580     if test -x "$_perl_path"; then
6581         PERL=$_perl_path
6582     else
6583         AC_MSG_ERROR([$_perl_path not found])
6584     fi
6587 dnl ===================================================================
6588 dnl Testing for Perl version 5 or greater.
6589 dnl $] is the Perl version variable, it is returned as an integer
6590 dnl ===================================================================
6591 if test "$PERL"; then
6592     AC_MSG_CHECKING([the Perl version])
6593     ${PERL} -e "exit($]);"
6594     _perl_version=$?
6595     if test "$_perl_version" -lt 5; then
6596         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6597     fi
6598     AC_MSG_RESULT([Perl $_perl_version])
6599 else
6600     AC_MSG_ERROR([Perl not found, install Perl 5])
6603 dnl ===================================================================
6604 dnl Testing for required Perl modules
6605 dnl ===================================================================
6607 AC_MSG_CHECKING([for required Perl modules])
6608 perl_use_string="use Cwd ; use Digest::MD5"
6609 if test "$_os" = "WINNT"; then
6610     if test -n "$PKGFORMAT"; then
6611         for i in $PKGFORMAT; do
6612             case "$i" in
6613             msi)
6614                 # for getting fonts versions to use in MSI
6615                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6616                 ;;
6617             esac
6618         done
6619     fi
6621 if test "$with_system_hsqldb" = "yes"; then
6622     perl_use_string="$perl_use_string ; use Archive::Zip"
6624 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6625     # OpenSSL needs that to build
6626     perl_use_string="$perl_use_string ; use FindBin"
6628 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6629     AC_MSG_RESULT([all modules found])
6630 else
6631     AC_MSG_RESULT([failed to find some modules])
6632     # Find out which modules are missing.
6633     for i in $perl_use_string; do
6634         if test "$i" != "use" -a "$i" != ";"; then
6635             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6636                 missing_perl_modules="$missing_perl_modules $i"
6637             fi
6638         fi
6639     done
6640     AC_MSG_ERROR([
6641     The missing Perl modules are: $missing_perl_modules
6642     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6645 dnl ===================================================================
6646 dnl Check for pkg-config
6647 dnl ===================================================================
6648 if test "$_os" != "WINNT"; then
6649     PKG_PROG_PKG_CONFIG
6651 AC_SUBST(PKG_CONFIG)
6652 AC_SUBST(PKG_CONFIG_PATH)
6653 AC_SUBST(PKG_CONFIG_LIBDIR)
6655 if test "$_os" != "WINNT"; then
6657     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6658     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6659     # explicitly. Or put /path/to/compiler in PATH yourself.
6661     toolprefix=gcc
6662     if test "$COM_IS_CLANG" = "TRUE"; then
6663         toolprefix=llvm
6664     fi
6665     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6666     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6667     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6668     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6669     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6670     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6672 AC_SUBST(AR)
6673 AC_SUBST(NM)
6674 AC_SUBST(OBJDUMP)
6675 AC_SUBST(RANLIB)
6676 AC_SUBST(READELF)
6677 AC_SUBST(STRIP)
6679 dnl ===================================================================
6680 dnl pkg-config checks on macOS
6681 dnl ===================================================================
6683 if test $_os = Darwin; then
6684     AC_MSG_CHECKING([for bogus pkg-config])
6685     if test -n "$PKG_CONFIG"; then
6686         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6687             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6688         else
6689             if test "$enable_bogus_pkg_config" = "yes"; then
6690                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6691             else
6692                 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.])
6693             fi
6694         fi
6695     else
6696         AC_MSG_RESULT([no, good])
6697     fi
6700 find_csc()
6702     # Return value: $csctest
6704     unset csctest
6706     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
6707     if test -n "$regvalue"; then
6708         csctest=$regvalue
6709         return
6710     fi
6713 find_al()
6715     # Return value: $altest
6717     unset altest
6719     # We need this check to detect 4.6.1 or above.
6720     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6721         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
6722         PathFormat "$regvalue"
6723         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6724             altest=$regvalue
6725             return
6726         fi
6727     done
6729     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6730     for x in $reglist; do
6731         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
6732         PathFormat "$regvalue"
6733         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6734             altest=$regvalue
6735             return
6736         fi
6737     done
6740 find_dotnetsdk()
6742     unset frametest
6744     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
6745         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
6746         if test -n "$regvalue"; then
6747             frametest=$regvalue
6748             return
6749         fi
6750     done
6751     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6754 find_winsdk_version()
6756     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6757     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6759     unset winsdktest winsdkbinsubdir winsdklibsubdir
6761     case "$1" in
6762     8.0|8.0A)
6763         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
6764         if test -n "$regvalue"; then
6765             winsdktest=$regvalue
6766             winsdklibsubdir=win8
6767             return
6768         fi
6769         ;;
6770     8.1|8.1A)
6771         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
6772         if test -n "$regvalue"; then
6773             winsdktest=$regvalue
6774             winsdklibsubdir=winv6.3
6775             return
6776         fi
6777         ;;
6778     10.0)
6779         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
6780         if test -n "$regvalue"; then
6781             winsdktest=$regvalue
6782             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
6783             if test -n "$regvalue"; then
6784                 winsdkbinsubdir="$regvalue".0
6785                 winsdklibsubdir=$winsdkbinsubdir
6786                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6787                 PathFormat "$tmppath"
6788                 local tmppath_unix=$formatted_path_unix
6789                 # test exist the SDK path
6790                 if test ! -d "$tmppath_unix"; then
6791                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6792                 fi
6793             fi
6794             return
6795         fi
6796         ;;
6797     esac
6800 find_winsdk()
6802     # Return value: From find_winsdk_version
6804     unset winsdktest
6806     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6807         find_winsdk_version $ver
6808         if test -n "$winsdktest"; then
6809             return
6810         fi
6811     done
6814 find_msms()
6816     # Return value: $msmdir
6817     local version="$1"
6819     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6820     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6821     local my_msm_dir
6823     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6825     msmdir=
6826     case "$VCVER" in
6827     16.0 | 17.0 | 17.10)
6828         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6829             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6830             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6831             if test -e "$my_msm_dir${my_msm_file}"; then
6832                 msmdir=$my_msm_dir
6833             fi
6834         done
6835         ;;
6836     esac
6838     if test -n "$msmdir"; then
6839         msmdir=`cygpath -m "$msmdir"`
6840         AC_MSG_RESULT([$msmdir])
6841     else
6842         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6843             AC_MSG_FAILURE([not found])
6844         else
6845             AC_MSG_WARN([not found (check config.log)])
6846             add_warning "MSM ${my_msm_file} not found"
6847         fi
6848     fi
6851 find_msvc_x64_dlls()
6853     # Return value: $msvcdllpath, $msvcdlls
6855     AC_MSG_CHECKING([for MSVC x64 DLL path])
6857     dnl Order crtver in increasing order. Then check the directories returned by
6858     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6859     dnl the result will be the highest CRT version found in the highest directory.
6861     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6862     case "$VCVER" in
6863     16.0 | 17.0 | 17.10)
6864         for crtver in 141 142 143; do
6865             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6866                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6867                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6868                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6869                 fi
6870             done
6871         done
6872         ;;
6873     esac
6874     AC_MSG_RESULT([$msvcdllpath])
6875     AC_MSG_CHECKING([for MSVC x64 DLLs])
6876     msvcdlls="msvcp140.dll vcruntime140.dll"
6877     for dll in $msvcdlls; do
6878         if ! test -f "$msvcdllpath/$dll"; then
6879             AC_MSG_FAILURE([missing $dll])
6880         fi
6881     done
6882     AC_MSG_RESULT([found all ($msvcdlls)])
6885 dnl =========================================
6886 dnl Check for the Windows  SDK.
6887 dnl =========================================
6888 if test "$_os" = "WINNT"; then
6889     AC_MSG_CHECKING([for Windows SDK])
6890     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6891         find_winsdk
6892         WINDOWS_SDK_HOME=$winsdktest
6894         # normalize if found
6895         if test -n "$WINDOWS_SDK_HOME"; then
6896             PathFormat "$WINDOWS_SDK_HOME"
6897             WINDOWS_SDK_HOME=$formatted_path_unix
6898         fi
6900         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6901         # The variable also contains the Windows SDK version
6902         echo $WINDOWS_SDK_LIB_SUBDIR
6903         IFS='.' read -r SDK_v1 SDK_v2 SDK_v3 SDK_v4 <<< "$WINDOWS_SDK_LIB_SUBDIR"
6904         # Assuming maximum of 5 digits for each part and ignoring last part
6905         SDK_NORMALIZED_VER=$((SDK_v1 * 10000000000 + SDK_v2 * 100000 + SDK_v3))
6906         # 10.0.20348.0 is the minimum required version
6907         if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
6908             AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
6909         fi
6910     fi
6912     if test -n "$WINDOWS_SDK_HOME"; then
6913         # Remove a possible trailing backslash
6914         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6916         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6917              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6918              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6919             have_windows_sdk_headers=yes
6920         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6921              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6922              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6923             have_windows_sdk_headers=yes
6924         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6925              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6926              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6927             have_windows_sdk_headers=yes
6928         else
6929             have_windows_sdk_headers=no
6930         fi
6932         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6933             have_windows_sdk_libs=yes
6934         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6935             have_windows_sdk_libs=yes
6936         else
6937             have_windows_sdk_libs=no
6938         fi
6940         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6941             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6942 the  Windows SDK are installed.])
6943         fi
6944     fi
6946     if test -z "$WINDOWS_SDK_HOME"; then
6947         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6948     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6949         WINDOWS_SDK_VERSION=80
6950         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6951     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6952         WINDOWS_SDK_VERSION=81
6953         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6954     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6955         WINDOWS_SDK_VERSION=10
6956         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6957     else
6958         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6959     fi
6960     PathFormat "$WINDOWS_SDK_HOME"
6961     WINDOWS_SDK_HOME="$formatted_path"
6962     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6963     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
6964         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6965         if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
6966             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6967         elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
6968             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6969         fi
6970     fi
6972     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6973     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6974     dnl but not in v8.0), so allow this to be overridden with a
6975     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6976     dnl and configuration error if no WiLangId.vbs is found would arguably be
6977     dnl better, but I do not know under which conditions exactly it is needed by
6978     dnl msiglobal.pm:
6979     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6980         WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6981         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6982             WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6983         fi
6984         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6985             WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6986         fi
6987         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6988             WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
6989         fi
6990         PathFormat "$WINDOWS_SDK_WILANGID_unix"
6991         WINDOWS_SDK_WILANGID="$formatted_path"
6992     fi
6993     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6994         if test -n "$with_package_format" -a "$with_package_format" != no; then
6995             for i in "$with_package_format"; do
6996                 if test "$i" = "msi"; then
6997                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6998                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6999                     fi
7000                 fi
7001             done
7002         fi
7003     fi
7005 AC_SUBST(WINDOWS_SDK_HOME)
7006 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
7007 AC_SUBST(WINDOWS_SDK_VERSION)
7008 AC_SUBST(WINDOWS_SDK_WILANGID)
7010 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
7011     dnl Check midl.exe; this being the first check for a tool in the SDK bin
7012     dnl dir, it also determines that dir's path w/o an arch segment if any,
7013     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
7014     AC_MSG_CHECKING([for midl.exe])
7016     find_winsdk
7017     PathFormat "$winsdktest"
7018     winsdktest_unix="$formatted_path_unix"
7020     if test -n "$winsdkbinsubdir" \
7021         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
7022     then
7023         MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
7024         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
7025     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
7026         MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
7027         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7028     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
7029         MIDL_PATH=$winsdktest_unix/Bin
7030         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
7031     fi
7032     PathFormat "$MIDL_PATH"
7033     if test ! -f "$formatted_path_unix/midl.exe"; then
7034         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
7035     else
7036         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
7037     fi
7039     # Convert to posix path with 8.3 filename restrictions ( No spaces )
7040     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
7042     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
7043          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
7044          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
7045          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
7046     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
7047          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
7048          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7049          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
7050     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
7051          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
7052          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
7053          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
7054     else
7055         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
7056     fi
7058     dnl Check csc.exe
7059     AC_MSG_CHECKING([for csc.exe])
7060     find_csc
7061     PathFormat "$csctest"
7062     csctest_unix="$formatted_path_unix"
7063     if test -f "$csctest_unix/csc.exe"; then
7064         CSC_PATH="$csctest"
7065     fi
7066     if test ! -f "$csctest_unix/csc.exe"; then
7067         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
7068     else
7069         AC_MSG_RESULT([$CSC_PATH/csc.exe])
7070     fi
7072     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
7074     dnl Check al.exe
7075     AC_MSG_CHECKING([for al.exe])
7076     if test -n "$winsdkbinsubdir" \
7077         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
7078     then
7079         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
7080     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
7081         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
7082     elif test -f "$winsdktest_unix/Bin/al.exe"; then
7083         AL_PATH="$winsdktest/Bin"
7084     fi
7086     if test -z "$AL_PATH"; then
7087         find_al
7088         PathFormat "$altest"
7089         altest_unix="$formatted_path_unix"
7090         if test -f "$altest_unix/bin/al.exe"; then
7091             AL_PATH="$altest/bin"
7092         elif test -f "$altest_unix/al.exe"; then
7093             AL_PATH="$altest"
7094         fi
7095     fi
7096     PathFormat "$AL_PATH"
7097     if test ! -f "$formatted_path_unix/al.exe"; then
7098         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
7099     else
7100         AC_MSG_RESULT([$AL_PATH/al.exe])
7101     fi
7103     AL_PATH=`win_short_path_for_make "$AL_PATH"`
7105     dnl Check mscoree.lib / .NET Framework dir
7106     AC_MSG_CHECKING(.NET Framework)
7107     find_dotnetsdk
7108     PathFormat "$frametest"
7109     frametest="$formatted_path_unix"
7110     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7111         DOTNET_FRAMEWORK_HOME="$frametest"
7112     else
7113         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7114             DOTNET_FRAMEWORK_HOME="$winsdktest"
7115         fi
7116     fi
7117     PathFormat "$DOTNET_FRAMEWORK_HOME"
7118     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
7119         AC_MSG_ERROR([mscoree.lib not found])
7120     fi
7121     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7123     PathFormat "$MIDL_PATH"
7124     MIDL_PATH="$formatted_path"
7126     PathFormat "$AL_PATH"
7127     AL_PATH="$formatted_path"
7129     PathFormat "$DOTNET_FRAMEWORK_HOME"
7130     DOTNET_FRAMEWORK_HOME="$formatted_path"
7132     PathFormat "$CSC_PATH"
7133     CSC_PATH="$formatted_path"
7136 dnl ===================================================================
7137 dnl Testing for C++ compiler and version...
7138 dnl ===================================================================
7140 if test "$_os" != "WINNT"; then
7141     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
7142     # see AC_PROG_CC above):
7143     save_CXXFLAGS=$CXXFLAGS
7144     CXXFLAGS=-g
7145     AC_PROG_CXX
7146     CXXFLAGS=$save_CXXFLAGS
7147     if test -z "$CXX_BASE"; then
7148         CXX_BASE=`first_arg_basename "$CXX"`
7149     fi
7152 dnl check for GNU C++ compiler version
7153 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7154     AC_MSG_CHECKING([the GNU C++ compiler version])
7156     _gpp_version=`$CXX -dumpversion`
7157     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7159     if test "$_gpp_majmin" -lt "700"; then
7160         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7161     else
7162         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7163     fi
7165     dnl see https://issuetracker.google.com/issues/36962819
7166         glibcxx_threads=no
7167         AC_LANG_PUSH([C++])
7168         AC_REQUIRE_CPP
7169         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7170         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7171             #include <bits/c++config.h>]],[[
7172             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7173             && !defined(_GLIBCXX__PTHREADS) \
7174             && !defined(_GLIBCXX_HAS_GTHREADS)
7175             choke me
7176             #endif
7177         ]])],[AC_MSG_RESULT([yes])
7178         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7179         AC_LANG_POP([C++])
7180         if test $glibcxx_threads = yes; then
7181             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7182         fi
7184 AC_SUBST(BOOST_CXXFLAGS)
7187 # prefx CXX with ccache if needed
7189 if test "$CCACHE" != ""; then
7190     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7191     AC_LANG_PUSH([C++])
7192     save_CXXFLAGS=$CXXFLAGS
7193     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7194     # msvc does not fail on unknown options, check stdout
7195     if test "$COM" = MSC; then
7196         CXXFLAGS="$CXXFLAGS -nologo"
7197     fi
7198     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7199     ac_cxx_werror_flag=yes
7200     dnl an empty program will do, we're checking the compiler flags
7201     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7202                       [use_ccache=yes], [use_ccache=no])
7203     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7204         AC_MSG_RESULT([yes])
7205     else
7206         CXX="$CCACHE $CXX"
7207         CXX_BASE="ccache $CXX_BASE"
7208         AC_MSG_RESULT([no])
7209     fi
7210     CXXFLAGS=$save_CXXFLAGS
7211     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7212     AC_LANG_POP([C++])
7215 dnl ===================================================================
7216 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7217 dnl ===================================================================
7219 if test "$_os" != "WINNT"; then
7220     AC_PROG_CXXCPP
7222     dnl Check whether there's a C pre-processor.
7223     AC_PROG_CPP
7227 dnl ===================================================================
7228 dnl Find integral type sizes and alignments
7229 dnl ===================================================================
7231 if test "$_os" != "WINNT"; then
7233     AC_CHECK_SIZEOF(long)
7234     AC_CHECK_SIZEOF(short)
7235     AC_CHECK_SIZEOF(int)
7236     AC_CHECK_SIZEOF(long long)
7237     AC_CHECK_SIZEOF(double)
7238     AC_CHECK_SIZEOF(void*)
7239     AC_CHECK_SIZEOF(size_t)
7241     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7242     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7243     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7244     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7245     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7246     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7248     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7249     m4_pattern_allow([AC_CHECK_ALIGNOF])
7250     m4_ifdef([AC_CHECK_ALIGNOF],
7251         [
7252             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7253             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7254             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7255             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7256         ],
7257         [
7258             case "$_os-$host_cpu" in
7259             Linux-i686)
7260                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7261                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7262                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7263                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7264                 ;;
7265             Linux-x86_64)
7266                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7267                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7268                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7269                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7270                 ;;
7271             *)
7272                 if test -z "$ac_cv_alignof_short" -o \
7273                         -z "$ac_cv_alignof_int" -o \
7274                         -z "$ac_cv_alignof_long" -o \
7275                         -z "$ac_cv_alignof_double"; then
7276                    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.])
7277                 fi
7278                 ;;
7279             esac
7280         ])
7282     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7283     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7284     if test $ac_cv_sizeof_long -eq 8; then
7285         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7286     elif test $ac_cv_sizeof_double -eq 8; then
7287         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7288     else
7289         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7290     fi
7292     dnl Check for large file support
7293     AC_SYS_LARGEFILE
7294     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
7295         LFS_CFLAGS="$ac_cv_sys_largefile_opts"
7296     elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7297         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7298     fi
7299     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7300         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7301     fi
7302 else
7303     # Hardcode for MSVC
7304     SAL_TYPES_SIZEOFSHORT=2
7305     SAL_TYPES_SIZEOFINT=4
7306     SAL_TYPES_SIZEOFLONG=4
7307     SAL_TYPES_SIZEOFLONGLONG=8
7308     if test $WIN_HOST_BITS -eq 32; then
7309         SAL_TYPES_SIZEOFPOINTER=4
7310         SIZEOF_SIZE_T=4
7311     else
7312         SAL_TYPES_SIZEOFPOINTER=8
7313         SIZEOF_SIZE_T=8
7314     fi
7315     SAL_TYPES_ALIGNMENT2=2
7316     SAL_TYPES_ALIGNMENT4=4
7317     SAL_TYPES_ALIGNMENT8=8
7318     LFS_CFLAGS=''
7320 AC_SUBST(LFS_CFLAGS)
7321 AC_SUBST(SIZEOF_SIZE_T)
7323 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7324 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7325 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7326 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7327 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7328 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7329 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7330 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7332 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7333 AC_MSG_CHECKING([whether jumbo sheets are supported])
7334 if test "$_os" != "WINNT"; then
7335     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7336         AC_MSG_RESULT([yes])
7337         ENABLE_JUMBO_SHEETS=TRUE
7338         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7339     else
7340         AC_MSG_RESULT([no])
7341     fi
7342 else
7343     if test $WIN_HOST_BITS -gt 32; then
7344         # 64bit windows is special-cased for tools::Long because long is 32bit
7345         AC_MSG_RESULT([yes])
7346         ENABLE_JUMBO_SHEETS=TRUE
7347         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7348     else
7349         AC_MSG_RESULT([no])
7350     fi
7352 AC_SUBST(ENABLE_JUMBO_SHEETS)
7354 dnl ===================================================================
7355 dnl Check whether to enable runtime optimizations
7356 dnl ===================================================================
7357 ENABLE_RUNTIME_OPTIMIZATIONS=
7358 AC_MSG_CHECKING([whether to enable runtime optimizations])
7359 if test -z "$enable_runtime_optimizations"; then
7360     for i in $CC; do
7361         case $i in
7362         -fsanitize=*)
7363             enable_runtime_optimizations=no
7364             break
7365             ;;
7366         esac
7367     done
7369 if test "$enable_runtime_optimizations" != no; then
7370     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7371     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7372     AC_MSG_RESULT([yes])
7373 else
7374     AC_MSG_RESULT([no])
7376 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7378 dnl ===================================================================
7379 dnl Check if valgrind headers are available
7380 dnl ===================================================================
7381 ENABLE_VALGRIND=
7382 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7383     prev_cppflags=$CPPFLAGS
7384     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7385     # or where does it come from?
7386     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7387     AC_CHECK_HEADER([valgrind/valgrind.h],
7388         [ENABLE_VALGRIND=TRUE])
7389     CPPFLAGS=$prev_cppflags
7391 AC_SUBST([ENABLE_VALGRIND])
7392 if test -z "$ENABLE_VALGRIND"; then
7393     if test "$with_valgrind" = yes; then
7394         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7395     fi
7396     VALGRIND_CFLAGS=
7398 AC_SUBST([VALGRIND_CFLAGS])
7401 dnl ===================================================================
7402 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7403 dnl ===================================================================
7405 # We need at least the sys/sdt.h include header.
7406 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7407 if test "$SDT_H_FOUND" = "TRUE"; then
7408     # Found sys/sdt.h header, now make sure the c++ compiler works.
7409     # Old g++ versions had problems with probes in constructors/destructors.
7410     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7411     AC_LANG_PUSH([C++])
7412     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7413     #include <sys/sdt.h>
7414     class ProbeClass
7415     {
7416     private:
7417       int& ref;
7418       const char *name;
7420     public:
7421       ProbeClass(int& v, const char *n) : ref(v), name(n)
7422       {
7423         DTRACE_PROBE2(_test_, cons, name, ref);
7424       }
7426       void method(int min)
7427       {
7428         DTRACE_PROBE3(_test_, meth, name, ref, min);
7429         ref -= min;
7430       }
7432       ~ProbeClass()
7433       {
7434         DTRACE_PROBE2(_test_, dest, name, ref);
7435       }
7436     };
7437     ]],[[
7438     int i = 64;
7439     DTRACE_PROBE1(_test_, call, i);
7440     ProbeClass inst = ProbeClass(i, "call");
7441     inst.method(24);
7442     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7443           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7444     AC_LANG_POP([C++])
7446 AC_CONFIG_HEADERS([config_host/config_probes.h])
7448 dnl ===================================================================
7449 dnl GCC features
7450 dnl ===================================================================
7451 HAVE_GCC_STACK_CLASH_PROTECTION=
7452 HARDENING_CFLAGS=
7453 HARDENING_OPT_CFLAGS=
7454 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7455     AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
7456     save_CFLAGS=$CFLAGS
7457     CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
7458     AC_LINK_IFELSE(
7459         [AC_LANG_PROGRAM(, [[return 0;]])],
7460         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
7461         [AC_MSG_RESULT([no])])
7462     CFLAGS=$save_CFLAGS
7464     AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
7465     save_CFLAGS=$CFLAGS
7466     CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
7467     if test "$ENABLE_OPTIMIZED" = TRUE; then
7468         CFLAGS="$CFLAGS -O2"
7469     fi
7470     AC_LINK_IFELSE(
7471         [AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
7472         [AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
7473         [AC_MSG_RESULT([no])])
7474     CFLAGS=$save_CFLAGS
7476     AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
7477     save_CFLAGS=$CFLAGS
7478     CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
7479     AC_LINK_IFELSE(
7480         [AC_LANG_PROGRAM(, [[return 0;]])],
7481         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
7482         [AC_MSG_RESULT([no])])
7483     CFLAGS=$save_CFLAGS
7485     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7486     save_CFLAGS=$CFLAGS
7487     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7488     AC_LINK_IFELSE(
7489         [AC_LANG_PROGRAM(, [[return 0;]])],
7490         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
7491         [AC_MSG_RESULT([no])])
7492     CFLAGS=$save_CFLAGS
7494     AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
7495     save_CFLAGS=$CFLAGS
7496     CFLAGS="$CFLAGS -Werror -fcf-protection"
7497     AC_LINK_IFELSE(
7498         [AC_LANG_PROGRAM(, [[return 0;]])],
7499         [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
7500         [AC_MSG_RESULT([no])])
7501     CFLAGS=$save_CFLAGS
7503     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7504     save_CFLAGS=$CFLAGS
7505     CFLAGS="$CFLAGS -Werror -mno-avx"
7506     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7507     CFLAGS=$save_CFLAGS
7508     if test "$HAVE_GCC_AVX" = "TRUE"; then
7509         AC_MSG_RESULT([yes])
7510     else
7511         AC_MSG_RESULT([no])
7512     fi
7514     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7515     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7516     int v = 0;
7517     if (__sync_add_and_fetch(&v, 1) != 1 ||
7518         __sync_sub_and_fetch(&v, 1) != 0)
7519         return 1;
7520     __sync_synchronize();
7521     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7522         v != 1)
7523         return 1;
7524     return 0;
7525 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7526     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7527         AC_MSG_RESULT([yes])
7528         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7529     else
7530         AC_MSG_RESULT([no])
7531     fi
7533     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7534     AC_LANG_PUSH([C++])
7535     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7536             #include <cstddef>
7537             #include <cxxabi.h>
7538             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7539         ])], [
7540             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7541             AC_MSG_RESULT([yes])
7542         ], [AC_MSG_RESULT([no])])
7543     AC_LANG_POP([C++])
7545     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7546     AC_LANG_PUSH([C++])
7547     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7548             #include <cstddef>
7549             #include <cxxabi.h>
7550             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7551         ])], [
7552             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7553             AC_MSG_RESULT([yes])
7554         ], [AC_MSG_RESULT([no])])
7555     AC_LANG_POP([C++])
7557     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7558     AC_LANG_PUSH([C++])
7559     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7560             #include <cxxabi.h>
7561             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7562         ])], [
7563             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7564             AC_MSG_RESULT([yes])
7565         ], [AC_MSG_RESULT([no])])
7566     AC_LANG_POP([C++])
7568     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7569     AC_LANG_PUSH([C++])
7570     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7571             #include <cstddef>
7572             #include <cxxabi.h>
7573             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7574         ])], [
7575             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7576             AC_MSG_RESULT([yes])
7577         ], [AC_MSG_RESULT([no])])
7578     AC_LANG_POP([C++])
7580     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7581     AC_LANG_PUSH([C++])
7582     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7583             #include <cstddef>
7584             #include <cxxabi.h>
7585             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7586         ])], [
7587             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7588             AC_MSG_RESULT([yes])
7589         ], [AC_MSG_RESULT([no])])
7590     AC_LANG_POP([C++])
7592     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7593     AC_LANG_PUSH([C++])
7594     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7595             #include <cxxabi.h>
7596             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7597         ])], [
7598             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7599             AC_MSG_RESULT([yes])
7600         ], [AC_MSG_RESULT([no])])
7601     AC_LANG_POP([C++])
7603     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7604     AC_LANG_PUSH([C++])
7605     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7606             #include <cxxabi.h>
7607             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7608         ])], [
7609             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7610             AC_MSG_RESULT([yes])
7611         ], [AC_MSG_RESULT([no])])
7612     AC_LANG_POP([C++])
7614     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7615     AC_LANG_PUSH([C++])
7616     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7617             #include <cxxabi.h>
7618             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7619         ])], [
7620             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7621             AC_MSG_RESULT([yes])
7622         ], [AC_MSG_RESULT([no])])
7623     AC_LANG_POP([C++])
7625     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7626     AC_LANG_PUSH([C++])
7627     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7628             #include <cstddef>
7629             #include <cxxabi.h>
7630             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7631         ])], [
7632             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7633             AC_MSG_RESULT([yes])
7634         ], [AC_MSG_RESULT([no])])
7635     AC_LANG_POP([C++])
7637     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7638     AC_LANG_PUSH([C++])
7639     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7640             #include <cstddef>
7641             #include <cxxabi.h>
7642             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7643         ])], [
7644             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7645             AC_MSG_RESULT([yes])
7646         ], [AC_MSG_RESULT([no])])
7647     AC_LANG_POP([C++])
7650 AC_SUBST(HAVE_GCC_AVX)
7651 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7652 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7653 AC_SUBST(HARDENING_CFLAGS)
7654 AC_SUBST(HARDENING_OPT_CFLAGS)
7656 dnl ===================================================================
7657 dnl Identify the C++ library
7658 dnl ===================================================================
7660 AC_MSG_CHECKING([what the C++ library is])
7661 HAVE_LIBSTDCPP=
7662 HAVE_LIBCPP=
7663 AC_LANG_PUSH([C++])
7664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7665 #include <utility>
7666 #ifndef __GLIBCXX__
7667 foo bar
7668 #endif
7669 ]])],
7670     [CPP_LIBRARY=GLIBCXX
7671      cpp_library_name="GNU libstdc++"
7672      HAVE_LIBSTDCPP=TRUE
7673     ],
7674     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7675 #include <utility>
7676 #ifndef _LIBCPP_VERSION
7677 foo bar
7678 #endif
7679 ]])],
7680     [CPP_LIBRARY=LIBCPP
7681      cpp_library_name="LLVM libc++"
7682      AC_DEFINE([HAVE_LIBCPP])
7683      HAVE_LIBCPP=TRUE
7684     ],
7685     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7686 #include <utility>
7687 #ifndef _MSC_VER
7688 foo bar
7689 #endif
7690 ]])],
7691     [CPP_LIBRARY=MSVCRT
7692      cpp_library_name="Microsoft"
7693     ],
7694     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7695 AC_MSG_RESULT([$cpp_library_name])
7696 AC_LANG_POP([C++])
7697 AC_SUBST([HAVE_LIBSTDCPP])
7698 AC_SUBST([HAVE_LIBCPP])
7700 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7701 then
7702     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7703     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7704     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7705     # although there will be backwards compatibility).
7706     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7707     # and there would be undefined references to debug functions.
7708     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7709     # So check if debug mode can be used and disable or downgrade it to assertions
7710     # if needed.
7711     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7712     AC_LANG_PUSH([C++])
7713     libcpp_debug_links=
7714     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7715 #define _LIBCPP_DEBUG 0 // only assertions
7716 #include <vector>
7717 int main()
7719     std::vector<int> v;
7720     v.push_back( 1 );
7721     return v[ 3 ];
7723 ]])], [libcpp_debug_links=1])
7724     if test -n "$libcpp_debug_links"; then
7725         # we can use at least assertions, check if debug mode works
7726         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7727 #define _LIBCPP_DEBUG 1 // debug mode
7728 #include <string>
7729 #include <vector>
7730 int foo(const std::vector<int>& v) { return *v.begin(); }
7731 int main()
7733     std::vector<int> v;
7734     v.push_back( 1 );
7735     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7736     return (foo(v) + s.size()) != 0 ? 0 : 1;
7738 ]])],
7739         [AC_MSG_RESULT(yes)
7740          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7741         ],
7742         [AC_MSG_RESULT(no, using only assertions)
7743          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7744         ]
7745         )
7746     else
7747         AC_MSG_RESULT(no)
7748     fi
7749     AC_LANG_POP([C++])
7751 AC_SUBST([LIBCPP_DEBUG])
7753 dnl ===================================================================
7754 dnl Check for gperf
7755 dnl ===================================================================
7756 AC_PATH_PROG(GPERF, gperf)
7757 if test -z "$GPERF"; then
7758     AC_MSG_ERROR([gperf not found but needed. Install it.])
7760 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7761     GPERF=`cygpath -m $GPERF`
7763 AC_MSG_CHECKING([whether gperf is new enough])
7764 my_gperf_ver1=$($GPERF --version | head -n 1)
7765 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7766 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7767 if test "$my_gperf_ver3" -ge 301; then
7768     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7769 else
7770     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7772 AC_SUBST(GPERF)
7774 dnl ===================================================================
7775 dnl Check for system libcmis
7776 dnl ===================================================================
7777 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7779 dnl ===================================================================
7780 dnl C++11
7781 dnl ===================================================================
7783 if test -z "${CXXFLAGS_CXX11+x}"; then
7784     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7785     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7786         if test "$with_latest_c__" = yes; then
7787             CXXFLAGS_CXX11=-std:c++latest
7788         else
7789             CXXFLAGS_CXX11=-std:c++20
7790         fi
7791         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7792     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7793         my_flags='-std=c++20 -std=c++2a'
7794         if test "$with_latest_c__" = yes; then
7795             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7796         fi
7797         for flag in $my_flags; do
7798             if test "$COM" = MSC; then
7799                 flag="-Xclang $flag"
7800             fi
7801             save_CXXFLAGS=$CXXFLAGS
7802             CXXFLAGS="$CXXFLAGS $flag -Werror"
7803             AC_LANG_PUSH([C++])
7804             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7805                 #include <algorithm>
7806                 #include <functional>
7807                 #include <vector>
7809                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7810                     std::sort(v.begin(), v.end(), fn);
7811                 }
7812                 ]])],[CXXFLAGS_CXX11=$flag])
7813             AC_LANG_POP([C++])
7814             CXXFLAGS=$save_CXXFLAGS
7815             if test -n "$CXXFLAGS_CXX11"; then
7816                 break
7817             fi
7818         done
7819     fi
7820     if test -n "$CXXFLAGS_CXX11"; then
7821         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7822     else
7823         AC_MSG_ERROR(no)
7824     fi
7826 AC_SUBST(CXXFLAGS_CXX11)
7828 if test "$GCC" = "yes"; then
7829     save_CXXFLAGS=$CXXFLAGS
7830     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7831     CHECK_L_ATOMIC
7832     CXXFLAGS=$save_CXXFLAGS
7833     AC_SUBST(ATOMIC_LIB)
7836 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7837 save_CXXFLAGS=$CXXFLAGS
7838 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7839 AC_LANG_PUSH([C++])
7841 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7842 #include <stddef.h>
7844 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7846 namespace
7848         struct b
7849         {
7850                 int i;
7851                 int j;
7852         };
7854 ]], [[
7855 struct a
7857         int i;
7858         int j;
7860 a thinga[]={{0,0}, {1,1}};
7861 b thingb[]={{0,0}, {1,1}};
7862 size_t i = sizeof(sal_n_array_size(thinga));
7863 size_t j = sizeof(sal_n_array_size(thingb));
7864 return !(i != 0 && j != 0);
7866     ], [ AC_MSG_RESULT(yes) ],
7867     [ AC_MSG_ERROR(no)])
7868 AC_LANG_POP([C++])
7869 CXXFLAGS=$save_CXXFLAGS
7871 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7872 if test "$GCC" = yes; then
7873     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7874     AC_LANG_PUSH([C++])
7875     save_CXXFLAGS=$CXXFLAGS
7876     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7877     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7878     CXXFLAGS=$save_CXXFLAGS
7879     AC_LANG_POP([C++])
7880     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7881         AC_MSG_RESULT([yes])
7882     else
7883         AC_MSG_RESULT([no])
7884     fi
7886 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7888 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7889 AC_LANG_PUSH([C++])
7890 save_CXXFLAGS=$CXXFLAGS
7891 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7892 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7893         #include <algorithm>
7894         #include <initializer_list>
7895         #include <vector>
7896         template<typename T> class S {
7897         private:
7898             std::vector<T> v_;
7899         public:
7900             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7901         };
7902         constinit S<int> s{3, 2, 1};
7903     ])], [
7904         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7905         AC_MSG_RESULT([yes])
7906     ], [AC_MSG_RESULT([no])])
7907 CXXFLAGS=$save_CXXFLAGS
7908 AC_LANG_POP([C++])
7910 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7911 AC_LANG_PUSH([C++])
7912 save_CXXFLAGS=$CXXFLAGS
7913 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7914 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7915         struct S1 { S1(S1 &&); };
7916         struct S2: S1 {};
7917         S1 f(S2 s) { return s; }
7918     ])], [
7919         AC_DEFINE([HAVE_P1155R3],[1])
7920         AC_MSG_RESULT([yes])
7921     ], [AC_MSG_RESULT([no])])
7922 CXXFLAGS=$save_CXXFLAGS
7923 AC_LANG_POP([C++])
7925 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7926 HAVE_CXX20_ATOMIC_REF=
7927 AC_LANG_PUSH([C++])
7928 save_CXXFLAGS=$CXXFLAGS
7929 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7930 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7931         #include <atomic>
7932         int x;
7933         std::atomic_ref<int> y(x);
7934     ])], [
7935         HAVE_CXX20_ATOMIC_REF=TRUE
7936         AC_MSG_RESULT([yes])
7937     ], [AC_MSG_RESULT([no])])
7938 CXXFLAGS=$save_CXXFLAGS
7939 AC_LANG_POP([C++])
7940 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7942 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7943 dnl which is included in -Wextra anyway):
7944 HAVE_WDEPRECATED_COPY_DTOR=
7945 if test "$GCC" = yes; then
7946     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7947     AC_LANG_PUSH([C++])
7948     save_CXXFLAGS=$CXXFLAGS
7949     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7950     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7951             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7952             AC_MSG_RESULT([yes])
7953         ], [AC_MSG_RESULT([no])])
7954     CXXFLAGS=$save_CXXFLAGS
7955     AC_LANG_POP([C++])
7957 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7959 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7960 dnl uninitialized warning for code like
7962 dnl   OString f();
7963 dnl   boost::optional<OString> * g(bool b) {
7964 dnl       boost::optional<OString> o;
7965 dnl       if (b) o = f();
7966 dnl       return new boost::optional<OString>(o);
7967 dnl   }
7969 dnl (as is e.g. present, in a slightly more elaborate form, in
7970 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7971 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7972 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7973 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7974     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7975     AC_LANG_PUSH([C++])
7976     save_CXXFLAGS=$CXXFLAGS
7977     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7978     if test "$ENABLE_OPTIMIZED" = TRUE; then
7979         CXXFLAGS="$CXXFLAGS -O2"
7980     else
7981         CXXFLAGS="$CXXFLAGS -O0"
7982     fi
7983     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7984             #include <new>
7985             void f1(int);
7986             struct S1 {
7987                 ~S1() { f1(n); }
7988                 int n = 0;
7989             };
7990             struct S2 {
7991                 S2() {}
7992                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7993                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7994                 void set(S1 s) {
7995                     new (stg) S1(s);
7996                     init = true;
7997                 }
7998                 bool init = false;
7999                 char stg[sizeof (S1)];
8000             } ;
8001             S1 f2();
8002             S2 * f3(bool b) {
8003                 S2 o;
8004                 if (b) o.set(f2());
8005                 return new S2(o);
8006             }
8007         ]])], [AC_MSG_RESULT([no])], [
8008             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
8009             AC_MSG_RESULT([yes])
8010         ])
8011     CXXFLAGS=$save_CXXFLAGS
8012     AC_LANG_POP([C++])
8014 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
8016 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
8017 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
8018 dnl hits us e.g. with GCC 10 and --enable-optimized at
8020 dnl   In file included from include/rtl/string.hxx:49,
8021 dnl                    from include/rtl/ustring.hxx:43,
8022 dnl                    from include/osl/file.hxx:35,
8023 dnl                    from include/codemaker/global.hxx:28,
8024 dnl                    from include/codemaker/options.hxx:23,
8025 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
8026 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
8027 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,
8028 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,
8029 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,
8030 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
8031 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
8032 dnl      78 |         memcpy( buffer, data, length );
8033 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
8034 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
8035 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
8036     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
8037     AC_LANG_PUSH([C++])
8038     save_CXXFLAGS=$CXXFLAGS
8039     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
8040     if test "$ENABLE_OPTIMIZED" = TRUE; then
8041         CXXFLAGS="$CXXFLAGS -O2"
8042     else
8043         CXXFLAGS="$CXXFLAGS -O0"
8044     fi
8045     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
8046     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8047             void fill(char const * begin, char const * end, char c);
8048             struct q {
8049                 char ids[4];
8050                 char username[6];
8051             };
8052             void test(q & c) {
8053                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
8054                 __builtin_strncpy(c.username, "root", sizeof(c.username));
8055             }
8056         ]])], [AC_MSG_RESULT([no])], [
8057             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
8058             AC_MSG_RESULT([yes])
8059         ])
8060     CXXFLAGS=$save_CXXFLAGS
8061     AC_LANG_POP([C++])
8063 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
8065 HAVE_DLLEXPORTINLINES=
8066 if test "$_os" = "WINNT"; then
8067     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
8068     AC_LANG_PUSH([C++])
8069     save_CXXFLAGS=$CXXFLAGS
8070     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
8071     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
8072             HAVE_DLLEXPORTINLINES=TRUE
8073             AC_MSG_RESULT([yes])
8074         ], [AC_MSG_RESULT([no])])
8075     CXXFLAGS=$save_CXXFLAGS
8076     AC_LANG_POP([C++])
8078 AC_SUBST([HAVE_DLLEXPORTINLINES])
8080 dnl ===================================================================
8081 dnl CPU Intrinsics support - SSE, AVX
8082 dnl ===================================================================
8084 CXXFLAGS_INTRINSICS_SSE2=
8085 CXXFLAGS_INTRINSICS_SSSE3=
8086 CXXFLAGS_INTRINSICS_SSE41=
8087 CXXFLAGS_INTRINSICS_SSE42=
8088 CXXFLAGS_INTRINSICS_AVX=
8089 CXXFLAGS_INTRINSICS_AVX2=
8090 CXXFLAGS_INTRINSICS_AVX512=
8091 CXXFLAGS_INTRINSICS_AVX512F=
8092 CXXFLAGS_INTRINSICS_F16C=
8093 CXXFLAGS_INTRINSICS_FMA=
8095 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
8096     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
8097     flag_sse2=-msse2
8098     flag_ssse3=-mssse3
8099     flag_sse41=-msse4.1
8100     flag_sse42=-msse4.2
8101     flag_avx=-mavx
8102     flag_avx2=-mavx2
8103     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
8104     flag_avx512f=-mavx512f
8105     flag_f16c=-mf16c
8106     flag_fma=-mfma
8107 else
8108     # With MSVC using -arch is in fact not necessary for being able
8109     # to use CPU intrinsics, code using AVX512F intrinsics will compile
8110     # even if compiled with -arch:AVX, the -arch option really only affects
8111     # instructions generated for C/C++ code.
8112     # So use the matching same (or lower) -arch options, but only in order
8113     # to generate the best matching instructions for the C++ code surrounding
8114     # the intrinsics.
8115     # SSE2 is the default for x86/x64, so no need to specify the option.
8116     flag_sse2=
8117     # No specific options for these, use the next lower.
8118     flag_ssse3="$flag_sse2"
8119     flag_sse41="$flag_sse2"
8120     flag_sse42="$flag_sse2"
8121     flag_avx=-arch:AVX
8122     flag_avx2=-arch:AVX2
8123     flag_avx512=-arch:AVX512
8124     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
8125     flag_avx512f=-arch:AVX2
8126     # No MSVC options for these.
8127     flag_f16c="$flag_sse2"
8128     flag_fma="$flag_sse2"
8131 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
8132 AC_LANG_PUSH([C++])
8133 save_CXXFLAGS=$CXXFLAGS
8134 CXXFLAGS="$CXXFLAGS $flag_sse2"
8135 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8136     #include <emmintrin.h>
8137     int main () {
8138         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8139         c = _mm_xor_si128 (a, b);
8140         return 0;
8141     }
8142     ])],
8143     [can_compile_sse2=yes],
8144     [can_compile_sse2=no])
8145 AC_LANG_POP([C++])
8146 CXXFLAGS=$save_CXXFLAGS
8147 AC_MSG_RESULT([${can_compile_sse2}])
8148 if test "${can_compile_sse2}" = "yes" ; then
8149     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
8152 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
8153 AC_LANG_PUSH([C++])
8154 save_CXXFLAGS=$CXXFLAGS
8155 CXXFLAGS="$CXXFLAGS $flag_ssse3"
8156 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8157     #include <tmmintrin.h>
8158     int main () {
8159         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8160         c = _mm_maddubs_epi16 (a, b);
8161         return 0;
8162     }
8163     ])],
8164     [can_compile_ssse3=yes],
8165     [can_compile_ssse3=no])
8166 AC_LANG_POP([C++])
8167 CXXFLAGS=$save_CXXFLAGS
8168 AC_MSG_RESULT([${can_compile_ssse3}])
8169 if test "${can_compile_ssse3}" = "yes" ; then
8170     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8173 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8174 AC_LANG_PUSH([C++])
8175 save_CXXFLAGS=$CXXFLAGS
8176 CXXFLAGS="$CXXFLAGS $flag_sse41"
8177 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8178     #include <smmintrin.h>
8179     int main () {
8180         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8181         c = _mm_cmpeq_epi64 (a, b);
8182         return 0;
8183     }
8184     ])],
8185     [can_compile_sse41=yes],
8186     [can_compile_sse41=no])
8187 AC_LANG_POP([C++])
8188 CXXFLAGS=$save_CXXFLAGS
8189 AC_MSG_RESULT([${can_compile_sse41}])
8190 if test "${can_compile_sse41}" = "yes" ; then
8191     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8194 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8195 AC_LANG_PUSH([C++])
8196 save_CXXFLAGS=$CXXFLAGS
8197 CXXFLAGS="$CXXFLAGS $flag_sse42"
8198 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8199     #include <nmmintrin.h>
8200     int main () {
8201         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8202         c = _mm_cmpgt_epi64 (a, b);
8203         return 0;
8204     }
8205     ])],
8206     [can_compile_sse42=yes],
8207     [can_compile_sse42=no])
8208 AC_LANG_POP([C++])
8209 CXXFLAGS=$save_CXXFLAGS
8210 AC_MSG_RESULT([${can_compile_sse42}])
8211 if test "${can_compile_sse42}" = "yes" ; then
8212     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8215 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8216 AC_LANG_PUSH([C++])
8217 save_CXXFLAGS=$CXXFLAGS
8218 CXXFLAGS="$CXXFLAGS $flag_avx"
8219 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8220     #include <immintrin.h>
8221     int main () {
8222         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8223         c = _mm256_xor_ps(a, b);
8224         return 0;
8225     }
8226     ])],
8227     [can_compile_avx=yes],
8228     [can_compile_avx=no])
8229 AC_LANG_POP([C++])
8230 CXXFLAGS=$save_CXXFLAGS
8231 AC_MSG_RESULT([${can_compile_avx}])
8232 if test "${can_compile_avx}" = "yes" ; then
8233     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8236 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8237 AC_LANG_PUSH([C++])
8238 save_CXXFLAGS=$CXXFLAGS
8239 CXXFLAGS="$CXXFLAGS $flag_avx2"
8240 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8241     #include <immintrin.h>
8242     int main () {
8243         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8244         c = _mm256_maddubs_epi16(a, b);
8245         return 0;
8246     }
8247     ])],
8248     [can_compile_avx2=yes],
8249     [can_compile_avx2=no])
8250 AC_LANG_POP([C++])
8251 CXXFLAGS=$save_CXXFLAGS
8252 AC_MSG_RESULT([${can_compile_avx2}])
8253 if test "${can_compile_avx2}" = "yes" ; then
8254     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8257 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8258 AC_LANG_PUSH([C++])
8259 save_CXXFLAGS=$CXXFLAGS
8260 CXXFLAGS="$CXXFLAGS $flag_avx512"
8261 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8262     #include <immintrin.h>
8263     int main () {
8264         __m512i a = _mm512_loadu_si512(0);
8265         __m512d v1 = _mm512_load_pd(0);
8266         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8267         __m512d v2 = _mm512_abs_pd(v1);
8268         return 0;
8269     }
8270     ])],
8271     [can_compile_avx512=yes],
8272     [can_compile_avx512=no])
8273 AC_LANG_POP([C++])
8274 CXXFLAGS=$save_CXXFLAGS
8275 AC_MSG_RESULT([${can_compile_avx512}])
8276 if test "${can_compile_avx512}" = "yes" ; then
8277     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8278     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8281 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8282 AC_LANG_PUSH([C++])
8283 save_CXXFLAGS=$CXXFLAGS
8284 CXXFLAGS="$CXXFLAGS $flag_f16c"
8285 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8286     #include <immintrin.h>
8287     int main () {
8288         __m128i a = _mm_set1_epi32 (0);
8289         __m128 c;
8290         c = _mm_cvtph_ps(a);
8291         return 0;
8292     }
8293     ])],
8294     [can_compile_f16c=yes],
8295     [can_compile_f16c=no])
8296 AC_LANG_POP([C++])
8297 CXXFLAGS=$save_CXXFLAGS
8298 AC_MSG_RESULT([${can_compile_f16c}])
8299 if test "${can_compile_f16c}" = "yes" ; then
8300     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8303 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8304 AC_LANG_PUSH([C++])
8305 save_CXXFLAGS=$CXXFLAGS
8306 CXXFLAGS="$CXXFLAGS $flag_fma"
8307 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8308     #include <immintrin.h>
8309     int main () {
8310         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8311         d = _mm256_fmadd_ps(a, b, c);
8312         return 0;
8313     }
8314     ])],
8315     [can_compile_fma=yes],
8316     [can_compile_fma=no])
8317 AC_LANG_POP([C++])
8318 CXXFLAGS=$save_CXXFLAGS
8319 AC_MSG_RESULT([${can_compile_fma}])
8320 if test "${can_compile_fma}" = "yes" ; then
8321     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8324 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8325 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8326 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8327 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8328 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8329 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8330 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8331 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8332 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8333 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8335 dnl ===================================================================
8336 dnl system stl sanity tests
8337 dnl ===================================================================
8338 if test "$_os" != "WINNT"; then
8340     AC_LANG_PUSH([C++])
8342     save_CPPFLAGS="$CPPFLAGS"
8343     if test -n "$MACOSX_SDK_PATH"; then
8344         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8345     fi
8347     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8348     # only.
8349     if test "$CPP_LIBRARY" = GLIBCXX; then
8350         dnl gcc#19664, gcc#22482, rhbz#162935
8351         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8352         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8353         AC_MSG_RESULT([$stlvisok])
8354         if test "$stlvisok" = "no"; then
8355             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8356         fi
8357     fi
8359     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8360     # when we don't make any dynamic libraries?
8361     if test "$DISABLE_DYNLOADING" = ""; then
8362         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8363         cat > conftestlib1.cc <<_ACEOF
8364 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8365 struct S2: S1<int> { virtual ~S2(); };
8366 S2::~S2() {}
8367 _ACEOF
8368         cat > conftestlib2.cc <<_ACEOF
8369 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8370 struct S2: S1<int> { virtual ~S2(); };
8371 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8372 _ACEOF
8373         gccvisinlineshiddenok=yes
8374         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8375             gccvisinlineshiddenok=no
8376         else
8377             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8378             dnl known to not work with -z defs (unsetting which makes the test
8379             dnl moot, though):
8380             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8381             if test "$COM_IS_CLANG" = TRUE; then
8382                 for i in $CXX $CXXFLAGS; do
8383                     case $i in
8384                     -fsanitize=*)
8385                         my_linkflagsnoundefs=
8386                         break
8387                         ;;
8388                     esac
8389                 done
8390             fi
8391             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8392                 gccvisinlineshiddenok=no
8393             fi
8394         fi
8396         rm -fr libconftest*
8397         AC_MSG_RESULT([$gccvisinlineshiddenok])
8398         if test "$gccvisinlineshiddenok" = "no"; then
8399             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8400         fi
8401     fi
8403    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8404     cat >visibility.cxx <<_ACEOF
8405 #pragma GCC visibility push(hidden)
8406 struct __attribute__ ((visibility ("default"))) TestStruct {
8407   static void Init();
8409 __attribute__ ((visibility ("default"))) void TestFunc() {
8410   TestStruct::Init();
8412 _ACEOF
8413     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8414         gccvisbroken=yes
8415     else
8416         case "$host_cpu" in
8417         i?86|x86_64)
8418             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8419                 gccvisbroken=no
8420             else
8421                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8422                     gccvisbroken=no
8423                 else
8424                     gccvisbroken=yes
8425                 fi
8426             fi
8427             ;;
8428         *)
8429             gccvisbroken=no
8430             ;;
8431         esac
8432     fi
8433     rm -f visibility.s visibility.cxx
8435     AC_MSG_RESULT([$gccvisbroken])
8436     if test "$gccvisbroken" = "yes"; then
8437         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8438     fi
8440     CPPFLAGS="$save_CPPFLAGS"
8442     AC_MSG_CHECKING([if CET endbranch is recognized])
8443 cat > endbr.s <<_ACEOF
8444 endbr32
8445 _ACEOF
8446     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8447     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8448         AC_MSG_RESULT([yes])
8449         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8450     else
8451         AC_MSG_RESULT([no])
8452     fi
8453     rm -f endbr.s endbr.o
8454     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8456     AC_LANG_POP([C++])
8459 dnl ===================================================================
8460 dnl  Clang++ tests
8461 dnl ===================================================================
8463 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8464 if test "$GCC" = "yes"; then
8465     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8466     AC_LANG_PUSH([C++])
8467     save_CXXFLAGS=$CXXFLAGS
8468     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8469     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8470     CXXFLAGS=$save_CXXFLAGS
8471     AC_LANG_POP([C++])
8472     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8473         AC_MSG_RESULT([yes])
8474     else
8475         AC_MSG_RESULT([no])
8476     fi
8478 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8480 dnl ===================================================================
8481 dnl Compiler plugins
8482 dnl ===================================================================
8484 COMPILER_PLUGINS=
8485 # currently only Clang
8487 if test "$COM_IS_CLANG" != "TRUE"; then
8488     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8489         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8490         enable_compiler_plugins=no
8491     fi
8494 COMPILER_PLUGINS_COM_IS_CLANG=
8495 if test "$COM_IS_CLANG" = "TRUE"; then
8496     if test -n "$enable_compiler_plugins"; then
8497         compiler_plugins="$enable_compiler_plugins"
8498     elif test -n "$ENABLE_DBGUTIL"; then
8499         compiler_plugins=test
8500     else
8501         compiler_plugins=no
8502     fi
8503     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8504         if test "$CLANGVER" -lt 120001; then
8505             if test "$compiler_plugins" = yes; then
8506                 AC_MSG_ERROR(
8507                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8508             else
8509                 compiler_plugins=no
8510             fi
8511         fi
8512     fi
8513     if test "$compiler_plugins" != "no"; then
8514         dnl The prefix where Clang resides, override to where Clang resides if
8515         dnl using a source build:
8516         if test -z "$CLANGDIR"; then
8517             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8518         fi
8519         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8520         if test -z "$COMPILER_PLUGINS_CXX"; then
8521             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8522         fi
8523         clangbindir=$CLANGDIR/bin
8524         if test "$build_os" = "cygwin"; then
8525             clangbindir=$(cygpath -u "$clangbindir")
8526         fi
8527         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8528         if test -n "$LLVM_CONFIG"; then
8529             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8530             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8531             if test -z "$CLANGLIBDIR"; then
8532                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8533             fi
8534             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8535             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8536             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8537                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8538                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8539                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8540                 fi
8541             fi
8542             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8543             clangobjdir=$($LLVM_CONFIG --obj-root)
8544             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8545                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8546             fi
8547         fi
8548         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8549         AC_LANG_PUSH([C++])
8550         save_CXX=$CXX
8551         save_CXXCPP=$CXXCPP
8552         save_CPPFLAGS=$CPPFLAGS
8553         save_CXXFLAGS=$CXXFLAGS
8554         save_LDFLAGS=$LDFLAGS
8555         save_LIBS=$LIBS
8556         CXX=$COMPILER_PLUGINS_CXX
8557         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8558         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8559         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8560         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8561             [COMPILER_PLUGINS=TRUE],
8562             [
8563             if test "$compiler_plugins" = "yes"; then
8564                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8565             else
8566                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8567                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8568             fi
8569             ])
8570         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8571         dnl comment in compilerplugins/Makefile-clang.mk:
8572         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8573             LDFLAGS=""
8574             AC_MSG_CHECKING([for clang libraries to use])
8575             if test -z "$CLANGTOOLLIBS"; then
8576                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8577                 AC_LINK_IFELSE([
8578                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8579                         [[ clang::FullSourceLoc().dump(); ]])
8580                 ],[CLANGTOOLLIBS="$LIBS"],[])
8581             fi
8582             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8583             dnl list of individual -lclang* (but note that that list can become outdated over time,
8584             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8585             dnl needs to include -lclangSupport now"):
8586             if test -z "$CLANGTOOLLIBS"; then
8587                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8588  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8589                 AC_LINK_IFELSE([
8590                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8591                         [[ clang::FullSourceLoc().dump(); ]])
8592                 ],[CLANGTOOLLIBS="$LIBS"],[])
8593             fi
8594             AC_MSG_RESULT([$CLANGTOOLLIBS])
8595             if test -z "$CLANGTOOLLIBS"; then
8596                 if test "$compiler_plugins" = "yes"; then
8597                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8598                 else
8599                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8600                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8601                 fi
8602                 COMPILER_PLUGINS=
8603             fi
8604             if test -n "$COMPILER_PLUGINS"; then
8605                 if test -z "$CLANGSYSINCLUDE"; then
8606                     if test -n "$LLVM_CONFIG"; then
8607                         # Path to the clang system headers (no idea if there's a better way to get it).
8608                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8609                     fi
8610                 fi
8611             fi
8612         fi
8613         CXX=$save_CXX
8614         CXXCPP=$save_CXXCPP
8615         CPPFLAGS=$save_CPPFLAGS
8616         CXXFLAGS=$save_CXXFLAGS
8617         LDFLAGS=$save_LDFLAGS
8618         LIBS="$save_LIBS"
8619         AC_LANG_POP([C++])
8621         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8622         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8623             #ifndef __clang__
8624             you lose
8625             #endif
8626             int foo=42;
8627             ]])],
8628             [AC_MSG_RESULT([yes])
8629              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8630             [AC_MSG_RESULT([no])])
8631         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8632     fi
8633 else
8634     if test "$enable_compiler_plugins" = "yes"; then
8635         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8636     fi
8638 COMPILER_PLUGINS_ANALYZER_PCH=
8639 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8640     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8642 AC_SUBST(COMPILER_PLUGINS)
8643 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8644 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8645 AC_SUBST(COMPILER_PLUGINS_CXX)
8646 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8647 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8648 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8649 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8650 AC_SUBST(CLANGDIR)
8651 AC_SUBST(CLANGLIBDIR)
8652 AC_SUBST(CLANGTOOLLIBS)
8653 AC_SUBST(CLANGSYSINCLUDE)
8655 # Plugin to help linker.
8656 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8657 # This makes --enable-lto build with clang work.
8658 AC_SUBST(LD_PLUGIN)
8660 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8661 AC_SUBST(HAVE_POSIX_FALLOCATE)
8663 JITC_PROCESSOR_TYPE=""
8664 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8665     # IBMs JDK needs this...
8666     JITC_PROCESSOR_TYPE=6
8667     export JITC_PROCESSOR_TYPE
8669 AC_SUBST([JITC_PROCESSOR_TYPE])
8671 # Misc Windows Stuff
8672 AC_ARG_WITH(ucrt-dir,
8673     AS_HELP_STRING([--with-ucrt-dir],
8674         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8675         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8676         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8677             Windows6.1-KB2999226-x64.msu
8678             Windows6.1-KB2999226-x86.msu
8679             Windows8.1-KB2999226-x64.msu
8680             Windows8.1-KB2999226-x86.msu
8681             Windows8-RT-KB2999226-x64.msu
8682             Windows8-RT-KB2999226-x86.msu
8683         A zip archive including those files is available from Microsoft site:
8684         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8687 UCRT_REDISTDIR="$with_ucrt_dir"
8688 if test $_os = "WINNT"; then
8689     find_msvc_x64_dlls
8690     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8691     MSVC_DLLS="$msvcdlls"
8692     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8693         with_redist=143
8694     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8695         with_redist=142
8696     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8697         with_redist=141
8698     fi
8699     for i in $PKGFORMAT; do
8700         if test "$i" = msi; then
8701             find_msms "$with_redist"
8702             if test -n "$msmdir"; then
8703                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8704                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8705             fi
8706             break
8707         fi
8708     done
8710     if test "$UCRT_REDISTDIR" = "no"; then
8711         dnl explicitly disabled
8712         UCRT_REDISTDIR=""
8713     else
8714         PathFormat "$UCRT_REDISTDIR"
8715         UCRT_REDISTDIR="$formatted_path"
8716         UCRT_REDISTDIR_unix="$formatted_path_unix"
8717         if ! test -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x64.msu" -a \
8718                   -f "$UCRT_REDISTDIR_unix/Windows6.1-KB2999226-x86.msu" -a \
8719                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x64.msu" -a \
8720                   -f "$UCRT_REDISTDIR_unix/Windows8.1-KB2999226-x86.msu" -a \
8721                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x64.msu" -a \
8722                   -f "$UCRT_REDISTDIR_unix/Windows8-RT-KB2999226-x86.msu"; then
8723             UCRT_REDISTDIR=""
8724             if test -n "$PKGFORMAT"; then
8725                for i in $PKGFORMAT; do
8726                    case "$i" in
8727                    msi)
8728                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8729                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8730                        ;;
8731                    esac
8732                done
8733             fi
8734         fi
8735     fi
8738 AC_SUBST(UCRT_REDISTDIR)
8739 AC_SUBST(MSVC_DLL_PATH)
8740 AC_SUBST(MSVC_DLLS)
8741 AC_SUBST(MSM_PATH)
8744 dnl ===================================================================
8745 dnl Checks for Java
8746 dnl ===================================================================
8747 if test "$ENABLE_JAVA" != ""; then
8749     # Windows-specific tests
8750     if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
8751         if test -z "$with_jdk_home"; then
8752             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8753             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8754             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK" "CurrentVersion"
8755             if test -n "$regvalue"; then
8756                 ver=$regvalue
8757                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver" "JavaHome"
8758                 with_jdk_home=$regvalue
8759             fi
8760             howfound="found automatically"
8761         else
8762             howfound="you passed"
8763         fi
8764         PathFormat "$with_jdk_home"
8765         with_jdk_home="$formatted_path_unix"
8767         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8768             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])
8769         fi
8770         with_java="java.exe"
8771         javacompiler="javac.exe"
8772         javadoc="javadoc.exe"
8773     fi
8775     # 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.
8776     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8777     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8778         with_jdk_home=`/usr/libexec/java_home`
8779     fi
8781     JAVA_HOME=; export JAVA_HOME
8782     if test -z "$with_jdk_home"; then
8783         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8784     else
8785         _java_path="$with_jdk_home/bin/$with_java"
8786         dnl Check if there is a Java interpreter at all.
8787         if test -x "$_java_path"; then
8788             JAVAINTERPRETER=$_java_path
8789         else
8790             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8791         fi
8792     fi
8794     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8795     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8796     dnl loaded by java to run JunitTests:
8797     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8798         shortjdkhome=`cygpath -d "$with_jdk_home"`
8799         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
8800             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8801             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8802         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
8803             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8804             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8805         fi
8807         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8808             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8809         fi
8810         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8811     elif test "$cross_compiling" != "yes"; then
8812         case $CPUNAME in
8813             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8814                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8815                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8816                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8817                 fi
8818                 ;;
8819             *) # assumption: everything else 32-bit
8820                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8821                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8822                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8823                 fi
8824                 ;;
8825         esac
8826     fi
8829 dnl ===================================================================
8830 dnl Checks for JDK.
8831 dnl ===================================================================
8833 # Whether all the complexity here actually is needed any more or not, no idea.
8835 JDK_SECURITYMANAGER_DISALLOWED=
8836 MODULAR_JAVA=
8837 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8838     _gij_longver=0
8839     AC_MSG_CHECKING([the installed JDK])
8840     if test -n "$JAVAINTERPRETER"; then
8841         dnl java -version sends output to stderr!
8842         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8843             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8844         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8845             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8846         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8847             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8848         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8849             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8850         else
8851             JDK=sun
8853             dnl Sun JDK specific tests
8854             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8855             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8857             if test "$_jdk_ver" -lt 10800; then
8858                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 10800)])
8859             fi
8860             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8861             dnl completely removed in some Java version > 18 (see
8862             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8863             if test "$_jdk_ver" -ge 180000; then
8864                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8865             fi
8867             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8868             if test "$_os" = "WINNT"; then
8869                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8870             fi
8871             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8873             dnl Check whether the build Java supports modules
8874             if test "$_jdk_ver" -ge 90000; then
8875                 MODULAR_JAVA=TRUE
8876             else
8877                 AC_MSG_WARN([Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)])
8878                 add_warning "Modular jars will not be built. They need at least Java 9 ($_jdk_ver < 90000)"
8879             fi
8881             # set to limit VM usage for JunitTests
8882             JAVAIFLAGS=-Xmx64M
8883             # set to limit VM usage for javac
8884             JAVACFLAGS=-J-Xmx128M
8885         fi
8886     else
8887         AC_MSG_ERROR([Java not found. You need at least JDK 8])
8888     fi
8889 else
8890     if test -z "$ENABLE_JAVA"; then
8891         dnl Java disabled
8892         JAVA_HOME=
8893         export JAVA_HOME
8894     elif test "$cross_compiling" = "yes"; then
8895         # Just assume compatibility of build and host JDK
8896         JDK=$JDK_FOR_BUILD
8897         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8898     fi
8901 dnl ===================================================================
8902 dnl Checks for javac
8903 dnl ===================================================================
8904 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8905     : ${JAVA_SOURCE_VER=8}
8906     : ${JAVA_TARGET_VER=8}
8907     if test -z "$with_jdk_home"; then
8908         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8909     else
8910         _javac_path="$with_jdk_home/bin/$javacompiler"
8911         dnl Check if there is a Java compiler at all.
8912         if test -x "$_javac_path"; then
8913             JAVACOMPILER=$_javac_path
8914         fi
8915     fi
8916     if test -z "$JAVACOMPILER"; then
8917         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8918     fi
8919     if test "$build_os" = "cygwin"; then
8920         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8921             JAVACOMPILER="${JAVACOMPILER}.exe"
8922         fi
8923         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8924     fi
8927 dnl ===================================================================
8928 dnl Checks for javadoc
8929 dnl ===================================================================
8930 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8931     if test -z "$with_jdk_home"; then
8932         AC_PATH_PROG(JAVADOC, $javadoc)
8933     else
8934         _javadoc_path="$with_jdk_home/bin/$javadoc"
8935         dnl Check if there is a javadoc at all.
8936         if test -x "$_javadoc_path"; then
8937             JAVADOC=$_javadoc_path
8938         else
8939             AC_PATH_PROG(JAVADOC, $javadoc)
8940         fi
8941     fi
8942     if test -z "$JAVADOC"; then
8943         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8944     fi
8945     if test "$build_os" = "cygwin"; then
8946         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8947             JAVADOC="${JAVADOC}.exe"
8948         fi
8949         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8950     fi
8952     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8953     JAVADOCISGJDOC="yes"
8954     fi
8956 AC_SUBST(JAVADOC)
8957 AC_SUBST(JAVADOCISGJDOC)
8959 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8960     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8961     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8962         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8963            # try to recover first by looking whether we have an alternative
8964            # system as in Debian or newer SuSEs where following /usr/bin/javac
8965            # over /etc/alternatives/javac leads to the right bindir where we
8966            # just need to strip a bit away to get a valid JAVA_HOME
8967            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8968         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8969             # maybe only one level of symlink (e.g. on Mac)
8970             JAVA_HOME=$(readlink $JAVACOMPILER)
8971             if test "$(dirname $JAVA_HOME)" = "."; then
8972                 # we've got no path to trim back
8973                 JAVA_HOME=""
8974             fi
8975         else
8976             # else warn
8977             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8978             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8979             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8980             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8981         fi
8982         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8983         if test "$JAVA_HOME" != "/usr"; then
8984             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8985                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8986                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8987                 dnl Tiger already returns a JDK path...
8988                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8989             else
8990                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8991                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8992                 dnl that checks which version to run
8993                 if test -f "$JAVA_HOME"; then
8994                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8995                 fi
8996             fi
8997         fi
8998     fi
8999     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
9001     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
9002     if test -z "$JAVA_HOME"; then
9003         if test "x$with_jdk_home" = "x"; then
9004             cat > findhome.java <<_ACEOF
9005 [import java.io.File;
9007 class findhome
9009     public static void main(String args[])
9010     {
9011         String jrelocation = System.getProperty("java.home");
9012         File jre = new File(jrelocation);
9013         System.out.println(jre.getParent());
9014     }
9016 _ACEOF
9017             AC_MSG_CHECKING([if javac works])
9018             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
9019             AC_TRY_EVAL(javac_cmd)
9020             if test $? = 0 -a -f ./findhome.class; then
9021                 AC_MSG_RESULT([javac works])
9022             else
9023                 echo "configure: javac test failed" >&5
9024                 cat findhome.java >&5
9025                 AC_MSG_ERROR([javac does not work - java projects will not build!])
9026             fi
9027             AC_MSG_CHECKING([if gij knows its java.home])
9028             JAVA_HOME=`$JAVAINTERPRETER findhome`
9029             if test $? = 0 -a "$JAVA_HOME" != ""; then
9030                 AC_MSG_RESULT([$JAVA_HOME])
9031             else
9032                 echo "configure: java test failed" >&5
9033                 cat findhome.java >&5
9034                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
9035             fi
9036             # clean-up after ourselves
9037             rm -f ./findhome.java ./findhome.class
9038         else
9039             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
9040         fi
9041     fi
9043     # now check if $JAVA_HOME is really valid
9044     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
9045         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
9046             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
9047             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
9048             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
9049             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
9050             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
9051             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
9052         fi
9053     fi
9054     PathFormat "$JAVA_HOME"
9055     JAVA_HOME="$formatted_path_unix"
9058 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
9059     "$_os" != Darwin
9060 then
9061     AC_MSG_CHECKING([for JAWT lib])
9062     if test "$_os" = WINNT; then
9063         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
9064         JAWTLIB=jawt.lib
9065     else
9066         case "$host_cpu" in
9067         arm*)
9068             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
9069             JAVA_ARCH=$my_java_arch
9070             ;;
9071         i*86)
9072             my_java_arch=i386
9073             ;;
9074         m68k)
9075             my_java_arch=m68k
9076             ;;
9077         powerpc)
9078             my_java_arch=ppc
9079             ;;
9080         powerpc64)
9081             my_java_arch=ppc64
9082             ;;
9083         powerpc64le)
9084             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
9085             JAVA_ARCH=$my_java_arch
9086             ;;
9087         sparc64)
9088             my_java_arch=sparcv9
9089             ;;
9090         x86_64)
9091             my_java_arch=amd64
9092             ;;
9093         *)
9094             my_java_arch=$host_cpu
9095             ;;
9096         esac
9097         # This is where JDK9 puts the library
9098         if test -e "$JAVA_HOME/lib/libjawt.so"; then
9099             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
9100         else
9101             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
9102         fi
9103         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
9104     fi
9105     AC_MSG_RESULT([$JAWTLIB])
9107 AC_SUBST(JAWTLIB)
9109 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
9110     case "$host_os" in
9112     cygwin*|wsl*)
9113         JAVAINC="-I$JAVA_HOME/include/win32"
9114         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
9115         ;;
9117     darwin*)
9118         if test -d "$JAVA_HOME/include/darwin"; then
9119             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
9120         else
9121             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
9122         fi
9123         ;;
9125     dragonfly*)
9126         JAVAINC="-I$JAVA_HOME/include"
9127         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9128         ;;
9130     freebsd*)
9131         JAVAINC="-I$JAVA_HOME/include"
9132         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
9133         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
9134         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9135         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9136         ;;
9138     k*bsd*-gnu*)
9139         JAVAINC="-I$JAVA_HOME/include"
9140         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9141         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9142         ;;
9144     linux-gnu*)
9145         JAVAINC="-I$JAVA_HOME/include"
9146         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
9147         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9148         ;;
9150     *netbsd*)
9151         JAVAINC="-I$JAVA_HOME/include"
9152         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
9153         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9154        ;;
9156     openbsd*)
9157         JAVAINC="-I$JAVA_HOME/include"
9158         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
9159         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9160         ;;
9162     solaris*)
9163         JAVAINC="-I$JAVA_HOME/include"
9164         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
9165         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
9166         ;;
9167     esac
9169 SOLARINC="$SOLARINC $JAVAINC"
9171 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
9172     JAVA_HOME_FOR_BUILD=$JAVA_HOME
9173     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9174     JDK_FOR_BUILD=$JDK
9175     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9178 AC_SUBST(JAVACFLAGS)
9179 AC_SUBST(JAVACOMPILER)
9180 AC_SUBST(JAVAINTERPRETER)
9181 AC_SUBST(JAVAIFLAGS)
9182 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9183 AC_SUBST(JAVA_HOME)
9184 AC_SUBST(JAVA_HOME_FOR_BUILD)
9185 AC_SUBST(JDK)
9186 AC_SUBST(JDK_FOR_BUILD)
9187 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9188 AC_SUBST(JAVA_SOURCE_VER)
9189 AC_SUBST(JAVA_TARGET_VER)
9190 AC_SUBST(MODULAR_JAVA)
9193 dnl ===================================================================
9194 dnl Export file validation
9195 dnl ===================================================================
9196 AC_MSG_CHECKING([whether to enable export file validation])
9197 if test "$with_export_validation" != "no"; then
9198     if test -z "$ENABLE_JAVA"; then
9199         if test "$with_export_validation" = "yes"; then
9200             AC_MSG_ERROR([requested, but Java is disabled])
9201         else
9202             AC_MSG_RESULT([no, as Java is disabled])
9203         fi
9204     elif ! test -d "${SRC_ROOT}/schema"; then
9205         if test "$with_export_validation" = "yes"; then
9206             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9207         else
9208             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9209         fi
9210     else
9211         AC_MSG_RESULT([yes])
9212         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9214         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9215         if test -z "$ODFVALIDATOR"; then
9216             # remember to download the ODF toolkit with validator later
9217             AC_MSG_NOTICE([no odfvalidator found, will download it])
9218             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9219             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9221             # and fetch name of odfvalidator jar name from download.lst
9222             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9223             AC_SUBST(ODFVALIDATOR_JAR)
9225             if test -z "$ODFVALIDATOR_JAR"; then
9226                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9227             fi
9228         fi
9229         if test "$build_os" = "cygwin"; then
9230             # In case of Cygwin it will be executed from Windows,
9231             # so we need to run bash and absolute path to validator
9232             # so instead of "odfvalidator" it will be
9233             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9234             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9235         else
9236             ODFVALIDATOR="sh $ODFVALIDATOR"
9237         fi
9238         AC_SUBST(ODFVALIDATOR)
9241         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9242         if test -z "$OFFICEOTRON"; then
9243             # remember to download the officeotron with validator later
9244             AC_MSG_NOTICE([no officeotron found, will download it])
9245             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9246             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9248             # and fetch name of officeotron jar name from download.lst
9249             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9250             AC_SUBST(OFFICEOTRON_JAR)
9252             if test -z "$OFFICEOTRON_JAR"; then
9253                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9254             fi
9255         else
9256             # check version of existing officeotron
9257             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9258             if test 0"$OFFICEOTRON_VER" -lt 704; then
9259                 AC_MSG_ERROR([officeotron too old])
9260             fi
9261         fi
9262         if test "$build_os" = "cygwin"; then
9263             # In case of Cygwin it will be executed from Windows,
9264             # so we need to run bash and absolute path to validator
9265             # so instead of "odfvalidator" it will be
9266             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9267             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9268         else
9269             OFFICEOTRON="sh $OFFICEOTRON"
9270         fi
9271     fi
9272     AC_SUBST(OFFICEOTRON)
9273 else
9274     AC_MSG_RESULT([no])
9277 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9278 if test "$with_bffvalidator" != "no"; then
9279     AC_DEFINE(HAVE_BFFVALIDATOR)
9281     if test "$with_export_validation" = "no"; then
9282         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9283     fi
9285     if test "$with_bffvalidator" = "yes"; then
9286         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9287     else
9288         BFFVALIDATOR="$with_bffvalidator"
9289     fi
9291     if test "$build_os" = "cygwin"; then
9292         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9293             AC_MSG_RESULT($BFFVALIDATOR)
9294         else
9295             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9296         fi
9297     elif test -n "$BFFVALIDATOR"; then
9298         # We are not in Cygwin but need to run Windows binary with wine
9299         AC_PATH_PROGS(WINE, wine)
9301         # so swap in a shell wrapper that converts paths transparently
9302         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9303         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9304         AC_SUBST(BFFVALIDATOR_EXE)
9305         AC_MSG_RESULT($BFFVALIDATOR)
9306     else
9307         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9308     fi
9309     AC_SUBST(BFFVALIDATOR)
9310 else
9311     AC_MSG_RESULT([no])
9314 dnl ===================================================================
9315 dnl Check for epm (not needed for Windows)
9316 dnl ===================================================================
9317 AC_MSG_CHECKING([whether to enable EPM for packing])
9318 if test "$enable_epm" = "yes"; then
9319     AC_MSG_RESULT([yes])
9320     if test "$_os" != "WINNT"; then
9321         if test $_os = Darwin; then
9322             EPM=internal
9323         elif test -n "$with_epm"; then
9324             EPM=$with_epm
9325         else
9326             AC_PATH_PROG(EPM, epm, no)
9327         fi
9328         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9329             AC_MSG_NOTICE([EPM will be built.])
9330             BUILD_TYPE="$BUILD_TYPE EPM"
9331             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9332         else
9333             # Gentoo has some epm which is something different...
9334             AC_MSG_CHECKING([whether the found epm is the right epm])
9335             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9336                 AC_MSG_RESULT([yes])
9337             else
9338                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9339             fi
9340             AC_MSG_CHECKING([epm version])
9341             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9342             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9343                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9344                 AC_MSG_RESULT([OK, >= 3.7])
9345             else
9346                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9347                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9348             fi
9349         fi
9350     fi
9352     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9353         AC_MSG_CHECKING([for rpm])
9354         for a in "$RPM" rpmbuild rpm; do
9355             $a --usage >/dev/null 2> /dev/null
9356             if test $? -eq 0; then
9357                 RPM=$a
9358                 break
9359             else
9360                 $a --version >/dev/null 2> /dev/null
9361                 if test $? -eq 0; then
9362                     RPM=$a
9363                     break
9364                 fi
9365             fi
9366         done
9367         if test -z "$RPM"; then
9368             AC_MSG_ERROR([not found])
9369         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9370             RPM_PATH=`command -v $RPM`
9371             AC_MSG_RESULT([$RPM_PATH])
9372             SCPDEFS="$SCPDEFS -DWITH_RPM"
9373         else
9374             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9375         fi
9376     fi
9377     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9378         AC_PATH_PROG(DPKG, dpkg, no)
9379         if test "$DPKG" = "no"; then
9380             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9381         fi
9382     fi
9383     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9384        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9385         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9386             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9387                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9388                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9389                     AC_MSG_RESULT([yes])
9390                 else
9391                     AC_MSG_RESULT([no])
9392                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9393                         _pt="rpm"
9394                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9395                         add_warning "the rpms will need to be installed with --nodeps"
9396                     else
9397                         _pt="pkg"
9398                     fi
9399                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9400                     add_warning "the ${_pt}s will not be relocatable"
9401                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9402                                  relocation will work, you need to patch your epm with the
9403                                  patch in epm/epm-3.7.patch or build with
9404                                  --with-epm=internal which will build a suitable epm])
9405                 fi
9406             fi
9407         fi
9408     fi
9409     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9410         AC_PATH_PROG(PKGMK, pkgmk, no)
9411         if test "$PKGMK" = "no"; then
9412             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9413         fi
9414     fi
9415     AC_SUBST(RPM)
9416     AC_SUBST(DPKG)
9417     AC_SUBST(PKGMK)
9418 else
9419     for i in $PKGFORMAT; do
9420         case "$i" in
9421         bsd | deb | pkg | rpm | native | portable)
9422             AC_MSG_ERROR(
9423                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9424             ;;
9425         esac
9426     done
9427     AC_MSG_RESULT([no])
9428     EPM=NO
9430 AC_SUBST(EPM)
9432 ENABLE_LWP=
9433 if test "$enable_lotuswordpro" = "yes"; then
9434     ENABLE_LWP="TRUE"
9436 AC_SUBST(ENABLE_LWP)
9438 dnl ===================================================================
9439 dnl Check for building ODK
9440 dnl ===================================================================
9441 AC_MSG_CHECKING([whether to build the ODK])
9442 if test "$enable_odk" = yes; then
9443     if test "$DISABLE_DYNLOADING" = TRUE; then
9444         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9445     fi
9446     AC_MSG_RESULT([yes])
9447     BUILD_TYPE="$BUILD_TYPE ODK"
9448 else
9449     AC_MSG_RESULT([no])
9452 if test "$enable_odk" != yes; then
9453     unset DOXYGEN
9454 else
9455     if test "$with_doxygen" = no; then
9456         AC_MSG_CHECKING([for doxygen])
9457         unset DOXYGEN
9458         AC_MSG_RESULT([no])
9459     else
9460         if test "$with_doxygen" = yes; then
9461             AC_PATH_PROG([DOXYGEN], [doxygen])
9462             if test -z "$DOXYGEN"; then
9463                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9464             fi
9465             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9466                 if ! dot -V 2>/dev/null; then
9467                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9468                 fi
9469             fi
9470         else
9471             AC_MSG_CHECKING([for doxygen])
9472             PathFormat "$with_doxygen"
9473             DOXYGEN="$formatted_path_unix"
9474             AC_MSG_RESULT([$formatted_path])
9475         fi
9476         if test -n "$DOXYGEN"; then
9477             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9478             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9479             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9480                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9481             fi
9482         fi
9483         if test -n "$WSL_ONLY_AS_HELPER"; then
9484             dnl what really should be tested is whether it is doxygen from windows-realm
9485             dnl i.e. one that runs on the windows-side and deals with windows-pathnames
9486             dnl using doxygen from wsl container would be possible, but there's a performance
9487             dnl penalty when accessing the files outside the container
9488             AC_MSG_CHECKING([whether doxygen is a windows executable])
9489             if $(file "$DOXYGEN" | grep -q "PE32"); then
9490                 AC_MSG_RESULT([yes])
9491             else
9492                 AC_MSG_RESULT([no])
9493                 AC_MSG_ERROR([please provide a path to a windows version of doxygen or use --without-doxygen])
9494             fi
9495         fi
9496     fi
9498 AC_SUBST([DOXYGEN])
9500 dnl ==================================================================
9501 dnl libfuzzer
9502 dnl ==================================================================
9503 AC_MSG_CHECKING([whether to enable fuzzers])
9504 if test "$enable_fuzzers" != yes; then
9505     AC_MSG_RESULT([no])
9506 else
9507     if test -z $LIB_FUZZING_ENGINE; then
9508       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9509     fi
9510     AC_MSG_RESULT([yes])
9511     ENABLE_FUZZERS="TRUE"
9512     AC_DEFINE([ENABLE_FUZZERS],1)
9513     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9515 AC_SUBST(LIB_FUZZING_ENGINE)
9517 dnl ===================================================================
9518 dnl Check for system zlib
9519 dnl ===================================================================
9520 if test "$with_system_zlib" = "auto"; then
9521     case "$_os" in
9522     WINNT)
9523         with_system_zlib="$with_system_libs"
9524         ;;
9525     *)
9526         if test "$enable_fuzzers" != "yes"; then
9527             with_system_zlib=yes
9528         else
9529             with_system_zlib=no
9530         fi
9531         ;;
9532     esac
9535 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9536 dnl and has no pkg-config for it at least on some tinderboxes,
9537 dnl so leaving that out for now
9538 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9539 AC_MSG_CHECKING([which zlib to use])
9540 if test "$with_system_zlib" = "yes"; then
9541     AC_MSG_RESULT([external])
9542     SYSTEM_ZLIB=TRUE
9543     AC_CHECK_HEADER(zlib.h, [],
9544         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9545     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9546         [AC_MSG_ERROR(zlib not found or functional)], [])
9547 else
9548     AC_MSG_RESULT([internal])
9549     SYSTEM_ZLIB=
9550     BUILD_TYPE="$BUILD_TYPE ZLIB"
9551     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9552     if test "$COM" = "MSC"; then
9553         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9554     else
9555         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9556     fi
9558 AC_SUBST(ZLIB_CFLAGS)
9559 AC_SUBST(ZLIB_LIBS)
9560 AC_SUBST(SYSTEM_ZLIB)
9562 dnl ===================================================================
9563 dnl Check for system jpeg
9564 dnl ===================================================================
9565 AC_MSG_CHECKING([which libjpeg to use])
9566 if test "$with_system_jpeg" = "yes"; then
9567     AC_MSG_RESULT([external])
9568     SYSTEM_LIBJPEG=TRUE
9569     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9570         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9571     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9572         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9573 else
9574     SYSTEM_LIBJPEG=
9575     AC_MSG_RESULT([internal, libjpeg-turbo])
9576     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9578     case "$host_cpu" in
9579     x86_64 | amd64 | i*86 | x86 | ia32)
9580         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9581         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9582             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9583                 NASM="$LODE_HOME/opt/bin/nasm"
9584             elif test -x "/opt/lo/bin/nasm"; then
9585                 NASM="/opt/lo/bin/nasm"
9586             fi
9587         fi
9589         if test -n "$NASM"; then
9590             AC_MSG_CHECKING([for object file format of host system])
9591             case "$host_os" in
9592               cygwin* | mingw* | pw32* | wsl*)
9593                 case "$host_cpu" in
9594                   x86_64)
9595                     objfmt='Win64-COFF'
9596                     ;;
9597                   *)
9598                     objfmt='Win32-COFF'
9599                     ;;
9600                 esac
9601               ;;
9602               msdosdjgpp* | go32*)
9603                 objfmt='COFF'
9604               ;;
9605               os2-emx*) # not tested
9606                 objfmt='MSOMF' # obj
9607               ;;
9608               linux*coff* | linux*oldld*)
9609                 objfmt='COFF' # ???
9610               ;;
9611               linux*aout*)
9612                 objfmt='a.out'
9613               ;;
9614               linux*)
9615                 case "$host_cpu" in
9616                   x86_64)
9617                     objfmt='ELF64'
9618                     ;;
9619                   *)
9620                     objfmt='ELF'
9621                     ;;
9622                 esac
9623               ;;
9624               kfreebsd* | freebsd* | netbsd* | openbsd*)
9625                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9626                   objfmt='BSD-a.out'
9627                 else
9628                   case "$host_cpu" in
9629                     x86_64 | amd64)
9630                       objfmt='ELF64'
9631                       ;;
9632                     *)
9633                       objfmt='ELF'
9634                       ;;
9635                   esac
9636                 fi
9637               ;;
9638               solaris* | sunos* | sysv* | sco*)
9639                 case "$host_cpu" in
9640                   x86_64)
9641                     objfmt='ELF64'
9642                     ;;
9643                   *)
9644                     objfmt='ELF'
9645                     ;;
9646                 esac
9647               ;;
9648               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9649                 case "$host_cpu" in
9650                   x86_64)
9651                     objfmt='Mach-O64'
9652                     ;;
9653                   *)
9654                     objfmt='Mach-O'
9655                     ;;
9656                 esac
9657               ;;
9658               *)
9659                 objfmt='ELF ?'
9660               ;;
9661             esac
9663             AC_MSG_RESULT([$objfmt])
9664             if test "$objfmt" = 'ELF ?'; then
9665               objfmt='ELF'
9666               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9667             fi
9669             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9670             case "$objfmt" in
9671               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9672               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9673               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9674               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9675               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9676               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9677               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9678               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9679               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9680               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9681               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9682             esac
9683             AC_MSG_RESULT([$NAFLAGS])
9685             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9686             cat > conftest.asm << EOF
9687             [%line __oline__ "configure"
9688                     section .text
9689                     global  _main,main
9690             _main:
9691             main:   xor     eax,eax
9692                     ret
9693             ]
9695             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9696             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9697               AC_MSG_RESULT(yes)
9698             else
9699               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9700               cat conftest.asm >&AS_MESSAGE_LOG_FD
9701               rm -rf conftest*
9702               AC_MSG_RESULT(no)
9703               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9704               NASM=""
9705             fi
9707         fi
9709         if test -z "$NASM"; then
9710 cat << _EOS
9711 ****************************************************************************
9712 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9713 To get one please:
9715 _EOS
9716             if test "$build_os" = "cygwin"; then
9717 cat << _EOS
9718 install a pre-compiled binary for Win32
9720 mkdir -p /opt/lo/bin
9721 cd /opt/lo/bin
9722 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9723 chmod +x nasm
9725 or get and install one from https://www.nasm.us/
9727 Then re-run autogen.sh
9729 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9730 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`command -v nasm\` finds it.
9732 _EOS
9733             else
9734 cat << _EOS
9735 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9737 _EOS
9738             fi
9739             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9740             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9741         fi
9742       ;;
9743     esac
9746 AC_SUBST(NASM)
9747 AC_SUBST(NAFLAGS)
9748 AC_SUBST(LIBJPEG_CFLAGS)
9749 AC_SUBST(LIBJPEG_LIBS)
9750 AC_SUBST(SYSTEM_LIBJPEG)
9752 dnl ===================================================================
9753 dnl Check for system clucene
9754 dnl ===================================================================
9755 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9756 if test "$SYSTEM_CLUCENE" = TRUE; then
9757     AC_LANG_PUSH([C++])
9758     save_CXXFLAGS=$CXXFLAGS
9759     save_CPPFLAGS=$CPPFLAGS
9760     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9761     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9762     dnl https://sourceforge.net/p/clucene/bugs/200/
9763     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9764     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9765                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9766     CXXFLAGS=$save_CXXFLAGS
9767     CPPFLAGS=$save_CPPFLAGS
9768     AC_LANG_POP([C++])
9769     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9772 dnl ===================================================================
9773 dnl Check for system expat
9774 dnl ===================================================================
9775 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9777 dnl ===================================================================
9778 dnl Check for system xmlsec
9779 dnl ===================================================================
9780 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9782 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9783 if test "$enable_eot" = "yes"; then
9784     ENABLE_EOT="TRUE"
9785     AC_DEFINE([ENABLE_EOT])
9786     AC_MSG_RESULT([yes])
9788     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9789 else
9790     ENABLE_EOT=
9791     AC_MSG_RESULT([no])
9793 AC_SUBST([ENABLE_EOT])
9795 dnl ===================================================================
9796 dnl Check for DLP libs
9797 dnl ===================================================================
9798 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9799 AS_IF([test "$COM" = "MSC"],
9800       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9801       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9803 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9804 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9806 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9808 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9810 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9811 AS_IF([test "$COM" = "MSC"],
9812       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9813       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9815 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9816 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9818 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9820 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9821 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9823 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9825 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9827 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9829 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9830 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9832 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9833 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9835 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9837 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9838 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9840 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9842 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9844 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9846 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9848 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9849 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9851 dnl ===================================================================
9852 dnl Check for system lcms2
9853 dnl ===================================================================
9854 if test "$with_system_lcms2" != "yes"; then
9855     SYSTEM_LCMS2=
9857 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9858 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9859 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9860 if test "$GCC" = "yes"; then
9861     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9863 if test "$COM" = "MSC"; then # override the above
9864     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9867 dnl ===================================================================
9868 dnl Check for system cppunit
9869 dnl ===================================================================
9870 if test "$_os" != "Android" ; then
9871     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9874 dnl ===================================================================
9875 dnl Check whether freetype is available
9877 dnl FreeType has 3 different kinds of versions
9878 dnl * release, like 2.4.10
9879 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9880 dnl * soname
9881 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9883 dnl 9.9.3 is 2.2.0
9884 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9885 dnl ===================================================================
9886 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9887 if test "x$ac_config_site_64bit_host" = xYES; then
9888     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9889 else
9890     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9892 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9894 # ===================================================================
9895 # Check for system libxslt
9896 # to prevent incompatibilities between internal libxml2 and external libxslt,
9897 # or vice versa, use with_system_libxml here
9898 # ===================================================================
9899 if test "$with_system_libxml" = "auto"; then
9900     case "$_os" in
9901     WINNT|iOS|Android)
9902         with_system_libxml="$with_system_libs"
9903         ;;
9904     Emscripten)
9905         with_system_libxml=no
9906         ;;
9907     *)
9908         if test "$enable_fuzzers" != "yes"; then
9909             with_system_libxml=yes
9910         else
9911             with_system_libxml=no
9912         fi
9913         ;;
9914     esac
9917 AC_MSG_CHECKING([which libxslt to use])
9918 if test "$with_system_libxml" = "yes"; then
9919     AC_MSG_RESULT([external])
9920     SYSTEM_LIBXSLT=TRUE
9921     if test "$_os" = "Darwin"; then
9922         dnl make sure to use SDK path
9923         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9924         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9925         dnl omit -L/usr/lib
9926         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9927         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9928     else
9929         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9930         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9931         FilterLibs "${LIBXSLT_LIBS}"
9932         LIBXSLT_LIBS="${filteredlibs}"
9933         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9934         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9935         FilterLibs "${LIBEXSLT_LIBS}"
9936         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9937     fi
9939     dnl Check for xsltproc
9940     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9941     if test "$XSLTPROC" = "no"; then
9942         AC_MSG_ERROR([xsltproc is required])
9943     fi
9944 else
9945     AC_MSG_RESULT([internal])
9946     SYSTEM_LIBXSLT=
9947     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9949 AC_SUBST(SYSTEM_LIBXSLT)
9950 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9951     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9953 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9955 AC_SUBST(LIBEXSLT_CFLAGS)
9956 AC_SUBST(LIBEXSLT_LIBS)
9957 AC_SUBST(LIBXSLT_CFLAGS)
9958 AC_SUBST(LIBXSLT_LIBS)
9959 AC_SUBST(XSLTPROC)
9961 # ===================================================================
9962 # Check for system libxml
9963 # ===================================================================
9964 AC_MSG_CHECKING([which libxml to use])
9965 if test "$with_system_libxml" = "yes"; then
9966     AC_MSG_RESULT([external])
9967     SYSTEM_LIBXML=TRUE
9968     if test "$_os" = "Darwin"; then
9969         dnl make sure to use SDK path
9970         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9971         dnl omit -L/usr/lib
9972         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9973     elif test $_os = iOS; then
9974         dnl make sure to use SDK path
9975         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9976         LIBXML_CFLAGS="-I$usr/include/libxml2"
9977         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9978     else
9979         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9980         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9981         FilterLibs "${LIBXML_LIBS}"
9982         LIBXML_LIBS="${filteredlibs}"
9983     fi
9985     dnl Check for xmllint
9986     AC_PATH_PROG(XMLLINT, xmllint, no)
9987     if test "$XMLLINT" = "no"; then
9988         AC_MSG_ERROR([xmllint is required])
9989     fi
9990 else
9991     AC_MSG_RESULT([internal])
9992     SYSTEM_LIBXML=
9993     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9994     if test "$COM" = "MSC"; then
9995         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9996     fi
9997     if test "$COM" = "MSC"; then
9998         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9999     else
10000         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
10001         if test "$DISABLE_DYNLOADING" = TRUE; then
10002             LIBXML_LIBS="$LIBXML_LIBS -lm"
10003         fi
10004     fi
10005     BUILD_TYPE="$BUILD_TYPE LIBXML2"
10007 AC_SUBST(SYSTEM_LIBXML)
10008 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
10009     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
10011 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
10012 AC_SUBST(LIBXML_CFLAGS)
10013 AC_SUBST(LIBXML_LIBS)
10014 AC_SUBST(XMLLINT)
10016 # =====================================================================
10017 # Checking for a Python interpreter with version >= 3.3.
10018 # Optionally user can pass an option to configure, i. e.
10019 # ./configure PYTHON=/usr/bin/python
10020 # =====================================================================
10021 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
10022     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
10023     # unless PYTHON is defined as above which allows 'system'
10024     enable_python=internal
10026 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
10027     if test -n "$PYTHON"; then
10028         PYTHON_FOR_BUILD=$PYTHON
10029     else
10030         # This allows a lack of system python with no error, we use internal one in that case.
10031         AM_PATH_PYTHON([3.3],, [:])
10032         # Clean PYTHON_VERSION checked below if cross-compiling
10033         PYTHON_VERSION=""
10034         if test "$PYTHON" != ":"; then
10035             PYTHON_FOR_BUILD=$PYTHON
10036         fi
10037     fi
10040 # Checks for Python to use for Pyuno
10041 AC_MSG_CHECKING([which Python to use for Pyuno])
10042 case "$enable_python" in
10043 no|disable)
10044     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10045         # Python is required to build LibreOffice. In theory we could separate the build-time Python
10046         # requirement from the choice whether to include Python stuff in the installer, but why
10047         # bother?
10048         AC_MSG_ERROR([Python is required at build time.])
10049     fi
10050     enable_python=no
10051     AC_MSG_RESULT([none])
10052     ;;
10053 ""|yes|auto)
10054     if test "$DISABLE_SCRIPTING" = TRUE; then
10055         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
10056             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
10057         fi
10058         AC_MSG_RESULT([none, overridden by --disable-scripting])
10059         enable_python=no
10060     elif test $build_os = cygwin -o $build_os = wsl; then
10061         dnl When building on Windows we don't attempt to use any installed
10062         dnl "system"  Python.
10063         AC_MSG_RESULT([fully internal])
10064         enable_python=internal
10065     elif test "$cross_compiling" = yes; then
10066         AC_MSG_RESULT([system])
10067         enable_python=system
10068     else
10069         # Unset variables set by the above AM_PATH_PYTHON so that
10070         # we actually do check anew.
10071         AC_MSG_RESULT([])
10072         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
10073         AM_PATH_PYTHON([3.3],, [:])
10074         AC_MSG_CHECKING([which Python to use for Pyuno])
10075         if test "$PYTHON" = ":"; then
10076             if test -z "$PYTHON_FOR_BUILD"; then
10077                 AC_MSG_RESULT([fully internal])
10078             else
10079                 AC_MSG_RESULT([internal])
10080             fi
10081             enable_python=internal
10082         else
10083             AC_MSG_RESULT([system])
10084             enable_python=system
10085         fi
10086     fi
10087     ;;
10088 internal)
10089     AC_MSG_RESULT([internal])
10090     ;;
10091 fully-internal)
10092     AC_MSG_RESULT([fully internal])
10093     enable_python=internal
10094     ;;
10095 system)
10096     AC_MSG_RESULT([system])
10097     if test "$_os" = Darwin -a -z "$PYTHON"; then
10098         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
10099     fi
10100     ;;
10102     AC_MSG_ERROR([Incorrect --enable-python option])
10103     ;;
10104 esac
10106 if test $enable_python != no; then
10107     BUILD_TYPE="$BUILD_TYPE PYUNO"
10110 if test $enable_python = system; then
10111     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
10112         # Fallback: Accept these in the environment, or as set above
10113         # for MacOSX.
10114         :
10115     elif test "$cross_compiling" != yes; then
10116         # Unset variables set by the above AM_PATH_PYTHON so that
10117         # we actually do check anew.
10118         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
10119         # This causes an error if no python command is found
10120         AM_PATH_PYTHON([3.3])
10121         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
10122         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
10123         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
10124         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
10125         if test -z "$PKG_CONFIG"; then
10126             PYTHON_CFLAGS="-I$python_include"
10127             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10128         elif $PKG_CONFIG --exists python-$python_version-embed; then
10129             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
10130             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
10131         elif $PKG_CONFIG --exists python-$python_version; then
10132             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
10133             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
10134         else
10135             PYTHON_CFLAGS="-I$python_include"
10136             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
10137         fi
10138         FilterLibs "${PYTHON_LIBS}"
10139         PYTHON_LIBS="${filteredlibs}"
10140     else
10141         dnl How to find out the cross-compilation Python installation path?
10142         AC_MSG_CHECKING([for python version])
10143         AS_IF([test -n "$PYTHON_VERSION"],
10144               [AC_MSG_RESULT([$PYTHON_VERSION])],
10145               [AC_MSG_RESULT([not found])
10146                AC_MSG_ERROR([no usable python found])])
10147         test -n "$PYTHON_CFLAGS" && break
10148     fi
10150     dnl Check if the headers really work
10151     save_CPPFLAGS="$CPPFLAGS"
10152     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
10153     AC_CHECK_HEADER(Python.h)
10154     CPPFLAGS="$save_CPPFLAGS"
10156     # let the PYTHON_FOR_BUILD match the same python installation that
10157     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
10158     # better for PythonTests.
10159     PYTHON_FOR_BUILD=$PYTHON
10162 if test "$with_lxml" != no; then
10163     if test -z "$PYTHON_FOR_BUILD"; then
10164         case $build_os in
10165             cygwin)
10166                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
10167                 ;;
10168             *)
10169                 if test "$cross_compiling" != yes ; then
10170                     BUILD_TYPE="$BUILD_TYPE LXML"
10171                 fi
10172                 ;;
10173         esac
10174     else
10175         AC_MSG_CHECKING([for python lxml])
10176         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
10177             AC_MSG_RESULT([yes])
10178         else
10179             case $build_os in
10180                 cygwin)
10181                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
10182                     ;;
10183                 *)
10184                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
10185                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
10186                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
10187                         else
10188                             BUILD_TYPE="$BUILD_TYPE LXML"
10189                             AC_MSG_RESULT([no, using internal lxml])
10190                         fi
10191                     else
10192                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10193                     fi
10194                     ;;
10195             esac
10196         fi
10197     fi
10200 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10201     SYSTEM_PYTHON=
10202     PYTHON_VERSION_MAJOR=3
10203     PYTHON_VERSION_MINOR=8
10204     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.19
10205     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10206         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10207     fi
10208     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10210     # Embedded Python dies without Home set
10211     if test "$HOME" = ""; then
10212         export HOME=""
10213     fi
10216 dnl By now enable_python should be "system", "internal" or "no"
10217 case $enable_python in
10218 system)
10219     SYSTEM_PYTHON=TRUE
10221     if test "x$ac_cv_header_Python_h" != "xyes"; then
10222        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10223     fi
10225     AC_LANG_PUSH(C)
10226     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10227     AC_MSG_CHECKING([for correct python library version])
10228        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10229 #include <Python.h>
10231 int main(int argc, char **argv) {
10232    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10233    else return 1;
10235        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10236     AC_LANG_POP(C)
10238     dnl FIXME Check if the Python library can be linked with, too?
10239     ;;
10241 internal)
10242     BUILD_TYPE="$BUILD_TYPE PYTHON"
10243     if test "$OS" = LINUX -o "$OS" = WNT ; then
10244         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10245     fi
10246     ;;
10248     DISABLE_PYTHON=TRUE
10249     SYSTEM_PYTHON=
10250     ;;
10252     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10253     ;;
10254 esac
10256 AC_SUBST(DISABLE_PYTHON)
10257 AC_SUBST(SYSTEM_PYTHON)
10258 AC_SUBST(PYTHON_CFLAGS)
10259 AC_SUBST(PYTHON_FOR_BUILD)
10260 AC_SUBST(PYTHON_LIBS)
10261 AC_SUBST(PYTHON_VERSION)
10262 AC_SUBST(PYTHON_VERSION_MAJOR)
10263 AC_SUBST(PYTHON_VERSION_MINOR)
10265 AC_MSG_CHECKING([whether to build LibreLogo])
10266 case "$enable_python" in
10267 no|disable)
10268     AC_MSG_RESULT([no; Python disabled])
10269     ;;
10271     if test "${enable_librelogo}" = "no"; then
10272         AC_MSG_RESULT([no])
10273     else
10274         AC_MSG_RESULT([yes])
10275         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10276         AC_DEFINE([ENABLE_LIBRELOGO],1)
10277     fi
10278     ;;
10279 esac
10280 AC_SUBST(ENABLE_LIBRELOGO)
10282 ENABLE_MARIADBC=
10283 MARIADBC_MAJOR=1
10284 MARIADBC_MINOR=0
10285 MARIADBC_MICRO=2
10286 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10287 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10288     ENABLE_MARIADBC=TRUE
10289     AC_MSG_RESULT([yes])
10290     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10291 else
10292     AC_MSG_RESULT([no])
10294 AC_SUBST(ENABLE_MARIADBC)
10295 AC_SUBST(MARIADBC_MAJOR)
10296 AC_SUBST(MARIADBC_MINOR)
10297 AC_SUBST(MARIADBC_MICRO)
10299 if test "$ENABLE_MARIADBC" = "TRUE"; then
10300     dnl ===================================================================
10301     dnl Check for system MariaDB
10302     dnl ===================================================================
10304     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10305         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10306     fi
10308     AC_MSG_CHECKING([which MariaDB to use])
10309     if test "$with_system_mariadb" = "yes"; then
10310         AC_MSG_RESULT([external])
10311         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10312         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10313         if test -z "$MARIADBCONFIG"; then
10314             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10315             if test -z "$MARIADBCONFIG"; then
10316                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10317                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10318             fi
10319         fi
10320         AC_MSG_CHECKING([MariaDB version])
10321         MARIADB_VERSION=`$MARIADBCONFIG --version`
10322         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10323         if test "$MARIADB_MAJOR" -ge "5"; then
10324             AC_MSG_RESULT([OK])
10325         else
10326             AC_MSG_ERROR([too old, use 5.0.x or later])
10327         fi
10328         AC_MSG_CHECKING([for MariaDB Client library])
10329         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10330         if test "$COM_IS_CLANG" = TRUE; then
10331             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10332         fi
10333         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10334         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10335         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10336         dnl linux32:
10337         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10338             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10339             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10340                 | sed -e 's|/lib64/|/lib/|')
10341         fi
10342         FilterLibs "${MARIADB_LIBS}"
10343         MARIADB_LIBS="${filteredlibs}"
10344         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10345         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10346         if test "$enable_bundle_mariadb" = "yes"; then
10347             AC_MSG_RESULT([yes])
10348             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10349             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10351 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10353 /g' | grep -E '(mysqlclient|mariadb)')
10354             if test "$_os" = "Darwin"; then
10355                 LIBMARIADB=${LIBMARIADB}.dylib
10356                 if test "$with_gssapi" != "no"; then
10357                     WITH_GSSAPI=TRUE
10358                     save_LIBS=$LIBS
10359                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10360                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10361                     GSSAPI_LIBS=$LIBS
10362                     LIBS=$save_LIBS
10363                 fi
10364             elif test "$_os" = "WINNT"; then
10365                 LIBMARIADB=${LIBMARIADB}.dll
10366             else
10367                 LIBMARIADB=${LIBMARIADB}.so
10368                 if test "$with_gssapi" != "no"; then
10369                     WITH_GSSAPI=TRUE
10370                     save_LIBS=$LIBS
10371                     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10372                         [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10373                     GSSAPI_LIBS=$LIBS
10374                     LIBS=$save_LIBS
10375                 fi
10376             fi
10377             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10378             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10379             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10380                 AC_MSG_RESULT([found.])
10381                 PathFormat "$LIBMARIADB_PATH"
10382                 LIBMARIADB_PATH="$formatted_path"
10383             else
10384                 AC_MSG_ERROR([not found.])
10385             fi
10386         else
10387             AC_MSG_RESULT([no])
10388             BUNDLE_MARIADB_CONNECTOR_C=
10389         fi
10390     else
10391         AC_MSG_RESULT([internal])
10392         SYSTEM_MARIADB_CONNECTOR_C=
10393         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10394         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10395         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10396     fi
10398     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10399     AC_SUBST(MARIADB_CFLAGS)
10400     AC_SUBST(MARIADB_LIBS)
10401     AC_SUBST(LIBMARIADB)
10402     AC_SUBST(LIBMARIADB_PATH)
10403     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10406 dnl ===================================================================
10407 dnl Check for system hsqldb
10408 dnl ===================================================================
10409 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10410     AC_MSG_CHECKING([which hsqldb to use])
10411     if test "$with_system_hsqldb" = "yes"; then
10412         AC_MSG_RESULT([external])
10413         SYSTEM_HSQLDB=TRUE
10414         if test -z $HSQLDB_JAR; then
10415             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10416         fi
10417         if ! test -f $HSQLDB_JAR; then
10418                AC_MSG_ERROR(hsqldb.jar not found.)
10419         fi
10420         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10421         export HSQLDB_JAR
10422         if $PERL -e \
10423            'use Archive::Zip;
10424             my $file = "$ENV{'HSQLDB_JAR'}";
10425             my $zip = Archive::Zip->new( $file );
10426             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10427             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10428             {
10429                 push @l, split(/\n/, $mf);
10430                 foreach my $line (@l)
10431                 {
10432                     if ($line =~ m/Specification-Version:/)
10433                     {
10434                         ($t, $version) = split (/:/,$line);
10435                         $version =~ s/^\s//;
10436                         ($a, $b, $c, $d) = split (/\./,$version);
10437                         if ($c == "0" && $d > "8")
10438                         {
10439                             exit 0;
10440                         }
10441                         else
10442                         {
10443                             exit 1;
10444                         }
10445                     }
10446                 }
10447             }
10448             else
10449             {
10450                 exit 1;
10451             }'; then
10452             AC_MSG_RESULT([yes])
10453         else
10454             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10455         fi
10456     else
10457         AC_MSG_RESULT([internal])
10458         SYSTEM_HSQLDB=
10459         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10460         NEED_ANT=TRUE
10461     fi
10462 else
10463     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10464         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10465     fi
10467 AC_SUBST(SYSTEM_HSQLDB)
10468 AC_SUBST(HSQLDB_JAR)
10470 dnl ===================================================================
10471 dnl Check for PostgreSQL stuff
10472 dnl ===================================================================
10473 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10474 if test "x$enable_postgresql_sdbc" != "xno"; then
10475     AC_MSG_RESULT([yes])
10476     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10478     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10479         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10480     fi
10481     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10482         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10483     fi
10485     postgres_interface=""
10486     if test "$with_system_postgresql" = "yes"; then
10487         postgres_interface="external PostgreSQL"
10488         SYSTEM_POSTGRESQL=TRUE
10489         if test "$_os" = Darwin; then
10490             supp_path=''
10491             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10492                 pg_supp_path="$P_SEP$d$pg_supp_path"
10493             done
10494         fi
10495         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10496         if test -n "$PGCONFIG"; then
10497             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10498             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10499         else
10500             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10501               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10502               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10503             ],[
10504               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10505             ])
10506         fi
10507         FilterLibs "${POSTGRESQL_LIB}"
10508         POSTGRESQL_LIB="${filteredlibs}"
10509     else
10510         # if/when anything else than PostgreSQL uses Kerberos,
10511         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10512         WITH_KRB5=
10513         WITH_GSSAPI=
10514         case "$_os" in
10515         Darwin)
10516             # macOS has system MIT Kerberos 5 since 10.4
10517             if test "$with_krb5" != "no"; then
10518                 WITH_KRB5=TRUE
10519                 save_LIBS=$LIBS
10520                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10521                 # that the libraries where these functions are located on macOS will change, is it?
10522                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10523                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10524                 KRB5_LIBS=$LIBS
10525                 LIBS=$save_LIBS
10526                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10527                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10528                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10529                 LIBS=$save_LIBS
10530             fi
10531             if test "$with_gssapi" != "no"; then
10532                 WITH_GSSAPI=TRUE
10533                 save_LIBS=$LIBS
10534                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10535                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10536                 GSSAPI_LIBS=$LIBS
10537                 LIBS=$save_LIBS
10538             fi
10539             ;;
10540         WINNT)
10541             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10542                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10543             fi
10544             ;;
10545         Linux|GNU|*BSD|DragonFly)
10546             if test "$with_krb5" != "no"; then
10547                 WITH_KRB5=TRUE
10548                 save_LIBS=$LIBS
10549                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10550                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10551                 KRB5_LIBS=$LIBS
10552                 LIBS=$save_LIBS
10553                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10554                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10555                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10556                 LIBS=$save_LIBS
10557             fi
10558             if test "$with_gssapi" != "no"; then
10559                 WITH_GSSAPI=TRUE
10560                 save_LIBS=$LIBS
10561                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10562                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10563                 GSSAPI_LIBS=$LIBS
10564                 LIBS=$save_LIBS
10565             fi
10566             ;;
10567         *)
10568             if test "$with_krb5" = "yes"; then
10569                 WITH_KRB5=TRUE
10570                 save_LIBS=$LIBS
10571                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10572                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10573                 KRB5_LIBS=$LIBS
10574                 LIBS=$save_LIBS
10575                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10576                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10577                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10578                 LIBS=$save_LIBS
10579             fi
10580             if test "$with_gssapi" = "yes"; then
10581                 WITH_GSSAPI=TRUE
10582                 save_LIBS=$LIBS
10583                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10584                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10585                 LIBS=$save_LIBS
10586                 GSSAPI_LIBS=$LIBS
10587             fi
10588         esac
10590         if test -n "$with_libpq_path"; then
10591             SYSTEM_POSTGRESQL=TRUE
10592             postgres_interface="external libpq"
10593             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10594             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10595         else
10596             SYSTEM_POSTGRESQL=
10597             postgres_interface="internal"
10598             POSTGRESQL_LIB=""
10599             POSTGRESQL_INC="%OVERRIDE_ME%"
10600             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10601         fi
10602     fi
10604     AC_MSG_CHECKING([PostgreSQL C interface])
10605     AC_MSG_RESULT([$postgres_interface])
10607     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10608         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10609         save_CFLAGS=$CFLAGS
10610         save_CPPFLAGS=$CPPFLAGS
10611         save_LIBS=$LIBS
10612         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10613         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10614         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10615         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10616             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10617         CFLAGS=$save_CFLAGS
10618         CPPFLAGS=$save_CPPFLAGS
10619         LIBS=$save_LIBS
10620     fi
10621     BUILD_POSTGRESQL_SDBC=TRUE
10622 else
10623     AC_MSG_RESULT([no])
10625 AC_SUBST(WITH_KRB5)
10626 AC_SUBST(WITH_GSSAPI)
10627 AC_SUBST(GSSAPI_LIBS)
10628 AC_SUBST(KRB5_LIBS)
10629 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10630 AC_SUBST(SYSTEM_POSTGRESQL)
10631 AC_SUBST(POSTGRESQL_INC)
10632 AC_SUBST(POSTGRESQL_LIB)
10634 dnl ===================================================================
10635 dnl Check for Firebird stuff
10636 dnl ===================================================================
10637 ENABLE_FIREBIRD_SDBC=
10638 if test "$enable_firebird_sdbc" = "yes" ; then
10639     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10641     dnl ===================================================================
10642     dnl Check for system Firebird
10643     dnl ===================================================================
10644     AC_MSG_CHECKING([which Firebird to use])
10645     if test "$with_system_firebird" = "yes"; then
10646         AC_MSG_RESULT([external])
10647         SYSTEM_FIREBIRD=TRUE
10648         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10649         if test -z "$FIREBIRDCONFIG"; then
10650             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10651             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10652                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10653             ])
10654             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10655         else
10656             AC_MSG_NOTICE([fb_config found])
10657             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10658             AC_MSG_CHECKING([for Firebird Client library])
10659             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10660             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10661             FilterLibs "${FIREBIRD_LIBS}"
10662             FIREBIRD_LIBS="${filteredlibs}"
10663         fi
10664         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10665         AC_MSG_CHECKING([Firebird version])
10666         if test -n "${FIREBIRD_VERSION}"; then
10667             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10668             if test "$FIREBIRD_MAJOR" -ge "3"; then
10669                 AC_MSG_RESULT([OK])
10670             else
10671                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10672             fi
10673         else
10674             save_CFLAGS="${CFLAGS}"
10675             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10676             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10677 #if defined(FB_API_VER) && FB_API_VER == 30
10678 int fb_api_is_30(void) { return 0; }
10679 #else
10680 #error "Wrong Firebird API version"
10681 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10682             CFLAGS="$save_CFLAGS"
10683         fi
10684         ENABLE_FIREBIRD_SDBC=TRUE
10685         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10686     elif test "$enable_database_connectivity" = no; then
10687         AC_MSG_RESULT([none])
10688     elif test "$cross_compiling" = "yes"; then
10689         AC_MSG_RESULT([none])
10690     else
10691         dnl Embedded Firebird has version 3.0
10692         dnl We need libatomic_ops for any non X86/X64 system
10693         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10694             dnl ===================================================================
10695             dnl Check for system libatomic_ops
10696             dnl ===================================================================
10697             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10698             if test "$with_system_libatomic_ops" = "yes"; then
10699                 SYSTEM_LIBATOMIC_OPS=TRUE
10700                 AC_CHECK_HEADERS(atomic_ops.h, [],
10701                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10702             else
10703                 SYSTEM_LIBATOMIC_OPS=
10704                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10705                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10706                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10707             fi
10708         fi
10710         AC_MSG_RESULT([internal])
10711         SYSTEM_FIREBIRD=
10712         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10713         FIREBIRD_LIBS="-lfbclient"
10715         if test "$with_system_libtommath" = "yes"; then
10716             SYSTEM_LIBTOMMATH=TRUE
10717             dnl check for tommath presence
10718             save_LIBS=$LIBS
10719             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10720             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10721             LIBS=$save_LIBS
10722         else
10723             SYSTEM_LIBTOMMATH=
10724             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10725             LIBTOMMATH_LIBS="-ltommath"
10726             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10727         fi
10729         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10730         ENABLE_FIREBIRD_SDBC=TRUE
10731         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10732     fi
10734 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10735 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10736 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10737 AC_SUBST(LIBATOMIC_OPS_LIBS)
10738 AC_SUBST(SYSTEM_FIREBIRD)
10739 AC_SUBST(FIREBIRD_CFLAGS)
10740 AC_SUBST(FIREBIRD_LIBS)
10741 AC_SUBST(SYSTEM_LIBTOMMATH)
10742 AC_SUBST(LIBTOMMATH_CFLAGS)
10743 AC_SUBST(LIBTOMMATH_LIBS)
10745 dnl ===================================================================
10746 dnl Check for system curl
10747 dnl ===================================================================
10748 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10750 dnl ===================================================================
10751 dnl Check for system boost
10752 dnl ===================================================================
10753 AC_MSG_CHECKING([which boost to use])
10754 if test "$with_system_boost" = "yes"; then
10755     AC_MSG_RESULT([external])
10756     SYSTEM_BOOST=TRUE
10757     AX_BOOST_BASE([1.69],,[AC_MSG_ERROR([no suitable Boost found])])
10758     AX_BOOST_DATE_TIME
10759     AX_BOOST_FILESYSTEM
10760     AX_BOOST_IOSTREAMS
10761     AX_BOOST_LOCALE
10762     AC_LANG_PUSH([C++])
10763     save_CXXFLAGS=$CXXFLAGS
10764     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10765     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10766        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10767     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10768        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10769     CXXFLAGS=$save_CXXFLAGS
10770     AC_LANG_POP([C++])
10771     # this is in m4/ax_boost_base.m4
10772     FilterLibs "${BOOST_LDFLAGS}"
10773     BOOST_LDFLAGS="${filteredlibs}"
10774 else
10775     AC_MSG_RESULT([internal])
10776     BUILD_TYPE="$BUILD_TYPE BOOST"
10777     SYSTEM_BOOST=
10778     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10779         # use warning-suppressing wrapper headers
10780         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10781     else
10782         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10783     fi
10785 AC_SUBST(SYSTEM_BOOST)
10787 dnl ===================================================================
10788 dnl Check for system mdds
10789 dnl ===================================================================
10790 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10791 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10793 dnl ===================================================================
10794 dnl Check for system dragonbox
10795 dnl ===================================================================
10796 AC_MSG_CHECKING([which dragonbox to use])
10797 if test "$with_system_dragonbox" = "yes"; then
10798     AC_MSG_RESULT([external])
10799     SYSTEM_DRAGONBOX=TRUE
10800     AC_LANG_PUSH([C++])
10801     save_CPPFLAGS=$CPPFLAGS
10802     # This is where upstream installs to, unfortunately no .pc or so...
10803     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10804     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10805     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10806        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10807     AC_LANG_POP([C++])
10808     CPPFLAGS=$save_CPPFLAGS
10809 else
10810     AC_MSG_RESULT([internal])
10811     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10812     SYSTEM_DRAGONBOX=
10814 AC_SUBST([SYSTEM_DRAGONBOX])
10815 AC_SUBST([DRAGONBOX_CFLAGS])
10817 dnl ===================================================================
10818 dnl Check for system frozen
10819 dnl ===================================================================
10820 AC_MSG_CHECKING([which frozen to use])
10821 if test "$with_system_frozen" = "yes"; then
10822     AC_MSG_RESULT([external])
10823     SYSTEM_FROZEN=TRUE
10824     AC_LANG_PUSH([C++])
10825     save_CPPFLAGS=$CPPFLAGS
10826     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10827        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10828     AC_LANG_POP([C++])
10829     CPPFLAGS=$save_CPPFLAGS
10830 else
10831     AC_MSG_RESULT([internal])
10832     BUILD_TYPE="$BUILD_TYPE FROZEN"
10833     SYSTEM_FROZEN=
10835 AC_SUBST([SYSTEM_FROZEN])
10836 AC_SUBST([FROZEN_CFLAGS])
10838 dnl ===================================================================
10839 dnl Check for system libfixmath
10840 dnl ===================================================================
10841 AC_MSG_CHECKING([which libfixmath to use])
10842 if test "$with_system_libfixmath" = "yes"; then
10843     AC_MSG_RESULT([external])
10844     SYSTEM_LIBFIXMATH=TRUE
10845     AC_LANG_PUSH([C++])
10846     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10847        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10848     AC_CHECK_LIB([libfixmath], [fix16_mul], [LIBFIXMATH_LIBS=-llibfixmath],
10849                  [AC_CHECK_LIB([fixmath], [fix16_mul], [LIBFIXMATH_LIBS=-lfixmath],
10850                                [AC_MSG_ERROR(libfixmath lib not found or functional)])])
10851     AC_LANG_POP([C++])
10852 else
10853     AC_MSG_RESULT([internal])
10854     SYSTEM_LIBFIXMATH=
10855     LIBFIXMATH_LIBS=
10857 AC_SUBST([SYSTEM_LIBFIXMATH])
10858 AC_SUBST([LIBFIXMATH_LIBS])
10860 dnl ===================================================================
10861 dnl Check for system glm
10862 dnl ===================================================================
10863 AC_MSG_CHECKING([which glm to use])
10864 if test "$with_system_glm" = "yes"; then
10865     AC_MSG_RESULT([external])
10866     SYSTEM_GLM=TRUE
10867     AC_LANG_PUSH([C++])
10868     AC_CHECK_HEADER([glm/glm.hpp], [],
10869        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10870     AC_LANG_POP([C++])
10871 else
10872     AC_MSG_RESULT([internal])
10873     BUILD_TYPE="$BUILD_TYPE GLM"
10874     SYSTEM_GLM=
10875     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10877 AC_SUBST([GLM_CFLAGS])
10878 AC_SUBST([SYSTEM_GLM])
10880 dnl ===================================================================
10881 dnl Check for system odbc
10882 dnl ===================================================================
10883 AC_MSG_CHECKING([which odbc headers to use])
10884 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
10885     AC_MSG_RESULT([external])
10886     SYSTEM_ODBC_HEADERS=TRUE
10888     if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
10889         save_CPPFLAGS=$CPPFLAGS
10890         find_winsdk
10891         PathFormat "$winsdktest"
10892         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"
10893         AC_CHECK_HEADER(sqlext.h, [],
10894             [AC_MSG_ERROR(odbc not found. install odbc)],
10895             [#include <windows.h>])
10896         CPPFLAGS=$save_CPPFLAGS
10897     else
10898         AC_CHECK_HEADER(sqlext.h, [],
10899             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10900     fi
10901 elif test "$enable_database_connectivity" = no; then
10902     AC_MSG_RESULT([none])
10903 else
10904     AC_MSG_RESULT([internal])
10905     SYSTEM_ODBC_HEADERS=
10907 AC_SUBST(SYSTEM_ODBC_HEADERS)
10909 dnl ===================================================================
10910 dnl Check for system NSS
10911 dnl ===================================================================
10912 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10913     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10914     AC_DEFINE(HAVE_FEATURE_NSS)
10915     ENABLE_NSS=TRUE
10916 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10917     with_tls=openssl
10919 AC_SUBST(ENABLE_NSS)
10921 dnl ===================================================================
10922 dnl Enable LDAP support
10923 dnl ===================================================================
10925 if test "$test_openldap" = yes; then
10926     AC_MSG_CHECKING([whether to enable LDAP support])
10927     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10928         AC_MSG_RESULT([yes])
10929         ENABLE_LDAP=TRUE
10930     else
10931         if test "$enable_ldap" != "yes"; then
10932             AC_MSG_RESULT([no])
10933         else
10934             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10935         fi
10936     fi
10938 dnl ===================================================================
10939 dnl Check for system openldap
10940 dnl ===================================================================
10942     if test "$ENABLE_LDAP" = TRUE; then
10943         AC_MSG_CHECKING([which openldap library to use])
10944         if test "$with_system_openldap" = yes; then
10945             AC_MSG_RESULT([external])
10946             SYSTEM_OPENLDAP=TRUE
10947             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10948             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10949             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10950         else
10951             AC_MSG_RESULT([internal])
10952             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10953         fi
10954     fi
10957 AC_SUBST(ENABLE_LDAP)
10958 AC_SUBST(SYSTEM_OPENLDAP)
10960 dnl ===================================================================
10961 dnl Check for TLS/SSL and cryptographic implementation to use
10962 dnl ===================================================================
10963 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10964 if test -n "$with_tls"; then
10965     case $with_tls in
10966     openssl)
10967         AC_DEFINE(USE_TLS_OPENSSL)
10968         TLS=OPENSSL
10969         AC_MSG_RESULT([$TLS])
10971         if test "$enable_openssl" != "yes"; then
10972             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10973         fi
10975         # warn that OpenSSL has been selected but not all TLS code has this option
10976         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10977         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10978         ;;
10979     nss)
10980         AC_DEFINE(USE_TLS_NSS)
10981         TLS=NSS
10982         AC_MSG_RESULT([$TLS])
10983         ;;
10984     no)
10985         AC_MSG_RESULT([none])
10986         AC_MSG_WARN([Skipping TLS/SSL])
10987         ;;
10988     *)
10989         AC_MSG_RESULT([])
10990         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10991 openssl - OpenSSL
10992 nss - Mozilla's Network Security Services (NSS)
10993     ])
10994         ;;
10995     esac
10996 else
10997     # default to using NSS, it results in smaller oox lib
10998     AC_DEFINE(USE_TLS_NSS)
10999     TLS=NSS
11000     AC_MSG_RESULT([$TLS])
11002 AC_SUBST(TLS)
11004 dnl ===================================================================
11005 dnl Check for system sane
11006 dnl ===================================================================
11007 AC_MSG_CHECKING([which sane header to use])
11008 if test "$with_system_sane" = "yes"; then
11009     AC_MSG_RESULT([external])
11010     AC_CHECK_HEADER(sane/sane.h, [],
11011       [AC_MSG_ERROR(sane not found. install sane)], [])
11012 else
11013     AC_MSG_RESULT([internal])
11014     BUILD_TYPE="$BUILD_TYPE SANE"
11017 dnl ===================================================================
11018 dnl Check for system icu
11019 dnl ===================================================================
11020 ICU_MAJOR=74
11021 ICU_MINOR=1
11022 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
11023 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
11024 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
11025 if test "$SYSTEM_ICU" = TRUE; then
11026     AC_LANG_PUSH([C++])
11027     AC_MSG_CHECKING([for unicode/rbbi.h])
11028     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
11029     AC_LANG_POP([C++])
11031     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
11032     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
11033     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
11035     if test "$CROSS_COMPILING" != TRUE; then
11036         # using the system icu tools can lead to version confusion, use the
11037         # ones from the build environment when cross-compiling
11038         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
11039         if test -z "$SYSTEM_GENBRK"; then
11040             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
11041         fi
11042         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11043         if test -z "$SYSTEM_GENCCODE"; then
11044             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
11045         fi
11046         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
11047         if test -z "$SYSTEM_GENCMN"; then
11048             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
11049         fi
11050     fi
11053 AC_SUBST(SYSTEM_GENBRK)
11054 AC_SUBST(SYSTEM_GENCCODE)
11055 AC_SUBST(SYSTEM_GENCMN)
11056 AC_SUBST(ICU_MAJOR)
11057 AC_SUBST(ICU_MINOR)
11059 dnl ==================================================================
11060 dnl CURL
11061 dnl ==================================================================
11062 if test "$enable_curl" = "yes"; then
11063     AC_DEFINE([HAVE_FEATURE_CURL])
11066 dnl ==================================================================
11067 dnl Breakpad
11068 dnl ==================================================================
11069 DEFAULT_CRASHDUMP_VALUE="true"
11070 AC_MSG_CHECKING([whether to enable breakpad])
11071 if test "$enable_breakpad" != yes; then
11072     AC_MSG_RESULT([no])
11073 else
11074     if test "$enable_curl" != "yes"; then
11075         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
11076     fi
11077     AC_MSG_RESULT([yes])
11078     ENABLE_BREAKPAD="TRUE"
11079     AC_DEFINE(ENABLE_BREAKPAD)
11080     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
11081     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
11083     AC_MSG_CHECKING([for disable crash dump])
11084     if test "$enable_crashdump" = no; then
11085         DEFAULT_CRASHDUMP_VALUE="false"
11086         AC_MSG_RESULT([yes])
11087     else
11088        AC_MSG_RESULT([no])
11089     fi
11091     AC_MSG_CHECKING([for crashreport config])
11092     if test "$with_symbol_config" = "no"; then
11093         BREAKPAD_SYMBOL_CONFIG="invalid"
11094         AC_MSG_RESULT([no])
11095     else
11096         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
11097         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
11098         AC_MSG_RESULT([yes])
11099     fi
11100     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
11102 AC_SUBST(ENABLE_BREAKPAD)
11103 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
11105 dnl ==================================================================
11106 dnl libcmis
11107 dnl ==================================================================
11108 if test "$enable_libcmis" = "yes"; then
11109     if test "$enable_curl" != "yes"; then
11110         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
11111     fi
11114 dnl ===================================================================
11115 dnl Orcus
11116 dnl ===================================================================
11117 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
11118 if test "$with_system_orcus" != "yes"; then
11119     if test "$SYSTEM_BOOST" = "TRUE"; then
11120         dnl Link with Boost.System
11121         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
11122         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
11123         dnl in documentation has no effect.
11124         AX_BOOST_SYSTEM
11125     fi
11127 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
11128 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
11129 AC_SUBST([BOOST_SYSTEM_LIB])
11130 AC_SUBST(SYSTEM_LIBORCUS)
11132 dnl ===================================================================
11133 dnl HarfBuzz
11134 dnl ===================================================================
11135 harfbuzz_required_version=5.1.0
11137 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
11138 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
11139 case "$_os" in
11140     Linux)
11141         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
11142         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
11143         ;;
11144     *)
11145         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
11146         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
11147         ;;
11148 esac
11149 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
11150 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
11152 if test "$COM" = "MSC"; then # override the above
11153     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
11154     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
11157 if test "$with_system_harfbuzz" = "yes"; then
11158     if test "$with_system_graphite" = "no"; then
11159         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
11160     fi
11161     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
11162     save_LIBS="$LIBS"
11163     save_CFLAGS="$CFLAGS"
11164     LIBS="$LIBS $HARFBUZZ_LIBS"
11165     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
11166     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
11167     LIBS="$save_LIBS"
11168     CFLAGS="$save_CFLAGS"
11169 else
11170     if test "$with_system_graphite" = "yes"; then
11171         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
11172     fi
11175 if test "$USING_X11" = TRUE; then
11176     AC_PATH_X
11177     AC_PATH_XTRA
11178     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
11180     if test -z "$x_includes"; then
11181         x_includes="default_x_includes"
11182     fi
11183     if test -z "$x_libraries"; then
11184         x_libraries="default_x_libraries"
11185     fi
11186     CFLAGS="$CFLAGS $X_CFLAGS"
11187     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
11188     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
11189 else
11190     x_includes="no_x_includes"
11191     x_libraries="no_x_libraries"
11194 if test "$USING_X11" = TRUE; then
11195     dnl ===================================================================
11196     dnl Check for extension headers
11197     dnl ===================================================================
11198     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
11199      [#include <X11/extensions/shape.h>])
11201     # vcl needs ICE and SM
11202     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
11203     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
11204         [AC_MSG_ERROR(ICE library not found)])
11205     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
11206     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
11207         [AC_MSG_ERROR(SM library not found)])
11210 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
11211     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
11212     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11215 dnl ===================================================================
11216 dnl Check for system Xrender
11217 dnl ===================================================================
11218 AC_MSG_CHECKING([whether to use Xrender])
11219 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11220     AC_MSG_RESULT([yes])
11221     PKG_CHECK_MODULES(XRENDER, xrender)
11222     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11223     FilterLibs "${XRENDER_LIBS}"
11224     XRENDER_LIBS="${filteredlibs}"
11225     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11226       [AC_MSG_ERROR(libXrender not found or functional)], [])
11227     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11228       [AC_MSG_ERROR(Xrender not found. install X)], [])
11229 else
11230     AC_MSG_RESULT([no])
11232 AC_SUBST(XRENDER_CFLAGS)
11233 AC_SUBST(XRENDER_LIBS)
11235 dnl ===================================================================
11236 dnl Check for XRandr
11237 dnl ===================================================================
11238 AC_MSG_CHECKING([whether to enable RandR support])
11239 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11240     AC_MSG_RESULT([yes])
11241     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11242     if test "$ENABLE_RANDR" != "TRUE"; then
11243         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11244                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11245         XRANDR_CFLAGS=" "
11246         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11247           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11248         XRANDR_LIBS="-lXrandr "
11249         ENABLE_RANDR="TRUE"
11250     fi
11251     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11252     FilterLibs "${XRANDR_LIBS}"
11253     XRANDR_LIBS="${filteredlibs}"
11254 else
11255     ENABLE_RANDR=""
11256     AC_MSG_RESULT([no])
11258 AC_SUBST(XRANDR_CFLAGS)
11259 AC_SUBST(XRANDR_LIBS)
11260 AC_SUBST(ENABLE_RANDR)
11262 if test -z "$with_webdav"; then
11263     with_webdav=$test_webdav
11266 AC_MSG_CHECKING([for WebDAV support])
11267 case "$with_webdav" in
11269     AC_MSG_RESULT([no])
11270     WITH_WEBDAV=""
11271     ;;
11273     AC_MSG_RESULT([yes])
11274     # curl is already mandatory (almost) and checked elsewhere
11275     if test "$enable_curl" = "no"; then
11276         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11277     fi
11278     WITH_WEBDAV=TRUE
11279     ;;
11280 esac
11281 AC_SUBST(WITH_WEBDAV)
11283 dnl ===================================================================
11284 dnl Check for disabling cve_tests
11285 dnl ===================================================================
11286 AC_MSG_CHECKING([whether to execute CVE tests])
11287 if test "$enable_cve_tests" = "no"; then
11288     AC_MSG_RESULT([no])
11289     DISABLE_CVE_TESTS=TRUE
11290     AC_SUBST(DISABLE_CVE_TESTS)
11291 else
11292     AC_MSG_RESULT([yes])
11295 dnl ===================================================================
11296 dnl Check for system openssl
11297 dnl ===================================================================
11298 ENABLE_OPENSSL=
11299 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11300 if test "$enable_openssl" = "yes"; then
11301     AC_MSG_RESULT([no])
11302     ENABLE_OPENSSL=TRUE
11303     if test "$_os" = Darwin ; then
11304         # OpenSSL is deprecated when building for 10.7 or later.
11305         #
11306         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11307         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11309         with_system_openssl=no
11310         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11311     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11312             && test "$with_system_openssl" != "no"; then
11313         with_system_openssl=yes
11314         SYSTEM_OPENSSL=TRUE
11315         OPENSSL_CFLAGS=
11316         OPENSSL_LIBS="-lssl -lcrypto"
11317     else
11318         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11319         if test -n "${SYSTEM_OPENSSL}"; then
11320             AC_DEFINE([SYSTEM_OPENSSL])
11321         fi
11322     fi
11323     if test "$with_system_openssl" = "yes"; then
11324         AC_MSG_CHECKING([whether openssl supports SHA512])
11325         AC_LANG_PUSH([C])
11326         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11327             SHA512_CTX context;
11328 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11329         AC_LANG_POP(C)
11330     fi
11331 else
11332     AC_MSG_RESULT([yes])
11334     # warn that although OpenSSL is disabled, system libraries may depend on it
11335     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11336     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11339 AC_SUBST([ENABLE_OPENSSL])
11341 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11342     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11343         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11344         enable_cipher_openssl_backend=no
11345     else
11346         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11347     fi
11349 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11350 ENABLE_CIPHER_OPENSSL_BACKEND=
11351 if test "$enable_cipher_openssl_backend" = yes; then
11352     AC_MSG_RESULT([yes])
11353     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11354 else
11355     AC_MSG_RESULT([no])
11357 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11359 dnl ===================================================================
11360 dnl Select the crypto backends used by LO
11361 dnl ===================================================================
11363 if test "$build_crypto" = yes; then
11364     if test "$OS" = WNT; then
11365         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11366         AC_DEFINE([USE_CRYPTO_MSCAPI])
11367     elif test "$ENABLE_NSS" = TRUE; then
11368         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11369         AC_DEFINE([USE_CRYPTO_NSS])
11370     fi
11373 ARGON2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/argon2/include"
11374 if test "$COM" = "MSC"; then
11375     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/vs2015/build/Argon2OptDll.lib"
11376 else
11377     ARGON2_LIBS_internal="${WORKDIR}/UnpackedTarball/argon2/libargon2.a"
11379 libo_CHECK_SYSTEM_MODULE([argon2],[ARGON2],[libargon2])
11381 dnl ===================================================================
11382 dnl Check for system redland
11383 dnl ===================================================================
11384 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11385 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11386 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11387 if test "$with_system_redland" = "yes"; then
11388     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11389             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11390 else
11391     RAPTOR_MAJOR="0"
11392     RASQAL_MAJOR="3"
11393     REDLAND_MAJOR="0"
11395 AC_SUBST(RAPTOR_MAJOR)
11396 AC_SUBST(RASQAL_MAJOR)
11397 AC_SUBST(REDLAND_MAJOR)
11399 dnl ===================================================================
11400 dnl Check for system hunspell
11401 dnl ===================================================================
11402 AC_MSG_CHECKING([which libhunspell to use])
11403 if test "$with_system_hunspell" = "yes"; then
11404     AC_MSG_RESULT([external])
11405     SYSTEM_HUNSPELL=TRUE
11406     AC_LANG_PUSH([C++])
11407     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11408     if test "$HUNSPELL_PC" != "TRUE"; then
11409         AC_CHECK_HEADER(hunspell.hxx, [],
11410             [
11411             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11412             [AC_MSG_ERROR(hunspell headers not found.)], [])
11413             ], [])
11414         AC_CHECK_LIB([hunspell], [main], [:],
11415            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11416         HUNSPELL_LIBS=-lhunspell
11417     fi
11418     AC_LANG_POP([C++])
11419     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11420     FilterLibs "${HUNSPELL_LIBS}"
11421     HUNSPELL_LIBS="${filteredlibs}"
11422 else
11423     AC_MSG_RESULT([internal])
11424     SYSTEM_HUNSPELL=
11425     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11426     if test "$COM" = "MSC"; then
11427         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11428     else
11429         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11430     fi
11431     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11433 AC_SUBST(SYSTEM_HUNSPELL)
11434 AC_SUBST(HUNSPELL_CFLAGS)
11435 AC_SUBST(HUNSPELL_LIBS)
11437 dnl ===================================================================
11438 dnl Check for system zxcvbn
11439 dnl ===================================================================
11440 AC_MSG_CHECKING([which zxcvbn to use])
11441 if test "$with_system_zxcvbn" = "yes"; then
11442     AC_MSG_RESULT([external])
11443     SYSTEM_ZXCVBN=TRUE
11444     AC_CHECK_HEADER(zxcvbn.h, [],
11445        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11446     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11447         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11448 else
11449    AC_MSG_RESULT([internal])
11450    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11451    SYSTEM_ZXCVBN=
11453 AC_SUBST(SYSTEM_ZXCVBN)
11455 dnl ===================================================================
11456 dnl Check for system zxing
11457 dnl ===================================================================
11458 AC_MSG_CHECKING([whether to use zxing])
11459 if test "$enable_zxing" = "no"; then
11460     AC_MSG_RESULT([no])
11461     ENABLE_ZXING=
11462     SYSTEM_ZXING=
11463 else
11464     AC_MSG_RESULT([yes])
11465     ENABLE_ZXING=TRUE
11466     AC_MSG_CHECKING([which libzxing to use])
11467     if test "$with_system_zxing" = "yes"; then
11468         AC_MSG_RESULT([external])
11469         SYSTEM_ZXING=TRUE
11470         ZXING_CFLAGS=
11471         AC_LANG_PUSH([C++])
11472         save_CXXFLAGS=$CXXFLAGS
11473         save_IFS=$IFS
11474         IFS=$P_SEP
11475         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11476             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11477             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11478             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11479             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11480             dnl unsetting IFS."):
11481             IFS=$save_IFS
11482             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11483             dnl ignore them here:
11484             if test -z "$i"; then
11485                 continue
11486             fi
11487             dnl TODO: White space in $i would cause problems:
11488             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11489             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11490                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11491         done
11492         CXXFLAGS=$save_CXXFLAGS
11493         if test -z "$ZXING_CFLAGS"; then
11494             AC_MSG_ERROR(zxing headers not found.)
11495         fi
11496         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11497             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11498             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11499         AC_LANG_POP([C++])
11500         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11501         FilterLibs "${ZXING_LIBS}"
11502         ZXING_LIBS="${filteredlibs}"
11503     else
11504         AC_MSG_RESULT([internal])
11505         SYSTEM_ZXING=
11506         BUILD_TYPE="$BUILD_TYPE ZXING"
11507         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11508     fi
11509     if test "$ENABLE_ZXING" = TRUE; then
11510         AC_DEFINE(ENABLE_ZXING)
11511     fi
11512     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11513     AC_LANG_PUSH([C++])
11514     save_CXXFLAGS=$CXXFLAGS
11515     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11516     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11517             #include <BitMatrix.h>
11518             #include <BitMatrixIO.h>
11519             int main(){
11520                 ZXing::BitMatrix matrix(1, 1);
11521                 matrix.set(0, 0, true);
11522                 ZXing::ToSVG(matrix);
11523                 return 0;
11524             }
11525         ])], [
11526             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11527             AC_MSG_RESULT([yes])
11528         ], [AC_MSG_RESULT([no])])
11529     CXXFLAGS=$save_CXXFLAGS
11530     AC_LANG_POP([C++])
11531     AC_SUBST(HAVE_ZXING_TOSVG)
11533 AC_SUBST(SYSTEM_ZXING)
11534 AC_SUBST(ENABLE_ZXING)
11535 AC_SUBST(ZXING_CFLAGS)
11536 AC_SUBST(ZXING_LIBS)
11538 dnl ===================================================================
11539 dnl Check for system box2d
11540 dnl ===================================================================
11541 AC_MSG_CHECKING([which box2d to use])
11542 if test "$with_system_box2d" = "yes"; then
11543     AC_MSG_RESULT([external])
11544     SYSTEM_BOX2D=TRUE
11545     AC_LANG_PUSH([C++])
11546     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11547         [BOX2D_H_FOUND='FALSE'])
11548     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11549         _BOX2D_LIB=box2d
11550         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11551     else
11552         # fail this. there's no other alternative to check when we are here.
11553         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11554             [AC_MSG_ERROR(box2d headers not found.)])
11555         _BOX2D_LIB=Box2D
11556         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11557     fi
11558     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11559         [ AC_MSG_ERROR(box2d library not found.) ], [])
11560     BOX2D_LIBS=-l$_BOX2D_LIB
11561     AC_LANG_POP([C++])
11562     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11563     FilterLibs "${BOX2D_LIBS}"
11564     BOX2D_LIBS="${filteredlibs}"
11565 else
11566     AC_MSG_RESULT([internal])
11567     SYSTEM_BOX2D=
11568     BUILD_TYPE="$BUILD_TYPE BOX2D"
11570 AC_SUBST(SYSTEM_BOX2D)
11571 AC_SUBST(BOX2D_CFLAGS)
11572 AC_SUBST(BOX2D_LIBS)
11574 dnl ===================================================================
11575 dnl Checking for altlinuxhyph
11576 dnl ===================================================================
11577 AC_MSG_CHECKING([which altlinuxhyph to use])
11578 if test "$with_system_altlinuxhyph" = "yes"; then
11579     AC_MSG_RESULT([external])
11580     SYSTEM_HYPH=TRUE
11581     AC_CHECK_HEADER(hyphen.h, [],
11582        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11583     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11584        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11585        [#include <hyphen.h>])
11586     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11587         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11588     if test -z "$HYPHEN_LIB"; then
11589         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11590            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11591     fi
11592     if test -z "$HYPHEN_LIB"; then
11593         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11594            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11595     fi
11596 else
11597     AC_MSG_RESULT([internal])
11598     SYSTEM_HYPH=
11599     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11600     if test "$COM" = "MSC"; then
11601         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11602     else
11603         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11604     fi
11606 AC_SUBST(SYSTEM_HYPH)
11607 AC_SUBST(HYPHEN_LIB)
11609 dnl ===================================================================
11610 dnl Checking for mythes
11611 dnl ===================================================================
11612 AC_MSG_CHECKING([which mythes to use])
11613 if test "$with_system_mythes" = "yes"; then
11614     AC_MSG_RESULT([external])
11615     SYSTEM_MYTHES=TRUE
11616     AC_LANG_PUSH([C++])
11617     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11618     if test "$MYTHES_PKGCONFIG" = "no"; then
11619         AC_CHECK_HEADER(mythes.hxx, [],
11620             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11621         AC_CHECK_LIB([mythes-1.2], [main], [:],
11622             [ MYTHES_FOUND=no], [])
11623     if test "$MYTHES_FOUND" = "no"; then
11624         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11625                 [ MYTHES_FOUND=no], [])
11626     fi
11627     if test "$MYTHES_FOUND" = "no"; then
11628         AC_MSG_ERROR([mythes library not found!.])
11629     fi
11630     fi
11631     AC_LANG_POP([C++])
11632     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11633     FilterLibs "${MYTHES_LIBS}"
11634     MYTHES_LIBS="${filteredlibs}"
11635 else
11636     AC_MSG_RESULT([internal])
11637     SYSTEM_MYTHES=
11638     BUILD_TYPE="$BUILD_TYPE MYTHES"
11639     if test "$COM" = "MSC"; then
11640         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11641     else
11642         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11643     fi
11645 AC_SUBST(SYSTEM_MYTHES)
11646 AC_SUBST(MYTHES_CFLAGS)
11647 AC_SUBST(MYTHES_LIBS)
11649 dnl ===================================================================
11650 dnl How should we build the linear programming solver ?
11651 dnl ===================================================================
11653 ENABLE_COINMP=
11654 AC_MSG_CHECKING([whether to build with CoinMP])
11655 if test "$enable_coinmp" != "no"; then
11656     ENABLE_COINMP=TRUE
11657     AC_MSG_RESULT([yes])
11658     if test "$with_system_coinmp" = "yes"; then
11659         SYSTEM_COINMP=TRUE
11660         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11661         FilterLibs "${COINMP_LIBS}"
11662         COINMP_LIBS="${filteredlibs}"
11663     else
11664         BUILD_TYPE="$BUILD_TYPE COINMP"
11665     fi
11666 else
11667     AC_MSG_RESULT([no])
11669 AC_SUBST(ENABLE_COINMP)
11670 AC_SUBST(SYSTEM_COINMP)
11671 AC_SUBST(COINMP_CFLAGS)
11672 AC_SUBST(COINMP_LIBS)
11674 ENABLE_LPSOLVE=
11675 AC_MSG_CHECKING([whether to build with lpsolve])
11676 if test "$enable_lpsolve" != "no"; then
11677     ENABLE_LPSOLVE=TRUE
11678     AC_MSG_RESULT([yes])
11679 else
11680     AC_MSG_RESULT([no])
11682 AC_SUBST(ENABLE_LPSOLVE)
11684 if test "$ENABLE_LPSOLVE" = TRUE; then
11685     AC_MSG_CHECKING([which lpsolve to use])
11686     if test "$with_system_lpsolve" = "yes"; then
11687         AC_MSG_RESULT([external])
11688         SYSTEM_LPSOLVE=TRUE
11689         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11690            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11691         save_LIBS=$LIBS
11692         # some systems need this. Like Ubuntu...
11693         AC_CHECK_LIB(m, floor)
11694         AC_CHECK_LIB(dl, dlopen)
11695         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11696             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11697         LIBS=$save_LIBS
11698     else
11699         AC_MSG_RESULT([internal])
11700         SYSTEM_LPSOLVE=
11701         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11702     fi
11704 AC_SUBST(SYSTEM_LPSOLVE)
11706 dnl ===================================================================
11707 dnl Checking for libexttextcat
11708 dnl ===================================================================
11709 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11710 if test "$with_system_libexttextcat" = "yes"; then
11711     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11713 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11715 dnl ===================================================================
11716 dnl Checking for libnumbertext
11717 dnl ===================================================================
11718 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11719 if test "$with_system_libnumbertext" = "yes"; then
11720     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11721     SYSTEM_LIBNUMBERTEXT=YES
11722 else
11723     SYSTEM_LIBNUMBERTEXT=
11725 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11726 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11728 dnl ***************************************
11729 dnl testing libc version for Linux...
11730 dnl ***************************************
11731 if test "$_os" = "Linux"; then
11732     AC_MSG_CHECKING([whether the libc is recent enough])
11733     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11734     #include <features.h>
11735     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11736     #error glibc >= 2.1 is required
11737     #endif
11738     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11741 dnl =========================================
11742 dnl Check for uuidgen
11743 dnl =========================================
11744 if test "$_os" = "WINNT"; then
11745     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11746     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11747     UUIDGEN=uuidgen.exe
11748     AC_SUBST(UUIDGEN)
11749 else
11750     AC_PATH_PROG([UUIDGEN], [uuidgen])
11751     if test -z "$UUIDGEN"; then
11752         AC_MSG_WARN([uuid is needed for building installation sets])
11753     fi
11756 dnl ***************************************
11757 dnl Checking for bison and flex
11758 dnl ***************************************
11759 AC_PATH_PROG(BISON, bison)
11760 if test -z "$BISON"; then
11761     AC_MSG_ERROR([no bison found in \$PATH, install it])
11762 else
11763     AC_MSG_CHECKING([the bison version])
11764     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11765     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11766     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11767     dnl cause
11768     dnl
11769     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]
11770     dnl   typedef union YYSTYPE
11771     dnl           ~~~~~~^~~~~~~
11772     dnl
11773     dnl while at least 3.4.1 is know to be good:
11774     if test "$COMPILER_PLUGINS" = TRUE; then
11775         if test "$_bison_longver" -lt 2004; then
11776             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11777         fi
11778     else
11779         if test "$_bison_longver" -lt 2000; then
11780             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11781         fi
11782     fi
11784 AC_SUBST([BISON])
11786 AC_PATH_PROG(FLEX, flex)
11787 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11788     FLEX=`cygpath -m $FLEX`
11790 if test -z "$FLEX"; then
11791     AC_MSG_ERROR([no flex found in \$PATH, install it])
11792 else
11793     AC_MSG_CHECKING([the flex version])
11794     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11795     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11796         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11797     fi
11799 AC_SUBST([FLEX])
11801 AC_PATH_PROG(DIFF, diff)
11802 if test -z "$DIFF"; then
11803     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11805 AC_SUBST([DIFF])
11807 AC_PATH_PROG(UNIQ, uniq)
11808 if test -z "$UNIQ"; then
11809     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11811 AC_SUBST([UNIQ])
11813 dnl ***************************************
11814 dnl Checking for patch
11815 dnl ***************************************
11816 AC_PATH_PROG(PATCH, patch)
11817 if test -z "$PATCH"; then
11818     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11821 dnl On Solaris or macOS, check if --with-gnu-patch was used
11822 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11823     if test -z "$with_gnu_patch"; then
11824         GNUPATCH=$PATCH
11825     else
11826         if test -x "$with_gnu_patch"; then
11827             GNUPATCH=$with_gnu_patch
11828         else
11829             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11830         fi
11831     fi
11833     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11834     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11835         AC_MSG_RESULT([yes])
11836     else
11837         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11838             AC_MSG_RESULT([no, but accepted (Apple patch)])
11839             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11840         else
11841             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11842         fi
11843     fi
11844 else
11845     GNUPATCH=$PATCH
11848 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11849     GNUPATCH=`cygpath -m $GNUPATCH`
11852 dnl We also need to check for --with-gnu-cp
11854 if test -z "$with_gnu_cp"; then
11855     # check the place where the good stuff is hidden on Solaris...
11856     if test -x /usr/gnu/bin/cp; then
11857         GNUCP=/usr/gnu/bin/cp
11858     else
11859         AC_PATH_PROGS(GNUCP, gnucp cp)
11860     fi
11861     if test -z $GNUCP; then
11862         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11863     fi
11864 else
11865     if test -x "$with_gnu_cp"; then
11866         GNUCP=$with_gnu_cp
11867     else
11868         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11869     fi
11872 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11873     GNUCP=`cygpath -m $GNUCP`
11876 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11877 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11878     AC_MSG_RESULT([yes])
11879 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11880     AC_MSG_RESULT([yes])
11881 else
11882     case "$build_os" in
11883     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11884         x_GNUCP=[\#]
11885         GNUCP=''
11886         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11887         ;;
11888     *)
11889         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11890         ;;
11891     esac
11894 AC_SUBST(GNUPATCH)
11895 AC_SUBST(GNUCP)
11896 AC_SUBST(x_GNUCP)
11898 dnl ***************************************
11899 dnl testing assembler path
11900 dnl ***************************************
11901 ML_EXE=""
11902 if test "$_os" = "WINNT"; then
11903     case "$WIN_HOST_ARCH" in
11904     x86) assembler=ml.exe ;;
11905     x64) assembler=ml64.exe ;;
11906     arm64) assembler=armasm64.exe ;;
11907     esac
11909     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11910     if test -f "$MSVC_HOST_PATH/$assembler"; then
11911         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11912         AC_MSG_RESULT([$ML_EXE])
11913     else
11914         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11915     fi
11918 AC_SUBST(ML_EXE)
11920 dnl ===================================================================
11921 dnl We need zip and unzip
11922 dnl ===================================================================
11923 AC_PATH_PROG(ZIP, zip)
11924 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11925 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11926     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],,)
11929 AC_PATH_PROG(UNZIP, unzip)
11930 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11932 dnl ===================================================================
11933 dnl Zip must be a specific type for different build types.
11934 dnl ===================================================================
11935 if test $build_os = cygwin; then
11936     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11937         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11938     fi
11941 dnl ===================================================================
11942 dnl We need touch with -h option support.
11943 dnl ===================================================================
11944 AC_PATH_PROG(TOUCH, touch)
11945 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11946 touch "$WARNINGS_FILE"
11947 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11948     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],,)
11951 dnl ===================================================================
11952 dnl Check for system epoxy
11953 dnl ===================================================================
11954 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11955 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11957 dnl ===================================================================
11958 dnl Show which vclplugs will be built.
11959 dnl ===================================================================
11960 R=""
11962 libo_ENABLE_VCLPLUG([gen])
11963 libo_ENABLE_VCLPLUG([gtk3])
11964 libo_ENABLE_VCLPLUG([gtk3_kde5])
11965 libo_ENABLE_VCLPLUG([gtk4])
11966 libo_ENABLE_VCLPLUG([kf5])
11967 libo_ENABLE_VCLPLUG([kf6])
11968 libo_ENABLE_VCLPLUG([qt5])
11969 libo_ENABLE_VCLPLUG([qt6])
11971 if test "$_os" = "WINNT"; then
11972     R="$R win"
11973 elif test "$_os" = "Darwin"; then
11974     R="$R osx"
11975 elif test "$_os" = "iOS"; then
11976     R="ios"
11977 elif test "$_os" = Android; then
11978     R="android"
11981 build_vcl_plugins="$R"
11982 if test -z "$build_vcl_plugins"; then
11983     build_vcl_plugins=" none"
11985 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11986 VCL_PLUGIN_INFO=$R
11987 AC_SUBST([VCL_PLUGIN_INFO])
11989 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11990     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11993 dnl ===================================================================
11994 dnl Check for GTK libraries
11995 dnl ===================================================================
11997 GTK3_CFLAGS=""
11998 GTK3_LIBS=""
11999 ENABLE_GTKTILEDVIEWER=""
12000 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
12001     if test "$with_system_cairo" = no; then
12002         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.'
12003     fi
12004     : ${with_system_cairo:=yes}
12005     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)
12006     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12007     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12008     FilterLibs "${GTK3_LIBS}"
12009     GTK3_LIBS="${filteredlibs}"
12011     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
12012     if test "$with_system_epoxy" != "yes"; then
12013         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12014         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12015                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12016     fi
12017 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
12018     PathFormat "${with_gtk3_build}/lib/pkgconfig"
12019     if test "$build_os" = "cygwin"; then
12020         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
12021         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
12022     fi
12024     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
12025     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
12026     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12027     FilterLibs "${GTK3_LIBS}"
12028     GTK3_LIBS="${filteredlibs}"
12029     ENABLE_GTKTILEDVIEWER="yes"
12031 AC_SUBST(GTK3_LIBS)
12032 AC_SUBST(GTK3_CFLAGS)
12033 AC_SUBST(ENABLE_GTKTILEDVIEWER)
12035 GTK4_CFLAGS=""
12036 GTK4_LIBS=""
12037 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
12038     if test "$with_system_cairo" = no; then
12039         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
12040     fi
12041     : ${with_system_cairo:=yes}
12042     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
12043     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12044     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
12045     FilterLibs "${GTK4_LIBS}"
12046     GTK4_LIBS="${filteredlibs}"
12048     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
12049     if test "$with_system_epoxy" != "yes"; then
12050         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
12051         AC_CHECK_HEADER(EGL/eglplatform.h, [],
12052                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
12053     fi
12055 AC_SUBST(GTK4_LIBS)
12056 AC_SUBST(GTK4_CFLAGS)
12058 if test "$enable_introspection" = yes; then
12059     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12060         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
12061     else
12062         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
12063     fi
12066 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
12067 if ! test "$ENABLE_GTK3" = TRUE; then
12068     if test "$enable_atspi_tests" = yes; then
12069         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
12070     fi
12071     enable_atspi_tests=no
12073 if ! test "$enable_atspi_tests" = no; then
12074     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
12075     if ! test "$XVFB_RUN" = no; then
12076         dnl make sure the found xvfb-run actually works
12077         AC_MSG_CHECKING([whether $XVFB_RUN works...])
12078         if $XVFB_RUN --auto-servernum true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
12079             AC_MSG_RESULT([yes])
12080         else
12081             AC_MSG_RESULT([no])
12082             XVFB_RUN=no
12083         fi
12084     fi
12085     if test "$XVFB_RUN" = no; then
12086         if test "$enable_atspi_tests" = yes; then
12087             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
12088         fi
12089         enable_atspi_tests=no
12090     fi
12092 if ! test "$enable_atspi_tests" = no; then
12093     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
12094     if test "$DBUS_LAUNCH" = no; then
12095         if test "$enable_atspi_tests" = yes; then
12096             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
12097         fi
12098         enable_atspi_tests=no
12099     fi
12101 if ! test "$enable_atspi_tests" = no; then
12102     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
12103                       [if test "$enable_atspi_tests" = yes; then
12104                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
12105                        else
12106                            enable_atspi_tests=no
12107                        fi])
12109 if ! test "x$enable_atspi_tests" = xno; then
12110     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
12111                       [have_atspi_scroll_to=1],
12112                       [have_atspi_scroll_to=0])
12113     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
12114                        [Whether AT-SPI2 has the scrollTo API])
12116 ENABLE_ATSPI_TESTS=
12117 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
12118 AC_SUBST([ENABLE_ATSPI_TESTS])
12120 dnl ===================================================================
12121 dnl check for dbus support
12122 dnl ===================================================================
12123 ENABLE_DBUS=""
12124 DBUS_CFLAGS=""
12125 DBUS_LIBS=""
12126 DBUS_GLIB_CFLAGS=""
12127 DBUS_GLIB_LIBS=""
12128 DBUS_HAVE_GLIB=""
12130 if test "$enable_dbus" = "no"; then
12131     test_dbus=no
12134 AC_MSG_CHECKING([whether to enable DBUS support])
12135 if test "$test_dbus" = "yes"; then
12136     ENABLE_DBUS="TRUE"
12137     AC_MSG_RESULT([yes])
12138     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
12139     AC_DEFINE(ENABLE_DBUS)
12140     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12141     FilterLibs "${DBUS_LIBS}"
12142     DBUS_LIBS="${filteredlibs}"
12144     # Glib is needed for BluetoothServer
12145     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
12146     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
12147         [
12148             DBUS_HAVE_GLIB="TRUE"
12149             AC_DEFINE(DBUS_HAVE_GLIB,1)
12150         ],
12151         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
12152     )
12153 else
12154     AC_MSG_RESULT([no])
12157 AC_SUBST(ENABLE_DBUS)
12158 AC_SUBST(DBUS_CFLAGS)
12159 AC_SUBST(DBUS_LIBS)
12160 AC_SUBST(DBUS_GLIB_CFLAGS)
12161 AC_SUBST(DBUS_GLIB_LIBS)
12162 AC_SUBST(DBUS_HAVE_GLIB)
12164 AC_MSG_CHECKING([whether to enable Impress remote control])
12165 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
12166     AC_MSG_RESULT([yes])
12167     ENABLE_SDREMOTE=TRUE
12168     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
12169         <true/>"
12170     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
12172     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
12173         # The Bluetooth code doesn't compile with macOS SDK 10.15
12174         if test "$enable_sdremote_bluetooth" = yes; then
12175             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
12176         fi
12177         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
12178         enable_sdremote_bluetooth=no
12179     fi
12180     # If not explicitly enabled or disabled, default
12181     if test -z "$enable_sdremote_bluetooth"; then
12182         case "$OS" in
12183         LINUX|MACOSX|WNT)
12184             # Default to yes for these
12185             enable_sdremote_bluetooth=yes
12186             ;;
12187         *)
12188             # otherwise no
12189             enable_sdremote_bluetooth=no
12190             ;;
12191         esac
12192     fi
12193     # $enable_sdremote_bluetooth is guaranteed non-empty now
12195     if test "$enable_sdremote_bluetooth" != "no"; then
12196         if test "$OS" = "LINUX"; then
12197             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
12198                 AC_MSG_RESULT([yes])
12199                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
12200                 dnl ===================================================================
12201                 dnl Check for system bluez
12202                 dnl ===================================================================
12203                 AC_MSG_CHECKING([which Bluetooth header to use])
12204                 if test "$with_system_bluez" = "yes"; then
12205                     AC_MSG_RESULT([external])
12206                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
12207                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12208                     SYSTEM_BLUEZ=TRUE
12209                 else
12210                     AC_MSG_RESULT([internal])
12211                     SYSTEM_BLUEZ=
12212                 fi
12213             else
12214                 AC_MSG_RESULT([no, dbus disabled])
12215                 ENABLE_SDREMOTE_BLUETOOTH=
12216                 SYSTEM_BLUEZ=
12217             fi
12218         else
12219             AC_MSG_RESULT([yes])
12220             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12221             SYSTEM_BLUEZ=
12222             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12223         <key>com.apple.security.device.bluetooth</key>
12224         <true/>"
12225         fi
12226     else
12227         AC_MSG_RESULT([no])
12228         ENABLE_SDREMOTE_BLUETOOTH=
12229         SYSTEM_BLUEZ=
12230     fi
12231 else
12232     ENABLE_SDREMOTE=
12233     SYSTEM_BLUEZ=
12234     AC_MSG_RESULT([no])
12236 AC_SUBST(ENABLE_SDREMOTE)
12237 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12238 AC_SUBST(SDREMOTE_ENTITLEMENT)
12239 AC_SUBST(SYSTEM_BLUEZ)
12241 dnl ===================================================================
12242 dnl Check whether to enable GIO support
12243 dnl ===================================================================
12244 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12245     AC_MSG_CHECKING([whether to enable GIO support])
12246     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12247         dnl Need at least 2.26 for the dbus support.
12248         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12249                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12250         if test "$ENABLE_GIO" = "TRUE"; then
12251             AC_DEFINE(ENABLE_GIO)
12252             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12253             FilterLibs "${GIO_LIBS}"
12254             GIO_LIBS="${filteredlibs}"
12255         fi
12256     else
12257         AC_MSG_RESULT([no])
12258     fi
12260 AC_SUBST(ENABLE_GIO)
12261 AC_SUBST(GIO_CFLAGS)
12262 AC_SUBST(GIO_LIBS)
12265 dnl ===================================================================
12267 SPLIT_APP_MODULES=""
12268 if test "$enable_split_app_modules" = "yes"; then
12269     SPLIT_APP_MODULES="TRUE"
12271 AC_SUBST(SPLIT_APP_MODULES)
12273 SPLIT_OPT_FEATURES=""
12274 if test "$enable_split_opt_features" = "yes"; then
12275     SPLIT_OPT_FEATURES="TRUE"
12277 AC_SUBST(SPLIT_OPT_FEATURES)
12279 dnl ===================================================================
12280 dnl Check whether the GStreamer libraries are available.
12281 dnl ===================================================================
12283 ENABLE_GSTREAMER_1_0=""
12285 if test "$test_gstreamer_1_0" = yes; then
12287     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12288     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12289         ENABLE_GSTREAMER_1_0="TRUE"
12290         AC_MSG_RESULT([yes])
12291         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12292         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12293         FilterLibs "${GSTREAMER_1_0_LIBS}"
12294         GSTREAMER_1_0_LIBS="${filteredlibs}"
12295         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12296     else
12297         AC_MSG_RESULT([no])
12298     fi
12300 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12301 AC_SUBST(GSTREAMER_1_0_LIBS)
12302 AC_SUBST(ENABLE_GSTREAMER_1_0)
12304 ENABLE_OPENGL_TRANSITIONS=
12305 ENABLE_OPENGL_CANVAS=
12306 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12307    : # disable
12308 elif test "$_os" = "Darwin"; then
12309     # We use frameworks on macOS, no need for detail checks
12310     ENABLE_OPENGL_TRANSITIONS=TRUE
12311     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12312     ENABLE_OPENGL_CANVAS=TRUE
12313 elif test $_os = WINNT; then
12314     ENABLE_OPENGL_TRANSITIONS=TRUE
12315     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12316     ENABLE_OPENGL_CANVAS=TRUE
12317 else
12318     if test "$USING_X11" = TRUE; then
12319         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12320         ENABLE_OPENGL_TRANSITIONS=TRUE
12321         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12322         ENABLE_OPENGL_CANVAS=TRUE
12323     fi
12326 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12327 AC_SUBST(ENABLE_OPENGL_CANVAS)
12329 dnl =================================================
12330 dnl Check whether to build with OpenCL support.
12331 dnl =================================================
12333 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12334     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12335     # platform (optional at run-time, used through clew).
12336     BUILD_TYPE="$BUILD_TYPE OPENCL"
12337     AC_DEFINE(HAVE_FEATURE_OPENCL)
12340 dnl =================================================
12341 dnl Check whether to build with dconf support.
12342 dnl =================================================
12344 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12345     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12346         if test "$enable_dconf" = yes; then
12347             AC_MSG_ERROR([dconf not found])
12348         else
12349             enable_dconf=no
12350         fi])
12352 AC_MSG_CHECKING([whether to enable dconf])
12353 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12354     DCONF_CFLAGS=
12355     DCONF_LIBS=
12356     ENABLE_DCONF=
12357     AC_MSG_RESULT([no])
12358 else
12359     ENABLE_DCONF=TRUE
12360     AC_DEFINE(ENABLE_DCONF)
12361     AC_MSG_RESULT([yes])
12363 AC_SUBST([DCONF_CFLAGS])
12364 AC_SUBST([DCONF_LIBS])
12365 AC_SUBST([ENABLE_DCONF])
12367 # pdf import?
12368 AC_MSG_CHECKING([whether to build the PDF import feature])
12369 ENABLE_PDFIMPORT=
12370 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12371     AC_MSG_RESULT([yes])
12372     ENABLE_PDFIMPORT=TRUE
12373     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12374 else
12375     AC_MSG_RESULT([no])
12378 # Pdfium?
12379 AC_MSG_CHECKING([whether to build PDFium])
12380 ENABLE_PDFIUM=
12381 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12382     AC_MSG_RESULT([yes])
12383     ENABLE_PDFIUM=TRUE
12384     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12385 else
12386     AC_MSG_RESULT([no])
12388 AC_SUBST(ENABLE_PDFIUM)
12390 if test "$ENABLE_PDFIUM" = "TRUE"; then
12391     AC_MSG_CHECKING([which OpenJPEG library to use])
12392     if test "$with_system_openjpeg" = "yes"; then
12393         SYSTEM_OPENJPEG2=TRUE
12394         AC_MSG_RESULT([external])
12395         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12396         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12397         FilterLibs "${OPENJPEG2_LIBS}"
12398         OPENJPEG2_LIBS="${filteredlibs}"
12399     else
12400         SYSTEM_OPENJPEG2=FALSE
12401         AC_MSG_RESULT([internal])
12402     fi
12404     AC_MSG_CHECKING([which Abseil library to use])
12405     if test "$with_system_abseil" = "yes"; then
12406         AC_MSG_RESULT([external])
12407         SYSTEM_ABSEIL=TRUE
12408         AC_LANG_PUSH([C++])
12409         PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
12410         AC_LANG_POP([C++])
12411         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12412         FilterLibs "${ABSEIL_LIBS}"
12413         ABSEIL_LIBS="${filteredlibs}"
12414     else
12415         AC_MSG_RESULT([internal])
12416     fi
12418 AC_SUBST(SYSTEM_OPENJPEG2)
12419 AC_SUBST(SYSTEM_ABSEIL)
12420 AC_SUBST(ABSEIL_CFLAGS)
12421 AC_SUBST(ABSEIL_LIBS)
12423 dnl ===================================================================
12424 dnl Check for poppler
12425 dnl ===================================================================
12426 ENABLE_POPPLER=
12427 AC_MSG_CHECKING([whether to build Poppler])
12428 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12429     AC_MSG_RESULT([yes])
12430     ENABLE_POPPLER=TRUE
12431     AC_DEFINE(HAVE_FEATURE_POPPLER)
12432 else
12433     AC_MSG_RESULT([no])
12435 AC_SUBST(ENABLE_POPPLER)
12437 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12438     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12441 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12442     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12445 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12446     dnl ===================================================================
12447     dnl Check for system poppler
12448     dnl ===================================================================
12449     AC_MSG_CHECKING([which PDF import poppler to use])
12450     if test "$with_system_poppler" = "yes"; then
12451         AC_MSG_RESULT([external])
12452         SYSTEM_POPPLER=TRUE
12453         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12454         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12455         FilterLibs "${POPPLER_LIBS}"
12456         POPPLER_LIBS="${filteredlibs}"
12457     else
12458         AC_MSG_RESULT([internal])
12459         SYSTEM_POPPLER=
12460         BUILD_TYPE="$BUILD_TYPE POPPLER"
12461     fi
12462     AC_DEFINE([ENABLE_PDFIMPORT],1)
12464 AC_SUBST(ENABLE_PDFIMPORT)
12465 AC_SUBST(SYSTEM_POPPLER)
12466 AC_SUBST(POPPLER_CFLAGS)
12467 AC_SUBST(POPPLER_LIBS)
12469 # Skia?
12470 ENABLE_SKIA=
12471 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12472     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12473     if test "$SYSTEM_FREETYPE" = TRUE; then
12474         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12475             [skia_freetype_ok=yes],
12476             [skia_freetype_ok=no])
12477     else # internal is ok
12478         skia_freetype_ok=yes
12479     fi
12480     AC_MSG_CHECKING([whether to build Skia])
12481     if test "$skia_freetype_ok" = "yes"; then
12482         if test "$enable_skia" = "debug"; then
12483             AC_MSG_RESULT([yes (debug)])
12484             ENABLE_SKIA_DEBUG=TRUE
12485         else
12486             AC_MSG_RESULT([yes])
12487             ENABLE_SKIA_DEBUG=
12488         fi
12489         ENABLE_SKIA=TRUE
12490         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12491             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12492         fi
12494         AC_DEFINE(HAVE_FEATURE_SKIA)
12495         BUILD_TYPE="$BUILD_TYPE SKIA"
12497         if test "$OS" = "MACOSX"; then
12498             AC_DEFINE(SK_GANESH,1)
12499             AC_DEFINE(SK_METAL,1)
12500             SKIA_GPU=METAL
12501             AC_SUBST(SKIA_GPU)
12502         else
12503             AC_DEFINE(SK_GANESH,1)
12504             AC_DEFINE(SK_VULKAN,1)
12505             SKIA_GPU=VULKAN
12506             AC_SUBST(SKIA_GPU)
12507         fi
12508     else
12509         AC_MSG_RESULT([no (freetype too old)])
12510         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12511     fi
12513 else
12514     AC_MSG_CHECKING([whether to build Skia])
12515     AC_MSG_RESULT([no])
12517 AC_SUBST(ENABLE_SKIA)
12518 AC_SUBST(ENABLE_SKIA_DEBUG)
12520 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12521 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12522 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12523 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12524 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12525 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12526 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12527 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12528 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12529 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12530 LO_CLANG_VERSION=
12531 HAVE_LO_CLANG_DLLEXPORTINLINES=
12533 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12534     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12535         AC_MSG_CHECKING([for Clang])
12536         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12537     else
12538         if test "$_os" = "WINNT"; then
12539             AC_MSG_CHECKING([for clang-cl])
12540             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12541                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12542             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12543                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12544             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12545                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12546             fi
12547             if test -n "$LO_CLANG_CC"; then
12548                 dnl explicitly set -m32/-m64
12549                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12550                 LO_CLANG_CXX="$LO_CLANG_CC"
12551                 AC_MSG_RESULT([$LO_CLANG_CC])
12552             else
12553                 AC_MSG_RESULT([no])
12554             fi
12556             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12557             echo "#include <stdlib.h>" > conftest.c
12558             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12559                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12560             rm -f conftest.c conftest.obj
12561             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12562                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12563             else
12564                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12565             fi
12566         else
12567             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12568             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12569         fi
12570     fi
12571     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12572         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12573         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12574         if test "$LO_CLANG_VERSION" -lt 50002; then
12575             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12576             LO_CLANG_CC=
12577             LO_CLANG_CXX=
12578         fi
12579     fi
12580     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12581         save_CXX="$CXX"
12582         CXX="$LO_CLANG_CXX"
12583         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12584         AC_LANG_PUSH([C++])
12585         save_CXXFLAGS=$CXXFLAGS
12586         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12587         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12588                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12589                 AC_MSG_RESULT([yes])
12590             ], [AC_MSG_RESULT([no])])
12591         CXXFLAGS=$save_CXXFLAGS
12592         AC_LANG_POP([C++])
12593         CXX="$save_CXX"
12594         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12595             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.])
12596         fi
12597     fi
12598     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12599         # Skia is the default on Windows and Mac, so hard-require Clang.
12600         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12601         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12602             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12603         else
12604             AC_MSG_WARN([Clang compiler not found.])
12605         fi
12606     else
12608         save_CXX="$CXX"
12609         CXX="$LO_CLANG_CXX"
12610         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12611         flag_sse2=-msse2
12612         flag_ssse3=-mssse3
12613         flag_sse41=-msse4.1
12614         flag_sse42=-msse4.2
12615         flag_avx=-mavx
12616         flag_avx2=-mavx2
12617         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12618         flag_avx512f=-mavx512f
12619         flag_f16c=-mf16c
12620         flag_fma=-mfma
12622         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12623         AC_LANG_PUSH([C++])
12624         save_CXXFLAGS=$CXXFLAGS
12625         CXXFLAGS="$CXXFLAGS $flag_sse2"
12626         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12627             #include <emmintrin.h>
12628             int main () {
12629                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12630                 c = _mm_xor_si128 (a, b);
12631                 return 0;
12632             }
12633             ])],
12634             [can_compile_sse2=yes],
12635             [can_compile_sse2=no])
12636         AC_LANG_POP([C++])
12637         CXXFLAGS=$save_CXXFLAGS
12638         AC_MSG_RESULT([${can_compile_sse2}])
12639         if test "${can_compile_sse2}" = "yes" ; then
12640             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12641         fi
12643         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12644         AC_LANG_PUSH([C++])
12645         save_CXXFLAGS=$CXXFLAGS
12646         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12647         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12648             #include <tmmintrin.h>
12649             int main () {
12650                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12651                 c = _mm_maddubs_epi16 (a, b);
12652                 return 0;
12653             }
12654             ])],
12655             [can_compile_ssse3=yes],
12656             [can_compile_ssse3=no])
12657         AC_LANG_POP([C++])
12658         CXXFLAGS=$save_CXXFLAGS
12659         AC_MSG_RESULT([${can_compile_ssse3}])
12660         if test "${can_compile_ssse3}" = "yes" ; then
12661             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12662         fi
12664         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12665         AC_LANG_PUSH([C++])
12666         save_CXXFLAGS=$CXXFLAGS
12667         CXXFLAGS="$CXXFLAGS $flag_sse41"
12668         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12669             #include <smmintrin.h>
12670             int main () {
12671                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12672                 c = _mm_cmpeq_epi64 (a, b);
12673                 return 0;
12674             }
12675             ])],
12676             [can_compile_sse41=yes],
12677             [can_compile_sse41=no])
12678         AC_LANG_POP([C++])
12679         CXXFLAGS=$save_CXXFLAGS
12680         AC_MSG_RESULT([${can_compile_sse41}])
12681         if test "${can_compile_sse41}" = "yes" ; then
12682             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12683         fi
12685         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12686         AC_LANG_PUSH([C++])
12687         save_CXXFLAGS=$CXXFLAGS
12688         CXXFLAGS="$CXXFLAGS $flag_sse42"
12689         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12690             #include <nmmintrin.h>
12691             int main () {
12692                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12693                 c = _mm_cmpgt_epi64 (a, b);
12694                 return 0;
12695             }
12696             ])],
12697             [can_compile_sse42=yes],
12698             [can_compile_sse42=no])
12699         AC_LANG_POP([C++])
12700         CXXFLAGS=$save_CXXFLAGS
12701         AC_MSG_RESULT([${can_compile_sse42}])
12702         if test "${can_compile_sse42}" = "yes" ; then
12703             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12704         fi
12706         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12707         AC_LANG_PUSH([C++])
12708         save_CXXFLAGS=$CXXFLAGS
12709         CXXFLAGS="$CXXFLAGS $flag_avx"
12710         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12711             #include <immintrin.h>
12712             int main () {
12713                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12714                 c = _mm256_xor_ps(a, b);
12715                 return 0;
12716             }
12717             ])],
12718             [can_compile_avx=yes],
12719             [can_compile_avx=no])
12720         AC_LANG_POP([C++])
12721         CXXFLAGS=$save_CXXFLAGS
12722         AC_MSG_RESULT([${can_compile_avx}])
12723         if test "${can_compile_avx}" = "yes" ; then
12724             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12725         fi
12727         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12728         AC_LANG_PUSH([C++])
12729         save_CXXFLAGS=$CXXFLAGS
12730         CXXFLAGS="$CXXFLAGS $flag_avx2"
12731         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12732             #include <immintrin.h>
12733             int main () {
12734                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12735                 c = _mm256_maddubs_epi16(a, b);
12736                 return 0;
12737             }
12738             ])],
12739             [can_compile_avx2=yes],
12740             [can_compile_avx2=no])
12741         AC_LANG_POP([C++])
12742         CXXFLAGS=$save_CXXFLAGS
12743         AC_MSG_RESULT([${can_compile_avx2}])
12744         if test "${can_compile_avx2}" = "yes" ; then
12745             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12746         fi
12748         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12749         AC_LANG_PUSH([C++])
12750         save_CXXFLAGS=$CXXFLAGS
12751         CXXFLAGS="$CXXFLAGS $flag_avx512"
12752         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12753             #include <immintrin.h>
12754             int main () {
12755                 __m512i a = _mm512_loadu_si512(0);
12756                 __m512d v1 = _mm512_load_pd(0);
12757                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12758                 __m512d v2 = _mm512_abs_pd(v1);
12759                 return 0;
12760             }
12761             ])],
12762             [can_compile_avx512=yes],
12763             [can_compile_avx512=no])
12764         AC_LANG_POP([C++])
12765         CXXFLAGS=$save_CXXFLAGS
12766         AC_MSG_RESULT([${can_compile_avx512}])
12767         if test "${can_compile_avx512}" = "yes" ; then
12768             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12769             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12770         fi
12772         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12773         AC_LANG_PUSH([C++])
12774         save_CXXFLAGS=$CXXFLAGS
12775         CXXFLAGS="$CXXFLAGS $flag_f16c"
12776         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12777             #include <immintrin.h>
12778             int main () {
12779                 __m128i a = _mm_set1_epi32 (0);
12780                 __m128 c;
12781                 c = _mm_cvtph_ps(a);
12782                 return 0;
12783             }
12784             ])],
12785             [can_compile_f16c=yes],
12786             [can_compile_f16c=no])
12787         AC_LANG_POP([C++])
12788         CXXFLAGS=$save_CXXFLAGS
12789         AC_MSG_RESULT([${can_compile_f16c}])
12790         if test "${can_compile_f16c}" = "yes" ; then
12791             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12792         fi
12794         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12795         AC_LANG_PUSH([C++])
12796         save_CXXFLAGS=$CXXFLAGS
12797         CXXFLAGS="$CXXFLAGS $flag_fma"
12798         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12799             #include <immintrin.h>
12800             int main () {
12801                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12802                 d = _mm256_fmadd_ps(a, b, c);
12803                 return 0;
12804             }
12805             ])],
12806             [can_compile_fma=yes],
12807             [can_compile_fma=no])
12808         AC_LANG_POP([C++])
12809         CXXFLAGS=$save_CXXFLAGS
12810         AC_MSG_RESULT([${can_compile_fma}])
12811         if test "${can_compile_fma}" = "yes" ; then
12812             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12813         fi
12815         CXX="$save_CXX"
12816     fi
12819 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12821 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12822     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12823     AC_LANG_PUSH([C])
12824     save_CC="$CC"
12825     CC="$LO_CLANG_CC"
12826     save_CFLAGS=$CFLAGS
12827     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12828     dnl an empty program will do, we're checking the compiler flags
12829     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12830                       [use_ccache=yes], [use_ccache=no])
12831     CFLAGS=$save_CFLAGS
12832     CC=$save_CC
12833     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12834         AC_MSG_RESULT([yes])
12835     else
12836         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12837         AC_MSG_RESULT([no])
12838     fi
12839     AC_LANG_POP([C])
12841     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12842     AC_LANG_PUSH([C++])
12843     save_CXX="$CXX"
12844     CXX="$LO_CLANG_CXX"
12845     save_CXXFLAGS=$CXXFLAGS
12846     CXXFLAGS="$CXXFLAGS --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     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12851         AC_MSG_RESULT([yes])
12852     else
12853         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12854         AC_MSG_RESULT([no])
12855     fi
12856     CXXFLAGS=$save_CXXFLAGS
12857     CXX=$save_CXX
12858     AC_LANG_POP([C++])
12861 AC_SUBST(LO_CLANG_CC)
12862 AC_SUBST(LO_CLANG_CXX)
12863 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12864 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12865 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12866 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12867 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12868 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12869 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12870 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12871 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12872 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12873 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12874 AC_SUBST(LO_CLANG_VERSION)
12875 AC_SUBST(CLANG_USE_LD)
12876 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12878 SYSTEM_GPGMEPP=
12880 AC_MSG_CHECKING([whether to enable gpgmepp])
12881 if test "$enable_gpgmepp" = no; then
12882     AC_MSG_RESULT([no])
12883 elif test "$enable_mpl_subset" = "yes"; then
12884     AC_MSG_RESULT([no (MPL only)])
12885 elif test "$enable_fuzzers" = "yes"; then
12886     AC_MSG_RESULT([no (oss-fuzz)])
12887 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12888     AC_MSG_RESULT([yes])
12889     dnl ===================================================================
12890     dnl Check for system gpgme
12891     dnl ===================================================================
12892     AC_MSG_CHECKING([which gpgmepp to use])
12893     if test "$with_system_gpgmepp" = "yes"; then
12894         AC_MSG_RESULT([external])
12895         SYSTEM_GPGMEPP=TRUE
12897         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12898         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12899             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12900         AC_CHECK_HEADER(gpgme.h, [],
12901             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12902         AC_CHECK_LIB(gpgmepp, main, [],
12903             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12904         GPGMEPP_LIBS=-lgpgmepp
12905     else
12906         AC_MSG_RESULT([internal])
12907         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12909         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12910         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12911         if test "$_os" != "WINNT"; then
12912             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12913             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12914         fi
12915     fi
12916     ENABLE_GPGMEPP=TRUE
12917     AC_DEFINE([HAVE_FEATURE_GPGME])
12918     AC_PATH_PROG(GPG, gpg)
12919     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12920     # so let's exclude that manually for the moment
12921     if test -n "$GPG" -a "$_os" != "WINNT"; then
12922         # make sure we not only have a working gpgme, but a full working
12923         # gpg installation to run OpenPGP signature verification
12924         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12925     fi
12926     if test "$_os" = "Linux"; then
12927       uid=`id -u`
12928       AC_MSG_CHECKING([for /run/user/$uid])
12929       if test -d /run/user/$uid; then
12930         AC_MSG_RESULT([yes])
12931         AC_PATH_PROG(GPGCONF, gpgconf)
12933         # Older versions of gpgconf are not working as expected, since
12934         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12935         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12936         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12937         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12938         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12939         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12940         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12941           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12942           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12943           if $GPGCONF --dump-options > /dev/null ; then
12944             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12945               AC_MSG_RESULT([yes])
12946               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12947               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12948             else
12949               AC_MSG_RESULT([no])
12950             fi
12951           else
12952             AC_MSG_RESULT([no. missing or broken gpgconf?])
12953           fi
12954         else
12955           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12956         fi
12957       else
12958         AC_MSG_RESULT([no])
12959      fi
12960    fi
12961 else
12962     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12964 AC_SUBST(ENABLE_GPGMEPP)
12965 AC_SUBST(SYSTEM_GPGMEPP)
12966 AC_SUBST(GPG_ERROR_CFLAGS)
12967 AC_SUBST(GPG_ERROR_LIBS)
12968 AC_SUBST(LIBASSUAN_CFLAGS)
12969 AC_SUBST(LIBASSUAN_LIBS)
12970 AC_SUBST(GPGMEPP_CFLAGS)
12971 AC_SUBST(GPGMEPP_LIBS)
12973 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12974 if test "$with_java" != "no"; then
12975     AC_MSG_RESULT([yes])
12976     ENABLE_JAVA_WEBSOCKET=TRUE
12977     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12978     NEED_ANT=TRUE
12979 else
12980     AC_MSG_RESULT([no])
12981     ENABLE_JAVA_WEBSOCKET=
12983 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12985 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12986 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12987     AC_MSG_RESULT([yes])
12988     ENABLE_MEDIAWIKI=TRUE
12989     BUILD_TYPE="$BUILD_TYPE XSLTML"
12990     if test  "x$with_java" = "xno"; then
12991         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12992     fi
12993 else
12994     AC_MSG_RESULT([no])
12995     ENABLE_MEDIAWIKI=
12996     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12998 AC_SUBST(ENABLE_MEDIAWIKI)
13000 AC_MSG_CHECKING([whether to build the Report Builder])
13001 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13002     AC_MSG_RESULT([yes])
13003     ENABLE_REPORTBUILDER=TRUE
13004     AC_MSG_CHECKING([which jfreereport libs to use])
13005     if test "$with_system_jfreereport" = "yes"; then
13006         SYSTEM_JFREEREPORT=TRUE
13007         AC_MSG_RESULT([external])
13008         if test -z $SAC_JAR; then
13009             SAC_JAR=/usr/share/java/sac.jar
13010         fi
13011         if ! test -f $SAC_JAR; then
13012              AC_MSG_ERROR(sac.jar not found.)
13013         fi
13015         if test -z $LIBXML_JAR; then
13016             if test -f /usr/share/java/libxml-1.0.0.jar; then
13017                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
13018             elif test -f /usr/share/java/libxml.jar; then
13019                 LIBXML_JAR=/usr/share/java/libxml.jar
13020             else
13021                 AC_MSG_ERROR(libxml.jar replacement not found.)
13022             fi
13023         elif ! test -f $LIBXML_JAR; then
13024             AC_MSG_ERROR(libxml.jar not found.)
13025         fi
13027         if test -z $FLUTE_JAR; then
13028             if test -f /usr/share/java/flute-1.3.0.jar; then
13029                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
13030             elif test -f /usr/share/java/flute.jar; then
13031                 FLUTE_JAR=/usr/share/java/flute.jar
13032             else
13033                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
13034             fi
13035         elif ! test -f $FLUTE_JAR; then
13036             AC_MSG_ERROR(flute-1.3.0.jar not found.)
13037         fi
13039         if test -z $JFREEREPORT_JAR; then
13040             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
13041                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
13042             elif test -f /usr/share/java/flow-engine.jar; then
13043                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
13044             else
13045                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
13046             fi
13047         elif ! test -f  $JFREEREPORT_JAR; then
13048                 AC_MSG_ERROR(jfreereport.jar not found.)
13049         fi
13051         if test -z $LIBLAYOUT_JAR; then
13052             if test -f /usr/share/java/liblayout-0.2.9.jar; then
13053                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
13054             elif test -f /usr/share/java/liblayout.jar; then
13055                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
13056             else
13057                 AC_MSG_ERROR(liblayout.jar replacement not found.)
13058             fi
13059         elif ! test -f $LIBLAYOUT_JAR; then
13060                 AC_MSG_ERROR(liblayout.jar not found.)
13061         fi
13063         if test -z $LIBLOADER_JAR; then
13064             if test -f /usr/share/java/libloader-1.0.0.jar; then
13065                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
13066             elif test -f /usr/share/java/libloader.jar; then
13067                 LIBLOADER_JAR=/usr/share/java/libloader.jar
13068             else
13069                 AC_MSG_ERROR(libloader.jar replacement not found.)
13070             fi
13071         elif ! test -f  $LIBLOADER_JAR; then
13072             AC_MSG_ERROR(libloader.jar not found.)
13073         fi
13075         if test -z $LIBFORMULA_JAR; then
13076             if test -f /usr/share/java/libformula-0.2.0.jar; then
13077                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
13078             elif test -f /usr/share/java/libformula.jar; then
13079                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
13080             else
13081                 AC_MSG_ERROR(libformula.jar replacement not found.)
13082             fi
13083         elif ! test -f $LIBFORMULA_JAR; then
13084                 AC_MSG_ERROR(libformula.jar not found.)
13085         fi
13087         if test -z $LIBREPOSITORY_JAR; then
13088             if test -f /usr/share/java/librepository-1.0.0.jar; then
13089                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
13090             elif test -f /usr/share/java/librepository.jar; then
13091                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
13092             else
13093                 AC_MSG_ERROR(librepository.jar replacement not found.)
13094             fi
13095         elif ! test -f $LIBREPOSITORY_JAR; then
13096             AC_MSG_ERROR(librepository.jar not found.)
13097         fi
13099         if test -z $LIBFONTS_JAR; then
13100             if test -f /usr/share/java/libfonts-1.0.0.jar; then
13101                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
13102             elif test -f /usr/share/java/libfonts.jar; then
13103                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
13104             else
13105                 AC_MSG_ERROR(libfonts.jar replacement not found.)
13106             fi
13107         elif ! test -f $LIBFONTS_JAR; then
13108                 AC_MSG_ERROR(libfonts.jar not found.)
13109         fi
13111         if test -z $LIBSERIALIZER_JAR; then
13112             if test -f /usr/share/java/libserializer-1.0.0.jar; then
13113                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
13114             elif test -f /usr/share/java/libserializer.jar; then
13115                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
13116             else
13117                 AC_MSG_ERROR(libserializer.jar replacement not found.)
13118             fi
13119         elif ! test -f $LIBSERIALIZER_JAR; then
13120                 AC_MSG_ERROR(libserializer.jar not found.)
13121         fi
13123         if test -z $LIBBASE_JAR; then
13124             if test -f /usr/share/java/libbase-1.0.0.jar; then
13125                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
13126             elif test -f /usr/share/java/libbase.jar; then
13127                 LIBBASE_JAR=/usr/share/java/libbase.jar
13128             else
13129                 AC_MSG_ERROR(libbase.jar replacement not found.)
13130             fi
13131         elif ! test -f $LIBBASE_JAR; then
13132             AC_MSG_ERROR(libbase.jar not found.)
13133         fi
13135     else
13136         AC_MSG_RESULT([internal])
13137         SYSTEM_JFREEREPORT=
13138         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
13139         NEED_ANT=TRUE
13140     fi
13141     BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
13142 else
13143     AC_MSG_RESULT([no])
13144     ENABLE_REPORTBUILDER=
13145     SYSTEM_JFREEREPORT=
13147 AC_SUBST(ENABLE_REPORTBUILDER)
13148 AC_SUBST(SYSTEM_JFREEREPORT)
13149 AC_SUBST(SAC_JAR)
13150 AC_SUBST(LIBXML_JAR)
13151 AC_SUBST(FLUTE_JAR)
13152 AC_SUBST(JFREEREPORT_JAR)
13153 AC_SUBST(LIBBASE_JAR)
13154 AC_SUBST(LIBLAYOUT_JAR)
13155 AC_SUBST(LIBLOADER_JAR)
13156 AC_SUBST(LIBFORMULA_JAR)
13157 AC_SUBST(LIBREPOSITORY_JAR)
13158 AC_SUBST(LIBFONTS_JAR)
13159 AC_SUBST(LIBSERIALIZER_JAR)
13161 # scripting provider for BeanShell?
13162 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
13163 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
13164     AC_MSG_RESULT([yes])
13165     ENABLE_SCRIPTING_BEANSHELL=TRUE
13167     dnl ===================================================================
13168     dnl Check for system beanshell
13169     dnl ===================================================================
13170     AC_MSG_CHECKING([which beanshell to use])
13171     if test "$with_system_beanshell" = "yes"; then
13172         AC_MSG_RESULT([external])
13173         SYSTEM_BSH=TRUE
13174         if test -z $BSH_JAR; then
13175             BSH_JAR=/usr/share/java/bsh.jar
13176         fi
13177         if ! test -f $BSH_JAR; then
13178             AC_MSG_ERROR(bsh.jar not found.)
13179         fi
13180     else
13181         AC_MSG_RESULT([internal])
13182         SYSTEM_BSH=
13183         BUILD_TYPE="$BUILD_TYPE BSH"
13184     fi
13185 else
13186     AC_MSG_RESULT([no])
13187     ENABLE_SCRIPTING_BEANSHELL=
13188     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
13190 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
13191 AC_SUBST(SYSTEM_BSH)
13192 AC_SUBST(BSH_JAR)
13194 # scripting provider for JavaScript?
13195 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
13196 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
13197     AC_MSG_RESULT([yes])
13198     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
13200     dnl ===================================================================
13201     dnl Check for system rhino
13202     dnl ===================================================================
13203     AC_MSG_CHECKING([which rhino to use])
13204     if test "$with_system_rhino" = "yes"; then
13205         AC_MSG_RESULT([external])
13206         SYSTEM_RHINO=TRUE
13207         if test -z $RHINO_JAR; then
13208             RHINO_JAR=/usr/share/java/js.jar
13209         fi
13210         if ! test -f $RHINO_JAR; then
13211             AC_MSG_ERROR(js.jar not found.)
13212         fi
13213     else
13214         AC_MSG_RESULT([internal])
13215         SYSTEM_RHINO=
13216         BUILD_TYPE="$BUILD_TYPE RHINO"
13217         NEED_ANT=TRUE
13218     fi
13219 else
13220     AC_MSG_RESULT([no])
13221     ENABLE_SCRIPTING_JAVASCRIPT=
13222     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13224 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13225 AC_SUBST(SYSTEM_RHINO)
13226 AC_SUBST(RHINO_JAR)
13228 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13229 # paths should be added to library search path. So lets put all 64-bit
13230 # platforms there.
13231 supports_multilib=
13232 case "$host_cpu" in
13233 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13234     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13235         supports_multilib="yes"
13236     fi
13237     ;;
13239     ;;
13240 esac
13242 dnl ===================================================================
13243 dnl QT5 Integration
13244 dnl ===================================================================
13246 QT5_CFLAGS=""
13247 QT5_LIBS=""
13248 QT5_GOBJECT_CFLAGS=""
13249 QT5_GOBJECT_LIBS=""
13250 QT5_HAVE_GOBJECT=""
13251 QT5_PLATFORMS_SRCDIR=""
13252 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13253         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13254         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13255 then
13256     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13257     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13259     if test -n "$supports_multilib"; then
13260         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13261     fi
13263     qt5_test_include="QtWidgets/qapplication.h"
13264     if test "$_os" = "Emscripten"; then
13265         qt5_test_library="libQt5Widgets.a"
13266     else
13267         qt5_test_library="libQt5Widgets.so"
13268     fi
13270     dnl Check for qmake5
13271     if test -n "$QT5DIR"; then
13272         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13273     else
13274         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13275     fi
13276     if test "$QMAKE5" = "no"; then
13277         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13278     else
13279         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13280         if test -z "$qmake5_test_ver"; then
13281             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13282         fi
13283         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13284         qt5_minimal_minor="15"
13285         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13286             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13287         else
13288             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13289         fi
13290     fi
13292     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13293     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13294     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13295     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13297     AC_MSG_CHECKING([for Qt5 headers])
13298     qt5_incdir="no"
13299     for inc_dir in $qt5_incdirs; do
13300         if test -r "$inc_dir/$qt5_test_include"; then
13301             qt5_incdir="$inc_dir"
13302             break
13303         fi
13304     done
13305     AC_MSG_RESULT([$qt5_incdir])
13306     if test "x$qt5_incdir" = "xno"; then
13307         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13308     fi
13309     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13310     AC_LANG_PUSH([C++])
13311     save_CPPFLAGS=$CPPFLAGS
13312     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13313     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13314         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13315     CPPFLAGS=$save_CPPFLAGS
13316     AC_LANG_POP([C++])
13318     AC_MSG_CHECKING([for Qt5 libraries])
13319     qt5_libdir="no"
13320     for lib_dir in $qt5_libdirs; do
13321         if test -r "$lib_dir/$qt5_test_library"; then
13322             qt5_libdir="$lib_dir"
13323             break
13324         fi
13325     done
13326     AC_MSG_RESULT([$qt5_libdir])
13327     if test "x$qt5_libdir" = "xno"; then
13328         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13329     fi
13331     if test "$_os" = "Emscripten"; then
13332         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13333             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13334         fi
13335         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13336             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13337         fi
13339         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13340         if ! test -x "$EMSDK_LLVM_NM"; then
13341             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13342         fi
13343         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13344             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13345         fi
13346         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13347         if test -n "$QT5_WASM_SJLJ"; then
13348             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13349         fi
13350     fi
13352     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13353     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13354     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13355     if test "$_os" = "Emscripten"; then
13356         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13357     fi
13359     if test "$USING_X11" = TRUE; then
13360         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13361         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13362         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13363         QT5_USING_X11=1
13364         AC_DEFINE(QT5_USING_X11)
13365     fi
13367     dnl Check for Meta Object Compiler
13369     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13370     if test "$MOC5" = "no"; then
13371         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13372 the root of your Qt installation by exporting QT5DIR before running "configure".])
13373     fi
13375     if test "$test_gstreamer_1_0" = yes; then
13376         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13377                 QT5_HAVE_GOBJECT=1
13378                 AC_DEFINE(QT5_HAVE_GOBJECT)
13379             ],
13380             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13381         )
13382     fi
13384 AC_SUBST(QT5_CFLAGS)
13385 AC_SUBST(QT5_LIBS)
13386 AC_SUBST(MOC5)
13387 AC_SUBST(QT5_GOBJECT_CFLAGS)
13388 AC_SUBST(QT5_GOBJECT_LIBS)
13389 AC_SUBST(QT5_HAVE_GOBJECT)
13390 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13392 dnl ===================================================================
13393 dnl QT6 Integration
13394 dnl ===================================================================
13396 QT6_CFLAGS=""
13397 QT6_LIBS=""
13398 QT6_PLATFORMS_SRCDIR=""
13399 ENABLE_QT6_MULTIMEDIA=""
13400 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13401         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13402 then
13403     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13404     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13406     if test -n "$supports_multilib"; then
13407         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13408     fi
13410     qt6_test_include="QtWidgets/qapplication.h"
13411     if test "$_os" = "Emscripten"; then
13412         qt6_test_library="libQt6Widgets.a"
13413     else
13414         qt6_test_library="libQt6Widgets.so"
13415     fi
13417     dnl Check for qmake6
13418     if test -n "$QT6DIR"; then
13419         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13420     else
13421         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13422     fi
13423     if test "$QMAKE6" = "no"; then
13424         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13425     else
13426         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13427         if test -z "$qmake6_test_ver"; then
13428             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13429         fi
13430         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13431     fi
13433     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13434     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13435     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13436     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13438     AC_MSG_CHECKING([for Qt6 headers])
13439     qt6_incdir="no"
13440     for inc_dir in $qt6_incdirs; do
13441         if test -r "$inc_dir/$qt6_test_include"; then
13442             qt6_incdir="$inc_dir"
13443             break
13444         fi
13445     done
13446     AC_MSG_RESULT([$qt6_incdir])
13447     if test "x$qt6_incdir" = "xno"; then
13448         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13449     fi
13450     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13451     AC_LANG_PUSH([C++])
13452     save_CPPFLAGS=$CPPFLAGS
13453     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13454     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13455         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13456     CPPFLAGS=$save_CPPFLAGS
13457     AC_LANG_POP([C++])
13459     AC_MSG_CHECKING([for Qt6 libraries])
13460     qt6_libdir="no"
13461     for lib_dir in $qt6_libdirs; do
13462         if test -r "$lib_dir/$qt6_test_library"; then
13463             qt6_libdir="$lib_dir"
13464             break
13465         fi
13466     done
13467     AC_MSG_RESULT([$qt6_libdir])
13468     if test "x$qt6_libdir" = "xno"; then
13469         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13470     fi
13472     if test "$_os" = "Emscripten"; then
13473         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13474             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13475         fi
13476         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13477             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13478         fi
13479     fi
13481     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13482     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13483     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13484     if test "$_os" = "Emscripten"; then
13485         QT6_LIBS="$QT6_LIBS -lQt6BundledPcre2 -lQt6BundledZLIB -L${qt6_platformsdir} -lqwasm -sGL_ENABLE_GET_PROC_ADDRESS"
13486     else
13487         if ! test "$enable_qt6_multimedia" = "no"; then
13488             if ! test -r "$qt6_incdir/QtMultimediaWidgets/QVideoWidget"; then
13489                 AC_MSG_ERROR([Qt 6 QMultimedia not found.])
13490                 break
13491             fi
13492             ENABLE_QT6_MULTIMEDIA=TRUE
13493             QT6_LIBS="$QT6_LIBS -lQt6Multimedia -lQt6MultimediaWidgets"
13494         fi
13495     fi
13497     if test "$USING_X11" = TRUE; then
13498         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13499         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13500         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13501         QT6_USING_X11=1
13502         AC_DEFINE(QT6_USING_X11)
13503     fi
13505     dnl Check for Meta Object Compiler
13507     for lib_dir in $qt6_libdirs; do
13508         if test -z "$qt6_libexec_dirs"; then
13509             qt6_libexec_dirs="$lib_dir/libexec"
13510         else
13511             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13512         fi
13513     done
13514     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])
13515     if test "$MOC6" = "no"; then
13516         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13517 the root of your Qt installation by exporting QT6DIR before running "configure".])
13518     else
13519         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13520         if test -z "$moc6_test_ver"; then
13521             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13522         fi
13523         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13524     fi
13526 AC_SUBST(QT6_CFLAGS)
13527 AC_SUBST(QT6_LIBS)
13528 AC_SUBST(MOC6)
13529 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13530 AC_SUBST(ENABLE_QT6_MULTIMEDIA)
13532 dnl ===================================================================
13533 dnl KF5 Integration
13534 dnl ===================================================================
13536 KF5_CFLAGS=""
13537 KF5_LIBS=""
13538 KF5_CONFIG="kf5-config"
13539 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13540         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13541 then
13542     if test "$OS" = "HAIKU"; then
13543         haiku_arch="`echo $RTL_ARCH | tr X x`"
13544         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13545         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13546     fi
13548     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13549     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13550     if test -n "$supports_multilib"; then
13551         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13552     fi
13554     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13555     kf5_test_library="libKF5KIOFileWidgets.so"
13556     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13558     dnl kf5 KDE4 support compatibility installed
13559     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13560     if test "$KF5_CONFIG" != "no"; then
13561         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13562         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13563     fi
13565     dnl Check for KF5 headers
13566     AC_MSG_CHECKING([for KF5 headers])
13567     kf5_incdir="no"
13568     for kf5_check in $kf5_incdirs; do
13569         if test -r "$kf5_check/$kf5_test_include"; then
13570             kf5_incdir="$kf5_check/KF5"
13571             break
13572         fi
13573     done
13574     AC_MSG_RESULT([$kf5_incdir])
13575     if test "x$kf5_incdir" = "xno"; then
13576         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13577     fi
13579     dnl Check for KF5 libraries
13580     AC_MSG_CHECKING([for KF5 libraries])
13581     kf5_libdir="no"
13582     for kf5_check in $kf5_libdirs; do
13583         if test -r "$kf5_check/$kf5_test_library"; then
13584             kf5_libdir="$kf5_check"
13585             break
13586         fi
13587     done
13589     AC_MSG_RESULT([$kf5_libdir])
13590     if test "x$kf5_libdir" = "xno"; then
13591         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13592     fi
13594     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"
13595     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13596     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13598     if test "$USING_X11" = TRUE; then
13599         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13600     fi
13602     AC_LANG_PUSH([C++])
13603     save_CXXFLAGS=$CXXFLAGS
13604     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13605     AC_MSG_CHECKING([whether KDE is >= 5.0])
13606        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13607 #include <kcoreaddons_version.h>
13609 int main(int argc, char **argv) {
13610        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13611        else return 1;
13613        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13614     CXXFLAGS=$save_CXXFLAGS
13615     AC_LANG_POP([C++])
13617 AC_SUBST(KF5_CFLAGS)
13618 AC_SUBST(KF5_LIBS)
13620 dnl ===================================================================
13621 dnl KF6 Integration
13622 dnl ===================================================================
13624 KF6_CFLAGS=""
13625 KF6_LIBS=""
13626 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13627 then
13628     if test "$OS" = "HAIKU"; then
13629         haiku_arch="`echo $RTL_ARCH | tr X x`"
13630         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13631         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13632     fi
13634     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13635     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13636     if test -n "$supports_multilib"; then
13637         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13638     fi
13640     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13641     kf6_test_library="libKF6KIOFileWidgets.so"
13642     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13644     dnl Check for KF6 headers
13645     AC_MSG_CHECKING([for KF6 headers])
13646     kf6_incdir="no"
13647     for kf6_check in $kf6_incdirs; do
13648         if test -r "$kf6_check/$kf6_test_include"; then
13649             kf6_incdir="$kf6_check/KF6"
13650             break
13651         fi
13652     done
13653     AC_MSG_RESULT([$kf6_incdir])
13654     if test "x$kf6_incdir" = "xno"; then
13655         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13656     fi
13658     dnl Check for KF6 libraries
13659     AC_MSG_CHECKING([for KF6 libraries])
13660     kf6_libdir="no"
13661     for kf6_check in $kf6_libdirs; do
13662         if test -r "$kf6_check/$kf6_test_library"; then
13663             kf6_libdir="$kf6_check"
13664             break
13665         fi
13666     done
13668     AC_MSG_RESULT([$kf6_libdir])
13669     if test "x$kf6_libdir" = "xno"; then
13670         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13671     fi
13673     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"
13674     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13675     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13677     AC_LANG_PUSH([C++])
13678     save_CXXFLAGS=$CXXFLAGS
13679     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13680     dnl KF6 development version as of 2023-06 uses version number 5.240
13681     AC_MSG_CHECKING([whether KDE is >= 5.240])
13682        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13683 #include <kcoreaddons_version.h>
13685 int main(int argc, char **argv) {
13686        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13687        else return 1;
13689        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13690     CXXFLAGS=$save_CXXFLAGS
13691     AC_LANG_POP([C++])
13693 AC_SUBST(KF6_CFLAGS)
13694 AC_SUBST(KF6_LIBS)
13696 if test "$enable_qt6_multimedia" = "yes" -a "$ENABLE_QT6" != "TRUE"; then
13697     AC_MSG_ERROR([--enable-qt6-multimedia requires --enable-qt6 or --enable-kf6])
13700 dnl ===================================================================
13701 dnl Test whether to include Evolution 2 support
13702 dnl ===================================================================
13703 AC_MSG_CHECKING([whether to enable evolution 2 support])
13704 if test "$enable_evolution2" = yes; then
13705     AC_MSG_RESULT([yes])
13706     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13707     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13708     FilterLibs "${GOBJECT_LIBS}"
13709     GOBJECT_LIBS="${filteredlibs}"
13710     ENABLE_EVOAB2="TRUE"
13711 else
13712     AC_MSG_RESULT([no])
13714 AC_SUBST(ENABLE_EVOAB2)
13715 AC_SUBST(GOBJECT_CFLAGS)
13716 AC_SUBST(GOBJECT_LIBS)
13718 dnl ===================================================================
13719 dnl Test which themes to include
13720 dnl ===================================================================
13721 AC_MSG_CHECKING([which themes to include])
13722 # if none given use default subset of available themes
13723 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13724     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"
13727 WITH_THEMES=""
13728 if test "x$with_theme" != "xno"; then
13729     for theme in $with_theme; do
13730         case $theme in
13731         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" ;;
13732         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13733         esac
13734     done
13736 AC_MSG_RESULT([$WITH_THEMES])
13737 AC_SUBST([WITH_THEMES])
13739 ###############################################################################
13740 # Extensions checking
13741 ###############################################################################
13742 AC_MSG_CHECKING([for extensions integration])
13743 if test "x$enable_extension_integration" != "xno"; then
13744     WITH_EXTENSION_INTEGRATION=TRUE
13745     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13746     AC_MSG_RESULT([yes, use integration])
13747 else
13748     WITH_EXTENSION_INTEGRATION=
13749     AC_MSG_RESULT([no, do not integrate])
13751 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13753 dnl Should any extra extensions be included?
13754 dnl There are standalone tests for each of these below.
13755 WITH_EXTRA_EXTENSIONS=
13756 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13758 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13759 if test "x$with_java" != "xno"; then
13760     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13763 AC_MSG_CHECKING([whether to build opens___.ttf])
13764 if test "$enable_build_opensymbol" = "yes"; then
13765     AC_MSG_RESULT([yes])
13766     AC_PATH_PROG(FONTFORGE, fontforge)
13767     if test -z "$FONTFORGE"; then
13768         AC_MSG_ERROR([fontforge not installed])
13769     fi
13770 else
13771     AC_MSG_RESULT([no])
13772     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13774 AC_SUBST(FONTFORGE)
13776 dnl ===================================================================
13777 dnl Test whether to include fonts
13778 dnl ===================================================================
13779 AC_MSG_CHECKING([whether to include third-party fonts])
13780 if test "$with_fonts" != "no"; then
13781     AC_MSG_RESULT([yes])
13782     WITH_FONTS=TRUE
13783     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13784     AC_DEFINE(HAVE_MORE_FONTS)
13785 else
13786     AC_MSG_RESULT([no])
13787     WITH_FONTS=
13788     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13790 AC_SUBST(WITH_FONTS)
13793 dnl ===================================================================
13794 dnl Test whether to enable online update service
13795 dnl ===================================================================
13796 AC_MSG_CHECKING([whether to enable online update])
13797 ENABLE_ONLINE_UPDATE=
13798 if test "$enable_online_update" = ""; then
13799     AC_MSG_RESULT([no])
13800 else
13801     if test "$enable_online_update" = "mar"; then
13802         AC_MSG_ERROR([--enable-online-update=mar is deprecated, use --enable-online-update-mar instead])
13803     elif test "$enable_online_update" = "yes"; then
13804         if test "$enable_curl" != "yes"; then
13805             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13806         fi
13807         AC_MSG_RESULT([yes])
13808         ENABLE_ONLINE_UPDATE="TRUE"
13809     else
13810         AC_MSG_RESULT([no])
13811     fi
13813 AC_SUBST(ENABLE_ONLINE_UPDATE)
13816 dnl ===================================================================
13817 dnl Test whether to enable mar online update service
13818 dnl ===================================================================
13819 AC_MSG_CHECKING([whether to enable mar online update])
13820 ENABLE_ONLINE_UPDATE_MAR=
13821 if test "$enable_online_update_mar" = yes; then
13822     AC_MSG_RESULT([yes])
13823     BUILD_TYPE="$BUILD_TYPE ONLINEUPDATE"
13824     ENABLE_ONLINE_UPDATE_MAR="TRUE"
13825     AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13826 else
13827     AC_MSG_RESULT([no])
13829 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13831 AC_MSG_CHECKING([for mar online update baseurl])
13832 ONLINEUPDATE_MAR_BASEURL=$with_online_update_mar_baseurl
13833 if test -n "$ONLINEUPDATE_MAR_BASEURL"; then
13834     AC_MSG_RESULT([yes])
13835 else
13836     AC_MSG_RESULT([no])
13838 AC_SUBST(ONLINEUPDATE_MAR_BASEURL)
13840 AC_MSG_CHECKING([for mar online update certificateder])
13841 ONLINEUPDATE_MAR_CERTIFICATEDER=$with_online_update_mar_certificateder
13842 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEDER"; then
13843     AC_MSG_RESULT([yes])
13844 else
13845     AC_MSG_RESULT([no])
13847 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEDER)
13849 AC_MSG_CHECKING([for mar online update certificatename])
13850 ONLINEUPDATE_MAR_CERTIFICATENAME=$with_online_update_mar_certificatename
13851 if test -n "$ONLINEUPDATE_MAR_CERTIFICATENAME"; then
13852     AC_MSG_RESULT([yes])
13853 else
13854     AC_MSG_RESULT([no])
13856 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATENAME)
13858 AC_MSG_CHECKING([for mar online update certificatepath])
13859 ONLINEUPDATE_MAR_CERTIFICATEPATH=$with_online_update_mar_certificatepath
13860 if test -n "$ONLINEUPDATE_MAR_CERTIFICATEPATH"; then
13861     AC_MSG_RESULT([yes])
13862 else
13863     AC_MSG_RESULT([no])
13865 AC_SUBST(ONLINEUPDATE_MAR_CERTIFICATEPATH)
13868 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13869 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13870     if test "x$with_privacy_policy_url" = "xundefined"; then
13871         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13872     fi
13874 AC_SUBST(PRIVACY_POLICY_URL)
13875 dnl ===================================================================
13876 dnl Test whether we need bzip2
13877 dnl ===================================================================
13878 SYSTEM_BZIP2=
13879 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13880     AC_MSG_CHECKING([whether to use system bzip2])
13881     if test "$with_system_bzip2" = yes; then
13882         SYSTEM_BZIP2=TRUE
13883         AC_MSG_RESULT([yes])
13884         PKG_CHECK_MODULES(BZIP2, bzip2)
13885         FilterLibs "${BZIP2_LIBS}"
13886         BZIP2_LIBS="${filteredlibs}"
13887     else
13888         AC_MSG_RESULT([no])
13889         BUILD_TYPE="$BUILD_TYPE BZIP2"
13890     fi
13892 AC_SUBST(SYSTEM_BZIP2)
13893 AC_SUBST(BZIP2_CFLAGS)
13894 AC_SUBST(BZIP2_LIBS)
13896 dnl ===================================================================
13897 dnl Test whether to enable extension update
13898 dnl ===================================================================
13899 AC_MSG_CHECKING([whether to enable extension update])
13900 ENABLE_EXTENSION_UPDATE=
13901 if test "x$enable_extension_update" = "xno"; then
13902     AC_MSG_RESULT([no])
13903 else
13904     AC_MSG_RESULT([yes])
13905     ENABLE_EXTENSION_UPDATE="TRUE"
13906     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13907     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13909 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13912 dnl ===================================================================
13913 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13914 dnl ===================================================================
13915 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13916 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13917     AC_MSG_RESULT([no])
13918     ENABLE_SILENT_MSI=
13919 else
13920     AC_MSG_RESULT([yes])
13921     ENABLE_SILENT_MSI=TRUE
13922     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13924 AC_SUBST(ENABLE_SILENT_MSI)
13926 dnl ===================================================================
13927 dnl Check for WiX tools.
13928 dnl ===================================================================
13929 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13930     AC_MSG_RESULT([no])
13931     ENABLE_WIX=
13932 else
13933     AC_MSG_RESULT([yes])
13934     # FIXME: this should do proper detection, but the path is currently
13935     # hardcoded in msicreator/createmsi.py
13936     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13937       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13938     fi
13939     ENABLE_WIX=TRUE
13941 AC_SUBST(ENABLE_WIX)
13943 AC_MSG_CHECKING([whether and how to use Xinerama])
13944 if test "$USING_X11" = TRUE; then
13945     if test "$x_libraries" = "default_x_libraries"; then
13946         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13947         if test "x$XINERAMALIB" = x; then
13948            XINERAMALIB="/usr/lib"
13949         fi
13950     else
13951         XINERAMALIB="$x_libraries"
13952     fi
13953     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13954         # we have both versions, let the user decide but use the dynamic one
13955         # per default
13956         USE_XINERAMA=TRUE
13957         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13958             XINERAMA_LINK=dynamic
13959         else
13960             XINERAMA_LINK=static
13961         fi
13962     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13963         # we have only the dynamic version
13964         USE_XINERAMA=TRUE
13965         XINERAMA_LINK=dynamic
13966     elif test -e "$XINERAMALIB/libXinerama.a"; then
13967         # static version
13968         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13969             USE_XINERAMA=TRUE
13970             XINERAMA_LINK=static
13971         else
13972             USE_XINERAMA=
13973             XINERAMA_LINK=none
13974         fi
13975     else
13976         # no Xinerama
13977         USE_XINERAMA=
13978         XINERAMA_LINK=none
13979     fi
13980     if test "$USE_XINERAMA" = "TRUE"; then
13981         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13982         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13983             [AC_MSG_ERROR(Xinerama header not found.)], [])
13984         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13985         if test "x$XEXTLIB" = x; then
13986            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13987         fi
13988         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13989         if test "$_os" = "FreeBSD"; then
13990             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13991         fi
13992         if test "$_os" = "Linux"; then
13993             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13994         fi
13995         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13996             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13997     else
13998         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
13999     fi
14000 else
14001     USE_XINERAMA=
14002     XINERAMA_LINK=none
14003     AC_MSG_RESULT([no])
14005 AC_SUBST(XINERAMA_LINK)
14007 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
14008 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
14009     enable_cairo_rgba=yes
14011 if test "$enable_cairo_rgba" = yes; then
14012     AC_DEFINE(ENABLE_CAIRO_RGBA)
14013     ENABLE_CAIRO_RGBA=TRUE
14014     AC_MSG_RESULT([yes])
14015 else
14016     ENABLE_CAIRO_RGBA=
14017     AC_MSG_RESULT([no])
14019 AC_SUBST(ENABLE_CAIRO_RGBA)
14021 dnl ===================================================================
14022 dnl Test whether to build cairo or rely on the system version
14023 dnl ===================================================================
14025 if test "$test_cairo" = "yes"; then
14026     AC_MSG_CHECKING([whether to use the system cairo])
14028     : ${with_system_cairo:=$with_system_libs}
14029     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
14030         SYSTEM_CAIRO=TRUE
14031         AC_MSG_RESULT([yes])
14033         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
14034         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14035         FilterLibs "${CAIRO_LIBS}"
14036         CAIRO_LIBS="${filteredlibs}"
14038         if test "$test_xrender" = "yes"; then
14039             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
14040             AC_LANG_PUSH([C])
14041             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
14042 #ifdef PictStandardA8
14043 #else
14044       return fail;
14045 #endif
14046 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
14048             AC_LANG_POP([C])
14049         fi
14050     else
14051         AC_MSG_RESULT([no])
14052         BUILD_TYPE="$BUILD_TYPE CAIRO"
14053     fi
14055     if test "$enable_cairo_canvas" != no; then
14056         AC_DEFINE(ENABLE_CAIRO_CANVAS)
14057         ENABLE_CAIRO_CANVAS=TRUE
14058     fi
14061 AC_SUBST(CAIRO_CFLAGS)
14062 AC_SUBST(CAIRO_LIBS)
14063 AC_SUBST(ENABLE_CAIRO_CANVAS)
14064 AC_SUBST(SYSTEM_CAIRO)
14066 dnl ===================================================================
14067 dnl Test whether to use avahi
14068 dnl ===================================================================
14069 if test "$_os" = "WINNT"; then
14070     # Windows uses bundled mDNSResponder
14071     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
14072 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
14073     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
14074                       [ENABLE_AVAHI="TRUE"])
14075     AC_DEFINE(HAVE_FEATURE_AVAHI)
14076     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14077     FilterLibs "${AVAHI_LIBS}"
14078     AVAHI_LIBS="${filteredlibs}"
14081 AC_SUBST(ENABLE_AVAHI)
14082 AC_SUBST(AVAHI_CFLAGS)
14083 AC_SUBST(AVAHI_LIBS)
14085 dnl ===================================================================
14086 dnl Test whether to use liblangtag
14087 dnl ===================================================================
14088 SYSTEM_LIBLANGTAG=
14089 AC_MSG_CHECKING([whether to use system liblangtag])
14090 if test "$with_system_liblangtag" = yes; then
14091     SYSTEM_LIBLANGTAG=TRUE
14092     AC_MSG_RESULT([yes])
14093     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
14094     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
14095     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
14096     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
14097     FilterLibs "${LIBLANGTAG_LIBS}"
14098     LIBLANGTAG_LIBS="${filteredlibs}"
14099 else
14100     SYSTEM_LIBLANGTAG=
14101     AC_MSG_RESULT([no])
14102     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
14103     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
14104     if test "$COM" = "MSC"; then
14105         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
14106     else
14107         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
14108     fi
14110 AC_SUBST(SYSTEM_LIBLANGTAG)
14111 AC_SUBST(LIBLANGTAG_CFLAGS)
14112 AC_SUBST(LIBLANGTAG_LIBS)
14114 dnl ===================================================================
14115 dnl Test whether to build libpng or rely on the system version
14116 dnl ===================================================================
14118 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
14119 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
14120 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
14122 dnl ===================================================================
14123 dnl Test whether to build libtiff or rely on the system version
14124 dnl ===================================================================
14126 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
14128 dnl ===================================================================
14129 dnl Test whether to build libwebp or rely on the system version
14130 dnl ===================================================================
14132 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
14134 dnl ===================================================================
14135 dnl Check for runtime JVM search path
14136 dnl ===================================================================
14137 if test "$ENABLE_JAVA" != ""; then
14138     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
14139     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
14140         AC_MSG_RESULT([yes])
14141         if ! test -d "$with_jvm_path"; then
14142             AC_MSG_ERROR(["$with_jvm_path" not a directory])
14143         fi
14144         if ! test -d "$with_jvm_path"jvm; then
14145             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
14146         fi
14147         JVM_ONE_PATH_CHECK="$with_jvm_path"
14148         AC_SUBST(JVM_ONE_PATH_CHECK)
14149     else
14150         AC_MSG_RESULT([no])
14151     fi
14154 dnl ===================================================================
14155 dnl Test for the presence of Ant and that it works
14156 dnl ===================================================================
14158 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
14159 # breaks filename decoding, so for the ant section, set it to LANG
14160 LC_ALL=$LANG
14161 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
14162     ANT_HOME=; export ANT_HOME
14163     WITH_ANT_HOME=; export WITH_ANT_HOME
14164     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
14165         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
14166             if test "$_os" = "WINNT"; then
14167                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
14168             else
14169                 with_ant_home="$LODE_HOME/opt/ant"
14170             fi
14171         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
14172             with_ant_home="$LODE_HOME/opt/ant"
14173         fi
14174     fi
14175     if test -z "$with_ant_home"; then
14176         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
14177     else
14178         if test "$_os" = "WINNT"; then
14179             # AC_PATH_PROGS needs unix path
14180             PathFormat "$with_ant_home"
14181             with_ant_home="$formatted_path_unix"
14182         fi
14183         AbsolutePath "$with_ant_home"
14184         with_ant_home=$absolute_path
14185         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
14186         WITH_ANT_HOME=$with_ant_home
14187         ANT_HOME=$with_ant_home
14188     fi
14190     if test -z "$ANT"; then
14191         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
14192     else
14193         # resolve relative or absolute symlink
14194         while test -h "$ANT"; do
14195             a_cwd=`pwd`
14196             a_basename=`basename "$ANT"`
14197             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
14198             cd "`dirname "$ANT"`"
14199             cd "`dirname "$a_script"`"
14200             ANT="`pwd`"/"`basename "$a_script"`"
14201             cd "$a_cwd"
14202         done
14204         AC_MSG_CHECKING([if $ANT works])
14205         mkdir -p conftest.dir
14206         a_cwd=$(pwd)
14207         cd conftest.dir
14208         cat > conftest.java << EOF
14209         public class conftest {
14210             int testmethod(int a, int b) {
14211                     return a + b;
14212             }
14213         }
14216         cat > conftest.xml << EOF
14217         <project name="conftest" default="conftest">
14218         <target name="conftest">
14219             <javac srcdir="." includes="conftest.java">
14220             </javac>
14221         </target>
14222         </project>
14225         if test -n "$WSL_ONLY_AS_HELPER"; then
14226             # need to set it directly, since ant only tries java, not java.exe from JAVA_HOME
14227             export JAVACMD="$JAVAINTERPRETER"
14228             # similarly it doesn't expect to be called from wsl, so it uses the wsl-realm path when
14229             # building the classpath, but we need the windows-style one for the windows-java
14230             PathFormat "$ANT_HOME"
14231             export LOCALCLASSPATH=";$formatted_path/lib/ant-launcher.jar"
14232         fi
14233         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
14234         if test $? = 0 -a -f ./conftest.class; then
14235             AC_MSG_RESULT([Ant works])
14236             if test -z "$WITH_ANT_HOME"; then
14237                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
14238                 if test -z "$ANT_HOME"; then
14239                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
14240                 fi
14241             else
14242                 ANT_HOME="$WITH_ANT_HOME"
14243             fi
14244         else
14245             echo "configure: Ant test failed" >&5
14246             cat conftest.java >&5
14247             cat conftest.xml >&5
14248             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
14249         fi
14250         cd "$a_cwd"
14251         rm -fr conftest.dir
14252     fi
14253     if test -z "$ANT_HOME"; then
14254         ANT_HOME="NO_ANT_HOME"
14255     else
14256         PathFormat "$ANT_HOME"
14257         ANT_HOME="$formatted_path_unix"
14258         PathFormat "$ANT"
14259         ANT="$formatted_path_unix"
14260     fi
14262     dnl Checking for ant.jar
14263     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14264         AC_MSG_CHECKING([Ant lib directory])
14265         if test -f $ANT_HOME/lib/ant.jar; then
14266             ANT_LIB="$ANT_HOME/lib"
14267         else
14268             if test -f $ANT_HOME/ant.jar; then
14269                 ANT_LIB="$ANT_HOME"
14270             else
14271                 if test -f /usr/share/java/ant.jar; then
14272                     ANT_LIB=/usr/share/java
14273                 else
14274                     if test -f /usr/share/ant-core/lib/ant.jar; then
14275                         ANT_LIB=/usr/share/ant-core/lib
14276                     else
14277                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14278                             ANT_LIB="$ANT_HOME/lib/ant"
14279                         else
14280                             if test -f /usr/share/lib/ant/ant.jar; then
14281                                 ANT_LIB=/usr/share/lib/ant
14282                             else
14283                                 AC_MSG_ERROR([Ant libraries not found!])
14284                             fi
14285                         fi
14286                     fi
14287                 fi
14288             fi
14289         fi
14290         PathFormat "$ANT_LIB"
14291         ANT_LIB="$formatted_path"
14292         AC_MSG_RESULT([Ant lib directory found.])
14293     fi
14295     ant_minver=1.6.0
14296     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14298     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14299     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14300     ant_version_major=`echo $ant_version | cut -d. -f1`
14301     ant_version_minor=`echo $ant_version | cut -d. -f2`
14302     echo "configure: ant_version $ant_version " >&5
14303     echo "configure: ant_version_major $ant_version_major " >&5
14304     echo "configure: ant_version_minor $ant_version_minor " >&5
14305     if test "$ant_version_major" -ge "2"; then
14306         AC_MSG_RESULT([yes, $ant_version])
14307     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14308         AC_MSG_RESULT([yes, $ant_version])
14309     else
14310         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14311     fi
14313     rm -f conftest* core core.* *.core
14315 AC_SUBST(ANT)
14316 AC_SUBST(ANT_HOME)
14317 AC_SUBST(ANT_LIB)
14319 OOO_JUNIT_JAR=
14320 HAMCREST_JAR=
14321 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14322     AC_MSG_CHECKING([for JUnit 4])
14323     if test "$with_junit" = "yes"; then
14324         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14325             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14326         elif test -e /usr/share/java/junit4.jar; then
14327             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14328         else
14329            if test -e /usr/share/lib/java/junit.jar; then
14330               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14331            else
14332               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14333            fi
14334         fi
14335     else
14336         OOO_JUNIT_JAR=$with_junit
14337     fi
14338     if test "$_os" = "WINNT"; then
14339         PathFormat "$OOO_JUNIT_JAR"
14340         OOO_JUNIT_JAR="$formatted_path"
14341     fi
14342     printf 'import org.junit.Before;' > conftest.java
14343     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14344         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14345     else
14346         AC_MSG_ERROR(
14347 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14348  specify its pathname via --with-junit=..., or disable it via --without-junit])
14349     fi
14350     rm -f conftest.class conftest.java
14351     if test $OOO_JUNIT_JAR != ""; then
14352         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14353     fi
14355     AC_MSG_CHECKING([for included Hamcrest])
14356     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14357     if $JAVACOMPILER -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14358         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14359     else
14360         AC_MSG_RESULT([Not included])
14361         AC_MSG_CHECKING([for standalone hamcrest jar.])
14362         if test "$with_hamcrest" = "yes"; then
14363             if test -e /usr/share/lib/java/hamcrest.jar; then
14364                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14365             elif test -e /usr/share/java/hamcrest/core.jar; then
14366                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14367             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14368                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14369             else
14370                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14371             fi
14372         else
14373             HAMCREST_JAR=$with_hamcrest
14374         fi
14375         if test "$_os" = "WINNT"; then
14376             PathFormat "$HAMCREST_JAR"
14377             HAMCREST_JAR="$formatted_path"
14378         fi
14379         if $JAVACOMPILER -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14380             AC_MSG_RESULT([$HAMCREST_JAR])
14381         else
14382             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),
14383                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14384         fi
14385     fi
14386     rm -f conftest.class conftest.java
14388 AC_SUBST(OOO_JUNIT_JAR)
14389 AC_SUBST(HAMCREST_JAR)
14390 # set back LC_ALL to C after the java related tests...
14391 LC_ALL=C
14393 AC_SUBST(SCPDEFS)
14396 # check for wget and curl
14398 WGET=
14399 CURL=
14401 if test "$enable_fetch_external" != "no"; then
14403 CURL=`command -v curl`
14405 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14406     # wget new enough?
14407     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14408     if test $? -eq 0; then
14409         WGET=$i
14410         break
14411     fi
14412 done
14414 if test -z "$WGET" -a -z "$CURL"; then
14415     AC_MSG_ERROR([neither wget nor curl found!])
14420 AC_SUBST(WGET)
14421 AC_SUBST(CURL)
14424 # check for sha256sum
14426 SHA256SUM=
14428 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14429     eval "$i -a 256 --version" > /dev/null 2>&1
14430     ret=$?
14431     if test $ret -eq 0; then
14432         SHA256SUM="$i -a 256"
14433         break
14434     fi
14435 done
14437 if test -z "$SHA256SUM"; then
14438     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14439         eval "$i --version" > /dev/null 2>&1
14440         ret=$?
14441         if test $ret -eq 0; then
14442             SHA256SUM=$i
14443             break
14444         fi
14445     done
14448 if test -z "$SHA256SUM"; then
14449     AC_MSG_ERROR([no sha256sum found!])
14452 AC_SUBST(SHA256SUM)
14454 dnl ===================================================================
14455 dnl Dealing with l10n options
14456 dnl ===================================================================
14457 AC_MSG_CHECKING([which languages to be built])
14458 # get list of all languages
14459 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14460 # the sed command does the following:
14461 #   + if a line ends with a backslash, append the next line to it
14462 #   + adds " on the beginning of the value (after =)
14463 #   + adds " at the end of the value
14464 #   + removes en-US; we want to put it on the beginning
14465 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
14466 [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)]
14467 ALL_LANGS="en-US $completelangiso"
14468 # check the configured localizations
14469 WITH_LANG="$with_lang"
14471 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14472 # (Norwegian is "nb" and "nn".)
14473 if test "$WITH_LANG" = "no"; then
14474     WITH_LANG=
14477 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14478     AC_MSG_RESULT([en-US])
14479 else
14480     AC_MSG_RESULT([$WITH_LANG])
14481     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14482     if test -z "$MSGFMT"; then
14483         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14484             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14485         elif test -x "/opt/lo/bin/msgfmt"; then
14486             MSGFMT="/opt/lo/bin/msgfmt"
14487         else
14488             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14489             if test -z "$MSGFMT"; then
14490                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14491             fi
14492         fi
14493     fi
14494     if test -z "$MSGUNIQ"; then
14495         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14496             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14497         elif test -x "/opt/lo/bin/msguniq"; then
14498             MSGUNIQ="/opt/lo/bin/msguniq"
14499         else
14500             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14501             if test -z "$MSGUNIQ"; then
14502                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14503             fi
14504         fi
14505     fi
14507 AC_SUBST(MSGFMT)
14508 AC_SUBST(MSGUNIQ)
14509 # check that the list is valid
14510 for lang in $WITH_LANG; do
14511     test "$lang" = "ALL" && continue
14512     # need to check for the exact string, so add space before and after the list of all languages
14513     for vl in $ALL_LANGS; do
14514         if test "$vl" = "$lang"; then
14515            break
14516         fi
14517     done
14518     if test "$vl" != "$lang"; then
14519         # if you're reading this - you prolly quoted your languages remove the quotes ...
14520         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14521     fi
14522 done
14523 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14524     echo $WITH_LANG | grep -q en-US
14525     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14527 # list with substituted ALL
14528 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14529 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14530 test "$WITH_LANG" = "en-US" && WITH_LANG=
14531 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14532     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14533     ALL_LANGS=`echo $ALL_LANGS qtz`
14535 AC_SUBST(ALL_LANGS)
14536 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14537 AC_SUBST(WITH_LANG)
14538 AC_SUBST(WITH_LANG_LIST)
14539 AC_SUBST(GIT_NEEDED_SUBMODULES)
14541 WITH_POOR_HELP_LOCALIZATIONS=
14542 if test -d "$SRC_ROOT/translations/source"; then
14543     for l in `ls -1 $SRC_ROOT/translations/source`; do
14544         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14545             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14546         fi
14547     done
14549 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14551 if test -n "$with_locales" -a "$with_locales" != ALL; then
14552     WITH_LOCALES="$with_locales"
14554     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14555     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14556     # config_host/config_locales.h.in
14557     for locale in $WITH_LOCALES; do
14558         lang=${locale%_*}
14560         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14562         case $lang in
14563         hi|mr*ne)
14564             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14565             ;;
14566         bg|ru)
14567             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14568             ;;
14569         esac
14570     done
14571 else
14572     AC_DEFINE(WITH_LOCALE_ALL)
14574 AC_SUBST(WITH_LOCALES)
14576 dnl git submodule update --reference
14577 dnl ===================================================================
14578 if test -n "${GIT_REFERENCE_SRC}"; then
14579     for repo in ${GIT_NEEDED_SUBMODULES}; do
14580         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14581             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14582         fi
14583     done
14585 AC_SUBST(GIT_REFERENCE_SRC)
14587 dnl git submodules linked dirs
14588 dnl ===================================================================
14589 if test -n "${GIT_LINK_SRC}"; then
14590     for repo in ${GIT_NEEDED_SUBMODULES}; do
14591         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14592             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14593         fi
14594     done
14596 AC_SUBST(GIT_LINK_SRC)
14598 dnl branding
14599 dnl ===================================================================
14600 AC_MSG_CHECKING([for alternative branding images directory])
14601 # initialize mapped arrays
14602 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14603 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14605 if test -z "$with_branding" -o "$with_branding" = "no"; then
14606     AC_MSG_RESULT([none])
14607     DEFAULT_BRAND_IMAGES="$brand_files"
14608 else
14609     if ! test -d $with_branding ; then
14610         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14611     else
14612         AC_MSG_RESULT([$with_branding])
14613         CUSTOM_BRAND_DIR="$with_branding"
14614         for lfile in $brand_files
14615         do
14616             if ! test -f $with_branding/$lfile ; then
14617                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14618                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14619             else
14620                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14621             fi
14622         done
14623         check_for_progress="yes"
14624     fi
14626 AC_SUBST([BRAND_INTRO_IMAGES])
14627 AC_SUBST([CUSTOM_BRAND_DIR])
14628 AC_SUBST([CUSTOM_BRAND_IMAGES])
14629 AC_SUBST([DEFAULT_BRAND_IMAGES])
14632 AC_MSG_CHECKING([for 'intro' progress settings])
14633 PROGRESSBARCOLOR=
14634 PROGRESSSIZE=
14635 PROGRESSPOSITION=
14636 PROGRESSFRAMECOLOR=
14637 PROGRESSTEXTCOLOR=
14638 PROGRESSTEXTBASELINE=
14640 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14641     source "$with_branding/progress.conf"
14642     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14643 else
14644     AC_MSG_RESULT([none])
14647 AC_SUBST(PROGRESSBARCOLOR)
14648 AC_SUBST(PROGRESSSIZE)
14649 AC_SUBST(PROGRESSPOSITION)
14650 AC_SUBST(PROGRESSFRAMECOLOR)
14651 AC_SUBST(PROGRESSTEXTCOLOR)
14652 AC_SUBST(PROGRESSTEXTBASELINE)
14655 dnl ===================================================================
14656 dnl Custom build version
14657 dnl ===================================================================
14658 AC_MSG_CHECKING([for extra build ID])
14659 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14660     EXTRA_BUILDID="$with_extra_buildid"
14662 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14663 if test -n "$EXTRA_BUILDID" ; then
14664     AC_MSG_RESULT([$EXTRA_BUILDID])
14665 else
14666     AC_MSG_RESULT([not set])
14668 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14670 OOO_VENDOR=
14671 AC_MSG_CHECKING([for vendor])
14672 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14673     OOO_VENDOR="$USERNAME"
14675     if test -z "$OOO_VENDOR"; then
14676         OOO_VENDOR="$USER"
14677     fi
14679     if test -z "$OOO_VENDOR"; then
14680         OOO_VENDOR="`id -u -n`"
14681     fi
14683     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14684 else
14685     OOO_VENDOR="$with_vendor"
14686     AC_MSG_RESULT([$OOO_VENDOR])
14688 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14689 AC_SUBST(OOO_VENDOR)
14691 if test "$_os" = "Android" ; then
14692     ANDROID_PACKAGE_NAME=
14693     AC_MSG_CHECKING([for Android package name])
14694     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14695         if test -n "$ENABLE_DEBUG"; then
14696             # Default to the package name that makes ndk-gdb happy.
14697             ANDROID_PACKAGE_NAME="org.libreoffice"
14698         else
14699             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14700         fi
14702         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14703     else
14704         ANDROID_PACKAGE_NAME="$with_android_package_name"
14705         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14706     fi
14707     AC_SUBST(ANDROID_PACKAGE_NAME)
14710 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14711 if test "$with_compat_oowrappers" = "yes"; then
14712     WITH_COMPAT_OOWRAPPERS=TRUE
14713     AC_MSG_RESULT(yes)
14714 else
14715     WITH_COMPAT_OOWRAPPERS=
14716     AC_MSG_RESULT(no)
14718 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14720 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14721 AC_MSG_CHECKING([for install dirname])
14722 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14723     INSTALLDIRNAME="$with_install_dirname"
14725 AC_MSG_RESULT([$INSTALLDIRNAME])
14726 AC_SUBST(INSTALLDIRNAME)
14728 AC_MSG_CHECKING([for prefix])
14729 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14730 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14731 PREFIXDIR="$prefix"
14732 AC_MSG_RESULT([$PREFIXDIR])
14733 AC_SUBST(PREFIXDIR)
14735 LIBDIR=[$(eval echo $(eval echo $libdir))]
14736 AC_SUBST(LIBDIR)
14738 DATADIR=[$(eval echo $(eval echo $datadir))]
14739 AC_SUBST(DATADIR)
14741 MANDIR=[$(eval echo $(eval echo $mandir))]
14742 AC_SUBST(MANDIR)
14744 DOCDIR=[$(eval echo $(eval echo $docdir))]
14745 AC_SUBST(DOCDIR)
14747 BINDIR=[$(eval echo $(eval echo $bindir))]
14748 AC_SUBST(BINDIR)
14750 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14751 AC_SUBST(INSTALLDIR)
14753 TESTINSTALLDIR="${BUILDDIR}/test-install"
14754 AC_SUBST(TESTINSTALLDIR)
14757 # ===================================================================
14758 # OAuth2 id and secrets
14759 # ===================================================================
14761 AC_MSG_CHECKING([for Google Drive client id and secret])
14762 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14763     AC_MSG_RESULT([not set])
14764     GDRIVE_CLIENT_ID="\"\""
14765     GDRIVE_CLIENT_SECRET="\"\""
14766 else
14767     AC_MSG_RESULT([set])
14768     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14769     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14771 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14772 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14774 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14775 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14776     AC_MSG_RESULT([not set])
14777     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14778     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14779 else
14780     AC_MSG_RESULT([set])
14781     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14782     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14784 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14785 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14787 AC_MSG_CHECKING([for OneDrive client id and secret])
14788 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14789     AC_MSG_RESULT([not set])
14790     ONEDRIVE_CLIENT_ID="\"\""
14791     ONEDRIVE_CLIENT_SECRET="\"\""
14792 else
14793     AC_MSG_RESULT([set])
14794     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14795     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14797 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14798 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14801 dnl ===================================================================
14802 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14803 dnl --enable-dependency-tracking configure option
14804 dnl ===================================================================
14805 AC_MSG_CHECKING([whether to enable dependency tracking])
14806 if test "$enable_dependency_tracking" = "no"; then
14807     nodep=TRUE
14808     AC_MSG_RESULT([no])
14809 else
14810     AC_MSG_RESULT([yes])
14812 AC_SUBST(nodep)
14814 dnl ===================================================================
14815 dnl Number of CPUs to use during the build
14816 dnl ===================================================================
14817 AC_MSG_CHECKING([for number of processors to use])
14818 # plain --with-parallelism is just the default
14819 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14820     if test "$with_parallelism" = "no"; then
14821         PARALLELISM=0
14822     else
14823         PARALLELISM=$with_parallelism
14824     fi
14825 else
14826     if test "$enable_icecream" = "yes"; then
14827         PARALLELISM="40"
14828     else
14829         case `uname -s` in
14831         Darwin|FreeBSD|NetBSD|OpenBSD)
14832             PARALLELISM=`sysctl -n hw.ncpu`
14833             ;;
14835         Linux)
14836             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14837         ;;
14838         # what else than above does profit here *and* has /proc?
14839         *)
14840             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14841             ;;
14842         esac
14844         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14845         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14846     fi
14849 if test $PARALLELISM -eq 0; then
14850     AC_MSG_RESULT([explicit make -j option needed])
14851 else
14852     AC_MSG_RESULT([$PARALLELISM])
14854 AC_SUBST(PARALLELISM)
14857 # Set up ILIB for MSVC build
14859 ILIB1=
14860 if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
14861     ILIB="."
14862     if test -n "$JAVA_HOME"; then
14863         ILIB="$ILIB;$JAVA_HOME/lib"
14864     fi
14865     ILIB1=-link
14866     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14867     ILIB="$ILIB;$formatted_path"
14868     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14869     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14870     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14871     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14872         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14873         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14874     fi
14875     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14876     ucrtlibpath_formatted=$formatted_path
14877     ILIB="$ILIB;$ucrtlibpath_formatted"
14878     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14879     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14880         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14881         ILIB="$ILIB;$formatted_path"
14882     else
14883         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14884         ILIB="$ILIB;$formatted_path"
14885     fi
14887     if test "$cross_compiling" != "yes"; then
14888         ILIB_FOR_BUILD="$ILIB"
14889     fi
14891 AC_SUBST(ILIB)
14892 AC_SUBST(ILIB_FOR_BUILD)
14894 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14895 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14896 dnl from consteval constructor initializing const variable",
14897 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14898 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14899 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14900 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14901 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14902 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)" (which appears to be
14903 dnl fixed at least in Visual Studio Community 2022 Preview 17.9.0 Preview 5.0),
14904 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14905 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14906 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14907 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17), or
14908 dnl <https://developercommunity.visualstudio.com/t/Bogus-error-C2440-with-consteval-constru/10579616>
14909 dnl "Bogus error C2440 with consteval constructor (/std:c++20)":
14910 have_cpp_consteval=
14911 AC_LANG_PUSH([C++])
14912 save_CXX=$CXX
14913 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14914     CXX="env LIB=$ILIB $CXX"
14916 save_CXXFLAGS=$CXXFLAGS
14917 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14918 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14919         struct S {
14920             consteval S() { i = 1; }
14921             int i = 0;
14922         };
14923         S const s;
14925         struct S1 {
14926              int a;
14927              consteval S1(int n): a(n) {}
14928         };
14929         struct S2 {
14930             S1 x;
14931             S2(): x(0) {}
14932         };
14934         struct S3 {
14935             consteval S3() {}
14936             union {
14937                 int a;
14938                 unsigned b = 0;
14939             };
14940         };
14941         void f() { S3(); }
14943         struct S4 { consteval S4() = default; };
14944         void f4(bool b) { b ? S4() : S4(); }
14946         struct S5 {
14947             consteval S5() { c = 0; }
14948             char * f() { return &c; }
14949             union {
14950                 char c;
14951                 int i;
14952             };
14953         };
14954         auto s5 = S5().f();
14956         struct S6 {
14957             consteval S6(char const (&lit)[[2]]) {
14958                 buf[[0]] = lit[[0]];
14959                 buf[[1]] = lit[[1]];
14960             }
14961             union {
14962                 int x;
14963                 char buf[[2]];
14964             };
14965         };
14966         void f6() { S6("a"); }
14967     ], [
14968         return (s.i == 1) ? 0 : 1;
14969     ])], [
14970         have_cpp_consteval=1
14971         AC_MSG_RESULT([yes])
14972     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14973 CXX=$save_CXX
14974 CXXFLAGS=$save_CXXFLAGS
14975 AC_LANG_POP([C++])
14976 if test -n "$have_cpp_consteval" && test "$COM_IS_CLANG" = TRUE && test -n "$BUILDING_PCH_WITH_OBJ"
14977 then
14978     AC_MSG_CHECKING([whether $CXX_BASE has working consteval in combination with PCH])
14979     dnl ...that does not suffer from <https://github.com/llvm/llvm-project/issues/81745> "undefined
14980     dnl reference to consteval constructor exported from module" (which also affects PCH, see
14981     dnl <https://lists.freedesktop.org/archives/libreoffice/2024-February/091564.html> "Our Clang
14982     dnl --enable-pch setup is known broken"):
14983     printf 'export module M;\nexport struct S1 { consteval S1(int) {} };' >conftest.cppm
14984     $CXX $CXXFLAGS $CXXFLAGS_CXX11 --precompile conftest.cppm
14985     rm conftest.cppm
14986     AC_LANG_PUSH([C++])
14987     save_CXXFLAGS=$CXXFLAGS
14988     save_LDFLAGS=$LDFLAGS
14989     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14990     LDFLAGS="$LDFLAGS -fmodule-file=M=conftest.pcm conftest.pcm"
14991     AC_LINK_IFELSE([AC_LANG_PROGRAM([
14992         import M;
14993     ], [
14994         struct S2 { S1 s = 0; };
14995         S2 s;
14996     ])], [
14997         AC_MSG_RESULT([yes])
14998     ], [
14999         have_cpp_consteval=
15000         AC_MSG_RESULT([no])])
15001     CXXFLAGS=$save_CXXFLAGS
15002     LDFLAGS=$save_LDFLAGS
15003     AC_LANG_POP([C++])
15004     rm conftest.pcm
15006 if test -n "$have_cpp_consteval"; then
15007     AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
15010 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 std::strong_order])
15011 dnl ...which is known to not be implemented in libc++ prior to
15012 dnl <https://github.com/llvm/llvm-project/commit/d8380ad977e94498e170b06449c81f1fc27da7b5> "[libc++]
15013 dnl [P1614] Implement [cmp.alg]'s std::{strong,weak,partial}_order" in LLVM 14:
15014 AC_LANG_PUSH([C++])
15015 save_CXX=$CXX
15016 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
15017     CXX="env LIB=$ILIB $CXX"
15019 save_CXXFLAGS=$CXXFLAGS
15020 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
15021 AC_LINK_IFELSE([AC_LANG_PROGRAM([
15022         #include <compare>
15023     ], [
15024         (void) (std::strong_order(1.0, 2.0) < 0);
15025     ])], [
15026         AC_DEFINE([HAVE_CPP_STRONG_ORDER],[1])
15027         AC_MSG_RESULT([yes])
15028     ], [AC_MSG_RESULT([no])])
15029 CXX=$save_CXX
15030 CXXFLAGS=$save_CXXFLAGS
15031 AC_LANG_POP([C++])
15033 # ===================================================================
15034 # Creating bigger shared library to link against
15035 # ===================================================================
15036 AC_MSG_CHECKING([whether to create huge library])
15037 MERGELIBS=
15038 MERGELIBS_MORE=
15040 if test $_os = iOS -o $_os = Android; then
15041     # Never any point in mergelibs for these as we build just static
15042     # libraries anyway...
15043     enable_mergelibs=no
15046 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
15047     if test "$enable_mergelibs" = "more"; then
15048         MERGELIBS="TRUE"
15049         MERGELIBS_MORE="TRUE"
15050         AC_MSG_RESULT([yes (more)])
15051         AC_DEFINE(ENABLE_MERGELIBS)
15052         AC_DEFINE(ENABLE_MERGELIBS_MORE)
15053     elif test "$enable_mergelibs" = "yes" -o "$enable_mergelibs" = ""; then
15054         MERGELIBS="TRUE"
15055         AC_MSG_RESULT([yes])
15056         AC_DEFINE(ENABLE_MERGELIBS)
15057     else
15058         AC_MSG_ERROR([unknown value --enable-mergelibs=$enable_mergelibs])
15059     fi
15060 else
15061     AC_MSG_RESULT([no])
15063 AC_SUBST([MERGELIBS])
15064 AC_SUBST([MERGELIBS_MORE])
15066 dnl ===================================================================
15067 dnl icerun is a wrapper that stops us spawning tens of processes
15068 dnl locally - for tools that can't be executed on the compile cluster
15069 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
15070 dnl ===================================================================
15071 AC_MSG_CHECKING([whether to use icerun wrapper])
15072 ICECREAM_RUN=
15073 if test "$enable_icecream" = "yes" && command -v icerun >/dev/null ; then
15074     ICECREAM_RUN=icerun
15075     AC_MSG_RESULT([yes])
15076 else
15077     AC_MSG_RESULT([no])
15079 AC_SUBST(ICECREAM_RUN)
15081 dnl ===================================================================
15082 dnl Setup the ICECC_VERSION for the build the same way it was set for
15083 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
15084 dnl ===================================================================
15085 x_ICECC_VERSION=[\#]
15086 if test -n "$ICECC_VERSION" ; then
15087     x_ICECC_VERSION=
15089 AC_SUBST(x_ICECC_VERSION)
15090 AC_SUBST(ICECC_VERSION)
15092 dnl ===================================================================
15094 AC_MSG_CHECKING([MPL subset])
15095 MPL_SUBSET=
15096 LICENSE="LGPL"
15098 if test "$enable_mpl_subset" = "yes"; then
15099     mpl_error_string=
15100     newline=$'\n    *'
15101     warn_report=false
15102     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
15103         warn_report=true
15104     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
15105         warn_report=true
15106     fi
15107     if test "$warn_report" = "true"; then
15108         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
15109     fi
15110     if test "x$enable_postgresql_sdbc" != "xno"; then
15111         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
15112     fi
15113     if test "$enable_lotuswordpro" = "yes"; then
15114         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
15115     fi
15116     if test -n "$ENABLE_POPPLER"; then
15117         if test "x$SYSTEM_POPPLER" = "x"; then
15118             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
15119         fi
15120     fi
15121     # cf. m4/libo_check_extension.m4
15122     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
15123         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
15124     fi
15125     denied_themes=
15126     filtered_themes=
15127     for theme in $WITH_THEMES; do
15128         case $theme in
15129         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
15130             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
15131         *)
15132             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
15133         esac
15134     done
15135     if test "x$denied_themes" != "x"; then
15136         if test "x$filtered_themes" == "x"; then
15137             filtered_themes="colibre"
15138         fi
15139         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
15140     fi
15142     ENABLE_OPENGL_TRANSITIONS=
15144     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
15145         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
15146     fi
15148     if test "x$mpl_error_string" != "x"; then
15149         AC_MSG_ERROR([$mpl_error_string])
15150     fi
15152     MPL_SUBSET="TRUE"
15153     LICENSE="MPL-2.0"
15154     AC_DEFINE(MPL_HAVE_SUBSET)
15155     AC_MSG_RESULT([only])
15156 else
15157     AC_MSG_RESULT([no restrictions])
15159 AC_SUBST(MPL_SUBSET)
15160 AC_SUBST(LICENSE)
15162 dnl ===================================================================
15164 AC_MSG_CHECKING([formula logger])
15165 ENABLE_FORMULA_LOGGER=
15167 if test "x$enable_formula_logger" = "xyes"; then
15168     AC_MSG_RESULT([yes])
15169     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15170     ENABLE_FORMULA_LOGGER=TRUE
15171 elif test -n "$ENABLE_DBGUTIL" ; then
15172     AC_MSG_RESULT([yes])
15173     AC_DEFINE(ENABLE_FORMULA_LOGGER)
15174     ENABLE_FORMULA_LOGGER=TRUE
15175 else
15176     AC_MSG_RESULT([no])
15179 AC_SUBST(ENABLE_FORMULA_LOGGER)
15181 dnl ===================================================================
15182 dnl Checking for active Antivirus software.
15183 dnl ===================================================================
15185 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
15186     AC_MSG_CHECKING([for active Antivirus software])
15187     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
15188     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
15189     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
15190         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
15191             AC_MSG_RESULT([found])
15192             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
15193             echo $EICAR_STRING > $SRC_ROOT/eicar
15194             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
15195             rm $SRC_ROOT/eicar
15196             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15197                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15198             fi
15199             echo $EICAR_STRING > $BUILDDIR/eicar
15200             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
15201             rm $BUILDDIR/eicar
15202             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
15203                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
15204             fi
15205             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"
15206         else
15207             AC_MSG_RESULT([not found])
15208         fi
15209     else
15210         AC_MSG_RESULT([n/a])
15211     fi
15214 dnl ===================================================================
15216 AC_MSG_CHECKING([for coredumpctl support])
15217 if test -z "$with_coredumpctl" && test $_os != Linux; then
15218     with_coredumpctl=no
15220 if test "$with_coredumpctl" = no; then
15221     WITH_COREDUMPCTL=
15222 else
15223     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
15224     AC_PATH_PROG(JQ, jq)
15225     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
15226     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
15227     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
15228         || test -z "$SYSTEMD_RUN"
15229     then
15230         if test -z "$with_coredumpctl"; then
15231             WITH_COREDUMPCTL=
15232         else
15233             if test -z "$COREDUMPCTL"; then
15234                 AC_MSG_ERROR([coredumpctl not found])
15235             fi
15236             if test -z "$JQ"; then
15237                 AC_MSG_ERROR([jq not found])
15238             fi
15239             if test -z "$SYSTEMD_ESCAPE"; then
15240                 AC_MSG_ERROR([systemd-escape not found])
15241             fi
15242             if test -z "$SYSTEMD_RUN"; then
15243                 AC_MSG_ERROR([systemd-run not found])
15244             fi
15245         fi
15246     else
15247         WITH_COREDUMPCTL=TRUE
15248     fi
15250 if test -z "$WITH_COREDUMPCTL"; then
15251     AC_MSG_RESULT([no])
15252 else
15253     AC_MSG_RESULT([yes])
15255 AC_SUBST(COREDUMPCTL)
15256 AC_SUBST(JQ)
15257 AC_SUBST(SYSTEMD_ESCAPE)
15258 AC_SUBST(SYSTEMD_RUN)
15259 AC_SUBST(WITH_COREDUMPCTL)
15261 dnl ===================================================================
15262 dnl Checking whether to use a keep-awake helper
15263 dnl ===================================================================
15265 AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby])
15266 if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then
15267     AC_MSG_RESULT([no])
15268 elif test "$with_keep_awake" = "yes"; then
15269     AC_MSG_RESULT([yes (autodetect)])
15270     AC_MSG_CHECKING([for a suitable keep-awake command])
15271     if test "$_os" = "WINNT"; then
15272         PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')"
15273         if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then
15274             AC_MSG_RESULT([using "Awake"])
15275             # need to pass the windows-PID to awake, so get the PGID of the shell first to get
15276             # make's PID and then use that to get the windows-PID.
15277             # lots of quoting for both make ($$) as well as configure ('"'"') make that command
15278             # much scarier looking than it actually is. Using make's shell instead of subshells in
15279             # the recipe to keep the command that's echoed by make short.
15280             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}'"'"') &'
15281         else
15282             AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command])
15283         fi
15284     elif test "$_os" = "Darwin"; then
15285         AC_MSG_RESULT([using "caffeinate"])
15286         KEEP_AWAKE_CMD="caffeinate"
15287     else
15288         AC_MSG_ERROR([no default available for $_os, please specify manually])
15289     fi
15290 else
15291     AC_MSG_RESULT([yes (custom command: $with_keep_awake)])
15293 AC_SUBST(KEEP_AWAKE_CMD)
15295 dnl ===================================================================
15296 dnl Setting up the environment.
15297 dnl ===================================================================
15298 AC_MSG_NOTICE([setting up the build environment variables...])
15300 AC_SUBST(COMPATH)
15302 if test "$build_os" = "cygwin" -o "$build_os" = wsl -o -n "$WSL_ONLY_AS_HELPER"; then
15303     if test -d "$COMPATH_unix/atlmfc/lib/spectre"; then
15304         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
15305         ATL_INCLUDE="$COMPATH/atlmfc/include"
15306     elif test -d "$COMPATH_unix/atlmfc/lib"; then
15307         ATL_LIB="$COMPATH/atlmfc/lib"
15308         ATL_INCLUDE="$COMPATH/atlmfc/include"
15309     else
15310         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
15311         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
15312     fi
15313     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
15314     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
15315     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
15318 if test "$build_os" = "cygwin"; then
15319     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
15320     PathFormat "/usr/bin/find.exe"
15321     FIND="$formatted_path"
15322     PathFormat "/usr/bin/sort.exe"
15323     SORT="$formatted_path"
15324     PathFormat "/usr/bin/grep.exe"
15325     WIN_GREP="$formatted_path"
15326     PathFormat "/usr/bin/ls.exe"
15327     WIN_LS="$formatted_path"
15328     PathFormat "/usr/bin/touch.exe"
15329     WIN_TOUCH="$formatted_path"
15330 else
15331     FIND=find
15332     SORT=sort
15335 AC_SUBST(ATL_INCLUDE)
15336 AC_SUBST(ATL_LIB)
15337 AC_SUBST(FIND)
15338 AC_SUBST(SORT)
15339 AC_SUBST(WIN_GREP)
15340 AC_SUBST(WIN_LS)
15341 AC_SUBST(WIN_TOUCH)
15343 AC_SUBST(BUILD_TYPE)
15345 AC_SUBST(SOLARINC)
15347 PathFormat "$PERL"
15348 PERL="$formatted_path"
15349 AC_SUBST(PERL)
15351 if test -n "$TMPDIR"; then
15352     TEMP_DIRECTORY="$TMPDIR"
15353     if test -n "$WSL_ONLY_AS_HELPER"; then
15354        TEMP_DIRECTORY=$(wslpath -m "$TEMP_DIRECTORY")
15355     fi
15356 else
15357     TEMP_DIRECTORY="/tmp"
15359 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
15360 if test "$build_os" = "cygwin"; then
15361     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
15362     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
15364 AC_SUBST(TEMP_DIRECTORY)
15365 AC_SUBST(CYGWIN_BASH)
15367 # setup the PATH for the environment
15368 if test -n "$LO_PATH_FOR_BUILD"; then
15369     LO_PATH="$LO_PATH_FOR_BUILD"
15370     case "$host_os" in
15371     cygwin*|wsl*)
15372         pathmunge "$MSVC_HOST_PATH" "before"
15373         ;;
15374     esac
15375 else
15376     LO_PATH="$PATH"
15378     case "$host_os" in
15380     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
15381         if test "$ENABLE_JAVA" != ""; then
15382             pathmunge "$JAVA_HOME/bin" "after"
15383         fi
15384         ;;
15386     cygwin*|wsl*)
15387         # Win32 make needs native paths
15388         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15389             LO_PATH=`cygpath -p -m "$PATH"`
15390         fi
15391         if test "$WIN_BUILD_ARCH" = "x64"; then
15392             # needed for msi packaging
15393             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15394         fi
15395         if test "$WIN_BUILD_ARCH" = "arm64"; then
15396             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15397             # the x86 ones probably would work just as well...
15398             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15399         fi
15400         # .NET 4.6 and higher don't have bin directory
15401         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15402             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15403         fi
15404         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15405         pathmunge "$CSC_PATH" "before"
15406         pathmunge "$MIDL_PATH" "before"
15407         pathmunge "$AL_PATH" "before"
15408         pathmunge "$MSVC_MULTI_PATH" "before"
15409         pathmunge "$MSVC_BUILD_PATH" "before"
15410         if test -n "$MSBUILD_PATH" ; then
15411             pathmunge "$MSBUILD_PATH" "before"
15412         fi
15413         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15414         if test "$ENABLE_JAVA" != ""; then
15415             if test -d "$JAVA_HOME/jre/bin/client"; then
15416                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15417             fi
15418             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15419                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15420             fi
15421             pathmunge "$JAVA_HOME/bin" "before"
15422         fi
15423         pathmunge "$MSVC_HOST_PATH" "before"
15424         ;;
15426     solaris*)
15427         pathmunge "/usr/css/bin" "before"
15428         if test "$ENABLE_JAVA" != ""; then
15429             pathmunge "$JAVA_HOME/bin" "after"
15430         fi
15431         ;;
15432     esac
15435 AC_SUBST(LO_PATH)
15437 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15438 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15439     x_LO_ELFCHECK_ALLOWLIST=
15440 else
15441     x_LO_ELFCHECK_ALLOWLIST=[\#]
15443 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15444 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15446 libo_FUZZ_SUMMARY
15448 # Generate a configuration sha256 we can use for deps
15449 if test -f config_host.mk; then
15450     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15452 if test -f config_host_lang.mk; then
15453     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15456 CFLAGS=$my_original_CFLAGS
15457 CXXFLAGS=$my_original_CXXFLAGS
15458 CPPFLAGS=$my_original_CPPFLAGS
15460 AC_CONFIG_LINKS([include:include])
15462 if test -n "$WSL_ONLY_AS_HELPER"; then
15463     # while we configure in linux, we actually compile in "cygwin" (close enough at least)
15464     build=$host
15465     PathFormat "$SRC_ROOT"
15466     SRC_ROOT="$formatted_path"
15467     PathFormat "$BUILDDIR"
15468     BUILDDIR="$formatted_path"
15469     # git-bash has (gnu) tar, curl and sha256sum
15470     CURL="curl.exe"
15471     WGET=
15472     GNUTAR="tar.exe"
15473     SHA256SUM="sha256sum.exe"
15474     # TODO: maybe switch to strawberry-perl right away?
15475     # only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
15476     PERL="perl.exe"
15477     # use flex, gperf and nasm from wsl-container
15478     # if using absolute path, would need to use double-leading slash for the msys path mangling
15479     FLEX="$WSL $FLEX"
15480     NASM="$WSL $NASM"
15481     # some externals (libebook) check for it with AC_PATH_PROGS, and that only accepts overrides
15482     # with an absolute path/requires the value to begin with a slash
15483     GPERF="/c/Windows/system32/$WSL gperf"
15484     # append strawberry tools dir to PATH (for e.g. windres, ar)
15485     LO_PATH="$LO_PATH:$STRAWBERRY_TOOLS"
15486     # temp-dir needs to be in windows realm, hardcode for now
15487     if test "$TEMP_DIRECTORY" = /tmp; then
15488         mkdir -p tmp
15489         TEMP_DIRECTORY="$BUILDDIR/tmp"
15490     fi
15493 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15494 # BUILD platform configuration] - otherwise breaks cross building
15495 AC_CONFIG_FILES([
15496                  config_host_lang.mk
15497                  Makefile
15498                  bin/bffvalidator.sh
15499                  bin/odfvalidator.sh
15500                  bin/officeotron.sh
15501                  instsetoo_native/util/openoffice.lst
15502                  sysui/desktop/macosx/Info.plist
15503                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15504                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15505                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15506 # map unix-style mount dirs to windows directories: /mnt/c/foobar -> C:/foobar
15507 # easier to do it in a postprocessing command than to modify every single variable
15508 AC_CONFIG_FILES([config_host.mk], [
15509     if test -n "$WSL_ONLY_AS_HELPER"; then
15510         sed -i -e 's#/mnt/\([[:alpha:]]\)/#\u\1:/#g' config_host.mk
15511     fi], [WSL_ONLY_AS_HELPER=$WSL_ONLY_AS_HELPER])
15513 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15514 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15515 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15516 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15517 AC_CONFIG_HEADERS([config_host/config_clang.h])
15518 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15519 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15520 AC_CONFIG_HEADERS([config_host/config_eot.h])
15521 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15522 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15523 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15524 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15525 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15526 AC_CONFIG_HEADERS([config_host/config_features.h])
15527 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15528 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15529 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15530 AC_CONFIG_HEADERS([config_host/config_folders.h])
15531 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15532 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15533 AC_CONFIG_HEADERS([config_host/config_gio.h])
15534 AC_CONFIG_HEADERS([config_host/config_global.h])
15535 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15536 AC_CONFIG_HEADERS([config_host/config_java.h])
15537 AC_CONFIG_HEADERS([config_host/config_langs.h])
15538 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15539 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15540 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15541 AC_CONFIG_HEADERS([config_host/config_locales.h])
15542 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15543 AC_CONFIG_HEADERS([config_host/config_oox.h])
15544 AC_CONFIG_HEADERS([config_host/config_options.h])
15545 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15546 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15547 AC_CONFIG_HEADERS([config_host/config_skia.h])
15548 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15549 AC_CONFIG_HEADERS([config_host/config_validation.h])
15550 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15551 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15552 AC_CONFIG_HEADERS([config_host/config_version.h])
15553 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15554 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15555 AC_CONFIG_HEADERS([config_host/config_python.h])
15556 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15557 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15558 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15559 AC_OUTPUT
15561 if test "$CROSS_COMPILING" = TRUE; then
15562     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15565 # touch the config timestamp file
15566 if test ! -f config_host.mk.stamp; then
15567     echo > config_host.mk.stamp
15568 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15569     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15570 else
15571     echo > config_host.mk.stamp
15574 # touch the config lang timestamp file
15575 if test ! -f config_host_lang.mk.stamp; then
15576     echo > config_host_lang.mk.stamp
15577 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15578     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15579 else
15580     echo > config_host_lang.mk.stamp
15584 if test \( "$STALE_MAKE" = "TRUE" \) \
15585         -a "$build_os" = "cygwin"; then
15587 cat << _EOS
15588 ****************************************************************************
15589 WARNING:
15590 Your make version is known to be horribly slow, and hard to debug
15591 problems with. To get a reasonably functional make please do:
15593 to install a pre-compiled binary make for Win32
15595  mkdir -p /opt/lo/bin
15596  cd /opt/lo/bin
15597  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15598  cp make-4.2.1-msvc.exe make
15599  chmod +x make
15601 to install from source:
15602 place yourself in a working directory of you choice.
15604  git clone git://git.savannah.gnu.org/make.git
15606  [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"]
15607  set PATH=%PATH%;C:\Cygwin\bin
15608  [or Cygwin64, if that is what you have]
15609  cd path-to-make-repo-you-cloned-above
15610  build_w32.bat --without-guile
15612 should result in a WinRel/gnumake.exe.
15613 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15615 Then re-run autogen.sh
15617 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15618 Alternatively, you can install the 'new' make where ever you want and make sure that `command -v make` finds it.
15620 _EOS
15624 cat << _EOF
15625 ****************************************************************************
15627 To show information on various make targets and make flags, run:
15628 $GNUMAKE help
15630 To just build, run:
15631 $GNUMAKE
15633 _EOF
15635 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15636     cat << _EOF
15637 After the build has finished successfully, you can immediately run what you built using the command:
15638 _EOF
15640     if test $_os = Darwin; then
15641         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15642     else
15643         echo instdir/program/soffice
15644     fi
15645     cat << _EOF
15647 If you want to run the unit tests, run:
15648 $GNUMAKE check
15650 _EOF
15653 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15654     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15655     cat "$WARNINGS_FILE_FOR_BUILD"
15656     echo
15659 if test -s "$WARNINGS_FILE"; then
15660     echo "HOST config ($WARNINGS_FILE)"
15661     cat "$WARNINGS_FILE"
15664 # Remove unneeded emconfigure artifacts
15665 rm -f a.out a.wasm a.out.js a.out.wasm
15667 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: