vcl: no raw pointers
[LibreOffice.git] / configure.ac
blobc8466ae65e0124657eabf12c5474a14d6d569bba
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.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     if test "$COM" = "MSC"; then
50         for f in $1; do
51             if test "x$f" != "x${f#-L}"; then
52                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
53             elif test "x$f" != "x${f#-l}"; then
54                 filteredlibs="$filteredlibs ${f:2}.lib"
55             else
56                 filteredlibs="$filteredlibs $f"
57             fi
58         done
59     else
60         for f in $1; do
61             case "$f" in
62                 # let's start with Fedora's paths for now
63                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
64                     # ignore it: on UNIXoids it is searched by default anyway
65                     # but if it's given explicitly then it may override other paths
66                     # (on macOS it would be an error to use it instead of SDK)
67                     ;;
68                 *)
69                     filteredlibs="$filteredlibs $f"
70                     ;;
71             esac
72         done
73     fi
76 PathFormat()
78     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
79     # function is called also on Unix.
80     #
81     # Return value: $formatted_path and $formatted_path_unix.
82     #
83     # $formatted_path is the argument in Windows format, but using forward slashes instead of
84     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
85     # or shell metacharacters).
86     #
87     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
88     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
89     # Unix pathname.
90     #
91     # Errors out if 8.3 names are needed but aren't present for some of the path components.
93     # Examples:
94     #
95     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
96     #
97     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
98     #
99     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
100     #
101     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
102     #
103     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
104     #
105     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
106     #
107     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
109     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
110         printf "PathFormat $1 ==> "
111     fi
113     formatted_path="$1"
114     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
115         if test "$build_os" = "wsl"; then
116             formatted_path=$(echo "$formatted_path" | tr -d '\r')
117         fi
119         pf_conv_to_dos=
120         # spaces,parentheses,brackets,braces are problematic in pathname
121         # so are backslashes
122         case "$formatted_path" in
123             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
124                 pf_conv_to_dos="yes"
125             ;;
126         esac
127         if test "$pf_conv_to_dos" = "yes"; then
128             if test "$build_os" = "wsl"; then
129                 case "$formatted_path" in
130                     /*)
131                         formatted_path=$(wslpath -w "$formatted_path")
132                         ;;
133                 esac
134                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
135             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
136                 formatted_path=`cygpath -sm "$formatted_path"`
137             else
138                 formatted_path=`cygpath -d "$formatted_path"`
139             fi
140             if test $? -ne 0;  then
141                 AC_MSG_ERROR([path conversion failed for "$1".])
142             fi
143         fi
144         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
145         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
146         if test "$fp_count_slash$fp_count_colon" != "00"; then
147             if test "$fp_count_colon" = "0"; then
148                 new_formatted_path=`realpath "$formatted_path"`
149                 if test $? -ne 0;  then
150                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
151                 else
152                     formatted_path="$new_formatted_path"
153                 fi
154             fi
155             if test "$build_os" = "wsl"; then
156                 if test "$fp_count_colon" != "0"; then
157                     formatted_path=$(wslpath "$formatted_path")
158                     local final_slash=
159                     case "$formatted_path" in
160                         */)
161                             final_slash=/
162                             ;;
163                     esac
164                     formatted_path=$(wslpath -m $formatted_path)
165                     case "$formatted_path" in
166                         */)
167                             ;;
168                         *)
169                             formatted_path="$formatted_path"$final_slash
170                             ;;
171                     esac
172                 else
173                     formatted_path=$(wslpath -m "$formatted_path")
174                 fi
175             else
176                 formatted_path=`cygpath -m "$formatted_path"`
177             fi
178             if test $? -ne 0;  then
179                 AC_MSG_ERROR([path conversion failed for "$1".])
180             fi
181         fi
182         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
183         if test "$fp_count_space" != "0"; then
184             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
185         fi
186     fi
187     if test "$build_os" = "wsl"; then
188         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
189         formatted_path_unix=$(wslpath "$formatted_path")
190     else
191         # But Cygwin can
192         formatted_path_unix="$formatted_path"
193     fi
196 AbsolutePath()
198     # There appears to be no simple and portable method to get an absolute and
199     # canonical path, so we try creating the directory if does not exist and
200     # utilizing the shell and pwd.
202     # Args: $1: A possibly relative pathname
203     # Return value: $absolute_path
205     # Convert to unix path, mkdir would treat c:/path as a relative path.
206     PathFormat "$1"
207     local rel="$formatted_path_unix"
208     absolute_path=""
209     test ! -e "$rel" && mkdir -p "$rel"
210     if test -d "$rel" ; then
211         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
212         absolute_path="$(pwd)"
213         cd - > /dev/null
214     else
215         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
216     fi
219 WARNINGS_FILE=config.warn
220 WARNINGS_FILE_FOR_BUILD=config.Build.warn
221 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
222 have_WARNINGS="no"
223 add_warning()
225     if test "$have_WARNINGS" = "no"; then
226         echo "*************************************" > "$WARNINGS_FILE"
227         have_WARNINGS="yes"
228         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
229             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
230             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
231         else
232             COLORWARN="* WARNING :"
233         fi
234     fi
235     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
238 dnl Some Mac User have the bad habit of letting a lot of crap
239 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
240 dnl that confuse the build.
241 dnl For the ones that use LODE, let's be nice and protect them
242 dnl from themselves
244 mac_sanitize_path()
246     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
247 dnl a common but nevertheless necessary thing that may be in a fancy
248 dnl path location is git, so make sure we have it
249     mac_git_path=`which git 2>/dev/null`
250     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
251         mac_path="$mac_path:`dirname $mac_git_path`"
252     fi
253 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
254 dnl path location is gpg, so make sure we find it
255     mac_gpg_path=`which gpg 2>/dev/null`
256     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
257         mac_path="$mac_path:`dirname $mac_gpg_path`"
258     fi
259     PATH="$mac_path"
260     unset mac_path
261     unset mac_git_path
262     unset mac_gpg_path
265 dnl semantically test a three digits version
266 dnl $1 - $3 = minimal version
267 dnl $4 - $6 = current version
269 check_semantic_version_three()
271     test "$4" -gt "$1" \
272         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
273         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
274     return $?
277 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
278 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
279 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
281 check_semantic_version_three_prefixed()
283     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
284     eval local MIN_MINOR="\$${1}_${2}_MINOR"
285     eval local MIN_TINY="\$${1}_${2}_TINY"
286     eval local CUR_MAJOR="\$${1}_MAJOR"
287     eval local CUR_MINOR="\$${1}_MINOR"
288     eval local CUR_TINY="\$${1}_TINY"
289     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
290     return $?
293 echo "********************************************************************"
294 echo "*"
295 echo "*   Running ${PACKAGE_NAME} build configuration."
296 echo "*"
297 echo "********************************************************************"
298 echo ""
300 dnl ===================================================================
301 dnl checks build and host OSes
302 dnl do this before argument processing to allow for platform dependent defaults
303 dnl ===================================================================
305 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
306 # Linux on WSL) trust that.
307 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
308     ac_cv_host="x86_64-pc-wsl"
309     ac_cv_host_cpu="x86_64"
310     ac_cv_host_os="wsl"
311     ac_cv_build="$ac_cv_host"
312     ac_cv_build_cpu="$ac_cv_host_cpu"
313     ac_cv_build_os="$ac_cv_host_os"
315     # Emulation of Cygwin's cygpath command for WSL.
316     cygpath()
317     {
318         if test -n "$UNITTEST_WSL_CYGPATH"; then
319             echo -n cygpath "$@" "==> "
320         fi
322         # Cygwin's real cygpath has a plethora of options but we use only a few here.
323         local args="$@"
324         local opt
325         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
326         OPTIND=1
328         while getopts dmuwlsp opt; do
329             case "$opt" in
330                 \?)
331                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
332                     ;;
333                 ?)
334                     eval opt_$opt=yes
335                     ;;
336             esac
337         done
339         shift $((OPTIND-1))
341         if test $# -ne 1; then
342             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
343         fi
345         local input="$1"
347         local result
349         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
350             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
352             if test -n "$opt_u"; then
353                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
354             fi
356             case "$input" in
357                 /mnt/*)
358                     # A Windows file in WSL format
359                     input=$(wslpath -w "$input")
360                     ;;
361                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
362                     # Already in Windows format
363                     ;;
364                 /*)
365                     input=$(wslpath -w "$input")
366                     ;;
367                 *)
368                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
369                     ;;
370             esac
371             if test -n "$opt_d" -o -n "$opt_s"; then
372                 input=$($WSL_LO_HELPER --8.3 "$input")
373             fi
374             if test -n "$opt_m"; then
375                 input="${input//\\//}"
376             fi
377             echo "$input"
378         else
379             # Print Unix path
381             case "$input" in
382                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
383                     wslpath -u "$input"
384                     ;;
385                 /)
386                     echo "$input"
387                     ;;
388                 *)
389                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
390                     ;;
391             esac
392         fi
393     }
395     if test -n "$UNITTEST_WSL_CYGPATH"; then
396         BUILDDIR=.
398         # Nothing special with these file names, just arbitrary ones picked to test with
399         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
400         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
401         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
402         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
403         # At least on my machine for instance this file does have an 8.3 name
404         cygpath -d /mnt/c/windows/WindowsUpdate.log
405         # But for instance this one doesn't
406         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
407         cygpath -ws /mnt/c/windows/WindowsUpdate.log
408         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
409         cygpath -ms /mnt/c/windows/WindowsUpdate.log
411         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
412         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
414         exit 0
415     fi
417     if test -z "$WSL_LO_HELPER"; then
418         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
419             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
420         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
421             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
422         fi
423     fi
424     if test -z "$WSL_LO_HELPER"; then
425         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
426     fi
429 AC_CANONICAL_HOST
430 AC_CANONICAL_BUILD
432 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
433     BUILDDIR=.
434     GREP=grep
436     # Use of PathFormat must be after AC_CANONICAL_BUILD above
437     PathFormat /
438     printf "$formatted_path , $formatted_path_unix\n"
440     PathFormat $PWD
441     printf "$formatted_path , $formatted_path_unix\n"
443     PathFormat "$PROGRAMFILESX86"
444     printf "$formatted_path , $formatted_path_unix\n"
446     exit 0
449 AC_MSG_CHECKING([for product name])
450 PRODUCTNAME="AC_PACKAGE_NAME"
451 if test -n "$with_product_name" -a "$with_product_name" != no; then
452     PRODUCTNAME="$with_product_name"
454 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
455     PRODUCTNAME="${PRODUCTNAME}Dev"
457 AC_MSG_RESULT([$PRODUCTNAME])
458 AC_SUBST(PRODUCTNAME)
459 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
460 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
462 dnl ===================================================================
463 dnl Our version is defined by the AC_INIT() at the top of this script.
464 dnl ===================================================================
466 AC_MSG_CHECKING([for package version])
467 if test -n "$with_package_version" -a "$with_package_version" != no; then
468     PACKAGE_VERSION="$with_package_version"
470 AC_MSG_RESULT([$PACKAGE_VERSION])
472 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
474 LIBO_VERSION_MAJOR=$1
475 LIBO_VERSION_MINOR=$2
476 LIBO_VERSION_MICRO=$3
477 LIBO_VERSION_PATCH=$4
479 LIBO_VERSION_SUFFIX=$5
481 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
482 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
483 # they get undoubled before actually passed to sed.
484 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
485 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
486 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
487 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
489 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
490 # three non-negative integers. Please find more information about CFBundleVersion at
491 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
493 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
494 # of at most three non-negative integers. Please find more information about
495 # CFBundleShortVersionString at
496 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
498 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
500 if test "$enable_macosx_sandbox" = yes; then
501     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
502     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
503 else
504     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
505     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
508 AC_SUBST(LIBO_VERSION_MAJOR)
509 AC_SUBST(LIBO_VERSION_MINOR)
510 AC_SUBST(LIBO_VERSION_MICRO)
511 AC_SUBST(LIBO_VERSION_PATCH)
512 AC_SUBST(LIBO_VERSION_SUFFIX)
513 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
514 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
515 AC_SUBST(MACOSX_BUNDLE_VERSION)
517 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
518 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
519 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
520 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
522 LIBO_THIS_YEAR=`date +%Y`
523 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
525 # replace backslashes, to get a valid c++ string
526 config_args=$(echo $ac_configure_args | tr '\\' '/')
527 AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
529 dnl ===================================================================
530 dnl Product version
531 dnl ===================================================================
532 AC_MSG_CHECKING([for product version])
533 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
534 AC_MSG_RESULT([$PRODUCTVERSION])
535 AC_SUBST(PRODUCTVERSION)
537 AC_PROG_EGREP
538 # AC_PROG_EGREP doesn't set GREP on all systems as well
539 AC_PATH_PROG(GREP, grep)
541 BUILDDIR=`pwd`
542 cd $srcdir
543 SRC_ROOT=`pwd`
544 cd $BUILDDIR
545 x_Cygwin=[\#]
547 dnl ======================================
548 dnl Required GObject introspection version
549 dnl ======================================
550 INTROSPECTION_REQUIRED_VERSION=1.32.0
552 dnl ===================================================================
553 dnl Search all the common names for GNU Make
554 dnl ===================================================================
555 AC_MSG_CHECKING([for GNU Make])
557 # try to use our own make if it is available and GNUMAKE was not already defined
558 if test -z "$GNUMAKE"; then
559     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
560         GNUMAKE="$LODE_HOME/opt/bin/make"
561     elif test -x "/opt/lo/bin/make"; then
562         GNUMAKE="/opt/lo/bin/make"
563     fi
566 GNUMAKE_WIN_NATIVE=
567 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
568     if test -n "$a"; then
569         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
570         if test $? -eq 0;  then
571             if test "$build_os" = "cygwin"; then
572                 if test -n "$($a -v | grep 'Built for Windows')" ; then
573                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
574                     GNUMAKE_WIN_NATIVE="TRUE"
575                 else
576                     GNUMAKE=`which $a`
577                 fi
578             else
579                 GNUMAKE=`which $a`
580             fi
581             break
582         fi
583     fi
584 done
585 AC_MSG_RESULT($GNUMAKE)
586 if test -z "$GNUMAKE"; then
587     AC_MSG_ERROR([not found. install GNU Make.])
588 else
589     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
590         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
591     fi
594 win_short_path_for_make()
596     local short_path="$1"
597     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
598         cygpath -sm "$short_path"
599     else
600         cygpath -u "$(cygpath -d "$short_path")"
601     fi
605 if test "$build_os" = "cygwin"; then
606     PathFormat "$SRC_ROOT"
607     SRC_ROOT="$formatted_path"
608     PathFormat "$BUILDDIR"
609     BUILDDIR="$formatted_path"
610     x_Cygwin=
611     AC_MSG_CHECKING(for explicit COMSPEC)
612     if test -z "$COMSPEC"; then
613         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
614     else
615         AC_MSG_RESULT([found: $COMSPEC])
616     fi
619 AC_SUBST(SRC_ROOT)
620 AC_SUBST(BUILDDIR)
621 AC_SUBST(x_Cygwin)
622 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
623 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
624 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
626 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
627     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
630 # need sed in os checks...
631 AC_PATH_PROGS(SED, sed)
632 if test -z "$SED"; then
633     AC_MSG_ERROR([install sed to run this script])
636 # Set the ENABLE_LTO variable
637 # ===================================================================
638 AC_MSG_CHECKING([whether to use link-time optimization])
639 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
640     ENABLE_LTO="TRUE"
641     AC_MSG_RESULT([yes])
642 else
643     ENABLE_LTO=""
644     AC_MSG_RESULT([no])
646 AC_SUBST(ENABLE_LTO)
648 AC_ARG_ENABLE(fuzz-options,
649     AS_HELP_STRING([--enable-fuzz-options],
650         [Randomly enable or disable each of those configurable options
651          that are supposed to be freely selectable without interdependencies,
652          or where bad interaction from interdependencies is automatically avoided.])
655 dnl ===================================================================
656 dnl When building for Android, --with-android-ndk,
657 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
658 dnl mandatory
659 dnl ===================================================================
661 AC_ARG_WITH(android-ndk,
662     AS_HELP_STRING([--with-android-ndk],
663         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
666 AC_ARG_WITH(android-ndk-toolchain-version,
667     AS_HELP_STRING([--with-android-ndk-toolchain-version],
668         [Specify which toolchain version to use, of those present in the
669         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
670         with_android_ndk_toolchain_version=clang5.0)
672 AC_ARG_WITH(android-sdk,
673     AS_HELP_STRING([--with-android-sdk],
674         [Specify location of the Android SDK. Mandatory when building for Android.]),
677 AC_ARG_WITH(android-api-level,
678     AS_HELP_STRING([--with-android-api-level],
679         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
682 ANDROID_NDK_DIR=
683 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
684     with_android_ndk="$SRC_ROOT/external/android-ndk"
686 if test -n "$with_android_ndk"; then
687     eval ANDROID_NDK_DIR=$with_android_ndk
689     ANDROID_API_LEVEL=16
690     if test -n "$with_android_api_level" ; then
691         ANDROID_API_LEVEL="$with_android_api_level"
692     fi
694     if test $host_cpu = arm; then
695         LLVM_TRIPLE=armv7a-linux-androideabi
696         ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
697         ANDROID_APP_ABI=armeabi-v7a
698         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
699     elif test $host_cpu = aarch64; then
700         LLVM_TRIPLE=aarch64-linux-android
701         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
702         # minimum android version that supports aarch64
703         if test "$ANDROID_API_LEVEL" -lt "21" ; then
704             ANDROID_API_LEVEL=21
705         fi
706         ANDROID_APP_ABI=arm64-v8a
707     elif test $host_cpu = x86_64; then
708         LLVM_TRIPLE=x86_64-linux-android
709         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
710         # minimum android version that supports x86_64
711         ANDROID_API_LEVEL=21
712         ANDROID_APP_ABI=x86_64
713     else
714         # host_cpu is something like "i386" or "i686" I guess, NDK uses
715         # "x86" in some contexts
716         LLVM_TRIPLE=i686-linux-android
717         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
718         ANDROID_APP_ABI=x86
719     fi
721     # Set up a lot of pre-canned defaults
723     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
724         if test ! -f $ANDROID_NDK_DIR/source.properties; then
725             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
726         fi
727         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
728     else
729         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
730     fi
731     if test -z "$ANDROID_NDK_VERSION";  then
732         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
733     fi
734     case $ANDROID_NDK_VERSION in
735     r9*|r10*)
736         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
737         ;;
738     11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
739         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
740         ;;
741     23.*)
742         ;;
743     *)
744         # NDK 24 dropped support for API levels < 19
745         if test "$ANDROID_API_LEVEL" -lt "19"; then
746             ANDROID_API_LEVEL=19
747         fi
748         case $ANDROID_NDK_VERSION in
749         24.*|25.*)
750             ;;
751         *)
752             AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
753             add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
754             ;;
755         esac
756         ;;
757     esac
759     case "$with_android_ndk_toolchain_version" in
760     clang5.0)
761         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
762         ;;
763     *)
764         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
765     esac
767     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
769     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
770     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
771     # manage to link the (app-specific) single huge .so that is built for the app in
772     # android/source/ if there is debug information in a significant part of the object files.
773     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
774     # all objects have been built with debug information.)
775     case $build_os in
776     linux-gnu*)
777         android_HOST_TAG=linux-x86_64
778         ;;
779     darwin*)
780         android_HOST_TAG=darwin-x86_64
781         ;;
782     *)
783         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
784         # ndk would also support windows and windows-x86_64
785         ;;
786     esac
787     ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
788     ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
790     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
791     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
792     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
793     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
794     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
796     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
797     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
798     if test "$ENABLE_LTO" = TRUE; then
799         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
800         # $CC and $CXX when building external libraries
801         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
802     fi
804     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
806     if test -z "$CC"; then
807         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
808         CC_BASE="clang"
809     fi
810     if test -z "$CXX"; then
811         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
812         CXX_BASE="clang++"
813     fi
815 AC_SUBST(ANDROID_NDK_DIR)
816 AC_SUBST(ANDROID_API_LEVEL)
817 AC_SUBST(ANDROID_APP_ABI)
818 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
819 AC_SUBST(ANDROID_SYSROOT_PLATFORM)
820 AC_SUBST(ANDROID_TOOLCHAIN)
822 dnl ===================================================================
823 dnl --with-android-sdk
824 dnl ===================================================================
825 ANDROID_SDK_DIR=
826 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
827     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
829 if test -n "$with_android_sdk"; then
830     eval ANDROID_SDK_DIR=$with_android_sdk
831     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
833 AC_SUBST(ANDROID_SDK_DIR)
835 AC_ARG_ENABLE([android-lok],
836     AS_HELP_STRING([--enable-android-lok],
837         [The Android app from the android/ subdir needs several tweaks all
838          over the place that break the LOK when used in the Online-based
839          Android app.  This switch indicates that the intent of this build is
840          actually the Online-based, non-modified LOK.])
842 ENABLE_ANDROID_LOK=
843 if test -n "$ANDROID_NDK_DIR" ; then
844     if test "$enable_android_lok" = yes; then
845         ENABLE_ANDROID_LOK=TRUE
846         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
847         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
848     else
849         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
850     fi
852 AC_SUBST([ENABLE_ANDROID_LOK])
854 libo_FUZZ_ARG_ENABLE([android-editing],
855     AS_HELP_STRING([--enable-android-editing],
856         [Enable the experimental editing feature on Android.])
858 ENABLE_ANDROID_EDITING=
859 if test "$enable_android_editing" = yes; then
860     ENABLE_ANDROID_EDITING=TRUE
862 AC_SUBST([ENABLE_ANDROID_EDITING])
864 disable_database_connectivity_dependencies()
866     enable_evolution2=no
867     enable_firebird_sdbc=no
868     enable_mariadb_sdbc=no
869     enable_postgresql_sdbc=no
870     enable_report_builder=no
873 # ===================================================================
875 # Start initial platform setup
877 # The using_* variables reflect platform support and should not be
878 # changed after the "End initial platform setup" block.
879 # This is also true for most test_* variables.
880 # ===================================================================
881 build_crypto=yes
882 test_clucene=no
883 test_gdb_index=no
884 test_openldap=yes
885 test_split_debug=no
886 test_webdav=yes
887 usable_dlapi=yes
889 # There is currently just iOS not using salplug, so this explicitly enables it.
890 # must: using_freetype_fontconfig
891 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
892 # must: using_x11
894 # Default values, as such probably valid just for Linux, set
895 # differently below just for Mac OSX, but at least better than
896 # hardcoding these as we used to do. Much of this is duplicated also
897 # in solenv for old build system and for gbuild, ideally we should
898 # perhaps define stuff like this only here in configure.ac?
900 LINKFLAGSSHL="-shared"
901 PICSWITCH="-fpic"
902 DLLPOST=".so"
904 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
906 INSTROOTBASESUFFIX=
907 INSTROOTCONTENTSUFFIX=
908 SDKDIRNAME=sdk
910 HOST_PLATFORM="$host"
912 host_cpu_for_clang="$host_cpu"
914 case "$host_os" in
916 solaris*)
917     using_freetype_fontconfig=yes
918     using_x11=yes
919     build_skia=yes
920     _os=SunOS
922     dnl ===========================================================
923     dnl Check whether we're using Solaris 10 - SPARC or Intel.
924     dnl ===========================================================
925     AC_MSG_CHECKING([the Solaris operating system release])
926     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
927     if test "$_os_release" -lt "10"; then
928         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
929     else
930         AC_MSG_RESULT([ok ($_os_release)])
931     fi
933     dnl Check whether we're using a SPARC or i386 processor
934     AC_MSG_CHECKING([the processor type])
935     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
936         AC_MSG_RESULT([ok ($host_cpu)])
937     else
938         AC_MSG_ERROR([only SPARC and i386 processors are supported])
939     fi
940     ;;
942 linux-gnu*|k*bsd*-gnu*|linux-musl*)
943     using_freetype_fontconfig=yes
944     using_x11=yes
945     build_skia=yes
946     test_gdb_index=yes
947     test_split_debug=yes
948     if test "$enable_fuzzers" = yes; then
949         test_system_freetype=no
950     fi
951     _os=Linux
952     ;;
954 gnu)
955     using_freetype_fontconfig=yes
956     using_x11=no
957     _os=GNU
958      ;;
960 cygwin*|wsl*)
961     # When building on Windows normally with MSVC under Cygwin,
962     # configure thinks that the host platform (the platform the
963     # built code will run on) is Cygwin, even if it obviously is
964     # Windows, which in Autoconf terminology is called
965     # "mingw32". (Which is misleading as MinGW is the name of the
966     # tool-chain, not an operating system.)
968     # Somewhat confusing, yes. But this configure script doesn't
969     # look at $host etc that much, it mostly uses its own $_os
970     # variable, set here in this case statement.
972     using_freetype_fontconfig=no
973     using_x11=no
974     test_unix_dlapi=no
975     test_openldap=no
976     enable_pagein=no
977     build_skia=yes
978     _os=WINNT
980     DLLPOST=".dll"
981     LINKFLAGSNOUNDEFS=
983     if test "$host_cpu" = "aarch64"; then
984         build_skia=no
985         enable_gpgmepp=no
986         enable_coinmp=no
987         enable_firebird_sdbc=no
988     fi
989     ;;
991 darwin*) # macOS
992     using_freetype_fontconfig=no
993     using_x11=no
994     build_skia=yes
995     enable_pagein=no
996     if test -n "$LODE_HOME" ; then
997         mac_sanitize_path
998         AC_MSG_NOTICE([sanitized the PATH to $PATH])
999     fi
1000     _os=Darwin
1001     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
1002     INSTROOTCONTENTSUFFIX=/Contents
1003     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1004     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1005     LINKFLAGSSHL="-dynamiclib"
1007     # -fPIC is default
1008     PICSWITCH=""
1010     DLLPOST=".dylib"
1012     # -undefined error is the default
1013     LINKFLAGSNOUNDEFS=""
1014     case "$host_cpu" in
1015     aarch64|arm64)
1016         # Apple's Clang uses "arm64"
1017         host_cpu_for_clang=arm64
1018     esac
1021 ios*) # iOS
1022     using_freetype_fontconfig=no
1023     using_x11=no
1024     build_crypto=no
1025     test_libcmis=no
1026     test_openldap=no
1027     test_webdav=no
1028     if test -n "$LODE_HOME" ; then
1029         mac_sanitize_path
1030         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1031     fi
1032     enable_gpgmepp=no
1033     _os=iOS
1034     enable_mpl_subset=yes
1035     enable_lotuswordpro=no
1036     disable_database_connectivity_dependencies
1037     enable_coinmp=no
1038     enable_lpsolve=no
1039     enable_extension_integration=no
1040     enable_xmlhelp=no
1041     with_ppds=no
1042     if test "$enable_ios_simulator" = "yes"; then
1043         host=x86_64-apple-darwin
1044     fi
1045     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1046     LINKFLAGSSHL="-dynamiclib"
1048     # -fPIC is default
1049     PICSWITCH=""
1051     DLLPOST=".dylib"
1053     # -undefined error is the default
1054     LINKFLAGSNOUNDEFS=""
1056     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1057     # part, so use aarch64-apple-darwin for now.
1058     HOST_PLATFORM=aarch64-apple-darwin
1060     # Apple's Clang uses "arm64"
1061     host_cpu_for_clang=arm64
1064 freebsd*)
1065     using_freetype_fontconfig=yes
1066     using_x11=yes
1067     build_skia=yes
1068     AC_MSG_CHECKING([the FreeBSD operating system release])
1069     if test -n "$with_os_version"; then
1070         OSVERSION="$with_os_version"
1071     else
1072         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1073     fi
1074     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1075     AC_MSG_CHECKING([which thread library to use])
1076     if test "$OSVERSION" -lt "500016"; then
1077         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1078         PTHREAD_LIBS="-pthread"
1079     elif test "$OSVERSION" -lt "502102"; then
1080         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1081         PTHREAD_LIBS="-lc_r"
1082     else
1083         PTHREAD_CFLAGS=""
1084         PTHREAD_LIBS="-pthread"
1085     fi
1086     AC_MSG_RESULT([$PTHREAD_LIBS])
1087     _os=FreeBSD
1088     ;;
1090 *netbsd*)
1091     using_freetype_fontconfig=yes
1092     using_x11=yes
1093     test_gtk3_kde5=no
1094     build_skia=yes
1095     PTHREAD_LIBS="-pthread -lpthread"
1096     _os=NetBSD
1097     ;;
1099 openbsd*)
1100     using_freetype_fontconfig=yes
1101     using_x11=yes
1102     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1103     PTHREAD_LIBS="-pthread"
1104     _os=OpenBSD
1105     ;;
1107 dragonfly*)
1108     using_freetype_fontconfig=yes
1109     using_x11=yes
1110     build_skia=yes
1111     PTHREAD_LIBS="-pthread"
1112     _os=DragonFly
1113     ;;
1115 linux-android*)
1116     # API exists, but seems not really usable since Android 7 AFAIK
1117     usable_dlapi=no
1118     using_freetype_fontconfig=yes
1119     using_headless_plugin=no
1120     using_x11=no
1121     build_crypto=no
1122     test_openldap=no
1123     test_system_freetype=no
1124     test_webdav=no
1125     disable_database_connectivity_dependencies
1126     enable_lotuswordpro=no
1127     enable_mpl_subset=yes
1128     enable_cairo_canvas=no
1129     enable_coinmp=yes
1130     enable_lpsolve=no
1131     enable_odk=no
1132     enable_python=no
1133     enable_xmlhelp=no
1134     _os=Android
1135     ;;
1137 haiku*)
1138     using_freetype_fontconfig=yes
1139     using_x11=no
1140     test_gtk3=no
1141     test_gtk3_kde5=no
1142     test_kf5=yes
1143     test_kf6=yes
1144     enable_odk=no
1145     enable_coinmp=no
1146     enable_pdfium=no
1147     enable_sdremote=no
1148     enable_postgresql_sdbc=no
1149     enable_firebird_sdbc=no
1150     _os=Haiku
1151     ;;
1153 emscripten)
1154     # API currently just exists in headers, not code
1155     usable_dlapi=no
1156     using_freetype_fontconfig=yes
1157     using_x11=yes
1158     test_openldap=no
1159     test_qt5=yes
1160     test_split_debug=yes
1161     test_system_freetype=no
1162     enable_compiler_plugins=no
1163     enable_customtarget_components=yes
1164     enable_split_debug=yes
1165     enable_wasm_strip=yes
1166     with_system_zlib=no
1167     with_theme="colibre"
1168     _os=Emscripten
1169     ;;
1172     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1173     ;;
1174 esac
1176 AC_SUBST(HOST_PLATFORM)
1178 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1179     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1182 # Set defaults, if not set by platform
1183 test "${test_cups+set}" = set || test_cups="$using_x11"
1184 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1185 test "${test_gen+set}" = set || test_gen="$using_x11"
1186 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1187 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1188 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1189 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1190 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1191 # don't handle test_qt5, so it can disable test_kf5 later
1192 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1193 test "${test_randr+set}" = set || test_randr="$using_x11"
1194 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1195 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1197 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1198 # Make sure fontconfig and freetype test both either system or not
1199 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1200 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1202 # convenience / platform overriding "fixes"
1203 # Don't sort!
1204 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1205 test "$test_kf5" = yes && test_qt5=yes
1206 test "$test_gtk3" != yes && enable_gtk3=no
1207 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1208 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1209 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1211 # Keep in sync with the above $using_x11 depending test default list
1212 disable_x11_tests()
1214     test_cups=no
1215     test_dbus=no
1216     test_gen=no
1217     test_gstreamer_1_0=no
1218     test_gtk3_kde5=no
1219     test_gtk3=no
1220     test_gtk4=no
1221     test_kf5=no
1222     test_kf6=no
1223     test_qt5=no
1224     test_qt6=no
1225     test_randr=no
1226     test_xrender=no
1229 test "$using_x11" = yes && USING_X11=TRUE
1231 if test "$using_freetype_fontconfig" = yes; then
1232     AC_DEFINE(USE_HEADLESS_CODE)
1233     USE_HEADLESS_CODE=TRUE
1234     if test "$using_headless_plugin" = yes; then
1235         AC_DEFINE(ENABLE_HEADLESS)
1236         ENABLE_HEADLESS=TRUE
1237     fi
1238 else
1239     test_fontconfig=no
1240     test_freetype=no
1243 AC_SUBST(ENABLE_HEADLESS)
1244 AC_SUBST(USE_HEADLESS_CODE)
1246 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1247 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1248 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1249 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1251 # ===================================================================
1253 # End initial platform setup
1255 # ===================================================================
1257 if test "$_os" = "Android" ; then
1258     # Verify that the NDK and SDK options are proper
1259     if test -z "$with_android_ndk"; then
1260         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1261     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1262         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1263     fi
1265     if test -z "$ANDROID_SDK_DIR"; then
1266         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1267     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1268         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1269     fi
1272 AC_SUBST(SDKDIRNAME)
1274 AC_SUBST(PTHREAD_CFLAGS)
1275 AC_SUBST(PTHREAD_LIBS)
1277 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1278 # By default use the ones specified by our build system,
1279 # but explicit override is possible.
1280 AC_MSG_CHECKING(for explicit AFLAGS)
1281 if test -n "$AFLAGS"; then
1282     AC_MSG_RESULT([$AFLAGS])
1283     x_AFLAGS=
1284 else
1285     AC_MSG_RESULT(no)
1286     x_AFLAGS=[\#]
1288 AC_MSG_CHECKING(for explicit CFLAGS)
1289 if test -n "$CFLAGS"; then
1290     AC_MSG_RESULT([$CFLAGS])
1291     x_CFLAGS=
1292 else
1293     AC_MSG_RESULT(no)
1294     x_CFLAGS=[\#]
1296 AC_MSG_CHECKING(for explicit CXXFLAGS)
1297 if test -n "$CXXFLAGS"; then
1298     AC_MSG_RESULT([$CXXFLAGS])
1299     x_CXXFLAGS=
1300 else
1301     AC_MSG_RESULT(no)
1302     x_CXXFLAGS=[\#]
1304 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1305 if test -n "$OBJCFLAGS"; then
1306     AC_MSG_RESULT([$OBJCFLAGS])
1307     x_OBJCFLAGS=
1308 else
1309     AC_MSG_RESULT(no)
1310     x_OBJCFLAGS=[\#]
1312 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1313 if test -n "$OBJCXXFLAGS"; then
1314     AC_MSG_RESULT([$OBJCXXFLAGS])
1315     x_OBJCXXFLAGS=
1316 else
1317     AC_MSG_RESULT(no)
1318     x_OBJCXXFLAGS=[\#]
1320 AC_MSG_CHECKING(for explicit LDFLAGS)
1321 if test -n "$LDFLAGS"; then
1322     AC_MSG_RESULT([$LDFLAGS])
1323     x_LDFLAGS=
1324 else
1325     AC_MSG_RESULT(no)
1326     x_LDFLAGS=[\#]
1328 AC_SUBST(AFLAGS)
1329 AC_SUBST(CFLAGS)
1330 AC_SUBST(CXXFLAGS)
1331 AC_SUBST(OBJCFLAGS)
1332 AC_SUBST(OBJCXXFLAGS)
1333 AC_SUBST(LDFLAGS)
1334 AC_SUBST(x_AFLAGS)
1335 AC_SUBST(x_CFLAGS)
1336 AC_SUBST(x_CXXFLAGS)
1337 AC_SUBST(x_OBJCFLAGS)
1338 AC_SUBST(x_OBJCXXFLAGS)
1339 AC_SUBST(x_LDFLAGS)
1341 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1342 my_original_CFLAGS=$CFLAGS
1343 my_original_CXXFLAGS=$CXXFLAGS
1344 my_original_CPPFLAGS=$CPPFLAGS
1346 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1347 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1348 dnl AC_PROG_CC internally.
1349 if test "$_os" != "WINNT"; then
1350     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1351     save_CFLAGS=$CFLAGS
1352     AC_PROG_CC
1353     CFLAGS=$save_CFLAGS
1354     if test -z "$CC_BASE"; then
1355         CC_BASE=`first_arg_basename "$CC"`
1356     fi
1359 if test "$_os" != "WINNT"; then
1360     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1361 else
1362     ENDIANNESS=little
1364 AC_SUBST(ENDIANNESS)
1366 if test "$usable_dlapi" != no; then
1367     AC_DEFINE([HAVE_DLAPI])
1368     if test "$test_unix_dlapi" != no; then
1369         save_LIBS="$LIBS"
1370         AC_SEARCH_LIBS([dlsym], [dl],
1371             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1372             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1373         LIBS="$save_LIBS"
1374         AC_DEFINE([HAVE_UNIX_DLAPI])
1375     fi
1377 AC_SUBST(UNIX_DLAPI_LIBS)
1379 # Check for a (GNU) backtrace implementation
1380 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1381 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1382 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1383     save_LIBS="$LIBS"
1384     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1385         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1386         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1387     LIBS="$save_LIBS"
1389 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1390     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1393 dnl ===================================================================
1394 dnl Sanity checks for Emscripten SDK setup
1395 dnl ===================================================================
1397 EMSCRIPTEN_MIN_MAJOR=2
1398 EMSCRIPTEN_MIN_MINOR=0
1399 EMSCRIPTEN_MIN_TINY=31
1400 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1402 if test "$_os" = "Emscripten"; then
1403     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1404     AS_IF([test -z "$EMSDK"],
1405           [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1406     EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1407     if test -f "$EMSCRIPTEN_VERSION_H"; then
1408         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1409         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1410         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1411     else
1412         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1413         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1414         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1415         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1416     fi
1418     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1420     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1421     if test $? -eq 0; then
1422         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1423     else
1424         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1425     fi
1427     EMSCRIPTEN_ERROR=0
1428     if ! which emconfigure >/dev/null 2>&1; then
1429         AC_MSG_WARN([emconfigure must be in your \$PATH])
1430         EMSCRIPTEN_ERROR=1
1431     fi
1432     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1433         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1434         EMSCRIPTEN_ERROR=1
1435     fi
1436     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1437     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1438         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1439         EMSCRIPTEN_ERROR=1
1440     fi
1441     if test $EMSCRIPTEN_ERROR -ne 0; then
1442         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1443     fi
1445 AC_SUBST(EMSDK_FILE_PACKAGER)
1447 ###############################################################################
1448 # Extensions switches --enable/--disable
1449 ###############################################################################
1450 # By default these should be enabled unless having extra dependencies.
1451 # If there is extra dependency over configure options then the enable should
1452 # be automagic based on whether the requiring feature is enabled or not.
1453 # All this options change anything only with --enable-extension-integration.
1455 # The name of this option and its help string makes it sound as if
1456 # extensions are built anyway, just not integrated in the installer,
1457 # if you use --disable-extension-integration. Is that really the
1458 # case?
1460 AC_ARG_ENABLE(ios-simulator,
1461     AS_HELP_STRING([--enable-ios-simulator],
1462         [build for iOS simulator])
1465 libo_FUZZ_ARG_ENABLE(extension-integration,
1466     AS_HELP_STRING([--disable-extension-integration],
1467         [Disable integration of the built extensions in the installer of the
1468          product. Use this switch to disable the integration.])
1471 AC_ARG_ENABLE(avmedia,
1472     AS_HELP_STRING([--disable-avmedia],
1473         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1474 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1476 AC_ARG_ENABLE(database-connectivity,
1477     AS_HELP_STRING([--disable-database-connectivity],
1478         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1481 # This doesn't mean not building (or "integrating") extensions
1482 # (although it probably should; i.e. it should imply
1483 # --disable-extension-integration I guess), it means not supporting
1484 # any extension mechanism at all
1485 libo_FUZZ_ARG_ENABLE(extensions,
1486     AS_HELP_STRING([--disable-extensions],
1487         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1490 AC_ARG_ENABLE(scripting,
1491     AS_HELP_STRING([--disable-scripting],
1492         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1493 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1495 # This is mainly for Android and iOS, but could potentially be used in some
1496 # special case otherwise, too, so factored out as a separate setting
1498 AC_ARG_ENABLE(dynamic-loading,
1499     AS_HELP_STRING([--disable-dynamic-loading],
1500         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1503 libo_FUZZ_ARG_ENABLE(report-builder,
1504     AS_HELP_STRING([--disable-report-builder],
1505         [Disable the Report Builder.])
1508 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1509     AS_HELP_STRING([--enable-ext-wiki-publisher],
1510         [Enable the Wiki Publisher extension.])
1513 libo_FUZZ_ARG_ENABLE(lpsolve,
1514     AS_HELP_STRING([--disable-lpsolve],
1515         [Disable compilation of the lp solve solver ])
1517 libo_FUZZ_ARG_ENABLE(coinmp,
1518     AS_HELP_STRING([--disable-coinmp],
1519         [Disable compilation of the CoinMP solver ])
1522 libo_FUZZ_ARG_ENABLE(pdfimport,
1523     AS_HELP_STRING([--disable-pdfimport],
1524         [Disable building the PDF import feature.])
1527 libo_FUZZ_ARG_ENABLE(pdfium,
1528     AS_HELP_STRING([--disable-pdfium],
1529         [Disable building PDFium. Results in unsecure PDF signature verification.])
1532 libo_FUZZ_ARG_ENABLE(skia,
1533     AS_HELP_STRING([--disable-skia],
1534         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1537 ###############################################################################
1539 dnl ---------- *** ----------
1541 libo_FUZZ_ARG_ENABLE(mergelibs,
1542     AS_HELP_STRING([--enable-mergelibs],
1543         [Merge several of the smaller libraries into one big, "merged", one.])
1546 libo_FUZZ_ARG_ENABLE(breakpad,
1547     AS_HELP_STRING([--enable-breakpad],
1548         [Enables breakpad for crash reporting.])
1551 libo_FUZZ_ARG_ENABLE(crashdump,
1552     AS_HELP_STRING([--disable-crashdump],
1553         [Disable dump.ini and dump-file, when --enable-breakpad])
1556 AC_ARG_ENABLE(fetch-external,
1557     AS_HELP_STRING([--disable-fetch-external],
1558         [Disables fetching external tarballs from web sources.])
1561 AC_ARG_ENABLE(fuzzers,
1562     AS_HELP_STRING([--enable-fuzzers],
1563         [Enables building libfuzzer targets for fuzz testing.])
1566 libo_FUZZ_ARG_ENABLE(pch,
1567     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1568         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1569          Using 'system' will include only external headers, 'base' will add also headers
1570          from base modules, 'normal' will also add all headers except from the module built,
1571          'full' will use all suitable headers even from a module itself.])
1574 libo_FUZZ_ARG_ENABLE(epm,
1575     AS_HELP_STRING([--enable-epm],
1576         [LibreOffice includes self-packaging code, that requires epm, however epm is
1577          useless for large scale package building.])
1580 libo_FUZZ_ARG_ENABLE(odk,
1581     AS_HELP_STRING([--enable-odk],
1582         [Enable building the Office Development Kit, the part that extensions need to build against])
1585 AC_ARG_ENABLE(mpl-subset,
1586     AS_HELP_STRING([--enable-mpl-subset],
1587         [Don't compile any pieces which are not MPL or more liberally licensed])
1590 libo_FUZZ_ARG_ENABLE(evolution2,
1591     AS_HELP_STRING([--enable-evolution2],
1592         [Allows the built-in evolution 2 addressbook connectivity build to be
1593          enabled.])
1596 AC_ARG_ENABLE(avahi,
1597     AS_HELP_STRING([--enable-avahi],
1598         [Determines whether to use Avahi to advertise Impress to remote controls.])
1601 libo_FUZZ_ARG_ENABLE(werror,
1602     AS_HELP_STRING([--enable-werror],
1603         [Turn warnings to errors. (Has no effect in modules where the treating
1604          of warnings as errors is disabled explicitly.)]),
1607 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1608     AS_HELP_STRING([--enable-assert-always-abort],
1609         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1612 libo_FUZZ_ARG_ENABLE(dbgutil,
1613     AS_HELP_STRING([--enable-dbgutil],
1614         [Provide debugging support from --enable-debug and include additional debugging
1615          utilities such as object counting or more expensive checks.
1616          This is the recommended option for developers.
1617          Note that this makes the build ABI incompatible, it is not possible to mix object
1618          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1620 libo_FUZZ_ARG_ENABLE(debug,
1621     AS_HELP_STRING([--enable-debug],
1622         [Include debugging information, disable compiler optimization and inlining plus
1623          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1625 libo_FUZZ_ARG_ENABLE(split-debug,
1626     AS_HELP_STRING([--disable-split-debug],
1627         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1628          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1630 libo_FUZZ_ARG_ENABLE(gdb-index,
1631     AS_HELP_STRING([--disable-gdb-index],
1632         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1633          The feature requires a linker that supports the --gdb-index option.]))
1635 libo_FUZZ_ARG_ENABLE(sal-log,
1636     AS_HELP_STRING([--enable-sal-log],
1637         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1639 libo_FUZZ_ARG_ENABLE(symbols,
1640     AS_HELP_STRING([--enable-symbols],
1641         [Generate debug information.
1642          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1643          otherwise. It is possible to explicitly specify gbuild build targets
1644          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1645          everything in the directory; there is no ordering, more specific overrides
1646          more general, and disabling takes precedence).
1647          Example: --enable-symbols="all -sw/ -Library_sc".]))
1649 libo_FUZZ_ARG_ENABLE(optimized,
1650     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1651         [Whether to compile with optimization flags.
1652          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1653          otherwise. Using 'debug' will try to use only optimizations that should
1654          not interfere with debugging. For Emscripten we default to optimized (-O1)
1655          debug build, as otherwise binaries become too large.]))
1657 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1658     AS_HELP_STRING([--disable-runtime-optimizations],
1659         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1660          JVM JIT) that are known to interact badly with certain dynamic analysis
1661          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1662          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1663          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1665 AC_ARG_WITH(valgrind,
1666     AS_HELP_STRING([--with-valgrind],
1667         [Make availability of Valgrind headers a hard requirement.]))
1669 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1670     AS_HELP_STRING([--enable-compiler-plugins],
1671         [Enable compiler plugins that will perform additional checks during
1672          building. Enabled automatically by --enable-dbgutil.
1673          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1674 COMPILER_PLUGINS_DEBUG=
1675 if test "$enable_compiler_plugins" = debug; then
1676     enable_compiler_plugins=yes
1677     COMPILER_PLUGINS_DEBUG=TRUE
1680 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1681     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1682         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1683          relevant in the --disable-compiler-plugins case.]))
1685 libo_FUZZ_ARG_ENABLE(ooenv,
1686     AS_HELP_STRING([--enable-ooenv],
1687         [Enable ooenv for the instdir installation.]))
1689 AC_ARG_ENABLE(lto,
1690     AS_HELP_STRING([--enable-lto],
1691         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1692          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1693          linker.)]))
1695 AC_ARG_ENABLE(python,
1696     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1697         [Enables or disables Python support at run-time.
1698          Also specifies what Python to use at build-time.
1699          'fully-internal' even forces the internal version for uses of Python
1700          during the build.
1701          On macOS the only choices are
1702          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1703          ]))
1705 libo_FUZZ_ARG_ENABLE(gtk3,
1706     AS_HELP_STRING([--disable-gtk3],
1707         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1708 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1710 AC_ARG_ENABLE(gtk4,
1711     AS_HELP_STRING([--enable-gtk4],
1712         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1714 AC_ARG_ENABLE(atspi-tests,
1715     AS_HELP_STRING([--disable-atspi-tests],
1716         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1718 AC_ARG_ENABLE(introspection,
1719     AS_HELP_STRING([--enable-introspection],
1720         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1721          Linux distributions.)]))
1723 AC_ARG_ENABLE(split-app-modules,
1724     AS_HELP_STRING([--enable-split-app-modules],
1725         [Split file lists for app modules, e.g. base, calc.
1726          Has effect only with make distro-pack-install]),
1729 AC_ARG_ENABLE(split-opt-features,
1730     AS_HELP_STRING([--enable-split-opt-features],
1731         [Split file lists for some optional features, e.g. pyuno, testtool.
1732          Has effect only with make distro-pack-install]),
1735 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1736     AS_HELP_STRING([--disable-cairo-canvas],
1737         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1740 libo_FUZZ_ARG_ENABLE(dbus,
1741     AS_HELP_STRING([--disable-dbus],
1742         [Determines whether to enable features that depend on dbus.
1743          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1744 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1746 libo_FUZZ_ARG_ENABLE(sdremote,
1747     AS_HELP_STRING([--disable-sdremote],
1748         [Determines whether to enable Impress remote control (i.e. the server component).]),
1749 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1751 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1752     AS_HELP_STRING([--disable-sdremote-bluetooth],
1753         [Determines whether to build sdremote with bluetooth support.
1754          Requires dbus on Linux.]))
1756 libo_FUZZ_ARG_ENABLE(gio,
1757     AS_HELP_STRING([--disable-gio],
1758         [Determines whether to use the GIO support.]),
1759 ,test "${enable_gio+set}" = set || enable_gio=yes)
1761 AC_ARG_ENABLE(qt5,
1762     AS_HELP_STRING([--enable-qt5],
1763         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1764          available.]),
1767 AC_ARG_ENABLE(qt6,
1768     AS_HELP_STRING([--enable-qt6],
1769         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1770          available.]),
1773 AC_ARG_ENABLE(kf5,
1774     AS_HELP_STRING([--enable-kf5],
1775         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1776          KF5 are available.]),
1779 AC_ARG_ENABLE(kf6,
1780     AS_HELP_STRING([--enable-kf6],
1781         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1782          KF6 are available.]),
1786 AC_ARG_ENABLE(gtk3_kde5,
1787     AS_HELP_STRING([--enable-gtk3-kde5],
1788         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1789          platforms where Gtk3, Qt5 and Plasma is available.]),
1792 AC_ARG_ENABLE(gen,
1793     AS_HELP_STRING([--enable-gen],
1794         [To select the gen backend in case of --disable-dynamic-loading.
1795          Per default auto-enabled when X11 is used.]),
1796 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1798 AC_ARG_ENABLE(gui,
1799     AS_HELP_STRING([--disable-gui],
1800         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1801 ,enable_gui=yes)
1803 libo_FUZZ_ARG_ENABLE(randr,
1804     AS_HELP_STRING([--disable-randr],
1805         [Disable RandR support in the vcl project.]),
1806 ,test "${enable_randr+set}" = set || enable_randr=yes)
1808 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1809     AS_HELP_STRING([--disable-gstreamer-1-0],
1810         [Disable building with the gstreamer 1.0 avmedia backend.]),
1811 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1813 libo_FUZZ_ARG_ENABLE([eot],
1814     [AS_HELP_STRING([--enable-eot],
1815         [Enable support for Embedded OpenType fonts.])],
1816 ,test "${enable_eot+set}" = set || enable_eot=no)
1818 libo_FUZZ_ARG_ENABLE(cve-tests,
1819     AS_HELP_STRING([--disable-cve-tests],
1820         [Prevent CVE tests to be executed]),
1823 AC_ARG_ENABLE(build-opensymbol,
1824     AS_HELP_STRING([--enable-build-opensymbol],
1825         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1826          fontforge installed.]),
1829 AC_ARG_ENABLE(dependency-tracking,
1830     AS_HELP_STRING([--enable-dependency-tracking],
1831         [Do not reject slow dependency extractors.])[
1832   --disable-dependency-tracking
1833                           Disables generation of dependency information.
1834                           Speed up one-time builds.],
1837 AC_ARG_ENABLE(icecream,
1838     AS_HELP_STRING([--enable-icecream],
1839         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1840          It defaults to /opt/icecream for the location of the icecream gcc/g++
1841          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1844 AC_ARG_ENABLE(ld,
1845     AS_HELP_STRING([--enable-ld=<linker>],
1846         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1847          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1848          If <linker> contains any ':', the part before the first ':' is used as the value of
1849          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1850          needed for Clang 12).]),
1853 libo_FUZZ_ARG_ENABLE(cups,
1854     AS_HELP_STRING([--disable-cups],
1855         [Do not build cups support.])
1858 AC_ARG_ENABLE(ccache,
1859     AS_HELP_STRING([--disable-ccache],
1860         [Do not try to use ccache automatically.
1861          By default we will try to detect if ccache is available; in that case if
1862          CC/CXX are not yet set, and --enable-icecream is not given, we
1863          attempt to use ccache. --disable-ccache disables ccache completely.
1864          Additionally ccache's depend mode is enabled if possible,
1865          use --enable-ccache=nodepend to enable ccache without depend mode.
1869 AC_ARG_ENABLE(z7-debug,
1870     AS_HELP_STRING([--enable-z7-debug],
1871         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1872          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1873          Enabled by default if ccache is detected.]))
1875 libo_FUZZ_ARG_ENABLE(online-update,
1876     AS_HELP_STRING([--enable-online-update],
1877         [Enable the online update service that will check for new versions of
1878          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.
1879          If the value is "mar", the experimental Mozilla-like update will be
1880          enabled instead of the traditional update mechanism.]),
1883 AC_ARG_WITH(update-config,
1884     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1885                    [Path to the update config ini file]))
1887 libo_FUZZ_ARG_ENABLE(extension-update,
1888     AS_HELP_STRING([--disable-extension-update],
1889         [Disable possibility to update installed extensions.]),
1892 libo_FUZZ_ARG_ENABLE(release-build,
1893     AS_HELP_STRING([--enable-release-build],
1894         [Enable release build. Note that the "release build" choice is orthogonal to
1895          whether symbols are present, debug info is generated, or optimization
1896          is done.
1897          See https://wiki.documentfoundation.org/Development/DevBuild]),
1900 AC_ARG_ENABLE(windows-build-signing,
1901     AS_HELP_STRING([--enable-windows-build-signing],
1902         [Enable signing of windows binaries (*.exe, *.dll)]),
1905 AC_ARG_ENABLE(silent-msi,
1906     AS_HELP_STRING([--enable-silent-msi],
1907         [Enable MSI with LIMITUI=1 (silent install).]),
1910 AC_ARG_ENABLE(wix,
1911     AS_HELP_STRING([--enable-wix],
1912         [Build Windows installer using WiX.]),
1915 AC_ARG_ENABLE(macosx-code-signing,
1916     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1917         [Sign executables, dylibs, frameworks and the app bundle. If you
1918          don't provide an identity the first suitable certificate
1919          in your keychain is used.]),
1922 AC_ARG_ENABLE(macosx-package-signing,
1923     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1924         [Create a .pkg suitable for uploading to the Mac App Store and sign
1925          it. If you don't provide an identity the first suitable certificate
1926          in your keychain is used.]),
1929 AC_ARG_ENABLE(macosx-sandbox,
1930     AS_HELP_STRING([--enable-macosx-sandbox],
1931         [Make the app bundle run in a sandbox. Requires code signing.
1932          Is required by apps distributed in the Mac App Store, and implies
1933          adherence to App Store rules.]),
1936 AC_ARG_WITH(macosx-bundle-identifier,
1937     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1938         [Define the macOS bundle identifier. Default is the somewhat weird
1939          org.libreoffice.script ("script", huh?).]),
1940 ,with_macosx_bundle_identifier=org.libreoffice.script)
1942 AC_ARG_WITH(macosx-provisioning-profile,
1943     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
1944         [Specify the path to a provisioning profile to use]),
1947 AC_ARG_WITH(product-name,
1948     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1949         [Define the product name. Default is AC_PACKAGE_NAME.]),
1950 ,with_product_name=$PRODUCTNAME)
1952 libo_FUZZ_ARG_ENABLE(community-flavor,
1953     AS_HELP_STRING([--disable-community-flavor],
1954         [Disable the Community branding.]),
1957 AC_ARG_WITH(package-version,
1958     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1959         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1962 libo_FUZZ_ARG_ENABLE(readonly-installset,
1963     AS_HELP_STRING([--enable-readonly-installset],
1964         [Prevents any attempts by LibreOffice to write into its installation. That means
1965          at least that no "system-wide" extensions can be added. Partly experimental work in
1966          progress, probably not fully implemented. Always enabled for macOS.]),
1969 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1970     AS_HELP_STRING([--disable-mariadb-sdbc],
1971         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1974 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1975     AS_HELP_STRING([--disable-postgresql-sdbc],
1976         [Disable the build of the PostgreSQL-SDBC driver.])
1979 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1980     AS_HELP_STRING([--disable-lotuswordpro],
1981         [Disable the build of the Lotus Word Pro filter.]),
1982 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1984 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1985     AS_HELP_STRING([--disable-firebird-sdbc],
1986         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1987 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1989 AC_ARG_ENABLE(bogus-pkg-config,
1990     AS_HELP_STRING([--enable-bogus-pkg-config],
1991         [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.]),
1994 AC_ARG_ENABLE(openssl,
1995     AS_HELP_STRING([--disable-openssl],
1996         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1997          components will use NSS. Work in progress,
1998          use only if you are hacking on it.]),
1999 ,enable_openssl=yes)
2001 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
2002     AS_HELP_STRING([--enable-cipher-openssl-backend],
2003         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2004          Requires --enable-openssl.]))
2006 AC_ARG_ENABLE(nss,
2007     AS_HELP_STRING([--disable-nss],
2008         [Disable using NSS. If disabled,
2009          components will use openssl. Work in progress,
2010          use only if you are hacking on it.]),
2011 ,enable_nss=yes)
2013 AC_ARG_ENABLE(library-bin-tar,
2014     AS_HELP_STRING([--enable-library-bin-tar],
2015         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2016         Some libraries can save their build result in a tarball
2017         stored in TARFILE_LOCATION. That binary tarball is
2018         uniquely identified by the source tarball,
2019         the content of the config_host.mk file and the content
2020         of the top-level directory in core for that library
2021         If this option is enabled, then if such a tarfile exist, it will be untarred
2022         instead of the source tarfile, and the build step will be skipped for that
2023         library.
2024         If a proper tarfile does not exist, then the normal source-based
2025         build is done for that library and a proper binary tarfile is created
2026         for the next time.]),
2029 AC_ARG_ENABLE(dconf,
2030     AS_HELP_STRING([--disable-dconf],
2031         [Disable the dconf configuration backend (enabled by default where
2032          available).]))
2034 libo_FUZZ_ARG_ENABLE(formula-logger,
2035     AS_HELP_STRING(
2036         [--enable-formula-logger],
2037         [Enable formula logger for logging formula calculation flow in Calc.]
2038     )
2041 AC_ARG_ENABLE(ldap,
2042     AS_HELP_STRING([--disable-ldap],
2043         [Disable LDAP support.]),
2044 ,enable_ldap=yes)
2046 AC_ARG_ENABLE(opencl,
2047     AS_HELP_STRING([--disable-opencl],
2048         [Disable OpenCL support.]),
2049 ,enable_opencl=yes)
2051 libo_FUZZ_ARG_ENABLE(librelogo,
2052     AS_HELP_STRING([--disable-librelogo],
2053         [Do not build LibreLogo.]),
2054 ,enable_librelogo=yes)
2056 AC_ARG_ENABLE(wasm-strip,
2057     AS_HELP_STRING([--enable-wasm-strip],
2058         [Strip the static build like for WASM/emscripten platform.]),
2061 AC_ARG_WITH(main-module,
2062     AS_HELP_STRING([--with-main-module=<writer/calc>],
2063         [Specify which main module to build for wasm.
2064         Default value is 'writer'.]),
2067 AC_ARG_ENABLE(wasm-exceptions,
2068     AS_HELP_STRING([--enable-wasm-exceptions],
2069         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2070         matter of fact, this is currently not finished by any implementation)
2071         (see https://webassembly.org/roadmap/ for the current state]),
2074 AC_ARG_ENABLE(xmlhelp,
2075     AS_HELP_STRING([--disable-xmlhelp],
2076         [Disable XML help support]),
2077 ,enable_xmlhelp=yes)
2079 AC_ARG_ENABLE(customtarget-components,
2080     AS_HELP_STRING([--enable-customtarget-components],
2081         [Generates the static UNO object constructor mapping from the build.]))
2083 dnl ===================================================================
2084 dnl Optional Packages (--with/without-)
2085 dnl ===================================================================
2087 AC_ARG_WITH(gcc-home,
2088     AS_HELP_STRING([--with-gcc-home],
2089         [Specify the location of gcc/g++ manually. This can be used in conjunction
2090          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2091          non-default path.]),
2094 AC_ARG_WITH(gnu-patch,
2095     AS_HELP_STRING([--with-gnu-patch],
2096         [Specify location of GNU patch on Solaris or FreeBSD.]),
2099 AC_ARG_WITH(build-platform-configure-options,
2100     AS_HELP_STRING([--with-build-platform-configure-options],
2101         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2104 AC_ARG_WITH(gnu-cp,
2105     AS_HELP_STRING([--with-gnu-cp],
2106         [Specify location of GNU cp on Solaris or FreeBSD.]),
2109 AC_ARG_WITH(external-tar,
2110     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2111         [Specify an absolute path of where to find (and store) tarfiles.]),
2112     TARFILE_LOCATION=$withval ,
2115 AC_ARG_WITH(referenced-git,
2116     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2117         [Specify another checkout directory to reference. This makes use of
2118                  git submodule update --reference, and saves a lot of diskspace
2119                  when having multiple trees side-by-side.]),
2120     GIT_REFERENCE_SRC=$withval ,
2123 AC_ARG_WITH(linked-git,
2124     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2125         [Specify a directory where the repositories of submodules are located.
2126          This uses a method similar to git-new-workdir to get submodules.]),
2127     GIT_LINK_SRC=$withval ,
2130 AC_ARG_WITH(galleries,
2131     AS_HELP_STRING([--with-galleries],
2132         [Specify how galleries should be built. It is possible either to
2133          build these internally from source ("build"),
2134          or to disable them ("no")]),
2137 AC_ARG_WITH(templates,
2138     AS_HELP_STRING([--with-templates],
2139         [Specify we build with or without template files. It is possible either to
2140          build with templates ("yes"),
2141          or to disable them ("no")]),
2144 AC_ARG_WITH(theme,
2145     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2146         [Choose which themes to include. By default those themes with an '*' are included.
2147          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2148          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2149          *elementary, *elementary_svg,
2150          *karasa_jaga, *karasa_jaga_svg,
2151          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2152          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2155 libo_FUZZ_ARG_WITH(helppack-integration,
2156     AS_HELP_STRING([--without-helppack-integration],
2157         [It will not integrate the helppacks to the installer
2158          of the product. Please use this switch to use the online help
2159          or separate help packages.]),
2162 libo_FUZZ_ARG_WITH(fonts,
2163     AS_HELP_STRING([--without-fonts],
2164         [LibreOffice includes some third-party fonts to provide a reliable basis for
2165          help content, templates, samples, etc. When these fonts are already
2166          known to be available on the system then you should use this option.]),
2169 AC_ARG_WITH(epm,
2170     AS_HELP_STRING([--with-epm],
2171         [Decides which epm to use. Default is to use the one from the system if
2172          one is built. When either this is not there or you say =internal epm
2173          will be built.]),
2176 AC_ARG_WITH(package-format,
2177     AS_HELP_STRING([--with-package-format],
2178         [Specify package format(s) for LibreOffice installation sets. The
2179          implicit --without-package-format leads to no installation sets being
2180          generated. Possible values: archive, bsd, deb, dmg,
2181          installed, msi, pkg, and rpm.
2182          Example: --with-package-format='deb rpm']),
2185 AC_ARG_WITH(tls,
2186     AS_HELP_STRING([--with-tls],
2187         [Decides which TLS/SSL and cryptographic implementations to use for
2188          LibreOffice's code. Default is to use NSS although OpenSSL is also
2189          possible. Notice that selecting NSS restricts the usage of OpenSSL
2190          in LO's code but selecting OpenSSL doesn't restrict by now the
2191          usage of NSS in LO's code. Possible values: openssl, nss.
2192          Example: --with-tls="nss"]),
2195 AC_ARG_WITH(system-libs,
2196     AS_HELP_STRING([--with-system-libs],
2197         [Use libraries already on system -- enables all --with-system-* flags.]),
2200 AC_ARG_WITH(system-bzip2,
2201     AS_HELP_STRING([--with-system-bzip2],
2202         [Use bzip2 already on system. Used when --enable-online-update=mar
2203         or --enable-python=internal]),,
2204     [with_system_bzip2="$with_system_libs"])
2206 AC_ARG_WITH(system-headers,
2207     AS_HELP_STRING([--with-system-headers],
2208         [Use headers already on system -- enables all --with-system-* flags for
2209          external packages whose headers are the only entities used i.e.
2210          boost/odbc/sane-header(s).]),,
2211     [with_system_headers="$with_system_libs"])
2213 AC_ARG_WITH(system-jars,
2214     AS_HELP_STRING([--without-system-jars],
2215         [When building with --with-system-libs, also the needed jars are expected
2216          on the system. Use this to disable that]),,
2217     [with_system_jars="$with_system_libs"])
2219 AC_ARG_WITH(system-cairo,
2220     AS_HELP_STRING([--with-system-cairo],
2221         [Use cairo libraries already on system.  Happens automatically for
2222          (implicit) --enable-gtk3.]))
2224 AC_ARG_WITH(system-epoxy,
2225     AS_HELP_STRING([--with-system-epoxy],
2226         [Use epoxy libraries already on system.  Happens automatically for
2227          (implicit) --enable-gtk3.]),,
2228        [with_system_epoxy="$with_system_libs"])
2230 AC_ARG_WITH(myspell-dicts,
2231     AS_HELP_STRING([--with-myspell-dicts],
2232         [Adds myspell dictionaries to the LibreOffice installation set]),
2235 AC_ARG_WITH(system-dicts,
2236     AS_HELP_STRING([--without-system-dicts],
2237         [Do not use dictionaries from system paths.]),
2240 AC_ARG_WITH(external-dict-dir,
2241     AS_HELP_STRING([--with-external-dict-dir],
2242         [Specify external dictionary dir.]),
2245 AC_ARG_WITH(external-hyph-dir,
2246     AS_HELP_STRING([--with-external-hyph-dir],
2247         [Specify external hyphenation pattern dir.]),
2250 AC_ARG_WITH(external-thes-dir,
2251     AS_HELP_STRING([--with-external-thes-dir],
2252         [Specify external thesaurus dir.]),
2255 AC_ARG_WITH(system-zlib,
2256     AS_HELP_STRING([--with-system-zlib],
2257         [Use zlib already on system.]),,
2258     [with_system_zlib=auto])
2260 AC_ARG_WITH(system-jpeg,
2261     AS_HELP_STRING([--with-system-jpeg],
2262         [Use jpeg already on system.]),,
2263     [with_system_jpeg="$with_system_libs"])
2265 AC_ARG_WITH(system-expat,
2266     AS_HELP_STRING([--with-system-expat],
2267         [Use expat already on system.]),,
2268     [with_system_expat="$with_system_libs"])
2270 AC_ARG_WITH(system-libxml,
2271     AS_HELP_STRING([--with-system-libxml],
2272         [Use libxml/libxslt already on system.]),,
2273     [with_system_libxml=auto])
2275 AC_ARG_WITH(system-openldap,
2276     AS_HELP_STRING([--with-system-openldap],
2277         [Use the OpenLDAP LDAP SDK already on system.]),,
2278     [with_system_openldap="$with_system_libs"])
2280 libo_FUZZ_ARG_ENABLE(poppler,
2281     AS_HELP_STRING([--disable-poppler],
2282         [Disable building Poppler.])
2285 AC_ARG_WITH(system-poppler,
2286     AS_HELP_STRING([--with-system-poppler],
2287         [Use system poppler (only needed for PDF import).]),,
2288     [with_system_poppler="$with_system_libs"])
2290 AC_ARG_WITH(system-abseil,
2291     AS_HELP_STRING([--with-system-abseil],
2292         [Use the abseil libraries already on system.]),,
2293     [with_system_abseil="$with_system_libs"])
2295 AC_ARG_WITH(system-openjpeg,
2296     AS_HELP_STRING([--with-system-openjpeg],
2297         [Use the OpenJPEG library already on system.]),,
2298     [with_system_openjpeg="$with_system_libs"])
2300 libo_FUZZ_ARG_ENABLE(gpgmepp,
2301     AS_HELP_STRING([--disable-gpgmepp],
2302         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2305 AC_ARG_WITH(system-gpgmepp,
2306     AS_HELP_STRING([--with-system-gpgmepp],
2307         [Use gpgmepp already on system]),,
2308     [with_system_gpgmepp="$with_system_libs"])
2310 AC_ARG_WITH(system-mariadb,
2311     AS_HELP_STRING([--with-system-mariadb],
2312         [Use MariaDB/MySQL libraries already on system.]),,
2313     [with_system_mariadb="$with_system_libs"])
2315 AC_ARG_ENABLE(bundle-mariadb,
2316     AS_HELP_STRING([--enable-bundle-mariadb],
2317         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2320 AC_ARG_WITH(system-postgresql,
2321     AS_HELP_STRING([--with-system-postgresql],
2322         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2323          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2324     [with_system_postgresql="$with_system_libs"])
2326 AC_ARG_WITH(libpq-path,
2327     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2328         [Use this PostgreSQL C interface (libpq) installation for building
2329          the PostgreSQL-SDBC extension.]),
2332 AC_ARG_WITH(system-firebird,
2333     AS_HELP_STRING([--with-system-firebird],
2334         [Use Firebird libraries already on system, for building the Firebird-SDBC
2335          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2336     [with_system_firebird="$with_system_libs"])
2338 AC_ARG_WITH(system-libtommath,
2339             AS_HELP_STRING([--with-system-libtommath],
2340                            [Use libtommath already on system]),,
2341             [with_system_libtommath="$with_system_libs"])
2343 AC_ARG_WITH(system-hsqldb,
2344     AS_HELP_STRING([--with-system-hsqldb],
2345         [Use hsqldb already on system.]))
2347 AC_ARG_WITH(hsqldb-jar,
2348     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2349         [Specify path to jarfile manually.]),
2350     HSQLDB_JAR=$withval)
2352 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2353     AS_HELP_STRING([--disable-scripting-beanshell],
2354         [Disable support for scripts in BeanShell.]),
2358 AC_ARG_WITH(system-beanshell,
2359     AS_HELP_STRING([--with-system-beanshell],
2360         [Use beanshell already on system.]),,
2361     [with_system_beanshell="$with_system_jars"])
2363 AC_ARG_WITH(beanshell-jar,
2364     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2365         [Specify path to jarfile manually.]),
2366     BSH_JAR=$withval)
2368 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2369     AS_HELP_STRING([--disable-scripting-javascript],
2370         [Disable support for scripts in JavaScript.]),
2374 AC_ARG_WITH(system-rhino,
2375     AS_HELP_STRING([--with-system-rhino],
2376         [Use rhino already on system.]),,)
2377 #    [with_system_rhino="$with_system_jars"])
2378 # Above is not used as we have different debug interface
2379 # patched into internal rhino. This code needs to be fixed
2380 # before we can enable it by default.
2382 AC_ARG_WITH(rhino-jar,
2383     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2384         [Specify path to jarfile manually.]),
2385     RHINO_JAR=$withval)
2387 AC_ARG_WITH(system-jfreereport,
2388     AS_HELP_STRING([--with-system-jfreereport],
2389         [Use JFreeReport already on system.]),,
2390     [with_system_jfreereport="$with_system_jars"])
2392 AC_ARG_WITH(sac-jar,
2393     AS_HELP_STRING([--with-sac-jar=JARFILE],
2394         [Specify path to jarfile manually.]),
2395     SAC_JAR=$withval)
2397 AC_ARG_WITH(libxml-jar,
2398     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2399         [Specify path to jarfile manually.]),
2400     LIBXML_JAR=$withval)
2402 AC_ARG_WITH(flute-jar,
2403     AS_HELP_STRING([--with-flute-jar=JARFILE],
2404         [Specify path to jarfile manually.]),
2405     FLUTE_JAR=$withval)
2407 AC_ARG_WITH(jfreereport-jar,
2408     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2409         [Specify path to jarfile manually.]),
2410     JFREEREPORT_JAR=$withval)
2412 AC_ARG_WITH(liblayout-jar,
2413     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2414         [Specify path to jarfile manually.]),
2415     LIBLAYOUT_JAR=$withval)
2417 AC_ARG_WITH(libloader-jar,
2418     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2419         [Specify path to jarfile manually.]),
2420     LIBLOADER_JAR=$withval)
2422 AC_ARG_WITH(libformula-jar,
2423     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2424         [Specify path to jarfile manually.]),
2425     LIBFORMULA_JAR=$withval)
2427 AC_ARG_WITH(librepository-jar,
2428     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2429         [Specify path to jarfile manually.]),
2430     LIBREPOSITORY_JAR=$withval)
2432 AC_ARG_WITH(libfonts-jar,
2433     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2434         [Specify path to jarfile manually.]),
2435     LIBFONTS_JAR=$withval)
2437 AC_ARG_WITH(libserializer-jar,
2438     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2439         [Specify path to jarfile manually.]),
2440     LIBSERIALIZER_JAR=$withval)
2442 AC_ARG_WITH(libbase-jar,
2443     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2444         [Specify path to jarfile manually.]),
2445     LIBBASE_JAR=$withval)
2447 AC_ARG_WITH(system-odbc,
2448     AS_HELP_STRING([--with-system-odbc],
2449         [Use the odbc headers already on system.]),,
2450     [with_system_odbc="auto"])
2452 AC_ARG_WITH(system-sane,
2453     AS_HELP_STRING([--with-system-sane],
2454         [Use sane.h already on system.]),,
2455     [with_system_sane="$with_system_headers"])
2457 AC_ARG_WITH(system-bluez,
2458     AS_HELP_STRING([--with-system-bluez],
2459         [Use bluetooth.h already on system.]),,
2460     [with_system_bluez="$with_system_headers"])
2462 AC_ARG_WITH(system-boost,
2463     AS_HELP_STRING([--with-system-boost],
2464         [Use boost already on system.]),,
2465     [with_system_boost="$with_system_headers"])
2467 AC_ARG_WITH(system-dragonbox,
2468     AS_HELP_STRING([--with-system-dragonbox],
2469         [Use dragonbox already on system.]),,
2470     [with_system_dragonbox="$with_system_headers"])
2472 AC_ARG_WITH(system-frozen,
2473     AS_HELP_STRING([--with-system-frozen],
2474         [Use frozen already on system.]),,
2475     [with_system_frozen="$with_system_headers"])
2477 AC_ARG_WITH(system-libfixmath,
2478     AS_HELP_STRING([--with-system-libfixmath],
2479         [Use libfixmath already on system.]),,
2480     [with_system_libfixmath="$with_system_libs"])
2482 AC_ARG_WITH(system-glm,
2483     AS_HELP_STRING([--with-system-glm],
2484         [Use glm already on system.]),,
2485     [with_system_glm="$with_system_headers"])
2487 AC_ARG_WITH(system-hunspell,
2488     AS_HELP_STRING([--with-system-hunspell],
2489         [Use libhunspell already on system.]),,
2490     [with_system_hunspell="$with_system_libs"])
2492 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2493     AS_HELP_STRING([--enable-cairo-rgba],
2494         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2496 libo_FUZZ_ARG_ENABLE(zxing,
2497     AS_HELP_STRING([--disable-zxing],
2498        [Disable use of zxing external library.]))
2500 AC_ARG_WITH(system-zxing,
2501     AS_HELP_STRING([--with-system-zxing],
2502         [Use libzxing already on system.]),,
2503     [with_system_zxing="$with_system_libs"])
2505 AC_ARG_WITH(system-box2d,
2506     AS_HELP_STRING([--with-system-box2d],
2507         [Use box2d already on system.]),,
2508     [with_system_box2d="$with_system_libs"])
2510 AC_ARG_WITH(system-mythes,
2511     AS_HELP_STRING([--with-system-mythes],
2512         [Use mythes already on system.]),,
2513     [with_system_mythes="$with_system_libs"])
2515 AC_ARG_WITH(system-altlinuxhyph,
2516     AS_HELP_STRING([--with-system-altlinuxhyph],
2517         [Use ALTLinuxhyph already on system.]),,
2518     [with_system_altlinuxhyph="$with_system_libs"])
2520 AC_ARG_WITH(system-lpsolve,
2521     AS_HELP_STRING([--with-system-lpsolve],
2522         [Use lpsolve already on system.]),,
2523     [with_system_lpsolve="$with_system_libs"])
2525 AC_ARG_WITH(system-coinmp,
2526     AS_HELP_STRING([--with-system-coinmp],
2527         [Use CoinMP already on system.]),,
2528     [with_system_coinmp="$with_system_libs"])
2530 AC_ARG_WITH(system-liblangtag,
2531     AS_HELP_STRING([--with-system-liblangtag],
2532         [Use liblangtag library already on system.]),,
2533     [with_system_liblangtag="$with_system_libs"])
2535 AC_ARG_WITH(system-lockfile,
2536     AS_HELP_STRING([--with-system-lockfile[=file]],
2537         [Detect a system lockfile program or use the \$file argument.]))
2539 AC_ARG_WITH(webdav,
2540     AS_HELP_STRING([--without-webdav],
2541         [Disable WebDAV support in the UCB.]))
2543 AC_ARG_WITH(linker-hash-style,
2544     AS_HELP_STRING([--with-linker-hash-style],
2545         [Use linker with --hash-style=<style> when linking shared objects.
2546          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2547          if supported on the build system, and "sysv" otherwise.]))
2549 AC_ARG_WITH(jdk-home,
2550     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2551         [If you have installed JDK 17 or later on your system please supply the
2552          path here. Note that this is not the location of the java command but the
2553          location of the entire distribution. In case of cross-compiling, this
2554          is the JDK of the host os. Use --with-build-platform-configure-options
2555          to point to a different build platform JDK.]),
2558 AC_ARG_WITH(help,
2559     AS_HELP_STRING([--with-help],
2560         [Enable the build of help. There is a special parameter "common" that
2561          can be used to bundle only the common part, .e.g help-specific icons.
2562          This is useful when you build the helpcontent separately.])
2563     [
2564                           Usage:     --with-help    build the old local help
2565                                  --without-help     no local help (default)
2566                                  --with-help=html   build the new HTML local help
2567                                  --with-help=online build the new HTML online help
2568     ],
2571 AC_ARG_WITH(omindex,
2572    AS_HELP_STRING([--with-omindex],
2573         [Enable the support of xapian-omega index for online help.])
2574    [
2575                          Usage: --with-omindex=server prepare the pages for omindex
2576                                 but let xapian-omega be built in server.
2577                                 --with-omindex=noxap do not prepare online pages
2578                                 for xapian-omega
2579   ],
2582 libo_FUZZ_ARG_WITH(java,
2583     AS_HELP_STRING([--with-java=<java command>],
2584         [Specify the name of the Java interpreter command. Typically "java"
2585          which is the default.
2587          To build without support for Java components, applets, accessibility
2588          or the XML filters written in Java, use --without-java or --with-java=no.]),
2589     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2590     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2593 AC_ARG_WITH(jvm-path,
2594     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2595         [Use a specific JVM search path at runtime.
2596          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2599 AC_ARG_WITH(ant-home,
2600     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2601         [If you have installed Apache Ant on your system, please supply the path here.
2602          Note that this is not the location of the Ant binary but the location
2603          of the entire distribution.]),
2606 AC_ARG_WITH(symbol-config,
2607     AS_HELP_STRING([--with-symbol-config],
2608         [Configuration for the crashreport symbol upload]),
2609         [],
2610         [with_symbol_config=no])
2612 AC_ARG_WITH(export-validation,
2613     AS_HELP_STRING([--without-export-validation],
2614         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2615 ,with_export_validation=auto)
2617 AC_ARG_WITH(bffvalidator,
2618     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2619         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2620          Requires installed Microsoft Office Binary File Format Validator.
2621          Note: export-validation (--with-export-validation) is required to be turned on.
2622          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2623 ,with_bffvalidator=no)
2625 libo_FUZZ_ARG_WITH(junit,
2626     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2627         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2628          --without-junit disables those tests. Not relevant in the --without-java case.]),
2629 ,with_junit=yes)
2631 AC_ARG_WITH(hamcrest,
2632     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2633         [Specifies the hamcrest jar file to use for JUnit-based tests.
2634          --without-junit disables those tests. Not relevant in the --without-java case.]),
2635 ,with_hamcrest=yes)
2637 AC_ARG_WITH(perl-home,
2638     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2639         [If you have installed Perl 5 Distribution, on your system, please
2640          supply the path here. Note that this is not the location of the Perl
2641          binary but the location of the entire distribution.]),
2644 libo_FUZZ_ARG_WITH(doxygen,
2645     AS_HELP_STRING(
2646         [--with-doxygen=<absolute path to doxygen executable>],
2647         [Specifies the doxygen executable to use when generating ODK C/C++
2648          documentation. --without-doxygen disables generation of ODK C/C++
2649          documentation. Not relevant in the --disable-odk case.]),
2650 ,with_doxygen=yes)
2652 AC_ARG_WITH(visual-studio,
2653     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2654         [Specify which Visual Studio version to use in case several are
2655          installed. Currently 2019 (default) and 2022 are supported.]),
2658 AC_ARG_WITH(windows-sdk,
2659     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2660         [Specify which Windows SDK, or "Windows Kit", version to use
2661          in case the one that came with the selected Visual Studio
2662          is not what you want for some reason. Note that not all compiler/SDK
2663          combinations are supported. The intent is that this option should not
2664          be needed.]),
2667 AC_ARG_WITH(lang,
2668     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2669         [Use this option to build LibreOffice with additional UI language support.
2670          English (US) is always included by default.
2671          Separate multiple languages with space.
2672          For all languages, use --with-lang=ALL.]),
2675 AC_ARG_WITH(locales,
2676     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2677         [Use this option to limit the locale information built in.
2678          Separate multiple locales with space.
2679          Very experimental and might well break stuff.
2680          Just a desperate measure to shrink code and data size.
2681          By default all the locales available is included.
2682          Just works with --disable-dynloading. Defaults to "ALL".
2683          This option is completely unrelated to --with-lang.])
2684     [
2685                           Affects also our character encoding conversion
2686                           tables for encodings mainly targeted for a
2687                           particular locale, like EUC-CN and EUC-TW for
2688                           zh, ISO-2022-JP for ja.
2690                           Affects also our add-on break iterator data for
2691                           some languages.
2693                           For the default, all locales, don't use this switch at all.
2694                           Specifying just the language part of a locale means all matching
2695                           locales will be included.
2696     ],
2699 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2700 libo_FUZZ_ARG_WITH(krb5,
2701     AS_HELP_STRING([--with-krb5],
2702         [Enable MIT Kerberos 5 support in modules that support it.
2703          By default automatically enabled on platforms
2704          where a good system Kerberos 5 is available.]),
2707 libo_FUZZ_ARG_WITH(gssapi,
2708     AS_HELP_STRING([--with-gssapi],
2709         [Enable GSSAPI support in modules that support it.
2710          By default automatically enabled on platforms
2711          where a good system GSSAPI is available.]),
2714 libo_FUZZ_ARG_WITH(lxml,
2715     AS_HELP_STRING([--without-lxml],
2716         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2717          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2718          report widget classes and ids.]),
2721 libo_FUZZ_ARG_WITH(latest-c++,
2722     AS_HELP_STRING([--with-latest-c++],
2723         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2724          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2725         [with_latest_c__=no])
2727 AC_ARG_WITH(gtk3-build,
2728     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2729         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2730          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2732 dnl ===================================================================
2733 dnl Branding
2734 dnl ===================================================================
2736 AC_ARG_WITH(branding,
2737     AS_HELP_STRING([--with-branding=/path/to/images],
2738         [Use given path to retrieve branding images set.])
2739     [
2740                           Search for intro.png about.svg and logo.svg.
2741                           If any is missing, default ones will be used instead.
2743                           Search also progress.conf for progress
2744                           settings on intro screen :
2746                           PROGRESSBARCOLOR="255,255,255" Set color of
2747                           progress bar. Comma separated RGB decimal values.
2748                           PROGRESSSIZE="407,6" Set size of progress bar.
2749                           Comma separated decimal values (width, height).
2750                           PROGRESSPOSITION="61,317" Set position of progress
2751                           bar from left,top. Comma separated decimal values.
2752                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2753                           bar frame. Comma separated RGB decimal values.
2754                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2755                           bar text. Comma separated RGB decimal values.
2756                           PROGRESSTEXTBASELINE="287" Set vertical position of
2757                           progress bar text from top. Decimal value.
2759                           Default values will be used if not found.
2760     ],
2764 AC_ARG_WITH(extra-buildid,
2765     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2766         [Show addition build identification in about dialog.]),
2770 AC_ARG_WITH(vendor,
2771     AS_HELP_STRING([--with-vendor="John the Builder"],
2772         [Set vendor of the build.]),
2775 AC_ARG_WITH(privacy-policy-url,
2776     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2777         [The URL to your privacy policy (needed when
2778          enabling online-update or crashreporting via breakpad)]),
2779         [if test "x$with_privacy_policy_url" = "xyes"; then
2780             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2781          elif test "x$with_privacy_policy_url" = "xno"; then
2782             with_privacy_policy_url="undefined"
2783          fi]
2784 ,[with_privacy_policy_url="undefined"])
2786 AC_ARG_WITH(android-package-name,
2787     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2788         [Set Android package name of the build.]),
2791 AC_ARG_WITH(compat-oowrappers,
2792     AS_HELP_STRING([--with-compat-oowrappers],
2793         [Install oo* wrappers in parallel with
2794          lo* ones to keep backward compatibility.
2795          Has effect only with make distro-pack-install]),
2798 AC_ARG_WITH(os-version,
2799     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2800         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2803 AC_ARG_WITH(parallelism,
2804     AS_HELP_STRING([--with-parallelism],
2805         [Number of jobs to run simultaneously during build. Parallel builds can
2806         save a lot of time on multi-cpu machines. Defaults to the number of
2807         CPUs on the machine, unless you configure --enable-icecream - then to
2808         40.]),
2811 AC_ARG_WITH(all-tarballs,
2812     AS_HELP_STRING([--with-all-tarballs],
2813         [Download all external tarballs unconditionally]))
2815 AC_ARG_WITH(gdrive-client-id,
2816     AS_HELP_STRING([--with-gdrive-client-id],
2817         [Provides the client id of the application for OAuth2 authentication
2818         on Google Drive. If either this or --with-gdrive-client-secret is
2819         empty, the feature will be disabled]),
2822 AC_ARG_WITH(gdrive-client-secret,
2823     AS_HELP_STRING([--with-gdrive-client-secret],
2824         [Provides the client secret of the application for OAuth2
2825         authentication on Google Drive. If either this or
2826         --with-gdrive-client-id is empty, the feature will be disabled]),
2829 AC_ARG_WITH(alfresco-cloud-client-id,
2830     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2831         [Provides the client id of the application for OAuth2 authentication
2832         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2833         empty, the feature will be disabled]),
2836 AC_ARG_WITH(alfresco-cloud-client-secret,
2837     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2838         [Provides the client secret of the application for OAuth2
2839         authentication on Alfresco Cloud. If either this or
2840         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2843 AC_ARG_WITH(onedrive-client-id,
2844     AS_HELP_STRING([--with-onedrive-client-id],
2845         [Provides the client id of the application for OAuth2 authentication
2846         on OneDrive. If either this or --with-onedrive-client-secret is
2847         empty, the feature will be disabled]),
2850 AC_ARG_WITH(onedrive-client-secret,
2851     AS_HELP_STRING([--with-onedrive-client-secret],
2852         [Provides the client secret of the application for OAuth2
2853         authentication on OneDrive. If either this or
2854         --with-onedrive-client-id is empty, the feature will be disabled]),
2857 dnl Check for coredumpctl support to present information about crashing test processes:
2858 AC_ARG_WITH(coredumpctl,
2859     AS_HELP_STRING([--with-coredumpctl],
2860         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2861         processes.]))
2863 dnl ===================================================================
2864 dnl Do we want to use pre-build binary tarball for recompile
2865 dnl ===================================================================
2867 if test "$enable_library_bin_tar" = "yes" ; then
2868     USE_LIBRARY_BIN_TAR=TRUE
2869 else
2870     USE_LIBRARY_BIN_TAR=
2872 AC_SUBST(USE_LIBRARY_BIN_TAR)
2874 dnl ===================================================================
2875 dnl Test whether build target is Release Build
2876 dnl ===================================================================
2877 AC_MSG_CHECKING([whether build target is Release Build])
2878 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2879     AC_MSG_RESULT([no])
2880     ENABLE_RELEASE_BUILD=
2881     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2882     dnl the newlines and then complains about spaces.
2883     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/>'
2884 else
2885     AC_MSG_RESULT([yes])
2886     ENABLE_RELEASE_BUILD=TRUE
2887     GET_TASK_ALLOW_ENTITLEMENT=
2889 AC_SUBST(ENABLE_RELEASE_BUILD)
2890 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2892 AC_MSG_CHECKING([whether to build a Community flavor])
2893 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2894     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2895     AC_MSG_RESULT([yes])
2896 else
2897     AC_MSG_RESULT([no])
2900 dnl ===================================================================
2901 dnl Test whether to sign Windows Build
2902 dnl ===================================================================
2903 AC_MSG_CHECKING([whether to sign windows build])
2904 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2905     AC_MSG_RESULT([yes])
2906     WINDOWS_BUILD_SIGNING="TRUE"
2907 else
2908     AC_MSG_RESULT([no])
2909     WINDOWS_BUILD_SIGNING="FALSE"
2911 AC_SUBST(WINDOWS_BUILD_SIGNING)
2913 dnl ===================================================================
2914 dnl MacOSX build and runtime environment options
2915 dnl ===================================================================
2917 AC_ARG_WITH(macosx-version-min-required,
2918     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2919         [set the minimum OS version needed to run the built LibreOffice])
2920     [
2921                           e. g.: --with-macosx-version-min-required=10.15
2922     ],
2925 dnl ===================================================================
2926 dnl Check for incompatible options set by fuzzing, and reset those
2927 dnl automatically to working combinations
2928 dnl ===================================================================
2930 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2931         "$enable_dbus" != "$enable_avahi"; then
2932     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2933     enable_avahi=$enable_dbus
2936 add_lopath_after ()
2938     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2939         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2940     fi
2943 add_lopath_before ()
2945     local IFS=${P_SEP}
2946     local path_cleanup
2947     local dir
2948     for dir in $LO_PATH ; do
2949         if test "$dir" != "$1" ; then
2950             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2951         fi
2952     done
2953     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2956 dnl ===================================================================
2957 dnl check for required programs (grep, awk, sed, bash)
2958 dnl ===================================================================
2960 pathmunge ()
2962     local new_path
2963     if test -n "$1"; then
2964         if test "$build_os" = "cygwin"; then
2965             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2966                 PathFormat "$1"
2967                 new_path=`cygpath -sm "$formatted_path"`
2968             else
2969                 PathFormat "$1"
2970                 new_path=`cygpath -u "$formatted_path"`
2971             fi
2972         else
2973             new_path="$1"
2974         fi
2975         if test "$2" = "after"; then
2976             add_lopath_after "$new_path"
2977         else
2978             add_lopath_before "$new_path"
2979         fi
2980     fi
2983 AC_PROG_AWK
2984 AC_PATH_PROG( AWK, $AWK)
2985 if test -z "$AWK"; then
2986     AC_MSG_ERROR([install awk to run this script])
2989 AC_PATH_PROG(BASH, bash)
2990 if test -z "$BASH"; then
2991     AC_MSG_ERROR([bash not found in \$PATH])
2993 AC_SUBST(BASH)
2995 # prefer parallel compression tools, if available
2996 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2997 if test -z "$COMPRESSIONTOOL"; then
2998     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2999     if test -z "$COMPRESSIONTOOL"; then
3000         AC_MSG_ERROR([gzip not found in \$PATH])
3001     fi
3003 AC_SUBST(COMPRESSIONTOOL)
3005 AC_MSG_CHECKING([for GNU or BSD tar])
3006 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3007     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3008     if test $? -eq 0;  then
3009         GNUTAR=$a
3010         break
3011     fi
3012 done
3013 AC_MSG_RESULT($GNUTAR)
3014 if test -z "$GNUTAR"; then
3015     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3017 AC_SUBST(GNUTAR)
3019 AC_MSG_CHECKING([for tar's option to strip components])
3020 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3021 if test $? -eq 0; then
3022     STRIP_COMPONENTS="--strip-components"
3023 else
3024     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3025     if test $? -eq 0; then
3026         STRIP_COMPONENTS="--strip-path"
3027     else
3028         STRIP_COMPONENTS="unsupported"
3029     fi
3031 AC_MSG_RESULT($STRIP_COMPONENTS)
3032 if test x$STRIP_COMPONENTS = xunsupported; then
3033     AC_MSG_ERROR([you need a tar that is able to strip components.])
3035 AC_SUBST(STRIP_COMPONENTS)
3037 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3038 dnl desktop OSes from "mobile" ones.
3040 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3041 dnl In other words, that when building for an OS that is not a
3042 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3044 dnl Note the direction of the implication; there is no assumption that
3045 dnl cross-compiling would imply a non-desktop OS.
3047 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3048     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3049     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3050     if test "$_os" != Emscripten; then
3051         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3052     fi
3055 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3056 # also work with the default gtk3 plugin.
3057 if test "$enable_wasm_strip" = "yes"; then
3058     enable_avmedia=no
3059     enable_libcmis=no
3060     enable_coinmp=no
3061     enable_cups=no
3062     test "$_os" = Emscripten && enable_curl=no
3063     enable_database_connectivity=no
3064     enable_dbus=no
3065     enable_dconf=no
3066     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3067     enable_extension_integration=no
3068     enable_extensions=no
3069     enable_extension_update=no
3070     enable_gio=no
3071     enable_gpgmepp=no
3072     enable_ldap=no
3073     enable_lotuswordpro=no
3074     enable_lpsolve=no
3075     enable_nss=no
3076     enable_odk=no
3077     enable_online_update=no
3078     enable_opencl=no
3079     enable_pdfimport=no
3080     enable_randr=no
3081     enable_report_builder=no
3082     enable_scripting=no
3083     enable_sdremote_bluetooth=no
3084     enable_skia=no
3085     enable_xmlhelp=no
3086     enable_zxing=no
3087     test_libepubgen=no
3088     test_libcdr=no
3089     test_libcmis=no
3090     test_libetonyek=no
3091     test_libfreehand=no
3092     test_libmspub=no
3093     test_libpagemaker=no
3094     test_libqxp=no
3095     test_libvisio=no
3096     test_libzmf=no
3097     test_webdav=no
3098     with_galleries=no
3099     with_templates=no
3100     with_webdav=no
3101     with_x=no
3103     test "${with_fonts+set}" = set || with_fonts=yes
3104     test "${with_locales+set}" = set || with_locales=en
3106     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3107     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3108     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3109     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3110 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3111     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3112     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3113     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3114     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3115 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3116     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3117     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3118     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3119     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3120     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3121     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3122     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3123     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3126 EMSCRIPTEN_NEH_MAJOR=3
3127 EMSCRIPTEN_NEH_MINOR=1
3128 EMSCRIPTEN_NEH_TINY=3
3129 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3131 if test "$enable_wasm_exceptions" = yes; then
3132     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3133     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3134     if test $? -ne 0; then
3135         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3136     else
3137         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3138     fi
3139     ENABLE_WASM_EXCEPTIONS=TRUE
3141 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3143 # Whether to build "avmedia" functionality or not.
3145 if test "$enable_avmedia" = yes; then
3146     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3147     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3148 else
3149     test_gstreamer_1_0=no
3152 # Decide whether to build database connectivity stuff (including Base) or not.
3153 if test "$enable_database_connectivity" != no; then
3154     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3155     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3156 else
3157     if test "$_os" = iOS; then
3158         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3159     fi
3160     disable_database_connectivity_dependencies
3163 if test -z "$enable_extensions"; then
3164     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3165     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3166         enable_extensions=yes
3167     fi
3170 DISABLE_SCRIPTING=''
3171 if test "$enable_scripting" = yes; then
3172     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3173     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3174 else
3175     DISABLE_SCRIPTING='TRUE'
3176     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3179 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3180     # Disable dynamic_loading always for iOS and Android
3181     enable_dynamic_loading=no
3182 elif test -z "$enable_dynamic_loading"; then
3183     # Otherwise enable it unless specifically disabled
3184     enable_dynamic_loading=yes
3187 DISABLE_DYNLOADING=''
3188 if test "$enable_dynamic_loading" = yes; then
3189     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3190 else
3191     DISABLE_DYNLOADING='TRUE'
3192     if test $_os != iOS -a $_os != Android; then
3193         enable_database_connectivity=no
3194         enable_nss=no
3195         enable_odk=no
3196         enable_python=no
3197         enable_skia=no
3198         with_java=no
3199     fi
3201 AC_SUBST(DISABLE_DYNLOADING)
3203 ENABLE_CUSTOMTARGET_COMPONENTS=
3204 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3205     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3206     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3207         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3208     fi
3210 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3212 if test "$enable_extensions" = yes; then
3213     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3214     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3215 else
3216     enable_extension_integration=no
3217     enable_extension_update=no
3220 # remember SYSBASE value
3221 AC_SUBST(SYSBASE)
3223 dnl ===================================================================
3224 dnl  Sort out various gallery compilation options
3225 dnl ===================================================================
3226 WITH_GALLERY_BUILD=TRUE
3227 AC_MSG_CHECKING([how to build and package galleries])
3228 if test -n "${with_galleries}"; then
3229     if test "$with_galleries" = "build"; then
3230         if test "$enable_database_connectivity" = no; then
3231             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3232         fi
3233         AC_MSG_RESULT([build from source images internally])
3234     elif test "$with_galleries" = "no"; then
3235         WITH_GALLERY_BUILD=
3236         AC_MSG_RESULT([disable non-internal gallery build])
3237     else
3238         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3239     fi
3240 else
3241     if test $_os != iOS -a $_os != Android; then
3242         AC_MSG_RESULT([internal src images for desktop])
3243     else
3244         WITH_GALLERY_BUILD=
3245         AC_MSG_RESULT([disable src image build])
3246     fi
3248 AC_SUBST(WITH_GALLERY_BUILD)
3250 dnl ===================================================================
3251 dnl  Sort out various templates compilation options
3252 dnl ===================================================================
3253 WITH_TEMPLATES=TRUE
3254 AC_MSG_CHECKING([build with or without template files])
3255 if test -n "${with_templates}"; then
3256     if test "$with_templates" = "yes"; then
3257         AC_MSG_RESULT([enable all templates])
3258     elif test "$with_templates" = "no"; then
3259         WITH_TEMPLATES=
3260         AC_MSG_RESULT([disable non-internal templates])
3261     else
3262         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3263     fi
3264 else
3265     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3266         AC_MSG_RESULT([enable all templates])
3267     else
3268         WITH_TEMPLATES=
3269         AC_MSG_RESULT([disable non-internal templates])
3270     fi
3272 AC_SUBST(WITH_TEMPLATES)
3274 dnl ===================================================================
3275 dnl  Checks if ccache is available
3276 dnl ===================================================================
3277 CCACHE_DEPEND_MODE=
3278 if test "$enable_ccache" = "no"; then
3279     CCACHE=""
3280 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3281     case "%$CC%$CXX%" in
3282     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3283     # assume that's good then
3284     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3285         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3286         CCACHE_DEPEND_MODE=1
3287         ;;
3288     *)
3289         # try to use our own ccache if it is available and CCACHE was not already defined
3290         if test -z "$CCACHE"; then
3291             if test "$_os" = "WINNT"; then
3292                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3293             fi
3294             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3295                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3296             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3297                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3298             fi
3299         fi
3300         AC_PATH_PROG([CCACHE],[ccache],[not found])
3301         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3302             CCACHE=`win_short_path_for_make "$CCACHE"`
3303             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3304             rm -f conftest.txt
3305             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3306             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3307             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3308                 AC_MSG_RESULT(yes)
3309             else
3310                 AC_MSG_RESULT(no)
3311                 CCACHE="not found"
3312             fi
3313             rm -f conftest.txt
3314         fi
3315         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3316             # on windows/VC perhaps sccache is around?
3317             case "%$CC%$CXX%" in
3318             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3319             # assume that's good then
3320             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3321                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3322                 CCACHE_DEPEND_MODE=1
3323                 SCCACHE=1
3324                 ;;
3325             *)
3326                 # for sharing code below, reuse CCACHE env var
3327                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3328                 if test "$CCACHE" != "not found"; then
3329                     CCACHE=`win_short_path_for_make "$CCACHE"`
3330                     SCCACHE=1
3331                     CCACHE_DEPEND_MODE=1
3332                 fi
3333                 ;;
3334             esac
3335         fi
3336         if test "$CCACHE" = "not found"; then
3337             CCACHE=""
3338         fi
3339         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3340             CCACHE_DEPEND_MODE=1
3341             # Need to check for ccache version: otherwise prevents
3342             # caching of the results (like "-x objective-c++" for Mac)
3343             if test $_os = Darwin -o $_os = iOS; then
3344                 # Check ccache version
3345                 AC_MSG_CHECKING([whether version of ccache is suitable])
3346                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3347                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3348                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3349                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3350                 else
3351                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3352                     CCACHE=""
3353                     CCACHE_DEPEND_MODE=
3354                 fi
3355             fi
3356         fi
3357         ;;
3358     esac
3359 else
3360     CCACHE=""
3362 if test "$enable_ccache" = "nodepend"; then
3363     CCACHE_DEPEND_MODE=""
3365 AC_SUBST(CCACHE_DEPEND_MODE)
3367 # sccache defaults are good enough
3368 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3369     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3370     # or (...) max_size = 20.0 G
3371     # -p works with both 4.2 and 4.4
3372     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3373     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3374     if test "$ccache_size" = ""; then
3375         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3376         if test "$ccache_size" = ""; then
3377             ccache_size=0
3378         fi
3379         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3380         if test $ccache_size -lt 1024; then
3381             CCACHE=""
3382             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3383             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3384         else
3385             # warn that ccache may be too small for debug build
3386             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3387             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3388         fi
3389     else
3390         if test $ccache_size -lt 5; then
3391             #warn that ccache may be too small for debug build
3392             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3393             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3394         fi
3395     fi
3398 ENABLE_Z7_DEBUG=
3399 if test "$enable_z7_debug" != no; then
3400     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3401         ENABLE_Z7_DEBUG=TRUE
3402     fi
3403 else
3404     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3405     add_warning "ccache will not work with --disable-z7-debug"
3407 AC_SUBST(ENABLE_Z7_DEBUG)
3409 dnl ===================================================================
3410 dnl  Checks for C compiler,
3411 dnl  The check for the C++ compiler is later on.
3412 dnl ===================================================================
3413 if test "$_os" != "WINNT"; then
3414     GCC_HOME_SET="true"
3415     AC_MSG_CHECKING([gcc home])
3416     if test -z "$with_gcc_home"; then
3417         if test "$enable_icecream" = "yes"; then
3418             if test -d "/usr/lib/icecc/bin"; then
3419                 GCC_HOME="/usr/lib/icecc/"
3420             elif test -d "/usr/libexec/icecc/bin"; then
3421                 GCC_HOME="/usr/libexec/icecc/"
3422             elif test -d "/opt/icecream/bin"; then
3423                 GCC_HOME="/opt/icecream/"
3424             else
3425                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3427             fi
3428         else
3429             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3430             GCC_HOME_SET="false"
3431         fi
3432     else
3433         GCC_HOME="$with_gcc_home"
3434     fi
3435     AC_MSG_RESULT($GCC_HOME)
3436     AC_SUBST(GCC_HOME)
3438     if test "$GCC_HOME_SET" = "true"; then
3439         if test -z "$CC"; then
3440             CC="$GCC_HOME/bin/gcc"
3441             CC_BASE="gcc"
3442         fi
3443         if test -z "$CXX"; then
3444             CXX="$GCC_HOME/bin/g++"
3445             CXX_BASE="g++"
3446         fi
3447     fi
3450 COMPATH=`dirname "$CC"`
3451 if test "$COMPATH" = "."; then
3452     AC_PATH_PROGS(COMPATH, $CC)
3453     dnl double square bracket to get single because of M4 quote...
3454     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3456 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3458 dnl ===================================================================
3459 dnl Java support
3460 dnl ===================================================================
3461 AC_MSG_CHECKING([whether to build with Java support])
3462 if test "$with_java" != "no"; then
3463     if test "$DISABLE_SCRIPTING" = TRUE; then
3464         AC_MSG_RESULT([no, overridden by --disable-scripting])
3465         ENABLE_JAVA=""
3466         with_java=no
3467     else
3468         AC_MSG_RESULT([yes])
3469         ENABLE_JAVA="TRUE"
3470         AC_DEFINE(HAVE_FEATURE_JAVA)
3471     fi
3472 else
3473     AC_MSG_RESULT([no])
3474     ENABLE_JAVA=""
3477 AC_SUBST(ENABLE_JAVA)
3479 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3481 dnl ENABLE_JAVA="" indicate no Java support at all
3483 dnl ===================================================================
3484 dnl Check macOS SDK and compiler
3485 dnl ===================================================================
3487 if test $_os = Darwin; then
3489     # The SDK in the currently selected Xcode should be found.
3491     AC_MSG_CHECKING([what macOS SDK to use])
3492     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3493     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3494     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3495     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3496     # problems that existed in the PPC days with target versions not being respected or random
3497     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3498     # SDK version is enough, no need to do both...
3499     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3500     if test ! -d "$MACOSX_SDK_PATH"; then
3501         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3502     fi
3503     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3504     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3505     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3506     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3507     # 10.10.2 is 101002
3508     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3509     # correct version in case such an old SDK is specified, it will be rejected later anyway
3510     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3511     if test $MACOSX_SDK_VERSION -lt 101500; then
3512         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3513     fi
3514     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3515         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3516     fi
3517     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3519     AC_MSG_CHECKING([what minimum version of macOS to require])
3520     if test "$with_macosx_version_min_required" = "" ; then
3521         if test "$host_cpu" = x86_64; then
3522             with_macosx_version_min_required="10.15";
3523         else
3524             with_macosx_version_min_required="11.0";
3525         fi
3526     fi
3527     # see same notes about MACOSX_SDK_VERSION above
3528     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3529     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3530         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3531     fi
3532     AC_MSG_RESULT([$with_macosx_version_min_required])
3534     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3535     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3536         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3537     else
3538         AC_MSG_RESULT([yes])
3539     fi
3541     # export this so that "xcrun" invocations later return matching values
3542     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3543     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3544     export DEVELOPER_DIR
3545     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3546     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3548     AC_MSG_CHECKING([whether Xcode is new enough])
3549     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3550     my_xcode_ver2=${my_xcode_ver1#Xcode }
3551     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3552     if test "$my_xcode_ver3" -ge 1205; then
3553         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3554         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3555             if test "$my_xcode_ver3" -ge 1600; then
3556                 dnl the Xcode 15 relnotes state that the classic linker will disappear in the next version, but nothing about
3557                 dnl fixing the problem with weak symbols/macOS 11 compatibility, so assume for now that Xcode 16 will break it...
3558                 AC_MSG_ERROR([Check that Xcode 16 still supports the old linker/that it doesn't break macOS 11 compatibility, then remove this check]);
3559             fi
3560             if test "$my_xcode_ver3" -ge 1500; then
3561                 AC_MSG_WARN([Xcode 15 has a new linker that causes runtime crashes on macOS 11])
3562                 add_warning "Xcode 15 has a new linker that causes runtime crashes on macOS 11, forcing the old linker."
3563                 add_warning "see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking"
3564                 LDFLAGS="$LDFLAGS -Wl,-ld_classic"
3565                 # if LDFLAGS weren't set already, a check above sets x_LDFLAGS=[#] to comment-out the export LDFLAGS line in config_host.mk
3566                 x_LDFLAGS=
3567             fi
3568         fi
3569     else
3570         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3571     fi
3573     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3574     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3576     LIBTOOL=/usr/bin/libtool
3577     INSTALL_NAME_TOOL=install_name_tool
3578     if test -z "$save_CC"; then
3579         stdlib=-stdlib=libc++
3581         AC_MSG_CHECKING([what C compiler to use])
3582         CC="`xcrun -find clang`"
3583         CC_BASE=`first_arg_basename "$CC"`
3584         if test "$host_cpu" = x86_64; then
3585             CC+=" -target x86_64-apple-macos"
3586         else
3587             CC+=" -target arm64-apple-macos"
3588         fi
3589         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3590         AC_MSG_RESULT([$CC])
3592         AC_MSG_CHECKING([what C++ compiler to use])
3593         CXX="`xcrun -find clang++`"
3594         CXX_BASE=`first_arg_basename "$CXX"`
3595         if test "$host_cpu" = x86_64; then
3596             CXX+=" -target x86_64-apple-macos"
3597         else
3598             CXX+=" -target arm64-apple-macos"
3599         fi
3600         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3601         AC_MSG_RESULT([$CXX])
3603         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3604         AR=`xcrun -find ar`
3605         NM=`xcrun -find nm`
3606         STRIP=`xcrun -find strip`
3607         LIBTOOL=`xcrun -find libtool`
3608         RANLIB=`xcrun -find ranlib`
3609     fi
3611     AC_MSG_CHECKING([whether to do code signing])
3613     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3614         AC_MSG_RESULT([no])
3615     else
3616         if test "$enable_macosx_code_signing" = yes; then
3617             # By default use the first suitable certificate (?).
3619             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3620             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3621             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3622             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3623             # "Developer ID Application" one.
3624             identity="Developer ID Application:"
3625         else
3626             identity=$enable_macosx_code_signing
3627         fi
3628         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3629         if test -n "$identity"; then
3630             MACOSX_CODESIGNING_IDENTITY=$identity
3631             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3632             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3633         else
3634             AC_MSG_ERROR([cannot determine identity to use])
3635         fi
3636     fi
3638     AC_MSG_CHECKING([whether to create a Mac App Store package])
3640     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3641         AC_MSG_RESULT([no])
3642     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3643         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3644     else
3645         if test "$enable_macosx_package_signing" = yes; then
3646             # By default use the first suitable certificate.
3647             # It should be a "3rd Party Mac Developer Installer" one
3648             identity="3rd Party Mac Developer Installer:"
3649         else
3650             identity=$enable_macosx_package_signing
3651         fi
3652         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3653         if test -n "$identity"; then
3654             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3655             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3656             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3657         else
3658             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3659         fi
3660     fi
3662     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3663         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3664     fi
3666     AC_MSG_CHECKING([whether to sandbox the application])
3668     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3669         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3670     elif test "$enable_macosx_sandbox" = yes; then
3671         ENABLE_MACOSX_SANDBOX=TRUE
3672         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3673         AC_MSG_RESULT([yes])
3674     else
3675         AC_MSG_RESULT([no])
3676     fi
3678     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3679     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3680     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3682     if test -n "$with_macosx_provisioning_profile" ; then
3683         if test ! -f "$with_macosx_provisioning_profile"; then
3684             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3685         else
3686             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3687             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3688                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3689                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3690                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3691         fi
3692     fi
3694 AC_SUBST(MACOSX_SDK_PATH)
3695 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3696 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3697 AC_SUBST(INSTALL_NAME_TOOL)
3698 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3699 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3700 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3701 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3702 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3703 AC_SUBST(MACOSX_PROVISIONING_INFO)
3704 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3705 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3706 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3708 dnl ===================================================================
3709 dnl Check iOS SDK and compiler
3710 dnl ===================================================================
3712 if test $_os = iOS; then
3713     AC_MSG_CHECKING([what iOS SDK to use])
3715     if test "$enable_ios_simulator" = "yes"; then
3716         platformlc=iphonesimulator
3717         versionmin=-mios-simulator-version-min=14.5
3718     else
3719         platformlc=iphoneos
3720         versionmin=-miphoneos-version-min=14.5
3721     fi
3723     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3725     if ! test -d "$sysroot"; then
3726         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3727     fi
3729     AC_MSG_RESULT($sysroot)
3731     stdlib="-stdlib=libc++"
3733     AC_MSG_CHECKING([what C compiler to use])
3734     CC="`xcrun -find clang`"
3735     CC_BASE=`first_arg_basename "$CC"`
3736     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3737     AC_MSG_RESULT([$CC])
3739     AC_MSG_CHECKING([what C++ compiler to use])
3740     CXX="`xcrun -find clang++`"
3741     CXX_BASE=`first_arg_basename "$CXX"`
3742     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3743     AC_MSG_RESULT([$CXX])
3745     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3746     AR=`xcrun -find ar`
3747     NM=`xcrun -find nm`
3748     STRIP=`xcrun -find strip`
3749     LIBTOOL=`xcrun -find libtool`
3750     RANLIB=`xcrun -find ranlib`
3753 AC_MSG_CHECKING([whether to treat the installation as read-only])
3755 if test $_os = Darwin; then
3756     enable_readonly_installset=yes
3757 elif test "$enable_extensions" != yes; then
3758     enable_readonly_installset=yes
3760 if test "$enable_readonly_installset" = yes; then
3761     AC_MSG_RESULT([yes])
3762     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3763 else
3764     AC_MSG_RESULT([no])
3767 dnl ===================================================================
3768 dnl Structure of install set
3769 dnl ===================================================================
3771 if test $_os = Darwin; then
3772     LIBO_BIN_FOLDER=MacOS
3773     LIBO_ETC_FOLDER=Resources
3774     LIBO_LIBEXEC_FOLDER=MacOS
3775     LIBO_LIB_FOLDER=Frameworks
3776     LIBO_LIB_PYUNO_FOLDER=Resources
3777     LIBO_SHARE_FOLDER=Resources
3778     LIBO_SHARE_HELP_FOLDER=Resources/help
3779     LIBO_SHARE_JAVA_FOLDER=Resources/java
3780     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3781     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3782     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3783     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3784     LIBO_URE_BIN_FOLDER=MacOS
3785     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3786     LIBO_URE_LIB_FOLDER=Frameworks
3787     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3788     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3789 elif test $_os = WINNT; then
3790     LIBO_BIN_FOLDER=program
3791     LIBO_ETC_FOLDER=program
3792     LIBO_LIBEXEC_FOLDER=program
3793     LIBO_LIB_FOLDER=program
3794     LIBO_LIB_PYUNO_FOLDER=program
3795     LIBO_SHARE_FOLDER=share
3796     LIBO_SHARE_HELP_FOLDER=help
3797     LIBO_SHARE_JAVA_FOLDER=program/classes
3798     LIBO_SHARE_PRESETS_FOLDER=presets
3799     LIBO_SHARE_READMES_FOLDER=readmes
3800     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3801     LIBO_SHARE_SHELL_FOLDER=program/shell
3802     LIBO_URE_BIN_FOLDER=program
3803     LIBO_URE_ETC_FOLDER=program
3804     LIBO_URE_LIB_FOLDER=program
3805     LIBO_URE_MISC_FOLDER=program
3806     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3807 else
3808     LIBO_BIN_FOLDER=program
3809     LIBO_ETC_FOLDER=program
3810     LIBO_LIBEXEC_FOLDER=program
3811     LIBO_LIB_FOLDER=program
3812     LIBO_LIB_PYUNO_FOLDER=program
3813     LIBO_SHARE_FOLDER=share
3814     LIBO_SHARE_HELP_FOLDER=help
3815     LIBO_SHARE_JAVA_FOLDER=program/classes
3816     LIBO_SHARE_PRESETS_FOLDER=presets
3817     LIBO_SHARE_READMES_FOLDER=readmes
3818     if test "$enable_fuzzers" != yes; then
3819         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3820     else
3821         LIBO_SHARE_RESOURCE_FOLDER=resource
3822     fi
3823     LIBO_SHARE_SHELL_FOLDER=program/shell
3824     LIBO_URE_BIN_FOLDER=program
3825     LIBO_URE_ETC_FOLDER=program
3826     LIBO_URE_LIB_FOLDER=program
3827     LIBO_URE_MISC_FOLDER=program
3828     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3830 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3831 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3832 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3833 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3834 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3835 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3836 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3837 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3838 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3839 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3840 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3841 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3842 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3843 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3844 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3845 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3847 # Not all of them needed in config_host.mk, add more if need arises
3848 AC_SUBST(LIBO_BIN_FOLDER)
3849 AC_SUBST(LIBO_ETC_FOLDER)
3850 AC_SUBST(LIBO_LIB_FOLDER)
3851 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3852 AC_SUBST(LIBO_SHARE_FOLDER)
3853 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3854 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3855 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3856 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3857 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3858 AC_SUBST(LIBO_URE_BIN_FOLDER)
3859 AC_SUBST(LIBO_URE_ETC_FOLDER)
3860 AC_SUBST(LIBO_URE_LIB_FOLDER)
3861 AC_SUBST(LIBO_URE_MISC_FOLDER)
3862 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3864 dnl ===================================================================
3865 dnl Windows specific tests and stuff
3866 dnl ===================================================================
3868 reg_get_value()
3870     # Return value: $regvalue
3871     unset regvalue
3873     if test "$build_os" = "wsl"; then
3874         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null)
3875         return
3876     fi
3878     local _regentry="/proc/registry${1}/${2}"
3879     if test -f "$_regentry"; then
3880         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3881         # Registry keys read via /proc/registry* are always \0 terminated!
3882         local _regvalue=$(tr -d '\0' < "$_regentry")
3883         if test $? -eq 0; then
3884             regvalue=$_regvalue
3885         fi
3886     fi
3889 # Get a value from the 32-bit side of the Registry
3890 reg_get_value_32()
3892     reg_get_value "32" "$1"
3895 # Get a value from the 64-bit side of the Registry
3896 reg_get_value_64()
3898     reg_get_value "64" "$1"
3901 reg_list_values()
3903     # Return value: $reglist
3904     unset reglist
3906     if test "$build_os" = "wsl"; then
3907         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
3908         return
3909     fi
3911     reglist=$(ls "/proc/registry${1}/${2}")
3914 # List values from the 32-bit side of the Registry
3915 reg_list_values_32()
3917     reg_list_values "32" "$1"
3920 # List values from the 64-bit side of the Registry
3921 reg_list_values_64()
3923     reg_list_values "64" "$1"
3926 case "$host_os" in
3927 cygwin*|wsl*)
3928     COM=MSC
3929     OS=WNT
3930     RTL_OS=Windows
3931     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3932         P_SEP=";"
3933     else
3934         P_SEP=:
3935     fi
3936     case "$host_cpu" in
3937     x86_64)
3938         CPUNAME=X86_64
3939         RTL_ARCH=X86_64
3940         PLATFORMID=windows_x86_64
3941         WINDOWS_X64=1
3942         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3943         WIN_HOST_ARCH="x64"
3944         WIN_MULTI_ARCH="x86"
3945         WIN_HOST_BITS=64
3946         ;;
3947     i*86)
3948         CPUNAME=INTEL
3949         RTL_ARCH=x86
3950         PLATFORMID=windows_x86
3951         WIN_HOST_ARCH="x86"
3952         WIN_HOST_BITS=32
3953         WIN_OTHER_ARCH="x64"
3954         ;;
3955     aarch64)
3956         CPUNAME=AARCH64
3957         RTL_ARCH=AARCH64
3958         PLATFORMID=windows_aarch64
3959         WINDOWS_X64=1
3960         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3961         WIN_HOST_ARCH="arm64"
3962         WIN_HOST_BITS=64
3963         with_ucrt_dir=no
3964         ;;
3965     *)
3966         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3967         ;;
3968     esac
3970     case "$build_cpu" in
3971     x86_64) WIN_BUILD_ARCH="x64" ;;
3972     i*86) WIN_BUILD_ARCH="x86" ;;
3973     aarch64) WIN_BUILD_ARCH="arm64" ;;
3974     *)
3975         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3976         ;;
3977     esac
3979     SCPDEFS="$SCPDEFS -D_MSC_VER"
3980     ;;
3981 esac
3983 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3984 # other-arch won't, but wouldn't break the build (x64 on x86).
3985 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3986     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3990 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
3991     # To allow building Windows multi-arch releases without cross-tooling
3992     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
3993         cross_compiling="yes"
3994     fi
3997 if test "$cross_compiling" = "yes"; then
3998     export CROSS_COMPILING=TRUE
3999     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4000         ENABLE_WASM_STRIP=TRUE
4001     fi
4002     if test "$_os" = "Emscripten"; then
4003         if test "$with_main_module" = "calc"; then
4004             ENABLE_WASM_STRIP_WRITER=TRUE
4005         elif test "$with_main_module" = "writer"; then
4006             ENABLE_WASM_STRIP_CALC=TRUE
4007         fi
4008     fi
4009 else
4010     CROSS_COMPILING=
4011     BUILD_TYPE="$BUILD_TYPE NATIVE"
4013 AC_SUBST(CROSS_COMPILING)
4014 AC_SUBST(ENABLE_WASM_STRIP)
4015 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4016 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4018 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4019 # NOTE: must _not_ be used for bundled external libraries!
4020 ISYSTEM=
4021 if test "$GCC" = "yes"; then
4022     AC_MSG_CHECKING( for -isystem )
4023     save_CFLAGS=$CFLAGS
4024     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4025     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4026     CFLAGS=$save_CFLAGS
4027     if test -n "$ISYSTEM"; then
4028         AC_MSG_RESULT(yes)
4029     else
4030         AC_MSG_RESULT(no)
4031     fi
4033 if test -z "$ISYSTEM"; then
4034     # fall back to using -I
4035     ISYSTEM=-I
4037 AC_SUBST(ISYSTEM)
4039 dnl ===================================================================
4040 dnl  Check which Visual Studio compiler is used
4041 dnl ===================================================================
4043 map_vs_year_to_version()
4045     # Return value: $vsversion
4047     unset vsversion
4049     case $1 in
4050     2019)
4051         vsversion=16;;
4052     2022)
4053         vsversion=17;;
4054     2022preview)
4055         vsversion=17.8;;
4056     *)
4057         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4058     esac
4061 vs_versions_to_check()
4063     # Args: $1 (optional) : versions to check, in the order of preference
4064     # Return value: $vsversions
4066     unset vsversions
4068     if test -n "$1"; then
4069         map_vs_year_to_version "$1"
4070         vsversions=$vsversion
4071     else
4072         # Default version is 2019
4073         vsversions="16"
4074     fi
4077 win_get_env_from_vsdevcmdbat()
4079     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4080     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4081     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" >> $WRAPPERBATCHFILEPATH
4082     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4083     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4084     local result
4085     if test "$build_os" = "wsl"; then
4086         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4087     else
4088         chmod +x $WRAPPERBATCHFILEPATH
4089         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4090     fi
4091     rm -f $WRAPPERBATCHFILEPATH
4092     printf '%s' "$result"
4095 find_ucrt()
4097     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4098     if test -n "$regvalue"; then
4099         PathFormat "$regvalue"
4100         UCRTSDKDIR=$formatted_path_unix
4101         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4102         UCRTVERSION=$regvalue
4103         # Rest if not exist
4104         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4105           UCRTSDKDIR=
4106         fi
4107     fi
4108     if test -z "$UCRTSDKDIR"; then
4109         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4110         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4111         if test -f "$ide_env_file"; then
4112             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4113             UCRTSDKDIR=$formatted_path
4114             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4115             dnl Hack needed at least by tml:
4116             if test "$UCRTVERSION" = 10.0.15063.0 \
4117                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4118                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4119             then
4120                 UCRTVERSION=10.0.14393.0
4121             fi
4122         else
4123           AC_MSG_ERROR([No UCRT found])
4124         fi
4125     fi
4128 find_msvc()
4130     # Find Visual C++
4131     # Args: $1 (optional) : The VS version year
4132     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4134     unset vctest vctoolset vcnumwithdot vcbuildnumber
4136     vs_versions_to_check "$1"
4137     if test "$build_os" = wsl; then
4138         vswhere="$PROGRAMFILESX86"
4139         if test -z "$vswhere"; then
4140             vswhere="c:\\Program Files (x86)"
4141         fi
4142     else
4143         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4144     fi
4145     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4146     PathFormat "$vswhere"
4147     vswhere=$formatted_path_unix
4148     for ver in $vsversions; do
4149         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4150         if test -z "$vswhereoutput"; then
4151             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4152         fi
4153         # Fall back to all MS products (this includes VC++ Build Tools)
4154         if ! test -n "$vswhereoutput"; then
4155             AC_MSG_CHECKING([VC++ Build Tools and similar])
4156             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4157         fi
4158         if test -n "$vswhereoutput"; then
4159             PathFormat "$vswhereoutput"
4160             vctest=$formatted_path_unix
4161             break
4162         fi
4163     done
4165     if test -n "$vctest"; then
4166         vcnumwithdot="$ver"
4167         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4168             vcnumwithdot=$vcnumwithdot.0
4169         fi
4170         case "$vcnumwithdot" in
4171         16.0)
4172             vcyear=2019
4173             vctoolset=v142
4174             ;;
4175         17.0 | 17.8)
4176             vcyear=2022
4177             vctoolset=v143
4178             ;;
4179         esac
4180         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4182     fi
4185 test_cl_exe()
4187     AC_MSG_CHECKING([$1 compiler])
4189     CL_EXE_PATH="$2/cl.exe"
4191     if test ! -f "$CL_EXE_PATH"; then
4192         if test "$1" = "multi-arch"; then
4193             AC_MSG_WARN([no compiler (cl.exe) in $2])
4194             return 1
4195         else
4196             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4197         fi
4198     fi
4200     dnl ===========================================================
4201     dnl  Check for the corresponding mspdb*.dll
4202     dnl ===========================================================
4204     # MSVC 15.0 has libraries from 14.0?
4205     mspdbnum="140"
4207     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4208         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4209     fi
4211     # The compiles has to find its shared libraries
4212     OLD_PATH="$PATH"
4213     TEMP_PATH=`cygpath -d "$2"`
4214     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4216     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4217         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4218     fi
4220     PATH="$OLD_PATH"
4222     AC_MSG_RESULT([$CL_EXE_PATH])
4225 SOLARINC=
4226 MSBUILD_PATH=
4227 DEVENV=
4228 if test "$_os" = "WINNT"; then
4229     AC_MSG_CHECKING([Visual C++])
4230     find_msvc "$with_visual_studio"
4231     if test -z "$vctest"; then
4232         if test -n "$with_visual_studio"; then
4233             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4234         else
4235             AC_MSG_ERROR([no Visual Studio installation found])
4236         fi
4237     fi
4238     AC_MSG_RESULT([])
4240     VC_PRODUCT_DIR="$vctest/VC"
4241     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4243     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4244     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4245         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4246         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4247         if test $? -ne 0; then
4248             WIN_MULTI_ARCH=""
4249             WIN_OTHER_ARCH=""
4250         fi
4251     fi
4253     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4254         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4255         test_cl_exe "build" "$MSVC_BUILD_PATH"
4256     fi
4258     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4259         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4260         test_cl_exe "host" "$MSVC_HOST_PATH"
4261     else
4262         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4263     fi
4265     AC_MSG_CHECKING([for short pathname of VC product directory])
4266     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4267     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4269     UCRTSDKDIR=
4270     UCRTVERSION=
4272     AC_MSG_CHECKING([for UCRT location])
4273     find_ucrt
4274     # find_ucrt errors out if it doesn't find it
4275     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4276     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4277     ucrtincpath_formatted=$formatted_path
4278     # SOLARINC is used for external modules and must be set too.
4279     # And no, it's not sufficient to set SOLARINC only, as configure
4280     # itself doesn't honour it.
4281     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4282     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4283     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4284     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4286     AC_SUBST(UCRTSDKDIR)
4287     AC_SUBST(UCRTVERSION)
4289     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4290     # Find the proper version of MSBuild.exe to use based on the VS version
4291     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4292     if test -z "$regvalue" ; then
4293         if test "$WIN_BUILD_ARCH" != "x64"; then
4294             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4295         else
4296             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4297         fi
4298     fi
4299     if test -d "$regvalue" ; then
4300         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4301         AC_MSG_RESULT([$regvalue])
4302     else
4303         AC_MSG_ERROR([MSBuild.exe location not found])
4304     fi
4306     # Find the version of devenv.exe
4307     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4308     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4309     DEVENV_unix=$(cygpath -u "$DEVENV")
4310     if test ! -e "$DEVENV_unix"; then
4311         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4312     fi
4314     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4315     dnl needed when building CLR code:
4316     if test -z "$MSVC_CXX"; then
4317         # This gives us a posix path with 8.3 filename restrictions
4318         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4319     fi
4321     if test -z "$CC"; then
4322         CC=$MSVC_CXX
4323         CC_BASE=`first_arg_basename "$CC"`
4324     fi
4325     if test -z "$CXX"; then
4326         CXX=$MSVC_CXX
4327         CXX_BASE=`first_arg_basename "$CXX"`
4328     fi
4330     if test -n "$CC"; then
4331         # Remove /cl.exe from CC case insensitive
4332         AC_MSG_NOTICE([found Visual C++ $vcyear])
4334         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4335         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4337         PathFormat "$COMPATH"
4338         COMPATH=`win_short_path_for_make "$formatted_path"`
4340         VCVER=$vcnumwithdot
4341         VCTOOLSET=$vctoolset
4343         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4344         # are always "better", we list them in reverse chronological order.
4346         case "$vcnumwithdot" in
4347         16.0 | 17.0 | 17.8)
4348             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4349             ;;
4350         esac
4352         # The expectation is that --with-windows-sdk should not need to be used
4353         if test -n "$with_windows_sdk"; then
4354             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4355             *" "$with_windows_sdk" "*)
4356                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4357                 ;;
4358             *)
4359                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4360                 ;;
4361             esac
4362         fi
4364         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4365         ac_objext=obj
4366         ac_exeext=exe
4368     else
4369         AC_MSG_ERROR([Visual C++ not found after all, huh])
4370     fi
4372     # ERROR if VS version < 16.5
4373     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4374     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4375         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4376         // between Visual Studio versions and _MSC_VER:
4377         #if _MSC_VER < 1925
4378         #error
4379         #endif
4380     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4382     # WARN if VS version < 16.10
4383     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4384     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4385         #if _MSC_VER < 1929
4386         #error
4387         #endif
4388     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4390     if test $vs2019_recommended_version = yes; then
4391         AC_MSG_RESULT([yes])
4392     else
4393         AC_MSG_WARN([no])
4394         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."
4395     fi
4397     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4398     # version of the Explorer extension (and maybe other small
4399     # bits, too) needed when installing a 32-bit LibreOffice on a
4400     # 64-bit OS. The 64-bit Explorer extension is a feature that
4401     # has been present since long in OOo. Don't confuse it with
4402     # building LibreOffice itself as 64-bit code.
4404     BUILD_X64=
4405     CXX_X64_BINARY=
4407     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4408         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4409         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4410              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4411         then
4412             BUILD_X64=TRUE
4413             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4414             AC_MSG_RESULT([found])
4415         else
4416             AC_MSG_RESULT([not found])
4417             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4418         fi
4419     elif test "$WIN_HOST_ARCH" = "x64"; then
4420         CXX_X64_BINARY=$CXX
4421     fi
4422     AC_SUBST(BUILD_X64)
4424     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4425     AC_SUBST(CXX_X64_BINARY)
4427     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4428     # needed to support TWAIN scan on both 32- and 64-bit systems
4430     case "$WIN_HOST_ARCH" in
4431     x64)
4432         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4433         if test -n "$CXX_X86_BINARY"; then
4434             BUILD_X86=TRUE
4435             AC_MSG_RESULT([preset])
4436         elif test -n "$WIN_MULTI_ARCH"; then
4437             BUILD_X86=TRUE
4438             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4439             AC_MSG_RESULT([found])
4440         else
4441             AC_MSG_RESULT([not found])
4442             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4443         fi
4444         ;;
4445     x86)
4446         BUILD_X86=TRUE
4447         CXX_X86_BINARY=$MSVC_CXX
4448         ;;
4449     esac
4450     AC_SUBST(BUILD_X86)
4451     AC_SUBST(CXX_X86_BINARY)
4453 AC_SUBST(VCVER)
4454 AC_SUBST(VCTOOLSET)
4455 AC_SUBST(DEVENV)
4456 AC_SUBST(MSVC_CXX)
4458 COM_IS_CLANG=
4459 AC_MSG_CHECKING([whether the compiler is actually Clang])
4460 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4461     #ifndef __clang__
4462     you lose
4463     #endif
4464     int foo=42;
4465     ]])],
4466     [AC_MSG_RESULT([yes])
4467      COM_IS_CLANG=TRUE],
4468     [AC_MSG_RESULT([no])])
4469 AC_SUBST(COM_IS_CLANG)
4471 CLANGVER=
4472 if test "$COM_IS_CLANG" = TRUE; then
4473     AC_MSG_CHECKING([whether Clang is new enough])
4474     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4475         #if !defined __apple_build_version__
4476         #error
4477         #endif
4478         ]])],
4479         [my_apple_clang=yes],[my_apple_clang=])
4480     if test "$my_apple_clang" = yes; then
4481         AC_MSG_RESULT([assumed yes (Apple Clang)])
4482     elif test "$_os" = Emscripten; then
4483         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4484     else
4485         if test "$_os" = WINNT; then
4486             dnl In which case, assume clang-cl:
4487             my_args="/EP /TC"
4488         else
4489             my_args="-E -P"
4490         fi
4491         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4492         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4493         CLANGVER=`echo $clang_version \
4494             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4495         if test "$CLANGVER" -ge 120000; then
4496             AC_MSG_RESULT([yes ($clang_version)])
4497         else
4498             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4499         fi
4500         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4501         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4502     fi
4505 SHOWINCLUDES_PREFIX=
4506 if test "$_os" = WINNT; then
4507     dnl We need to guess the prefix of the -showIncludes output, it can be
4508     dnl localized
4509     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4510     echo "#include <stdlib.h>" > conftest.c
4511     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4512         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4513     rm -f conftest.c conftest.obj
4514     if test -z "$SHOWINCLUDES_PREFIX"; then
4515         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4516     else
4517         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4518     fi
4520 AC_SUBST(SHOWINCLUDES_PREFIX)
4523 # prefix C with ccache if needed
4525 if test "$CCACHE" != ""; then
4526     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4528     AC_LANG_PUSH([C])
4529     save_CFLAGS=$CFLAGS
4530     CFLAGS="$CFLAGS --ccache-skip -O2"
4531     # msvc does not fail on unknown options, check stdout
4532     if test "$COM" = MSC; then
4533         CFLAGS="$CFLAGS -nologo"
4534     fi
4535     save_ac_c_werror_flag=$ac_c_werror_flag
4536     ac_c_werror_flag=yes
4537     dnl an empty program will do, we're checking the compiler flags
4538     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4539                       [use_ccache=yes], [use_ccache=no])
4540     CFLAGS=$save_CFLAGS
4541     ac_c_werror_flag=$save_ac_c_werror_flag
4542     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4543         AC_MSG_RESULT([yes])
4544     else
4545         CC="$CCACHE $CC"
4546         CC_BASE="ccache $CC_BASE"
4547         AC_MSG_RESULT([no])
4548     fi
4549     AC_LANG_POP([C])
4552 # ===================================================================
4553 # check various GCC options that Clang does not support now but maybe
4554 # will somewhen in the future, check them even for GCC, so that the
4555 # flags are set
4556 # ===================================================================
4558 HAVE_GCC_GGDB2=
4559 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4560     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4561     save_CFLAGS=$CFLAGS
4562     CFLAGS="$CFLAGS -Werror -ggdb2"
4563     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4564     CFLAGS=$save_CFLAGS
4565     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4566         AC_MSG_RESULT([yes])
4567     else
4568         AC_MSG_RESULT([no])
4569     fi
4571     if test "$host_cpu" = "m68k"; then
4572         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4573         save_CFLAGS=$CFLAGS
4574         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4575         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4576         CFLAGS=$save_CFLAGS
4577         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4578             AC_MSG_RESULT([yes])
4579         else
4580             AC_MSG_ERROR([no])
4581         fi
4582     fi
4584 AC_SUBST(HAVE_GCC_GGDB2)
4586 dnl ===================================================================
4587 dnl  Test the gcc version
4588 dnl ===================================================================
4589 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4590     AC_MSG_CHECKING([the GCC version])
4591     _gcc_version=`$CC -dumpfullversion`
4592     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4593         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4594     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4596     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4598     if test "$gcc_full_version" -lt 120000; then
4599         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4600     fi
4601 else
4602     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4603     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4604     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4605     # (which reports itself as GCC 4.2.1).
4606     GCC_VERSION=
4608 AC_SUBST(GCC_VERSION)
4610 dnl Set the ENABLE_DBGUTIL variable
4611 dnl ===================================================================
4612 AC_MSG_CHECKING([whether to build with additional debug utilities])
4613 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4614     ENABLE_DBGUTIL="TRUE"
4615     # this is an extra var so it can have different default on different MSVC
4616     # versions (in case there are version specific problems with it)
4617     MSVC_USE_DEBUG_RUNTIME="TRUE"
4619     AC_MSG_RESULT([yes])
4620     # cppunit and graphite expose STL in public headers
4621     if test "$with_system_cppunit" = "yes"; then
4622         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4623     else
4624         with_system_cppunit=no
4625     fi
4626     if test "$with_system_graphite" = "yes"; then
4627         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4628     else
4629         with_system_graphite=no
4630     fi
4631     if test "$with_system_orcus" = "yes"; then
4632         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4633     else
4634         with_system_orcus=no
4635     fi
4636     if test "$with_system_libcmis" = "yes"; then
4637         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4638     else
4639         with_system_libcmis=no
4640     fi
4641     if test "$with_system_hunspell" = "yes"; then
4642         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4643     else
4644         with_system_hunspell=no
4645     fi
4646     if test "$with_system_gpgmepp" = "yes"; then
4647         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4648     else
4649         with_system_gpgmepp=no
4650     fi
4651     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4652     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4653     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4654     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4655     # of those two is using the system variant:
4656     if test "$with_system_libnumbertext" = "yes"; then
4657         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4658     else
4659         with_system_libnumbertext=no
4660     fi
4661     if test "$with_system_libwps" = "yes"; then
4662         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4663     else
4664         with_system_libwps=no
4665     fi
4666 else
4667     ENABLE_DBGUTIL=""
4668     MSVC_USE_DEBUG_RUNTIME=""
4669     AC_MSG_RESULT([no])
4671 AC_SUBST(ENABLE_DBGUTIL)
4672 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4674 dnl Set the ENABLE_DEBUG variable.
4675 dnl ===================================================================
4676 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4677     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4679 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4680     if test -z "$libo_fuzzed_enable_debug"; then
4681         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4682     else
4683         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4684         enable_debug=yes
4685     fi
4688 AC_MSG_CHECKING([whether to do a debug build])
4689 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4690     ENABLE_DEBUG="TRUE"
4691     if test -n "$ENABLE_DBGUTIL" ; then
4692         AC_MSG_RESULT([yes (dbgutil)])
4693     else
4694         AC_MSG_RESULT([yes])
4695     fi
4696 else
4697     ENABLE_DEBUG=""
4698     AC_MSG_RESULT([no])
4700 AC_SUBST(ENABLE_DEBUG)
4702 dnl ===================================================================
4703 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4704 dnl This is done only after compiler checks (need to know if Clang is
4705 dnl used, for different defaults) and after checking if a debug build
4706 dnl is wanted (non-debug builds get the default linker if not explicitly
4707 dnl specified otherwise).
4708 dnl All checks for linker features/options should come after this.
4709 dnl ===================================================================
4710 check_use_ld()
4712     use_ld=-fuse-ld=${1%%:*}
4713     use_ld_path=${1#*:}
4714     if test "$use_ld_path" != "$1"; then
4715         if test "$COM_IS_CLANG" = TRUE; then
4716             if test "$CLANGVER" -ge 120000; then
4717                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4718             else
4719                 use_ld="-fuse-ld=${use_ld_path}"
4720             fi
4721         else
4722             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4723             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4724             # pickup the alternative linker, when called by libtool for linking.
4725             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4726             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4727         fi
4728     fi
4729     use_ld_fail_if_error=$2
4730     use_ld_ok=
4731     AC_MSG_CHECKING([for $use_ld linker support])
4732     use_ld_ldflags_save="$LDFLAGS"
4733     LDFLAGS="$LDFLAGS $use_ld"
4734     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4735 #include <stdio.h>
4736         ],[
4737 printf ("hello world\n");
4738         ])], USE_LD=$use_ld, [])
4739     if test -n "$USE_LD"; then
4740         AC_MSG_RESULT( yes )
4741         use_ld_ok=yes
4742     else
4743         if test -n "$use_ld_fail_if_error"; then
4744             AC_MSG_ERROR( no )
4745         else
4746             AC_MSG_RESULT( no )
4747         fi
4748     fi
4749     if test -n "$use_ld_ok"; then
4750         dnl keep the value of LDFLAGS
4751         return 0
4752     fi
4753     LDFLAGS="$use_ld_ldflags_save"
4754     return 1
4756 USE_LD=
4757 if test "$enable_ld" != "no"; then
4758     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4759         if test -n "$enable_ld"; then
4760             check_use_ld "$enable_ld" fail_if_error
4761         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4762             dnl non-debug builds default to the default linker
4763             true
4764         elif test -n "$COM_IS_CLANG"; then
4765             check_use_ld lld
4766             if test $? -ne 0; then
4767                 check_use_ld gold
4768                 if test $? -ne 0; then
4769                     check_use_ld mold
4770                 fi
4771             fi
4772         else
4773             # For gcc first try gold, new versions also support lld/mold.
4774             check_use_ld gold
4775             if test $? -ne 0; then
4776                 check_use_ld lld
4777                 if test $? -ne 0; then
4778                     check_use_ld mold
4779                 fi
4780             fi
4781         fi
4782         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4783         rm conftest.out
4784         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4785         if test -z "$ld_used"; then
4786             ld_used="unknown"
4787         fi
4788         AC_MSG_CHECKING([for linker that is used])
4789         AC_MSG_RESULT([$ld_used])
4790         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4791             if echo "$ld_used" | grep -q "^GNU ld"; then
4792                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4793                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4794             fi
4795         fi
4796     else
4797         if test "$enable_ld" = "yes"; then
4798             AC_MSG_ERROR([--enable-ld not supported])
4799         fi
4800     fi
4802 AC_SUBST(USE_LD)
4803 AC_SUBST(LD)
4805 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4806 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4807     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4808     bsymbolic_functions_ldflags_save=$LDFLAGS
4809     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4810     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4811 #include <stdio.h>
4812         ],[
4813 printf ("hello world\n");
4814         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4815     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4816         AC_MSG_RESULT( found )
4817     else
4818         AC_MSG_RESULT( not found )
4819     fi
4820     LDFLAGS=$bsymbolic_functions_ldflags_save
4822 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4824 LD_GC_SECTIONS=
4825 if test "$GCC" = "yes"; then
4826     for flag in "--gc-sections" "-dead_strip"; do
4827         AC_MSG_CHECKING([for $flag linker support])
4828         ldflags_save=$LDFLAGS
4829         LDFLAGS="$LDFLAGS -Wl,$flag"
4830         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4831 #include <stdio.h>
4832             ],[
4833 printf ("hello world\n");
4834             ])],[
4835             LD_GC_SECTIONS="-Wl,$flag"
4836             AC_MSG_RESULT( found )
4837             ], [
4838             AC_MSG_RESULT( not found )
4839             ])
4840         LDFLAGS=$ldflags_save
4841         if test -n "$LD_GC_SECTIONS"; then
4842             break
4843         fi
4844     done
4846 AC_SUBST(LD_GC_SECTIONS)
4848 HAVE_EXTERNAL_DWARF=
4849 if test "$enable_split_debug" != no; then
4850     use_split_debug=
4851     if test -n "$ENABLE_LTO"; then
4852         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4853     elif test "$enable_split_debug" = yes; then
4854         use_split_debug=1
4855     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4856     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4857         use_split_debug=1
4858     fi
4859     if test -n "$use_split_debug"; then
4860         if test "$_os" = "Emscripten"; then
4861             TEST_CC_FLAG=-gseparate-dwarf
4862         else
4863             TEST_CC_FLAG=-gsplit-dwarf
4864         fi
4865         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4866         save_CFLAGS=$CFLAGS
4867         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4868         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4869         CFLAGS=$save_CFLAGS
4870         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4871             AC_MSG_RESULT([yes])
4872         else
4873             if test "$enable_split_debug" = yes; then
4874                 AC_MSG_ERROR([no])
4875             else
4876                 AC_MSG_RESULT([no])
4877             fi
4878         fi
4879     fi
4880     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4881         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4882         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4883     fi
4885 AC_SUBST(HAVE_EXTERNAL_DWARF)
4887 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4888 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4889 save_CFLAGS=$CFLAGS
4890 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4891 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4892 CFLAGS=$save_CFLAGS
4893 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4894     AC_MSG_RESULT([yes])
4895 else
4896     AC_MSG_RESULT([no])
4898 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4900 ENABLE_GDB_INDEX=
4901 if test "$enable_gdb_index" != "no"; then
4902     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4903     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4904         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4905         save_CFLAGS=$CFLAGS
4906         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
4907         have_ggnu_pubnames=
4908         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4909         if test "$have_ggnu_pubnames" != "TRUE"; then
4910             if test "$enable_gdb_index" = "yes"; then
4911                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4912             else
4913                 AC_MSG_RESULT( no )
4914             fi
4915         else
4916             AC_MSG_RESULT( yes )
4917             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4918             ldflags_save=$LDFLAGS
4919             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4920             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4921 #include <stdio.h>
4922                 ],[
4923 printf ("hello world\n");
4924                 ])], ENABLE_GDB_INDEX=TRUE, [])
4925             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4926                 AC_MSG_RESULT( yes )
4927             else
4928                 if test "$enable_gdb_index" = "yes"; then
4929                     AC_MSG_ERROR( no )
4930                 else
4931                     AC_MSG_RESULT( no )
4932                 fi
4933             fi
4934             LDFLAGS=$ldflags_save
4935         fi
4936         CFLAGS=$save_CFLAGS
4937         fi
4938     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4939         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4940         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4941     fi
4943 AC_SUBST(ENABLE_GDB_INDEX)
4945 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4946     enable_sal_log=yes
4948 if test "$enable_sal_log" = yes; then
4949     ENABLE_SAL_LOG=TRUE
4951 AC_SUBST(ENABLE_SAL_LOG)
4953 dnl Check for enable symbols option
4954 dnl ===================================================================
4955 AC_MSG_CHECKING([whether to generate debug information])
4956 if test -z "$enable_symbols"; then
4957     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4958         enable_symbols=yes
4959     else
4960         enable_symbols=no
4961     fi
4963 if test "$enable_symbols" = yes; then
4964     ENABLE_SYMBOLS_FOR=all
4965     AC_MSG_RESULT([yes])
4966 elif test "$enable_symbols" = no; then
4967     ENABLE_SYMBOLS_FOR=
4968     AC_MSG_RESULT([no])
4969 else
4970     # Selective debuginfo.
4971     ENABLE_SYMBOLS_FOR="$enable_symbols"
4972     AC_MSG_RESULT([for "$enable_symbols"])
4974 AC_SUBST(ENABLE_SYMBOLS_FOR)
4976 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4977     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4978     AC_MSG_CHECKING([whether enough memory is available for linking])
4979     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4980     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4981     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4982         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4983     else
4984         AC_MSG_RESULT([yes])
4985     fi
4988 ENABLE_OPTIMIZED=
4989 ENABLE_OPTIMIZED_DEBUG=
4990 AC_MSG_CHECKING([whether to compile with optimization flags])
4991 if test -z "$enable_optimized"; then
4992     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4993         enable_optimized=no
4994     else
4995         enable_optimized=yes
4996     fi
4998 if test "$enable_optimized" = yes; then
4999     ENABLE_OPTIMIZED=TRUE
5000     AC_MSG_RESULT([yes])
5001 elif test "$enable_optimized" = debug; then
5002     ENABLE_OPTIMIZED_DEBUG=TRUE
5003     AC_MSG_RESULT([yes (debug)])
5004     HAVE_GCC_OG=
5005     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5006         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5007         save_CFLAGS=$CFLAGS
5008         CFLAGS="$CFLAGS -Werror -Og"
5009         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5010         CFLAGS=$save_CFLAGS
5011         if test "$HAVE_GCC_OG" = "TRUE"; then
5012             AC_MSG_RESULT([yes])
5013         else
5014             AC_MSG_RESULT([no])
5015         fi
5016     fi
5017     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5018         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5019     fi
5020 else
5021     AC_MSG_RESULT([no])
5023 AC_SUBST(ENABLE_OPTIMIZED)
5024 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5027 # determine CPUNAME, OS, ...
5029 case "$host_os" in
5031 cygwin*|wsl*)
5032     # Already handled
5033     ;;
5035 darwin*)
5036     COM=GCC
5037     OS=MACOSX
5038     RTL_OS=MacOSX
5039     P_SEP=:
5041     case "$host_cpu" in
5042     aarch64|arm64)
5043         if test "$enable_ios_simulator" = "yes"; then
5044             OS=iOS
5045         else
5046             CPUNAME=AARCH64
5047             RTL_ARCH=AARCH64
5048             PLATFORMID=macosx_aarch64
5049         fi
5050         ;;
5051     x86_64)
5052         if test "$enable_ios_simulator" = "yes"; then
5053             OS=iOS
5054         fi
5055         CPUNAME=X86_64
5056         RTL_ARCH=X86_64
5057         PLATFORMID=macosx_x86_64
5058         ;;
5059     *)
5060         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5061         ;;
5062     esac
5063     ;;
5065 ios*)
5066     COM=GCC
5067     OS=iOS
5068     RTL_OS=iOS
5069     P_SEP=:
5071     case "$host_cpu" in
5072     aarch64|arm64)
5073         if test "$enable_ios_simulator" = "yes"; then
5074             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5075         fi
5076         ;;
5077     *)
5078         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5079         ;;
5080     esac
5081     CPUNAME=AARCH64
5082     RTL_ARCH=AARCH64
5083     PLATFORMID=ios_arm64
5084     ;;
5086 dragonfly*)
5087     COM=GCC
5088     OS=DRAGONFLY
5089     RTL_OS=DragonFly
5090     P_SEP=:
5092     case "$host_cpu" in
5093     i*86)
5094         CPUNAME=INTEL
5095         RTL_ARCH=x86
5096         PLATFORMID=dragonfly_x86
5097         ;;
5098     x86_64)
5099         CPUNAME=X86_64
5100         RTL_ARCH=X86_64
5101         PLATFORMID=dragonfly_x86_64
5102         ;;
5103     *)
5104         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5105         ;;
5106     esac
5107     ;;
5109 freebsd*)
5110     COM=GCC
5111     RTL_OS=FreeBSD
5112     OS=FREEBSD
5113     P_SEP=:
5115     case "$host_cpu" in
5116     aarch64)
5117         CPUNAME=AARCH64
5118         PLATFORMID=freebsd_aarch64
5119         RTL_ARCH=AARCH64
5120         ;;
5121     i*86)
5122         CPUNAME=INTEL
5123         RTL_ARCH=x86
5124         PLATFORMID=freebsd_x86
5125         ;;
5126     x86_64|amd64)
5127         CPUNAME=X86_64
5128         RTL_ARCH=X86_64
5129         PLATFORMID=freebsd_x86_64
5130         ;;
5131     powerpc64)
5132         CPUNAME=POWERPC64
5133         RTL_ARCH=PowerPC_64
5134         PLATFORMID=freebsd_powerpc64
5135         ;;
5136     powerpc|powerpcspe)
5137         CPUNAME=POWERPC
5138         RTL_ARCH=PowerPC
5139         PLATFORMID=freebsd_powerpc
5140         ;;
5141     *)
5142         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5143         ;;
5144     esac
5145     ;;
5147 haiku*)
5148     COM=GCC
5149     GUIBASE=haiku
5150     RTL_OS=Haiku
5151     OS=HAIKU
5152     P_SEP=:
5154     case "$host_cpu" in
5155     i*86)
5156         CPUNAME=INTEL
5157         RTL_ARCH=x86
5158         PLATFORMID=haiku_x86
5159         ;;
5160     x86_64|amd64)
5161         CPUNAME=X86_64
5162         RTL_ARCH=X86_64
5163         PLATFORMID=haiku_x86_64
5164         ;;
5165     *)
5166         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5167         ;;
5168     esac
5169     ;;
5171 kfreebsd*)
5172     COM=GCC
5173     OS=LINUX
5174     RTL_OS=kFreeBSD
5175     P_SEP=:
5177     case "$host_cpu" in
5179     i*86)
5180         CPUNAME=INTEL
5181         RTL_ARCH=x86
5182         PLATFORMID=kfreebsd_x86
5183         ;;
5184     x86_64)
5185         CPUNAME=X86_64
5186         RTL_ARCH=X86_64
5187         PLATFORMID=kfreebsd_x86_64
5188         ;;
5189     *)
5190         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5191         ;;
5192     esac
5193     ;;
5195 linux-gnu*|linux-musl*)
5196     COM=GCC
5197     OS=LINUX
5198     RTL_OS=Linux
5199     P_SEP=:
5201     case "$host_cpu" in
5203     aarch64)
5204         CPUNAME=AARCH64
5205         PLATFORMID=linux_aarch64
5206         RTL_ARCH=AARCH64
5207         EPM_FLAGS="-a arm64"
5208         ;;
5209     alpha)
5210         CPUNAME=AXP
5211         RTL_ARCH=ALPHA
5212         PLATFORMID=linux_alpha
5213         ;;
5214     arm*)
5215         CPUNAME=ARM
5216         EPM_FLAGS="-a arm"
5217         RTL_ARCH=ARM_EABI
5218         PLATFORMID=linux_arm_eabi
5219         case "$host_cpu" in
5220         arm*-linux)
5221             RTL_ARCH=ARM_OABI
5222             PLATFORMID=linux_arm_oabi
5223             ;;
5224         esac
5225         ;;
5226     hppa)
5227         CPUNAME=HPPA
5228         RTL_ARCH=HPPA
5229         EPM_FLAGS="-a hppa"
5230         PLATFORMID=linux_hppa
5231         ;;
5232     i*86)
5233         CPUNAME=INTEL
5234         RTL_ARCH=x86
5235         PLATFORMID=linux_x86
5236         ;;
5237     ia64)
5238         CPUNAME=IA64
5239         RTL_ARCH=IA64
5240         PLATFORMID=linux_ia64
5241         ;;
5242     mips)
5243         CPUNAME=MIPS
5244         RTL_ARCH=MIPS_EB
5245         EPM_FLAGS="-a mips"
5246         PLATFORMID=linux_mips_eb
5247         ;;
5248     mips64)
5249         CPUNAME=MIPS64
5250         RTL_ARCH=MIPS64_EB
5251         EPM_FLAGS="-a mips64"
5252         PLATFORMID=linux_mips64_eb
5253         ;;
5254     mips64el)
5255         CPUNAME=MIPS64
5256         RTL_ARCH=MIPS64_EL
5257         EPM_FLAGS="-a mips64el"
5258         PLATFORMID=linux_mips64_el
5259         ;;
5260     mipsel)
5261         CPUNAME=MIPS
5262         RTL_ARCH=MIPS_EL
5263         EPM_FLAGS="-a mipsel"
5264         PLATFORMID=linux_mips_el
5265         ;;
5266     riscv64)
5267         CPUNAME=RISCV64
5268         RTL_ARCH=RISCV64
5269         EPM_FLAGS="-a riscv64"
5270         PLATFORMID=linux_riscv64
5271         ;;
5272     m68k)
5273         CPUNAME=M68K
5274         RTL_ARCH=M68K
5275         PLATFORMID=linux_m68k
5276         ;;
5277     powerpc)
5278         CPUNAME=POWERPC
5279         RTL_ARCH=PowerPC
5280         PLATFORMID=linux_powerpc
5281         ;;
5282     powerpc64)
5283         CPUNAME=POWERPC64
5284         RTL_ARCH=PowerPC_64
5285         PLATFORMID=linux_powerpc64
5286         ;;
5287     powerpc64le)
5288         CPUNAME=POWERPC64
5289         RTL_ARCH=PowerPC_64_LE
5290         PLATFORMID=linux_powerpc64_le
5291         ;;
5292     sparc)
5293         CPUNAME=SPARC
5294         RTL_ARCH=SPARC
5295         PLATFORMID=linux_sparc
5296         ;;
5297     sparc64)
5298         CPUNAME=SPARC64
5299         RTL_ARCH=SPARC64
5300         PLATFORMID=linux_sparc64
5301         ;;
5302     s390x)
5303         CPUNAME=S390X
5304         RTL_ARCH=S390x
5305         PLATFORMID=linux_s390x
5306         ;;
5307     x86_64)
5308         CPUNAME=X86_64
5309         RTL_ARCH=X86_64
5310         PLATFORMID=linux_x86_64
5311         ;;
5312     loongarch64)
5313         CPUNAME=LOONGARCH64
5314         RTL_ARCH=LOONGARCH64
5315         PLATFORMID=linux_loongarch64
5316         ;;
5317     *)
5318         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5319         ;;
5320     esac
5321     ;;
5323 linux-android*)
5324     COM=GCC
5325     OS=ANDROID
5326     RTL_OS=Android
5327     P_SEP=:
5329     case "$host_cpu" in
5331     arm|armel)
5332         CPUNAME=ARM
5333         RTL_ARCH=ARM_EABI
5334         PLATFORMID=android_arm_eabi
5335         ;;
5336     aarch64)
5337         CPUNAME=AARCH64
5338         RTL_ARCH=AARCH64
5339         PLATFORMID=android_aarch64
5340         ;;
5341     i*86)
5342         CPUNAME=INTEL
5343         RTL_ARCH=x86
5344         PLATFORMID=android_x86
5345         ;;
5346     x86_64)
5347         CPUNAME=X86_64
5348         RTL_ARCH=X86_64
5349         PLATFORMID=android_x86_64
5350         ;;
5351     *)
5352         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5353         ;;
5354     esac
5355     ;;
5357 *netbsd*)
5358     COM=GCC
5359     OS=NETBSD
5360     RTL_OS=NetBSD
5361     P_SEP=:
5363     case "$host_cpu" in
5364     i*86)
5365         CPUNAME=INTEL
5366         RTL_ARCH=x86
5367         PLATFORMID=netbsd_x86
5368         ;;
5369     powerpc)
5370         CPUNAME=POWERPC
5371         RTL_ARCH=PowerPC
5372         PLATFORMID=netbsd_powerpc
5373         ;;
5374     sparc)
5375         CPUNAME=SPARC
5376         RTL_ARCH=SPARC
5377         PLATFORMID=netbsd_sparc
5378         ;;
5379     x86_64)
5380         CPUNAME=X86_64
5381         RTL_ARCH=X86_64
5382         PLATFORMID=netbsd_x86_64
5383         ;;
5384     *)
5385         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5386         ;;
5387     esac
5388     ;;
5390 openbsd*)
5391     COM=GCC
5392     OS=OPENBSD
5393     RTL_OS=OpenBSD
5394     P_SEP=:
5396     case "$host_cpu" in
5397     i*86)
5398         CPUNAME=INTEL
5399         RTL_ARCH=x86
5400         PLATFORMID=openbsd_x86
5401         ;;
5402     x86_64)
5403         CPUNAME=X86_64
5404         RTL_ARCH=X86_64
5405         PLATFORMID=openbsd_x86_64
5406         ;;
5407     *)
5408         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5409         ;;
5410     esac
5411     SOLARINC="$SOLARINC -I/usr/local/include"
5412     ;;
5414 solaris*)
5415     COM=GCC
5416     OS=SOLARIS
5417     RTL_OS=Solaris
5418     P_SEP=:
5420     case "$host_cpu" in
5421     i*86)
5422         CPUNAME=INTEL
5423         RTL_ARCH=x86
5424         PLATFORMID=solaris_x86
5425         ;;
5426     sparc)
5427         CPUNAME=SPARC
5428         RTL_ARCH=SPARC
5429         PLATFORMID=solaris_sparc
5430         ;;
5431     sparc64)
5432         CPUNAME=SPARC64
5433         RTL_ARCH=SPARC64
5434         PLATFORMID=solaris_sparc64
5435         ;;
5436     *)
5437         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5438         ;;
5439     esac
5440     SOLARINC="$SOLARINC -I/usr/local/include"
5441     ;;
5443 emscripten*)
5444     COM=GCC
5445     OS=EMSCRIPTEN
5446     RTL_OS=Emscripten
5447     P_SEP=:
5449     case "$host_cpu" in
5450     wasm32|wasm64)
5451         ;;
5452     *)
5453         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5454         ;;
5455     esac
5456     CPUNAME=INTEL
5457     RTL_ARCH=x86
5458     PLATFORMID=linux_x86
5459     ;;
5462     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5463     ;;
5464 esac
5466 DISABLE_GUI=""
5467 if test "$enable_gui" = "no"; then
5468     if test "$using_x11" != yes; then
5469         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5470     fi
5471     USING_X11=
5472     DISABLE_GUI=TRUE
5473     test_epoxy=no
5474 else
5475     AC_DEFINE(HAVE_FEATURE_UI)
5477 AC_SUBST(DISABLE_GUI)
5479 if test "$with_x" = "no"; then
5480     USING_X11=
5483 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5484     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5487 if test "$using_x11" = yes; then
5488     if test "$USING_X11" = TRUE; then
5489         AC_DEFINE(USING_X11)
5490     else
5491         disable_x11_tests
5492         if test "$DISABLE_DYNLOADING" = TRUE; then
5493             test_qt5=yes
5494         fi
5495     fi
5496 else
5497     if test "$USING_X11" = TRUE; then
5498         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5499     fi
5502 WORKDIR="${BUILDDIR}/workdir"
5503 INSTDIR="${BUILDDIR}/instdir"
5504 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5505 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5506 AC_SUBST(COM)
5507 AC_SUBST(CPUNAME)
5508 AC_SUBST(RTL_OS)
5509 AC_SUBST(RTL_ARCH)
5510 AC_SUBST(EPM_FLAGS)
5511 AC_SUBST(USING_X11)
5512 AC_SUBST([INSTDIR])
5513 AC_SUBST([INSTROOT])
5514 AC_SUBST([INSTROOTBASE])
5515 AC_SUBST(OS)
5516 AC_SUBST(P_SEP)
5517 AC_SUBST(WORKDIR)
5518 AC_SUBST(PLATFORMID)
5519 AC_SUBST(WINDOWS_X64)
5520 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5521 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5523 if test "$OS" = WNT -a "$COM" = MSC; then
5524     case "$CPUNAME" in
5525     INTEL) CPPU_ENV=msci ;;
5526     X86_64) CPPU_ENV=mscx ;;
5527     AARCH64) CPPU_ENV=msca ;;
5528     *)
5529         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5530         ;;
5531     esac
5532 else
5533     CPPU_ENV=gcc3
5535 AC_SUBST(CPPU_ENV)
5537 dnl ===================================================================
5538 dnl Test which package format to use
5539 dnl ===================================================================
5540 AC_MSG_CHECKING([which package format to use])
5541 if test -n "$with_package_format" -a "$with_package_format" != no; then
5542     for i in $with_package_format; do
5543         case "$i" in
5544         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5545             ;;
5546         *)
5547             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5548 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5549 deb - Debian software distribution
5550 pkg - Solaris software distribution
5551 rpm - RedHat software distribution
5553 LibreOffice additionally supports:
5554 archive - .tar.gz or .zip
5555 dmg - macOS .dmg
5556 installed - installation tree
5557 msi - Windows .msi
5558         ])
5559             ;;
5560         esac
5561     done
5562     # fakeroot is needed to ensure correct file ownerships/permissions
5563     # inside deb packages and tar archives created on Linux and Solaris.
5564     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5565         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5566         if test "$FAKEROOT" = "no"; then
5567             AC_MSG_ERROR(
5568                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5569         fi
5570     fi
5571     PKGFORMAT="$with_package_format"
5572     AC_MSG_RESULT([$PKGFORMAT])
5573 else
5574     PKGFORMAT=
5575     AC_MSG_RESULT([none])
5577 AC_SUBST(PKGFORMAT)
5579 dnl ===================================================================
5580 dnl handle help related options
5582 dnl If you change help related options, please update README.help
5583 dnl ===================================================================
5585 ENABLE_HTMLHELP=
5586 HELP_OMINDEX_PAGE=
5587 HELP_ONLINE=
5588 WITH_HELPPACKS=
5590 AC_MSG_CHECKING([which help to build])
5591 if test -n "$with_help" -a "$with_help" != "no"; then
5592     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5593     BUILD_TYPE="$BUILD_TYPE HELP"
5594     case "$with_help" in
5595     "html")
5596         ENABLE_HTMLHELP=TRUE
5597         WITH_HELPPACKS=TRUE
5598         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5599         AC_MSG_RESULT([HTML (local)])
5600         ;;
5601     "online")
5602         ENABLE_HTMLHELP=TRUE
5603         HELP_ONLINE=TRUE
5604         AC_MSG_RESULT([HTML (online)])
5605         ;;
5606     yes)
5607         WITH_HELPPACKS=TRUE
5608         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5609         AC_MSG_RESULT([XML (local)])
5610         ;;
5611     *)
5612         AC_MSG_ERROR([Unknown --with-help=$with_help])
5613         ;;
5614     esac
5615 else
5616     AC_MSG_RESULT([no])
5619 AC_MSG_CHECKING([if we need to build the help index tooling])
5620 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5621     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5622     test_clucene=yes
5623     AC_MSG_RESULT([yes])
5624 else
5625     AC_MSG_RESULT([no])
5628 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5629 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5630     if test "$HELP_ONLINE" != TRUE; then
5631         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5632     fi
5633     case "$with_omindex" in
5634     "server")
5635         HELP_OMINDEX_PAGE=TRUE
5636         AC_MSG_RESULT([SERVER])
5637         ;;
5638     "noxap")
5639         AC_MSG_RESULT([NOXAP])
5640         ;;
5641     *)
5642         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5643         ;;
5644     esac
5645 else
5646     AC_MSG_RESULT([no])
5649 AC_MSG_CHECKING([whether to include the XML-help support])
5650 if test "$enable_xmlhelp" = yes; then
5651     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5652     test_clucene=yes
5653     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5654     AC_MSG_RESULT([yes])
5655 else
5656     if test "$with_help" = yes; then
5657         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5658     fi
5659     AC_MSG_RESULT([no])
5662 dnl Test whether to integrate helppacks into the product's installer
5663 AC_MSG_CHECKING([for helppack integration])
5664 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5665     AC_MSG_RESULT([no integration])
5666 else
5667     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5668     AC_MSG_RESULT([integration])
5671 AC_SUBST([ENABLE_HTMLHELP])
5672 AC_SUBST([HELP_OMINDEX_PAGE])
5673 AC_SUBST([HELP_ONLINE])
5674 # WITH_HELPPACKS is used only in configure
5676 dnl ===================================================================
5677 dnl Set up a different compiler to produce tools to run on the build
5678 dnl machine when doing cross-compilation
5679 dnl ===================================================================
5681 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5682 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5683 if test "$cross_compiling" = "yes"; then
5684     AC_MSG_CHECKING([for BUILD platform configuration])
5685     echo
5686     rm -rf CONF-FOR-BUILD config_build.mk
5687     mkdir CONF-FOR-BUILD
5688     # Here must be listed all files needed when running the configure script. In particular, also
5689     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5690     # keep them in the same order as there.
5691     (cd $SRC_ROOT && tar cf - \
5692         config.guess \
5693         bin/get_config_variables \
5694         solenv/bin/getcompver.awk \
5695         solenv/inc/langlist.mk \
5696         download.lst \
5697         config_host.mk.in \
5698         config_host_lang.mk.in \
5699         Makefile.in \
5700         lo.xcent.in \
5701         bin/bffvalidator.sh.in \
5702         bin/odfvalidator.sh.in \
5703         bin/officeotron.sh.in \
5704         hardened_runtime.xcent.in \
5705         instsetoo_native/util/openoffice.lst.in \
5706         config_host/*.in \
5707         sysui/desktop/macosx/Info.plist.in \
5708         .vscode/vs-code-template.code-workspace.in \
5709         solenv/lockfile/autoconf.h.in \
5710         ) \
5711     | (cd CONF-FOR-BUILD && tar xf -)
5712     cp configure CONF-FOR-BUILD
5713     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5714     (
5715     unset COM USING_X11 OS CPUNAME
5716     unset CC CXX SYSBASE CFLAGS
5717     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5718     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5719     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5720     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5721     if test -n "$CC_FOR_BUILD"; then
5722         export CC="$CC_FOR_BUILD"
5723         CC_BASE=`first_arg_basename "$CC"`
5724     fi
5725     if test -n "$CXX_FOR_BUILD"; then
5726         export CXX="$CXX_FOR_BUILD"
5727         CXX_BASE=`first_arg_basename "$CXX"`
5728     fi
5729     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5730     cd CONF-FOR-BUILD
5732     # Handle host configuration, which affects the cross-toolset too
5733     sub_conf_opts=""
5734     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5735     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5736     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5737     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5738     if test -n "$ENABLE_JAVA"; then
5739         case "$_os" in
5740         Android)
5741             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5742             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5743             ;;
5744         *)
5745             if test -z "$with_jdk_home"; then
5746                 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.])
5747             fi
5748             ;;
5749         esac
5750     else
5751         sub_conf_opts="$sub_conf_opts --without-java"
5752     fi
5753     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5754     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5755     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5756     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5757     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5758     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5759     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5760     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5761     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5762     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5763     if test "$_os" = "Emscripten"; then
5764         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5765         if test "${with_main_module+set}" = set; then
5766             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5767         else
5768             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5769         fi
5770     fi
5771     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5772     # when cross-compiling for aarch64, overriding the defaults below
5773     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5775     # Don't bother having configure look for stuff not needed for the build platform anyway
5776     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5777     sub_conf_defaults=" \
5778         --build="$build_alias" \
5779         --disable-cairo-canvas \
5780         --disable-cups \
5781         --disable-customtarget-components \
5782         --disable-firebird-sdbc \
5783         --disable-gpgmepp \
5784         --disable-gstreamer-1-0 \
5785         --disable-gtk3 \
5786         --disable-gtk4 \
5787         --disable-libcmis \
5788         --disable-mariadb-sdbc \
5789         --disable-nss \
5790         --disable-online-update \
5791         --disable-opencl \
5792         --disable-openssl \
5793         --disable-pdfimport \
5794         --disable-postgresql-sdbc \
5795         --disable-skia \
5796         --disable-xmlhelp \
5797         --enable-dynamic-loading \
5798         --enable-icecream="$enable_icecream" \
5799         --without-doxygen \
5800         --without-tls \
5801         --without-webdav \
5802         --without-x \
5804     # single quotes added for better readability in case of spaces
5805     echo "    Running CONF-FOR-BUILD/configure" \
5806         $sub_conf_defaults \
5807         --with-parallelism="'$with_parallelism'" \
5808         --with-theme="'$with_theme'" \
5809         --with-vendor="'$with_vendor'" \
5810         $sub_conf_opts \
5811         $with_build_platform_configure_options \
5812         --srcdir=$srcdir
5814     ./configure \
5815         $sub_conf_defaults \
5816         --with-parallelism="$with_parallelism" \
5817         --with-theme="$with_theme" \
5818         "--with-vendor=$with_vendor" \
5819         $sub_conf_opts \
5820         $with_build_platform_configure_options \
5821         --srcdir=$srcdir \
5822         2>&1 | sed -e 's/^/    /'
5823     if test [${PIPESTATUS[0]}] -ne 0; then
5824         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5825     fi
5827     # filter permitted build targets
5828     PERMITTED_BUILD_TARGETS="
5829         AVMEDIA
5830         BOOST
5831         BZIP2
5832         CAIRO
5833         CLUCENE
5834         CURL
5835         DBCONNECTIVITY
5836         DESKTOP
5837         DRAGONBOX
5838         DYNLOADING
5839         EPOXY
5840         EXPAT
5841         FROZEN
5842         GLM
5843         GRAPHITE
5844         HARFBUZZ
5845         HELPTOOLS
5846         ICU
5847         LCMS2
5848         LIBJPEG_TURBO
5849         LIBLANGTAG
5850         LibO
5851         LIBFFI
5852         LIBPN
5853         LIBTIFF
5854         LIBWEBP
5855         LIBXML2
5856         LIBXSLT
5857         MDDS
5858         NATIVE
5859         OPENSSL
5860         ORCUS
5861         PYTHON
5862         SCRIPTING
5863         ZLIB
5865     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5866     # newlined lists, to use grep as a filter
5867     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5868     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5869     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5870     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5872     cp config_host.mk ../config_build.mk
5873     cp config_host_lang.mk ../config_build_lang.mk
5874     mv config.log ../config.Build.log
5875     mkdir -p ../config_build
5876     mv config_host/*.h ../config_build
5877     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5879     # all these will get a _FOR_BUILD postfix
5880     DIRECT_FOR_BUILD_SETTINGS="
5881         CC
5882         CPPU_ENV
5883         CXX
5884         ILIB
5885         JAVA_HOME
5886         JAVAIFLAGS
5887         JDK
5888         JDK_SECURITYMANAGER_DISALLOWED
5889         LIBO_BIN_FOLDER
5890         LIBO_LIB_FOLDER
5891         LIBO_URE_LIB_FOLDER
5892         LIBO_URE_MISC_FOLDER
5893         OS
5894         SDKDIRNAME
5895         SYSTEM_LIBXML
5896         SYSTEM_LIBXSLT
5898     # these overwrite host config with build config
5899     OVERWRITING_SETTINGS="
5900         ANT
5901         ANT_HOME
5902         ANT_LIB
5903         JAVA_SOURCE_VER
5904         JAVA_TARGET_VER
5905         JAVACFLAGS
5906         JAVACOMPILER
5907         JAVADOC
5908         JAVADOCISGJDOC
5909         LOCKFILE
5910         SYSTEM_GENBRK
5911         SYSTEM_GENCCODE
5912         SYSTEM_GENCMN
5914     # these need some special handling
5915     EXTRA_HANDLED_SETTINGS="
5916         INSTDIR
5917         INSTROOT
5918         PATH
5919         WORKDIR
5921     OLD_PATH=$PATH
5922     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5923     BUILD_PATH=$PATH
5924     PATH=$OLD_PATH
5926     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5927     echo "$line" >>build-config
5929     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5930         VV='$'$V
5931         VV=`eval "echo $VV"`
5932         if test -n "$VV"; then
5933             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5934             echo "$line" >>build-config
5935         fi
5936     done
5938     for V in $OVERWRITING_SETTINGS; do
5939         VV='$'$V
5940         VV=`eval "echo $VV"`
5941         if test -n "$VV"; then
5942             line=${V}='${'${V}:-$VV'}'
5943             echo "$line" >>build-config
5944         fi
5945     done
5947     for V in INSTDIR INSTROOT WORKDIR; do
5948         VV='$'$V
5949         VV=`eval "echo $VV"`
5950         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5951         if test -n "$VV"; then
5952             line="${V}_FOR_BUILD='$VV'"
5953             echo "$line" >>build-config
5954         fi
5955     done
5957     )
5958     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5959     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])
5960     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5961              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5963     eval `cat CONF-FOR-BUILD/build-config`
5965     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5967     rm -rf CONF-FOR-BUILD
5968 else
5969     OS_FOR_BUILD="$OS"
5970     CC_FOR_BUILD="$CC"
5971     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5972     CXX_FOR_BUILD="$CXX"
5973     INSTDIR_FOR_BUILD="$INSTDIR"
5974     INSTROOT_FOR_BUILD="$INSTROOT"
5975     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5976     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5977     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5978     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5979     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5980     WORKDIR_FOR_BUILD="$WORKDIR"
5982 AC_SUBST(OS_FOR_BUILD)
5983 AC_SUBST(INSTDIR_FOR_BUILD)
5984 AC_SUBST(INSTROOT_FOR_BUILD)
5985 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5986 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5987 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5988 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5989 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5990 AC_SUBST(WORKDIR_FOR_BUILD)
5991 AC_SUBST(CC_FOR_BUILD)
5992 AC_SUBST(CXX_FOR_BUILD)
5993 AC_SUBST(CPPU_ENV_FOR_BUILD)
5995 dnl ===================================================================
5996 dnl Check for lockfile deps
5997 dnl ===================================================================
5998 if test -z "$CROSS_COMPILING"; then
5999     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6000     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6001     AC_MSG_CHECKING([which lockfile binary to use])
6002     case "$with_system_lockfile" in
6003     yes)
6004         AC_MSG_RESULT([external])
6005         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6006         ;;
6007     no)
6008         AC_MSG_RESULT([internal])
6009         ;;
6010     *)
6011         if test -x "$with_system_lockfile"; then
6012             LOCKFILE="$with_system_lockfile"
6013         else
6014             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6015         fi
6016         AC_MSG_RESULT([$with_system_lockfile])
6017         ;;
6018     esac
6021 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6022     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6025 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6026 AC_CHECK_FUNCS([utime utimes])
6027 AC_SUBST(LOCKFILE)
6029 dnl ===================================================================
6030 dnl Check for syslog header
6031 dnl ===================================================================
6032 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6034 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6035 dnl ===================================================================
6036 AC_MSG_CHECKING([whether to turn warnings to errors])
6037 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6038     ENABLE_WERROR="TRUE"
6039     PYTHONWARNINGS="error"
6040     AC_MSG_RESULT([yes])
6041 else
6042     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6043         ENABLE_WERROR="TRUE"
6044         PYTHONWARNINGS="error"
6045         AC_MSG_RESULT([yes])
6046     else
6047         AC_MSG_RESULT([no])
6048     fi
6050 AC_SUBST(ENABLE_WERROR)
6051 AC_SUBST(PYTHONWARNINGS)
6053 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6054 dnl ===================================================================
6055 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6056 if test -z "$enable_assert_always_abort"; then
6057    if test "$ENABLE_DEBUG" = TRUE; then
6058        enable_assert_always_abort=yes
6059    else
6060        enable_assert_always_abort=no
6061    fi
6063 if test "$enable_assert_always_abort" = "yes"; then
6064     ASSERT_ALWAYS_ABORT="TRUE"
6065     AC_MSG_RESULT([yes])
6066 else
6067     ASSERT_ALWAYS_ABORT="FALSE"
6068     AC_MSG_RESULT([no])
6070 AC_SUBST(ASSERT_ALWAYS_ABORT)
6072 # Determine whether to use ooenv for the instdir installation
6073 # ===================================================================
6074 if test $_os != "WINNT" -a $_os != "Darwin"; then
6075     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6076     if test -z "$enable_ooenv"; then
6077         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6078             enable_ooenv=yes
6079         else
6080             enable_ooenv=no
6081         fi
6082     fi
6083     if test "$enable_ooenv" = "no"; then
6084         AC_MSG_RESULT([no])
6085     else
6086         ENABLE_OOENV="TRUE"
6087         AC_MSG_RESULT([yes])
6088     fi
6090 AC_SUBST(ENABLE_OOENV)
6092 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6093     if test "$enable_qt5" = "no"; then
6094         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6095     else
6096         enable_qt5=yes
6097     fi
6100 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6101     if test "$enable_qt6" = "no"; then
6102         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6103     else
6104         enable_qt6=yes
6105     fi
6109 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6110 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6111     AC_MSG_RESULT([yes])
6112     ENABLE_PAGEIN=TRUE
6113     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6114 else
6115     AC_MSG_RESULT([no])
6117 AC_SUBST(ENABLE_PAGEIN)
6119 dnl ===================================================================
6120 dnl check for cups support
6121 dnl ===================================================================
6123 AC_MSG_CHECKING([whether to enable CUPS support])
6124 if test "$test_cups" = yes -a "$enable_cups" != no; then
6125     ENABLE_CUPS=TRUE
6126     AC_MSG_RESULT([yes])
6128     AC_MSG_CHECKING([whether cups support is present])
6129     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6130     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6131     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6132         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6133     fi
6134 else
6135     AC_MSG_RESULT([no])
6138 AC_SUBST(ENABLE_CUPS)
6140 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6142 dnl whether to find & fetch external tarballs?
6143 dnl ===================================================================
6144 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6145    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6146        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6147    else
6148        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6149    fi
6151 if test -z "$TARFILE_LOCATION"; then
6152     if test -d "$SRC_ROOT/src" ; then
6153         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6154         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6155     fi
6156     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6157 else
6158     AbsolutePath "$TARFILE_LOCATION"
6159     PathFormat "${absolute_path}"
6160     TARFILE_LOCATION="${formatted_path_unix}"
6162 AC_SUBST(TARFILE_LOCATION)
6164 AC_MSG_CHECKING([whether we want to fetch tarballs])
6165 if test "$enable_fetch_external" != "no"; then
6166     if test "$with_all_tarballs" = "yes"; then
6167         AC_MSG_RESULT([yes, all of them])
6168         DO_FETCH_TARBALLS="ALL"
6169     else
6170         AC_MSG_RESULT([yes, if we use them])
6171         DO_FETCH_TARBALLS="TRUE"
6172     fi
6173 else
6174     AC_MSG_RESULT([no])
6175     DO_FETCH_TARBALLS=
6177 AC_SUBST(DO_FETCH_TARBALLS)
6179 dnl Test whether to include MySpell dictionaries
6180 dnl ===================================================================
6181 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6182 if test "$with_myspell_dicts" = "yes"; then
6183     AC_MSG_RESULT([yes])
6184     WITH_MYSPELL_DICTS=TRUE
6185     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6186     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6187 else
6188     AC_MSG_RESULT([no])
6189     WITH_MYSPELL_DICTS=
6191 AC_SUBST(WITH_MYSPELL_DICTS)
6193 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6194 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6195     if test "$with_system_dicts" = yes; then
6196         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6197     fi
6198     with_system_dicts=no
6201 AC_MSG_CHECKING([whether to use dicts from external paths])
6202 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6203     AC_MSG_RESULT([yes])
6204     SYSTEM_DICTS=TRUE
6205     AC_MSG_CHECKING([for spelling dictionary directory])
6206     if test -n "$with_external_dict_dir"; then
6207         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6208     else
6209         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6210         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6211             DICT_SYSTEM_DIR=file:///usr/share/myspell
6212         fi
6213     fi
6214     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6215     AC_MSG_CHECKING([for hyphenation patterns directory])
6216     if test -n "$with_external_hyph_dir"; then
6217         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6218     else
6219         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6220     fi
6221     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6222     AC_MSG_CHECKING([for thesaurus directory])
6223     if test -n "$with_external_thes_dir"; then
6224         THES_SYSTEM_DIR=file://$with_external_thes_dir
6225     else
6226         THES_SYSTEM_DIR=file:///usr/share/mythes
6227     fi
6228     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6229 else
6230     AC_MSG_RESULT([no])
6231     SYSTEM_DICTS=
6233 AC_SUBST(SYSTEM_DICTS)
6234 AC_SUBST(DICT_SYSTEM_DIR)
6235 AC_SUBST(HYPH_SYSTEM_DIR)
6236 AC_SUBST(THES_SYSTEM_DIR)
6238 dnl ===================================================================
6239 dnl Precompiled headers.
6240 ENABLE_PCH=""
6241 AC_MSG_CHECKING([whether to enable pch feature])
6242 if test -z "$enable_pch"; then
6243     if test "$_os" = "WINNT"; then
6244         # Enabled by default on Windows.
6245         enable_pch=yes
6246         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6247         if test -z "$enable_ccache" -a "$SCCACHE"; then
6248             CCACHE=""
6249         fi
6250     else
6251         enable_pch=no
6252     fi
6254 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6255     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6257 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6258     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6260 if test "$enable_pch" = "system"; then
6261     ENABLE_PCH="1"
6262     AC_MSG_RESULT([yes (system headers)])
6263 elif test "$enable_pch" = "base"; then
6264     ENABLE_PCH="2"
6265     AC_MSG_RESULT([yes (system and base headers)])
6266 elif test "$enable_pch" = "normal"; then
6267     ENABLE_PCH="3"
6268     AC_MSG_RESULT([yes (normal)])
6269 elif test "$enable_pch" = "full"; then
6270     ENABLE_PCH="4"
6271     AC_MSG_RESULT([yes (full)])
6272 elif test "$enable_pch" = "yes"; then
6273     # Pick a suitable default.
6274     if test "$GCC" = "yes"; then
6275         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6276         # while making the PCHs larger and rebuilds more likely.
6277         ENABLE_PCH="2"
6278         AC_MSG_RESULT([yes (system and base headers)])
6279     else
6280         # With MSVC the highest level makes a significant difference,
6281         # and it was the default when there used to be no PCH levels.
6282         ENABLE_PCH="4"
6283         AC_MSG_RESULT([yes (full)])
6284     fi
6285 elif test "$enable_pch" = "no"; then
6286     AC_MSG_RESULT([no])
6287 else
6288     AC_MSG_ERROR([Unknown value for --enable-pch])
6290 AC_SUBST(ENABLE_PCH)
6291 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6292 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6293     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6294     if test "$CCACHE_BIN" != "not found"; then
6295         AC_MSG_CHECKING([ccache version])
6296         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6297         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6298         AC_MSG_RESULT([$CCACHE_VERSION])
6299         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6300         if test "$CCACHE_NUMVER" -gt "030701"; then
6301             AC_MSG_RESULT([yes])
6302         else
6303             AC_MSG_RESULT([no (not newer than 3.7.1)])
6304             CCACHE_DEPEND_MODE=
6305         fi
6306     fi
6309 PCH_INSTANTIATE_TEMPLATES=
6310 if test -n "$ENABLE_PCH"; then
6311     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6312     save_CFLAGS=$CFLAGS
6313     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6314     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6315     CFLAGS=$save_CFLAGS
6316     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6317         AC_MSG_RESULT(yes)
6318     else
6319         AC_MSG_RESULT(no)
6320     fi
6322 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6324 BUILDING_PCH_WITH_OBJ=
6325 if test -n "$ENABLE_PCH"; then
6326     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6327     save_CFLAGS=$CFLAGS
6328     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6329     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6330     CFLAGS=$save_CFLAGS
6331     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6332         AC_MSG_RESULT(yes)
6333     else
6334         AC_MSG_RESULT(no)
6335     fi
6337 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6339 PCH_CODEGEN=
6340 PCH_NO_CODEGEN=
6341 fpch_prefix=
6342 if test "$COM" = MSC; then
6343     fpch_prefix="-Xclang "
6345 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6346     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6347     save_CFLAGS=$CFLAGS
6348     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6349     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6350         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6351     CFLAGS=$save_CFLAGS
6352     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6353     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6354         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6355     CFLAGS=$save_CFLAGS
6356     if test -n "$PCH_CODEGEN"; then
6357         AC_MSG_RESULT(yes)
6358     else
6359         AC_MSG_RESULT(no)
6360     fi
6362 AC_SUBST(PCH_CODEGEN)
6363 AC_SUBST(PCH_NO_CODEGEN)
6364 PCH_DEBUGINFO=
6365 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6366     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6367     save_CFLAGS=$CFLAGS
6368     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6369     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6370     CFLAGS=$save_CFLAGS
6371     if test -n "$PCH_DEBUGINFO"; then
6372         AC_MSG_RESULT(yes)
6373     else
6374         AC_MSG_RESULT(no)
6375     fi
6377 AC_SUBST(PCH_DEBUGINFO)
6379 TAB=`printf '\t'`
6381 AC_MSG_CHECKING([the GNU Make version])
6382 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6383 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6384 if test "$_make_longver" -ge "040000"; then
6385     AC_MSG_RESULT([$GNUMAKE $_make_version])
6386 else
6387     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6390 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6391 STALE_MAKE=
6392 if test "$_make_ver_check" = ""; then
6393    STALE_MAKE=TRUE
6396 HAVE_LD_HASH_STYLE=FALSE
6397 WITH_LINKER_HASH_STYLE=
6398 AC_MSG_CHECKING([for --hash-style gcc linker support])
6399 if test "$GCC" = "yes"; then
6400     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6401         hash_styles="gnu sysv"
6402     elif test "$with_linker_hash_style" = "no"; then
6403         hash_styles=
6404     else
6405         hash_styles="$with_linker_hash_style"
6406     fi
6408     for hash_style in $hash_styles; do
6409         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6410         hash_style_ldflags_save=$LDFLAGS
6411         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6413         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6414             [
6415 #include <stdio.h>
6416             ],[
6417 printf ("");
6418             ])],
6419             [
6420                   HAVE_LD_HASH_STYLE=TRUE
6421                   WITH_LINKER_HASH_STYLE=$hash_style
6422             ],
6423             [HAVE_LD_HASH_STYLE=FALSE],
6424             [HAVE_LD_HASH_STYLE=FALSE])
6425         LDFLAGS=$hash_style_ldflags_save
6426     done
6428     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6429         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6430     else
6431         AC_MSG_RESULT( no )
6432     fi
6433     LDFLAGS=$hash_style_ldflags_save
6434 else
6435     AC_MSG_RESULT( no )
6437 AC_SUBST(HAVE_LD_HASH_STYLE)
6438 AC_SUBST(WITH_LINKER_HASH_STYLE)
6440 dnl ===================================================================
6441 dnl Check whether there's a Perl version available.
6442 dnl ===================================================================
6443 if test -z "$with_perl_home"; then
6444     AC_PATH_PROG(PERL, perl)
6445 else
6446     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6447     _perl_path="$with_perl_home/bin/perl"
6448     if test -x "$_perl_path"; then
6449         PERL=$_perl_path
6450     else
6451         AC_MSG_ERROR([$_perl_path not found])
6452     fi
6455 dnl ===================================================================
6456 dnl Testing for Perl version 5 or greater.
6457 dnl $] is the Perl version variable, it is returned as an integer
6458 dnl ===================================================================
6459 if test "$PERL"; then
6460     AC_MSG_CHECKING([the Perl version])
6461     ${PERL} -e "exit($]);"
6462     _perl_version=$?
6463     if test "$_perl_version" -lt 5; then
6464         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6465     fi
6466     AC_MSG_RESULT([Perl $_perl_version])
6467 else
6468     AC_MSG_ERROR([Perl not found, install Perl 5])
6471 dnl ===================================================================
6472 dnl Testing for required Perl modules
6473 dnl ===================================================================
6475 AC_MSG_CHECKING([for required Perl modules])
6476 perl_use_string="use Cwd ; use Digest::MD5"
6477 if test "$_os" = "WINNT"; then
6478     if test -n "$PKGFORMAT"; then
6479         for i in $PKGFORMAT; do
6480             case "$i" in
6481             msi)
6482                 # for getting fonts versions to use in MSI
6483                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6484                 ;;
6485             esac
6486         done
6487     fi
6489 if test "$with_system_hsqldb" = "yes"; then
6490     perl_use_string="$perl_use_string ; use Archive::Zip"
6492 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6493     # OpenSSL needs that to build
6494     perl_use_string="$perl_use_string ; use FindBin"
6496 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6497     AC_MSG_RESULT([all modules found])
6498 else
6499     AC_MSG_RESULT([failed to find some modules])
6500     # Find out which modules are missing.
6501     for i in $perl_use_string; do
6502         if test "$i" != "use" -a "$i" != ";"; then
6503             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6504                 missing_perl_modules="$missing_perl_modules $i"
6505             fi
6506         fi
6507     done
6508     AC_MSG_ERROR([
6509     The missing Perl modules are: $missing_perl_modules
6510     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6513 dnl ===================================================================
6514 dnl Check for pkg-config
6515 dnl ===================================================================
6516 if test "$_os" != "WINNT"; then
6517     PKG_PROG_PKG_CONFIG
6519 AC_SUBST(PKG_CONFIG)
6520 AC_SUBST(PKG_CONFIG_PATH)
6521 AC_SUBST(PKG_CONFIG_LIBDIR)
6523 if test "$_os" != "WINNT"; then
6525     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6526     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6527     # explicitly. Or put /path/to/compiler in PATH yourself.
6529     toolprefix=gcc
6530     if test "$COM_IS_CLANG" = "TRUE"; then
6531         toolprefix=llvm
6532     fi
6533     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6534     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6535     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6536     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6537     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6538     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6540 AC_SUBST(AR)
6541 AC_SUBST(NM)
6542 AC_SUBST(OBJDUMP)
6543 AC_SUBST(RANLIB)
6544 AC_SUBST(READELF)
6545 AC_SUBST(STRIP)
6547 dnl ===================================================================
6548 dnl pkg-config checks on macOS
6549 dnl ===================================================================
6551 if test $_os = Darwin; then
6552     AC_MSG_CHECKING([for bogus pkg-config])
6553     if test -n "$PKG_CONFIG"; then
6554         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6555             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6556         else
6557             if test "$enable_bogus_pkg_config" = "yes"; then
6558                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6559             else
6560                 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.])
6561             fi
6562         fi
6563     else
6564         AC_MSG_RESULT([no, good])
6565     fi
6568 find_csc()
6570     # Return value: $csctest
6572     unset csctest
6574     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6575     if test -n "$regvalue"; then
6576         csctest=$regvalue
6577         return
6578     fi
6581 find_al()
6583     # Return value: $altest
6585     unset altest
6587     # We need this check to detect 4.6.1 or above.
6588     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6589         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6590         PathFormat "$regvalue"
6591         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6592             altest=$regvalue
6593             return
6594         fi
6595     done
6597     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6598     for x in $reglist; do
6599         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6600         PathFormat "$regvalue"
6601         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6602             altest=$regvalue
6603             return
6604         fi
6605     done
6608 find_dotnetsdk()
6610     unset frametest
6612     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
6613         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6614         if test -n "$regvalue"; then
6615             frametest=$regvalue
6616             return
6617         fi
6618     done
6619     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6622 find_winsdk_version()
6624     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6625     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6627     unset winsdktest winsdkbinsubdir winsdklibsubdir
6629     case "$1" in
6630     8.0|8.0A)
6631         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6632         if test -n "$regvalue"; then
6633             winsdktest=$regvalue
6634             winsdklibsubdir=win8
6635             return
6636         fi
6637         ;;
6638     8.1|8.1A)
6639         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6640         if test -n "$regvalue"; then
6641             winsdktest=$regvalue
6642             winsdklibsubdir=winv6.3
6643             return
6644         fi
6645         ;;
6646     10.0)
6647         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6648         if test -n "$regvalue"; then
6649             winsdktest=$regvalue
6650             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6651             if test -n "$regvalue"; then
6652                 winsdkbinsubdir="$regvalue".0
6653                 winsdklibsubdir=$winsdkbinsubdir
6654                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6655                 local tmppath_unix=$(cygpath -u "$tmppath")
6656                 # test exist the SDK path
6657                 if test -d "$tmppath_unix"; then
6658                    # when path is convertible to a short path then path is okay
6659                    cygpath -d "$tmppath" >/dev/null 2>&1
6660                    if test $? -ne 0; then
6661                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6662                    fi
6663                 else
6664                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6665                 fi
6666             fi
6667             return
6668         fi
6669         ;;
6670     esac
6673 find_winsdk()
6675     # Return value: From find_winsdk_version
6677     unset winsdktest
6679     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6680         find_winsdk_version $ver
6681         if test -n "$winsdktest"; then
6682             return
6683         fi
6684     done
6687 find_msms()
6689     # Return value: $msmdir
6690     local version="$1"
6692     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6693     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6694     local my_msm_dir
6696     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6698     msmdir=
6699     case "$VCVER" in
6700     16.0 | 17.0 | 17.8)
6701         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6702             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6703             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6704             if test -e "$my_msm_dir${my_msm_file}"; then
6705                 msmdir=$my_msm_dir
6706             fi
6707         done
6708         ;;
6709     esac
6711     if test -n "$msmdir"; then
6712         msmdir=`cygpath -m "$msmdir"`
6713         AC_MSG_RESULT([$msmdir])
6714     else
6715         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6716             AC_MSG_FAILURE([not found])
6717         else
6718             AC_MSG_WARN([not found (check config.log)])
6719             add_warning "MSM ${my_msm_file} not found"
6720         fi
6721     fi
6724 find_msvc_x64_dlls()
6726     # Return value: $msvcdllpath, $msvcdlls
6728     AC_MSG_CHECKING([for MSVC x64 DLL path])
6730     dnl Order crtver in increasing order. Then check the directories returned by
6731     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6732     dnl the result will be the highest CRT version found in the highest directory.
6734     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6735     case "$VCVER" in
6736     16.0 | 17.0 | 17.8)
6737         for crtver in 141 142 143; do
6738             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6739                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6740                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6741                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6742                 fi
6743             done
6744         done
6745         ;;
6746     esac
6747     AC_MSG_RESULT([$msvcdllpath])
6748     AC_MSG_CHECKING([for MSVC x64 DLLs])
6749     msvcdlls="msvcp140.dll vcruntime140.dll"
6750     for dll in $msvcdlls; do
6751         if ! test -f "$msvcdllpath/$dll"; then
6752             AC_MSG_FAILURE([missing $dll])
6753         fi
6754     done
6755     AC_MSG_RESULT([found all ($msvcdlls)])
6758 dnl =========================================
6759 dnl Check for the Windows  SDK.
6760 dnl =========================================
6761 if test "$_os" = "WINNT"; then
6762     AC_MSG_CHECKING([for Windows SDK])
6763     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6764         find_winsdk
6765         WINDOWS_SDK_HOME=$winsdktest
6767         # normalize if found
6768         if test -n "$WINDOWS_SDK_HOME"; then
6769             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6770             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6771         fi
6773         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6774     fi
6776     if test -n "$WINDOWS_SDK_HOME"; then
6777         # Remove a possible trailing backslash
6778         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6780         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6781              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6782              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6783             have_windows_sdk_headers=yes
6784         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6785              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6786              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6787             have_windows_sdk_headers=yes
6788         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6789              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6790              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6791             have_windows_sdk_headers=yes
6792         else
6793             have_windows_sdk_headers=no
6794         fi
6796         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6797             have_windows_sdk_libs=yes
6798         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6799             have_windows_sdk_libs=yes
6800         else
6801             have_windows_sdk_libs=no
6802         fi
6804         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6805             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6806 the  Windows SDK are installed.])
6807         fi
6808     fi
6810     if test -z "$WINDOWS_SDK_HOME"; then
6811         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6812     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6813         WINDOWS_SDK_VERSION=80
6814         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6815     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6816         WINDOWS_SDK_VERSION=81
6817         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6818     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6819         WINDOWS_SDK_VERSION=10
6820         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6821     else
6822         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6823     fi
6824     PathFormat "$WINDOWS_SDK_HOME"
6825     WINDOWS_SDK_HOME="$formatted_path"
6826     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6827     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6828         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6829         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6830             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6831         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6832             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6833         fi
6834     fi
6836     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6837     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6838     dnl but not in v8.0), so allow this to be overridden with a
6839     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6840     dnl and configuration error if no WiLangId.vbs is found would arguably be
6841     dnl better, but I do not know under which conditions exactly it is needed by
6842     dnl msiglobal.pm:
6843     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6844         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6845         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6846         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6847             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6848             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6849         fi
6850         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6851             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6852             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6853         fi
6854         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6855             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6856             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6857         fi
6858     fi
6859     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6860         if test -n "$with_package_format" -a "$with_package_format" != no; then
6861             for i in "$with_package_format"; do
6862                 if test "$i" = "msi"; then
6863                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6864                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6865                     fi
6866                 fi
6867             done
6868         fi
6869     fi
6871 AC_SUBST(WINDOWS_SDK_HOME)
6872 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6873 AC_SUBST(WINDOWS_SDK_VERSION)
6874 AC_SUBST(WINDOWS_SDK_WILANGID)
6876 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6877     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6878     dnl dir, it also determines that dir's path w/o an arch segment if any,
6879     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6880     AC_MSG_CHECKING([for midl.exe])
6882     find_winsdk
6883     PathFormat "$winsdktest"
6884     winsdktest_unix="$formatted_path_unix"
6886     if test -n "$winsdkbinsubdir" \
6887         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6888     then
6889         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6890         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
6891     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6892         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6893         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6894     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
6895         MIDL_PATH=$winsdktest/Bin
6896         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6897     fi
6898     PathFormat "$MIDL_PATH"
6899     if test ! -f "$formatted_path_unix/midl.exe"; then
6900         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6901     else
6902         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6903     fi
6905     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6906     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6908     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6909          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6910          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6911          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6912     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6913          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6914          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6915          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6916     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6917          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6918          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6919          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6920     else
6921         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6922     fi
6924     dnl Check csc.exe
6925     AC_MSG_CHECKING([for csc.exe])
6926     find_csc
6927     PathFormat "$csctest"
6928     csctest_unix="$formatted_path_unix"
6929     if test -f "$csctest_unix/csc.exe"; then
6930         CSC_PATH="$csctest"
6931     fi
6932     if test ! -f "$csctest_unix/csc.exe"; then
6933         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6934     else
6935         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6936     fi
6938     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6940     dnl Check al.exe
6941     AC_MSG_CHECKING([for al.exe])
6942     if test -n "$winsdkbinsubdir" \
6943         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6944     then
6945         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6946     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
6947         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6948     elif test -f "$winsdktest_unix/Bin/al.exe"; then
6949         AL_PATH="$winsdktest/Bin"
6950     fi
6952     if test -z "$AL_PATH"; then
6953         find_al
6954         PathFormat "$altest"
6955         altest_unix="$formatted_path_unix"
6956         if test -f "$altest_unix/bin/al.exe"; then
6957             AL_PATH="$altest/bin"
6958         elif test -f "$altest_unix/al.exe"; then
6959             AL_PATH="$altest"
6960         fi
6961     fi
6962     PathFormat "$AL_PATH"
6963     if test ! -f "$formatted_path_unix/al.exe"; then
6964         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6965     else
6966         AC_MSG_RESULT([$AL_PATH/al.exe])
6967     fi
6969     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6971     dnl Check mscoree.lib / .NET Framework dir
6972     AC_MSG_CHECKING(.NET Framework)
6973     find_dotnetsdk
6974     PathFormat "$frametest"
6975     frametest="$formatted_path_unix"
6976     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6977         DOTNET_FRAMEWORK_HOME="$frametest"
6978     else
6979         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6980             DOTNET_FRAMEWORK_HOME="$winsdktest"
6981         fi
6982     fi
6983     PathFormat "$DOTNET_FRAMEWORK_HOME"
6984     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
6985         AC_MSG_ERROR([mscoree.lib not found])
6986     fi
6987     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6989     PathFormat "$MIDL_PATH"
6990     MIDL_PATH="$formatted_path"
6992     PathFormat "$AL_PATH"
6993     AL_PATH="$formatted_path"
6995     PathFormat "$DOTNET_FRAMEWORK_HOME"
6996     DOTNET_FRAMEWORK_HOME="$formatted_path"
6998     PathFormat "$CSC_PATH"
6999     CSC_PATH="$formatted_path"
7002 dnl ===================================================================
7003 dnl Testing for C++ compiler and version...
7004 dnl ===================================================================
7006 if test "$_os" != "WINNT"; then
7007     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
7008     save_CXXFLAGS=$CXXFLAGS
7009     AC_PROG_CXX
7010     CXXFLAGS=$save_CXXFLAGS
7011     if test -z "$CXX_BASE"; then
7012         CXX_BASE=`first_arg_basename "$CXX"`
7013     fi
7016 dnl check for GNU C++ compiler version
7017 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7018     AC_MSG_CHECKING([the GNU C++ compiler version])
7020     _gpp_version=`$CXX -dumpversion`
7021     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7023     if test "$_gpp_majmin" -lt "700"; then
7024         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7025     else
7026         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7027     fi
7029     dnl see https://issuetracker.google.com/issues/36962819
7030         glibcxx_threads=no
7031         AC_LANG_PUSH([C++])
7032         AC_REQUIRE_CPP
7033         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7034         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7035             #include <bits/c++config.h>]],[[
7036             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7037             && !defined(_GLIBCXX__PTHREADS) \
7038             && !defined(_GLIBCXX_HAS_GTHREADS)
7039             choke me
7040             #endif
7041         ]])],[AC_MSG_RESULT([yes])
7042         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7043         AC_LANG_POP([C++])
7044         if test $glibcxx_threads = yes; then
7045             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7046         fi
7048 AC_SUBST(BOOST_CXXFLAGS)
7051 # prefx CXX with ccache if needed
7053 if test "$CCACHE" != ""; then
7054     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7055     AC_LANG_PUSH([C++])
7056     save_CXXFLAGS=$CXXFLAGS
7057     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7058     # msvc does not fail on unknown options, check stdout
7059     if test "$COM" = MSC; then
7060         CXXFLAGS="$CXXFLAGS -nologo"
7061     fi
7062     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7063     ac_cxx_werror_flag=yes
7064     dnl an empty program will do, we're checking the compiler flags
7065     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7066                       [use_ccache=yes], [use_ccache=no])
7067     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7068         AC_MSG_RESULT([yes])
7069     else
7070         CXX="$CCACHE $CXX"
7071         CXX_BASE="ccache $CXX_BASE"
7072         AC_MSG_RESULT([no])
7073     fi
7074     CXXFLAGS=$save_CXXFLAGS
7075     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7076     AC_LANG_POP([C++])
7079 dnl ===================================================================
7080 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7081 dnl ===================================================================
7083 if test "$_os" != "WINNT"; then
7084     AC_PROG_CXXCPP
7086     dnl Check whether there's a C pre-processor.
7087     AC_PROG_CPP
7091 dnl ===================================================================
7092 dnl Find integral type sizes and alignments
7093 dnl ===================================================================
7095 if test "$_os" != "WINNT"; then
7097     AC_CHECK_SIZEOF(long)
7098     AC_CHECK_SIZEOF(short)
7099     AC_CHECK_SIZEOF(int)
7100     AC_CHECK_SIZEOF(long long)
7101     AC_CHECK_SIZEOF(double)
7102     AC_CHECK_SIZEOF(void*)
7103     AC_CHECK_SIZEOF(size_t)
7105     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7106     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7107     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7108     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7109     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7110     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7112     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7113     m4_pattern_allow([AC_CHECK_ALIGNOF])
7114     m4_ifdef([AC_CHECK_ALIGNOF],
7115         [
7116             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7117             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7118             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7119             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7120         ],
7121         [
7122             case "$_os-$host_cpu" in
7123             Linux-i686)
7124                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7125                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7126                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7127                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7128                 ;;
7129             Linux-x86_64)
7130                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7131                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7132                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7133                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7134                 ;;
7135             *)
7136                 if test -z "$ac_cv_alignof_short" -o \
7137                         -z "$ac_cv_alignof_int" -o \
7138                         -z "$ac_cv_alignof_long" -o \
7139                         -z "$ac_cv_alignof_double"; then
7140                    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.])
7141                 fi
7142                 ;;
7143             esac
7144         ])
7146     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7147     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7148     if test $ac_cv_sizeof_long -eq 8; then
7149         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7150     elif test $ac_cv_sizeof_double -eq 8; then
7151         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7152     else
7153         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7154     fi
7156     dnl Check for large file support
7157     AC_SYS_LARGEFILE
7158     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7159         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7160     fi
7161     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7162         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7163     fi
7164 else
7165     # Hardcode for MSVC
7166     SAL_TYPES_SIZEOFSHORT=2
7167     SAL_TYPES_SIZEOFINT=4
7168     SAL_TYPES_SIZEOFLONG=4
7169     SAL_TYPES_SIZEOFLONGLONG=8
7170     if test $WIN_HOST_BITS -eq 32; then
7171         SAL_TYPES_SIZEOFPOINTER=4
7172         SIZEOF_SIZE_T=4
7173     else
7174         SAL_TYPES_SIZEOFPOINTER=8
7175         SIZEOF_SIZE_T=8
7176     fi
7177     SAL_TYPES_ALIGNMENT2=2
7178     SAL_TYPES_ALIGNMENT4=4
7179     SAL_TYPES_ALIGNMENT8=8
7180     LFS_CFLAGS=''
7182 AC_SUBST(LFS_CFLAGS)
7183 AC_SUBST(SIZEOF_SIZE_T)
7185 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7186 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7187 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7188 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7189 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7190 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7191 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7192 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7194 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7195 AC_MSG_CHECKING([whether jumbo sheets are supported])
7196 if test "$_os" != "WINNT"; then
7197     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7198         AC_MSG_RESULT([yes])
7199         ENABLE_JUMBO_SHEETS=TRUE
7200         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7201     else
7202         AC_MSG_RESULT([no])
7203     fi
7204 else
7205     if test $WIN_HOST_BITS -gt 32; then
7206         # 64bit windows is special-cased for tools::Long because long is 32bit
7207         AC_MSG_RESULT([yes])
7208         ENABLE_JUMBO_SHEETS=TRUE
7209         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7210     else
7211         AC_MSG_RESULT([no])
7212     fi
7214 AC_SUBST(ENABLE_JUMBO_SHEETS)
7216 dnl ===================================================================
7217 dnl Check whether to enable runtime optimizations
7218 dnl ===================================================================
7219 ENABLE_RUNTIME_OPTIMIZATIONS=
7220 AC_MSG_CHECKING([whether to enable runtime optimizations])
7221 if test -z "$enable_runtime_optimizations"; then
7222     for i in $CC; do
7223         case $i in
7224         -fsanitize=*)
7225             enable_runtime_optimizations=no
7226             break
7227             ;;
7228         esac
7229     done
7231 if test "$enable_runtime_optimizations" != no; then
7232     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7233     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7234     AC_MSG_RESULT([yes])
7235 else
7236     AC_MSG_RESULT([no])
7238 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7240 dnl ===================================================================
7241 dnl Check if valgrind headers are available
7242 dnl ===================================================================
7243 ENABLE_VALGRIND=
7244 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7245     prev_cppflags=$CPPFLAGS
7246     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7247     # or where does it come from?
7248     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7249     AC_CHECK_HEADER([valgrind/valgrind.h],
7250         [ENABLE_VALGRIND=TRUE])
7251     CPPFLAGS=$prev_cppflags
7253 AC_SUBST([ENABLE_VALGRIND])
7254 if test -z "$ENABLE_VALGRIND"; then
7255     if test "$with_valgrind" = yes; then
7256         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7257     fi
7258     VALGRIND_CFLAGS=
7260 AC_SUBST([VALGRIND_CFLAGS])
7263 dnl ===================================================================
7264 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7265 dnl ===================================================================
7267 # We need at least the sys/sdt.h include header.
7268 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7269 if test "$SDT_H_FOUND" = "TRUE"; then
7270     # Found sys/sdt.h header, now make sure the c++ compiler works.
7271     # Old g++ versions had problems with probes in constructors/destructors.
7272     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7273     AC_LANG_PUSH([C++])
7274     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7275     #include <sys/sdt.h>
7276     class ProbeClass
7277     {
7278     private:
7279       int& ref;
7280       const char *name;
7282     public:
7283       ProbeClass(int& v, const char *n) : ref(v), name(n)
7284       {
7285         DTRACE_PROBE2(_test_, cons, name, ref);
7286       }
7288       void method(int min)
7289       {
7290         DTRACE_PROBE3(_test_, meth, name, ref, min);
7291         ref -= min;
7292       }
7294       ~ProbeClass()
7295       {
7296         DTRACE_PROBE2(_test_, dest, name, ref);
7297       }
7298     };
7299     ]],[[
7300     int i = 64;
7301     DTRACE_PROBE1(_test_, call, i);
7302     ProbeClass inst = ProbeClass(i, "call");
7303     inst.method(24);
7304     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7305           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7306     AC_LANG_POP([C++])
7308 AC_CONFIG_HEADERS([config_host/config_probes.h])
7310 dnl ===================================================================
7311 dnl GCC features
7312 dnl ===================================================================
7313 HAVE_GCC_STACK_CLASH_PROTECTION=
7314 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7315     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7316     save_CFLAGS=$CFLAGS
7317     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7318     AC_LINK_IFELSE(
7319         [AC_LANG_PROGRAM(, [[return 0;]])],
7320         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7321         [AC_MSG_RESULT([no])])
7322     CFLAGS=$save_CFLAGS
7324     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7325     save_CFLAGS=$CFLAGS
7326     CFLAGS="$CFLAGS -Werror -mno-avx"
7327     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7328     CFLAGS=$save_CFLAGS
7329     if test "$HAVE_GCC_AVX" = "TRUE"; then
7330         AC_MSG_RESULT([yes])
7331     else
7332         AC_MSG_RESULT([no])
7333     fi
7335     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7336     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7337     int v = 0;
7338     if (__sync_add_and_fetch(&v, 1) != 1 ||
7339         __sync_sub_and_fetch(&v, 1) != 0)
7340         return 1;
7341     __sync_synchronize();
7342     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7343         v != 1)
7344         return 1;
7345     return 0;
7346 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7347     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7348         AC_MSG_RESULT([yes])
7349         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7350     else
7351         AC_MSG_RESULT([no])
7352     fi
7354     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7355     AC_LANG_PUSH([C++])
7356     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7357             #include <cstddef>
7358             #include <cxxabi.h>
7359             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7360         ])], [
7361             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7362             AC_MSG_RESULT([yes])
7363         ], [AC_MSG_RESULT([no])])
7364     AC_LANG_POP([C++])
7366     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7367     AC_LANG_PUSH([C++])
7368     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7369             #include <cstddef>
7370             #include <cxxabi.h>
7371             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7372         ])], [
7373             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7374             AC_MSG_RESULT([yes])
7375         ], [AC_MSG_RESULT([no])])
7376     AC_LANG_POP([C++])
7378     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7379     AC_LANG_PUSH([C++])
7380     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7381             #include <cxxabi.h>
7382             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7383         ])], [
7384             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7385             AC_MSG_RESULT([yes])
7386         ], [AC_MSG_RESULT([no])])
7387     AC_LANG_POP([C++])
7389     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7390     AC_LANG_PUSH([C++])
7391     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7392             #include <cstddef>
7393             #include <cxxabi.h>
7394             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7395         ])], [
7396             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7397             AC_MSG_RESULT([yes])
7398         ], [AC_MSG_RESULT([no])])
7399     AC_LANG_POP([C++])
7401     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7402     AC_LANG_PUSH([C++])
7403     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7404             #include <cstddef>
7405             #include <cxxabi.h>
7406             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7407         ])], [
7408             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7409             AC_MSG_RESULT([yes])
7410         ], [AC_MSG_RESULT([no])])
7411     AC_LANG_POP([C++])
7413     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7414     AC_LANG_PUSH([C++])
7415     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7416             #include <cxxabi.h>
7417             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7418         ])], [
7419             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7420             AC_MSG_RESULT([yes])
7421         ], [AC_MSG_RESULT([no])])
7422     AC_LANG_POP([C++])
7424     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7425     AC_LANG_PUSH([C++])
7426     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7427             #include <cxxabi.h>
7428             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7429         ])], [
7430             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7431             AC_MSG_RESULT([yes])
7432         ], [AC_MSG_RESULT([no])])
7433     AC_LANG_POP([C++])
7435     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7436     AC_LANG_PUSH([C++])
7437     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7438             #include <cxxabi.h>
7439             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7440         ])], [
7441             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7442             AC_MSG_RESULT([yes])
7443         ], [AC_MSG_RESULT([no])])
7444     AC_LANG_POP([C++])
7446     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7447     AC_LANG_PUSH([C++])
7448     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7449             #include <cstddef>
7450             #include <cxxabi.h>
7451             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7452         ])], [
7453             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7454             AC_MSG_RESULT([yes])
7455         ], [AC_MSG_RESULT([no])])
7456     AC_LANG_POP([C++])
7458     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7459     AC_LANG_PUSH([C++])
7460     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7461             #include <cstddef>
7462             #include <cxxabi.h>
7463             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7464         ])], [
7465             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7466             AC_MSG_RESULT([yes])
7467         ], [AC_MSG_RESULT([no])])
7468     AC_LANG_POP([C++])
7471 AC_SUBST(HAVE_GCC_AVX)
7472 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7473 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7475 dnl ===================================================================
7476 dnl Identify the C++ library
7477 dnl ===================================================================
7479 AC_MSG_CHECKING([what the C++ library is])
7480 HAVE_LIBSTDCPP=
7481 HAVE_LIBCPP=
7482 AC_LANG_PUSH([C++])
7483 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7484 #include <utility>
7485 #ifndef __GLIBCXX__
7486 foo bar
7487 #endif
7488 ]])],
7489     [CPP_LIBRARY=GLIBCXX
7490      cpp_library_name="GNU libstdc++"
7491      HAVE_LIBSTDCPP=TRUE
7492     ],
7493     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7494 #include <utility>
7495 #ifndef _LIBCPP_VERSION
7496 foo bar
7497 #endif
7498 ]])],
7499     [CPP_LIBRARY=LIBCPP
7500      cpp_library_name="LLVM libc++"
7501      AC_DEFINE([HAVE_LIBCPP])
7502      HAVE_LIBCPP=TRUE
7503     ],
7504     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7505 #include <utility>
7506 #ifndef _MSC_VER
7507 foo bar
7508 #endif
7509 ]])],
7510     [CPP_LIBRARY=MSVCRT
7511      cpp_library_name="Microsoft"
7512     ],
7513     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7514 AC_MSG_RESULT([$cpp_library_name])
7515 AC_LANG_POP([C++])
7516 AC_SUBST([HAVE_LIBSTDCPP])
7517 AC_SUBST([HAVE_LIBCPP])
7519 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7520 then
7521     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7522     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7523     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7524     # although there will be backwards compatibility).
7525     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7526     # and there would be undefined references to debug functions.
7527     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7528     # So check if debug mode can be used and disable or downgrade it to assertions
7529     # if needed.
7530     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7531     AC_LANG_PUSH([C++])
7532     libcpp_debug_links=
7533     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7534 #define _LIBCPP_DEBUG 0 // only assertions
7535 #include <vector>
7536 int main()
7538     std::vector<int> v;
7539     v.push_back( 1 );
7540     return v[ 3 ];
7542 ]])], [libcpp_debug_links=1])
7543     if test -n "$libcpp_debug_links"; then
7544         # we can use at least assertions, check if debug mode works
7545         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7546 #define _LIBCPP_DEBUG 1 // debug mode
7547 #include <string>
7548 #include <vector>
7549 int foo(const std::vector<int>& v) { return *v.begin(); }
7550 int main()
7552     std::vector<int> v;
7553     v.push_back( 1 );
7554     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7555     return (foo(v) + s.size()) != 0 ? 0 : 1;
7557 ]])],
7558         [AC_MSG_RESULT(yes)
7559          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7560         ],
7561         [AC_MSG_RESULT(no, using only assertions)
7562          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7563         ]
7564         )
7565     else
7566         AC_MSG_RESULT(no)
7567     fi
7568     AC_LANG_POP([C++])
7570 AC_SUBST([LIBCPP_DEBUG])
7572 dnl ===================================================================
7573 dnl Check for gperf
7574 dnl ===================================================================
7575 AC_PATH_PROG(GPERF, gperf)
7576 if test -z "$GPERF"; then
7577     AC_MSG_ERROR([gperf not found but needed. Install it.])
7579 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7580     GPERF=`cygpath -m $GPERF`
7582 AC_MSG_CHECKING([whether gperf is new enough])
7583 my_gperf_ver1=$($GPERF --version | head -n 1)
7584 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7585 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7586 if test "$my_gperf_ver3" -ge 301; then
7587     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7588 else
7589     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7591 AC_SUBST(GPERF)
7593 dnl ===================================================================
7594 dnl Check for system libcmis
7595 dnl ===================================================================
7596 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.0],enabled)
7598 dnl ===================================================================
7599 dnl C++11
7600 dnl ===================================================================
7602 if test -z "${CXXFLAGS_CXX11+x}"; then
7603     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7604     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7605         if test "$with_latest_c__" = yes; then
7606             CXXFLAGS_CXX11=-std:c++latest
7607         else
7608             CXXFLAGS_CXX11=-std:c++20
7609         fi
7610         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7611     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7612         my_flags='-std=c++20 -std=c++2a'
7613         if test "$with_latest_c__" = yes; then
7614             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7615         fi
7616         for flag in $my_flags; do
7617             if test "$COM" = MSC; then
7618                 flag="-Xclang $flag"
7619             fi
7620             save_CXXFLAGS=$CXXFLAGS
7621             CXXFLAGS="$CXXFLAGS $flag -Werror"
7622             AC_LANG_PUSH([C++])
7623             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7624                 #include <algorithm>
7625                 #include <functional>
7626                 #include <vector>
7628                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7629                     std::sort(v.begin(), v.end(), fn);
7630                 }
7631                 ]])],[CXXFLAGS_CXX11=$flag])
7632             AC_LANG_POP([C++])
7633             CXXFLAGS=$save_CXXFLAGS
7634             if test -n "$CXXFLAGS_CXX11"; then
7635                 break
7636             fi
7637         done
7638     fi
7639     if test -n "$CXXFLAGS_CXX11"; then
7640         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7641     else
7642         AC_MSG_ERROR(no)
7643     fi
7645 AC_SUBST(CXXFLAGS_CXX11)
7647 if test "$GCC" = "yes"; then
7648     save_CXXFLAGS=$CXXFLAGS
7649     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7650     CHECK_L_ATOMIC
7651     CXXFLAGS=$save_CXXFLAGS
7652     AC_SUBST(ATOMIC_LIB)
7655 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7656 save_CXXFLAGS=$CXXFLAGS
7657 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7658 AC_LANG_PUSH([C++])
7660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7661 #include <stddef.h>
7663 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7665 namespace
7667         struct b
7668         {
7669                 int i;
7670                 int j;
7671         };
7673 ]], [[
7674 struct a
7676         int i;
7677         int j;
7679 a thinga[]={{0,0}, {1,1}};
7680 b thingb[]={{0,0}, {1,1}};
7681 size_t i = sizeof(sal_n_array_size(thinga));
7682 size_t j = sizeof(sal_n_array_size(thingb));
7683 return !(i != 0 && j != 0);
7685     ], [ AC_MSG_RESULT(yes) ],
7686     [ AC_MSG_ERROR(no)])
7687 AC_LANG_POP([C++])
7688 CXXFLAGS=$save_CXXFLAGS
7690 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7691 if test "$GCC" = yes; then
7692     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7693     AC_LANG_PUSH([C++])
7694     save_CXXFLAGS=$CXXFLAGS
7695     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7696     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7697     CXXFLAGS=$save_CXXFLAGS
7698     AC_LANG_POP([C++])
7699     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7700         AC_MSG_RESULT([yes])
7701     else
7702         AC_MSG_RESULT([no])
7703     fi
7705 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7707 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7708 AC_LANG_PUSH([C++])
7709 save_CXXFLAGS=$CXXFLAGS
7710 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7711 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7712         #include <algorithm>
7713         #include <initializer_list>
7714         #include <vector>
7715         template<typename T> class S {
7716         private:
7717             std::vector<T> v_;
7718         public:
7719             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7720         };
7721         constinit S<int> s{3, 2, 1};
7722     ])], [
7723         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7724         AC_MSG_RESULT([yes])
7725     ], [AC_MSG_RESULT([no])])
7726 CXXFLAGS=$save_CXXFLAGS
7727 AC_LANG_POP([C++])
7729 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7730 AC_LANG_PUSH([C++])
7731 save_CXXFLAGS=$CXXFLAGS
7732 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7733 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7734         struct S1 { S1(S1 &&); };
7735         struct S2: S1 {};
7736         S1 f(S2 s) { return s; }
7737     ])], [
7738         AC_DEFINE([HAVE_P1155R3],[1])
7739         AC_MSG_RESULT([yes])
7740     ], [AC_MSG_RESULT([no])])
7741 CXXFLAGS=$save_CXXFLAGS
7742 AC_LANG_POP([C++])
7744 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7745 HAVE_CXX20_ATOMIC_REF=
7746 AC_LANG_PUSH([C++])
7747 save_CXXFLAGS=$CXXFLAGS
7748 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7749 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7750         #include <atomic>
7751         int x;
7752         std::atomic_ref<int> y(x);
7753     ])], [
7754         HAVE_CXX20_ATOMIC_REF=TRUE
7755         AC_MSG_RESULT([yes])
7756     ], [AC_MSG_RESULT([no])])
7757 CXXFLAGS=$save_CXXFLAGS
7758 AC_LANG_POP([C++])
7759 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7761 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7762 dnl which is included in -Wextra anyway):
7763 HAVE_WDEPRECATED_COPY_DTOR=
7764 if test "$GCC" = yes; then
7765     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7766     AC_LANG_PUSH([C++])
7767     save_CXXFLAGS=$CXXFLAGS
7768     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7769     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7770             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7771             AC_MSG_RESULT([yes])
7772         ], [AC_MSG_RESULT([no])])
7773     CXXFLAGS=$save_CXXFLAGS
7774     AC_LANG_POP([C++])
7776 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7778 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7779 dnl uninitialized warning for code like
7781 dnl   OString f();
7782 dnl   boost::optional<OString> * g(bool b) {
7783 dnl       boost::optional<OString> o;
7784 dnl       if (b) o = f();
7785 dnl       return new boost::optional<OString>(o);
7786 dnl   }
7788 dnl (as is e.g. present, in a slightly more elaborate form, in
7789 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7790 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7791 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7792 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7793     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7794     AC_LANG_PUSH([C++])
7795     save_CXXFLAGS=$CXXFLAGS
7796     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7797     if test "$ENABLE_OPTIMIZED" = TRUE; then
7798         CXXFLAGS="$CXXFLAGS -O2"
7799     else
7800         CXXFLAGS="$CXXFLAGS -O0"
7801     fi
7802     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7803             #include <new>
7804             void f1(int);
7805             struct S1 {
7806                 ~S1() { f1(n); }
7807                 int n = 0;
7808             };
7809             struct S2 {
7810                 S2() {}
7811                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7812                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7813                 void set(S1 s) {
7814                     new (stg) S1(s);
7815                     init = true;
7816                 }
7817                 bool init = false;
7818                 char stg[sizeof (S1)];
7819             } ;
7820             S1 f2();
7821             S2 * f3(bool b) {
7822                 S2 o;
7823                 if (b) o.set(f2());
7824                 return new S2(o);
7825             }
7826         ]])], [AC_MSG_RESULT([no])], [
7827             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7828             AC_MSG_RESULT([yes])
7829         ])
7830     CXXFLAGS=$save_CXXFLAGS
7831     AC_LANG_POP([C++])
7833 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7835 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7836 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7837 dnl hits us e.g. with GCC 10 and --enable-optimized at
7839 dnl   In file included from include/rtl/string.hxx:49,
7840 dnl                    from include/rtl/ustring.hxx:43,
7841 dnl                    from include/osl/file.hxx:35,
7842 dnl                    from include/codemaker/global.hxx:28,
7843 dnl                    from include/codemaker/options.hxx:23,
7844 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7845 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7846 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,
7847 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,
7848 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,
7849 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7850 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7851 dnl      78 |         memcpy( buffer, data, length );
7852 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7853 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7854 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7855     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7856     AC_LANG_PUSH([C++])
7857     save_CXXFLAGS=$CXXFLAGS
7858     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7859     if test "$ENABLE_OPTIMIZED" = TRUE; then
7860         CXXFLAGS="$CXXFLAGS -O2"
7861     else
7862         CXXFLAGS="$CXXFLAGS -O0"
7863     fi
7864     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7865     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7866             void fill(char const * begin, char const * end, char c);
7867             struct q {
7868                 char ids[4];
7869                 char username[6];
7870             };
7871             void test(q & c) {
7872                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7873                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7874             }
7875         ]])], [AC_MSG_RESULT([no])], [
7876             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7877             AC_MSG_RESULT([yes])
7878         ])
7879     CXXFLAGS=$save_CXXFLAGS
7880     AC_LANG_POP([C++])
7882 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7884 HAVE_DLLEXPORTINLINES=
7885 if test "$_os" = "WINNT"; then
7886     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7887     AC_LANG_PUSH([C++])
7888     save_CXXFLAGS=$CXXFLAGS
7889     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7890     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7891             HAVE_DLLEXPORTINLINES=TRUE
7892             AC_MSG_RESULT([yes])
7893         ], [AC_MSG_RESULT([no])])
7894     CXXFLAGS=$save_CXXFLAGS
7895     AC_LANG_POP([C++])
7897 AC_SUBST([HAVE_DLLEXPORTINLINES])
7899 dnl ===================================================================
7900 dnl CPU Intrinsics support - SSE, AVX
7901 dnl ===================================================================
7903 CXXFLAGS_INTRINSICS_SSE2=
7904 CXXFLAGS_INTRINSICS_SSSE3=
7905 CXXFLAGS_INTRINSICS_SSE41=
7906 CXXFLAGS_INTRINSICS_SSE42=
7907 CXXFLAGS_INTRINSICS_AVX=
7908 CXXFLAGS_INTRINSICS_AVX2=
7909 CXXFLAGS_INTRINSICS_AVX512=
7910 CXXFLAGS_INTRINSICS_AVX512F=
7911 CXXFLAGS_INTRINSICS_F16C=
7912 CXXFLAGS_INTRINSICS_FMA=
7914 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7915     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7916     flag_sse2=-msse2
7917     flag_ssse3=-mssse3
7918     flag_sse41=-msse4.1
7919     flag_sse42=-msse4.2
7920     flag_avx=-mavx
7921     flag_avx2=-mavx2
7922     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7923     flag_avx512f=-mavx512f
7924     flag_f16c=-mf16c
7925     flag_fma=-mfma
7926 else
7927     # With MSVC using -arch is in fact not necessary for being able
7928     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7929     # even if compiled with -arch:AVX, the -arch option really only affects
7930     # instructions generated for C/C++ code.
7931     # So use the matching same (or lower) -arch options, but only in order
7932     # to generate the best matching instructions for the C++ code surrounding
7933     # the intrinsics.
7934     # SSE2 is the default for x86/x64, so no need to specify the option.
7935     flag_sse2=
7936     # No specific options for these, use the next lower.
7937     flag_ssse3="$flag_sse2"
7938     flag_sse41="$flag_sse2"
7939     flag_sse42="$flag_sse2"
7940     flag_avx=-arch:AVX
7941     flag_avx2=-arch:AVX2
7942     flag_avx512=-arch:AVX512
7943     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7944     flag_avx512f=-arch:AVX2
7945     # No MSVC options for these.
7946     flag_f16c="$flag_sse2"
7947     flag_fma="$flag_sse2"
7950 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7951 AC_LANG_PUSH([C++])
7952 save_CXXFLAGS=$CXXFLAGS
7953 CXXFLAGS="$CXXFLAGS $flag_sse2"
7954 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7955     #include <emmintrin.h>
7956     int main () {
7957         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7958         c = _mm_xor_si128 (a, b);
7959         return 0;
7960     }
7961     ])],
7962     [can_compile_sse2=yes],
7963     [can_compile_sse2=no])
7964 AC_LANG_POP([C++])
7965 CXXFLAGS=$save_CXXFLAGS
7966 AC_MSG_RESULT([${can_compile_sse2}])
7967 if test "${can_compile_sse2}" = "yes" ; then
7968     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7971 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7972 AC_LANG_PUSH([C++])
7973 save_CXXFLAGS=$CXXFLAGS
7974 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7975 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7976     #include <tmmintrin.h>
7977     int main () {
7978         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7979         c = _mm_maddubs_epi16 (a, b);
7980         return 0;
7981     }
7982     ])],
7983     [can_compile_ssse3=yes],
7984     [can_compile_ssse3=no])
7985 AC_LANG_POP([C++])
7986 CXXFLAGS=$save_CXXFLAGS
7987 AC_MSG_RESULT([${can_compile_ssse3}])
7988 if test "${can_compile_ssse3}" = "yes" ; then
7989     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7992 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7993 AC_LANG_PUSH([C++])
7994 save_CXXFLAGS=$CXXFLAGS
7995 CXXFLAGS="$CXXFLAGS $flag_sse41"
7996 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7997     #include <smmintrin.h>
7998     int main () {
7999         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8000         c = _mm_cmpeq_epi64 (a, b);
8001         return 0;
8002     }
8003     ])],
8004     [can_compile_sse41=yes],
8005     [can_compile_sse41=no])
8006 AC_LANG_POP([C++])
8007 CXXFLAGS=$save_CXXFLAGS
8008 AC_MSG_RESULT([${can_compile_sse41}])
8009 if test "${can_compile_sse41}" = "yes" ; then
8010     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8013 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8014 AC_LANG_PUSH([C++])
8015 save_CXXFLAGS=$CXXFLAGS
8016 CXXFLAGS="$CXXFLAGS $flag_sse42"
8017 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8018     #include <nmmintrin.h>
8019     int main () {
8020         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8021         c = _mm_cmpgt_epi64 (a, b);
8022         return 0;
8023     }
8024     ])],
8025     [can_compile_sse42=yes],
8026     [can_compile_sse42=no])
8027 AC_LANG_POP([C++])
8028 CXXFLAGS=$save_CXXFLAGS
8029 AC_MSG_RESULT([${can_compile_sse42}])
8030 if test "${can_compile_sse42}" = "yes" ; then
8031     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8034 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8035 AC_LANG_PUSH([C++])
8036 save_CXXFLAGS=$CXXFLAGS
8037 CXXFLAGS="$CXXFLAGS $flag_avx"
8038 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8039     #include <immintrin.h>
8040     int main () {
8041         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8042         c = _mm256_xor_ps(a, b);
8043         return 0;
8044     }
8045     ])],
8046     [can_compile_avx=yes],
8047     [can_compile_avx=no])
8048 AC_LANG_POP([C++])
8049 CXXFLAGS=$save_CXXFLAGS
8050 AC_MSG_RESULT([${can_compile_avx}])
8051 if test "${can_compile_avx}" = "yes" ; then
8052     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8055 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8056 AC_LANG_PUSH([C++])
8057 save_CXXFLAGS=$CXXFLAGS
8058 CXXFLAGS="$CXXFLAGS $flag_avx2"
8059 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8060     #include <immintrin.h>
8061     int main () {
8062         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8063         c = _mm256_maddubs_epi16(a, b);
8064         return 0;
8065     }
8066     ])],
8067     [can_compile_avx2=yes],
8068     [can_compile_avx2=no])
8069 AC_LANG_POP([C++])
8070 CXXFLAGS=$save_CXXFLAGS
8071 AC_MSG_RESULT([${can_compile_avx2}])
8072 if test "${can_compile_avx2}" = "yes" ; then
8073     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8076 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8077 AC_LANG_PUSH([C++])
8078 save_CXXFLAGS=$CXXFLAGS
8079 CXXFLAGS="$CXXFLAGS $flag_avx512"
8080 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8081     #include <immintrin.h>
8082     int main () {
8083         __m512i a = _mm512_loadu_si512(0);
8084         __m512d v1 = _mm512_load_pd(0);
8085         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8086         __m512d v2 = _mm512_abs_pd(v1);
8087         return 0;
8088     }
8089     ])],
8090     [can_compile_avx512=yes],
8091     [can_compile_avx512=no])
8092 AC_LANG_POP([C++])
8093 CXXFLAGS=$save_CXXFLAGS
8094 AC_MSG_RESULT([${can_compile_avx512}])
8095 if test "${can_compile_avx512}" = "yes" ; then
8096     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8097     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8100 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8101 AC_LANG_PUSH([C++])
8102 save_CXXFLAGS=$CXXFLAGS
8103 CXXFLAGS="$CXXFLAGS $flag_f16c"
8104 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8105     #include <immintrin.h>
8106     int main () {
8107         __m128i a = _mm_set1_epi32 (0);
8108         __m128 c;
8109         c = _mm_cvtph_ps(a);
8110         return 0;
8111     }
8112     ])],
8113     [can_compile_f16c=yes],
8114     [can_compile_f16c=no])
8115 AC_LANG_POP([C++])
8116 CXXFLAGS=$save_CXXFLAGS
8117 AC_MSG_RESULT([${can_compile_f16c}])
8118 if test "${can_compile_f16c}" = "yes" ; then
8119     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8122 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8123 AC_LANG_PUSH([C++])
8124 save_CXXFLAGS=$CXXFLAGS
8125 CXXFLAGS="$CXXFLAGS $flag_fma"
8126 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8127     #include <immintrin.h>
8128     int main () {
8129         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8130         d = _mm256_fmadd_ps(a, b, c);
8131         return 0;
8132     }
8133     ])],
8134     [can_compile_fma=yes],
8135     [can_compile_fma=no])
8136 AC_LANG_POP([C++])
8137 CXXFLAGS=$save_CXXFLAGS
8138 AC_MSG_RESULT([${can_compile_fma}])
8139 if test "${can_compile_fma}" = "yes" ; then
8140     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8143 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8144 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8145 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8146 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8147 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8148 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8149 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8150 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8151 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8152 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8154 dnl ===================================================================
8155 dnl system stl sanity tests
8156 dnl ===================================================================
8157 if test "$_os" != "WINNT"; then
8159     AC_LANG_PUSH([C++])
8161     save_CPPFLAGS="$CPPFLAGS"
8162     if test -n "$MACOSX_SDK_PATH"; then
8163         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8164     fi
8166     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8167     # only.
8168     if test "$CPP_LIBRARY" = GLIBCXX; then
8169         dnl gcc#19664, gcc#22482, rhbz#162935
8170         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8171         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8172         AC_MSG_RESULT([$stlvisok])
8173         if test "$stlvisok" = "no"; then
8174             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8175         fi
8176     fi
8178     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8179     # when we don't make any dynamic libraries?
8180     if test "$DISABLE_DYNLOADING" = ""; then
8181         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8182         cat > conftestlib1.cc <<_ACEOF
8183 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8184 struct S2: S1<int> { virtual ~S2(); };
8185 S2::~S2() {}
8186 _ACEOF
8187         cat > conftestlib2.cc <<_ACEOF
8188 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8189 struct S2: S1<int> { virtual ~S2(); };
8190 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8191 _ACEOF
8192         gccvisinlineshiddenok=yes
8193         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8194             gccvisinlineshiddenok=no
8195         else
8196             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8197             dnl known to not work with -z defs (unsetting which makes the test
8198             dnl moot, though):
8199             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8200             if test "$COM_IS_CLANG" = TRUE; then
8201                 for i in $CXX $CXXFLAGS; do
8202                     case $i in
8203                     -fsanitize=*)
8204                         my_linkflagsnoundefs=
8205                         break
8206                         ;;
8207                     esac
8208                 done
8209             fi
8210             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8211                 gccvisinlineshiddenok=no
8212             fi
8213         fi
8215         rm -fr libconftest*
8216         AC_MSG_RESULT([$gccvisinlineshiddenok])
8217         if test "$gccvisinlineshiddenok" = "no"; then
8218             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8219         fi
8220     fi
8222    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8223     cat >visibility.cxx <<_ACEOF
8224 #pragma GCC visibility push(hidden)
8225 struct __attribute__ ((visibility ("default"))) TestStruct {
8226   static void Init();
8228 __attribute__ ((visibility ("default"))) void TestFunc() {
8229   TestStruct::Init();
8231 _ACEOF
8232     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8233         gccvisbroken=yes
8234     else
8235         case "$host_cpu" in
8236         i?86|x86_64)
8237             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8238                 gccvisbroken=no
8239             else
8240                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8241                     gccvisbroken=no
8242                 else
8243                     gccvisbroken=yes
8244                 fi
8245             fi
8246             ;;
8247         *)
8248             gccvisbroken=no
8249             ;;
8250         esac
8251     fi
8252     rm -f visibility.s visibility.cxx
8254     AC_MSG_RESULT([$gccvisbroken])
8255     if test "$gccvisbroken" = "yes"; then
8256         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8257     fi
8259     CPPFLAGS="$save_CPPFLAGS"
8261     AC_MSG_CHECKING([if CET endbranch is recognized])
8262 cat > endbr.s <<_ACEOF
8263 endbr32
8264 _ACEOF
8265     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8266     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8267         AC_MSG_RESULT([yes])
8268         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8269     else
8270         AC_MSG_RESULT([no])
8271     fi
8272     rm -f endbr.s endbr.o
8273     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8275     AC_LANG_POP([C++])
8278 dnl ===================================================================
8279 dnl  Clang++ tests
8280 dnl ===================================================================
8282 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8283 if test "$GCC" = "yes"; then
8284     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8285     AC_LANG_PUSH([C++])
8286     save_CXXFLAGS=$CXXFLAGS
8287     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8288     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8289     CXXFLAGS=$save_CXXFLAGS
8290     AC_LANG_POP([C++])
8291     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8292         AC_MSG_RESULT([yes])
8293     else
8294         AC_MSG_RESULT([no])
8295     fi
8297 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8299 dnl ===================================================================
8300 dnl Compiler plugins
8301 dnl ===================================================================
8303 COMPILER_PLUGINS=
8304 # currently only Clang
8306 if test "$COM_IS_CLANG" != "TRUE"; then
8307     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8308         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8309         enable_compiler_plugins=no
8310     fi
8313 COMPILER_PLUGINS_COM_IS_CLANG=
8314 if test "$COM_IS_CLANG" = "TRUE"; then
8315     if test -n "$enable_compiler_plugins"; then
8316         compiler_plugins="$enable_compiler_plugins"
8317     elif test -n "$ENABLE_DBGUTIL"; then
8318         compiler_plugins=test
8319     else
8320         compiler_plugins=no
8321     fi
8322     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8323         if test "$CLANGVER" -lt 120001; then
8324             if test "$compiler_plugins" = yes; then
8325                 AC_MSG_ERROR(
8326                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8327             else
8328                 compiler_plugins=no
8329             fi
8330         fi
8331     fi
8332     if test "$compiler_plugins" != "no"; then
8333         dnl The prefix where Clang resides, override to where Clang resides if
8334         dnl using a source build:
8335         if test -z "$CLANGDIR"; then
8336             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8337         fi
8338         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8339         if test -z "$COMPILER_PLUGINS_CXX"; then
8340             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8341         fi
8342         clangbindir=$CLANGDIR/bin
8343         if test "$build_os" = "cygwin"; then
8344             clangbindir=$(cygpath -u "$clangbindir")
8345         fi
8346         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8347         if test -n "$LLVM_CONFIG"; then
8348             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8349             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8350             if test -z "$CLANGLIBDIR"; then
8351                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8352             fi
8353             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8354             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8355             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8356                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8357                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8358                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8359                 fi
8360             fi
8361             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8362             clangobjdir=$($LLVM_CONFIG --obj-root)
8363             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8364                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8365             fi
8366         fi
8367         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8368         AC_LANG_PUSH([C++])
8369         save_CXX=$CXX
8370         save_CXXCPP=$CXXCPP
8371         save_CPPFLAGS=$CPPFLAGS
8372         save_CXXFLAGS=$CXXFLAGS
8373         save_LDFLAGS=$LDFLAGS
8374         save_LIBS=$LIBS
8375         CXX=$COMPILER_PLUGINS_CXX
8376         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8377         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8378         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8379         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8380             [COMPILER_PLUGINS=TRUE],
8381             [
8382             if test "$compiler_plugins" = "yes"; then
8383                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8384             else
8385                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8386                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8387             fi
8388             ])
8389         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8390         dnl comment in compilerplugins/Makefile-clang.mk:
8391         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8392             LDFLAGS=""
8393             AC_MSG_CHECKING([for clang libraries to use])
8394             if test -z "$CLANGTOOLLIBS"; then
8395                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8396                 AC_LINK_IFELSE([
8397                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8398                         [[ clang::FullSourceLoc().dump(); ]])
8399                 ],[CLANGTOOLLIBS="$LIBS"],[])
8400             fi
8401             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8402             dnl list of individual -lclang* (but note that that list can become outdated over time,
8403             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8404             dnl needs to include -lclangSupport now"):
8405             if test -z "$CLANGTOOLLIBS"; then
8406                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8407  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8408                 AC_LINK_IFELSE([
8409                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8410                         [[ clang::FullSourceLoc().dump(); ]])
8411                 ],[CLANGTOOLLIBS="$LIBS"],[])
8412             fi
8413             AC_MSG_RESULT([$CLANGTOOLLIBS])
8414             if test -z "$CLANGTOOLLIBS"; then
8415                 if test "$compiler_plugins" = "yes"; then
8416                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8417                 else
8418                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8419                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8420                 fi
8421                 COMPILER_PLUGINS=
8422             fi
8423             if test -n "$COMPILER_PLUGINS"; then
8424                 if test -z "$CLANGSYSINCLUDE"; then
8425                     if test -n "$LLVM_CONFIG"; then
8426                         # Path to the clang system headers (no idea if there's a better way to get it).
8427                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8428                     fi
8429                 fi
8430             fi
8431         fi
8432         CXX=$save_CXX
8433         CXXCPP=$save_CXXCPP
8434         CPPFLAGS=$save_CPPFLAGS
8435         CXXFLAGS=$save_CXXFLAGS
8436         LDFLAGS=$save_LDFLAGS
8437         LIBS="$save_LIBS"
8438         AC_LANG_POP([C++])
8440         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8441         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8442             #ifndef __clang__
8443             you lose
8444             #endif
8445             int foo=42;
8446             ]])],
8447             [AC_MSG_RESULT([yes])
8448              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8449             [AC_MSG_RESULT([no])])
8450         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8451     fi
8452 else
8453     if test "$enable_compiler_plugins" = "yes"; then
8454         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8455     fi
8457 COMPILER_PLUGINS_ANALYZER_PCH=
8458 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8459     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8461 AC_SUBST(COMPILER_PLUGINS)
8462 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8463 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8464 AC_SUBST(COMPILER_PLUGINS_CXX)
8465 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8466 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8467 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8468 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8469 AC_SUBST(CLANGDIR)
8470 AC_SUBST(CLANGLIBDIR)
8471 AC_SUBST(CLANGTOOLLIBS)
8472 AC_SUBST(CLANGSYSINCLUDE)
8474 # Plugin to help linker.
8475 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8476 # This makes --enable-lto build with clang work.
8477 AC_SUBST(LD_PLUGIN)
8479 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8480 AC_SUBST(HAVE_POSIX_FALLOCATE)
8482 JITC_PROCESSOR_TYPE=""
8483 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8484     # IBMs JDK needs this...
8485     JITC_PROCESSOR_TYPE=6
8486     export JITC_PROCESSOR_TYPE
8488 AC_SUBST([JITC_PROCESSOR_TYPE])
8490 # Misc Windows Stuff
8491 AC_ARG_WITH(ucrt-dir,
8492     AS_HELP_STRING([--with-ucrt-dir],
8493         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8494         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8495         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8496             Windows6.1-KB2999226-x64.msu
8497             Windows6.1-KB2999226-x86.msu
8498             Windows8.1-KB2999226-x64.msu
8499             Windows8.1-KB2999226-x86.msu
8500             Windows8-RT-KB2999226-x64.msu
8501             Windows8-RT-KB2999226-x86.msu
8502         A zip archive including those files is available from Microsoft site:
8503         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8506 UCRT_REDISTDIR="$with_ucrt_dir"
8507 if test $_os = "WINNT"; then
8508     find_msvc_x64_dlls
8509     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8510     MSVC_DLLS="$msvcdlls"
8511     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8512         with_redist=143
8513     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8514         with_redist=142
8515     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8516         with_redist=141
8517     fi
8518     for i in $PKGFORMAT; do
8519         if test "$i" = msi; then
8520             find_msms "$with_redist"
8521             if test -n "$msmdir"; then
8522                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8523                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8524             fi
8525             break
8526         fi
8527     done
8529     if test "$UCRT_REDISTDIR" = "no"; then
8530         dnl explicitly disabled
8531         UCRT_REDISTDIR=""
8532     else
8533         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8534                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8535                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8536                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8537                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8538                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8539             UCRT_REDISTDIR=""
8540             if test -n "$PKGFORMAT"; then
8541                for i in $PKGFORMAT; do
8542                    case "$i" in
8543                    msi)
8544                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8545                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8546                        ;;
8547                    esac
8548                done
8549             fi
8550         fi
8551     fi
8554 AC_SUBST(UCRT_REDISTDIR)
8555 AC_SUBST(MSVC_DLL_PATH)
8556 AC_SUBST(MSVC_DLLS)
8557 AC_SUBST(MSM_PATH)
8560 dnl ===================================================================
8561 dnl Checks for Java
8562 dnl ===================================================================
8563 if test "$ENABLE_JAVA" != ""; then
8565     # Windows-specific tests
8566     if test "$build_os" = "cygwin"; then
8567         if test -z "$with_jdk_home"; then
8568             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8569             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8570             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8571             if test -n "$regvalue"; then
8572                 ver=$regvalue
8573                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8574                 with_jdk_home=$regvalue
8575             fi
8576             howfound="found automatically"
8577         else
8578             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8579             howfound="you passed"
8580         fi
8582         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8583             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 17])
8584         fi
8585     fi
8587     # 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.
8588     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8589     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8590         with_jdk_home=`/usr/libexec/java_home`
8591     fi
8593     JAVA_HOME=; export JAVA_HOME
8594     if test -z "$with_jdk_home"; then
8595         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8596     else
8597         _java_path="$with_jdk_home/bin/$with_java"
8598         dnl Check if there is a Java interpreter at all.
8599         if test -x "$_java_path"; then
8600             JAVAINTERPRETER=$_java_path
8601         else
8602             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8603         fi
8604     fi
8606     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8607     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8608     dnl loaded by java to run JunitTests:
8609     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8610         shortjdkhome=`cygpath -d "$with_jdk_home"`
8611         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
8612             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8613             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8614         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
8615             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8616             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8617         fi
8619         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8620             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8621         fi
8622         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8623     elif test "$cross_compiling" != "yes"; then
8624         case $CPUNAME in
8625             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8626                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8627                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8628                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8629                 fi
8630                 ;;
8631             *) # assumption: everything else 32-bit
8632                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8633                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8634                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8635                 fi
8636                 ;;
8637         esac
8638     fi
8641 dnl ===================================================================
8642 dnl Checks for JDK.
8643 dnl ===================================================================
8645 # Whether all the complexity here actually is needed any more or not, no idea.
8647 JDK_SECURITYMANAGER_DISALLOWED=
8648 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8649     _gij_longver=0
8650     AC_MSG_CHECKING([the installed JDK])
8651     if test -n "$JAVAINTERPRETER"; then
8652         dnl java -version sends output to stderr!
8653         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8654             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8655         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8656             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8657         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8658             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8659         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8660             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8661         else
8662             JDK=sun
8664             dnl Sun JDK specific tests
8665             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8666             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8668             if test "$_jdk_ver" -lt 170000; then
8669                 AC_MSG_ERROR([JDK is too old, you need at least 17 ($_jdk_ver < 170000)])
8670             fi
8671             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8672             dnl completely removed in some Java version > 18 (see
8673             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8674             if test "$_jdk_ver" -ge 180000; then
8675                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8676             fi
8678             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8679             if test "$_os" = "WINNT"; then
8680                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8681             fi
8682             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8684             # set to limit VM usage for JunitTests
8685             JAVAIFLAGS=-Xmx64M
8686             # set to limit VM usage for javac
8687             JAVACFLAGS=-J-Xmx128M
8688         fi
8689     else
8690         AC_MSG_ERROR([Java not found. You need at least JDK 17])
8691     fi
8692 else
8693     if test -z "$ENABLE_JAVA"; then
8694         dnl Java disabled
8695         JAVA_HOME=
8696         export JAVA_HOME
8697     elif test "$cross_compiling" = "yes"; then
8698         # Just assume compatibility of build and host JDK
8699         JDK=$JDK_FOR_BUILD
8700         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8701     fi
8704 dnl ===================================================================
8705 dnl Checks for javac
8706 dnl ===================================================================
8707 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8708     javacompiler="javac"
8709     : ${JAVA_SOURCE_VER=8}
8710     : ${JAVA_TARGET_VER=8}
8711     if test -z "$with_jdk_home"; then
8712         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8713     else
8714         _javac_path="$with_jdk_home/bin/$javacompiler"
8715         dnl Check if there is a Java compiler at all.
8716         if test -x "$_javac_path"; then
8717             JAVACOMPILER=$_javac_path
8718         fi
8719     fi
8720     if test -z "$JAVACOMPILER"; then
8721         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8722     fi
8723     if test "$build_os" = "cygwin"; then
8724         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8725             JAVACOMPILER="${JAVACOMPILER}.exe"
8726         fi
8727         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8728     fi
8731 dnl ===================================================================
8732 dnl Checks for javadoc
8733 dnl ===================================================================
8734 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8735     if test -z "$with_jdk_home"; then
8736         AC_PATH_PROG(JAVADOC, javadoc)
8737     else
8738         _javadoc_path="$with_jdk_home/bin/javadoc"
8739         dnl Check if there is a javadoc at all.
8740         if test -x "$_javadoc_path"; then
8741             JAVADOC=$_javadoc_path
8742         else
8743             AC_PATH_PROG(JAVADOC, javadoc)
8744         fi
8745     fi
8746     if test -z "$JAVADOC"; then
8747         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8748     fi
8749     if test "$build_os" = "cygwin"; then
8750         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8751             JAVADOC="${JAVADOC}.exe"
8752         fi
8753         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8754     fi
8756     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8757     JAVADOCISGJDOC="yes"
8758     fi
8760 AC_SUBST(JAVADOC)
8761 AC_SUBST(JAVADOCISGJDOC)
8763 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8764     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8765     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8766         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8767            # try to recover first by looking whether we have an alternative
8768            # system as in Debian or newer SuSEs where following /usr/bin/javac
8769            # over /etc/alternatives/javac leads to the right bindir where we
8770            # just need to strip a bit away to get a valid JAVA_HOME
8771            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8772         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8773             # maybe only one level of symlink (e.g. on Mac)
8774             JAVA_HOME=$(readlink $JAVACOMPILER)
8775             if test "$(dirname $JAVA_HOME)" = "."; then
8776                 # we've got no path to trim back
8777                 JAVA_HOME=""
8778             fi
8779         else
8780             # else warn
8781             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8782             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8783             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8784             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8785         fi
8786         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8787         if test "$JAVA_HOME" != "/usr"; then
8788             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8789                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8790                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8791                 dnl Tiger already returns a JDK path...
8792                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8793             else
8794                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8795                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8796                 dnl that checks which version to run
8797                 if test -f "$JAVA_HOME"; then
8798                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8799                 fi
8800             fi
8801         fi
8802     fi
8803     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8805     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8806     if test -z "$JAVA_HOME"; then
8807         if test "x$with_jdk_home" = "x"; then
8808             cat > findhome.java <<_ACEOF
8809 [import java.io.File;
8811 class findhome
8813     public static void main(String args[])
8814     {
8815         String jrelocation = System.getProperty("java.home");
8816         File jre = new File(jrelocation);
8817         System.out.println(jre.getParent());
8818     }
8820 _ACEOF
8821             AC_MSG_CHECKING([if javac works])
8822             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8823             AC_TRY_EVAL(javac_cmd)
8824             if test $? = 0 -a -f ./findhome.class; then
8825                 AC_MSG_RESULT([javac works])
8826             else
8827                 echo "configure: javac test failed" >&5
8828                 cat findhome.java >&5
8829                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8830             fi
8831             AC_MSG_CHECKING([if gij knows its java.home])
8832             JAVA_HOME=`$JAVAINTERPRETER findhome`
8833             if test $? = 0 -a "$JAVA_HOME" != ""; then
8834                 AC_MSG_RESULT([$JAVA_HOME])
8835             else
8836                 echo "configure: java test failed" >&5
8837                 cat findhome.java >&5
8838                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8839             fi
8840             # clean-up after ourselves
8841             rm -f ./findhome.java ./findhome.class
8842         else
8843             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8844         fi
8845     fi
8847     # now check if $JAVA_HOME is really valid
8848     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8849         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8850             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8851             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8852             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8853             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8854             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8855             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8856         fi
8857     fi
8858     PathFormat "$JAVA_HOME"
8859     JAVA_HOME="$formatted_path"
8862 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8863     "$_os" != Darwin
8864 then
8865     AC_MSG_CHECKING([for JAWT lib])
8866     if test "$_os" = WINNT; then
8867         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8868         JAWTLIB=jawt.lib
8869     else
8870         case "$host_cpu" in
8871         arm*)
8872             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8873             JAVA_ARCH=$my_java_arch
8874             ;;
8875         i*86)
8876             my_java_arch=i386
8877             ;;
8878         m68k)
8879             my_java_arch=m68k
8880             ;;
8881         powerpc)
8882             my_java_arch=ppc
8883             ;;
8884         powerpc64)
8885             my_java_arch=ppc64
8886             ;;
8887         powerpc64le)
8888             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8889             JAVA_ARCH=$my_java_arch
8890             ;;
8891         sparc64)
8892             my_java_arch=sparcv9
8893             ;;
8894         x86_64)
8895             my_java_arch=amd64
8896             ;;
8897         *)
8898             my_java_arch=$host_cpu
8899             ;;
8900         esac
8901         # This is where JDK9 puts the library
8902         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8903             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8904         else
8905             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8906         fi
8907         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8908     fi
8909     AC_MSG_RESULT([$JAWTLIB])
8911 AC_SUBST(JAWTLIB)
8913 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8914     case "$host_os" in
8916     cygwin*|wsl*)
8917         JAVAINC="-I$JAVA_HOME/include/win32"
8918         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8919         ;;
8921     darwin*)
8922         if test -d "$JAVA_HOME/include/darwin"; then
8923             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8924         else
8925             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8926         fi
8927         ;;
8929     dragonfly*)
8930         JAVAINC="-I$JAVA_HOME/include"
8931         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8932         ;;
8934     freebsd*)
8935         JAVAINC="-I$JAVA_HOME/include"
8936         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8937         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8938         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8939         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8940         ;;
8942     k*bsd*-gnu*)
8943         JAVAINC="-I$JAVA_HOME/include"
8944         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8945         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8946         ;;
8948     linux-gnu*)
8949         JAVAINC="-I$JAVA_HOME/include"
8950         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8951         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8952         ;;
8954     *netbsd*)
8955         JAVAINC="-I$JAVA_HOME/include"
8956         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8957         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8958        ;;
8960     openbsd*)
8961         JAVAINC="-I$JAVA_HOME/include"
8962         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8963         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8964         ;;
8966     solaris*)
8967         JAVAINC="-I$JAVA_HOME/include"
8968         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8969         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8970         ;;
8971     esac
8973 SOLARINC="$SOLARINC $JAVAINC"
8975 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8976     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8977     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8978     JDK_FOR_BUILD=$JDK
8979     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
8982 AC_SUBST(JAVACFLAGS)
8983 AC_SUBST(JAVACOMPILER)
8984 AC_SUBST(JAVAINTERPRETER)
8985 AC_SUBST(JAVAIFLAGS)
8986 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8987 AC_SUBST(JAVA_HOME)
8988 AC_SUBST(JAVA_HOME_FOR_BUILD)
8989 AC_SUBST(JDK)
8990 AC_SUBST(JDK_FOR_BUILD)
8991 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
8992 AC_SUBST(JAVA_SOURCE_VER)
8993 AC_SUBST(JAVA_TARGET_VER)
8996 dnl ===================================================================
8997 dnl Export file validation
8998 dnl ===================================================================
8999 AC_MSG_CHECKING([whether to enable export file validation])
9000 if test "$with_export_validation" != "no"; then
9001     if test -z "$ENABLE_JAVA"; then
9002         if test "$with_export_validation" = "yes"; then
9003             AC_MSG_ERROR([requested, but Java is disabled])
9004         else
9005             AC_MSG_RESULT([no, as Java is disabled])
9006         fi
9007     elif ! test -d "${SRC_ROOT}/schema"; then
9008         if test "$with_export_validation" = "yes"; then
9009             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9010         else
9011             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9012         fi
9013     else
9014         AC_MSG_RESULT([yes])
9015         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9017         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9018         if test -z "$ODFVALIDATOR"; then
9019             # remember to download the ODF toolkit with validator later
9020             AC_MSG_NOTICE([no odfvalidator found, will download it])
9021             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9022             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9024             # and fetch name of odfvalidator jar name from download.lst
9025             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9026             AC_SUBST(ODFVALIDATOR_JAR)
9028             if test -z "$ODFVALIDATOR_JAR"; then
9029                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9030             fi
9031         fi
9032         if test "$build_os" = "cygwin"; then
9033             # In case of Cygwin it will be executed from Windows,
9034             # so we need to run bash and absolute path to validator
9035             # so instead of "odfvalidator" it will be
9036             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9037             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9038         else
9039             ODFVALIDATOR="sh $ODFVALIDATOR"
9040         fi
9041         AC_SUBST(ODFVALIDATOR)
9044         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9045         if test -z "$OFFICEOTRON"; then
9046             # remember to download the officeotron with validator later
9047             AC_MSG_NOTICE([no officeotron found, will download it])
9048             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9049             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9051             # and fetch name of officeotron jar name from download.lst
9052             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9053             AC_SUBST(OFFICEOTRON_JAR)
9055             if test -z "$OFFICEOTRON_JAR"; then
9056                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9057             fi
9058         else
9059             # check version of existing officeotron
9060             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9061             if test 0"$OFFICEOTRON_VER" -lt 704; then
9062                 AC_MSG_ERROR([officeotron too old])
9063             fi
9064         fi
9065         if test "$build_os" = "cygwin"; then
9066             # In case of Cygwin it will be executed from Windows,
9067             # so we need to run bash and absolute path to validator
9068             # so instead of "odfvalidator" it will be
9069             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9070             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9071         else
9072             OFFICEOTRON="sh $OFFICEOTRON"
9073         fi
9074     fi
9075     AC_SUBST(OFFICEOTRON)
9076 else
9077     AC_MSG_RESULT([no])
9080 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9081 if test "$with_bffvalidator" != "no"; then
9082     AC_DEFINE(HAVE_BFFVALIDATOR)
9084     if test "$with_export_validation" = "no"; then
9085         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9086     fi
9088     if test "$with_bffvalidator" = "yes"; then
9089         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9090     else
9091         BFFVALIDATOR="$with_bffvalidator"
9092     fi
9094     if test "$build_os" = "cygwin"; then
9095         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9096             AC_MSG_RESULT($BFFVALIDATOR)
9097         else
9098             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9099         fi
9100     elif test -n "$BFFVALIDATOR"; then
9101         # We are not in Cygwin but need to run Windows binary with wine
9102         AC_PATH_PROGS(WINE, wine)
9104         # so swap in a shell wrapper that converts paths transparently
9105         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9106         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9107         AC_SUBST(BFFVALIDATOR_EXE)
9108         AC_MSG_RESULT($BFFVALIDATOR)
9109     else
9110         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9111     fi
9112     AC_SUBST(BFFVALIDATOR)
9113 else
9114     AC_MSG_RESULT([no])
9117 dnl ===================================================================
9118 dnl Check for epm (not needed for Windows)
9119 dnl ===================================================================
9120 AC_MSG_CHECKING([whether to enable EPM for packing])
9121 if test "$enable_epm" = "yes"; then
9122     AC_MSG_RESULT([yes])
9123     if test "$_os" != "WINNT"; then
9124         if test $_os = Darwin; then
9125             EPM=internal
9126         elif test -n "$with_epm"; then
9127             EPM=$with_epm
9128         else
9129             AC_PATH_PROG(EPM, epm, no)
9130         fi
9131         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9132             AC_MSG_NOTICE([EPM will be built.])
9133             BUILD_TYPE="$BUILD_TYPE EPM"
9134             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9135         else
9136             # Gentoo has some epm which is something different...
9137             AC_MSG_CHECKING([whether the found epm is the right epm])
9138             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9139                 AC_MSG_RESULT([yes])
9140             else
9141                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9142             fi
9143             AC_MSG_CHECKING([epm version])
9144             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9145             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9146                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9147                 AC_MSG_RESULT([OK, >= 3.7])
9148             else
9149                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9150                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9151             fi
9152         fi
9153     fi
9155     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9156         AC_MSG_CHECKING([for rpm])
9157         for a in "$RPM" rpmbuild rpm; do
9158             $a --usage >/dev/null 2> /dev/null
9159             if test $? -eq 0; then
9160                 RPM=$a
9161                 break
9162             else
9163                 $a --version >/dev/null 2> /dev/null
9164                 if test $? -eq 0; then
9165                     RPM=$a
9166                     break
9167                 fi
9168             fi
9169         done
9170         if test -z "$RPM"; then
9171             AC_MSG_ERROR([not found])
9172         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9173             RPM_PATH=`which $RPM`
9174             AC_MSG_RESULT([$RPM_PATH])
9175             SCPDEFS="$SCPDEFS -DWITH_RPM"
9176         else
9177             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9178         fi
9179     fi
9180     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9181         AC_PATH_PROG(DPKG, dpkg, no)
9182         if test "$DPKG" = "no"; then
9183             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9184         fi
9185     fi
9186     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9187        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9188         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9189             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9190                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9191                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9192                     AC_MSG_RESULT([yes])
9193                 else
9194                     AC_MSG_RESULT([no])
9195                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9196                         _pt="rpm"
9197                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9198                         add_warning "the rpms will need to be installed with --nodeps"
9199                     else
9200                         _pt="pkg"
9201                     fi
9202                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9203                     add_warning "the ${_pt}s will not be relocatable"
9204                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9205                                  relocation will work, you need to patch your epm with the
9206                                  patch in epm/epm-3.7.patch or build with
9207                                  --with-epm=internal which will build a suitable epm])
9208                 fi
9209             fi
9210         fi
9211     fi
9212     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9213         AC_PATH_PROG(PKGMK, pkgmk, no)
9214         if test "$PKGMK" = "no"; then
9215             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9216         fi
9217     fi
9218     AC_SUBST(RPM)
9219     AC_SUBST(DPKG)
9220     AC_SUBST(PKGMK)
9221 else
9222     for i in $PKGFORMAT; do
9223         case "$i" in
9224         bsd | deb | pkg | rpm | native | portable)
9225             AC_MSG_ERROR(
9226                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9227             ;;
9228         esac
9229     done
9230     AC_MSG_RESULT([no])
9231     EPM=NO
9233 AC_SUBST(EPM)
9235 ENABLE_LWP=
9236 if test "$enable_lotuswordpro" = "yes"; then
9237     ENABLE_LWP="TRUE"
9239 AC_SUBST(ENABLE_LWP)
9241 dnl ===================================================================
9242 dnl Check for building ODK
9243 dnl ===================================================================
9244 AC_MSG_CHECKING([whether to build the ODK])
9245 if test "$enable_odk" = yes; then
9246     if test "$DISABLE_DYNLOADING" = TRUE; then
9247         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9248     fi
9249     AC_MSG_RESULT([yes])
9250     BUILD_TYPE="$BUILD_TYPE ODK"
9251 else
9252     AC_MSG_RESULT([no])
9255 if test "$enable_odk" != yes; then
9256     unset DOXYGEN
9257 else
9258     if test "$with_doxygen" = no; then
9259         AC_MSG_CHECKING([for doxygen])
9260         unset DOXYGEN
9261         AC_MSG_RESULT([no])
9262     else
9263         if test "$with_doxygen" = yes; then
9264             AC_PATH_PROG([DOXYGEN], [doxygen])
9265             if test -z "$DOXYGEN"; then
9266                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9267             fi
9268             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9269                 if ! dot -V 2>/dev/null; then
9270                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9271                 fi
9272             fi
9273         else
9274             AC_MSG_CHECKING([for doxygen])
9275             DOXYGEN=$with_doxygen
9276             AC_MSG_RESULT([$DOXYGEN])
9277         fi
9278         if test -n "$DOXYGEN"; then
9279             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9280             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9281             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9282                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9283             fi
9284         fi
9285     fi
9287 AC_SUBST([DOXYGEN])
9289 dnl ==================================================================
9290 dnl libfuzzer
9291 dnl ==================================================================
9292 AC_MSG_CHECKING([whether to enable fuzzers])
9293 if test "$enable_fuzzers" != yes; then
9294     AC_MSG_RESULT([no])
9295 else
9296     if test -z $LIB_FUZZING_ENGINE; then
9297       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9298     fi
9299     AC_MSG_RESULT([yes])
9300     ENABLE_FUZZERS="TRUE"
9301     AC_DEFINE([ENABLE_FUZZERS],1)
9302     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9304 AC_SUBST(LIB_FUZZING_ENGINE)
9306 dnl ===================================================================
9307 dnl Check for system zlib
9308 dnl ===================================================================
9309 if test "$with_system_zlib" = "auto"; then
9310     case "$_os" in
9311     WINNT)
9312         with_system_zlib="$with_system_libs"
9313         ;;
9314     *)
9315         if test "$enable_fuzzers" != "yes"; then
9316             with_system_zlib=yes
9317         else
9318             with_system_zlib=no
9319         fi
9320         ;;
9321     esac
9324 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9325 dnl and has no pkg-config for it at least on some tinderboxes,
9326 dnl so leaving that out for now
9327 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9328 AC_MSG_CHECKING([which zlib to use])
9329 if test "$with_system_zlib" = "yes"; then
9330     AC_MSG_RESULT([external])
9331     SYSTEM_ZLIB=TRUE
9332     AC_CHECK_HEADER(zlib.h, [],
9333         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9334     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9335         [AC_MSG_ERROR(zlib not found or functional)], [])
9336 else
9337     AC_MSG_RESULT([internal])
9338     SYSTEM_ZLIB=
9339     BUILD_TYPE="$BUILD_TYPE ZLIB"
9340     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9341     if test "$COM" = "MSC"; then
9342         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9343     else
9344         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9345     fi
9347 AC_SUBST(ZLIB_CFLAGS)
9348 AC_SUBST(ZLIB_LIBS)
9349 AC_SUBST(SYSTEM_ZLIB)
9351 dnl ===================================================================
9352 dnl Check for system jpeg
9353 dnl ===================================================================
9354 AC_MSG_CHECKING([which libjpeg to use])
9355 if test "$with_system_jpeg" = "yes"; then
9356     AC_MSG_RESULT([external])
9357     SYSTEM_LIBJPEG=TRUE
9358     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9359         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9360     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9361         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9362 else
9363     SYSTEM_LIBJPEG=
9364     AC_MSG_RESULT([internal, libjpeg-turbo])
9365     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9367     case "$host_cpu" in
9368     x86_64 | amd64 | i*86 | x86 | ia32)
9369         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9370         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9371             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9372                 NASM="$LODE_HOME/opt/bin/nasm"
9373             elif test -x "/opt/lo/bin/nasm"; then
9374                 NASM="/opt/lo/bin/nasm"
9375             fi
9376         fi
9378         if test -n "$NASM"; then
9379             AC_MSG_CHECKING([for object file format of host system])
9380             case "$host_os" in
9381               cygwin* | mingw* | pw32* | wsl*)
9382                 case "$host_cpu" in
9383                   x86_64)
9384                     objfmt='Win64-COFF'
9385                     ;;
9386                   *)
9387                     objfmt='Win32-COFF'
9388                     ;;
9389                 esac
9390               ;;
9391               msdosdjgpp* | go32*)
9392                 objfmt='COFF'
9393               ;;
9394               os2-emx*) # not tested
9395                 objfmt='MSOMF' # obj
9396               ;;
9397               linux*coff* | linux*oldld*)
9398                 objfmt='COFF' # ???
9399               ;;
9400               linux*aout*)
9401                 objfmt='a.out'
9402               ;;
9403               linux*)
9404                 case "$host_cpu" in
9405                   x86_64)
9406                     objfmt='ELF64'
9407                     ;;
9408                   *)
9409                     objfmt='ELF'
9410                     ;;
9411                 esac
9412               ;;
9413               kfreebsd* | freebsd* | netbsd* | openbsd*)
9414                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9415                   objfmt='BSD-a.out'
9416                 else
9417                   case "$host_cpu" in
9418                     x86_64 | amd64)
9419                       objfmt='ELF64'
9420                       ;;
9421                     *)
9422                       objfmt='ELF'
9423                       ;;
9424                   esac
9425                 fi
9426               ;;
9427               solaris* | sunos* | sysv* | sco*)
9428                 case "$host_cpu" in
9429                   x86_64)
9430                     objfmt='ELF64'
9431                     ;;
9432                   *)
9433                     objfmt='ELF'
9434                     ;;
9435                 esac
9436               ;;
9437               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9438                 case "$host_cpu" in
9439                   x86_64)
9440                     objfmt='Mach-O64'
9441                     ;;
9442                   *)
9443                     objfmt='Mach-O'
9444                     ;;
9445                 esac
9446               ;;
9447               *)
9448                 objfmt='ELF ?'
9449               ;;
9450             esac
9452             AC_MSG_RESULT([$objfmt])
9453             if test "$objfmt" = 'ELF ?'; then
9454               objfmt='ELF'
9455               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9456             fi
9458             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9459             case "$objfmt" in
9460               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9461               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9462               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9463               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9464               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9465               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9466               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9467               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9468               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9469               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9470               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9471             esac
9472             AC_MSG_RESULT([$NAFLAGS])
9474             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9475             cat > conftest.asm << EOF
9476             [%line __oline__ "configure"
9477                     section .text
9478                     global  _main,main
9479             _main:
9480             main:   xor     eax,eax
9481                     ret
9482             ]
9484             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9485             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9486               AC_MSG_RESULT(yes)
9487             else
9488               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9489               cat conftest.asm >&AS_MESSAGE_LOG_FD
9490               rm -rf conftest*
9491               AC_MSG_RESULT(no)
9492               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9493               NASM=""
9494             fi
9496         fi
9498         if test -z "$NASM"; then
9499 cat << _EOS
9500 ****************************************************************************
9501 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9502 To get one please:
9504 _EOS
9505             if test "$build_os" = "cygwin"; then
9506 cat << _EOS
9507 install a pre-compiled binary for Win32
9509 mkdir -p /opt/lo/bin
9510 cd /opt/lo/bin
9511 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9512 chmod +x nasm
9514 or get and install one from https://www.nasm.us/
9516 Then re-run autogen.sh
9518 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9519 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9521 _EOS
9522             else
9523 cat << _EOS
9524 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9526 _EOS
9527             fi
9528             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9529             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9530         fi
9531       ;;
9532     esac
9535 AC_SUBST(NASM)
9536 AC_SUBST(NAFLAGS)
9537 AC_SUBST(LIBJPEG_CFLAGS)
9538 AC_SUBST(LIBJPEG_LIBS)
9539 AC_SUBST(SYSTEM_LIBJPEG)
9541 dnl ===================================================================
9542 dnl Check for system clucene
9543 dnl ===================================================================
9544 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9545 if test "$SYSTEM_CLUCENE" = TRUE; then
9546     AC_LANG_PUSH([C++])
9547     save_CXXFLAGS=$CXXFLAGS
9548     save_CPPFLAGS=$CPPFLAGS
9549     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9550     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9551     dnl https://sourceforge.net/p/clucene/bugs/200/
9552     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9553     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9554                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9555     CXXFLAGS=$save_CXXFLAGS
9556     CPPFLAGS=$save_CPPFLAGS
9557     AC_LANG_POP([C++])
9558     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9561 dnl ===================================================================
9562 dnl Check for system expat
9563 dnl ===================================================================
9564 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9566 dnl ===================================================================
9567 dnl Check for system xmlsec
9568 dnl ===================================================================
9569 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9571 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9572 if test "$enable_eot" = "yes"; then
9573     ENABLE_EOT="TRUE"
9574     AC_DEFINE([ENABLE_EOT])
9575     AC_MSG_RESULT([yes])
9577     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9578 else
9579     ENABLE_EOT=
9580     AC_MSG_RESULT([no])
9582 AC_SUBST([ENABLE_EOT])
9584 dnl ===================================================================
9585 dnl Check for DLP libs
9586 dnl ===================================================================
9587 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9588 AS_IF([test "$COM" = "MSC"],
9589       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9590       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9592 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9593 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9595 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9597 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9599 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9600 AS_IF([test "$COM" = "MSC"],
9601       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9602       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9604 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9605 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9607 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9609 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9610 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9612 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9614 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9616 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9618 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9619 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9621 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9622 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9624 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9626 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9627 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9629 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9631 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9633 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9635 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9637 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9638 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9640 dnl ===================================================================
9641 dnl Check for system lcms2
9642 dnl ===================================================================
9643 if test "$with_system_lcms2" != "yes"; then
9644     SYSTEM_LCMS2=
9646 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9647 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9648 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9649 if test "$GCC" = "yes"; then
9650     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9652 if test "$COM" = "MSC"; then # override the above
9653     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9656 dnl ===================================================================
9657 dnl Check for system cppunit
9658 dnl ===================================================================
9659 if test "$_os" != "Android" ; then
9660     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9663 dnl ===================================================================
9664 dnl Check whether freetype is available
9666 dnl FreeType has 3 different kinds of versions
9667 dnl * release, like 2.4.10
9668 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9669 dnl * soname
9670 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9672 dnl 9.9.3 is 2.2.0
9673 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9674 dnl ===================================================================
9675 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9676 if test "x$ac_config_site_64bit_host" = xYES; then
9677     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9678 else
9679     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9681 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9683 # ===================================================================
9684 # Check for system libxslt
9685 # to prevent incompatibilities between internal libxml2 and external libxslt,
9686 # or vice versa, use with_system_libxml here
9687 # ===================================================================
9688 if test "$with_system_libxml" = "auto"; then
9689     case "$_os" in
9690     WINNT|iOS|Android)
9691         with_system_libxml="$with_system_libs"
9692         ;;
9693     Emscripten)
9694         with_system_libxml=no
9695         ;;
9696     *)
9697         if test "$enable_fuzzers" != "yes"; then
9698             with_system_libxml=yes
9699         else
9700             with_system_libxml=no
9701         fi
9702         ;;
9703     esac
9706 AC_MSG_CHECKING([which libxslt to use])
9707 if test "$with_system_libxml" = "yes"; then
9708     AC_MSG_RESULT([external])
9709     SYSTEM_LIBXSLT=TRUE
9710     if test "$_os" = "Darwin"; then
9711         dnl make sure to use SDK path
9712         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9713         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9714         dnl omit -L/usr/lib
9715         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9716         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9717     else
9718         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9719         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9720         FilterLibs "${LIBXSLT_LIBS}"
9721         LIBXSLT_LIBS="${filteredlibs}"
9722         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9723         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9724         FilterLibs "${LIBEXSLT_LIBS}"
9725         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9726     fi
9728     dnl Check for xsltproc
9729     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9730     if test "$XSLTPROC" = "no"; then
9731         AC_MSG_ERROR([xsltproc is required])
9732     fi
9733 else
9734     AC_MSG_RESULT([internal])
9735     SYSTEM_LIBXSLT=
9736     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9738 AC_SUBST(SYSTEM_LIBXSLT)
9739 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9740     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9742 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9744 AC_SUBST(LIBEXSLT_CFLAGS)
9745 AC_SUBST(LIBEXSLT_LIBS)
9746 AC_SUBST(LIBXSLT_CFLAGS)
9747 AC_SUBST(LIBXSLT_LIBS)
9748 AC_SUBST(XSLTPROC)
9750 # ===================================================================
9751 # Check for system libxml
9752 # ===================================================================
9753 AC_MSG_CHECKING([which libxml to use])
9754 if test "$with_system_libxml" = "yes"; then
9755     AC_MSG_RESULT([external])
9756     SYSTEM_LIBXML=TRUE
9757     if test "$_os" = "Darwin"; then
9758         dnl make sure to use SDK path
9759         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9760         dnl omit -L/usr/lib
9761         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9762     elif test $_os = iOS; then
9763         dnl make sure to use SDK path
9764         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9765         LIBXML_CFLAGS="-I$usr/include/libxml2"
9766         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9767     else
9768         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9769         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9770         FilterLibs "${LIBXML_LIBS}"
9771         LIBXML_LIBS="${filteredlibs}"
9772     fi
9774     dnl Check for xmllint
9775     AC_PATH_PROG(XMLLINT, xmllint, no)
9776     if test "$XMLLINT" = "no"; then
9777         AC_MSG_ERROR([xmllint is required])
9778     fi
9779 else
9780     AC_MSG_RESULT([internal])
9781     SYSTEM_LIBXML=
9782     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9783     if test "$COM" = "MSC"; then
9784         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9785     fi
9786     if test "$COM" = "MSC"; then
9787         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9788     else
9789         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9790         if test "$DISABLE_DYNLOADING" = TRUE; then
9791             LIBXML_LIBS="$LIBXML_LIBS -lm"
9792         fi
9793     fi
9794     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9796 AC_SUBST(SYSTEM_LIBXML)
9797 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9798     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9800 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9801 AC_SUBST(LIBXML_CFLAGS)
9802 AC_SUBST(LIBXML_LIBS)
9803 AC_SUBST(XMLLINT)
9805 # =====================================================================
9806 # Checking for a Python interpreter with version >= 3.3.
9807 # Optionally user can pass an option to configure, i. e.
9808 # ./configure PYTHON=/usr/bin/python
9809 # =====================================================================
9810 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9811     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9812     # unless PYTHON is defined as above which allows 'system'
9813     enable_python=internal
9815 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9816     if test -n "$PYTHON"; then
9817         PYTHON_FOR_BUILD=$PYTHON
9818     else
9819         # This allows a lack of system python with no error, we use internal one in that case.
9820         AM_PATH_PYTHON([3.3],, [:])
9821         # Clean PYTHON_VERSION checked below if cross-compiling
9822         PYTHON_VERSION=""
9823         if test "$PYTHON" != ":"; then
9824             PYTHON_FOR_BUILD=$PYTHON
9825         fi
9826     fi
9829 # Checks for Python to use for Pyuno
9830 AC_MSG_CHECKING([which Python to use for Pyuno])
9831 case "$enable_python" in
9832 no|disable)
9833     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9834         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9835         # requirement from the choice whether to include Python stuff in the installer, but why
9836         # bother?
9837         AC_MSG_ERROR([Python is required at build time.])
9838     fi
9839     enable_python=no
9840     AC_MSG_RESULT([none])
9841     ;;
9842 ""|yes|auto)
9843     if test "$DISABLE_SCRIPTING" = TRUE; then
9844         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9845             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9846         fi
9847         AC_MSG_RESULT([none, overridden by --disable-scripting])
9848         enable_python=no
9849     elif test $build_os = cygwin -o $build_os = wsl; then
9850         dnl When building on Windows we don't attempt to use any installed
9851         dnl "system"  Python.
9852         AC_MSG_RESULT([fully internal])
9853         enable_python=internal
9854     elif test "$cross_compiling" = yes; then
9855         AC_MSG_RESULT([system])
9856         enable_python=system
9857     else
9858         # Unset variables set by the above AM_PATH_PYTHON so that
9859         # we actually do check anew.
9860         AC_MSG_RESULT([])
9861         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
9862         AM_PATH_PYTHON([3.3],, [:])
9863         AC_MSG_CHECKING([which Python to use for Pyuno])
9864         if test "$PYTHON" = ":"; then
9865             if test -z "$PYTHON_FOR_BUILD"; then
9866                 AC_MSG_RESULT([fully internal])
9867             else
9868                 AC_MSG_RESULT([internal])
9869             fi
9870             enable_python=internal
9871         else
9872             AC_MSG_RESULT([system])
9873             enable_python=system
9874         fi
9875     fi
9876     ;;
9877 internal)
9878     AC_MSG_RESULT([internal])
9879     ;;
9880 fully-internal)
9881     AC_MSG_RESULT([fully internal])
9882     enable_python=internal
9883     ;;
9884 system)
9885     AC_MSG_RESULT([system])
9886     if test "$_os" = Darwin -a -z "$PYTHON"; then
9887         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9888     fi
9889     ;;
9891     AC_MSG_ERROR([Incorrect --enable-python option])
9892     ;;
9893 esac
9895 if test $enable_python != no; then
9896     BUILD_TYPE="$BUILD_TYPE PYUNO"
9899 if test $enable_python = system; then
9900     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9901         # Fallback: Accept these in the environment, or as set above
9902         # for MacOSX.
9903         :
9904     elif test "$cross_compiling" != yes; then
9905         # Unset variables set by the above AM_PATH_PYTHON so that
9906         # we actually do check anew.
9907         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
9908         # This causes an error if no python command is found
9909         AM_PATH_PYTHON([3.3])
9910         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9911         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9912         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9913         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9914         if test -z "$PKG_CONFIG"; then
9915             PYTHON_CFLAGS="-I$python_include"
9916             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9917         elif $PKG_CONFIG --exists python-$python_version-embed; then
9918             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9919             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9920         elif $PKG_CONFIG --exists python-$python_version; then
9921             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9922             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9923         else
9924             PYTHON_CFLAGS="-I$python_include"
9925             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9926         fi
9927         FilterLibs "${PYTHON_LIBS}"
9928         PYTHON_LIBS="${filteredlibs}"
9929     else
9930         dnl How to find out the cross-compilation Python installation path?
9931         AC_MSG_CHECKING([for python version])
9932         AS_IF([test -n "$PYTHON_VERSION"],
9933               [AC_MSG_RESULT([$PYTHON_VERSION])],
9934               [AC_MSG_RESULT([not found])
9935                AC_MSG_ERROR([no usable python found])])
9936         test -n "$PYTHON_CFLAGS" && break
9937     fi
9939     dnl Check if the headers really work
9940     save_CPPFLAGS="$CPPFLAGS"
9941     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9942     AC_CHECK_HEADER(Python.h)
9943     CPPFLAGS="$save_CPPFLAGS"
9945     # let the PYTHON_FOR_BUILD match the same python installation that
9946     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9947     # better for PythonTests.
9948     PYTHON_FOR_BUILD=$PYTHON
9951 if test "$with_lxml" != no; then
9952     if test -z "$PYTHON_FOR_BUILD"; then
9953         case $build_os in
9954             cygwin)
9955                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9956                 ;;
9957             *)
9958                 if test "$cross_compiling" != yes ; then
9959                     BUILD_TYPE="$BUILD_TYPE LXML"
9960                 fi
9961                 ;;
9962         esac
9963     else
9964         AC_MSG_CHECKING([for python lxml])
9965         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9966             AC_MSG_RESULT([yes])
9967         else
9968             case $build_os in
9969                 cygwin)
9970                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9971                     ;;
9972                 *)
9973                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9974                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9975                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9976                         else
9977                             BUILD_TYPE="$BUILD_TYPE LXML"
9978                             AC_MSG_RESULT([no, using internal lxml])
9979                         fi
9980                     else
9981                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9982                     fi
9983                     ;;
9984             esac
9985         fi
9986     fi
9989 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
9990     SYSTEM_PYTHON=
9991     PYTHON_VERSION_MAJOR=3
9992     PYTHON_VERSION_MINOR=8
9993     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.18
9994     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9995         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9996     fi
9997     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9999     # Embedded Python dies without Home set
10000     if test "$HOME" = ""; then
10001         export HOME=""
10002     fi
10005 dnl By now enable_python should be "system", "internal" or "no"
10006 case $enable_python in
10007 system)
10008     SYSTEM_PYTHON=TRUE
10010     if test "x$ac_cv_header_Python_h" != "xyes"; then
10011        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10012     fi
10014     AC_LANG_PUSH(C)
10015     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10016     AC_MSG_CHECKING([for correct python library version])
10017        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10018 #include <Python.h>
10020 int main(int argc, char **argv) {
10021    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10022    else return 1;
10024        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10025     AC_LANG_POP(C)
10027     dnl FIXME Check if the Python library can be linked with, too?
10028     ;;
10030 internal)
10031     BUILD_TYPE="$BUILD_TYPE PYTHON"
10032     if test "$OS" = LINUX -o "$OS" = WNT ; then
10033         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10034     fi
10035     ;;
10037     DISABLE_PYTHON=TRUE
10038     SYSTEM_PYTHON=
10039     ;;
10041     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10042     ;;
10043 esac
10045 AC_SUBST(DISABLE_PYTHON)
10046 AC_SUBST(SYSTEM_PYTHON)
10047 AC_SUBST(PYTHON_CFLAGS)
10048 AC_SUBST(PYTHON_FOR_BUILD)
10049 AC_SUBST(PYTHON_LIBS)
10050 AC_SUBST(PYTHON_VERSION)
10051 AC_SUBST(PYTHON_VERSION_MAJOR)
10052 AC_SUBST(PYTHON_VERSION_MINOR)
10054 AC_MSG_CHECKING([whether to build LibreLogo])
10055 case "$enable_python" in
10056 no|disable)
10057     AC_MSG_RESULT([no; Python disabled])
10058     ;;
10060     if test "${enable_librelogo}" = "no"; then
10061         AC_MSG_RESULT([no])
10062     else
10063         AC_MSG_RESULT([yes])
10064         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10065         AC_DEFINE([ENABLE_LIBRELOGO],1)
10066     fi
10067     ;;
10068 esac
10069 AC_SUBST(ENABLE_LIBRELOGO)
10071 ENABLE_MARIADBC=
10072 MARIADBC_MAJOR=1
10073 MARIADBC_MINOR=0
10074 MARIADBC_MICRO=2
10075 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10076 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10077     ENABLE_MARIADBC=TRUE
10078     AC_MSG_RESULT([yes])
10079     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10080 else
10081     AC_MSG_RESULT([no])
10083 AC_SUBST(ENABLE_MARIADBC)
10084 AC_SUBST(MARIADBC_MAJOR)
10085 AC_SUBST(MARIADBC_MINOR)
10086 AC_SUBST(MARIADBC_MICRO)
10088 if test "$ENABLE_MARIADBC" = "TRUE"; then
10089     dnl ===================================================================
10090     dnl Check for system MariaDB
10091     dnl ===================================================================
10092     AC_MSG_CHECKING([which MariaDB to use])
10093     if test "$with_system_mariadb" = "yes"; then
10094         AC_MSG_RESULT([external])
10095         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10096         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10097         if test -z "$MARIADBCONFIG"; then
10098             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10099             if test -z "$MARIADBCONFIG"; then
10100                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10101                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10102             fi
10103         fi
10104         AC_MSG_CHECKING([MariaDB version])
10105         MARIADB_VERSION=`$MARIADBCONFIG --version`
10106         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10107         if test "$MARIADB_MAJOR" -ge "5"; then
10108             AC_MSG_RESULT([OK])
10109         else
10110             AC_MSG_ERROR([too old, use 5.0.x or later])
10111         fi
10112         AC_MSG_CHECKING([for MariaDB Client library])
10113         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10114         if test "$COM_IS_CLANG" = TRUE; then
10115             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10116         fi
10117         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10118         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10119         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10120         dnl linux32:
10121         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10122             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10123             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10124                 | sed -e 's|/lib64/|/lib/|')
10125         fi
10126         FilterLibs "${MARIADB_LIBS}"
10127         MARIADB_LIBS="${filteredlibs}"
10128         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10129         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10130         if test "$enable_bundle_mariadb" = "yes"; then
10131             AC_MSG_RESULT([yes])
10132             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10133             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10135 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10137 /g' | grep -E '(mysqlclient|mariadb)')
10138             if test "$_os" = "Darwin"; then
10139                 LIBMARIADB=${LIBMARIADB}.dylib
10140             elif test "$_os" = "WINNT"; then
10141                 LIBMARIADB=${LIBMARIADB}.dll
10142             else
10143                 LIBMARIADB=${LIBMARIADB}.so
10144             fi
10145             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10146             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10147             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10148                 AC_MSG_RESULT([found.])
10149                 PathFormat "$LIBMARIADB_PATH"
10150                 LIBMARIADB_PATH="$formatted_path"
10151             else
10152                 AC_MSG_ERROR([not found.])
10153             fi
10154         else
10155             AC_MSG_RESULT([no])
10156             BUNDLE_MARIADB_CONNECTOR_C=
10157         fi
10158     else
10159         AC_MSG_RESULT([internal])
10160         SYSTEM_MARIADB_CONNECTOR_C=
10161         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10162         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10163         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10164     fi
10166     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10167     AC_SUBST(MARIADB_CFLAGS)
10168     AC_SUBST(MARIADB_LIBS)
10169     AC_SUBST(LIBMARIADB)
10170     AC_SUBST(LIBMARIADB_PATH)
10171     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10174 dnl ===================================================================
10175 dnl Check for system hsqldb
10176 dnl ===================================================================
10177 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10178     AC_MSG_CHECKING([which hsqldb to use])
10179     if test "$with_system_hsqldb" = "yes"; then
10180         AC_MSG_RESULT([external])
10181         SYSTEM_HSQLDB=TRUE
10182         if test -z $HSQLDB_JAR; then
10183             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10184         fi
10185         if ! test -f $HSQLDB_JAR; then
10186                AC_MSG_ERROR(hsqldb.jar not found.)
10187         fi
10188         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10189         export HSQLDB_JAR
10190         if $PERL -e \
10191            'use Archive::Zip;
10192             my $file = "$ENV{'HSQLDB_JAR'}";
10193             my $zip = Archive::Zip->new( $file );
10194             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10195             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10196             {
10197                 push @l, split(/\n/, $mf);
10198                 foreach my $line (@l)
10199                 {
10200                     if ($line =~ m/Specification-Version:/)
10201                     {
10202                         ($t, $version) = split (/:/,$line);
10203                         $version =~ s/^\s//;
10204                         ($a, $b, $c, $d) = split (/\./,$version);
10205                         if ($c == "0" && $d > "8")
10206                         {
10207                             exit 0;
10208                         }
10209                         else
10210                         {
10211                             exit 1;
10212                         }
10213                     }
10214                 }
10215             }
10216             else
10217             {
10218                 exit 1;
10219             }'; then
10220             AC_MSG_RESULT([yes])
10221         else
10222             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10223         fi
10224     else
10225         AC_MSG_RESULT([internal])
10226         SYSTEM_HSQLDB=
10227         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10228         NEED_ANT=TRUE
10229     fi
10230 else
10231     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10232         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10233     fi
10235 AC_SUBST(SYSTEM_HSQLDB)
10236 AC_SUBST(HSQLDB_JAR)
10238 dnl ===================================================================
10239 dnl Check for PostgreSQL stuff
10240 dnl ===================================================================
10241 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10242 if test "x$enable_postgresql_sdbc" != "xno"; then
10243     AC_MSG_RESULT([yes])
10244     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10246     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10247         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10248     fi
10249     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10250         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10251     fi
10253     postgres_interface=""
10254     if test "$with_system_postgresql" = "yes"; then
10255         postgres_interface="external PostgreSQL"
10256         SYSTEM_POSTGRESQL=TRUE
10257         if test "$_os" = Darwin; then
10258             supp_path=''
10259             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10260                 pg_supp_path="$P_SEP$d$pg_supp_path"
10261             done
10262         fi
10263         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10264         if test -n "$PGCONFIG"; then
10265             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10266             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10267         else
10268             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10269               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10270               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10271             ],[
10272               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10273             ])
10274         fi
10275         FilterLibs "${POSTGRESQL_LIB}"
10276         POSTGRESQL_LIB="${filteredlibs}"
10277     else
10278         # if/when anything else than PostgreSQL uses Kerberos,
10279         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10280         WITH_KRB5=
10281         WITH_GSSAPI=
10282         case "$_os" in
10283         Darwin)
10284             # macOS has system MIT Kerberos 5 since 10.4
10285             if test "$with_krb5" != "no"; then
10286                 WITH_KRB5=TRUE
10287                 save_LIBS=$LIBS
10288                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10289                 # that the libraries where these functions are located on macOS will change, is it?
10290                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10291                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10292                 KRB5_LIBS=$LIBS
10293                 LIBS=$save_LIBS
10294                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10295                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10296                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10297                 LIBS=$save_LIBS
10298             fi
10299             if test "$with_gssapi" != "no"; then
10300                 WITH_GSSAPI=TRUE
10301                 save_LIBS=$LIBS
10302                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10303                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10304                 GSSAPI_LIBS=$LIBS
10305                 LIBS=$save_LIBS
10306             fi
10307             ;;
10308         WINNT)
10309             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10310                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10311             fi
10312             ;;
10313         Linux|GNU|*BSD|DragonFly)
10314             if test "$with_krb5" != "no"; then
10315                 WITH_KRB5=TRUE
10316                 save_LIBS=$LIBS
10317                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10318                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10319                 KRB5_LIBS=$LIBS
10320                 LIBS=$save_LIBS
10321                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10322                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10323                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10324                 LIBS=$save_LIBS
10325             fi
10326             if test "$with_gssapi" != "no"; then
10327                 WITH_GSSAPI=TRUE
10328                 save_LIBS=$LIBS
10329                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10330                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10331                 GSSAPI_LIBS=$LIBS
10332                 LIBS=$save_LIBS
10333             fi
10334             ;;
10335         *)
10336             if test "$with_krb5" = "yes"; then
10337                 WITH_KRB5=TRUE
10338                 save_LIBS=$LIBS
10339                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10340                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10341                 KRB5_LIBS=$LIBS
10342                 LIBS=$save_LIBS
10343                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10344                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10345                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10346                 LIBS=$save_LIBS
10347             fi
10348             if test "$with_gssapi" = "yes"; then
10349                 WITH_GSSAPI=TRUE
10350                 save_LIBS=$LIBS
10351                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10352                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10353                 LIBS=$save_LIBS
10354                 GSSAPI_LIBS=$LIBS
10355             fi
10356         esac
10358         if test -n "$with_libpq_path"; then
10359             SYSTEM_POSTGRESQL=TRUE
10360             postgres_interface="external libpq"
10361             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10362             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10363         else
10364             SYSTEM_POSTGRESQL=
10365             postgres_interface="internal"
10366             POSTGRESQL_LIB=""
10367             POSTGRESQL_INC="%OVERRIDE_ME%"
10368             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10369         fi
10370     fi
10372     AC_MSG_CHECKING([PostgreSQL C interface])
10373     AC_MSG_RESULT([$postgres_interface])
10375     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10376         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10377         save_CFLAGS=$CFLAGS
10378         save_CPPFLAGS=$CPPFLAGS
10379         save_LIBS=$LIBS
10380         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10381         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10382         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10383         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10384             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10385         CFLAGS=$save_CFLAGS
10386         CPPFLAGS=$save_CPPFLAGS
10387         LIBS=$save_LIBS
10388     fi
10389     BUILD_POSTGRESQL_SDBC=TRUE
10390 else
10391     AC_MSG_RESULT([no])
10393 AC_SUBST(WITH_KRB5)
10394 AC_SUBST(WITH_GSSAPI)
10395 AC_SUBST(GSSAPI_LIBS)
10396 AC_SUBST(KRB5_LIBS)
10397 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10398 AC_SUBST(SYSTEM_POSTGRESQL)
10399 AC_SUBST(POSTGRESQL_INC)
10400 AC_SUBST(POSTGRESQL_LIB)
10402 dnl ===================================================================
10403 dnl Check for Firebird stuff
10404 dnl ===================================================================
10405 ENABLE_FIREBIRD_SDBC=
10406 if test "$enable_firebird_sdbc" = "yes" ; then
10407     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10409     dnl ===================================================================
10410     dnl Check for system Firebird
10411     dnl ===================================================================
10412     AC_MSG_CHECKING([which Firebird to use])
10413     if test "$with_system_firebird" = "yes"; then
10414         AC_MSG_RESULT([external])
10415         SYSTEM_FIREBIRD=TRUE
10416         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10417         if test -z "$FIREBIRDCONFIG"; then
10418             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10419             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10420                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10421             ])
10422             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10423         else
10424             AC_MSG_NOTICE([fb_config found])
10425             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10426             AC_MSG_CHECKING([for Firebird Client library])
10427             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10428             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10429             FilterLibs "${FIREBIRD_LIBS}"
10430             FIREBIRD_LIBS="${filteredlibs}"
10431         fi
10432         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10433         AC_MSG_CHECKING([Firebird version])
10434         if test -n "${FIREBIRD_VERSION}"; then
10435             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10436             if test "$FIREBIRD_MAJOR" -ge "3"; then
10437                 AC_MSG_RESULT([OK])
10438             else
10439                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10440             fi
10441         else
10442             save_CFLAGS="${CFLAGS}"
10443             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10444             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10445 #if defined(FB_API_VER) && FB_API_VER == 30
10446 int fb_api_is_30(void) { return 0; }
10447 #else
10448 #error "Wrong Firebird API version"
10449 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10450             CFLAGS="$save_CFLAGS"
10451         fi
10452         ENABLE_FIREBIRD_SDBC=TRUE
10453         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10454     elif test "$enable_database_connectivity" = no; then
10455         AC_MSG_RESULT([none])
10456     elif test "$cross_compiling" = "yes"; then
10457         AC_MSG_RESULT([none])
10458     else
10459         dnl Embedded Firebird has version 3.0
10460         dnl We need libatomic_ops for any non X86/X64 system
10461         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10462             dnl ===================================================================
10463             dnl Check for system libatomic_ops
10464             dnl ===================================================================
10465             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10466             if test "$with_system_libatomic_ops" = "yes"; then
10467                 SYSTEM_LIBATOMIC_OPS=TRUE
10468                 AC_CHECK_HEADERS(atomic_ops.h, [],
10469                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10470             else
10471                 SYSTEM_LIBATOMIC_OPS=
10472                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10473                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10474                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10475             fi
10476         fi
10478         AC_MSG_RESULT([internal])
10479         SYSTEM_FIREBIRD=
10480         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10481         FIREBIRD_LIBS="-lfbclient"
10483         if test "$with_system_libtommath" = "yes"; then
10484             SYSTEM_LIBTOMMATH=TRUE
10485             dnl check for tommath presence
10486             save_LIBS=$LIBS
10487             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10488             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10489             LIBS=$save_LIBS
10490         else
10491             SYSTEM_LIBTOMMATH=
10492             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10493             LIBTOMMATH_LIBS="-ltommath"
10494             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10495         fi
10497         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10498         ENABLE_FIREBIRD_SDBC=TRUE
10499         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10500     fi
10502 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10503 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10504 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10505 AC_SUBST(LIBATOMIC_OPS_LIBS)
10506 AC_SUBST(SYSTEM_FIREBIRD)
10507 AC_SUBST(FIREBIRD_CFLAGS)
10508 AC_SUBST(FIREBIRD_LIBS)
10509 AC_SUBST(SYSTEM_LIBTOMMATH)
10510 AC_SUBST(LIBTOMMATH_CFLAGS)
10511 AC_SUBST(LIBTOMMATH_LIBS)
10513 dnl ===================================================================
10514 dnl Check for system curl
10515 dnl ===================================================================
10516 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10518 dnl ===================================================================
10519 dnl Check for system boost
10520 dnl ===================================================================
10521 AC_MSG_CHECKING([which boost to use])
10522 if test "$with_system_boost" = "yes"; then
10523     AC_MSG_RESULT([external])
10524     SYSTEM_BOOST=TRUE
10525     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10526     AX_BOOST_DATE_TIME
10527     AX_BOOST_FILESYSTEM
10528     AX_BOOST_IOSTREAMS
10529     AX_BOOST_LOCALE
10530     AC_LANG_PUSH([C++])
10531     save_CXXFLAGS=$CXXFLAGS
10532     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10533     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10534        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10535     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10536        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10537     CXXFLAGS=$save_CXXFLAGS
10538     AC_LANG_POP([C++])
10539     # this is in m4/ax_boost_base.m4
10540     FilterLibs "${BOOST_LDFLAGS}"
10541     BOOST_LDFLAGS="${filteredlibs}"
10542 else
10543     AC_MSG_RESULT([internal])
10544     BUILD_TYPE="$BUILD_TYPE BOOST"
10545     SYSTEM_BOOST=
10546     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10547         # use warning-suppressing wrapper headers
10548         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10549     else
10550         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10551     fi
10553 AC_SUBST(SYSTEM_BOOST)
10555 dnl ===================================================================
10556 dnl Check for system mdds
10557 dnl ===================================================================
10558 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10559 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10561 dnl ===================================================================
10562 dnl Check for system dragonbox
10563 dnl ===================================================================
10564 AC_MSG_CHECKING([which dragonbox to use])
10565 if test "$with_system_dragonbox" = "yes"; then
10566     AC_MSG_RESULT([external])
10567     SYSTEM_DRAGONBOX=TRUE
10568     AC_LANG_PUSH([C++])
10569     save_CPPFLAGS=$CPPFLAGS
10570     # This is where upstream installs to, unfortunately no .pc or so...
10571     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10572     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10573     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10574        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10575     AC_LANG_POP([C++])
10576     CPPFLAGS=$save_CPPFLAGS
10577 else
10578     AC_MSG_RESULT([internal])
10579     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10580     SYSTEM_DRAGONBOX=
10582 AC_SUBST([SYSTEM_DRAGONBOX])
10583 AC_SUBST([DRAGONBOX_CFLAGS])
10585 dnl ===================================================================
10586 dnl Check for system frozen
10587 dnl ===================================================================
10588 AC_MSG_CHECKING([which frozen to use])
10589 if test "$with_system_frozen" = "yes"; then
10590     AC_MSG_RESULT([external])
10591     SYSTEM_FROZEN=TRUE
10592     AC_LANG_PUSH([C++])
10593     save_CPPFLAGS=$CPPFLAGS
10594     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10595        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10596     AC_LANG_POP([C++])
10597     CPPFLAGS=$save_CPPFLAGS
10598 else
10599     AC_MSG_RESULT([internal])
10600     BUILD_TYPE="$BUILD_TYPE FROZEN"
10601     SYSTEM_FROZEN=
10603 AC_SUBST([SYSTEM_FROZEN])
10604 AC_SUBST([FROZEN_CFLAGS])
10606 dnl ===================================================================
10607 dnl Check for system libfixmath
10608 dnl ===================================================================
10609 AC_MSG_CHECKING([which libfixmath to use])
10610 if test "$with_system_libfixmath" = "yes"; then
10611     AC_MSG_RESULT([external])
10612     SYSTEM_LIBFIXMATH=TRUE
10613     AC_LANG_PUSH([C++])
10614     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10615        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10616     AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib not found or functional)], [])
10617     AC_LANG_POP([C++])
10618 else
10619     AC_MSG_RESULT([internal])
10620     SYSTEM_LIBFIXMATH=
10622 AC_SUBST([SYSTEM_LIBFIXMATH])
10624 dnl ===================================================================
10625 dnl Check for system glm
10626 dnl ===================================================================
10627 AC_MSG_CHECKING([which glm to use])
10628 if test "$with_system_glm" = "yes"; then
10629     AC_MSG_RESULT([external])
10630     SYSTEM_GLM=TRUE
10631     AC_LANG_PUSH([C++])
10632     AC_CHECK_HEADER([glm/glm.hpp], [],
10633        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10634     AC_LANG_POP([C++])
10635 else
10636     AC_MSG_RESULT([internal])
10637     BUILD_TYPE="$BUILD_TYPE GLM"
10638     SYSTEM_GLM=
10639     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10641 AC_SUBST([GLM_CFLAGS])
10642 AC_SUBST([SYSTEM_GLM])
10644 dnl ===================================================================
10645 dnl Check for system odbc
10646 dnl ===================================================================
10647 AC_MSG_CHECKING([which odbc headers to use])
10648 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
10649     AC_MSG_RESULT([external])
10650     SYSTEM_ODBC_HEADERS=TRUE
10652     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10653         save_CPPFLAGS=$CPPFLAGS
10654         find_winsdk
10655         PathFormat "$winsdktest"
10656         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"
10657         AC_CHECK_HEADER(sqlext.h, [],
10658             [AC_MSG_ERROR(odbc not found. install odbc)],
10659             [#include <windows.h>])
10660         CPPFLAGS=$save_CPPFLAGS
10661     else
10662         AC_CHECK_HEADER(sqlext.h, [],
10663             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10664     fi
10665 elif test "$enable_database_connectivity" = no; then
10666     AC_MSG_RESULT([none])
10667 else
10668     AC_MSG_RESULT([internal])
10669     SYSTEM_ODBC_HEADERS=
10671 AC_SUBST(SYSTEM_ODBC_HEADERS)
10673 dnl ===================================================================
10674 dnl Check for system NSS
10675 dnl ===================================================================
10676 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10677     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10678     AC_DEFINE(HAVE_FEATURE_NSS)
10679     ENABLE_NSS=TRUE
10680 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10681     with_tls=openssl
10683 AC_SUBST(ENABLE_NSS)
10685 dnl ===================================================================
10686 dnl Enable LDAP support
10687 dnl ===================================================================
10689 if test "$test_openldap" = yes; then
10690     AC_MSG_CHECKING([whether to enable LDAP support])
10691     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10692         AC_MSG_RESULT([yes])
10693         ENABLE_LDAP=TRUE
10694     else
10695         if test "$enable_ldap" != "yes"; then
10696             AC_MSG_RESULT([no])
10697         else
10698             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10699         fi
10700     fi
10702 dnl ===================================================================
10703 dnl Check for system openldap
10704 dnl ===================================================================
10706     if test "$ENABLE_LDAP" = TRUE; then
10707         AC_MSG_CHECKING([which openldap library to use])
10708         if test "$with_system_openldap" = yes; then
10709             AC_MSG_RESULT([external])
10710             SYSTEM_OPENLDAP=TRUE
10711             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10712             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10713             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10714         else
10715             AC_MSG_RESULT([internal])
10716             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10717         fi
10718     fi
10721 AC_SUBST(ENABLE_LDAP)
10722 AC_SUBST(SYSTEM_OPENLDAP)
10724 dnl ===================================================================
10725 dnl Check for TLS/SSL and cryptographic implementation to use
10726 dnl ===================================================================
10727 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10728 if test -n "$with_tls"; then
10729     case $with_tls in
10730     openssl)
10731         AC_DEFINE(USE_TLS_OPENSSL)
10732         TLS=OPENSSL
10733         AC_MSG_RESULT([$TLS])
10735         if test "$enable_openssl" != "yes"; then
10736             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10737         fi
10739         # warn that OpenSSL has been selected but not all TLS code has this option
10740         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10741         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10742         ;;
10743     nss)
10744         AC_DEFINE(USE_TLS_NSS)
10745         TLS=NSS
10746         AC_MSG_RESULT([$TLS])
10747         ;;
10748     no)
10749         AC_MSG_RESULT([none])
10750         AC_MSG_WARN([Skipping TLS/SSL])
10751         ;;
10752     *)
10753         AC_MSG_RESULT([])
10754         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10755 openssl - OpenSSL
10756 nss - Mozilla's Network Security Services (NSS)
10757     ])
10758         ;;
10759     esac
10760 else
10761     # default to using NSS, it results in smaller oox lib
10762     AC_DEFINE(USE_TLS_NSS)
10763     TLS=NSS
10764     AC_MSG_RESULT([$TLS])
10766 AC_SUBST(TLS)
10768 dnl ===================================================================
10769 dnl Check for system sane
10770 dnl ===================================================================
10771 AC_MSG_CHECKING([which sane header to use])
10772 if test "$with_system_sane" = "yes"; then
10773     AC_MSG_RESULT([external])
10774     AC_CHECK_HEADER(sane/sane.h, [],
10775       [AC_MSG_ERROR(sane not found. install sane)], [])
10776 else
10777     AC_MSG_RESULT([internal])
10778     BUILD_TYPE="$BUILD_TYPE SANE"
10781 dnl ===================================================================
10782 dnl Check for system icu
10783 dnl ===================================================================
10784 ICU_MAJOR=73
10785 ICU_MINOR=2
10786 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10787 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10788 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
10789 if test "$SYSTEM_ICU" = TRUE; then
10790     AC_LANG_PUSH([C++])
10791     AC_MSG_CHECKING([for unicode/rbbi.h])
10792     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10793     AC_LANG_POP([C++])
10795     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10796     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10797     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10799     if test "$CROSS_COMPILING" != TRUE; then
10800         # using the system icu tools can lead to version confusion, use the
10801         # ones from the build environment when cross-compiling
10802         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10803         if test -z "$SYSTEM_GENBRK"; then
10804             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10805         fi
10806         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10807         if test -z "$SYSTEM_GENCCODE"; then
10808             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10809         fi
10810         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10811         if test -z "$SYSTEM_GENCMN"; then
10812             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10813         fi
10814     fi
10817 AC_SUBST(SYSTEM_GENBRK)
10818 AC_SUBST(SYSTEM_GENCCODE)
10819 AC_SUBST(SYSTEM_GENCMN)
10820 AC_SUBST(ICU_MAJOR)
10821 AC_SUBST(ICU_MINOR)
10823 dnl ==================================================================
10824 dnl CURL
10825 dnl ==================================================================
10826 if test "$enable_curl" == "yes"; then
10827     AC_DEFINE([HAVE_FEATURE_CURL])
10830 dnl ==================================================================
10831 dnl Breakpad
10832 dnl ==================================================================
10833 DEFAULT_CRASHDUMP_VALUE="true"
10834 AC_MSG_CHECKING([whether to enable breakpad])
10835 if test "$enable_breakpad" != yes; then
10836     AC_MSG_RESULT([no])
10837 else
10838     if test "$enable_curl" != "yes"; then
10839         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
10840     fi
10841     AC_MSG_RESULT([yes])
10842     ENABLE_BREAKPAD="TRUE"
10843     AC_DEFINE(ENABLE_BREAKPAD)
10844     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10845     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10847     AC_MSG_CHECKING([for disable crash dump])
10848     if test "$enable_crashdump" = no; then
10849         DEFAULT_CRASHDUMP_VALUE="false"
10850         AC_MSG_RESULT([yes])
10851     else
10852        AC_MSG_RESULT([no])
10853     fi
10855     AC_MSG_CHECKING([for crashreport config])
10856     if test "$with_symbol_config" = "no"; then
10857         BREAKPAD_SYMBOL_CONFIG="invalid"
10858         AC_MSG_RESULT([no])
10859     else
10860         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10861         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10862         AC_MSG_RESULT([yes])
10863     fi
10864     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10866 AC_SUBST(ENABLE_BREAKPAD)
10867 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10869 dnl ==================================================================
10870 dnl libcmis
10871 dnl ==================================================================
10872 if test "$enable_libcmis" == "yes"; then
10873     if test "$enable_curl" != "yes"; then
10874         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
10875     fi
10878 dnl ===================================================================
10879 dnl Orcus
10880 dnl ===================================================================
10881 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
10882 if test "$with_system_orcus" != "yes"; then
10883     if test "$SYSTEM_BOOST" = "TRUE"; then
10884         dnl Link with Boost.System
10885         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10886         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10887         dnl in documentation has no effect.
10888         AX_BOOST_SYSTEM
10889     fi
10891 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10892 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10893 AC_SUBST([BOOST_SYSTEM_LIB])
10894 AC_SUBST(SYSTEM_LIBORCUS)
10896 dnl ===================================================================
10897 dnl HarfBuzz
10898 dnl ===================================================================
10899 harfbuzz_required_version=5.1.0
10901 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10902 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10903 case "$_os" in
10904     Linux)
10905         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
10906         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
10907         ;;
10908     *)
10909         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10910         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10911         ;;
10912 esac
10913 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10914 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
10916 if test "$COM" = "MSC"; then # override the above
10917     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10918     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10921 if test "$with_system_harfbuzz" = "yes"; then
10922     if test "$with_system_graphite" = "no"; then
10923         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10924     fi
10925     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10926     save_LIBS="$LIBS"
10927     save_CFLAGS="$CFLAGS"
10928     LIBS="$LIBS $HARFBUZZ_LIBS"
10929     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10930     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10931     LIBS="$save_LIBS"
10932     CFLAGS="$save_CFLAGS"
10933 else
10934     if test "$with_system_graphite" = "yes"; then
10935         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10936     fi
10939 if test "$USING_X11" = TRUE; then
10940     AC_PATH_X
10941     AC_PATH_XTRA
10942     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10944     if test -z "$x_includes"; then
10945         x_includes="default_x_includes"
10946     fi
10947     if test -z "$x_libraries"; then
10948         x_libraries="default_x_libraries"
10949     fi
10950     CFLAGS="$CFLAGS $X_CFLAGS"
10951     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10952     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10953 else
10954     x_includes="no_x_includes"
10955     x_libraries="no_x_libraries"
10958 if test "$USING_X11" = TRUE; then
10959     dnl ===================================================================
10960     dnl Check for extension headers
10961     dnl ===================================================================
10962     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10963      [#include <X11/extensions/shape.h>])
10965     # vcl needs ICE and SM
10966     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10967     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10968         [AC_MSG_ERROR(ICE library not found)])
10969     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10970     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10971         [AC_MSG_ERROR(SM library not found)])
10974 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10975     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10976     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10979 dnl ===================================================================
10980 dnl Check for system Xrender
10981 dnl ===================================================================
10982 AC_MSG_CHECKING([whether to use Xrender])
10983 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10984     AC_MSG_RESULT([yes])
10985     PKG_CHECK_MODULES(XRENDER, xrender)
10986     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10987     FilterLibs "${XRENDER_LIBS}"
10988     XRENDER_LIBS="${filteredlibs}"
10989     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10990       [AC_MSG_ERROR(libXrender not found or functional)], [])
10991     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10992       [AC_MSG_ERROR(Xrender not found. install X)], [])
10993 else
10994     AC_MSG_RESULT([no])
10996 AC_SUBST(XRENDER_CFLAGS)
10997 AC_SUBST(XRENDER_LIBS)
10999 dnl ===================================================================
11000 dnl Check for XRandr
11001 dnl ===================================================================
11002 AC_MSG_CHECKING([whether to enable RandR support])
11003 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11004     AC_MSG_RESULT([yes])
11005     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11006     if test "$ENABLE_RANDR" != "TRUE"; then
11007         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11008                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11009         XRANDR_CFLAGS=" "
11010         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11011           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11012         XRANDR_LIBS="-lXrandr "
11013         ENABLE_RANDR="TRUE"
11014     fi
11015     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11016     FilterLibs "${XRANDR_LIBS}"
11017     XRANDR_LIBS="${filteredlibs}"
11018 else
11019     ENABLE_RANDR=""
11020     AC_MSG_RESULT([no])
11022 AC_SUBST(XRANDR_CFLAGS)
11023 AC_SUBST(XRANDR_LIBS)
11024 AC_SUBST(ENABLE_RANDR)
11026 if test -z "$with_webdav"; then
11027     with_webdav=$test_webdav
11030 AC_MSG_CHECKING([for WebDAV support])
11031 case "$with_webdav" in
11033     AC_MSG_RESULT([no])
11034     WITH_WEBDAV=""
11035     ;;
11037     AC_MSG_RESULT([yes])
11038     # curl is already mandatory (almost) and checked elsewhere
11039     if test "$enable_curl" = "no"; then
11040         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11041     fi
11042     WITH_WEBDAV=TRUE
11043     ;;
11044 esac
11045 AC_SUBST(WITH_WEBDAV)
11047 dnl ===================================================================
11048 dnl Check for disabling cve_tests
11049 dnl ===================================================================
11050 AC_MSG_CHECKING([whether to execute CVE tests])
11051 # If not explicitly enabled or disabled, default
11052 if test -z "$enable_cve_tests"; then
11053     case "$OS" in
11054     WNT)
11055         # Default cves off for Windows with its wild and wonderful
11056         # variety of AV software kicking in and panicking
11057         enable_cve_tests=no
11058         ;;
11059     *)
11060         # otherwise yes
11061         enable_cve_tests=yes
11062         ;;
11063     esac
11065 if test "$enable_cve_tests" = "no"; then
11066     AC_MSG_RESULT([no])
11067     DISABLE_CVE_TESTS=TRUE
11068     AC_SUBST(DISABLE_CVE_TESTS)
11069 else
11070     AC_MSG_RESULT([yes])
11073 dnl ===================================================================
11074 dnl Check for system openssl
11075 dnl ===================================================================
11076 ENABLE_OPENSSL=
11077 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11078 if test "$enable_openssl" = "yes"; then
11079     AC_MSG_RESULT([no])
11080     ENABLE_OPENSSL=TRUE
11081     if test "$_os" = Darwin ; then
11082         # OpenSSL is deprecated when building for 10.7 or later.
11083         #
11084         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11085         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11087         with_system_openssl=no
11088         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11089     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11090             && test "$with_system_openssl" != "no"; then
11091         with_system_openssl=yes
11092         SYSTEM_OPENSSL=TRUE
11093         OPENSSL_CFLAGS=
11094         OPENSSL_LIBS="-lssl -lcrypto"
11095     else
11096         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11097     fi
11098     if test "$with_system_openssl" = "yes"; then
11099         AC_MSG_CHECKING([whether openssl supports SHA512])
11100         AC_LANG_PUSH([C])
11101         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11102             SHA512_CTX context;
11103 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11104         AC_LANG_POP(C)
11105     fi
11106 else
11107     AC_MSG_RESULT([yes])
11109     # warn that although OpenSSL is disabled, system libraries may depend on it
11110     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11111     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11114 AC_SUBST([ENABLE_OPENSSL])
11116 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11117     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11118         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11119         enable_cipher_openssl_backend=no
11120     else
11121         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11122     fi
11124 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11125 ENABLE_CIPHER_OPENSSL_BACKEND=
11126 if test "$enable_cipher_openssl_backend" = yes; then
11127     AC_MSG_RESULT([yes])
11128     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11129 else
11130     AC_MSG_RESULT([no])
11132 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11134 dnl ===================================================================
11135 dnl Select the crypto backends used by LO
11136 dnl ===================================================================
11138 if test "$build_crypto" = yes; then
11139     if test "$OS" = WNT; then
11140         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11141         AC_DEFINE([USE_CRYPTO_MSCAPI])
11142     elif test "$ENABLE_NSS" = TRUE; then
11143         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11144         AC_DEFINE([USE_CRYPTO_NSS])
11145     fi
11148 dnl ===================================================================
11149 dnl Check for system redland
11150 dnl ===================================================================
11151 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11152 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11153 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11154 if test "$with_system_redland" = "yes"; then
11155     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11156             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11157 else
11158     RAPTOR_MAJOR="0"
11159     RASQAL_MAJOR="3"
11160     REDLAND_MAJOR="0"
11162 AC_SUBST(RAPTOR_MAJOR)
11163 AC_SUBST(RASQAL_MAJOR)
11164 AC_SUBST(REDLAND_MAJOR)
11166 dnl ===================================================================
11167 dnl Check for system hunspell
11168 dnl ===================================================================
11169 AC_MSG_CHECKING([which libhunspell to use])
11170 if test "$with_system_hunspell" = "yes"; then
11171     AC_MSG_RESULT([external])
11172     SYSTEM_HUNSPELL=TRUE
11173     AC_LANG_PUSH([C++])
11174     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11175     if test "$HUNSPELL_PC" != "TRUE"; then
11176         AC_CHECK_HEADER(hunspell.hxx, [],
11177             [
11178             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11179             [AC_MSG_ERROR(hunspell headers not found.)], [])
11180             ], [])
11181         AC_CHECK_LIB([hunspell], [main], [:],
11182            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11183         HUNSPELL_LIBS=-lhunspell
11184     fi
11185     AC_LANG_POP([C++])
11186     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11187     FilterLibs "${HUNSPELL_LIBS}"
11188     HUNSPELL_LIBS="${filteredlibs}"
11189 else
11190     AC_MSG_RESULT([internal])
11191     SYSTEM_HUNSPELL=
11192     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11193     if test "$COM" = "MSC"; then
11194         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11195     else
11196         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11197     fi
11198     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11200 AC_SUBST(SYSTEM_HUNSPELL)
11201 AC_SUBST(HUNSPELL_CFLAGS)
11202 AC_SUBST(HUNSPELL_LIBS)
11204 dnl ===================================================================
11205 dnl Check for system zxing
11206 dnl ===================================================================
11207 AC_MSG_CHECKING([whether to use zxing])
11208 if test "$enable_zxing" = "no"; then
11209     AC_MSG_RESULT([no])
11210     ENABLE_ZXING=
11211     SYSTEM_ZXING=
11212 else
11213     AC_MSG_RESULT([yes])
11214     ENABLE_ZXING=TRUE
11215     AC_MSG_CHECKING([which libzxing to use])
11216     if test "$with_system_zxing" = "yes"; then
11217         AC_MSG_RESULT([external])
11218         SYSTEM_ZXING=TRUE
11219         ZXING_CFLAGS=
11220         AC_LANG_PUSH([C++])
11221         save_CXXFLAGS=$CXXFLAGS
11222         save_IFS=$IFS
11223         IFS=$P_SEP
11224         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11225             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11226             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11227             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11228             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11229             dnl unsetting IFS."):
11230             IFS=$save_IFS
11231             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11232             dnl ignore them here:
11233             if test -z "$i"; then
11234                 continue
11235             fi
11236             dnl TODO: White space in $i would cause problems:
11237             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11238             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11239                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11240         done
11241         CXXFLAGS=$save_CXXFLAGS
11242         if test -z "$ZXING_CFLAGS"; then
11243             AC_MSG_ERROR(zxing headers not found.)
11244         fi
11245         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11246             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11247             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11248         AC_LANG_POP([C++])
11249         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11250         FilterLibs "${ZXING_LIBS}"
11251         ZXING_LIBS="${filteredlibs}"
11252     else
11253         AC_MSG_RESULT([internal])
11254         SYSTEM_ZXING=
11255         BUILD_TYPE="$BUILD_TYPE ZXING"
11256         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11257     fi
11258     if test "$ENABLE_ZXING" = TRUE; then
11259         AC_DEFINE(ENABLE_ZXING)
11260     fi
11261     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11262     AC_LANG_PUSH([C++])
11263     save_CXXFLAGS=$CXXFLAGS
11264     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11265     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11266             #include <BitMatrix.h>
11267             #include <BitMatrixIO.h>
11268             int main(){
11269                 ZXing::BitMatrix matrix(1, 1);
11270                 matrix.set(0, 0, true);
11271                 ZXing::ToSVG(matrix);
11272                 return 0;
11273             }
11274         ])], [
11275             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11276             AC_MSG_RESULT([yes])
11277         ], [AC_MSG_RESULT([no])])
11278     CXXFLAGS=$save_CXXFLAGS
11279     AC_LANG_POP([C++])
11280     AC_SUBST(HAVE_ZXING_TOSVG)
11282 AC_SUBST(SYSTEM_ZXING)
11283 AC_SUBST(ENABLE_ZXING)
11284 AC_SUBST(ZXING_CFLAGS)
11285 AC_SUBST(ZXING_LIBS)
11287 dnl ===================================================================
11288 dnl Check for system box2d
11289 dnl ===================================================================
11290 AC_MSG_CHECKING([which box2d to use])
11291 if test "$with_system_box2d" = "yes"; then
11292     AC_MSG_RESULT([external])
11293     SYSTEM_BOX2D=TRUE
11294     AC_LANG_PUSH([C++])
11295     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11296         [BOX2D_H_FOUND='FALSE'])
11297     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11298         _BOX2D_LIB=box2d
11299         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11300     else
11301         # fail this. there's no other alternative to check when we are here.
11302         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11303             [AC_MSG_ERROR(box2d headers not found.)])
11304         _BOX2D_LIB=Box2D
11305         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11306     fi
11307     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11308         [ AC_MSG_ERROR(box2d library not found.) ], [])
11309     BOX2D_LIBS=-l$_BOX2D_LIB
11310     AC_LANG_POP([C++])
11311     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11312     FilterLibs "${BOX2D_LIBS}"
11313     BOX2D_LIBS="${filteredlibs}"
11314 else
11315     AC_MSG_RESULT([internal])
11316     SYSTEM_BOX2D=
11317     BUILD_TYPE="$BUILD_TYPE BOX2D"
11319 AC_SUBST(SYSTEM_BOX2D)
11320 AC_SUBST(BOX2D_CFLAGS)
11321 AC_SUBST(BOX2D_LIBS)
11323 dnl ===================================================================
11324 dnl Checking for altlinuxhyph
11325 dnl ===================================================================
11326 AC_MSG_CHECKING([which altlinuxhyph to use])
11327 if test "$with_system_altlinuxhyph" = "yes"; then
11328     AC_MSG_RESULT([external])
11329     SYSTEM_HYPH=TRUE
11330     AC_CHECK_HEADER(hyphen.h, [],
11331        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11332     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11333        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11334        [#include <hyphen.h>])
11335     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11336         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11337     if test -z "$HYPHEN_LIB"; then
11338         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11339            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11340     fi
11341     if test -z "$HYPHEN_LIB"; then
11342         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11343            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11344     fi
11345 else
11346     AC_MSG_RESULT([internal])
11347     SYSTEM_HYPH=
11348     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11349     if test "$COM" = "MSC"; then
11350         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11351     else
11352         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11353     fi
11355 AC_SUBST(SYSTEM_HYPH)
11356 AC_SUBST(HYPHEN_LIB)
11358 dnl ===================================================================
11359 dnl Checking for mythes
11360 dnl ===================================================================
11361 AC_MSG_CHECKING([which mythes to use])
11362 if test "$with_system_mythes" = "yes"; then
11363     AC_MSG_RESULT([external])
11364     SYSTEM_MYTHES=TRUE
11365     AC_LANG_PUSH([C++])
11366     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11367     if test "$MYTHES_PKGCONFIG" = "no"; then
11368         AC_CHECK_HEADER(mythes.hxx, [],
11369             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11370         AC_CHECK_LIB([mythes-1.2], [main], [:],
11371             [ MYTHES_FOUND=no], [])
11372     if test "$MYTHES_FOUND" = "no"; then
11373         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11374                 [ MYTHES_FOUND=no], [])
11375     fi
11376     if test "$MYTHES_FOUND" = "no"; then
11377         AC_MSG_ERROR([mythes library not found!.])
11378     fi
11379     fi
11380     AC_LANG_POP([C++])
11381     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11382     FilterLibs "${MYTHES_LIBS}"
11383     MYTHES_LIBS="${filteredlibs}"
11384 else
11385     AC_MSG_RESULT([internal])
11386     SYSTEM_MYTHES=
11387     BUILD_TYPE="$BUILD_TYPE MYTHES"
11388     if test "$COM" = "MSC"; then
11389         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11390     else
11391         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11392     fi
11394 AC_SUBST(SYSTEM_MYTHES)
11395 AC_SUBST(MYTHES_CFLAGS)
11396 AC_SUBST(MYTHES_LIBS)
11398 dnl ===================================================================
11399 dnl How should we build the linear programming solver ?
11400 dnl ===================================================================
11402 ENABLE_COINMP=
11403 AC_MSG_CHECKING([whether to build with CoinMP])
11404 if test "$enable_coinmp" != "no"; then
11405     ENABLE_COINMP=TRUE
11406     AC_MSG_RESULT([yes])
11407     if test "$with_system_coinmp" = "yes"; then
11408         SYSTEM_COINMP=TRUE
11409         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11410         FilterLibs "${COINMP_LIBS}"
11411         COINMP_LIBS="${filteredlibs}"
11412     else
11413         BUILD_TYPE="$BUILD_TYPE COINMP"
11414     fi
11415 else
11416     AC_MSG_RESULT([no])
11418 AC_SUBST(ENABLE_COINMP)
11419 AC_SUBST(SYSTEM_COINMP)
11420 AC_SUBST(COINMP_CFLAGS)
11421 AC_SUBST(COINMP_LIBS)
11423 ENABLE_LPSOLVE=
11424 AC_MSG_CHECKING([whether to build with lpsolve])
11425 if test "$enable_lpsolve" != "no"; then
11426     ENABLE_LPSOLVE=TRUE
11427     AC_MSG_RESULT([yes])
11428 else
11429     AC_MSG_RESULT([no])
11431 AC_SUBST(ENABLE_LPSOLVE)
11433 if test "$ENABLE_LPSOLVE" = TRUE; then
11434     AC_MSG_CHECKING([which lpsolve to use])
11435     if test "$with_system_lpsolve" = "yes"; then
11436         AC_MSG_RESULT([external])
11437         SYSTEM_LPSOLVE=TRUE
11438         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11439            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11440         save_LIBS=$LIBS
11441         # some systems need this. Like Ubuntu...
11442         AC_CHECK_LIB(m, floor)
11443         AC_CHECK_LIB(dl, dlopen)
11444         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11445             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11446         LIBS=$save_LIBS
11447     else
11448         AC_MSG_RESULT([internal])
11449         SYSTEM_LPSOLVE=
11450         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11451     fi
11453 AC_SUBST(SYSTEM_LPSOLVE)
11455 dnl ===================================================================
11456 dnl Checking for libexttextcat
11457 dnl ===================================================================
11458 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11459 if test "$with_system_libexttextcat" = "yes"; then
11460     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11462 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11464 dnl ===================================================================
11465 dnl Checking for libnumbertext
11466 dnl ===================================================================
11467 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11468 if test "$with_system_libnumbertext" = "yes"; then
11469     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11470     SYSTEM_LIBNUMBERTEXT=YES
11471 else
11472     SYSTEM_LIBNUMBERTEXT=
11474 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11475 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11477 dnl ***************************************
11478 dnl testing libc version for Linux...
11479 dnl ***************************************
11480 if test "$_os" = "Linux"; then
11481     AC_MSG_CHECKING([whether the libc is recent enough])
11482     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11483     #include <features.h>
11484     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11485     #error glibc >= 2.1 is required
11486     #endif
11487     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11490 dnl =========================================
11491 dnl Check for uuidgen
11492 dnl =========================================
11493 if test "$_os" = "WINNT"; then
11494     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11495     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11496     UUIDGEN=uuidgen.exe
11497     AC_SUBST(UUIDGEN)
11498 else
11499     AC_PATH_PROG([UUIDGEN], [uuidgen])
11500     if test -z "$UUIDGEN"; then
11501         AC_MSG_WARN([uuid is needed for building installation sets])
11502     fi
11505 dnl ***************************************
11506 dnl Checking for bison and flex
11507 dnl ***************************************
11508 AC_PATH_PROG(BISON, bison)
11509 if test -z "$BISON"; then
11510     AC_MSG_ERROR([no bison found in \$PATH, install it])
11511 else
11512     AC_MSG_CHECKING([the bison version])
11513     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11514     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11515     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11516     dnl cause
11517     dnl
11518     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]
11519     dnl   typedef union YYSTYPE
11520     dnl           ~~~~~~^~~~~~~
11521     dnl
11522     dnl while at least 3.4.1 is know to be good:
11523     if test "$COMPILER_PLUGINS" = TRUE; then
11524         if test "$_bison_longver" -lt 2004; then
11525             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11526         fi
11527     else
11528         if test "$_bison_longver" -lt 2000; then
11529             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11530         fi
11531     fi
11533 AC_SUBST([BISON])
11535 AC_PATH_PROG(FLEX, flex)
11536 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11537     FLEX=`cygpath -m $FLEX`
11539 if test -z "$FLEX"; then
11540     AC_MSG_ERROR([no flex found in \$PATH, install it])
11541 else
11542     AC_MSG_CHECKING([the flex version])
11543     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11544     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11545         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11546     fi
11548 AC_SUBST([FLEX])
11550 AC_PATH_PROG(DIFF, diff)
11551 if test -z "$DIFF"; then
11552     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11554 AC_SUBST([DIFF])
11556 AC_PATH_PROG(UNIQ, uniq)
11557 if test -z "$UNIQ"; then
11558     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11560 AC_SUBST([UNIQ])
11562 dnl ***************************************
11563 dnl Checking for patch
11564 dnl ***************************************
11565 AC_PATH_PROG(PATCH, patch)
11566 if test -z "$PATCH"; then
11567     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11570 dnl On Solaris or macOS, check if --with-gnu-patch was used
11571 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11572     if test -z "$with_gnu_patch"; then
11573         GNUPATCH=$PATCH
11574     else
11575         if test -x "$with_gnu_patch"; then
11576             GNUPATCH=$with_gnu_patch
11577         else
11578             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11579         fi
11580     fi
11582     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11583     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11584         AC_MSG_RESULT([yes])
11585     else
11586         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11587             AC_MSG_RESULT([no, but accepted (Apple patch)])
11588             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11589         else
11590             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11591         fi
11592     fi
11593 else
11594     GNUPATCH=$PATCH
11597 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11598     GNUPATCH=`cygpath -m $GNUPATCH`
11601 dnl We also need to check for --with-gnu-cp
11603 if test -z "$with_gnu_cp"; then
11604     # check the place where the good stuff is hidden on Solaris...
11605     if test -x /usr/gnu/bin/cp; then
11606         GNUCP=/usr/gnu/bin/cp
11607     else
11608         AC_PATH_PROGS(GNUCP, gnucp cp)
11609     fi
11610     if test -z $GNUCP; then
11611         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11612     fi
11613 else
11614     if test -x "$with_gnu_cp"; then
11615         GNUCP=$with_gnu_cp
11616     else
11617         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11618     fi
11621 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11622     GNUCP=`cygpath -m $GNUCP`
11625 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11626 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11627     AC_MSG_RESULT([yes])
11628 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11629     AC_MSG_RESULT([yes])
11630 else
11631     case "$build_os" in
11632     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11633         x_GNUCP=[\#]
11634         GNUCP=''
11635         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11636         ;;
11637     *)
11638         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11639         ;;
11640     esac
11643 AC_SUBST(GNUPATCH)
11644 AC_SUBST(GNUCP)
11645 AC_SUBST(x_GNUCP)
11647 dnl ***************************************
11648 dnl testing assembler path
11649 dnl ***************************************
11650 ML_EXE=""
11651 if test "$_os" = "WINNT"; then
11652     case "$WIN_HOST_ARCH" in
11653     x86) assembler=ml.exe ;;
11654     x64) assembler=ml64.exe ;;
11655     arm64) assembler=armasm64.exe ;;
11656     esac
11658     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11659     if test -f "$MSVC_HOST_PATH/$assembler"; then
11660         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11661         AC_MSG_RESULT([$ML_EXE])
11662     else
11663         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11664     fi
11667 AC_SUBST(ML_EXE)
11669 dnl ===================================================================
11670 dnl We need zip and unzip
11671 dnl ===================================================================
11672 AC_PATH_PROG(ZIP, zip)
11673 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11674 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11675     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],,)
11678 AC_PATH_PROG(UNZIP, unzip)
11679 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11681 dnl ===================================================================
11682 dnl Zip must be a specific type for different build types.
11683 dnl ===================================================================
11684 if test $build_os = cygwin; then
11685     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11686         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11687     fi
11690 dnl ===================================================================
11691 dnl We need touch with -h option support.
11692 dnl ===================================================================
11693 AC_PATH_PROG(TOUCH, touch)
11694 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11695 touch "$WARNINGS_FILE"
11696 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11697     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],,)
11700 dnl ===================================================================
11701 dnl Check for system epoxy
11702 dnl ===================================================================
11703 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11704 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11706 dnl ===================================================================
11707 dnl Show which vclplugs will be built.
11708 dnl ===================================================================
11709 R=""
11711 libo_ENABLE_VCLPLUG([gen])
11712 libo_ENABLE_VCLPLUG([gtk3])
11713 libo_ENABLE_VCLPLUG([gtk3_kde5])
11714 libo_ENABLE_VCLPLUG([gtk4])
11715 libo_ENABLE_VCLPLUG([kf5])
11716 libo_ENABLE_VCLPLUG([kf6])
11717 libo_ENABLE_VCLPLUG([qt5])
11718 libo_ENABLE_VCLPLUG([qt6])
11720 if test "$_os" = "WINNT"; then
11721     R="$R win"
11722 elif test "$_os" = "Darwin"; then
11723     R="$R osx"
11724 elif test "$_os" = "iOS"; then
11725     R="ios"
11726 elif test "$_os" = Android; then
11727     R="android"
11730 build_vcl_plugins="$R"
11731 if test -z "$build_vcl_plugins"; then
11732     build_vcl_plugins=" none"
11734 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11735 VCL_PLUGIN_INFO=$R
11736 AC_SUBST([VCL_PLUGIN_INFO])
11738 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11739     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11742 dnl ===================================================================
11743 dnl Check for GTK libraries
11744 dnl ===================================================================
11746 GTK3_CFLAGS=""
11747 GTK3_LIBS=""
11748 ENABLE_GTKTILEDVIEWER=""
11749 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11750     if test "$with_system_cairo" = no; then
11751         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.'
11752     fi
11753     : ${with_system_cairo:=yes}
11754     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)
11755     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11756     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11757     FilterLibs "${GTK3_LIBS}"
11758     GTK3_LIBS="${filteredlibs}"
11760     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11761     if test "$with_system_epoxy" != "yes"; then
11762         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11763         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11764                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11765     fi
11766 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
11767     PathFormat "${with_gtk3_build}/lib/pkgconfig"
11768     if test "$build_os" = "cygwin"; then
11769         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
11770         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
11771     fi
11773     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
11774     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
11775     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11776     FilterLibs "${GTK3_LIBS}"
11777     GTK3_LIBS="${filteredlibs}"
11778     ENABLE_GTKTILEDVIEWER="yes"
11780 AC_SUBST(GTK3_LIBS)
11781 AC_SUBST(GTK3_CFLAGS)
11782 AC_SUBST(ENABLE_GTKTILEDVIEWER)
11784 GTK4_CFLAGS=""
11785 GTK4_LIBS=""
11786 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11787     if test "$with_system_cairo" = no; then
11788         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11789     fi
11790     : ${with_system_cairo:=yes}
11791     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11792     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11793     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11794     FilterLibs "${GTK4_LIBS}"
11795     GTK4_LIBS="${filteredlibs}"
11797     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11798     if test "$with_system_epoxy" != "yes"; then
11799         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11800         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11801                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11802     fi
11804 AC_SUBST(GTK4_LIBS)
11805 AC_SUBST(GTK4_CFLAGS)
11807 if test "$enable_introspection" = yes; then
11808     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11809         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11810     else
11811         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11812     fi
11815 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
11816 if ! test "$ENABLE_GTK3" = TRUE; then
11817     if test "$enable_atspi_tests" = yes; then
11818         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
11819     fi
11820     enable_atspi_tests=no
11822 if ! test "$enable_atspi_tests" = no; then
11823     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
11824     if ! test "$XVFB_RUN" = no; then
11825         dnl make sure the found xvfb-run actually works
11826         AC_MSG_CHECKING([whether $XVFB_RUN works...])
11827         if $XVFB_RUN true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
11828             AC_MSG_RESULT([yes])
11829         else
11830             AC_MSG_RESULT([no])
11831             XVFB_RUN=no
11832         fi
11833     fi
11834     if test "$XVFB_RUN" = no; then
11835         if test "$enable_atspi_tests" = yes; then
11836             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
11837         fi
11838         enable_atspi_tests=no
11839     fi
11841 if ! test "$enable_atspi_tests" = no; then
11842     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
11843     if test "$DBUS_LAUNCH" = no; then
11844         if test "$enable_atspi_tests" = yes; then
11845             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
11846         fi
11847         enable_atspi_tests=no
11848     fi
11850 if ! test "$enable_atspi_tests" = no; then
11851     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
11852                       [if test "$enable_atspi_tests" = yes; then
11853                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
11854                        else
11855                            enable_atspi_tests=no
11856                        fi])
11858 if ! test "x$enable_atspi_tests" = xno; then
11859     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
11860                       [have_atspi_scroll_to=1],
11861                       [have_atspi_scroll_to=0])
11862     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
11863                        [Whether AT-SPI2 has the scrollTo API])
11865 ENABLE_ATSPI_TESTS=
11866 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
11867 AC_SUBST([ENABLE_ATSPI_TESTS])
11869 dnl ===================================================================
11870 dnl check for dbus support
11871 dnl ===================================================================
11872 ENABLE_DBUS=""
11873 DBUS_CFLAGS=""
11874 DBUS_LIBS=""
11875 DBUS_GLIB_CFLAGS=""
11876 DBUS_GLIB_LIBS=""
11877 DBUS_HAVE_GLIB=""
11879 if test "$enable_dbus" = "no"; then
11880     test_dbus=no
11883 AC_MSG_CHECKING([whether to enable DBUS support])
11884 if test "$test_dbus" = "yes"; then
11885     ENABLE_DBUS="TRUE"
11886     AC_MSG_RESULT([yes])
11887     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11888     AC_DEFINE(ENABLE_DBUS)
11889     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11890     FilterLibs "${DBUS_LIBS}"
11891     DBUS_LIBS="${filteredlibs}"
11893     # Glib is needed for BluetoothServer
11894     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11895     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11896         [
11897             DBUS_HAVE_GLIB="TRUE"
11898             AC_DEFINE(DBUS_HAVE_GLIB,1)
11899         ],
11900         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11901     )
11902 else
11903     AC_MSG_RESULT([no])
11906 AC_SUBST(ENABLE_DBUS)
11907 AC_SUBST(DBUS_CFLAGS)
11908 AC_SUBST(DBUS_LIBS)
11909 AC_SUBST(DBUS_GLIB_CFLAGS)
11910 AC_SUBST(DBUS_GLIB_LIBS)
11911 AC_SUBST(DBUS_HAVE_GLIB)
11913 AC_MSG_CHECKING([whether to enable Impress remote control])
11914 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11915     AC_MSG_RESULT([yes])
11916     ENABLE_SDREMOTE=TRUE
11917     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
11918         <true/>"
11919     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11921     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11922         # The Bluetooth code doesn't compile with macOS SDK 10.15
11923         if test "$enable_sdremote_bluetooth" = yes; then
11924             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11925         fi
11926         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
11927         enable_sdremote_bluetooth=no
11928     fi
11929     # If not explicitly enabled or disabled, default
11930     if test -z "$enable_sdremote_bluetooth"; then
11931         case "$OS" in
11932         LINUX|MACOSX|WNT)
11933             # Default to yes for these
11934             enable_sdremote_bluetooth=yes
11935             ;;
11936         *)
11937             # otherwise no
11938             enable_sdremote_bluetooth=no
11939             ;;
11940         esac
11941     fi
11942     # $enable_sdremote_bluetooth is guaranteed non-empty now
11944     if test "$enable_sdremote_bluetooth" != "no"; then
11945         if test "$OS" = "LINUX"; then
11946             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11947                 AC_MSG_RESULT([yes])
11948                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11949                 dnl ===================================================================
11950                 dnl Check for system bluez
11951                 dnl ===================================================================
11952                 AC_MSG_CHECKING([which Bluetooth header to use])
11953                 if test "$with_system_bluez" = "yes"; then
11954                     AC_MSG_RESULT([external])
11955                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11956                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11957                     SYSTEM_BLUEZ=TRUE
11958                 else
11959                     AC_MSG_RESULT([internal])
11960                     SYSTEM_BLUEZ=
11961                 fi
11962             else
11963                 AC_MSG_RESULT([no, dbus disabled])
11964                 ENABLE_SDREMOTE_BLUETOOTH=
11965                 SYSTEM_BLUEZ=
11966             fi
11967         else
11968             AC_MSG_RESULT([yes])
11969             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11970             SYSTEM_BLUEZ=
11971             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
11972         <key>com.apple.security.device.bluetooth</key>
11973         <true/>"
11974         fi
11975     else
11976         AC_MSG_RESULT([no])
11977         ENABLE_SDREMOTE_BLUETOOTH=
11978         SYSTEM_BLUEZ=
11979     fi
11980 else
11981     ENABLE_SDREMOTE=
11982     SYSTEM_BLUEZ=
11983     AC_MSG_RESULT([no])
11985 AC_SUBST(ENABLE_SDREMOTE)
11986 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11987 AC_SUBST(SDREMOTE_ENTITLEMENT)
11988 AC_SUBST(SYSTEM_BLUEZ)
11990 dnl ===================================================================
11991 dnl Check whether to enable GIO support
11992 dnl ===================================================================
11993 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11994     AC_MSG_CHECKING([whether to enable GIO support])
11995     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11996         dnl Need at least 2.26 for the dbus support.
11997         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11998                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11999         if test "$ENABLE_GIO" = "TRUE"; then
12000             AC_DEFINE(ENABLE_GIO)
12001             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12002             FilterLibs "${GIO_LIBS}"
12003             GIO_LIBS="${filteredlibs}"
12004         fi
12005     else
12006         AC_MSG_RESULT([no])
12007     fi
12009 AC_SUBST(ENABLE_GIO)
12010 AC_SUBST(GIO_CFLAGS)
12011 AC_SUBST(GIO_LIBS)
12014 dnl ===================================================================
12016 SPLIT_APP_MODULES=""
12017 if test "$enable_split_app_modules" = "yes"; then
12018     SPLIT_APP_MODULES="TRUE"
12020 AC_SUBST(SPLIT_APP_MODULES)
12022 SPLIT_OPT_FEATURES=""
12023 if test "$enable_split_opt_features" = "yes"; then
12024     SPLIT_OPT_FEATURES="TRUE"
12026 AC_SUBST(SPLIT_OPT_FEATURES)
12028 dnl ===================================================================
12029 dnl Check whether the GStreamer libraries are available.
12030 dnl ===================================================================
12032 ENABLE_GSTREAMER_1_0=""
12034 if test "$test_gstreamer_1_0" = yes; then
12036     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12037     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12038         ENABLE_GSTREAMER_1_0="TRUE"
12039         AC_MSG_RESULT([yes])
12040         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12041         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12042         FilterLibs "${GSTREAMER_1_0_LIBS}"
12043         GSTREAMER_1_0_LIBS="${filteredlibs}"
12044         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12045     else
12046         AC_MSG_RESULT([no])
12047     fi
12049 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12050 AC_SUBST(GSTREAMER_1_0_LIBS)
12051 AC_SUBST(ENABLE_GSTREAMER_1_0)
12053 ENABLE_OPENGL_TRANSITIONS=
12054 ENABLE_OPENGL_CANVAS=
12055 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12056    : # disable
12057 elif test "$_os" = "Darwin"; then
12058     # We use frameworks on macOS, no need for detail checks
12059     ENABLE_OPENGL_TRANSITIONS=TRUE
12060     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12061     ENABLE_OPENGL_CANVAS=TRUE
12062 elif test $_os = WINNT; then
12063     ENABLE_OPENGL_TRANSITIONS=TRUE
12064     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12065     ENABLE_OPENGL_CANVAS=TRUE
12066 else
12067     if test "$USING_X11" = TRUE; then
12068         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12069         ENABLE_OPENGL_TRANSITIONS=TRUE
12070         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12071         ENABLE_OPENGL_CANVAS=TRUE
12072     fi
12075 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12076 AC_SUBST(ENABLE_OPENGL_CANVAS)
12078 dnl =================================================
12079 dnl Check whether to build with OpenCL support.
12080 dnl =================================================
12082 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12083     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12084     # platform (optional at run-time, used through clew).
12085     BUILD_TYPE="$BUILD_TYPE OPENCL"
12086     AC_DEFINE(HAVE_FEATURE_OPENCL)
12089 dnl =================================================
12090 dnl Check whether to build with dconf support.
12091 dnl =================================================
12093 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12094     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12095         if test "$enable_dconf" = yes; then
12096             AC_MSG_ERROR([dconf not found])
12097         else
12098             enable_dconf=no
12099         fi])
12101 AC_MSG_CHECKING([whether to enable dconf])
12102 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12103     DCONF_CFLAGS=
12104     DCONF_LIBS=
12105     ENABLE_DCONF=
12106     AC_MSG_RESULT([no])
12107 else
12108     ENABLE_DCONF=TRUE
12109     AC_DEFINE(ENABLE_DCONF)
12110     AC_MSG_RESULT([yes])
12112 AC_SUBST([DCONF_CFLAGS])
12113 AC_SUBST([DCONF_LIBS])
12114 AC_SUBST([ENABLE_DCONF])
12116 # pdf import?
12117 AC_MSG_CHECKING([whether to build the PDF import feature])
12118 ENABLE_PDFIMPORT=
12119 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12120     AC_MSG_RESULT([yes])
12121     ENABLE_PDFIMPORT=TRUE
12122     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12123 else
12124     AC_MSG_RESULT([no])
12127 # Pdfium?
12128 AC_MSG_CHECKING([whether to build PDFium])
12129 ENABLE_PDFIUM=
12130 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12131     AC_MSG_RESULT([yes])
12132     ENABLE_PDFIUM=TRUE
12133     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12134 else
12135     AC_MSG_RESULT([no])
12137 AC_SUBST(ENABLE_PDFIUM)
12139 if test "$ENABLE_PDFIUM" = "TRUE"; then
12140     AC_MSG_CHECKING([which OpenJPEG library to use])
12141     if test "$with_system_openjpeg" = "yes"; then
12142         SYSTEM_OPENJPEG2=TRUE
12143         AC_MSG_RESULT([external])
12144         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12145         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12146         FilterLibs "${OPENJPEG2_LIBS}"
12147         OPENJPEG2_LIBS="${filteredlibs}"
12148     else
12149         SYSTEM_OPENJPEG2=FALSE
12150         AC_MSG_RESULT([internal])
12151     fi
12153     AC_MSG_CHECKING([which Abseil library to use])
12154     if test "$with_system_abseil" = "yes"; then
12155         AC_MSG_RESULT([external])
12156         SYSTEM_ABSEIL=TRUE
12157         AC_LANG_PUSH([C++])
12158         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
12159                         [AC_MSG_ERROR(abseil headers not found.)], [])
12160         AC_CHECK_HEADER(absl/types/bad_variant_access.h, [],
12161                         [AC_MSG_ERROR(abseil headers not found.)], [])
12162         AC_CHECK_LIB([absl_bad_optional_access], [main], [],
12163                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
12164         AC_CHECK_LIB([absl_bad_variant_access], [main], [],
12165                      [AC_MSG_ERROR([libabsl_bad_variant_access library not found.])])
12166         ABSEIL_LIBS="-labsl_bad_optional_access -labsl_bad_variant_access"
12167         AC_LANG_POP([C++])
12168         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12169         FilterLibs "${ABSEIL_LIBS}"
12170         ABSEIL_LIBS="${filteredlibs}"
12171     else
12172         AC_MSG_RESULT([internal])
12173     fi
12175 AC_SUBST(SYSTEM_OPENJPEG2)
12176 AC_SUBST(SYSTEM_ABSEIL)
12177 AC_SUBST(ABSEIL_CFLAGS)
12178 AC_SUBST(ABSEIL_LIBS)
12180 dnl ===================================================================
12181 dnl Check for poppler
12182 dnl ===================================================================
12183 ENABLE_POPPLER=
12184 AC_MSG_CHECKING([whether to build Poppler])
12185 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12186     AC_MSG_RESULT([yes])
12187     ENABLE_POPPLER=TRUE
12188     AC_DEFINE(HAVE_FEATURE_POPPLER)
12189 else
12190     AC_MSG_RESULT([no])
12192 AC_SUBST(ENABLE_POPPLER)
12194 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12195     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12198 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12199     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12202 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12203     dnl ===================================================================
12204     dnl Check for system poppler
12205     dnl ===================================================================
12206     AC_MSG_CHECKING([which PDF import poppler to use])
12207     if test "$with_system_poppler" = "yes"; then
12208         AC_MSG_RESULT([external])
12209         SYSTEM_POPPLER=TRUE
12210         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12211         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12212         FilterLibs "${POPPLER_LIBS}"
12213         POPPLER_LIBS="${filteredlibs}"
12214     else
12215         AC_MSG_RESULT([internal])
12216         SYSTEM_POPPLER=
12217         BUILD_TYPE="$BUILD_TYPE POPPLER"
12218     fi
12219     AC_DEFINE([ENABLE_PDFIMPORT],1)
12221 AC_SUBST(ENABLE_PDFIMPORT)
12222 AC_SUBST(SYSTEM_POPPLER)
12223 AC_SUBST(POPPLER_CFLAGS)
12224 AC_SUBST(POPPLER_LIBS)
12226 # Skia?
12227 ENABLE_SKIA=
12228 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12229     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12230     if test "$SYSTEM_FREETYPE" = TRUE; then
12231         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12232             [skia_freetype_ok=yes],
12233             [skia_freetype_ok=no])
12234     else # internal is ok
12235         skia_freetype_ok=yes
12236     fi
12237     AC_MSG_CHECKING([whether to build Skia])
12238     if test "$skia_freetype_ok" = "yes"; then
12239         if test "$enable_skia" = "debug"; then
12240             AC_MSG_RESULT([yes (debug)])
12241             ENABLE_SKIA_DEBUG=TRUE
12242         else
12243             AC_MSG_RESULT([yes])
12244             ENABLE_SKIA_DEBUG=
12245         fi
12246         ENABLE_SKIA=TRUE
12247         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12248                 AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12249         fi
12251         AC_DEFINE(HAVE_FEATURE_SKIA)
12252         BUILD_TYPE="$BUILD_TYPE SKIA"
12254         if test "$OS" = "MACOSX"; then
12255             AC_DEFINE(SK_GANESH,1)
12256             AC_DEFINE(SK_METAL,1)
12257             SKIA_GPU=METAL
12258             AC_SUBST(SKIA_GPU)
12259         else
12260             AC_DEFINE(SK_GANESH,1)
12261             AC_DEFINE(SK_VULKAN,1)
12262             SKIA_GPU=VULKAN
12263             AC_SUBST(SKIA_GPU)
12264         fi
12265     else
12266         AC_MSG_RESULT([no (freetype too old)])
12267         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12268     fi
12270 else
12271     AC_MSG_CHECKING([whether to build Skia])
12272     AC_MSG_RESULT([no])
12274 AC_SUBST(ENABLE_SKIA)
12275 AC_SUBST(ENABLE_SKIA_DEBUG)
12277 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12278 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12279 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12280 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12281 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12282 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12283 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12284 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12285 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12286 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12287 LO_CLANG_VERSION=
12288 HAVE_LO_CLANG_DLLEXPORTINLINES=
12290 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12291     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12292         AC_MSG_CHECKING([for Clang])
12293         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12294     else
12295         if test "$_os" = "WINNT"; then
12296             AC_MSG_CHECKING([for clang-cl])
12297             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12298                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12299             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12300                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12301             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12302                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12303             fi
12304             if test -n "$LO_CLANG_CC"; then
12305                 dnl explicitly set -m32/-m64
12306                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12307                 LO_CLANG_CXX="$LO_CLANG_CC"
12308                 AC_MSG_RESULT([$LO_CLANG_CC])
12309             else
12310                 AC_MSG_RESULT([no])
12311             fi
12313             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12314             echo "#include <stdlib.h>" > conftest.c
12315             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12316                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12317             rm -f conftest.c conftest.obj
12318             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12319                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12320             else
12321                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12322             fi
12323         else
12324             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12325             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12326         fi
12327     fi
12328     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12329         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12330         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12331         if test "$LO_CLANG_VERSION" -lt 50002; then
12332             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12333             LO_CLANG_CC=
12334             LO_CLANG_CXX=
12335         fi
12336     fi
12337     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12338         save_CXX="$CXX"
12339         CXX="$LO_CLANG_CXX"
12340         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12341         AC_LANG_PUSH([C++])
12342         save_CXXFLAGS=$CXXFLAGS
12343         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12344         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12345                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12346                 AC_MSG_RESULT([yes])
12347             ], [AC_MSG_RESULT([no])])
12348         CXXFLAGS=$save_CXXFLAGS
12349         AC_LANG_POP([C++])
12350         CXX="$save_CXX"
12351         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12352             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.])
12353         fi
12354     fi
12355     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12356         # Skia is the default on Windows and Mac, so hard-require Clang.
12357         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12358         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12359             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12360         else
12361             AC_MSG_WARN([Clang compiler not found.])
12362         fi
12363     else
12365         save_CXX="$CXX"
12366         CXX="$LO_CLANG_CXX"
12367         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12368         flag_sse2=-msse2
12369         flag_ssse3=-mssse3
12370         flag_sse41=-msse4.1
12371         flag_sse42=-msse4.2
12372         flag_avx=-mavx
12373         flag_avx2=-mavx2
12374         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12375         flag_avx512f=-mavx512f
12376         flag_f16c=-mf16c
12377         flag_fma=-mfma
12379         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12380         AC_LANG_PUSH([C++])
12381         save_CXXFLAGS=$CXXFLAGS
12382         CXXFLAGS="$CXXFLAGS $flag_sse2"
12383         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12384             #include <emmintrin.h>
12385             int main () {
12386                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12387                 c = _mm_xor_si128 (a, b);
12388                 return 0;
12389             }
12390             ])],
12391             [can_compile_sse2=yes],
12392             [can_compile_sse2=no])
12393         AC_LANG_POP([C++])
12394         CXXFLAGS=$save_CXXFLAGS
12395         AC_MSG_RESULT([${can_compile_sse2}])
12396         if test "${can_compile_sse2}" = "yes" ; then
12397             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12398         fi
12400         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12401         AC_LANG_PUSH([C++])
12402         save_CXXFLAGS=$CXXFLAGS
12403         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12404         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12405             #include <tmmintrin.h>
12406             int main () {
12407                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12408                 c = _mm_maddubs_epi16 (a, b);
12409                 return 0;
12410             }
12411             ])],
12412             [can_compile_ssse3=yes],
12413             [can_compile_ssse3=no])
12414         AC_LANG_POP([C++])
12415         CXXFLAGS=$save_CXXFLAGS
12416         AC_MSG_RESULT([${can_compile_ssse3}])
12417         if test "${can_compile_ssse3}" = "yes" ; then
12418             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12419         fi
12421         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12422         AC_LANG_PUSH([C++])
12423         save_CXXFLAGS=$CXXFLAGS
12424         CXXFLAGS="$CXXFLAGS $flag_sse41"
12425         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12426             #include <smmintrin.h>
12427             int main () {
12428                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12429                 c = _mm_cmpeq_epi64 (a, b);
12430                 return 0;
12431             }
12432             ])],
12433             [can_compile_sse41=yes],
12434             [can_compile_sse41=no])
12435         AC_LANG_POP([C++])
12436         CXXFLAGS=$save_CXXFLAGS
12437         AC_MSG_RESULT([${can_compile_sse41}])
12438         if test "${can_compile_sse41}" = "yes" ; then
12439             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12440         fi
12442         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12443         AC_LANG_PUSH([C++])
12444         save_CXXFLAGS=$CXXFLAGS
12445         CXXFLAGS="$CXXFLAGS $flag_sse42"
12446         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12447             #include <nmmintrin.h>
12448             int main () {
12449                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12450                 c = _mm_cmpgt_epi64 (a, b);
12451                 return 0;
12452             }
12453             ])],
12454             [can_compile_sse42=yes],
12455             [can_compile_sse42=no])
12456         AC_LANG_POP([C++])
12457         CXXFLAGS=$save_CXXFLAGS
12458         AC_MSG_RESULT([${can_compile_sse42}])
12459         if test "${can_compile_sse42}" = "yes" ; then
12460             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12461         fi
12463         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12464         AC_LANG_PUSH([C++])
12465         save_CXXFLAGS=$CXXFLAGS
12466         CXXFLAGS="$CXXFLAGS $flag_avx"
12467         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12468             #include <immintrin.h>
12469             int main () {
12470                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12471                 c = _mm256_xor_ps(a, b);
12472                 return 0;
12473             }
12474             ])],
12475             [can_compile_avx=yes],
12476             [can_compile_avx=no])
12477         AC_LANG_POP([C++])
12478         CXXFLAGS=$save_CXXFLAGS
12479         AC_MSG_RESULT([${can_compile_avx}])
12480         if test "${can_compile_avx}" = "yes" ; then
12481             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12482         fi
12484         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12485         AC_LANG_PUSH([C++])
12486         save_CXXFLAGS=$CXXFLAGS
12487         CXXFLAGS="$CXXFLAGS $flag_avx2"
12488         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12489             #include <immintrin.h>
12490             int main () {
12491                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12492                 c = _mm256_maddubs_epi16(a, b);
12493                 return 0;
12494             }
12495             ])],
12496             [can_compile_avx2=yes],
12497             [can_compile_avx2=no])
12498         AC_LANG_POP([C++])
12499         CXXFLAGS=$save_CXXFLAGS
12500         AC_MSG_RESULT([${can_compile_avx2}])
12501         if test "${can_compile_avx2}" = "yes" ; then
12502             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12503         fi
12505         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12506         AC_LANG_PUSH([C++])
12507         save_CXXFLAGS=$CXXFLAGS
12508         CXXFLAGS="$CXXFLAGS $flag_avx512"
12509         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12510             #include <immintrin.h>
12511             int main () {
12512                 __m512i a = _mm512_loadu_si512(0);
12513                 __m512d v1 = _mm512_load_pd(0);
12514                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12515                 __m512d v2 = _mm512_abs_pd(v1);
12516                 return 0;
12517             }
12518             ])],
12519             [can_compile_avx512=yes],
12520             [can_compile_avx512=no])
12521         AC_LANG_POP([C++])
12522         CXXFLAGS=$save_CXXFLAGS
12523         AC_MSG_RESULT([${can_compile_avx512}])
12524         if test "${can_compile_avx512}" = "yes" ; then
12525             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12526             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12527         fi
12529         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12530         AC_LANG_PUSH([C++])
12531         save_CXXFLAGS=$CXXFLAGS
12532         CXXFLAGS="$CXXFLAGS $flag_f16c"
12533         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12534             #include <immintrin.h>
12535             int main () {
12536                 __m128i a = _mm_set1_epi32 (0);
12537                 __m128 c;
12538                 c = _mm_cvtph_ps(a);
12539                 return 0;
12540             }
12541             ])],
12542             [can_compile_f16c=yes],
12543             [can_compile_f16c=no])
12544         AC_LANG_POP([C++])
12545         CXXFLAGS=$save_CXXFLAGS
12546         AC_MSG_RESULT([${can_compile_f16c}])
12547         if test "${can_compile_f16c}" = "yes" ; then
12548             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12549         fi
12551         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12552         AC_LANG_PUSH([C++])
12553         save_CXXFLAGS=$CXXFLAGS
12554         CXXFLAGS="$CXXFLAGS $flag_fma"
12555         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12556             #include <immintrin.h>
12557             int main () {
12558                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12559                 d = _mm256_fmadd_ps(a, b, c);
12560                 return 0;
12561             }
12562             ])],
12563             [can_compile_fma=yes],
12564             [can_compile_fma=no])
12565         AC_LANG_POP([C++])
12566         CXXFLAGS=$save_CXXFLAGS
12567         AC_MSG_RESULT([${can_compile_fma}])
12568         if test "${can_compile_fma}" = "yes" ; then
12569             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12570         fi
12572         CXX="$save_CXX"
12573     fi
12576 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12578 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12579     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12580     AC_LANG_PUSH([C])
12581     save_CC="$CC"
12582     CC="$LO_CLANG_CC"
12583     save_CFLAGS=$CFLAGS
12584     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12585     dnl an empty program will do, we're checking the compiler flags
12586     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12587                       [use_ccache=yes], [use_ccache=no])
12588     CFLAGS=$save_CFLAGS
12589     CC=$save_CC
12590     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12591         AC_MSG_RESULT([yes])
12592     else
12593         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12594         AC_MSG_RESULT([no])
12595     fi
12596     AC_LANG_POP([C])
12598     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12599     AC_LANG_PUSH([C++])
12600     save_CXX="$CXX"
12601     CXX="$LO_CLANG_CXX"
12602     save_CXXFLAGS=$CXXFLAGS
12603     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12604     dnl an empty program will do, we're checking the compiler flags
12605     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12606                       [use_ccache=yes], [use_ccache=no])
12607     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12608         AC_MSG_RESULT([yes])
12609     else
12610         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12611         AC_MSG_RESULT([no])
12612     fi
12613     CXXFLAGS=$save_CXXFLAGS
12614     CXX=$save_CXX
12615     AC_LANG_POP([C++])
12618 AC_SUBST(LO_CLANG_CC)
12619 AC_SUBST(LO_CLANG_CXX)
12620 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12621 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12622 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12623 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12624 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12625 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12626 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12627 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12628 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12629 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12630 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12631 AC_SUBST(LO_CLANG_VERSION)
12632 AC_SUBST(CLANG_USE_LD)
12633 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12635 SYSTEM_GPGMEPP=
12637 AC_MSG_CHECKING([whether to enable gpgmepp])
12638 if test "$enable_gpgmepp" = no; then
12639     AC_MSG_RESULT([no])
12640 elif test "$enable_mpl_subset" = "yes"; then
12641     AC_MSG_RESULT([no (MPL only])
12642 elif test "$enable_fuzzers" = "yes"; then
12643     AC_MSG_RESULT([no (oss-fuzz)])
12644 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12645     AC_MSG_RESULT([yes])
12646     dnl ===================================================================
12647     dnl Check for system gpgme
12648     dnl ===================================================================
12649     AC_MSG_CHECKING([which gpgmepp to use])
12650     if test "$with_system_gpgmepp" = "yes"; then
12651         AC_MSG_RESULT([external])
12652         SYSTEM_GPGMEPP=TRUE
12654         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12655         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12656             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12657         AC_CHECK_HEADER(gpgme.h, [],
12658             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12659         AC_CHECK_LIB(gpgmepp, main, [],
12660             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12661         GPGMEPP_LIBS=-lgpgmepp
12662     else
12663         AC_MSG_RESULT([internal])
12664         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12666         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12667         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12668         if test "$_os" != "WINNT"; then
12669             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12670             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12671         fi
12672     fi
12673     ENABLE_GPGMEPP=TRUE
12674     AC_DEFINE([HAVE_FEATURE_GPGME])
12675     AC_PATH_PROG(GPG, gpg)
12676     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12677     # so let's exclude that manually for the moment
12678     if test -n "$GPG" -a "$_os" != "WINNT"; then
12679         # make sure we not only have a working gpgme, but a full working
12680         # gpg installation to run OpenPGP signature verification
12681         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12682     fi
12683     if test "$_os" = "Linux"; then
12684       uid=`id -u`
12685       AC_MSG_CHECKING([for /run/user/$uid])
12686       if test -d /run/user/$uid; then
12687         AC_MSG_RESULT([yes])
12688         AC_PATH_PROG(GPGCONF, gpgconf)
12690         # Older versions of gpgconf are not working as expected, since
12691         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12692         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12693         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12694         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12695         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12696         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12697         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12698           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12699           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12700           if $GPGCONF --dump-options > /dev/null ; then
12701             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12702               AC_MSG_RESULT([yes])
12703               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12704               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12705             else
12706               AC_MSG_RESULT([no])
12707             fi
12708           else
12709             AC_MSG_RESULT([no. missing or broken gpgconf?])
12710           fi
12711         else
12712           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12713         fi
12714       else
12715         AC_MSG_RESULT([no])
12716      fi
12717    fi
12718 else
12719     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12721 AC_SUBST(ENABLE_GPGMEPP)
12722 AC_SUBST(SYSTEM_GPGMEPP)
12723 AC_SUBST(GPG_ERROR_CFLAGS)
12724 AC_SUBST(GPG_ERROR_LIBS)
12725 AC_SUBST(LIBASSUAN_CFLAGS)
12726 AC_SUBST(LIBASSUAN_LIBS)
12727 AC_SUBST(GPGMEPP_CFLAGS)
12728 AC_SUBST(GPGMEPP_LIBS)
12730 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12731 if test "$with_java" != "no"; then
12732     AC_MSG_RESULT([yes])
12733     ENABLE_JAVA_WEBSOCKET=TRUE
12734     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12735     NEED_ANT=TRUE
12736 else
12737     AC_MSG_RESULT([no])
12738     ENABLE_JAVA_WEBSOCKET=
12740 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12742 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12743 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12744     AC_MSG_RESULT([yes])
12745     ENABLE_MEDIAWIKI=TRUE
12746     BUILD_TYPE="$BUILD_TYPE XSLTML"
12747     if test  "x$with_java" = "xno"; then
12748         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12749     fi
12750 else
12751     AC_MSG_RESULT([no])
12752     ENABLE_MEDIAWIKI=
12753     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12755 AC_SUBST(ENABLE_MEDIAWIKI)
12757 AC_MSG_CHECKING([whether to build the Report Builder])
12758 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12759     AC_MSG_RESULT([yes])
12760     ENABLE_REPORTBUILDER=TRUE
12761     AC_MSG_CHECKING([which jfreereport libs to use])
12762     if test "$with_system_jfreereport" = "yes"; then
12763         SYSTEM_JFREEREPORT=TRUE
12764         AC_MSG_RESULT([external])
12765         if test -z $SAC_JAR; then
12766             SAC_JAR=/usr/share/java/sac.jar
12767         fi
12768         if ! test -f $SAC_JAR; then
12769              AC_MSG_ERROR(sac.jar not found.)
12770         fi
12772         if test -z $LIBXML_JAR; then
12773             if test -f /usr/share/java/libxml-1.0.0.jar; then
12774                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12775             elif test -f /usr/share/java/libxml.jar; then
12776                 LIBXML_JAR=/usr/share/java/libxml.jar
12777             else
12778                 AC_MSG_ERROR(libxml.jar replacement not found.)
12779             fi
12780         elif ! test -f $LIBXML_JAR; then
12781             AC_MSG_ERROR(libxml.jar not found.)
12782         fi
12784         if test -z $FLUTE_JAR; then
12785             if test -f /usr/share/java/flute-1.3.0.jar; then
12786                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12787             elif test -f /usr/share/java/flute.jar; then
12788                 FLUTE_JAR=/usr/share/java/flute.jar
12789             else
12790                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12791             fi
12792         elif ! test -f $FLUTE_JAR; then
12793             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12794         fi
12796         if test -z $JFREEREPORT_JAR; then
12797             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12798                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12799             elif test -f /usr/share/java/flow-engine.jar; then
12800                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12801             else
12802                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12803             fi
12804         elif ! test -f  $JFREEREPORT_JAR; then
12805                 AC_MSG_ERROR(jfreereport.jar not found.)
12806         fi
12808         if test -z $LIBLAYOUT_JAR; then
12809             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12810                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12811             elif test -f /usr/share/java/liblayout.jar; then
12812                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12813             else
12814                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12815             fi
12816         elif ! test -f $LIBLAYOUT_JAR; then
12817                 AC_MSG_ERROR(liblayout.jar not found.)
12818         fi
12820         if test -z $LIBLOADER_JAR; then
12821             if test -f /usr/share/java/libloader-1.0.0.jar; then
12822                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12823             elif test -f /usr/share/java/libloader.jar; then
12824                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12825             else
12826                 AC_MSG_ERROR(libloader.jar replacement not found.)
12827             fi
12828         elif ! test -f  $LIBLOADER_JAR; then
12829             AC_MSG_ERROR(libloader.jar not found.)
12830         fi
12832         if test -z $LIBFORMULA_JAR; then
12833             if test -f /usr/share/java/libformula-0.2.0.jar; then
12834                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12835             elif test -f /usr/share/java/libformula.jar; then
12836                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12837             else
12838                 AC_MSG_ERROR(libformula.jar replacement not found.)
12839             fi
12840         elif ! test -f $LIBFORMULA_JAR; then
12841                 AC_MSG_ERROR(libformula.jar not found.)
12842         fi
12844         if test -z $LIBREPOSITORY_JAR; then
12845             if test -f /usr/share/java/librepository-1.0.0.jar; then
12846                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12847             elif test -f /usr/share/java/librepository.jar; then
12848                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12849             else
12850                 AC_MSG_ERROR(librepository.jar replacement not found.)
12851             fi
12852         elif ! test -f $LIBREPOSITORY_JAR; then
12853             AC_MSG_ERROR(librepository.jar not found.)
12854         fi
12856         if test -z $LIBFONTS_JAR; then
12857             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12858                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12859             elif test -f /usr/share/java/libfonts.jar; then
12860                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12861             else
12862                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12863             fi
12864         elif ! test -f $LIBFONTS_JAR; then
12865                 AC_MSG_ERROR(libfonts.jar not found.)
12866         fi
12868         if test -z $LIBSERIALIZER_JAR; then
12869             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12870                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12871             elif test -f /usr/share/java/libserializer.jar; then
12872                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12873             else
12874                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12875             fi
12876         elif ! test -f $LIBSERIALIZER_JAR; then
12877                 AC_MSG_ERROR(libserializer.jar not found.)
12878         fi
12880         if test -z $LIBBASE_JAR; then
12881             if test -f /usr/share/java/libbase-1.0.0.jar; then
12882                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12883             elif test -f /usr/share/java/libbase.jar; then
12884                 LIBBASE_JAR=/usr/share/java/libbase.jar
12885             else
12886                 AC_MSG_ERROR(libbase.jar replacement not found.)
12887             fi
12888         elif ! test -f $LIBBASE_JAR; then
12889             AC_MSG_ERROR(libbase.jar not found.)
12890         fi
12892     else
12893         AC_MSG_RESULT([internal])
12894         SYSTEM_JFREEREPORT=
12895         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12896         NEED_ANT=TRUE
12897     fi
12898 else
12899     AC_MSG_RESULT([no])
12900     ENABLE_REPORTBUILDER=
12901     SYSTEM_JFREEREPORT=
12903 AC_SUBST(ENABLE_REPORTBUILDER)
12904 AC_SUBST(SYSTEM_JFREEREPORT)
12905 AC_SUBST(SAC_JAR)
12906 AC_SUBST(LIBXML_JAR)
12907 AC_SUBST(FLUTE_JAR)
12908 AC_SUBST(JFREEREPORT_JAR)
12909 AC_SUBST(LIBBASE_JAR)
12910 AC_SUBST(LIBLAYOUT_JAR)
12911 AC_SUBST(LIBLOADER_JAR)
12912 AC_SUBST(LIBFORMULA_JAR)
12913 AC_SUBST(LIBREPOSITORY_JAR)
12914 AC_SUBST(LIBFONTS_JAR)
12915 AC_SUBST(LIBSERIALIZER_JAR)
12917 # scripting provider for BeanShell?
12918 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12919 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12920     AC_MSG_RESULT([yes])
12921     ENABLE_SCRIPTING_BEANSHELL=TRUE
12923     dnl ===================================================================
12924     dnl Check for system beanshell
12925     dnl ===================================================================
12926     AC_MSG_CHECKING([which beanshell to use])
12927     if test "$with_system_beanshell" = "yes"; then
12928         AC_MSG_RESULT([external])
12929         SYSTEM_BSH=TRUE
12930         if test -z $BSH_JAR; then
12931             BSH_JAR=/usr/share/java/bsh.jar
12932         fi
12933         if ! test -f $BSH_JAR; then
12934             AC_MSG_ERROR(bsh.jar not found.)
12935         fi
12936     else
12937         AC_MSG_RESULT([internal])
12938         SYSTEM_BSH=
12939         BUILD_TYPE="$BUILD_TYPE BSH"
12940     fi
12941 else
12942     AC_MSG_RESULT([no])
12943     ENABLE_SCRIPTING_BEANSHELL=
12944     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12946 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12947 AC_SUBST(SYSTEM_BSH)
12948 AC_SUBST(BSH_JAR)
12950 # scripting provider for JavaScript?
12951 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12952 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12953     AC_MSG_RESULT([yes])
12954     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12956     dnl ===================================================================
12957     dnl Check for system rhino
12958     dnl ===================================================================
12959     AC_MSG_CHECKING([which rhino to use])
12960     if test "$with_system_rhino" = "yes"; then
12961         AC_MSG_RESULT([external])
12962         SYSTEM_RHINO=TRUE
12963         if test -z $RHINO_JAR; then
12964             RHINO_JAR=/usr/share/java/js.jar
12965         fi
12966         if ! test -f $RHINO_JAR; then
12967             AC_MSG_ERROR(js.jar not found.)
12968         fi
12969     else
12970         AC_MSG_RESULT([internal])
12971         SYSTEM_RHINO=
12972         BUILD_TYPE="$BUILD_TYPE RHINO"
12973         NEED_ANT=TRUE
12974     fi
12975 else
12976     AC_MSG_RESULT([no])
12977     ENABLE_SCRIPTING_JAVASCRIPT=
12978     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12980 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12981 AC_SUBST(SYSTEM_RHINO)
12982 AC_SUBST(RHINO_JAR)
12984 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
12985 # paths should be added to library search path. So lets put all 64-bit
12986 # platforms there.
12987 supports_multilib=
12988 case "$host_cpu" in
12989 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
12990     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12991         supports_multilib="yes"
12992     fi
12993     ;;
12995     ;;
12996 esac
12998 dnl ===================================================================
12999 dnl QT5 Integration
13000 dnl ===================================================================
13002 QT5_CFLAGS=""
13003 QT5_LIBS=""
13004 QMAKE5="qmake"
13005 MOC5="moc"
13006 QT5_GOBJECT_CFLAGS=""
13007 QT5_GOBJECT_LIBS=""
13008 QT5_HAVE_GOBJECT=""
13009 QT5_PLATFORMS_SRCDIR=""
13010 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13011         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13012         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13013 then
13014     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13015     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13017     if test -n "$supports_multilib"; then
13018         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13019     fi
13021     qt5_test_include="QtWidgets/qapplication.h"
13022     if test "$_os" = "Emscripten"; then
13023         qt5_test_library="libQt5Widgets.a"
13024     else
13025         qt5_test_library="libQt5Widgets.so"
13026     fi
13028     dnl Check for qmake5
13029     if test -n "$QT5DIR"; then
13030         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13031     else
13032         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13033     fi
13034     if test "$QMAKE5" = "no"; then
13035         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13036     else
13037         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13038         if test -z "$qmake5_test_ver"; then
13039             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13040         fi
13041         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13042         qt5_minimal_minor="15"
13043         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13044             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13045         else
13046             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13047         fi
13048     fi
13050     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13051     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13052     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13053     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13055     AC_MSG_CHECKING([for Qt5 headers])
13056     qt5_incdir="no"
13057     for inc_dir in $qt5_incdirs; do
13058         if test -r "$inc_dir/$qt5_test_include"; then
13059             qt5_incdir="$inc_dir"
13060             break
13061         fi
13062     done
13063     AC_MSG_RESULT([$qt5_incdir])
13064     if test "x$qt5_incdir" = "xno"; then
13065         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13066     fi
13067     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13068     AC_LANG_PUSH([C++])
13069     save_CPPFLAGS=$CPPFLAGS
13070     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13071     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13072         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13073     CPPFLAGS=$save_CPPFLAGS
13074     AC_LANG_POP([C++])
13076     AC_MSG_CHECKING([for Qt5 libraries])
13077     qt5_libdir="no"
13078     for lib_dir in $qt5_libdirs; do
13079         if test -r "$lib_dir/$qt5_test_library"; then
13080             qt5_libdir="$lib_dir"
13081             break
13082         fi
13083     done
13084     AC_MSG_RESULT([$qt5_libdir])
13085     if test "x$qt5_libdir" = "xno"; then
13086         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13087     fi
13089     if test "$_os" = "Emscripten"; then
13090         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13091             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13092         fi
13093         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13094             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13095         fi
13097         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13098         if ! test -x "$EMSDK_LLVM_NM"; then
13099             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13100         fi
13101         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13102             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13103         fi
13104         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13105         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
13106             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13107         fi
13108         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
13109             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
13110         fi
13111     fi
13113     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13114     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13115     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13116     if test "$_os" = "Emscripten"; then
13117         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13118     fi
13120     if test "$USING_X11" = TRUE; then
13121         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13122         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13123         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13124         QT5_USING_X11=1
13125         AC_DEFINE(QT5_USING_X11)
13126     fi
13128     dnl Check for Meta Object Compiler
13130     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13131     if test "$MOC5" = "no"; then
13132         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13133 the root of your Qt installation by exporting QT5DIR before running "configure".])
13134     fi
13136     if test "$test_gstreamer_1_0" = yes; then
13137         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13138                 QT5_HAVE_GOBJECT=1
13139                 AC_DEFINE(QT5_HAVE_GOBJECT)
13140             ],
13141             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13142         )
13143     fi
13145 AC_SUBST(QT5_CFLAGS)
13146 AC_SUBST(QT5_LIBS)
13147 AC_SUBST(MOC5)
13148 AC_SUBST(QT5_GOBJECT_CFLAGS)
13149 AC_SUBST(QT5_GOBJECT_LIBS)
13150 AC_SUBST(QT5_HAVE_GOBJECT)
13151 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13153 dnl ===================================================================
13154 dnl QT6 Integration
13155 dnl ===================================================================
13157 QT6_CFLAGS=""
13158 QT6_LIBS=""
13159 QMAKE6="qmake"
13160 MOC6="moc"
13161 QT6_PLATFORMS_SRCDIR=""
13162 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13163         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13164 then
13165     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13166     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13168     if test -n "$supports_multilib"; then
13169         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13170     fi
13172     qt6_test_include="QtWidgets/qapplication.h"
13173     if test "$_os" = "Emscripten"; then
13174         qt6_test_library="libQt6Widgets.a"
13175     else
13176         qt6_test_library="libQt6Widgets.so"
13177     fi
13179     dnl Check for qmake6
13180     if test -n "$QT6DIR"; then
13181         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13182     else
13183         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13184     fi
13185     if test "$QMAKE6" = "no"; then
13186         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13187     else
13188         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13189         if test -z "$qmake6_test_ver"; then
13190             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13191         fi
13192         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13193     fi
13195     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13196     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13197     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13198     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13200     AC_MSG_CHECKING([for Qt6 headers])
13201     qt6_incdir="no"
13202     for inc_dir in $qt6_incdirs; do
13203         if test -r "$inc_dir/$qt6_test_include"; then
13204             qt6_incdir="$inc_dir"
13205             break
13206         fi
13207     done
13208     AC_MSG_RESULT([$qt6_incdir])
13209     if test "x$qt6_incdir" = "xno"; then
13210         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13211     fi
13212     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13213     AC_LANG_PUSH([C++])
13214     save_CPPFLAGS=$CPPFLAGS
13215     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13216     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13217         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13218     CPPFLAGS=$save_CPPFLAGS
13219     AC_LANG_POP([C++])
13221     AC_MSG_CHECKING([for Qt6 libraries])
13222     qt6_libdir="no"
13223     for lib_dir in $qt6_libdirs; do
13224         if test -r "$lib_dir/$qt6_test_library"; then
13225             qt6_libdir="$lib_dir"
13226             break
13227         fi
13228     done
13229     AC_MSG_RESULT([$qt6_libdir])
13230     if test "x$qt6_libdir" = "xno"; then
13231         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13232     fi
13234     if test "$_os" = "Emscripten"; then
13235         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13236             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13237         fi
13238         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13239             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13240         fi
13241     fi
13243     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13244     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13245     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13246     if test "$_os" = "Emscripten"; then
13247         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13248     fi
13250     if test "$USING_X11" = TRUE; then
13251         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13252         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13253         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13254         QT6_USING_X11=1
13255         AC_DEFINE(QT6_USING_X11)
13256     fi
13258     dnl Check for Meta Object Compiler
13260     for lib_dir in $qt6_libdirs; do
13261         if test -z "$qt6_libexec_dirs"; then
13262             qt6_libexec_dirs="$lib_dir/libexec"
13263         else
13264             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13265         fi
13266     done
13267     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])
13268     if test "$MOC6" = "no"; then
13269         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13270 the root of your Qt installation by exporting QT6DIR before running "configure".])
13271     else
13272         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13273         if test -z "$moc6_test_ver"; then
13274             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13275         fi
13276         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13277     fi
13279 AC_SUBST(QT6_CFLAGS)
13280 AC_SUBST(QT6_LIBS)
13281 AC_SUBST(MOC6)
13282 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13284 dnl ===================================================================
13285 dnl KF5 Integration
13286 dnl ===================================================================
13288 KF5_CFLAGS=""
13289 KF5_LIBS=""
13290 KF5_CONFIG="kf5-config"
13291 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13292         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13293 then
13294     if test "$OS" = "HAIKU"; then
13295         haiku_arch="`echo $RTL_ARCH | tr X x`"
13296         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13297         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13298     fi
13300     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13301     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13302     if test -n "$supports_multilib"; then
13303         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13304     fi
13306     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13307     kf5_test_library="libKF5KIOFileWidgets.so"
13308     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13310     dnl kf5 KDE4 support compatibility installed
13311     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13312     if test "$KF5_CONFIG" != "no"; then
13313         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13314         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13315     fi
13317     dnl Check for KF5 headers
13318     AC_MSG_CHECKING([for KF5 headers])
13319     kf5_incdir="no"
13320     for kf5_check in $kf5_incdirs; do
13321         if test -r "$kf5_check/$kf5_test_include"; then
13322             kf5_incdir="$kf5_check/KF5"
13323             break
13324         fi
13325     done
13326     AC_MSG_RESULT([$kf5_incdir])
13327     if test "x$kf5_incdir" = "xno"; then
13328         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13329     fi
13331     dnl Check for KF5 libraries
13332     AC_MSG_CHECKING([for KF5 libraries])
13333     kf5_libdir="no"
13334     for kf5_check in $kf5_libdirs; do
13335         if test -r "$kf5_check/$kf5_test_library"; then
13336             kf5_libdir="$kf5_check"
13337             break
13338         fi
13339     done
13341     AC_MSG_RESULT([$kf5_libdir])
13342     if test "x$kf5_libdir" = "xno"; then
13343         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13344     fi
13346     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"
13347     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13348     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13350     if test "$USING_X11" = TRUE; then
13351         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13352     fi
13354     AC_LANG_PUSH([C++])
13355     save_CXXFLAGS=$CXXFLAGS
13356     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13357     AC_MSG_CHECKING([whether KDE is >= 5.0])
13358        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13359 #include <kcoreaddons_version.h>
13361 int main(int argc, char **argv) {
13362        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13363        else return 1;
13365        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13366     CXXFLAGS=$save_CXXFLAGS
13367     AC_LANG_POP([C++])
13369 AC_SUBST(KF5_CFLAGS)
13370 AC_SUBST(KF5_LIBS)
13372 dnl ===================================================================
13373 dnl KF6 Integration
13374 dnl ===================================================================
13376 KF6_CFLAGS=""
13377 KF6_LIBS=""
13378 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13379 then
13380     if test "$OS" = "HAIKU"; then
13381         haiku_arch="`echo $RTL_ARCH | tr X x`"
13382         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13383         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13384     fi
13386     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13387     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13388     if test -n "$supports_multilib"; then
13389         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13390     fi
13392     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13393     kf6_test_library="libKF6KIOFileWidgets.so"
13394     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13396     dnl Check for KF6 headers
13397     AC_MSG_CHECKING([for KF6 headers])
13398     kf6_incdir="no"
13399     for kf6_check in $kf6_incdirs; do
13400         if test -r "$kf6_check/$kf6_test_include"; then
13401             kf6_incdir="$kf6_check/KF6"
13402             break
13403         fi
13404     done
13405     AC_MSG_RESULT([$kf6_incdir])
13406     if test "x$kf6_incdir" = "xno"; then
13407         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13408     fi
13410     dnl Check for KF6 libraries
13411     AC_MSG_CHECKING([for KF6 libraries])
13412     kf6_libdir="no"
13413     for kf6_check in $kf6_libdirs; do
13414         if test -r "$kf6_check/$kf6_test_library"; then
13415             kf6_libdir="$kf6_check"
13416             break
13417         fi
13418     done
13420     AC_MSG_RESULT([$kf6_libdir])
13421     if test "x$kf6_libdir" = "xno"; then
13422         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13423     fi
13425     KF6_CFLAGS="-I$kf6_incdir -I$kf6_incdir/KCoreAddons -I$kf6_incdir/KI18n -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"
13426     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13427     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13429     AC_LANG_PUSH([C++])
13430     save_CXXFLAGS=$CXXFLAGS
13431     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13432     dnl KF6 development version as of 2023-06 uses version number 5.240
13433     AC_MSG_CHECKING([whether KDE is >= 5.240])
13434        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13435 #include <kcoreaddons_version.h>
13437 int main(int argc, char **argv) {
13438        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13439        else return 1;
13441        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13442     CXXFLAGS=$save_CXXFLAGS
13443     AC_LANG_POP([C++])
13445 AC_SUBST(KF6_CFLAGS)
13446 AC_SUBST(KF6_LIBS)
13448 dnl ===================================================================
13449 dnl Test whether to include Evolution 2 support
13450 dnl ===================================================================
13451 AC_MSG_CHECKING([whether to enable evolution 2 support])
13452 if test "$enable_evolution2" = yes; then
13453     AC_MSG_RESULT([yes])
13454     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13455     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13456     FilterLibs "${GOBJECT_LIBS}"
13457     GOBJECT_LIBS="${filteredlibs}"
13458     ENABLE_EVOAB2="TRUE"
13459 else
13460     AC_MSG_RESULT([no])
13462 AC_SUBST(ENABLE_EVOAB2)
13463 AC_SUBST(GOBJECT_CFLAGS)
13464 AC_SUBST(GOBJECT_LIBS)
13466 dnl ===================================================================
13467 dnl Test which themes to include
13468 dnl ===================================================================
13469 AC_MSG_CHECKING([which themes to include])
13470 # if none given use default subset of available themes
13471 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13472     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"
13475 WITH_THEMES=""
13476 if test "x$with_theme" != "xno"; then
13477     for theme in $with_theme; do
13478         case $theme in
13479         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) real_theme="$theme" ;;
13480         default) real_theme=colibre ;;
13481         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13482         esac
13483         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13484     done
13486 AC_MSG_RESULT([$WITH_THEMES])
13487 AC_SUBST([WITH_THEMES])
13488 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13489 for theme in $with_theme; do
13490     case $theme in
13491     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13492     *) ;;
13493     esac
13494 done
13496 ###############################################################################
13497 # Extensions checking
13498 ###############################################################################
13499 AC_MSG_CHECKING([for extensions integration])
13500 if test "x$enable_extension_integration" != "xno"; then
13501     WITH_EXTENSION_INTEGRATION=TRUE
13502     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13503     AC_MSG_RESULT([yes, use integration])
13504 else
13505     WITH_EXTENSION_INTEGRATION=
13506     AC_MSG_RESULT([no, do not integrate])
13508 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13510 dnl Should any extra extensions be included?
13511 dnl There are standalone tests for each of these below.
13512 WITH_EXTRA_EXTENSIONS=
13513 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13515 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13516 if test "x$with_java" != "xno"; then
13517     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13520 AC_MSG_CHECKING([whether to build opens___.ttf])
13521 if test "$enable_build_opensymbol" = "yes"; then
13522     AC_MSG_RESULT([yes])
13523     AC_PATH_PROG(FONTFORGE, fontforge)
13524     if test -z "$FONTFORGE"; then
13525         AC_MSG_ERROR([fontforge not installed])
13526     fi
13527 else
13528     AC_MSG_RESULT([no])
13529     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13531 AC_SUBST(FONTFORGE)
13533 dnl ===================================================================
13534 dnl Test whether to include fonts
13535 dnl ===================================================================
13536 AC_MSG_CHECKING([whether to include third-party fonts])
13537 if test "$with_fonts" != "no"; then
13538     AC_MSG_RESULT([yes])
13539     WITH_FONTS=TRUE
13540     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13541     AC_DEFINE(HAVE_MORE_FONTS)
13542 else
13543     AC_MSG_RESULT([no])
13544     WITH_FONTS=
13545     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13547 AC_SUBST(WITH_FONTS)
13550 dnl ===================================================================
13551 dnl Test whether to enable online update service
13552 dnl ===================================================================
13553 AC_MSG_CHECKING([whether to enable online update])
13554 ENABLE_ONLINE_UPDATE=
13555 ENABLE_ONLINE_UPDATE_MAR=
13556 UPDATE_CONFIG=
13557 if test "$enable_online_update" = ""; then
13558     AC_MSG_RESULT([no])
13559 else
13560     if test "$enable_online_update" = "mar"; then
13561         AC_MSG_RESULT([yes - MAR-based online update])
13562         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13563         if test "$with_update_config" = ""; then
13564             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13565         fi
13566         UPDATE_CONFIG="$with_update_config"
13567         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13568     elif test "$enable_online_update" = "yes"; then
13569         AC_MSG_RESULT([yes])
13570         ENABLE_ONLINE_UPDATE="TRUE"
13571     else
13572         AC_MSG_RESULT([no])
13573     fi
13575 AC_SUBST(ENABLE_ONLINE_UPDATE)
13576 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13577 AC_SUBST(UPDATE_CONFIG)
13580 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13581 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13582     if test "x$with_privacy_policy_url" = "xundefined"; then
13583         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13584     fi
13586 AC_SUBST(PRIVACY_POLICY_URL)
13587 dnl ===================================================================
13588 dnl Test whether we need bzip2
13589 dnl ===================================================================
13590 SYSTEM_BZIP2=
13591 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13592     AC_MSG_CHECKING([whether to use system bzip2])
13593     if test "$with_system_bzip2" = yes; then
13594         SYSTEM_BZIP2=TRUE
13595         AC_MSG_RESULT([yes])
13596         PKG_CHECK_MODULES(BZIP2, bzip2)
13597         FilterLibs "${BZIP2_LIBS}"
13598         BZIP2_LIBS="${filteredlibs}"
13599     else
13600         AC_MSG_RESULT([no])
13601         BUILD_TYPE="$BUILD_TYPE BZIP2"
13602     fi
13604 AC_SUBST(SYSTEM_BZIP2)
13605 AC_SUBST(BZIP2_CFLAGS)
13606 AC_SUBST(BZIP2_LIBS)
13608 dnl ===================================================================
13609 dnl Test whether to enable extension update
13610 dnl ===================================================================
13611 AC_MSG_CHECKING([whether to enable extension update])
13612 ENABLE_EXTENSION_UPDATE=
13613 if test "x$enable_extension_update" = "xno"; then
13614     AC_MSG_RESULT([no])
13615 else
13616     AC_MSG_RESULT([yes])
13617     ENABLE_EXTENSION_UPDATE="TRUE"
13618     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13619     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13621 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13624 dnl ===================================================================
13625 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13626 dnl ===================================================================
13627 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13628 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13629     AC_MSG_RESULT([no])
13630     ENABLE_SILENT_MSI=
13631 else
13632     AC_MSG_RESULT([yes])
13633     ENABLE_SILENT_MSI=TRUE
13634     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13636 AC_SUBST(ENABLE_SILENT_MSI)
13638 dnl ===================================================================
13639 dnl Check for WiX tools.
13640 dnl ===================================================================
13641 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13642     AC_MSG_RESULT([no])
13643     ENABLE_WIX=
13644 else
13645     AC_MSG_RESULT([yes])
13646     if ! which candle  >/dev/null 2>&1; then
13647       AC_MSG_ERROR([WiX requested but WiX toolset not found.])
13648     fi
13649     ENABLE_WIX=TRUE
13651 AC_SUBST(ENABLE_SILENT_MSI)
13653 AC_MSG_CHECKING([whether and how to use Xinerama])
13654 if test "$USING_X11" = TRUE; then
13655     if test "$x_libraries" = "default_x_libraries"; then
13656         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13657         if test "x$XINERAMALIB" = x; then
13658            XINERAMALIB="/usr/lib"
13659         fi
13660     else
13661         XINERAMALIB="$x_libraries"
13662     fi
13663     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13664         # we have both versions, let the user decide but use the dynamic one
13665         # per default
13666         USE_XINERAMA=TRUE
13667         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13668             XINERAMA_LINK=dynamic
13669         else
13670             XINERAMA_LINK=static
13671         fi
13672     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13673         # we have only the dynamic version
13674         USE_XINERAMA=TRUE
13675         XINERAMA_LINK=dynamic
13676     elif test -e "$XINERAMALIB/libXinerama.a"; then
13677         # static version
13678         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13679             USE_XINERAMA=TRUE
13680             XINERAMA_LINK=static
13681         else
13682             USE_XINERAMA=
13683             XINERAMA_LINK=none
13684         fi
13685     else
13686         # no Xinerama
13687         USE_XINERAMA=
13688         XINERAMA_LINK=none
13689     fi
13690     if test "$USE_XINERAMA" = "TRUE"; then
13691         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13692         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13693             [AC_MSG_ERROR(Xinerama header not found.)], [])
13694         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13695         if test "x$XEXTLIB" = x; then
13696            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13697         fi
13698         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13699         if test "$_os" = "FreeBSD"; then
13700             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13701         fi
13702         if test "$_os" = "Linux"; then
13703             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13704         fi
13705         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13706             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13707     else
13708         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
13709     fi
13710 else
13711     USE_XINERAMA=
13712     XINERAMA_LINK=none
13713     AC_MSG_RESULT([no])
13715 AC_SUBST(XINERAMA_LINK)
13717 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
13718 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
13719     enable_cairo_rgba=yes
13721 if test "$enable_cairo_rgba" = yes; then
13722     AC_DEFINE(ENABLE_CAIRO_RGBA)
13723     ENABLE_CAIRO_RGBA=TRUE
13724     AC_MSG_RESULT([yes])
13725 else
13726     ENABLE_CAIRO_RGBA=
13727     AC_MSG_RESULT([no])
13729 AC_SUBST(ENABLE_CAIRO_RGBA)
13731 dnl ===================================================================
13732 dnl Test whether to build cairo or rely on the system version
13733 dnl ===================================================================
13735 if test "$test_cairo" = "yes"; then
13736     AC_MSG_CHECKING([whether to use the system cairo])
13738     : ${with_system_cairo:=$with_system_libs}
13739     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
13740         SYSTEM_CAIRO=TRUE
13741         AC_MSG_RESULT([yes])
13743         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
13744         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13745         FilterLibs "${CAIRO_LIBS}"
13746         CAIRO_LIBS="${filteredlibs}"
13748         if test "$test_xrender" = "yes"; then
13749             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13750             AC_LANG_PUSH([C])
13751             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13752 #ifdef PictStandardA8
13753 #else
13754       return fail;
13755 #endif
13756 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13758             AC_LANG_POP([C])
13759         fi
13760     else
13761         AC_MSG_RESULT([no])
13762         BUILD_TYPE="$BUILD_TYPE CAIRO"
13763     fi
13765     if test "$enable_cairo_canvas" != no; then
13766         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13767         ENABLE_CAIRO_CANVAS=TRUE
13768     fi
13771 AC_SUBST(CAIRO_CFLAGS)
13772 AC_SUBST(CAIRO_LIBS)
13773 AC_SUBST(ENABLE_CAIRO_CANVAS)
13774 AC_SUBST(SYSTEM_CAIRO)
13776 dnl ===================================================================
13777 dnl Test whether to use avahi
13778 dnl ===================================================================
13779 if test "$_os" = "WINNT"; then
13780     # Windows uses bundled mDNSResponder
13781     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13782 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13783     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13784                       [ENABLE_AVAHI="TRUE"])
13785     AC_DEFINE(HAVE_FEATURE_AVAHI)
13786     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13787     FilterLibs "${AVAHI_LIBS}"
13788     AVAHI_LIBS="${filteredlibs}"
13791 AC_SUBST(ENABLE_AVAHI)
13792 AC_SUBST(AVAHI_CFLAGS)
13793 AC_SUBST(AVAHI_LIBS)
13795 dnl ===================================================================
13796 dnl Test whether to use liblangtag
13797 dnl ===================================================================
13798 SYSTEM_LIBLANGTAG=
13799 AC_MSG_CHECKING([whether to use system liblangtag])
13800 if test "$with_system_liblangtag" = yes; then
13801     SYSTEM_LIBLANGTAG=TRUE
13802     AC_MSG_RESULT([yes])
13803     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13804     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13805     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13806     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13807     FilterLibs "${LIBLANGTAG_LIBS}"
13808     LIBLANGTAG_LIBS="${filteredlibs}"
13809 else
13810     SYSTEM_LIBLANGTAG=
13811     AC_MSG_RESULT([no])
13812     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13813     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13814     if test "$COM" = "MSC"; then
13815         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13816     else
13817         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13818     fi
13820 AC_SUBST(SYSTEM_LIBLANGTAG)
13821 AC_SUBST(LIBLANGTAG_CFLAGS)
13822 AC_SUBST(LIBLANGTAG_LIBS)
13824 dnl ===================================================================
13825 dnl Test whether to build libpng or rely on the system version
13826 dnl ===================================================================
13828 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13829 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13830 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13832 dnl ===================================================================
13833 dnl Test whether to build libtiff or rely on the system version
13834 dnl ===================================================================
13836 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
13838 dnl ===================================================================
13839 dnl Test whether to build libwebp or rely on the system version
13840 dnl ===================================================================
13842 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13844 dnl ===================================================================
13845 dnl Check for runtime JVM search path
13846 dnl ===================================================================
13847 if test "$ENABLE_JAVA" != ""; then
13848     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13849     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13850         AC_MSG_RESULT([yes])
13851         if ! test -d "$with_jvm_path"; then
13852             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13853         fi
13854         if ! test -d "$with_jvm_path"jvm; then
13855             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13856         fi
13857         JVM_ONE_PATH_CHECK="$with_jvm_path"
13858         AC_SUBST(JVM_ONE_PATH_CHECK)
13859     else
13860         AC_MSG_RESULT([no])
13861     fi
13864 dnl ===================================================================
13865 dnl Test for the presence of Ant and that it works
13866 dnl ===================================================================
13868 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
13869 # breaks filename decoding, so for the ant section, set it to LANG
13870 LC_ALL=$LANG
13871 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13872     ANT_HOME=; export ANT_HOME
13873     WITH_ANT_HOME=; export WITH_ANT_HOME
13874     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13875         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13876             if test "$_os" = "WINNT"; then
13877                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13878             else
13879                 with_ant_home="$LODE_HOME/opt/ant"
13880             fi
13881         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13882             with_ant_home="$LODE_HOME/opt/ant"
13883         fi
13884     fi
13885     if test -z "$with_ant_home"; then
13886         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13887     else
13888         if test "$_os" = "WINNT"; then
13889             # AC_PATH_PROGS needs unix path
13890             with_ant_home=`cygpath -u "$with_ant_home"`
13891         fi
13892         AbsolutePath "$with_ant_home"
13893         with_ant_home=$absolute_path
13894         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13895         WITH_ANT_HOME=$with_ant_home
13896         ANT_HOME=$with_ant_home
13897     fi
13899     if test -z "$ANT"; then
13900         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13901     else
13902         # resolve relative or absolute symlink
13903         while test -h "$ANT"; do
13904             a_cwd=`pwd`
13905             a_basename=`basename "$ANT"`
13906             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13907             cd "`dirname "$ANT"`"
13908             cd "`dirname "$a_script"`"
13909             ANT="`pwd`"/"`basename "$a_script"`"
13910             cd "$a_cwd"
13911         done
13913         AC_MSG_CHECKING([if $ANT works])
13914         mkdir -p conftest.dir
13915         a_cwd=$(pwd)
13916         cd conftest.dir
13917         cat > conftest.java << EOF
13918         public class conftest {
13919             int testmethod(int a, int b) {
13920                     return a + b;
13921             }
13922         }
13925         cat > conftest.xml << EOF
13926         <project name="conftest" default="conftest">
13927         <target name="conftest">
13928             <javac srcdir="." includes="conftest.java">
13929             </javac>
13930         </target>
13931         </project>
13934         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13935         if test $? = 0 -a -f ./conftest.class; then
13936             AC_MSG_RESULT([Ant works])
13937             if test -z "$WITH_ANT_HOME"; then
13938                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13939                 if test -z "$ANT_HOME"; then
13940                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13941                 fi
13942             else
13943                 ANT_HOME="$WITH_ANT_HOME"
13944             fi
13945         else
13946             echo "configure: Ant test failed" >&5
13947             cat conftest.java >&5
13948             cat conftest.xml >&5
13949             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13950         fi
13951         cd "$a_cwd"
13952         rm -fr conftest.dir
13953     fi
13954     if test -z "$ANT_HOME"; then
13955         ANT_HOME="NO_ANT_HOME"
13956     else
13957         PathFormat "$ANT_HOME"
13958         ANT_HOME="$formatted_path"
13959         PathFormat "$ANT"
13960         ANT="$formatted_path"
13961     fi
13963     dnl Checking for ant.jar
13964     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13965         AC_MSG_CHECKING([Ant lib directory])
13966         if test -f $ANT_HOME/lib/ant.jar; then
13967             ANT_LIB="$ANT_HOME/lib"
13968         else
13969             if test -f $ANT_HOME/ant.jar; then
13970                 ANT_LIB="$ANT_HOME"
13971             else
13972                 if test -f /usr/share/java/ant.jar; then
13973                     ANT_LIB=/usr/share/java
13974                 else
13975                     if test -f /usr/share/ant-core/lib/ant.jar; then
13976                         ANT_LIB=/usr/share/ant-core/lib
13977                     else
13978                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13979                             ANT_LIB="$ANT_HOME/lib/ant"
13980                         else
13981                             if test -f /usr/share/lib/ant/ant.jar; then
13982                                 ANT_LIB=/usr/share/lib/ant
13983                             else
13984                                 AC_MSG_ERROR([Ant libraries not found!])
13985                             fi
13986                         fi
13987                     fi
13988                 fi
13989             fi
13990         fi
13991         PathFormat "$ANT_LIB"
13992         ANT_LIB="$formatted_path"
13993         AC_MSG_RESULT([Ant lib directory found.])
13994     fi
13996     ant_minver=1.6.0
13997     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13999     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14000     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14001     ant_version_major=`echo $ant_version | cut -d. -f1`
14002     ant_version_minor=`echo $ant_version | cut -d. -f2`
14003     echo "configure: ant_version $ant_version " >&5
14004     echo "configure: ant_version_major $ant_version_major " >&5
14005     echo "configure: ant_version_minor $ant_version_minor " >&5
14006     if test "$ant_version_major" -ge "2"; then
14007         AC_MSG_RESULT([yes, $ant_version])
14008     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14009         AC_MSG_RESULT([yes, $ant_version])
14010     else
14011         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14012     fi
14014     rm -f conftest* core core.* *.core
14016 AC_SUBST(ANT)
14017 AC_SUBST(ANT_HOME)
14018 AC_SUBST(ANT_LIB)
14020 OOO_JUNIT_JAR=
14021 HAMCREST_JAR=
14022 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14023     AC_MSG_CHECKING([for JUnit 4])
14024     if test "$with_junit" = "yes"; then
14025         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14026             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14027         elif test -e /usr/share/java/junit4.jar; then
14028             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14029         else
14030            if test -e /usr/share/lib/java/junit.jar; then
14031               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14032            else
14033               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14034            fi
14035         fi
14036     else
14037         OOO_JUNIT_JAR=$with_junit
14038     fi
14039     if test "$_os" = "WINNT"; then
14040         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
14041     fi
14042     printf 'import org.junit.Before;' > conftest.java
14043     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14044         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14045     else
14046         AC_MSG_ERROR(
14047 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14048  specify its pathname via --with-junit=..., or disable it via --without-junit])
14049     fi
14050     rm -f conftest.class conftest.java
14051     if test $OOO_JUNIT_JAR != ""; then
14052         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14053     fi
14055     AC_MSG_CHECKING([for included Hamcrest])
14056     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14057     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14058         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14059     else
14060         AC_MSG_RESULT([Not included])
14061         AC_MSG_CHECKING([for standalone hamcrest jar.])
14062         if test "$with_hamcrest" = "yes"; then
14063             if test -e /usr/share/lib/java/hamcrest.jar; then
14064                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14065             elif test -e /usr/share/java/hamcrest/core.jar; then
14066                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14067             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14068                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14069             else
14070                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14071             fi
14072         else
14073             HAMCREST_JAR=$with_hamcrest
14074         fi
14075         if test "$_os" = "WINNT"; then
14076             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
14077         fi
14078         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14079             AC_MSG_RESULT([$HAMCREST_JAR])
14080         else
14081             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),
14082                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14083         fi
14084     fi
14085     rm -f conftest.class conftest.java
14087 AC_SUBST(OOO_JUNIT_JAR)
14088 AC_SUBST(HAMCREST_JAR)
14089 # set back LC_ALL to C after the java related tests...
14090 LC_ALL=C
14092 AC_SUBST(SCPDEFS)
14095 # check for wget and curl
14097 WGET=
14098 CURL=
14100 if test "$enable_fetch_external" != "no"; then
14102 CURL=`which curl 2>/dev/null`
14104 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14105     # wget new enough?
14106     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14107     if test $? -eq 0; then
14108         WGET=$i
14109         break
14110     fi
14111 done
14113 if test -z "$WGET" -a -z "$CURL"; then
14114     AC_MSG_ERROR([neither wget nor curl found!])
14119 AC_SUBST(WGET)
14120 AC_SUBST(CURL)
14123 # check for sha256sum
14125 SHA256SUM=
14127 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14128     eval "$i -a 256 --version" > /dev/null 2>&1
14129     ret=$?
14130     if test $ret -eq 0; then
14131         SHA256SUM="$i -a 256"
14132         break
14133     fi
14134 done
14136 if test -z "$SHA256SUM"; then
14137     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14138         eval "$i --version" > /dev/null 2>&1
14139         ret=$?
14140         if test $ret -eq 0; then
14141             SHA256SUM=$i
14142             break
14143         fi
14144     done
14147 if test -z "$SHA256SUM"; then
14148     AC_MSG_ERROR([no sha256sum found!])
14151 AC_SUBST(SHA256SUM)
14153 dnl ===================================================================
14154 dnl Dealing with l10n options
14155 dnl ===================================================================
14156 AC_MSG_CHECKING([which languages to be built])
14157 # get list of all languages
14158 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14159 # the sed command does the following:
14160 #   + if a line ends with a backslash, append the next line to it
14161 #   + adds " on the beginning of the value (after =)
14162 #   + adds " at the end of the value
14163 #   + removes en-US; we want to put it on the beginning
14164 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
14165 [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)]
14166 ALL_LANGS="en-US $completelangiso"
14167 # check the configured localizations
14168 WITH_LANG="$with_lang"
14170 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14171 # (Norwegian is "nb" and "nn".)
14172 if test "$WITH_LANG" = "no"; then
14173     WITH_LANG=
14176 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14177     AC_MSG_RESULT([en-US])
14178 else
14179     AC_MSG_RESULT([$WITH_LANG])
14180     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14181     if test -z "$MSGFMT"; then
14182         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14183             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14184         elif test -x "/opt/lo/bin/msgfmt"; then
14185             MSGFMT="/opt/lo/bin/msgfmt"
14186         else
14187             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14188             if test -z "$MSGFMT"; then
14189                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14190             fi
14191         fi
14192     fi
14193     if test -z "$MSGUNIQ"; then
14194         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14195             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14196         elif test -x "/opt/lo/bin/msguniq"; then
14197             MSGUNIQ="/opt/lo/bin/msguniq"
14198         else
14199             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14200             if test -z "$MSGUNIQ"; then
14201                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14202             fi
14203         fi
14204     fi
14206 AC_SUBST(MSGFMT)
14207 AC_SUBST(MSGUNIQ)
14208 # check that the list is valid
14209 for lang in $WITH_LANG; do
14210     test "$lang" = "ALL" && continue
14211     # need to check for the exact string, so add space before and after the list of all languages
14212     for vl in $ALL_LANGS; do
14213         if test "$vl" = "$lang"; then
14214            break
14215         fi
14216     done
14217     if test "$vl" != "$lang"; then
14218         # if you're reading this - you prolly quoted your languages remove the quotes ...
14219         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14220     fi
14221 done
14222 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14223     echo $WITH_LANG | grep -q en-US
14224     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14226 # list with substituted ALL
14227 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14228 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14229 test "$WITH_LANG" = "en-US" && WITH_LANG=
14230 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14231     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14232     ALL_LANGS=`echo $ALL_LANGS qtz`
14234 AC_SUBST(ALL_LANGS)
14235 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14236 AC_SUBST(WITH_LANG)
14237 AC_SUBST(WITH_LANG_LIST)
14238 AC_SUBST(GIT_NEEDED_SUBMODULES)
14240 WITH_POOR_HELP_LOCALIZATIONS=
14241 if test -d "$SRC_ROOT/translations/source"; then
14242     for l in `ls -1 $SRC_ROOT/translations/source`; do
14243         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14244             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14245         fi
14246     done
14248 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14250 if test -n "$with_locales" -a "$with_locales" != ALL; then
14251     WITH_LOCALES="$with_locales"
14253     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14254     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14255     # config_host/config_locales.h.in
14256     for locale in $WITH_LOCALES; do
14257         lang=${locale%_*}
14259         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14261         case $lang in
14262         hi|mr*ne)
14263             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14264             ;;
14265         bg|ru)
14266             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14267             ;;
14268         esac
14269     done
14270 else
14271     AC_DEFINE(WITH_LOCALE_ALL)
14273 AC_SUBST(WITH_LOCALES)
14275 dnl git submodule update --reference
14276 dnl ===================================================================
14277 if test -n "${GIT_REFERENCE_SRC}"; then
14278     for repo in ${GIT_NEEDED_SUBMODULES}; do
14279         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14280             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14281         fi
14282     done
14284 AC_SUBST(GIT_REFERENCE_SRC)
14286 dnl git submodules linked dirs
14287 dnl ===================================================================
14288 if test -n "${GIT_LINK_SRC}"; then
14289     for repo in ${GIT_NEEDED_SUBMODULES}; do
14290         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14291             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14292         fi
14293     done
14295 AC_SUBST(GIT_LINK_SRC)
14297 dnl branding
14298 dnl ===================================================================
14299 AC_MSG_CHECKING([for alternative branding images directory])
14300 # initialize mapped arrays
14301 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14302 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14304 if test -z "$with_branding" -o "$with_branding" = "no"; then
14305     AC_MSG_RESULT([none])
14306     DEFAULT_BRAND_IMAGES="$brand_files"
14307 else
14308     if ! test -d $with_branding ; then
14309         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14310     else
14311         AC_MSG_RESULT([$with_branding])
14312         CUSTOM_BRAND_DIR="$with_branding"
14313         for lfile in $brand_files
14314         do
14315             if ! test -f $with_branding/$lfile ; then
14316                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14317                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14318             else
14319                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14320             fi
14321         done
14322         check_for_progress="yes"
14323     fi
14325 AC_SUBST([BRAND_INTRO_IMAGES])
14326 AC_SUBST([CUSTOM_BRAND_DIR])
14327 AC_SUBST([CUSTOM_BRAND_IMAGES])
14328 AC_SUBST([DEFAULT_BRAND_IMAGES])
14331 AC_MSG_CHECKING([for 'intro' progress settings])
14332 PROGRESSBARCOLOR=
14333 PROGRESSSIZE=
14334 PROGRESSPOSITION=
14335 PROGRESSFRAMECOLOR=
14336 PROGRESSTEXTCOLOR=
14337 PROGRESSTEXTBASELINE=
14339 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14340     source "$with_branding/progress.conf"
14341     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14342 else
14343     AC_MSG_RESULT([none])
14346 AC_SUBST(PROGRESSBARCOLOR)
14347 AC_SUBST(PROGRESSSIZE)
14348 AC_SUBST(PROGRESSPOSITION)
14349 AC_SUBST(PROGRESSFRAMECOLOR)
14350 AC_SUBST(PROGRESSTEXTCOLOR)
14351 AC_SUBST(PROGRESSTEXTBASELINE)
14354 dnl ===================================================================
14355 dnl Custom build version
14356 dnl ===================================================================
14357 AC_MSG_CHECKING([for extra build ID])
14358 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14359     EXTRA_BUILDID="$with_extra_buildid"
14361 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14362 if test -n "$EXTRA_BUILDID" ; then
14363     AC_MSG_RESULT([$EXTRA_BUILDID])
14364 else
14365     AC_MSG_RESULT([not set])
14367 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14369 OOO_VENDOR=
14370 AC_MSG_CHECKING([for vendor])
14371 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14372     OOO_VENDOR="$USERNAME"
14374     if test -z "$OOO_VENDOR"; then
14375         OOO_VENDOR="$USER"
14376     fi
14378     if test -z "$OOO_VENDOR"; then
14379         OOO_VENDOR="`id -u -n`"
14380     fi
14382     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14383 else
14384     OOO_VENDOR="$with_vendor"
14385     AC_MSG_RESULT([$OOO_VENDOR])
14387 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14388 AC_SUBST(OOO_VENDOR)
14390 if test "$_os" = "Android" ; then
14391     ANDROID_PACKAGE_NAME=
14392     AC_MSG_CHECKING([for Android package name])
14393     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14394         if test -n "$ENABLE_DEBUG"; then
14395             # Default to the package name that makes ndk-gdb happy.
14396             ANDROID_PACKAGE_NAME="org.libreoffice"
14397         else
14398             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14399         fi
14401         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14402     else
14403         ANDROID_PACKAGE_NAME="$with_android_package_name"
14404         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14405     fi
14406     AC_SUBST(ANDROID_PACKAGE_NAME)
14409 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14410 if test "$with_compat_oowrappers" = "yes"; then
14411     WITH_COMPAT_OOWRAPPERS=TRUE
14412     AC_MSG_RESULT(yes)
14413 else
14414     WITH_COMPAT_OOWRAPPERS=
14415     AC_MSG_RESULT(no)
14417 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14419 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14420 AC_MSG_CHECKING([for install dirname])
14421 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14422     INSTALLDIRNAME="$with_install_dirname"
14424 AC_MSG_RESULT([$INSTALLDIRNAME])
14425 AC_SUBST(INSTALLDIRNAME)
14427 AC_MSG_CHECKING([for prefix])
14428 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14429 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14430 PREFIXDIR="$prefix"
14431 AC_MSG_RESULT([$PREFIXDIR])
14432 AC_SUBST(PREFIXDIR)
14434 LIBDIR=[$(eval echo $(eval echo $libdir))]
14435 AC_SUBST(LIBDIR)
14437 DATADIR=[$(eval echo $(eval echo $datadir))]
14438 AC_SUBST(DATADIR)
14440 MANDIR=[$(eval echo $(eval echo $mandir))]
14441 AC_SUBST(MANDIR)
14443 DOCDIR=[$(eval echo $(eval echo $docdir))]
14444 AC_SUBST(DOCDIR)
14446 BINDIR=[$(eval echo $(eval echo $bindir))]
14447 AC_SUBST(BINDIR)
14449 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14450 AC_SUBST(INSTALLDIR)
14452 TESTINSTALLDIR="${BUILDDIR}/test-install"
14453 AC_SUBST(TESTINSTALLDIR)
14456 # ===================================================================
14457 # OAuth2 id and secrets
14458 # ===================================================================
14460 AC_MSG_CHECKING([for Google Drive client id and secret])
14461 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14462     AC_MSG_RESULT([not set])
14463     GDRIVE_CLIENT_ID="\"\""
14464     GDRIVE_CLIENT_SECRET="\"\""
14465 else
14466     AC_MSG_RESULT([set])
14467     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14468     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14470 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14471 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14473 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14474 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14475     AC_MSG_RESULT([not set])
14476     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14477     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14478 else
14479     AC_MSG_RESULT([set])
14480     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14481     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14483 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14484 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14486 AC_MSG_CHECKING([for OneDrive client id and secret])
14487 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14488     AC_MSG_RESULT([not set])
14489     ONEDRIVE_CLIENT_ID="\"\""
14490     ONEDRIVE_CLIENT_SECRET="\"\""
14491 else
14492     AC_MSG_RESULT([set])
14493     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14494     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14496 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14497 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14500 dnl ===================================================================
14501 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14502 dnl --enable-dependency-tracking configure option
14503 dnl ===================================================================
14504 AC_MSG_CHECKING([whether to enable dependency tracking])
14505 if test "$enable_dependency_tracking" = "no"; then
14506     nodep=TRUE
14507     AC_MSG_RESULT([no])
14508 else
14509     AC_MSG_RESULT([yes])
14511 AC_SUBST(nodep)
14513 dnl ===================================================================
14514 dnl Number of CPUs to use during the build
14515 dnl ===================================================================
14516 AC_MSG_CHECKING([for number of processors to use])
14517 # plain --with-parallelism is just the default
14518 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14519     if test "$with_parallelism" = "no"; then
14520         PARALLELISM=0
14521     else
14522         PARALLELISM=$with_parallelism
14523     fi
14524 else
14525     if test "$enable_icecream" = "yes"; then
14526         PARALLELISM="40"
14527     else
14528         case `uname -s` in
14530         Darwin|FreeBSD|NetBSD|OpenBSD)
14531             PARALLELISM=`sysctl -n hw.ncpu`
14532             ;;
14534         Linux)
14535             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14536         ;;
14537         # what else than above does profit here *and* has /proc?
14538         *)
14539             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14540             ;;
14541         esac
14543         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14544         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14545     fi
14548 if test $PARALLELISM -eq 0; then
14549     AC_MSG_RESULT([explicit make -j option needed])
14550 else
14551     AC_MSG_RESULT([$PARALLELISM])
14553 AC_SUBST(PARALLELISM)
14556 # Set up ILIB for MSVC build
14558 ILIB1=
14559 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
14560     ILIB="."
14561     if test -n "$JAVA_HOME"; then
14562         ILIB="$ILIB;$JAVA_HOME/lib"
14563     fi
14564     ILIB1=-link
14565     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14566     ILIB="$ILIB;$formatted_path"
14567     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14568     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14569     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14570     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14571         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14572         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14573     fi
14574     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14575     ucrtlibpath_formatted=$formatted_path
14576     ILIB="$ILIB;$ucrtlibpath_formatted"
14577     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14578     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14579         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14580         ILIB="$ILIB;$formatted_path"
14581     else
14582         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14583         ILIB="$ILIB;$formatted_path"
14584     fi
14586     if test "$cross_compiling" != "yes"; then
14587         ILIB_FOR_BUILD="$ILIB"
14588     fi
14590 AC_SUBST(ILIB)
14591 AC_SUBST(ILIB_FOR_BUILD)
14593 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14594 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14595 dnl from consteval constructor initializing const variable",
14596 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14597 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14598 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14599 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14600 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14601 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)", or
14602 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14603 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14604 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14605 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17):
14606 AC_LANG_PUSH([C++])
14607 save_CXX=$CXX
14608 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14609     CXX="env LIB=$ILIB $CXX"
14611 save_CXXFLAGS=$CXXFLAGS
14612 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14613 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14614         struct S {
14615             consteval S() { i = 1; }
14616             int i = 0;
14617         };
14618         S const s;
14620         struct S1 { consteval S1(int) {} };
14621         struct S2 {
14622             S1 x;
14623             S2(): x(0) {}
14624         };
14626         struct S3 {
14627             consteval S3() {}
14628             union {
14629                 int a;
14630                 unsigned b = 0;
14631             };
14632         };
14633         void f() { S3(); }
14635         struct S4 { consteval S4() = default; };
14636         void f4(bool b) { b ? S4() : S4(); }
14638         struct S5 {
14639             consteval S5() { c = 0; }
14640             char * f() { return &c; }
14641             union {
14642                 char c;
14643                 int i;
14644             };
14645         };
14646         auto s5 = S5().f();
14647     ], [
14648         return (s.i == 1) ? 0 : 1;
14649     ])], [
14650         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14651         AC_MSG_RESULT([yes])
14652     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14653 CXX=$save_CXX
14654 CXXFLAGS=$save_CXXFLAGS
14655 AC_LANG_POP([C++])
14657 # ===================================================================
14658 # Creating bigger shared library to link against
14659 # ===================================================================
14660 AC_MSG_CHECKING([whether to create huge library])
14661 MERGELIBS=
14663 if test $_os = iOS -o $_os = Android; then
14664     # Never any point in mergelibs for these as we build just static
14665     # libraries anyway...
14666     enable_mergelibs=no
14669 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14670     if test $_os != Linux -a $_os != WINNT; then
14671         add_warning "--enable-mergelibs is not tested for this platform"
14672     fi
14673     MERGELIBS="TRUE"
14674     AC_MSG_RESULT([yes])
14675     AC_DEFINE(ENABLE_MERGELIBS)
14676 else
14677     AC_MSG_RESULT([no])
14679 AC_SUBST([MERGELIBS])
14681 dnl ===================================================================
14682 dnl icerun is a wrapper that stops us spawning tens of processes
14683 dnl locally - for tools that can't be executed on the compile cluster
14684 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14685 dnl ===================================================================
14686 AC_MSG_CHECKING([whether to use icerun wrapper])
14687 ICECREAM_RUN=
14688 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14689     ICECREAM_RUN=icerun
14690     AC_MSG_RESULT([yes])
14691 else
14692     AC_MSG_RESULT([no])
14694 AC_SUBST(ICECREAM_RUN)
14696 dnl ===================================================================
14697 dnl Setup the ICECC_VERSION for the build the same way it was set for
14698 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14699 dnl ===================================================================
14700 x_ICECC_VERSION=[\#]
14701 if test -n "$ICECC_VERSION" ; then
14702     x_ICECC_VERSION=
14704 AC_SUBST(x_ICECC_VERSION)
14705 AC_SUBST(ICECC_VERSION)
14707 dnl ===================================================================
14709 AC_MSG_CHECKING([MPL subset])
14710 MPL_SUBSET=
14712 if test "$enable_mpl_subset" = "yes"; then
14713     mpl_error_string=
14714     newline=$'\n    *'
14715     warn_report=false
14716     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14717         warn_report=true
14718     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14719         warn_report=true
14720     fi
14721     if test "$warn_report" = "true"; then
14722         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
14723     fi
14724     if test "x$enable_postgresql_sdbc" != "xno"; then
14725         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
14726     fi
14727     if test "$enable_lotuswordpro" = "yes"; then
14728         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
14729     fi
14730     if test -n "$ENABLE_POPPLER"; then
14731         if test "x$SYSTEM_POPPLER" = "x"; then
14732             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler or use system library."
14733         fi
14734     fi
14735     # cf. m4/libo_check_extension.m4
14736     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14737         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'."
14738     fi
14739     denied_themes=
14740     for theme in $WITH_THEMES; do
14741         case $theme in
14742         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14743             denied_themes="$denied_themes $theme" ;;
14744         *) : ;;
14745         esac
14746     done
14747     if test "x$denied_themes" != "x"; then
14748         mpl_error_string="$mpl_error_string$newline Need to disable icon themes from '$WITH_THEMES': $denied_themes present, use --with-theme=colibre."
14749     fi
14751     ENABLE_OPENGL_TRANSITIONS=
14753     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14754         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
14755     fi
14757     if test "x$mpl_error_string" != "x"; then
14758         AC_MSG_ERROR([$mpl_error_string])
14759     fi
14761     MPL_SUBSET="TRUE"
14762     AC_DEFINE(MPL_HAVE_SUBSET)
14763     AC_MSG_RESULT([only])
14764 else
14765     AC_MSG_RESULT([no restrictions])
14767 AC_SUBST(MPL_SUBSET)
14769 dnl ===================================================================
14771 AC_MSG_CHECKING([formula logger])
14772 ENABLE_FORMULA_LOGGER=
14774 if test "x$enable_formula_logger" = "xyes"; then
14775     AC_MSG_RESULT([yes])
14776     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14777     ENABLE_FORMULA_LOGGER=TRUE
14778 elif test -n "$ENABLE_DBGUTIL" ; then
14779     AC_MSG_RESULT([yes])
14780     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14781     ENABLE_FORMULA_LOGGER=TRUE
14782 else
14783     AC_MSG_RESULT([no])
14786 AC_SUBST(ENABLE_FORMULA_LOGGER)
14788 dnl ===================================================================
14789 dnl Checking for active Antivirus software.
14790 dnl ===================================================================
14792 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14793     AC_MSG_CHECKING([for active Antivirus software])
14794     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
14795     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
14796     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14797         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14798             AC_MSG_RESULT([found])
14799             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14800             echo $EICAR_STRING > $SRC_ROOT/eicar
14801             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14802             rm $SRC_ROOT/eicar
14803             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14804                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14805             fi
14806             echo $EICAR_STRING > $BUILDDIR/eicar
14807             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14808             rm $BUILDDIR/eicar
14809             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14810                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14811             fi
14812             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"
14813         else
14814             AC_MSG_RESULT([not found])
14815         fi
14816     else
14817         AC_MSG_RESULT([n/a])
14818     fi
14821 dnl ===================================================================
14823 AC_MSG_CHECKING([for coredumpctl support])
14824 if test -z "$with_coredumpctl" && test $_os != Linux; then
14825     with_coredumpctl=no
14827 if test "$with_coredumpctl" = no; then
14828     WITH_COREDUMPCTL=
14829 else
14830     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
14831     AC_PATH_PROG(JQ, jq)
14832     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
14833     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
14834     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
14835         || test -z "$SYSTEMD_RUN"
14836     then
14837         if test -z "$with_coredumpctl"; then
14838             WITH_COREDUMPCTL=
14839         else
14840             if test -z "$COREDUMPCTL"; then
14841                 AC_MSG_ERROR([coredumpctl not found])
14842             fi
14843             if test -z "$JQ"; then
14844                 AC_MSG_ERROR([jq not found])
14845             fi
14846             if test -z "$SYSTEMD_ESCAPE"; then
14847                 AC_MSG_ERROR([systemd-escape not found])
14848             fi
14849             if test -z "$SYSTEMD_RUN"; then
14850                 AC_MSG_ERROR([systemd-run not found])
14851             fi
14852         fi
14853     else
14854         WITH_COREDUMPCTL=TRUE
14855     fi
14857 if test -z "$WITH_COREDUMPCTL"; then
14858     AC_MSG_RESULT([no])
14859 else
14860     AC_MSG_RESULT([yes])
14862 AC_SUBST(COREDUMPCTL)
14863 AC_SUBST(JQ)
14864 AC_SUBST(SYSTEMD_ESCAPE)
14865 AC_SUBST(SYSTEMD_RUN)
14866 AC_SUBST(WITH_COREDUMPCTL)
14868 dnl ===================================================================
14869 dnl Setting up the environment.
14870 dnl ===================================================================
14871 AC_MSG_NOTICE([setting up the build environment variables...])
14873 AC_SUBST(COMPATH)
14875 if test "$build_os" = "cygwin" -o "$build_os" = wsl; then
14876     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14877         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14878         ATL_INCLUDE="$COMPATH/atlmfc/include"
14879     elif test -d "$COMPATH/atlmfc/lib"; then
14880         ATL_LIB="$COMPATH/atlmfc/lib"
14881         ATL_INCLUDE="$COMPATH/atlmfc/include"
14882     else
14883         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14884         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14885     fi
14886     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14887     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14888     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14891 if test "$build_os" = "cygwin"; then
14892     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14893     PathFormat "/usr/bin/find.exe"
14894     FIND="$formatted_path"
14895     PathFormat "/usr/bin/sort.exe"
14896     SORT="$formatted_path"
14897     PathFormat "/usr/bin/grep.exe"
14898     WIN_GREP="$formatted_path"
14899     PathFormat "/usr/bin/ls.exe"
14900     WIN_LS="$formatted_path"
14901     PathFormat "/usr/bin/touch.exe"
14902     WIN_TOUCH="$formatted_path"
14903 else
14904     FIND=find
14905     SORT=sort
14908 AC_SUBST(ATL_INCLUDE)
14909 AC_SUBST(ATL_LIB)
14910 AC_SUBST(FIND)
14911 AC_SUBST(SORT)
14912 AC_SUBST(WIN_GREP)
14913 AC_SUBST(WIN_LS)
14914 AC_SUBST(WIN_TOUCH)
14916 AC_SUBST(BUILD_TYPE)
14918 AC_SUBST(SOLARINC)
14920 PathFormat "$PERL"
14921 PERL="$formatted_path"
14922 AC_SUBST(PERL)
14924 if test -n "$TMPDIR"; then
14925     TEMP_DIRECTORY="$TMPDIR"
14926 else
14927     TEMP_DIRECTORY="/tmp"
14929 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
14930 if test "$build_os" = "cygwin"; then
14931     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14932     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
14934 AC_SUBST(TEMP_DIRECTORY)
14935 AC_SUBST(CYGWIN_BASH)
14937 # setup the PATH for the environment
14938 if test -n "$LO_PATH_FOR_BUILD"; then
14939     LO_PATH="$LO_PATH_FOR_BUILD"
14940     case "$host_os" in
14941     cygwin*|wsl*)
14942         pathmunge "$MSVC_HOST_PATH" "before"
14943         ;;
14944     esac
14945 else
14946     LO_PATH="$PATH"
14948     case "$host_os" in
14950     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14951         if test "$ENABLE_JAVA" != ""; then
14952             pathmunge "$JAVA_HOME/bin" "after"
14953         fi
14954         ;;
14956     cygwin*|wsl*)
14957         # Win32 make needs native paths
14958         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14959             LO_PATH=`cygpath -p -m "$PATH"`
14960         fi
14961         if test "$WIN_BUILD_ARCH" = "x64"; then
14962             # needed for msi packaging
14963             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14964         fi
14965         if test "$WIN_BUILD_ARCH" = "arm64"; then
14966             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
14967             # the x86 ones probably would work just as well...
14968             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
14969         fi
14970         # .NET 4.6 and higher don't have bin directory
14971         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14972             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14973         fi
14974         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14975         pathmunge "$CSC_PATH" "before"
14976         pathmunge "$MIDL_PATH" "before"
14977         pathmunge "$AL_PATH" "before"
14978         pathmunge "$MSVC_MULTI_PATH" "before"
14979         pathmunge "$MSVC_BUILD_PATH" "before"
14980         if test -n "$MSBUILD_PATH" ; then
14981             pathmunge "$MSBUILD_PATH" "before"
14982         fi
14983         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14984         if test "$ENABLE_JAVA" != ""; then
14985             if test -d "$JAVA_HOME/jre/bin/client"; then
14986                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14987             fi
14988             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14989                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14990             fi
14991             pathmunge "$JAVA_HOME/bin" "before"
14992         fi
14993         pathmunge "$MSVC_HOST_PATH" "before"
14994         ;;
14996     solaris*)
14997         pathmunge "/usr/css/bin" "before"
14998         if test "$ENABLE_JAVA" != ""; then
14999             pathmunge "$JAVA_HOME/bin" "after"
15000         fi
15001         ;;
15002     esac
15005 AC_SUBST(LO_PATH)
15007 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15008 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15009     x_LO_ELFCHECK_ALLOWLIST=
15010 else
15011     x_LO_ELFCHECK_ALLOWLIST=[\#]
15013 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15014 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15016 libo_FUZZ_SUMMARY
15018 # Generate a configuration sha256 we can use for deps
15019 if test -f config_host.mk; then
15020     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15022 if test -f config_host_lang.mk; then
15023     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15026 CFLAGS=$my_original_CFLAGS
15027 CXXFLAGS=$my_original_CXXFLAGS
15028 CPPFLAGS=$my_original_CPPFLAGS
15030 AC_CONFIG_LINKS([include:include])
15032 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15033 # BUILD platform configuration] - otherwise breaks cross building
15034 AC_CONFIG_FILES([config_host.mk
15035                  config_host_lang.mk
15036                  Makefile
15037                  lo.xcent
15038                  bin/bffvalidator.sh
15039                  bin/odfvalidator.sh
15040                  bin/officeotron.sh
15041                  hardened_runtime.xcent
15042                  instsetoo_native/util/openoffice.lst
15043                  sysui/desktop/macosx/Info.plist
15044                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15046 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15047 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15048 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15049 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15050 AC_CONFIG_HEADERS([config_host/config_clang.h])
15051 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15052 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15053 AC_CONFIG_HEADERS([config_host/config_eot.h])
15054 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15055 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15056 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15057 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15058 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15059 AC_CONFIG_HEADERS([config_host/config_features.h])
15060 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15061 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15062 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15063 AC_CONFIG_HEADERS([config_host/config_folders.h])
15064 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15065 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15066 AC_CONFIG_HEADERS([config_host/config_gio.h])
15067 AC_CONFIG_HEADERS([config_host/config_global.h])
15068 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15069 AC_CONFIG_HEADERS([config_host/config_java.h])
15070 AC_CONFIG_HEADERS([config_host/config_langs.h])
15071 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15072 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15073 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15074 AC_CONFIG_HEADERS([config_host/config_locales.h])
15075 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15076 AC_CONFIG_HEADERS([config_host/config_oox.h])
15077 AC_CONFIG_HEADERS([config_host/config_options.h])
15078 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15079 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15080 AC_CONFIG_HEADERS([config_host/config_skia.h])
15081 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15082 AC_CONFIG_HEADERS([config_host/config_validation.h])
15083 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15084 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15085 AC_CONFIG_HEADERS([config_host/config_version.h])
15086 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15087 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15088 AC_CONFIG_HEADERS([config_host/config_python.h])
15089 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15090 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15091 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15092 AC_OUTPUT
15094 if test "$CROSS_COMPILING" = TRUE; then
15095     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15098 # touch the config timestamp file
15099 if test ! -f config_host.mk.stamp; then
15100     echo > config_host.mk.stamp
15101 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15102     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15103 else
15104     echo > config_host.mk.stamp
15107 # touch the config lang timestamp file
15108 if test ! -f config_host_lang.mk.stamp; then
15109     echo > config_host_lang.mk.stamp
15110 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15111     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15112 else
15113     echo > config_host_lang.mk.stamp
15117 if test \( "$STALE_MAKE" = "TRUE" \) \
15118         -a "$build_os" = "cygwin"; then
15120 cat << _EOS
15121 ****************************************************************************
15122 WARNING:
15123 Your make version is known to be horribly slow, and hard to debug
15124 problems with. To get a reasonably functional make please do:
15126 to install a pre-compiled binary make for Win32
15128  mkdir -p /opt/lo/bin
15129  cd /opt/lo/bin
15130  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15131  cp make-4.2.1-msvc.exe make
15132  chmod +x make
15134 to install from source:
15135 place yourself in a working directory of you choice.
15137  git clone git://git.savannah.gnu.org/make.git
15139  [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"]
15140  set PATH=%PATH%;C:\Cygwin\bin
15141  [or Cygwin64, if that is what you have]
15142  cd path-to-make-repo-you-cloned-above
15143  build_w32.bat --without-guile
15145 should result in a WinRel/gnumake.exe.
15146 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15148 Then re-run autogen.sh
15150 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15151 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
15153 _EOS
15157 cat << _EOF
15158 ****************************************************************************
15160 To show information on various make targets and make flags, run:
15161 $GNUMAKE help
15163 To just build, run:
15164 $GNUMAKE
15166 _EOF
15168 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15169     cat << _EOF
15170 After the build has finished successfully, you can immediately run what you built using the command:
15171 _EOF
15173     if test $_os = Darwin; then
15174         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15175     else
15176         echo instdir/program/soffice
15177     fi
15178     cat << _EOF
15180 If you want to run the unit tests, run:
15181 $GNUMAKE check
15183 _EOF
15186 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15187     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15188     cat "$WARNINGS_FILE_FOR_BUILD"
15189     echo
15192 if test -s "$WARNINGS_FILE"; then
15193     echo "HOST config ($WARNINGS_FILE)"
15194     cat "$WARNINGS_FILE"
15197 # Remove unneeded emconfigure artifacts
15198 rm -f a.out a.wasm a.out.js a.out.wasm
15200 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: