CppunitTest_svgio: use CPPUNIT_TEST_FIXTURE()
[LibreOffice.git] / configure.ac
blob1e850637f55ed3cea916ebe80083db2fff2e29e4
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],[7.5.0.0.alpha1+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
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 AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$ac_configure_args"]],[Options passed to configure script])
527 dnl ===================================================================
528 dnl Product version
529 dnl ===================================================================
530 AC_MSG_CHECKING([for product version])
531 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
532 AC_MSG_RESULT([$PRODUCTVERSION])
533 AC_SUBST(PRODUCTVERSION)
535 AC_PROG_EGREP
536 # AC_PROG_EGREP doesn't set GREP on all systems as well
537 AC_PATH_PROG(GREP, grep)
539 BUILDDIR=`pwd`
540 cd $srcdir
541 SRC_ROOT=`pwd`
542 cd $BUILDDIR
543 x_Cygwin=[\#]
545 dnl ======================================
546 dnl Required GObject introspection version
547 dnl ======================================
548 INTROSPECTION_REQUIRED_VERSION=1.32.0
550 dnl ===================================================================
551 dnl Search all the common names for GNU Make
552 dnl ===================================================================
553 AC_MSG_CHECKING([for GNU Make])
555 # try to use our own make if it is available and GNUMAKE was not already defined
556 if test -z "$GNUMAKE"; then
557     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
558         GNUMAKE="$LODE_HOME/opt/bin/make"
559     elif test -x "/opt/lo/bin/make"; then
560         GNUMAKE="/opt/lo/bin/make"
561     fi
564 GNUMAKE_WIN_NATIVE=
565 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
566     if test -n "$a"; then
567         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
568         if test $? -eq 0;  then
569             if test "$build_os" = "cygwin"; then
570                 if test -n "$($a -v | grep 'Built for Windows')" ; then
571                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
572                     GNUMAKE_WIN_NATIVE="TRUE"
573                 else
574                     GNUMAKE=`which $a`
575                 fi
576             else
577                 GNUMAKE=`which $a`
578             fi
579             break
580         fi
581     fi
582 done
583 AC_MSG_RESULT($GNUMAKE)
584 if test -z "$GNUMAKE"; then
585     AC_MSG_ERROR([not found. install GNU Make.])
586 else
587     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
588         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
589     fi
592 win_short_path_for_make()
594     local short_path="$1"
595     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
596         cygpath -sm "$short_path"
597     else
598         cygpath -u "$(cygpath -d "$short_path")"
599     fi
603 if test "$build_os" = "cygwin"; then
604     PathFormat "$SRC_ROOT"
605     SRC_ROOT="$formatted_path"
606     PathFormat "$BUILDDIR"
607     BUILDDIR="$formatted_path"
608     x_Cygwin=
609     AC_MSG_CHECKING(for explicit COMSPEC)
610     if test -z "$COMSPEC"; then
611         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
612     else
613         AC_MSG_RESULT([found: $COMSPEC])
614     fi
617 AC_SUBST(SRC_ROOT)
618 AC_SUBST(BUILDDIR)
619 AC_SUBST(x_Cygwin)
620 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
621 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
622 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
624 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
625     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
628 # need sed in os checks...
629 AC_PATH_PROGS(SED, sed)
630 if test -z "$SED"; then
631     AC_MSG_ERROR([install sed to run this script])
634 # Set the ENABLE_LTO variable
635 # ===================================================================
636 AC_MSG_CHECKING([whether to use link-time optimization])
637 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
638     ENABLE_LTO="TRUE"
639     AC_MSG_RESULT([yes])
640 else
641     ENABLE_LTO=""
642     AC_MSG_RESULT([no])
644 AC_SUBST(ENABLE_LTO)
646 AC_ARG_ENABLE(fuzz-options,
647     AS_HELP_STRING([--enable-fuzz-options],
648         [Randomly enable or disable each of those configurable options
649          that are supposed to be freely selectable without interdependencies,
650          or where bad interaction from interdependencies is automatically avoided.])
653 dnl ===================================================================
654 dnl When building for Android, --with-android-ndk,
655 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
656 dnl mandatory
657 dnl ===================================================================
659 AC_ARG_WITH(android-ndk,
660     AS_HELP_STRING([--with-android-ndk],
661         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
664 AC_ARG_WITH(android-ndk-toolchain-version,
665     AS_HELP_STRING([--with-android-ndk-toolchain-version],
666         [Specify which toolchain version to use, of those present in the
667         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
668         with_android_ndk_toolchain_version=clang5.0)
670 AC_ARG_WITH(android-sdk,
671     AS_HELP_STRING([--with-android-sdk],
672         [Specify location of the Android SDK. Mandatory when building for Android.]),
675 AC_ARG_WITH(android-api-level,
676     AS_HELP_STRING([--with-android-api-level],
677         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
680 ANDROID_NDK_DIR=
681 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
682     with_android_ndk="$SRC_ROOT/external/android-ndk"
684 if test -n "$with_android_ndk"; then
685     eval ANDROID_NDK_DIR=$with_android_ndk
687     # Set up a lot of pre-canned defaults
689     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
690         if test ! -f $ANDROID_NDK_DIR/source.properties; then
691             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
692         fi
693         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
694     else
695         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
696     fi
697     if test -z "$ANDROID_NDK_VERSION";  then
698         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
699     fi
700     case $ANDROID_NDK_VERSION in
701     r9*|r10*)
702         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
703         ;;
704     11.1.*|12.1.*|13.1.*|14.1.*)
705         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
706         ;;
707     16.*|17.*|18.*|19.*|20.*)
708         ;;
709     *)
710         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
711         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
712         ;;
713     esac
715     ANDROID_API_LEVEL=16
716     if test -n "$with_android_api_level" ; then
717         ANDROID_API_LEVEL="$with_android_api_level"
718     fi
720     android_cpu=$host_cpu
721     if test $host_cpu = arm; then
722         android_platform_prefix=arm-linux-androideabi
723         android_gnu_prefix=$android_platform_prefix
724         LLVM_TRIPLE=armv7a-linux-androideabi
725         ANDROID_APP_ABI=armeabi-v7a
726         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
727     elif test $host_cpu = aarch64; then
728         android_platform_prefix=aarch64-linux-android
729         android_gnu_prefix=$android_platform_prefix
730         LLVM_TRIPLE=$android_platform_prefix
731         # minimum android version that supports aarch64
732         if test "$ANDROID_API_LEVEL" -lt "21" ; then
733             ANDROID_API_LEVEL=21
734         fi
735         ANDROID_APP_ABI=arm64-v8a
736     elif test $host_cpu = x86_64; then
737         android_platform_prefix=x86_64-linux-android
738         android_gnu_prefix=$android_platform_prefix
739         LLVM_TRIPLE=$android_platform_prefix
740         # minimum android version that supports x86_64
741         ANDROID_API_LEVEL=21
742         ANDROID_APP_ABI=x86_64
743     else
744         # host_cpu is something like "i386" or "i686" I guess, NDK uses
745         # "x86" in some contexts
746         android_cpu=x86
747         android_platform_prefix=$android_cpu
748         android_gnu_prefix=i686-linux-android
749         LLVM_TRIPLE=$android_gnu_prefix
750         ANDROID_APP_ABI=x86
751     fi
753     case "$with_android_ndk_toolchain_version" in
754     clang5.0)
755         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
756         ;;
757     *)
758         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
759     esac
761     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
763     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
764     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
765     # manage to link the (app-specific) single huge .so that is built for the app in
766     # android/source/ if there is debug information in a significant part of the object files.
767     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
768     # all objects have been built with debug information.)
769     case $build_os in
770     linux-gnu*)
771         android_HOST_TAG=linux-x86_64
772         ;;
773     darwin*)
774         android_HOST_TAG=darwin-x86_64
775         ;;
776     *)
777         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
778         # ndk would also support windows and windows-x86_64
779         ;;
780     esac
781     android_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
782     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
783     dnl TODO: NSS build uses it...
784     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_DIR/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
785     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
787     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
788     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
789     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
790     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
791     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
793     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
794     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
795     if test "$ENABLE_LTO" = TRUE; then
796         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
797         # $CC and $CXX when building external libraries
798         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
799     fi
801     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
803     if test -z "$CC"; then
804         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
805         CC_BASE="clang"
806     fi
807     if test -z "$CXX"; then
808         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
809         CXX_BASE="clang++"
810     fi
812 AC_SUBST(ANDROID_NDK_DIR)
813 AC_SUBST(ANDROID_APP_ABI)
814 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
816 dnl ===================================================================
817 dnl --with-android-sdk
818 dnl ===================================================================
819 ANDROID_SDK_DIR=
820 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
821     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
823 if test -n "$with_android_sdk"; then
824     eval ANDROID_SDK_DIR=$with_android_sdk
825     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
827 AC_SUBST(ANDROID_SDK_DIR)
829 AC_ARG_ENABLE([android-lok],
830     AS_HELP_STRING([--enable-android-lok],
831         [The Android app from the android/ subdir needs several tweaks all
832          over the place that break the LOK when used in the Online-based
833          Android app.  This switch indicates that the intent of this build is
834          actually the Online-based, non-modified LOK.])
836 ENABLE_ANDROID_LOK=
837 if test -n "$ANDROID_NDK_DIR" ; then
838     if test "$enable_android_lok" = yes; then
839         ENABLE_ANDROID_LOK=TRUE
840         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
841         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
842     else
843         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
844     fi
846 AC_SUBST([ENABLE_ANDROID_LOK])
848 libo_FUZZ_ARG_ENABLE([android-editing],
849     AS_HELP_STRING([--enable-android-editing],
850         [Enable the experimental editing feature on Android.])
852 ENABLE_ANDROID_EDITING=
853 if test "$enable_android_editing" = yes; then
854     ENABLE_ANDROID_EDITING=TRUE
856 AC_SUBST([ENABLE_ANDROID_EDITING])
858 disable_database_connectivity_dependencies()
860     enable_evolution2=no
861     enable_firebird_sdbc=no
862     enable_mariadb_sdbc=no
863     enable_postgresql_sdbc=no
864     enable_report_builder=no
867 # ===================================================================
869 # Start initial platform setup
871 # The using_* variables reflect platform support and should not be
872 # changed after the "End initial platform setup" block.
873 # This is also true for most test_* variables.
874 # ===================================================================
875 build_crypto=yes
876 test_clucene=no
877 test_gdb_index=no
878 test_openldap=yes
879 test_split_debug=no
880 test_webdav=yes
881 usable_dlapi=yes
883 # There is currently just iOS not using salplug, so this explicitly enables it.
884 # must: using_freetype_fontconfig
885 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
886 # must: using_x11
888 # Default values, as such probably valid just for Linux, set
889 # differently below just for Mac OSX, but at least better than
890 # hardcoding these as we used to do. Much of this is duplicated also
891 # in solenv for old build system and for gbuild, ideally we should
892 # perhaps define stuff like this only here in configure.ac?
894 LINKFLAGSSHL="-shared"
895 PICSWITCH="-fpic"
896 DLLPOST=".so"
898 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
900 INSTROOTBASESUFFIX=
901 INSTROOTCONTENTSUFFIX=
902 SDKDIRNAME=sdk
904 HOST_PLATFORM="$host"
906 host_cpu_for_clang="$host_cpu"
908 case "$host_os" in
910 solaris*)
911     using_freetype_fontconfig=yes
912     using_x11=yes
913     build_skia=yes
914     _os=SunOS
916     dnl ===========================================================
917     dnl Check whether we're using Solaris 10 - SPARC or Intel.
918     dnl ===========================================================
919     AC_MSG_CHECKING([the Solaris operating system release])
920     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
921     if test "$_os_release" -lt "10"; then
922         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
923     else
924         AC_MSG_RESULT([ok ($_os_release)])
925     fi
927     dnl Check whether we're using a SPARC or i386 processor
928     AC_MSG_CHECKING([the processor type])
929     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
930         AC_MSG_RESULT([ok ($host_cpu)])
931     else
932         AC_MSG_ERROR([only SPARC and i386 processors are supported])
933     fi
934     ;;
936 linux-gnu*|k*bsd*-gnu*|linux-musl*)
937     using_freetype_fontconfig=yes
938     using_x11=yes
939     build_skia=yes
940     test_gdb_index=yes
941     test_split_debug=yes
942     if test "$enable_fuzzers" = yes; then
943         test_system_freetype=no
944     fi
945     _os=Linux
946     ;;
948 gnu)
949     using_freetype_fontconfig=yes
950     using_x11=no
951     _os=GNU
952      ;;
954 cygwin*|wsl*)
955     # When building on Windows normally with MSVC under Cygwin,
956     # configure thinks that the host platform (the platform the
957     # built code will run on) is Cygwin, even if it obviously is
958     # Windows, which in Autoconf terminology is called
959     # "mingw32". (Which is misleading as MinGW is the name of the
960     # tool-chain, not an operating system.)
962     # Somewhat confusing, yes. But this configure script doesn't
963     # look at $host etc that much, it mostly uses its own $_os
964     # variable, set here in this case statement.
966     using_freetype_fontconfig=no
967     using_x11=no
968     test_unix_dlapi=no
969     test_openldap=no
970     enable_pagein=no
971     build_skia=yes
972     _os=WINNT
974     DLLPOST=".dll"
975     LINKFLAGSNOUNDEFS=
977     if test "$host_cpu" = "aarch64"; then
978         build_skia=no
979         enable_gpgmepp=no
980         enable_coinmp=no
981         enable_firebird_sdbc=no
982     fi
983     ;;
985 darwin*) # macOS
986     using_freetype_fontconfig=no
987     using_x11=no
988     build_skia=yes
989     enable_pagein=no
990     if test -n "$LODE_HOME" ; then
991         mac_sanitize_path
992         AC_MSG_NOTICE([sanitized the PATH to $PATH])
993     fi
994     _os=Darwin
995     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
996     INSTROOTCONTENTSUFFIX=/Contents
997     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
998     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
999     LINKFLAGSSHL="-dynamiclib -single_module"
1001     # -fPIC is default
1002     PICSWITCH=""
1004     DLLPOST=".dylib"
1006     # -undefined error is the default
1007     LINKFLAGSNOUNDEFS=""
1008     case "$host_cpu" in
1009     aarch64|arm64)
1010         # Apple's Clang uses "arm64"
1011         host_cpu_for_clang=arm64
1012     esac
1015 ios*) # iOS
1016     using_freetype_fontconfig=no
1017     using_x11=no
1018     build_crypto=no
1019     test_libcmis=no
1020     test_openldap=no
1021     test_webdav=no
1022     if test -n "$LODE_HOME" ; then
1023         mac_sanitize_path
1024         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1025     fi
1026     enable_gpgmepp=no
1027     _os=iOS
1028     enable_mpl_subset=yes
1029     enable_lotuswordpro=no
1030     disable_database_connectivity_dependencies
1031     enable_coinmp=no
1032     enable_lpsolve=no
1033     enable_extension_integration=no
1034     enable_xmlhelp=no
1035     with_ppds=no
1036     if test "$enable_ios_simulator" = "yes"; then
1037         host=x86_64-apple-darwin
1038     fi
1039     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1040     LINKFLAGSSHL="-dynamiclib -single_module"
1042     # -fPIC is default
1043     PICSWITCH=""
1045     DLLPOST=".dylib"
1047     # -undefined error is the default
1048     LINKFLAGSNOUNDEFS=""
1050     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1051     # part, so use aarch64-apple-darwin for now.
1052     HOST_PLATFORM=aarch64-apple-darwin
1054     # Apple's Clang uses "arm64"
1055     host_cpu_for_clang=arm64
1058 freebsd*)
1059     using_freetype_fontconfig=yes
1060     using_x11=yes
1061     build_skia=yes
1062     AC_MSG_CHECKING([the FreeBSD operating system release])
1063     if test -n "$with_os_version"; then
1064         OSVERSION="$with_os_version"
1065     else
1066         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1067     fi
1068     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1069     AC_MSG_CHECKING([which thread library to use])
1070     if test "$OSVERSION" -lt "500016"; then
1071         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1072         PTHREAD_LIBS="-pthread"
1073     elif test "$OSVERSION" -lt "502102"; then
1074         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1075         PTHREAD_LIBS="-lc_r"
1076     else
1077         PTHREAD_CFLAGS=""
1078         PTHREAD_LIBS="-pthread"
1079     fi
1080     AC_MSG_RESULT([$PTHREAD_LIBS])
1081     _os=FreeBSD
1082     ;;
1084 *netbsd*)
1085     using_freetype_fontconfig=yes
1086     using_x11=yes
1087     test_gtk3_kde5=no
1088     build_skia=yes
1089     PTHREAD_LIBS="-pthread -lpthread"
1090     _os=NetBSD
1091     ;;
1093 aix*)
1094     using_freetype_fontconfig=yes
1095     using_x11=yes
1096     test_randr=no
1097     test_gstreamer_1_0=no
1098     PTHREAD_LIBS=-pthread
1099     _os=AIX
1100     ;;
1102 openbsd*)
1103     using_freetype_fontconfig=yes
1104     using_x11=yes
1105     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1106     PTHREAD_LIBS="-pthread"
1107     _os=OpenBSD
1108     ;;
1110 dragonfly*)
1111     using_freetype_fontconfig=yes
1112     using_x11=yes
1113     build_skia=yes
1114     PTHREAD_LIBS="-pthread"
1115     _os=DragonFly
1116     ;;
1118 linux-android*)
1119     # API exists, but seems not really usable since Android 7 AFAIK
1120     usable_dlapi=no
1121     using_freetype_fontconfig=yes
1122     using_headless_plugin=no
1123     using_x11=no
1124     build_crypto=no
1125     test_openldap=no
1126     test_system_freetype=no
1127     test_webdav=no
1128     disable_database_connectivity_dependencies
1129     enable_lotuswordpro=no
1130     enable_mpl_subset=yes
1131     enable_cairo_canvas=no
1132     enable_coinmp=yes
1133     enable_lpsolve=no
1134     enable_odk=no
1135     enable_python=no
1136     enable_xmlhelp=no
1137     _os=Android
1138     ;;
1140 haiku*)
1141     using_freetype_fontconfig=yes
1142     using_x11=no
1143     test_gtk3=no
1144     test_gtk3_kde5=no
1145     test_kf5=yes
1146     enable_odk=no
1147     enable_coinmp=no
1148     enable_pdfium=no
1149     enable_sdremote=no
1150     enable_postgresql_sdbc=no
1151     enable_firebird_sdbc=no
1152     _os=Haiku
1153     ;;
1155 emscripten)
1156     # API currently just exists in headers, not code
1157     usable_dlapi=no
1158     using_freetype_fontconfig=yes
1159     using_x11=yes
1160     test_openldap=no
1161     test_qt5=yes
1162     test_split_debug=yes
1163     test_system_freetype=no
1164     enable_compiler_plugins=no
1165     enable_customtarget_components=yes
1166     enable_split_debug=yes
1167     enable_wasm_strip=yes
1168     with_system_zlib=no
1169     with_theme="colibre"
1170     _os=Emscripten
1171     ;;
1174     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1175     ;;
1176 esac
1178 AC_SUBST(HOST_PLATFORM)
1180 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1181     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1184 # Set defaults, if not set by platform
1185 test "${test_cups+set}" = set || test_cups="$using_x11"
1186 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1187 test "${test_gen+set}" = set || test_gen="$using_x11"
1188 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1189 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1190 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1191 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1192 # don't handle test_qt5, so it can disable test_kf5 later
1193 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1194 test "${test_randr+set}" = set || test_randr="$using_x11"
1195 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1196 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1198 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1199 # Make sure fontconfig and freetype test both either system or not
1200 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1201 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1203 # convenience / platform overriding "fixes"
1204 # Don't sort!
1205 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1206 test "$test_kf5" = yes && test_qt5=yes
1207 test "$test_gtk3" != yes && enable_gtk3=no
1208 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1209 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1210 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1212 # Keep in sync with the above $using_x11 depending test default list
1213 disable_x11_tests()
1215     test_cups=no
1216     test_dbus=no
1217     test_gen=no
1218     test_gstreamer_1_0=no
1219     test_gtk3_kde5=no
1220     test_gtk3=no
1221     test_gtk4=no
1222     test_kf5=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     USE_HEADLESS_CODE=TRUE
1233     if test "$using_headless_plugin" = yes; then
1234         AC_DEFINE(ENABLE_HEADLESS)
1235         ENABLE_HEADLESS=TRUE
1236     fi
1237 else
1238     test_fontconfig=no
1239     test_freetype=no
1242 AC_SUBST(ENABLE_HEADLESS)
1243 AC_SUBST(USE_HEADLESS_CODE)
1245 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1246 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1247 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1248 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1250 # ===================================================================
1252 # End initial platform setup
1254 # ===================================================================
1256 if test "$_os" = "Android" ; then
1257     # Verify that the NDK and SDK options are proper
1258     if test -z "$with_android_ndk"; then
1259         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1260     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1261         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1262     fi
1264     if test -z "$ANDROID_SDK_DIR"; then
1265         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1266     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1267         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1268     fi
1271 if test "$_os" = "AIX"; then
1272     AC_PATH_PROG(GAWK, gawk)
1273     if test -z "$GAWK"; then
1274         AC_MSG_ERROR([gawk not found in \$PATH])
1275     fi
1278 AC_SUBST(SDKDIRNAME)
1280 AC_SUBST(PTHREAD_CFLAGS)
1281 AC_SUBST(PTHREAD_LIBS)
1283 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1284 # By default use the ones specified by our build system,
1285 # but explicit override is possible.
1286 AC_MSG_CHECKING(for explicit AFLAGS)
1287 if test -n "$AFLAGS"; then
1288     AC_MSG_RESULT([$AFLAGS])
1289     x_AFLAGS=
1290 else
1291     AC_MSG_RESULT(no)
1292     x_AFLAGS=[\#]
1294 AC_MSG_CHECKING(for explicit CFLAGS)
1295 if test -n "$CFLAGS"; then
1296     AC_MSG_RESULT([$CFLAGS])
1297     x_CFLAGS=
1298 else
1299     AC_MSG_RESULT(no)
1300     x_CFLAGS=[\#]
1302 AC_MSG_CHECKING(for explicit CXXFLAGS)
1303 if test -n "$CXXFLAGS"; then
1304     AC_MSG_RESULT([$CXXFLAGS])
1305     x_CXXFLAGS=
1306 else
1307     AC_MSG_RESULT(no)
1308     x_CXXFLAGS=[\#]
1310 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1311 if test -n "$OBJCFLAGS"; then
1312     AC_MSG_RESULT([$OBJCFLAGS])
1313     x_OBJCFLAGS=
1314 else
1315     AC_MSG_RESULT(no)
1316     x_OBJCFLAGS=[\#]
1318 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1319 if test -n "$OBJCXXFLAGS"; then
1320     AC_MSG_RESULT([$OBJCXXFLAGS])
1321     x_OBJCXXFLAGS=
1322 else
1323     AC_MSG_RESULT(no)
1324     x_OBJCXXFLAGS=[\#]
1326 AC_MSG_CHECKING(for explicit LDFLAGS)
1327 if test -n "$LDFLAGS"; then
1328     AC_MSG_RESULT([$LDFLAGS])
1329     x_LDFLAGS=
1330 else
1331     AC_MSG_RESULT(no)
1332     x_LDFLAGS=[\#]
1334 AC_SUBST(AFLAGS)
1335 AC_SUBST(CFLAGS)
1336 AC_SUBST(CXXFLAGS)
1337 AC_SUBST(OBJCFLAGS)
1338 AC_SUBST(OBJCXXFLAGS)
1339 AC_SUBST(LDFLAGS)
1340 AC_SUBST(x_AFLAGS)
1341 AC_SUBST(x_CFLAGS)
1342 AC_SUBST(x_CXXFLAGS)
1343 AC_SUBST(x_OBJCFLAGS)
1344 AC_SUBST(x_OBJCXXFLAGS)
1345 AC_SUBST(x_LDFLAGS)
1347 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1348 my_original_CFLAGS=$CFLAGS
1349 my_original_CXXFLAGS=$CXXFLAGS
1350 my_original_CPPFLAGS=$CPPFLAGS
1352 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1353 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1354 dnl AC_PROG_CC internally.
1355 if test "$_os" != "WINNT"; then
1356     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1357     save_CFLAGS=$CFLAGS
1358     AC_PROG_CC
1359     CFLAGS=$save_CFLAGS
1360     if test -z "$CC_BASE"; then
1361         CC_BASE=`first_arg_basename "$CC"`
1362     fi
1365 if test "$_os" != "WINNT"; then
1366     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1367 else
1368     ENDIANNESS=little
1370 AC_SUBST(ENDIANNESS)
1372 if test "$usable_dlapi" != no; then
1373     AC_DEFINE([HAVE_DLAPI])
1374     if test "$test_unix_dlapi" != no; then
1375         save_LIBS="$LIBS"
1376         AC_SEARCH_LIBS([dlsym], [dl],
1377             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1378             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1379         LIBS="$save_LIBS"
1380         AC_DEFINE([HAVE_UNIX_DLAPI])
1381     fi
1383 AC_SUBST(UNIX_DLAPI_LIBS)
1385 # Check for a (GNU) backtrace implementation
1386 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1387 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1388 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1389     save_LIBS="$LIBS"
1390     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1391         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1392         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1393     LIBS="$save_LIBS"
1395 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1396     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1399 dnl ===================================================================
1400 dnl Sanity checks for Emscripten SDK setup
1401 dnl ===================================================================
1403 EMSCRIPTEN_MIN_MAJOR=2
1404 EMSCRIPTEN_MIN_MINOR=0
1405 EMSCRIPTEN_MIN_TINY=31
1406 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1408 if test "$_os" = "Emscripten"; then
1409     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1410     EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1411     EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1412     EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1413     EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1414     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1416     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1417     if test $? -eq 0; then
1418         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1419     else
1420         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1421     fi
1423     EMSCRIPTEN_ERROR=0
1424     if ! which emconfigure >/dev/null 2>&1; then
1425         AC_MSG_WARN([emconfigure must be in your \$PATH])
1426         EMSCRIPTEN_ERROR=1
1427     fi
1428     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1429         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1430         EMSCRIPTEN_ERROR=1
1431     fi
1432     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1433     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1434         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1435         EMSCRIPTEN_ERROR=1
1436     fi
1437     if test $EMSCRIPTEN_ERROR -ne 0; then
1438         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1439     fi
1441 AC_SUBST(EMSDK_FILE_PACKAGER)
1443 ###############################################################################
1444 # Extensions switches --enable/--disable
1445 ###############################################################################
1446 # By default these should be enabled unless having extra dependencies.
1447 # If there is extra dependency over configure options then the enable should
1448 # be automagic based on whether the requiring feature is enabled or not.
1449 # All this options change anything only with --enable-extension-integration.
1451 # The name of this option and its help string makes it sound as if
1452 # extensions are built anyway, just not integrated in the installer,
1453 # if you use --disable-extension-integration. Is that really the
1454 # case?
1456 AC_ARG_ENABLE(ios-simulator,
1457     AS_HELP_STRING([--enable-ios-simulator],
1458         [build for iOS simulator])
1461 libo_FUZZ_ARG_ENABLE(extension-integration,
1462     AS_HELP_STRING([--disable-extension-integration],
1463         [Disable integration of the built extensions in the installer of the
1464          product. Use this switch to disable the integration.])
1467 AC_ARG_ENABLE(avmedia,
1468     AS_HELP_STRING([--disable-avmedia],
1469         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1470 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1472 AC_ARG_ENABLE(database-connectivity,
1473     AS_HELP_STRING([--disable-database-connectivity],
1474         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1477 # This doesn't mean not building (or "integrating") extensions
1478 # (although it probably should; i.e. it should imply
1479 # --disable-extension-integration I guess), it means not supporting
1480 # any extension mechanism at all
1481 libo_FUZZ_ARG_ENABLE(extensions,
1482     AS_HELP_STRING([--disable-extensions],
1483         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1486 AC_ARG_ENABLE(scripting,
1487     AS_HELP_STRING([--disable-scripting],
1488         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1489 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1491 # This is mainly for Android and iOS, but could potentially be used in some
1492 # special case otherwise, too, so factored out as a separate setting
1494 AC_ARG_ENABLE(dynamic-loading,
1495     AS_HELP_STRING([--disable-dynamic-loading],
1496         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1499 libo_FUZZ_ARG_ENABLE(report-builder,
1500     AS_HELP_STRING([--disable-report-builder],
1501         [Disable the Report Builder.])
1504 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1505     AS_HELP_STRING([--enable-ext-wiki-publisher],
1506         [Enable the Wiki Publisher extension.])
1509 libo_FUZZ_ARG_ENABLE(lpsolve,
1510     AS_HELP_STRING([--disable-lpsolve],
1511         [Disable compilation of the lp solve solver ])
1513 libo_FUZZ_ARG_ENABLE(coinmp,
1514     AS_HELP_STRING([--disable-coinmp],
1515         [Disable compilation of the CoinMP solver ])
1518 libo_FUZZ_ARG_ENABLE(pdfimport,
1519     AS_HELP_STRING([--disable-pdfimport],
1520         [Disable building the PDF import feature.])
1523 libo_FUZZ_ARG_ENABLE(pdfium,
1524     AS_HELP_STRING([--disable-pdfium],
1525         [Disable building PDFium. Results in unsecure PDF signature verification.])
1528 libo_FUZZ_ARG_ENABLE(skia,
1529     AS_HELP_STRING([--disable-skia],
1530         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1533 ###############################################################################
1535 dnl ---------- *** ----------
1537 libo_FUZZ_ARG_ENABLE(mergelibs,
1538     AS_HELP_STRING([--enable-mergelibs],
1539         [Merge several of the smaller libraries into one big, "merged", one.])
1542 libo_FUZZ_ARG_ENABLE(breakpad,
1543     AS_HELP_STRING([--enable-breakpad],
1544         [Enables breakpad for crash reporting.])
1547 libo_FUZZ_ARG_ENABLE(crashdump,
1548     AS_HELP_STRING([--disable-crashdump],
1549         [Disable dump.ini and dump-file, when --enable-breakpad])
1552 AC_ARG_ENABLE(fetch-external,
1553     AS_HELP_STRING([--disable-fetch-external],
1554         [Disables fetching external tarballs from web sources.])
1557 AC_ARG_ENABLE(fuzzers,
1558     AS_HELP_STRING([--enable-fuzzers],
1559         [Enables building libfuzzer targets for fuzz testing.])
1562 libo_FUZZ_ARG_ENABLE(pch,
1563     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1564         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1565          Using 'system' will include only external headers, 'base' will add also headers
1566          from base modules, 'normal' will also add all headers except from the module built,
1567          'full' will use all suitable headers even from a module itself.])
1570 libo_FUZZ_ARG_ENABLE(epm,
1571     AS_HELP_STRING([--enable-epm],
1572         [LibreOffice includes self-packaging code, that requires epm, however epm is
1573          useless for large scale package building.])
1576 libo_FUZZ_ARG_ENABLE(odk,
1577     AS_HELP_STRING([--enable-odk],
1578         [Enable building the Office Development Kit, the part that extensions need to build against])
1581 AC_ARG_ENABLE(mpl-subset,
1582     AS_HELP_STRING([--enable-mpl-subset],
1583         [Don't compile any pieces which are not MPL or more liberally licensed])
1586 libo_FUZZ_ARG_ENABLE(evolution2,
1587     AS_HELP_STRING([--enable-evolution2],
1588         [Allows the built-in evolution 2 addressbook connectivity build to be
1589          enabled.])
1592 AC_ARG_ENABLE(avahi,
1593     AS_HELP_STRING([--enable-avahi],
1594         [Determines whether to use Avahi to advertise Impress to remote controls.])
1597 libo_FUZZ_ARG_ENABLE(werror,
1598     AS_HELP_STRING([--enable-werror],
1599         [Turn warnings to errors. (Has no effect in modules where the treating
1600          of warnings as errors is disabled explicitly.)]),
1603 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1604     AS_HELP_STRING([--enable-assert-always-abort],
1605         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1608 libo_FUZZ_ARG_ENABLE(dbgutil,
1609     AS_HELP_STRING([--enable-dbgutil],
1610         [Provide debugging support from --enable-debug and include additional debugging
1611          utilities such as object counting or more expensive checks.
1612          This is the recommended option for developers.
1613          Note that this makes the build ABI incompatible, it is not possible to mix object
1614          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1616 libo_FUZZ_ARG_ENABLE(debug,
1617     AS_HELP_STRING([--enable-debug],
1618         [Include debugging information, disable compiler optimization and inlining plus
1619          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1621 libo_FUZZ_ARG_ENABLE(split-debug,
1622     AS_HELP_STRING([--disable-split-debug],
1623         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1624          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1626 libo_FUZZ_ARG_ENABLE(gdb-index,
1627     AS_HELP_STRING([--disable-gdb-index],
1628         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1629          The feature requires a linker that supports the --gdb-index option.]))
1631 libo_FUZZ_ARG_ENABLE(sal-log,
1632     AS_HELP_STRING([--enable-sal-log],
1633         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1635 libo_FUZZ_ARG_ENABLE(symbols,
1636     AS_HELP_STRING([--enable-symbols],
1637         [Generate debug information.
1638          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1639          otherwise. It is possible to explicitly specify gbuild build targets
1640          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1641          everything in the directory; there is no ordering, more specific overrides
1642          more general, and disabling takes precedence).
1643          Example: --enable-symbols="all -sw/ -Library_sc".]))
1645 libo_FUZZ_ARG_ENABLE(optimized,
1646     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1647         [Whether to compile with optimization flags.
1648          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1649          otherwise. Using 'debug' will try to use only optimizations that should
1650          not interfere with debugging. For Emscripten we default to optimized (-O1)
1651          debug build, as otherwise binaries become too large.]))
1653 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1654     AS_HELP_STRING([--disable-runtime-optimizations],
1655         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1656          JVM JIT) that are known to interact badly with certain dynamic analysis
1657          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1658          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1659          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1661 AC_ARG_WITH(valgrind,
1662     AS_HELP_STRING([--with-valgrind],
1663         [Make availability of Valgrind headers a hard requirement.]))
1665 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1666     AS_HELP_STRING([--enable-compiler-plugins],
1667         [Enable compiler plugins that will perform additional checks during
1668          building. Enabled automatically by --enable-dbgutil.
1669          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1670 COMPILER_PLUGINS_DEBUG=
1671 if test "$enable_compiler_plugins" = debug; then
1672     enable_compiler_plugins=yes
1673     COMPILER_PLUGINS_DEBUG=TRUE
1676 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1677     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1678         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1679          relevant in the --disable-compiler-plugins case.]))
1681 libo_FUZZ_ARG_ENABLE(ooenv,
1682     AS_HELP_STRING([--enable-ooenv],
1683         [Enable ooenv for the instdir installation.]))
1685 AC_ARG_ENABLE(lto,
1686     AS_HELP_STRING([--enable-lto],
1687         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1688          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1689          linker.)]))
1691 AC_ARG_ENABLE(python,
1692     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1693         [Enables or disables Python support at run-time.
1694          Also specifies what Python to use at build-time.
1695          'fully-internal' even forces the internal version for uses of Python
1696          during the build.
1697          On macOS the only choices are
1698          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1699          ]))
1701 libo_FUZZ_ARG_ENABLE(gtk3,
1702     AS_HELP_STRING([--disable-gtk3],
1703         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1704 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1706 AC_ARG_ENABLE(gtk4,
1707     AS_HELP_STRING([--enable-gtk4],
1708         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1710 AC_ARG_ENABLE(introspection,
1711     AS_HELP_STRING([--enable-introspection],
1712         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1713          Linux distributions.)]))
1715 AC_ARG_ENABLE(split-app-modules,
1716     AS_HELP_STRING([--enable-split-app-modules],
1717         [Split file lists for app modules, e.g. base, calc.
1718          Has effect only with make distro-pack-install]),
1721 AC_ARG_ENABLE(split-opt-features,
1722     AS_HELP_STRING([--enable-split-opt-features],
1723         [Split file lists for some optional features, e.g. pyuno, testtool.
1724          Has effect only with make distro-pack-install]),
1727 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1728     AS_HELP_STRING([--disable-cairo-canvas],
1729         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1732 libo_FUZZ_ARG_ENABLE(dbus,
1733     AS_HELP_STRING([--disable-dbus],
1734         [Determines whether to enable features that depend on dbus.
1735          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1736 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1738 libo_FUZZ_ARG_ENABLE(sdremote,
1739     AS_HELP_STRING([--disable-sdremote],
1740         [Determines whether to enable Impress remote control (i.e. the server component).]),
1741 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1743 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1744     AS_HELP_STRING([--disable-sdremote-bluetooth],
1745         [Determines whether to build sdremote with bluetooth support.
1746          Requires dbus on Linux.]))
1748 libo_FUZZ_ARG_ENABLE(gio,
1749     AS_HELP_STRING([--disable-gio],
1750         [Determines whether to use the GIO support.]),
1751 ,test "${enable_gio+set}" = set || enable_gio=yes)
1753 AC_ARG_ENABLE(qt5,
1754     AS_HELP_STRING([--enable-qt5],
1755         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1756          available.]),
1759 AC_ARG_ENABLE(qt6,
1760     AS_HELP_STRING([--enable-qt6],
1761         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1762          available.]),
1765 AC_ARG_ENABLE(kf5,
1766     AS_HELP_STRING([--enable-kf5],
1767         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1768          KF5 are available.]),
1771 AC_ARG_ENABLE(gtk3_kde5,
1772     AS_HELP_STRING([--enable-gtk3-kde5],
1773         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1774          platforms where Gtk3, Qt5 and Plasma is available.]),
1777 AC_ARG_ENABLE(gen,
1778     AS_HELP_STRING([--enable-gen],
1779         [To select the gen backend in case of --disable-dynamic-loading.
1780          Per default auto-enabled when X11 is used.]),
1781 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1783 AC_ARG_ENABLE(gui,
1784     AS_HELP_STRING([--disable-gui],
1785         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1786 ,enable_gui=yes)
1788 libo_FUZZ_ARG_ENABLE(randr,
1789     AS_HELP_STRING([--disable-randr],
1790         [Disable RandR support in the vcl project.]),
1791 ,test "${enable_randr+set}" = set || enable_randr=yes)
1793 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1794     AS_HELP_STRING([--disable-gstreamer-1-0],
1795         [Disable building with the gstreamer 1.0 avmedia backend.]),
1796 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1798 libo_FUZZ_ARG_ENABLE([eot],
1799     [AS_HELP_STRING([--enable-eot],
1800         [Enable support for Embedded OpenType fonts.])],
1801 ,test "${enable_eot+set}" = set || enable_eot=no)
1803 libo_FUZZ_ARG_ENABLE(cve-tests,
1804     AS_HELP_STRING([--disable-cve-tests],
1805         [Prevent CVE tests to be executed]),
1808 AC_ARG_ENABLE(build-opensymbol,
1809     AS_HELP_STRING([--enable-build-opensymbol],
1810         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1811          fontforge installed.]),
1814 AC_ARG_ENABLE(dependency-tracking,
1815     AS_HELP_STRING([--enable-dependency-tracking],
1816         [Do not reject slow dependency extractors.])[
1817   --disable-dependency-tracking
1818                           Disables generation of dependency information.
1819                           Speed up one-time builds.],
1822 AC_ARG_ENABLE(icecream,
1823     AS_HELP_STRING([--enable-icecream],
1824         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1825          It defaults to /opt/icecream for the location of the icecream gcc/g++
1826          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1829 AC_ARG_ENABLE(ld,
1830     AS_HELP_STRING([--enable-ld=<linker>],
1831         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1832          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1833          If <linker> contains any ':', the part before the first ':' is used as the value of
1834          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1835          needed for Clang 12).]),
1838 libo_FUZZ_ARG_ENABLE(cups,
1839     AS_HELP_STRING([--disable-cups],
1840         [Do not build cups support.])
1843 AC_ARG_ENABLE(ccache,
1844     AS_HELP_STRING([--disable-ccache],
1845         [Do not try to use ccache automatically.
1846          By default we will try to detect if ccache is available; in that case if
1847          CC/CXX are not yet set, and --enable-icecream is not given, we
1848          attempt to use ccache. --disable-ccache disables ccache completely.
1849          Additionally ccache's depend mode is enabled if possible,
1850          use --enable-ccache=nodepend to enable ccache without depend mode.
1854 AC_ARG_ENABLE(z7-debug,
1855     AS_HELP_STRING([--enable-z7-debug],
1856         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1857          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1858          Enabled by default if ccache is detected.]))
1860 libo_FUZZ_ARG_ENABLE(online-update,
1861     AS_HELP_STRING([--enable-online-update],
1862         [Enable the online update service that will check for new versions of
1863          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.
1864          If the value is "mar", the experimental Mozilla-like update will be
1865          enabled instead of the traditional update mechanism.]),
1868 AC_ARG_WITH(update-config,
1869     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1870                    [Path to the update config ini file]))
1872 libo_FUZZ_ARG_ENABLE(extension-update,
1873     AS_HELP_STRING([--disable-extension-update],
1874         [Disable possibility to update installed extensions.]),
1877 libo_FUZZ_ARG_ENABLE(release-build,
1878     AS_HELP_STRING([--enable-release-build],
1879         [Enable release build. Note that the "release build" choice is orthogonal to
1880          whether symbols are present, debug info is generated, or optimization
1881          is done.
1882          See http://wiki.documentfoundation.org/Development/DevBuild]),
1885 AC_ARG_ENABLE(windows-build-signing,
1886     AS_HELP_STRING([--enable-windows-build-signing],
1887         [Enable signing of windows binaries (*.exe, *.dll)]),
1890 AC_ARG_ENABLE(silent-msi,
1891     AS_HELP_STRING([--enable-silent-msi],
1892         [Enable MSI with LIMITUI=1 (silent install).]),
1895 AC_ARG_ENABLE(macosx-code-signing,
1896     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1897         [Sign executables, dylibs, frameworks and the app bundle. If you
1898          don't provide an identity the first suitable certificate
1899          in your keychain is used.]),
1902 AC_ARG_ENABLE(macosx-package-signing,
1903     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1904         [Create a .pkg suitable for uploading to the Mac App Store and sign
1905          it. If you don't provide an identity the first suitable certificate
1906          in your keychain is used.]),
1909 AC_ARG_ENABLE(macosx-sandbox,
1910     AS_HELP_STRING([--enable-macosx-sandbox],
1911         [Make the app bundle run in a sandbox. Requires code signing.
1912          Is required by apps distributed in the Mac App Store, and implies
1913          adherence to App Store rules.]),
1916 AC_ARG_WITH(macosx-bundle-identifier,
1917     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1918         [Define the macOS bundle identifier. Default is the somewhat weird
1919          org.libreoffice.script ("script", huh?).]),
1920 ,with_macosx_bundle_identifier=org.libreoffice.script)
1922 AC_ARG_WITH(macosx-provisioning-profile,
1923     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
1924         [Specify the path to a provisioning profile to use]),
1927 AC_ARG_WITH(product-name,
1928     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1929         [Define the product name. Default is AC_PACKAGE_NAME.]),
1930 ,with_product_name=$PRODUCTNAME)
1932 libo_FUZZ_ARG_ENABLE(community-flavor,
1933     AS_HELP_STRING([--disable-community-flavor],
1934         [Disable the Community branding.]),
1937 AC_ARG_WITH(package-version,
1938     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1939         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1942 libo_FUZZ_ARG_ENABLE(readonly-installset,
1943     AS_HELP_STRING([--enable-readonly-installset],
1944         [Prevents any attempts by LibreOffice to write into its installation. That means
1945          at least that no "system-wide" extensions can be added. Partly experimental work in
1946          progress, probably not fully implemented. Always enabled for macOS.]),
1949 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1950     AS_HELP_STRING([--disable-mariadb-sdbc],
1951         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1954 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1955     AS_HELP_STRING([--disable-postgresql-sdbc],
1956         [Disable the build of the PostgreSQL-SDBC driver.])
1959 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1960     AS_HELP_STRING([--disable-lotuswordpro],
1961         [Disable the build of the Lotus Word Pro filter.]),
1962 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1964 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1965     AS_HELP_STRING([--disable-firebird-sdbc],
1966         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1967 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1969 AC_ARG_ENABLE(bogus-pkg-config,
1970     AS_HELP_STRING([--enable-bogus-pkg-config],
1971         [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.]),
1974 AC_ARG_ENABLE(openssl,
1975     AS_HELP_STRING([--disable-openssl],
1976         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1977          components will use NSS. Work in progress,
1978          use only if you are hacking on it.]),
1979 ,enable_openssl=yes)
1981 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1982     AS_HELP_STRING([--enable-cipher-openssl-backend],
1983         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1984          Requires --enable-openssl.]))
1986 AC_ARG_ENABLE(nss,
1987     AS_HELP_STRING([--disable-nss],
1988         [Disable using NSS. If disabled,
1989          components will use openssl. Work in progress,
1990          use only if you are hacking on it.]),
1991 ,enable_nss=yes)
1993 AC_ARG_ENABLE(library-bin-tar,
1994     AS_HELP_STRING([--enable-library-bin-tar],
1995         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1996         Some libraries can save their build result in a tarball
1997         stored in TARFILE_LOCATION. That binary tarball is
1998         uniquely identified by the source tarball,
1999         the content of the config_host.mk file and the content
2000         of the top-level directory in core for that library
2001         If this option is enabled, then if such a tarfile exist, it will be untarred
2002         instead of the source tarfile, and the build step will be skipped for that
2003         library.
2004         If a proper tarfile does not exist, then the normal source-based
2005         build is done for that library and a proper binary tarfile is created
2006         for the next time.]),
2009 AC_ARG_ENABLE(dconf,
2010     AS_HELP_STRING([--disable-dconf],
2011         [Disable the dconf configuration backend (enabled by default where
2012          available).]))
2014 libo_FUZZ_ARG_ENABLE(formula-logger,
2015     AS_HELP_STRING(
2016         [--enable-formula-logger],
2017         [Enable formula logger for logging formula calculation flow in Calc.]
2018     )
2021 AC_ARG_ENABLE(ldap,
2022     AS_HELP_STRING([--disable-ldap],
2023         [Disable LDAP support.]),
2024 ,enable_ldap=yes)
2026 AC_ARG_ENABLE(opencl,
2027     AS_HELP_STRING([--disable-opencl],
2028         [Disable OpenCL support.]),
2029 ,enable_opencl=yes)
2031 libo_FUZZ_ARG_ENABLE(librelogo,
2032     AS_HELP_STRING([--disable-librelogo],
2033         [Do not build LibreLogo.]),
2034 ,enable_librelogo=yes)
2036 AC_ARG_ENABLE(wasm-strip,
2037     AS_HELP_STRING([--enable-wasm-strip],
2038         [Strip the static build like for WASM/emscripten platform.]),
2041 AC_ARG_WITH(main-module,
2042     AS_HELP_STRING([--with-main-module=<writer/calc>],
2043         [Specify which main module to build for wasm.
2044         Default value is 'writer'.]),
2047 AC_ARG_ENABLE(wasm-exceptions,
2048     AS_HELP_STRING([--enable-wasm-exceptions],
2049         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2050         matter of fact, this is currently not finished by any implementation)
2051         (see https://webassembly.org/roadmap/ for the current state]),
2054 AC_ARG_ENABLE(xmlhelp,
2055     AS_HELP_STRING([--disable-xmlhelp],
2056         [Disable XML help support]),
2057 ,enable_xmlhelp=yes)
2059 AC_ARG_ENABLE(customtarget-components,
2060     AS_HELP_STRING([--enable-customtarget-components],
2061         [Generates the static UNO object constructor mapping from the build.]))
2063 AC_ARG_ENABLE(float_device_pixel,
2064     AS_HELP_STRING([--enable-float-device-pixel],
2065                    [Uses doubles for VCL device coordinates instead of 32-bit integers.]),
2068 dnl ===================================================================
2069 dnl Optional Packages (--with/without-)
2070 dnl ===================================================================
2072 AC_ARG_WITH(gcc-home,
2073     AS_HELP_STRING([--with-gcc-home],
2074         [Specify the location of gcc/g++ manually. This can be used in conjunction
2075          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2076          non-default path.]),
2079 AC_ARG_WITH(gnu-patch,
2080     AS_HELP_STRING([--with-gnu-patch],
2081         [Specify location of GNU patch on Solaris or FreeBSD.]),
2084 AC_ARG_WITH(build-platform-configure-options,
2085     AS_HELP_STRING([--with-build-platform-configure-options],
2086         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2089 AC_ARG_WITH(gnu-cp,
2090     AS_HELP_STRING([--with-gnu-cp],
2091         [Specify location of GNU cp on Solaris or FreeBSD.]),
2094 AC_ARG_WITH(external-tar,
2095     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2096         [Specify an absolute path of where to find (and store) tarfiles.]),
2097     TARFILE_LOCATION=$withval ,
2100 AC_ARG_WITH(referenced-git,
2101     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2102         [Specify another checkout directory to reference. This makes use of
2103                  git submodule update --reference, and saves a lot of diskspace
2104                  when having multiple trees side-by-side.]),
2105     GIT_REFERENCE_SRC=$withval ,
2108 AC_ARG_WITH(linked-git,
2109     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2110         [Specify a directory where the repositories of submodules are located.
2111          This uses a method similar to git-new-workdir to get submodules.]),
2112     GIT_LINK_SRC=$withval ,
2115 AC_ARG_WITH(galleries,
2116     AS_HELP_STRING([--with-galleries],
2117         [Specify how galleries should be built. It is possible either to
2118          build these internally from source ("build"),
2119          or to disable them ("no")]),
2122 AC_ARG_WITH(theme,
2123     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2124         [Choose which themes to include. By default those themes with an '*' are included.
2125          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2126          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2127          *elementary, *elementary_svg,
2128          *karasa_jaga, *karasa_jaga_svg,
2129          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2130          *sukapura, *sukapura_svg.]),
2133 libo_FUZZ_ARG_WITH(helppack-integration,
2134     AS_HELP_STRING([--without-helppack-integration],
2135         [It will not integrate the helppacks to the installer
2136          of the product. Please use this switch to use the online help
2137          or separate help packages.]),
2140 libo_FUZZ_ARG_WITH(fonts,
2141     AS_HELP_STRING([--without-fonts],
2142         [LibreOffice includes some third-party fonts to provide a reliable basis for
2143          help content, templates, samples, etc. When these fonts are already
2144          known to be available on the system then you should use this option.]),
2147 AC_ARG_WITH(epm,
2148     AS_HELP_STRING([--with-epm],
2149         [Decides which epm to use. Default is to use the one from the system if
2150          one is built. When either this is not there or you say =internal epm
2151          will be built.]),
2154 AC_ARG_WITH(package-format,
2155     AS_HELP_STRING([--with-package-format],
2156         [Specify package format(s) for LibreOffice installation sets. The
2157          implicit --without-package-format leads to no installation sets being
2158          generated. Possible values: aix, archive, bsd, deb, dmg,
2159          installed, msi, pkg, and rpm.
2160          Example: --with-package-format='deb rpm']),
2163 AC_ARG_WITH(tls,
2164     AS_HELP_STRING([--with-tls],
2165         [Decides which TLS/SSL and cryptographic implementations to use for
2166          LibreOffice's code. Default is to use NSS although OpenSSL is also
2167          possible. Notice that selecting NSS restricts the usage of OpenSSL
2168          in LO's code but selecting OpenSSL doesn't restrict by now the
2169          usage of NSS in LO's code. Possible values: openssl, nss.
2170          Example: --with-tls="nss"]),
2173 AC_ARG_WITH(system-libs,
2174     AS_HELP_STRING([--with-system-libs],
2175         [Use libraries already on system -- enables all --with-system-* flags.]),
2178 AC_ARG_WITH(system-bzip2,
2179     AS_HELP_STRING([--with-system-bzip2],
2180         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2181     [with_system_bzip2="$with_system_libs"])
2183 AC_ARG_WITH(system-headers,
2184     AS_HELP_STRING([--with-system-headers],
2185         [Use headers already on system -- enables all --with-system-* flags for
2186          external packages whose headers are the only entities used i.e.
2187          boost/odbc/sane-header(s).]),,
2188     [with_system_headers="$with_system_libs"])
2190 AC_ARG_WITH(system-jars,
2191     AS_HELP_STRING([--without-system-jars],
2192         [When building with --with-system-libs, also the needed jars are expected
2193          on the system. Use this to disable that]),,
2194     [with_system_jars="$with_system_libs"])
2196 AC_ARG_WITH(system-cairo,
2197     AS_HELP_STRING([--with-system-cairo],
2198         [Use cairo libraries already on system.  Happens automatically for
2199          (implicit) --enable-gtk3.]))
2201 AC_ARG_WITH(system-epoxy,
2202     AS_HELP_STRING([--with-system-epoxy],
2203         [Use epoxy libraries already on system.  Happens automatically for
2204          (implicit) --enable-gtk3.]),,
2205        [with_system_epoxy="$with_system_libs"])
2207 AC_ARG_WITH(myspell-dicts,
2208     AS_HELP_STRING([--with-myspell-dicts],
2209         [Adds myspell dictionaries to the LibreOffice installation set]),
2212 AC_ARG_WITH(system-dicts,
2213     AS_HELP_STRING([--without-system-dicts],
2214         [Do not use dictionaries from system paths.]),
2217 AC_ARG_WITH(external-dict-dir,
2218     AS_HELP_STRING([--with-external-dict-dir],
2219         [Specify external dictionary dir.]),
2222 AC_ARG_WITH(external-hyph-dir,
2223     AS_HELP_STRING([--with-external-hyph-dir],
2224         [Specify external hyphenation pattern dir.]),
2227 AC_ARG_WITH(external-thes-dir,
2228     AS_HELP_STRING([--with-external-thes-dir],
2229         [Specify external thesaurus dir.]),
2232 AC_ARG_WITH(system-zlib,
2233     AS_HELP_STRING([--with-system-zlib],
2234         [Use zlib already on system.]),,
2235     [with_system_zlib=auto])
2237 AC_ARG_WITH(system-jpeg,
2238     AS_HELP_STRING([--with-system-jpeg],
2239         [Use jpeg already on system.]),,
2240     [with_system_jpeg="$with_system_libs"])
2242 AC_ARG_WITH(system-expat,
2243     AS_HELP_STRING([--with-system-expat],
2244         [Use expat already on system.]),,
2245     [with_system_expat="$with_system_libs"])
2247 AC_ARG_WITH(system-libxml,
2248     AS_HELP_STRING([--with-system-libxml],
2249         [Use libxml/libxslt already on system.]),,
2250     [with_system_libxml=auto])
2252 AC_ARG_WITH(system-openldap,
2253     AS_HELP_STRING([--with-system-openldap],
2254         [Use the OpenLDAP LDAP SDK already on system.]),,
2255     [with_system_openldap="$with_system_libs"])
2257 libo_FUZZ_ARG_ENABLE(poppler,
2258     AS_HELP_STRING([--disable-poppler],
2259         [Disable building Poppler.])
2262 AC_ARG_WITH(system-poppler,
2263     AS_HELP_STRING([--with-system-poppler],
2264         [Use system poppler (only needed for PDF import).]),,
2265     [with_system_poppler="$with_system_libs"])
2267 AC_ARG_WITH(system-abseil,
2268     AS_HELP_STRING([--with-system-abseil],
2269         [Use the abseil libraries already on system.]),,
2270     [with_system_abseil="$with_system_libs"])
2272 AC_ARG_WITH(system-openjpeg,
2273     AS_HELP_STRING([--with-system-openjpeg],
2274         [Use the OpenJPEG library already on system.]),,
2275     [with_system_openjpeg="$with_system_libs"])
2277 libo_FUZZ_ARG_ENABLE(gpgmepp,
2278     AS_HELP_STRING([--disable-gpgmepp],
2279         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2282 AC_ARG_WITH(system-gpgmepp,
2283     AS_HELP_STRING([--with-system-gpgmepp],
2284         [Use gpgmepp already on system]),,
2285     [with_system_gpgmepp="$with_system_libs"])
2287 AC_ARG_WITH(system-mariadb,
2288     AS_HELP_STRING([--with-system-mariadb],
2289         [Use MariaDB/MySQL libraries already on system.]),,
2290     [with_system_mariadb="$with_system_libs"])
2292 AC_ARG_ENABLE(bundle-mariadb,
2293     AS_HELP_STRING([--enable-bundle-mariadb],
2294         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2297 AC_ARG_WITH(system-postgresql,
2298     AS_HELP_STRING([--with-system-postgresql],
2299         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2300          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2301     [with_system_postgresql="$with_system_libs"])
2303 AC_ARG_WITH(libpq-path,
2304     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2305         [Use this PostgreSQL C interface (libpq) installation for building
2306          the PostgreSQL-SDBC extension.]),
2309 AC_ARG_WITH(system-firebird,
2310     AS_HELP_STRING([--with-system-firebird],
2311         [Use Firebird libraries already on system, for building the Firebird-SDBC
2312          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2313     [with_system_firebird="$with_system_libs"])
2315 AC_ARG_WITH(system-libtommath,
2316             AS_HELP_STRING([--with-system-libtommath],
2317                            [Use libtommath already on system]),,
2318             [with_system_libtommath="$with_system_libs"])
2320 AC_ARG_WITH(system-hsqldb,
2321     AS_HELP_STRING([--with-system-hsqldb],
2322         [Use hsqldb already on system.]))
2324 AC_ARG_WITH(hsqldb-jar,
2325     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2326         [Specify path to jarfile manually.]),
2327     HSQLDB_JAR=$withval)
2329 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2330     AS_HELP_STRING([--disable-scripting-beanshell],
2331         [Disable support for scripts in BeanShell.]),
2335 AC_ARG_WITH(system-beanshell,
2336     AS_HELP_STRING([--with-system-beanshell],
2337         [Use beanshell already on system.]),,
2338     [with_system_beanshell="$with_system_jars"])
2340 AC_ARG_WITH(beanshell-jar,
2341     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2342         [Specify path to jarfile manually.]),
2343     BSH_JAR=$withval)
2345 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2346     AS_HELP_STRING([--disable-scripting-javascript],
2347         [Disable support for scripts in JavaScript.]),
2351 AC_ARG_WITH(system-rhino,
2352     AS_HELP_STRING([--with-system-rhino],
2353         [Use rhino already on system.]),,)
2354 #    [with_system_rhino="$with_system_jars"])
2355 # Above is not used as we have different debug interface
2356 # patched into internal rhino. This code needs to be fixed
2357 # before we can enable it by default.
2359 AC_ARG_WITH(rhino-jar,
2360     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2361         [Specify path to jarfile manually.]),
2362     RHINO_JAR=$withval)
2364 AC_ARG_WITH(system-jfreereport,
2365     AS_HELP_STRING([--with-system-jfreereport],
2366         [Use JFreeReport already on system.]),,
2367     [with_system_jfreereport="$with_system_jars"])
2369 AC_ARG_WITH(sac-jar,
2370     AS_HELP_STRING([--with-sac-jar=JARFILE],
2371         [Specify path to jarfile manually.]),
2372     SAC_JAR=$withval)
2374 AC_ARG_WITH(libxml-jar,
2375     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2376         [Specify path to jarfile manually.]),
2377     LIBXML_JAR=$withval)
2379 AC_ARG_WITH(flute-jar,
2380     AS_HELP_STRING([--with-flute-jar=JARFILE],
2381         [Specify path to jarfile manually.]),
2382     FLUTE_JAR=$withval)
2384 AC_ARG_WITH(jfreereport-jar,
2385     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2386         [Specify path to jarfile manually.]),
2387     JFREEREPORT_JAR=$withval)
2389 AC_ARG_WITH(liblayout-jar,
2390     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2391         [Specify path to jarfile manually.]),
2392     LIBLAYOUT_JAR=$withval)
2394 AC_ARG_WITH(libloader-jar,
2395     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2396         [Specify path to jarfile manually.]),
2397     LIBLOADER_JAR=$withval)
2399 AC_ARG_WITH(libformula-jar,
2400     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2401         [Specify path to jarfile manually.]),
2402     LIBFORMULA_JAR=$withval)
2404 AC_ARG_WITH(librepository-jar,
2405     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2406         [Specify path to jarfile manually.]),
2407     LIBREPOSITORY_JAR=$withval)
2409 AC_ARG_WITH(libfonts-jar,
2410     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2411         [Specify path to jarfile manually.]),
2412     LIBFONTS_JAR=$withval)
2414 AC_ARG_WITH(libserializer-jar,
2415     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2416         [Specify path to jarfile manually.]),
2417     LIBSERIALIZER_JAR=$withval)
2419 AC_ARG_WITH(libbase-jar,
2420     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2421         [Specify path to jarfile manually.]),
2422     LIBBASE_JAR=$withval)
2424 AC_ARG_WITH(system-odbc,
2425     AS_HELP_STRING([--with-system-odbc],
2426         [Use the odbc headers already on system.]),,
2427     [with_system_odbc="auto"])
2429 AC_ARG_WITH(system-sane,
2430     AS_HELP_STRING([--with-system-sane],
2431         [Use sane.h already on system.]),,
2432     [with_system_sane="$with_system_headers"])
2434 AC_ARG_WITH(system-bluez,
2435     AS_HELP_STRING([--with-system-bluez],
2436         [Use bluetooth.h already on system.]),,
2437     [with_system_bluez="$with_system_headers"])
2439 AC_ARG_WITH(system-boost,
2440     AS_HELP_STRING([--with-system-boost],
2441         [Use boost already on system.]),,
2442     [with_system_boost="$with_system_headers"])
2444 AC_ARG_WITH(system-dragonbox,
2445     AS_HELP_STRING([--with-system-dragonbox],
2446         [Use dragonbox already on system.]),,
2447     [with_system_dragonbox="$with_system_headers"])
2449 AC_ARG_WITH(system-libfixmath,
2450     AS_HELP_STRING([--with-system-libfixmath],
2451         [Use libfixmath already on system.]),,
2452     [with_system_libfixmath="$with_system_libs"])
2454 AC_ARG_WITH(system-glm,
2455     AS_HELP_STRING([--with-system-glm],
2456         [Use glm already on system.]),,
2457     [with_system_glm="$with_system_headers"])
2459 AC_ARG_WITH(system-hunspell,
2460     AS_HELP_STRING([--with-system-hunspell],
2461         [Use libhunspell already on system.]),,
2462     [with_system_hunspell="$with_system_libs"])
2464 libo_FUZZ_ARG_ENABLE(zxing,
2465     AS_HELP_STRING([--disable-zxing],
2466        [Disable use of zxing external library.]))
2468 AC_ARG_WITH(system-zxing,
2469     AS_HELP_STRING([--with-system-zxing],
2470         [Use libzxing already on system.]),,
2471     [with_system_zxing="$with_system_libs"])
2473 AC_ARG_WITH(system-box2d,
2474     AS_HELP_STRING([--with-system-box2d],
2475         [Use box2d already on system.]),,
2476     [with_system_box2d="$with_system_libs"])
2478 AC_ARG_WITH(system-mythes,
2479     AS_HELP_STRING([--with-system-mythes],
2480         [Use mythes already on system.]),,
2481     [with_system_mythes="$with_system_libs"])
2483 AC_ARG_WITH(system-altlinuxhyph,
2484     AS_HELP_STRING([--with-system-altlinuxhyph],
2485         [Use ALTLinuxhyph already on system.]),,
2486     [with_system_altlinuxhyph="$with_system_libs"])
2488 AC_ARG_WITH(system-lpsolve,
2489     AS_HELP_STRING([--with-system-lpsolve],
2490         [Use lpsolve already on system.]),,
2491     [with_system_lpsolve="$with_system_libs"])
2493 AC_ARG_WITH(system-coinmp,
2494     AS_HELP_STRING([--with-system-coinmp],
2495         [Use CoinMP already on system.]),,
2496     [with_system_coinmp="$with_system_libs"])
2498 AC_ARG_WITH(system-liblangtag,
2499     AS_HELP_STRING([--with-system-liblangtag],
2500         [Use liblangtag library already on system.]),,
2501     [with_system_liblangtag="$with_system_libs"])
2503 AC_ARG_WITH(system-lockfile,
2504     AS_HELP_STRING([--with-system-lockfile[=file]],
2505         [Detect a system lockfile program or use the \$file argument.]))
2507 AC_ARG_WITH(webdav,
2508     AS_HELP_STRING([--without-webdav],
2509         [Disable WebDAV support in the UCB.]))
2511 AC_ARG_WITH(linker-hash-style,
2512     AS_HELP_STRING([--with-linker-hash-style],
2513         [Use linker with --hash-style=<style> when linking shared objects.
2514          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2515          if supported on the build system, and "sysv" otherwise.]))
2517 AC_ARG_WITH(jdk-home,
2518     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2519         [If you have installed JDK 9 or later on your system please supply the
2520          path here. Note that this is not the location of the java command but the
2521          location of the entire distribution. In case of cross-compiling, this
2522          is the JDK of the host os. Use --with-build-platform-configure-options
2523          to point to a different build platform JDK.]),
2526 AC_ARG_WITH(help,
2527     AS_HELP_STRING([--with-help],
2528         [Enable the build of help. There is a special parameter "common" that
2529          can be used to bundle only the common part, .e.g help-specific icons.
2530          This is useful when you build the helpcontent separately.])
2531     [
2532                           Usage:     --with-help    build the old local help
2533                                  --without-help     no local help (default)
2534                                  --with-help=html   build the new HTML local help
2535                                  --with-help=online build the new HTML online help
2536     ],
2539 AC_ARG_WITH(omindex,
2540    AS_HELP_STRING([--with-omindex],
2541         [Enable the support of xapian-omega index for online help.])
2542    [
2543                          Usage: --with-omindex=server prepare the pages for omindex
2544                                 but let xapian-omega be built in server.
2545                                 --with-omindex=noxap do not prepare online pages
2546                                 for xapian-omega
2547   ],
2550 libo_FUZZ_ARG_WITH(java,
2551     AS_HELP_STRING([--with-java=<java command>],
2552         [Specify the name of the Java interpreter command. Typically "java"
2553          which is the default.
2555          To build without support for Java components, applets, accessibility
2556          or the XML filters written in Java, use --without-java or --with-java=no.]),
2557     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2558     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2561 AC_ARG_WITH(jvm-path,
2562     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2563         [Use a specific JVM search path at runtime.
2564          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2567 AC_ARG_WITH(ant-home,
2568     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2569         [If you have installed Apache Ant on your system, please supply the path here.
2570          Note that this is not the location of the Ant binary but the location
2571          of the entire distribution.]),
2574 AC_ARG_WITH(symbol-config,
2575     AS_HELP_STRING([--with-symbol-config],
2576         [Configuration for the crashreport symbol upload]),
2577         [],
2578         [with_symbol_config=no])
2580 AC_ARG_WITH(export-validation,
2581     AS_HELP_STRING([--without-export-validation],
2582         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2583 ,with_export_validation=auto)
2585 AC_ARG_WITH(bffvalidator,
2586     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2587         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2588          Requires installed Microsoft Office Binary File Format Validator.
2589          Note: export-validation (--with-export-validation) is required to be turned on.
2590          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2591 ,with_bffvalidator=no)
2593 libo_FUZZ_ARG_WITH(junit,
2594     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2595         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2596          --without-junit disables those tests. Not relevant in the --without-java case.]),
2597 ,with_junit=yes)
2599 AC_ARG_WITH(hamcrest,
2600     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2601         [Specifies the hamcrest jar file to use for JUnit-based tests.
2602          --without-junit disables those tests. Not relevant in the --without-java case.]),
2603 ,with_hamcrest=yes)
2605 AC_ARG_WITH(perl-home,
2606     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2607         [If you have installed Perl 5 Distribution, on your system, please
2608          supply the path here. Note that this is not the location of the Perl
2609          binary but the location of the entire distribution.]),
2612 libo_FUZZ_ARG_WITH(doxygen,
2613     AS_HELP_STRING(
2614         [--with-doxygen=<absolute path to doxygen executable>],
2615         [Specifies the doxygen executable to use when generating ODK C/C++
2616          documentation. --without-doxygen disables generation of ODK C/C++
2617          documentation. Not relevant in the --disable-odk case.]),
2618 ,with_doxygen=yes)
2620 AC_ARG_WITH(visual-studio,
2621     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2622         [Specify which Visual Studio version to use in case several are
2623          installed. Currently 2019 (default) and 2022 are supported.]),
2626 AC_ARG_WITH(windows-sdk,
2627     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2628         [Specify which Windows SDK, or "Windows Kit", version to use
2629          in case the one that came with the selected Visual Studio
2630          is not what you want for some reason. Note that not all compiler/SDK
2631          combinations are supported. The intent is that this option should not
2632          be needed.]),
2635 AC_ARG_WITH(lang,
2636     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2637         [Use this option to build LibreOffice with additional UI language support.
2638          English (US) is always included by default.
2639          Separate multiple languages with space.
2640          For all languages, use --with-lang=ALL.]),
2643 AC_ARG_WITH(locales,
2644     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2645         [Use this option to limit the locale information built in.
2646          Separate multiple locales with space.
2647          Very experimental and might well break stuff.
2648          Just a desperate measure to shrink code and data size.
2649          By default all the locales available is included.
2650          Just works with --disable-dynloading. Defaults to "ALL".
2651          This option is completely unrelated to --with-lang.])
2652     [
2653                           Affects also our character encoding conversion
2654                           tables for encodings mainly targeted for a
2655                           particular locale, like EUC-CN and EUC-TW for
2656                           zh, ISO-2022-JP for ja.
2658                           Affects also our add-on break iterator data for
2659                           some languages.
2661                           For the default, all locales, don't use this switch at all.
2662                           Specifying just the language part of a locale means all matching
2663                           locales will be included.
2664     ],
2667 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2668 libo_FUZZ_ARG_WITH(krb5,
2669     AS_HELP_STRING([--with-krb5],
2670         [Enable MIT Kerberos 5 support in modules that support it.
2671          By default automatically enabled on platforms
2672          where a good system Kerberos 5 is available.]),
2675 libo_FUZZ_ARG_WITH(gssapi,
2676     AS_HELP_STRING([--with-gssapi],
2677         [Enable GSSAPI support in modules that support it.
2678          By default automatically enabled on platforms
2679          where a good system GSSAPI is available.]),
2682 libo_FUZZ_ARG_WITH(lxml,
2683     AS_HELP_STRING([--without-lxml],
2684         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2685          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2686          report widget classes and ids.]),
2689 libo_FUZZ_ARG_WITH(latest-c++,
2690     AS_HELP_STRING([--with-latest-c++],
2691         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2692          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2693         [with_latest_c__=no])
2695 AC_ARG_WITH(gtk3-build,
2696     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2697         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2698          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2700 dnl ===================================================================
2701 dnl Branding
2702 dnl ===================================================================
2704 AC_ARG_WITH(branding,
2705     AS_HELP_STRING([--with-branding=/path/to/images],
2706         [Use given path to retrieve branding images set.])
2707     [
2708                           Search for intro.png about.svg and logo.svg.
2709                           If any is missing, default ones will be used instead.
2711                           Search also progress.conf for progress
2712                           settings on intro screen :
2714                           PROGRESSBARCOLOR="255,255,255" Set color of
2715                           progress bar. Comma separated RGB decimal values.
2716                           PROGRESSSIZE="407,6" Set size of progress bar.
2717                           Comma separated decimal values (width, height).
2718                           PROGRESSPOSITION="61,317" Set position of progress
2719                           bar from left,top. Comma separated decimal values.
2720                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2721                           bar frame. Comma separated RGB decimal values.
2722                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2723                           bar text. Comma separated RGB decimal values.
2724                           PROGRESSTEXTBASELINE="287" Set vertical position of
2725                           progress bar text from top. Decimal value.
2727                           Default values will be used if not found.
2728     ],
2732 AC_ARG_WITH(extra-buildid,
2733     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2734         [Show addition build identification in about dialog.]),
2738 AC_ARG_WITH(vendor,
2739     AS_HELP_STRING([--with-vendor="John the Builder"],
2740         [Set vendor of the build.]),
2743 AC_ARG_WITH(privacy-policy-url,
2744     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2745         [The URL to your privacy policy (needed when
2746          enabling online-update or crashreporting via breakpad)]),
2747         [if test "x$with_privacy_policy_url" = "xyes"; then
2748             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2749          elif test "x$with_privacy_policy_url" = "xno"; then
2750             with_privacy_policy_url="undefined"
2751          fi]
2752 ,[with_privacy_policy_url="undefined"])
2754 AC_ARG_WITH(android-package-name,
2755     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2756         [Set Android package name of the build.]),
2759 AC_ARG_WITH(compat-oowrappers,
2760     AS_HELP_STRING([--with-compat-oowrappers],
2761         [Install oo* wrappers in parallel with
2762          lo* ones to keep backward compatibility.
2763          Has effect only with make distro-pack-install]),
2766 AC_ARG_WITH(os-version,
2767     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2768         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2771 AC_ARG_WITH(parallelism,
2772     AS_HELP_STRING([--with-parallelism],
2773         [Number of jobs to run simultaneously during build. Parallel builds can
2774         save a lot of time on multi-cpu machines. Defaults to the number of
2775         CPUs on the machine, unless you configure --enable-icecream - then to
2776         40.]),
2779 AC_ARG_WITH(all-tarballs,
2780     AS_HELP_STRING([--with-all-tarballs],
2781         [Download all external tarballs unconditionally]))
2783 AC_ARG_WITH(gdrive-client-id,
2784     AS_HELP_STRING([--with-gdrive-client-id],
2785         [Provides the client id of the application for OAuth2 authentication
2786         on Google Drive. If either this or --with-gdrive-client-secret is
2787         empty, the feature will be disabled]),
2790 AC_ARG_WITH(gdrive-client-secret,
2791     AS_HELP_STRING([--with-gdrive-client-secret],
2792         [Provides the client secret of the application for OAuth2
2793         authentication on Google Drive. If either this or
2794         --with-gdrive-client-id is empty, the feature will be disabled]),
2797 AC_ARG_WITH(alfresco-cloud-client-id,
2798     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2799         [Provides the client id of the application for OAuth2 authentication
2800         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2801         empty, the feature will be disabled]),
2804 AC_ARG_WITH(alfresco-cloud-client-secret,
2805     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2806         [Provides the client secret of the application for OAuth2
2807         authentication on Alfresco Cloud. If either this or
2808         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2811 AC_ARG_WITH(onedrive-client-id,
2812     AS_HELP_STRING([--with-onedrive-client-id],
2813         [Provides the client id of the application for OAuth2 authentication
2814         on OneDrive. If either this or --with-onedrive-client-secret is
2815         empty, the feature will be disabled]),
2818 AC_ARG_WITH(onedrive-client-secret,
2819     AS_HELP_STRING([--with-onedrive-client-secret],
2820         [Provides the client secret of the application for OAuth2
2821         authentication on OneDrive. If either this or
2822         --with-onedrive-client-id is empty, the feature will be disabled]),
2824 dnl ===================================================================
2825 dnl Do we want to use pre-build binary tarball for recompile
2826 dnl ===================================================================
2828 if test "$enable_library_bin_tar" = "yes" ; then
2829     USE_LIBRARY_BIN_TAR=TRUE
2830 else
2831     USE_LIBRARY_BIN_TAR=
2833 AC_SUBST(USE_LIBRARY_BIN_TAR)
2835 dnl ===================================================================
2836 dnl Test whether build target is Release Build
2837 dnl ===================================================================
2838 AC_MSG_CHECKING([whether build target is Release Build])
2839 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2840     AC_MSG_RESULT([no])
2841     ENABLE_RELEASE_BUILD=
2842     GET_TASK_ALLOW_ENTITLEMENT='
2843         <!-- We want to be able to debug a hardened process when not building for release -->
2844         <key>com.apple.security.get-task-allow</key>
2845         <true/>'
2846 else
2847     AC_MSG_RESULT([yes])
2848     ENABLE_RELEASE_BUILD=TRUE
2849     GET_TASK_ALLOW_ENTITLEMENT=''
2851 AC_SUBST(ENABLE_RELEASE_BUILD)
2852 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2854 AC_MSG_CHECKING([whether to build a Community flavor])
2855 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2856     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2857     AC_MSG_RESULT([yes])
2858 else
2859     AC_MSG_RESULT([no])
2862 dnl ===================================================================
2863 dnl Test whether to sign Windows Build
2864 dnl ===================================================================
2865 AC_MSG_CHECKING([whether to sign windows build])
2866 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2867     AC_MSG_RESULT([yes])
2868     WINDOWS_BUILD_SIGNING="TRUE"
2869 else
2870     AC_MSG_RESULT([no])
2871     WINDOWS_BUILD_SIGNING="FALSE"
2873 AC_SUBST(WINDOWS_BUILD_SIGNING)
2875 dnl ===================================================================
2876 dnl MacOSX build and runtime environment options
2877 dnl ===================================================================
2879 AC_ARG_WITH(macosx-version-min-required,
2880     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2881         [set the minimum OS version needed to run the built LibreOffice])
2882     [
2883                           e. g.: --with-macosx-version-min-required=10.14
2884     ],
2887 dnl ===================================================================
2888 dnl Check for incompatible options set by fuzzing, and reset those
2889 dnl automatically to working combinations
2890 dnl ===================================================================
2892 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2893         "$enable_dbus" != "$enable_avahi"; then
2894     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2895     enable_avahi=$enable_dbus
2898 add_lopath_after ()
2900     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2901         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2902     fi
2905 add_lopath_before ()
2907     local IFS=${P_SEP}
2908     local path_cleanup
2909     local dir
2910     for dir in $LO_PATH ; do
2911         if test "$dir" != "$1" ; then
2912             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2913         fi
2914     done
2915     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2918 dnl ===================================================================
2919 dnl check for required programs (grep, awk, sed, bash)
2920 dnl ===================================================================
2922 pathmunge ()
2924     local new_path
2925     if test -n "$1"; then
2926         if test "$build_os" = "cygwin"; then
2927             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2928                 PathFormat "$1"
2929                 new_path=`cygpath -sm "$formatted_path"`
2930             else
2931                 PathFormat "$1"
2932                 new_path=`cygpath -u "$formatted_path"`
2933             fi
2934         else
2935             new_path="$1"
2936         fi
2937         if test "$2" = "after"; then
2938             add_lopath_after "$new_path"
2939         else
2940             add_lopath_before "$new_path"
2941         fi
2942     fi
2945 AC_PROG_AWK
2946 AC_PATH_PROG( AWK, $AWK)
2947 if test -z "$AWK"; then
2948     AC_MSG_ERROR([install awk to run this script])
2951 AC_PATH_PROG(BASH, bash)
2952 if test -z "$BASH"; then
2953     AC_MSG_ERROR([bash not found in \$PATH])
2955 AC_SUBST(BASH)
2957 # prefer parallel compression tools, if available
2958 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2959 if test -z "$COMPRESSIONTOOL"; then
2960     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2961     if test -z "$COMPRESSIONTOOL"; then
2962         AC_MSG_ERROR([gzip not found in \$PATH])
2963     fi
2965 AC_SUBST(COMPRESSIONTOOL)
2967 AC_MSG_CHECKING([for GNU or BSD tar])
2968 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
2969     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
2970     if test $? -eq 0;  then
2971         GNUTAR=$a
2972         break
2973     fi
2974 done
2975 AC_MSG_RESULT($GNUTAR)
2976 if test -z "$GNUTAR"; then
2977     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2979 AC_SUBST(GNUTAR)
2981 AC_MSG_CHECKING([for tar's option to strip components])
2982 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
2983 if test $? -eq 0; then
2984     STRIP_COMPONENTS="--strip-components"
2985 else
2986     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
2987     if test $? -eq 0; then
2988         STRIP_COMPONENTS="--strip-path"
2989     else
2990         STRIP_COMPONENTS="unsupported"
2991     fi
2993 AC_MSG_RESULT($STRIP_COMPONENTS)
2994 if test x$STRIP_COMPONENTS = xunsupported; then
2995     AC_MSG_ERROR([you need a tar that is able to strip components.])
2997 AC_SUBST(STRIP_COMPONENTS)
2999 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3000 dnl desktop OSes from "mobile" ones.
3002 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3003 dnl In other words, that when building for an OS that is not a
3004 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3006 dnl Note the direction of the implication; there is no assumption that
3007 dnl cross-compiling would imply a non-desktop OS.
3009 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3010     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3011     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3012     if test "$_os" != Emscripten; then
3013         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3014     fi
3017 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3018 # also work with the default gtk3 plugin.
3019 if test "$enable_wasm_strip" = "yes"; then
3020     enable_avmedia=no
3021     enable_cmis=no
3022     enable_coinmp=no
3023     enable_cups=no
3024     test "$_os" = Emscripten && enable_curl=no
3025     enable_database_connectivity=no
3026     enable_dbus=no
3027     enable_dconf=no
3028     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3029     enable_extension_integration=no
3030     enable_extensions=no
3031     enable_extension_update=no
3032     enable_gio=no
3033     enable_gpgmepp=no
3034     enable_ldap=no
3035     enable_lotuswordpro=no
3036     enable_lpsolve=no
3037     enable_nss=no
3038     enable_odk=no
3039     enable_online_update=no
3040     enable_opencl=no
3041     enable_pdfimport=no
3042     enable_randr=no
3043     enable_report_builder=no
3044     enable_scripting=no
3045     enable_sdremote_bluetooth=no
3046     enable_skia=no
3047     enable_xmlhelp=no
3048     enable_zxing=no
3049     test_libepubgen=no
3050     test_libcdr=no
3051     test_libcmis=no
3052     test_libetonyek=no
3053     test_libfreehand=no
3054     test_libmspub=no
3055     test_libpagemaker=no
3056     test_libqxp=no
3057     test_libvisio=no
3058     test_libzmf=no
3059     test_webdav=no
3060     with_galleries=no
3061     with_webdav=no
3062     with_x=no
3064     test "${with_fonts+set}" = set || with_fonts=yes
3065     test "${with_locales+set}" = set || with_locales=en
3067     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3068     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3069     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3070     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3071 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3072     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3073     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3074     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3075     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3076 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3077     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3078     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3079     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3080     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3081     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3082     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3083     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3084     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3087 EMSCRIPTEN_NEH_MAJOR=3
3088 EMSCRIPTEN_NEH_MINOR=1
3089 EMSCRIPTEN_NEH_TINY=3
3090 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3092 if test "$enable_wasm_exceptions" = yes; then
3093     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3094     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3095     if test $? -ne 0; then
3096         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3097     else
3098         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3099     fi
3100     ENABLE_WASM_EXCEPTIONS=TRUE
3102 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3104 # Whether to build "avmedia" functionality or not.
3106 if test "$enable_avmedia" = yes; then
3107     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3108     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3109 else
3110     test_gstreamer_1_0=no
3113 # Decide whether to build database connectivity stuff (including Base) or not.
3114 if test "$enable_database_connectivity" != no; then
3115     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3116     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3117 else
3118     if test "$_os" = iOS; then
3119         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3120     fi
3121     disable_database_connectivity_dependencies
3124 if test -z "$enable_extensions"; then
3125     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3126     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3127         enable_extensions=yes
3128     fi
3131 DISABLE_SCRIPTING=''
3132 if test "$enable_scripting" = yes; then
3133     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3134     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3135 else
3136     DISABLE_SCRIPTING='TRUE'
3137     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3140 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3141     # Disable dynamic_loading always for iOS and Android
3142     enable_dynamic_loading=no
3143 elif test -z "$enable_dynamic_loading"; then
3144     # Otherwise enable it unless specifically disabled
3145     enable_dynamic_loading=yes
3148 DISABLE_DYNLOADING=''
3149 if test "$enable_dynamic_loading" = yes; then
3150     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3151 else
3152     DISABLE_DYNLOADING='TRUE'
3153     if test $_os != iOS -a $_os != Android; then
3154         enable_database_connectivity=no
3155         enable_nss=no
3156         enable_odk=no
3157         enable_python=no
3158         enable_skia=no
3159         with_java=no
3160     fi
3162 AC_SUBST(DISABLE_DYNLOADING)
3164 ENABLE_CUSTOMTARGET_COMPONENTS=
3165 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3166     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3167     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3168         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3169     fi
3171 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3173 if test "$enable_extensions" = yes; then
3174     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3175     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3176 else
3177     enable_extension_integration=no
3178     enable_extension_update=no
3181 # remember SYSBASE value
3182 AC_SUBST(SYSBASE)
3184 dnl ===================================================================
3185 dnl  Sort out various gallery compilation options
3186 dnl ===================================================================
3187 WITH_GALLERY_BUILD=TRUE
3188 AC_MSG_CHECKING([how to build and package galleries])
3189 if test -n "${with_galleries}"; then
3190     if test "$with_galleries" = "build"; then
3191         if test "$enable_database_connectivity" = no; then
3192             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3193         fi
3194         AC_MSG_RESULT([build from source images internally])
3195     elif test "$with_galleries" = "no"; then
3196         WITH_GALLERY_BUILD=
3197         AC_MSG_RESULT([disable non-internal gallery build])
3198     else
3199         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3200     fi
3201 else
3202     if test $_os != iOS -a $_os != Android; then
3203         AC_MSG_RESULT([internal src images for desktop])
3204     else
3205         WITH_GALLERY_BUILD=
3206         AC_MSG_RESULT([disable src image build])
3207     fi
3209 AC_SUBST(WITH_GALLERY_BUILD)
3211 dnl ===================================================================
3212 dnl  Checks if ccache is available
3213 dnl ===================================================================
3214 CCACHE_DEPEND_MODE=
3215 if test "$enable_ccache" = "no"; then
3216     CCACHE=""
3217 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3218     case "%$CC%$CXX%" in
3219     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3220     # assume that's good then
3221     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3222         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3223         CCACHE_DEPEND_MODE=1
3224         ;;
3225     *)
3226         # try to use our own ccache if it is available and CCACHE was not already defined
3227         if test -z "$CCACHE"; then
3228             if test "$_os" = "WINNT"; then
3229                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3230             fi
3231             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3232                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3233             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3234                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3235             fi
3236         fi
3237         AC_PATH_PROG([CCACHE],[ccache],[not found])
3238         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3239             CCACHE=`win_short_path_for_make "$CCACHE"`
3240             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3241             rm -f conftest.txt
3242             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3243             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3244             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3245                 AC_MSG_RESULT(yes)
3246             else
3247                 AC_MSG_RESULT(no)
3248                 CCACHE="not found"
3249             fi
3250             rm -f conftest.txt
3251         fi
3252         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3253             # on windows/VC perhaps sccache is around?
3254             case "%$CC%$CXX%" in
3255             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3256             # assume that's good then
3257             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3258                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3259                 CCACHE_DEPEND_MODE=1
3260                 SCCACHE=1
3261                 ;;
3262             *)
3263                 # for sharing code below, reuse CCACHE env var
3264                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3265                 if test "$CCACHE" != "not found"; then
3266                     CCACHE=`win_short_path_for_make "$CCACHE"`
3267                     SCCACHE=1
3268                     CCACHE_DEPEND_MODE=1
3269                 fi
3270                 ;;
3271             esac
3272         fi
3273         if test "$CCACHE" = "not found"; then
3274             CCACHE=""
3275         fi
3276         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3277             CCACHE_DEPEND_MODE=1
3278             # Need to check for ccache version: otherwise prevents
3279             # caching of the results (like "-x objective-c++" for Mac)
3280             if test $_os = Darwin -o $_os = iOS; then
3281                 # Check ccache version
3282                 AC_MSG_CHECKING([whether version of ccache is suitable])
3283                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3284                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3285                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3286                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3287                 else
3288                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3289                     CCACHE=""
3290                     CCACHE_DEPEND_MODE=
3291                 fi
3292             fi
3293         fi
3294         ;;
3295     esac
3296 else
3297     CCACHE=""
3299 if test "$enable_ccache" = "nodepend"; then
3300     CCACHE_DEPEND_MODE=""
3302 AC_SUBST(CCACHE_DEPEND_MODE)
3304 # sccache defaults are good enough
3305 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3306     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3307     # -p works with both 4.2 and 4.4
3308     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//'])
3309     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3310     if test "$ccache_size" = ""; then
3311         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3312         if test "$ccache_size" = ""; then
3313             ccache_size=0
3314         fi
3315         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3316         if test $ccache_size -lt 1024; then
3317             CCACHE=""
3318             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3319             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3320         else
3321             # warn that ccache may be too small for debug build
3322             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3323             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3324         fi
3325     else
3326         if test $ccache_size -lt 5; then
3327             #warn that ccache may be too small for debug build
3328             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3329             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3330         fi
3331     fi
3334 ENABLE_Z7_DEBUG=
3335 if test "$enable_z7_debug" != no; then
3336     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3337         ENABLE_Z7_DEBUG=TRUE
3338     fi
3339 else
3340     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3341     add_warning "ccache will not work with --disable-z7-debug"
3343 AC_SUBST(ENABLE_Z7_DEBUG)
3345 dnl ===================================================================
3346 dnl  Checks for C compiler,
3347 dnl  The check for the C++ compiler is later on.
3348 dnl ===================================================================
3349 if test "$_os" != "WINNT"; then
3350     GCC_HOME_SET="true"
3351     AC_MSG_CHECKING([gcc home])
3352     if test -z "$with_gcc_home"; then
3353         if test "$enable_icecream" = "yes"; then
3354             if test -d "/usr/lib/icecc/bin"; then
3355                 GCC_HOME="/usr/lib/icecc/"
3356             elif test -d "/usr/libexec/icecc/bin"; then
3357                 GCC_HOME="/usr/libexec/icecc/"
3358             elif test -d "/opt/icecream/bin"; then
3359                 GCC_HOME="/opt/icecream/"
3360             else
3361                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3363             fi
3364         else
3365             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3366             GCC_HOME_SET="false"
3367         fi
3368     else
3369         GCC_HOME="$with_gcc_home"
3370     fi
3371     AC_MSG_RESULT($GCC_HOME)
3372     AC_SUBST(GCC_HOME)
3374     if test "$GCC_HOME_SET" = "true"; then
3375         if test -z "$CC"; then
3376             CC="$GCC_HOME/bin/gcc"
3377             CC_BASE="gcc"
3378         fi
3379         if test -z "$CXX"; then
3380             CXX="$GCC_HOME/bin/g++"
3381             CXX_BASE="g++"
3382         fi
3383     fi
3386 COMPATH=`dirname "$CC"`
3387 if test "$COMPATH" = "."; then
3388     AC_PATH_PROGS(COMPATH, $CC)
3389     dnl double square bracket to get single because of M4 quote...
3390     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3392 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3394 dnl ===================================================================
3395 dnl Java support
3396 dnl ===================================================================
3397 AC_MSG_CHECKING([whether to build with Java support])
3398 if test "$with_java" != "no"; then
3399     if test "$DISABLE_SCRIPTING" = TRUE; then
3400         AC_MSG_RESULT([no, overridden by --disable-scripting])
3401         ENABLE_JAVA=""
3402         with_java=no
3403     else
3404         AC_MSG_RESULT([yes])
3405         ENABLE_JAVA="TRUE"
3406         AC_DEFINE(HAVE_FEATURE_JAVA)
3407     fi
3408 else
3409     AC_MSG_RESULT([no])
3410     ENABLE_JAVA=""
3413 AC_SUBST(ENABLE_JAVA)
3415 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3417 dnl ENABLE_JAVA="" indicate no Java support at all
3419 dnl ===================================================================
3420 dnl Check macOS SDK and compiler
3421 dnl ===================================================================
3423 if test $_os = Darwin; then
3425     # The SDK in the currently selected Xcode should be found.
3427     AC_MSG_CHECKING([what macOS SDK to use])
3428     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3429     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3430     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3431     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3432     # problems that existed in the PPC days with target versions not being respected or random
3433     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3434     # SDK version is enough, no need to do both...
3435     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3436     if test ! -d "$MACOSX_SDK_PATH"; then
3437         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3438     fi
3439     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3440     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3441     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3442     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3443     # 10.10.2 is 101002
3444     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3445     # correct version in case such an old SDK is specified, it will be rejected later anyway
3446     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3447     if test $MACOSX_SDK_VERSION -lt 101400; then
3448         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.14])
3449     fi
3450     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3451         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3452     fi
3453     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3455     AC_MSG_CHECKING([what minimum version of macOS to require])
3456     if test "$with_macosx_version_min_required" = "" ; then
3457         if test "$host_cpu" = x86_64; then
3458             with_macosx_version_min_required="10.14";
3459         else
3460             with_macosx_version_min_required="11.0";
3461         fi
3462     fi
3463     # see same notes about MACOSX_SDK_VERSION above
3464     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3465     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101400; then
3466         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.14])
3467     fi
3468     AC_MSG_RESULT([$with_macosx_version_min_required])
3470     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3471     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3472         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3473     else
3474         AC_MSG_RESULT([yes])
3475     fi
3477     # export this so that "xcrun" invocations later return matching values
3478     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3479     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3480     export DEVELOPER_DIR
3481     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3482     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3484     AC_MSG_CHECKING([whether Xcode is new enough])
3485     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3486     my_xcode_ver2=${my_xcode_ver1#Xcode }
3487     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3488     if test "$my_xcode_ver3" -ge 1205; then
3489         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3490     else
3491         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3492     fi
3494     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3495     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3497     LIBTOOL=/usr/bin/libtool
3498     INSTALL_NAME_TOOL=install_name_tool
3499     if test -z "$save_CC"; then
3500         stdlib=-stdlib=libc++
3502         AC_MSG_CHECKING([what C compiler to use])
3503         CC="`xcrun -find clang`"
3504         CC_BASE=`first_arg_basename "$CC"`
3505         if test "$host_cpu" = x86_64; then
3506             CC+=" -target x86_64-apple-macos"
3507         else
3508             CC+=" -target arm64-apple-macos"
3509         fi
3510         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3511         AC_MSG_RESULT([$CC])
3513         AC_MSG_CHECKING([what C++ compiler to use])
3514         CXX="`xcrun -find clang++`"
3515         CXX_BASE=`first_arg_basename "$CXX"`
3516         if test "$host_cpu" = x86_64; then
3517             CXX+=" -target x86_64-apple-macos"
3518         else
3519             CXX+=" -target arm64-apple-macos"
3520         fi
3521         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3522         AC_MSG_RESULT([$CXX])
3524         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3525         AR=`xcrun -find ar`
3526         NM=`xcrun -find nm`
3527         STRIP=`xcrun -find strip`
3528         LIBTOOL=`xcrun -find libtool`
3529         RANLIB=`xcrun -find ranlib`
3530     fi
3532     AC_MSG_CHECKING([whether to do code signing])
3534     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3535         AC_MSG_RESULT([no])
3536     else
3537         if test "$enable_macosx_code_signing" = yes; then
3538             # By default use the first suitable certificate (?).
3540             # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3541             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3542             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3543             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3544             # "Developer ID Application" one.
3545             identity="Developer ID Application:"
3546         else
3547             identity=$enable_macosx_code_signing
3548         fi
3549         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3550         if test -n "$identity"; then
3551             MACOSX_CODESIGNING_IDENTITY=$identity
3552             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3553             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3554         else
3555             AC_MSG_ERROR([cannot determine identity to use])
3556         fi
3557     fi
3559     AC_MSG_CHECKING([whether to create a Mac App Store package])
3561     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3562         AC_MSG_RESULT([no])
3563     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3564         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3565     else
3566         if test "$enable_macosx_package_signing" = yes; then
3567             # By default use the first suitable certificate.
3568             # It should be a "3rd Party Mac Developer Installer" one
3569             identity="3rd Party Mac Developer Installer:"
3570         else
3571             identity=$enable_macosx_package_signing
3572         fi
3573         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3574         if test -n "$identity"; then
3575             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3576             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3577             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3578         else
3579             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3580         fi
3581     fi
3583     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3584         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3585     fi
3587     AC_MSG_CHECKING([whether to sandbox the application])
3589     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3590         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3591     elif test "$enable_macosx_sandbox" = yes; then
3592         ENABLE_MACOSX_SANDBOX=TRUE
3593         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3594         AC_MSG_RESULT([yes])
3595     else
3596         AC_MSG_RESULT([no])
3597     fi
3599     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3600     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3601     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3603     if test -n "$with_macosx_provisioning_profile" ; then
3604         if test ! -f "$with_macosx_provisioning_profile"; then
3605             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3606         else
3607             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3608             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3609                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3610                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3611                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3612         fi
3613     fi
3615 AC_SUBST(MACOSX_SDK_PATH)
3616 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3617 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3618 AC_SUBST(INSTALL_NAME_TOOL)
3619 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3620 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3621 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3622 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3623 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3624 AC_SUBST(MACOSX_PROVISIONING_INFO)
3625 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3626 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3627 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3629 dnl ===================================================================
3630 dnl Check iOS SDK and compiler
3631 dnl ===================================================================
3633 if test $_os = iOS; then
3634     AC_MSG_CHECKING([what iOS SDK to use])
3635     current_sdk_ver=16.1
3636     older_sdk_vers="16.0 15.6"
3637     if test "$enable_ios_simulator" = "yes"; then
3638         platform=iPhoneSimulator
3639         versionmin=-mios-simulator-version-min=14.5
3640     else
3641         platform=iPhoneOS
3642         versionmin=-miphoneos-version-min=14.5
3643     fi
3644     xcode_developer=`xcode-select -print-path`
3646     for sdkver in $current_sdk_ver $older_sdk_vers; do
3647         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3648         if test -d $t; then
3649             sysroot=$t
3650             break
3651         fi
3652     done
3654     if test -z "$sysroot"; then
3655         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3656     fi
3658     AC_MSG_RESULT($sysroot)
3660     stdlib="-stdlib=libc++"
3662     AC_MSG_CHECKING([what C compiler to use])
3663     CC="`xcrun -find clang`"
3664     CC_BASE=`first_arg_basename "$CC"`
3665     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3666     AC_MSG_RESULT([$CC])
3668     AC_MSG_CHECKING([what C++ compiler to use])
3669     CXX="`xcrun -find clang++`"
3670     CXX_BASE=`first_arg_basename "$CXX"`
3671     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3672     AC_MSG_RESULT([$CXX])
3674     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3675     AR=`xcrun -find ar`
3676     NM=`xcrun -find nm`
3677     STRIP=`xcrun -find strip`
3678     LIBTOOL=`xcrun -find libtool`
3679     RANLIB=`xcrun -find ranlib`
3682 AC_MSG_CHECKING([whether to treat the installation as read-only])
3684 if test $_os = Darwin; then
3685     enable_readonly_installset=yes
3686 elif test "$enable_extensions" != yes; then
3687     enable_readonly_installset=yes
3689 if test "$enable_readonly_installset" = yes; then
3690     AC_MSG_RESULT([yes])
3691     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3692 else
3693     AC_MSG_RESULT([no])
3696 dnl ===================================================================
3697 dnl Structure of install set
3698 dnl ===================================================================
3700 if test $_os = Darwin; then
3701     LIBO_BIN_FOLDER=MacOS
3702     LIBO_ETC_FOLDER=Resources
3703     LIBO_LIBEXEC_FOLDER=MacOS
3704     LIBO_LIB_FOLDER=Frameworks
3705     LIBO_LIB_PYUNO_FOLDER=Resources
3706     LIBO_SHARE_FOLDER=Resources
3707     LIBO_SHARE_HELP_FOLDER=Resources/help
3708     LIBO_SHARE_JAVA_FOLDER=Resources/java
3709     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3710     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3711     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3712     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3713     LIBO_URE_BIN_FOLDER=MacOS
3714     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3715     LIBO_URE_LIB_FOLDER=Frameworks
3716     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3717     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3718 elif test $_os = WINNT; then
3719     LIBO_BIN_FOLDER=program
3720     LIBO_ETC_FOLDER=program
3721     LIBO_LIBEXEC_FOLDER=program
3722     LIBO_LIB_FOLDER=program
3723     LIBO_LIB_PYUNO_FOLDER=program
3724     LIBO_SHARE_FOLDER=share
3725     LIBO_SHARE_HELP_FOLDER=help
3726     LIBO_SHARE_JAVA_FOLDER=program/classes
3727     LIBO_SHARE_PRESETS_FOLDER=presets
3728     LIBO_SHARE_READMES_FOLDER=readmes
3729     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3730     LIBO_SHARE_SHELL_FOLDER=program/shell
3731     LIBO_URE_BIN_FOLDER=program
3732     LIBO_URE_ETC_FOLDER=program
3733     LIBO_URE_LIB_FOLDER=program
3734     LIBO_URE_MISC_FOLDER=program
3735     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3736 else
3737     LIBO_BIN_FOLDER=program
3738     LIBO_ETC_FOLDER=program
3739     LIBO_LIBEXEC_FOLDER=program
3740     LIBO_LIB_FOLDER=program
3741     LIBO_LIB_PYUNO_FOLDER=program
3742     LIBO_SHARE_FOLDER=share
3743     LIBO_SHARE_HELP_FOLDER=help
3744     LIBO_SHARE_JAVA_FOLDER=program/classes
3745     LIBO_SHARE_PRESETS_FOLDER=presets
3746     LIBO_SHARE_READMES_FOLDER=readmes
3747     if test "$enable_fuzzers" != yes; then
3748         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3749     else
3750         LIBO_SHARE_RESOURCE_FOLDER=resource
3751     fi
3752     LIBO_SHARE_SHELL_FOLDER=program/shell
3753     LIBO_URE_BIN_FOLDER=program
3754     LIBO_URE_ETC_FOLDER=program
3755     LIBO_URE_LIB_FOLDER=program
3756     LIBO_URE_MISC_FOLDER=program
3757     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3759 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3760 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3761 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3762 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3763 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3764 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3765 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3766 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3767 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3768 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3769 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3770 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3771 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3772 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3773 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3774 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3776 # Not all of them needed in config_host.mk, add more if need arises
3777 AC_SUBST(LIBO_BIN_FOLDER)
3778 AC_SUBST(LIBO_ETC_FOLDER)
3779 AC_SUBST(LIBO_LIB_FOLDER)
3780 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3781 AC_SUBST(LIBO_SHARE_FOLDER)
3782 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3783 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3784 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3785 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3786 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3787 AC_SUBST(LIBO_URE_BIN_FOLDER)
3788 AC_SUBST(LIBO_URE_ETC_FOLDER)
3789 AC_SUBST(LIBO_URE_LIB_FOLDER)
3790 AC_SUBST(LIBO_URE_MISC_FOLDER)
3791 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3793 dnl ===================================================================
3794 dnl Windows specific tests and stuff
3795 dnl ===================================================================
3797 reg_get_value()
3799     # Return value: $regvalue
3800     unset regvalue
3802     if test "$build_os" = "wsl"; then
3803         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null)
3804         return
3805     fi
3807     local _regentry="/proc/registry${1}/${2}"
3808     if test -f "$_regentry"; then
3809         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3810         # Registry keys read via /proc/registry* are always \0 terminated!
3811         local _regvalue=$(tr -d '\0' < "$_regentry")
3812         if test $? -eq 0; then
3813             regvalue=$_regvalue
3814         fi
3815     fi
3818 # Get a value from the 32-bit side of the Registry
3819 reg_get_value_32()
3821     reg_get_value "32" "$1"
3824 # Get a value from the 64-bit side of the Registry
3825 reg_get_value_64()
3827     reg_get_value "64" "$1"
3830 reg_list_values()
3832     # Return value: $reglist
3833     unset reglist
3835     if test "$build_os" = "wsl"; then
3836         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
3837         return
3838     fi
3840     reglist=$(ls "/proc/registry${1}/${2}")
3843 # List values from the 32-bit side of the Registry
3844 reg_list_values_32()
3846     reg_list_values "32" "$1"
3849 # List values from the 64-bit side of the Registry
3850 reg_list_values_64()
3852     reg_list_values "64" "$1"
3855 case "$host_os" in
3856 cygwin*|wsl*)
3857     COM=MSC
3858     OS=WNT
3859     RTL_OS=Windows
3860     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3861         P_SEP=";"
3862     else
3863         P_SEP=:
3864     fi
3865     case "$host_cpu" in
3866     x86_64)
3867         CPUNAME=X86_64
3868         RTL_ARCH=X86_64
3869         PLATFORMID=windows_x86_64
3870         WINDOWS_X64=1
3871         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3872         WIN_HOST_ARCH="x64"
3873         WIN_MULTI_ARCH="x86"
3874         WIN_HOST_BITS=64
3875         ;;
3876     i*86)
3877         CPUNAME=INTEL
3878         RTL_ARCH=x86
3879         PLATFORMID=windows_x86
3880         WIN_HOST_ARCH="x86"
3881         WIN_HOST_BITS=32
3882         WIN_OTHER_ARCH="x64"
3883         ;;
3884     aarch64)
3885         CPUNAME=AARCH64
3886         RTL_ARCH=AARCH64
3887         PLATFORMID=windows_aarch64
3888         WINDOWS_X64=1
3889         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3890         WIN_HOST_ARCH="arm64"
3891         WIN_HOST_BITS=64
3892         with_ucrt_dir=no
3893         ;;
3894     *)
3895         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3896         ;;
3897     esac
3899     case "$build_cpu" in
3900     x86_64) WIN_BUILD_ARCH="x64" ;;
3901     i*86) WIN_BUILD_ARCH="x86" ;;
3902     aarch64) WIN_BUILD_ARCH="arm64" ;;
3903     *)
3904         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3905         ;;
3906     esac
3908     SCPDEFS="$SCPDEFS -D_MSC_VER"
3909     ;;
3910 esac
3912 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3913 # other-arch won't, but wouldn't break the build (x64 on x86).
3914 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3915     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3919 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
3920     # To allow building Windows multi-arch releases without cross-tooling
3921     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
3922         cross_compiling="yes"
3923     fi
3926 if test "$cross_compiling" = "yes"; then
3927     export CROSS_COMPILING=TRUE
3928     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3929         ENABLE_WASM_STRIP=TRUE
3930     fi
3931     if test "$_os" = "Emscripten"; then
3932         if test "$with_main_module" = "calc"; then
3933             ENABLE_WASM_STRIP_WRITER=TRUE
3934         elif test "$with_main_module" = "writer"; then
3935             ENABLE_WASM_STRIP_CALC=TRUE
3936         fi
3937     fi
3938 else
3939     CROSS_COMPILING=
3940     BUILD_TYPE="$BUILD_TYPE NATIVE"
3942 AC_SUBST(CROSS_COMPILING)
3943 AC_SUBST(ENABLE_WASM_STRIP)
3944 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
3945 AC_SUBST(ENABLE_WASM_STRIP_CALC)
3947 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3948 # NOTE: must _not_ be used for bundled external libraries!
3949 ISYSTEM=
3950 if test "$GCC" = "yes"; then
3951     AC_MSG_CHECKING( for -isystem )
3952     save_CFLAGS=$CFLAGS
3953     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
3954     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3955     CFLAGS=$save_CFLAGS
3956     if test -n "$ISYSTEM"; then
3957         AC_MSG_RESULT(yes)
3958     else
3959         AC_MSG_RESULT(no)
3960     fi
3962 if test -z "$ISYSTEM"; then
3963     # fall back to using -I
3964     ISYSTEM=-I
3966 AC_SUBST(ISYSTEM)
3968 dnl ===================================================================
3969 dnl  Check which Visual Studio compiler is used
3970 dnl ===================================================================
3972 map_vs_year_to_version()
3974     # Return value: $vsversion
3976     unset vsversion
3978     case $1 in
3979     2019)
3980         vsversion=16;;
3981     2022)
3982         vsversion=17;;
3983     2022preview)
3984         vsversion=17.4;;
3985     *)
3986         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3987     esac
3990 vs_versions_to_check()
3992     # Args: $1 (optional) : versions to check, in the order of preference
3993     # Return value: $vsversions
3995     unset vsversions
3997     if test -n "$1"; then
3998         map_vs_year_to_version "$1"
3999         vsversions=$vsversion
4000     else
4001         # Default version is 2019
4002         vsversions="16"
4003     fi
4006 win_get_env_from_vsvars32bat()
4008     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4009     # Also seems to be located in another directory under the same name: vsvars32.bat
4010     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
4011     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
4012     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4013     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4014     local result
4015     if test "$build_os" = "wsl"; then
4016         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4017     else
4018         chmod +x $WRAPPERBATCHFILEPATH
4019         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4020     fi
4021     rm -f $WRAPPERBATCHFILEPATH
4022     printf '%s' "$result"
4025 find_ucrt()
4027     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4028     if test -n "$regvalue"; then
4029         PathFormat "$regvalue"
4030         UCRTSDKDIR=$formatted_path_unix
4031         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4032         UCRTVERSION=$regvalue
4033         # Rest if not exist
4034         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4035           UCRTSDKDIR=
4036         fi
4037     fi
4038     if test -z "$UCRTSDKDIR"; then
4039         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4040         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4041         if test -f "$ide_env_file"; then
4042             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
4043             UCRTSDKDIR=$formatted_path
4044             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
4045             dnl Hack needed at least by tml:
4046             if test "$UCRTVERSION" = 10.0.15063.0 \
4047                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4048                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4049             then
4050                 UCRTVERSION=10.0.14393.0
4051             fi
4052         else
4053           AC_MSG_ERROR([No UCRT found])
4054         fi
4055     fi
4058 find_msvc()
4060     # Find Visual C++
4061     # Args: $1 (optional) : The VS version year
4062     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4064     unset vctest vctoolset vcnumwithdot vcbuildnumber
4066     vs_versions_to_check "$1"
4067     if test "$build_os" = wsl; then
4068         vswhere="$PROGRAMFILESX86"
4069         if test -z "$vswhere"; then
4070             vswhere="c:\\Program Files (x86)"
4071         fi
4072     else
4073         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4074     fi
4075     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4076     PathFormat "$vswhere"
4077     vswhere=$formatted_path_unix
4078     for ver in $vsversions; do
4079         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4080         if test -z "$vswhereoutput"; then
4081             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4082         fi
4083         # Fall back to all MS products (this includes VC++ Build Tools)
4084         if ! test -n "$vswhereoutput"; then
4085             AC_MSG_CHECKING([VC++ Build Tools and similar])
4086             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4087         fi
4088         if test -n "$vswhereoutput"; then
4089             PathFormat "$vswhereoutput"
4090             vctest=$formatted_path_unix
4091             break
4092         fi
4093     done
4095     if test -n "$vctest"; then
4096         vcnumwithdot="$ver"
4097         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4098             vcnumwithdot=$vcnumwithdot.0
4099         fi
4100         case "$vcnumwithdot" in
4101         16.0)
4102             vcyear=2019
4103             vctoolset=v142
4104             ;;
4105         17.0 | 17.4)
4106             vcyear=2022
4107             vctoolset=v143
4108             ;;
4109         esac
4110         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4112     fi
4115 test_cl_exe()
4117     AC_MSG_CHECKING([$1 compiler])
4119     CL_EXE_PATH="$2/cl.exe"
4121     if test ! -f "$CL_EXE_PATH"; then
4122         if test "$1" = "multi-arch"; then
4123             AC_MSG_WARN([no compiler (cl.exe) in $2])
4124             return 1
4125         else
4126             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4127         fi
4128     fi
4130     dnl ===========================================================
4131     dnl  Check for the corresponding mspdb*.dll
4132     dnl ===========================================================
4134     # MSVC 15.0 has libraries from 14.0?
4135     mspdbnum="140"
4137     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4138         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4139     fi
4141     # The compiles has to find its shared libraries
4142     OLD_PATH="$PATH"
4143     TEMP_PATH=`cygpath -d "$2"`
4144     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4146     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4147         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4148     fi
4150     PATH="$OLD_PATH"
4152     AC_MSG_RESULT([$CL_EXE_PATH])
4155 SOLARINC=
4156 MSBUILD_PATH=
4157 DEVENV=
4158 if test "$_os" = "WINNT"; then
4159     AC_MSG_CHECKING([Visual C++])
4160     find_msvc "$with_visual_studio"
4161     if test -z "$vctest"; then
4162         if test -n "$with_visual_studio"; then
4163             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4164         else
4165             AC_MSG_ERROR([no Visual Studio installation found])
4166         fi
4167     fi
4168     AC_MSG_RESULT([])
4170     VC_PRODUCT_DIR="$vctest/VC"
4171     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4173     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4174     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4175         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4176         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4177         if test $? -ne 0; then
4178             WIN_MULTI_ARCH=""
4179             WIN_OTHER_ARCH=""
4180         fi
4181     fi
4183     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4184         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4185         test_cl_exe "build" "$MSVC_BUILD_PATH"
4186     fi
4188     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4189         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4190         test_cl_exe "host" "$MSVC_HOST_PATH"
4191     else
4192         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4193     fi
4195     AC_MSG_CHECKING([for short pathname of VC product directory])
4196     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4197     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4199     UCRTSDKDIR=
4200     UCRTVERSION=
4202     AC_MSG_CHECKING([for UCRT location])
4203     find_ucrt
4204     # find_ucrt errors out if it doesn't find it
4205     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4206     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4207     ucrtincpath_formatted=$formatted_path
4208     # SOLARINC is used for external modules and must be set too.
4209     # And no, it's not sufficient to set SOLARINC only, as configure
4210     # itself doesn't honour it.
4211     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4212     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4213     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4214     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4216     AC_SUBST(UCRTSDKDIR)
4217     AC_SUBST(UCRTVERSION)
4219     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4220     # Find the proper version of MSBuild.exe to use based on the VS version
4221     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4222     if test -z "$regvalue" ; then
4223         if test "$WIN_BUILD_ARCH" != "x64"; then
4224             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4225         else
4226             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4227         fi
4228     fi
4229     if test -d "$regvalue" ; then
4230         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4231         AC_MSG_RESULT([$regvalue])
4232     else
4233         AC_MSG_ERROR([MSBuild.exe location not found])
4234     fi
4236     # Find the version of devenv.exe
4237     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4238     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4239     DEVENV_unix=$(cygpath -u "$DEVENV")
4240     if test ! -e "$DEVENV_unix"; then
4241         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4242     fi
4244     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4245     dnl needed when building CLR code:
4246     if test -z "$MSVC_CXX"; then
4247         # This gives us a posix path with 8.3 filename restrictions
4248         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4249     fi
4251     if test -z "$CC"; then
4252         CC=$MSVC_CXX
4253         CC_BASE=`first_arg_basename "$CC"`
4254     fi
4255     if test -z "$CXX"; then
4256         CXX=$MSVC_CXX
4257         CXX_BASE=`first_arg_basename "$CXX"`
4258     fi
4260     if test -n "$CC"; then
4261         # Remove /cl.exe from CC case insensitive
4262         AC_MSG_NOTICE([found Visual C++ $vcyear])
4264         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4265         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4267         PathFormat "$COMPATH"
4268         COMPATH=`win_short_path_for_make "$formatted_path"`
4270         VCVER=$vcnumwithdot
4271         VCTOOLSET=$vctoolset
4273         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4274         # are always "better", we list them in reverse chronological order.
4276         case "$vcnumwithdot" in
4277         16.0 | 17.0 | 17.4)
4278             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4279             ;;
4280         esac
4282         # The expectation is that --with-windows-sdk should not need to be used
4283         if test -n "$with_windows_sdk"; then
4284             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4285             *" "$with_windows_sdk" "*)
4286                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4287                 ;;
4288             *)
4289                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4290                 ;;
4291             esac
4292         fi
4294         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4295         ac_objext=obj
4296         ac_exeext=exe
4298     else
4299         AC_MSG_ERROR([Visual C++ not found after all, huh])
4300     fi
4302     # ERROR if VS version < 16.5
4303     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4304     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4305         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4306         // between Visual Studio versions and _MSC_VER:
4307         #if _MSC_VER < 1925
4308         #error
4309         #endif
4310     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4312     # WARN if VS version < 16.10
4313     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4314     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4315         #if _MSC_VER < 1929
4316         #error
4317         #endif
4318     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4320     if test $vs2019_recommended_version = yes; then
4321         AC_MSG_RESULT([yes])
4322     else
4323         AC_MSG_WARN([no])
4324         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."
4325     fi
4327     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4328     # version of the Explorer extension (and maybe other small
4329     # bits, too) needed when installing a 32-bit LibreOffice on a
4330     # 64-bit OS. The 64-bit Explorer extension is a feature that
4331     # has been present since long in OOo. Don't confuse it with
4332     # building LibreOffice itself as 64-bit code.
4334     BUILD_X64=
4335     CXX_X64_BINARY=
4337     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4338         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4339         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4340              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4341         then
4342             BUILD_X64=TRUE
4343             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4344             AC_MSG_RESULT([found])
4345         else
4346             AC_MSG_RESULT([not found])
4347             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4348         fi
4349     elif test "$WIN_HOST_ARCH" = "x64"; then
4350         CXX_X64_BINARY=$CXX
4351     fi
4352     AC_SUBST(BUILD_X64)
4354     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4355     AC_SUBST(CXX_X64_BINARY)
4357     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4358     # needed to support TWAIN scan on both 32- and 64-bit systems
4360     case "$WIN_HOST_ARCH" in
4361     x64)
4362         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4363         if test -n "$CXX_X86_BINARY"; then
4364             BUILD_X86=TRUE
4365             AC_MSG_RESULT([preset])
4366         elif test -n "$WIN_MULTI_ARCH"; then
4367             BUILD_X86=TRUE
4368             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4369             AC_MSG_RESULT([found])
4370         else
4371             AC_MSG_RESULT([not found])
4372             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4373         fi
4374         ;;
4375     x86)
4376         BUILD_X86=TRUE
4377         CXX_X86_BINARY=$MSVC_CXX
4378         ;;
4379     esac
4380     AC_SUBST(BUILD_X86)
4381     AC_SUBST(CXX_X86_BINARY)
4383 AC_SUBST(VCVER)
4384 AC_SUBST(VCTOOLSET)
4385 AC_SUBST(DEVENV)
4386 AC_SUBST(MSVC_CXX)
4388 COM_IS_CLANG=
4389 AC_MSG_CHECKING([whether the compiler is actually Clang])
4390 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4391     #ifndef __clang__
4392     you lose
4393     #endif
4394     int foo=42;
4395     ]])],
4396     [AC_MSG_RESULT([yes])
4397      COM_IS_CLANG=TRUE],
4398     [AC_MSG_RESULT([no])])
4399 AC_SUBST(COM_IS_CLANG)
4401 CLANGVER=
4402 if test "$COM_IS_CLANG" = TRUE; then
4403     AC_MSG_CHECKING([whether Clang is new enough])
4404     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4405         #if !defined __apple_build_version__
4406         #error
4407         #endif
4408         ]])],
4409         [my_apple_clang=yes],[my_apple_clang=])
4410     if test "$my_apple_clang" = yes; then
4411         AC_MSG_RESULT([assumed yes (Apple Clang)])
4412     elif test "$_os" = Emscripten; then
4413         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4414     else
4415         if test "$_os" = WINNT; then
4416             dnl In which case, assume clang-cl:
4417             my_args="/EP /TC"
4418         else
4419             my_args="-E -P"
4420         fi
4421         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4422         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4423         CLANGVER=`echo $clang_version \
4424             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4425         if test "$CLANGVER" -ge 80001; then
4426             AC_MSG_RESULT([yes ($clang_version)])
4427         else
4428             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 8.0.1])
4429         fi
4430         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4431         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4432     fi
4435 SHOWINCLUDES_PREFIX=
4436 if test "$_os" = WINNT; then
4437     dnl We need to guess the prefix of the -showIncludes output, it can be
4438     dnl localized
4439     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4440     echo "#include <stdlib.h>" > conftest.c
4441     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4442         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4443     rm -f conftest.c conftest.obj
4444     if test -z "$SHOWINCLUDES_PREFIX"; then
4445         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4446     else
4447         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4448     fi
4450 AC_SUBST(SHOWINCLUDES_PREFIX)
4453 # prefix C with ccache if needed
4455 if test "$CCACHE" != ""; then
4456     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4458     AC_LANG_PUSH([C])
4459     save_CFLAGS=$CFLAGS
4460     CFLAGS="$CFLAGS --ccache-skip -O2"
4461     # msvc does not fail on unknown options, check stdout
4462     if test "$COM" = MSC; then
4463         CFLAGS="$CFLAGS -nologo"
4464     fi
4465     save_ac_c_werror_flag=$ac_c_werror_flag
4466     ac_c_werror_flag=yes
4467     dnl an empty program will do, we're checking the compiler flags
4468     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4469                       [use_ccache=yes], [use_ccache=no])
4470     CFLAGS=$save_CFLAGS
4471     ac_c_werror_flag=$save_ac_c_werror_flag
4472     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4473         AC_MSG_RESULT([yes])
4474     else
4475         CC="$CCACHE $CC"
4476         CC_BASE="ccache $CC_BASE"
4477         AC_MSG_RESULT([no])
4478     fi
4479     AC_LANG_POP([C])
4482 # ===================================================================
4483 # check various GCC options that Clang does not support now but maybe
4484 # will somewhen in the future, check them even for GCC, so that the
4485 # flags are set
4486 # ===================================================================
4488 HAVE_GCC_GGDB2=
4489 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4490     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4491     save_CFLAGS=$CFLAGS
4492     CFLAGS="$CFLAGS -Werror -ggdb2"
4493     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4494     CFLAGS=$save_CFLAGS
4495     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4496         AC_MSG_RESULT([yes])
4497     else
4498         AC_MSG_RESULT([no])
4499     fi
4501     if test "$host_cpu" = "m68k"; then
4502         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4503         save_CFLAGS=$CFLAGS
4504         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4505         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4506         CFLAGS=$save_CFLAGS
4507         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4508             AC_MSG_RESULT([yes])
4509         else
4510             AC_MSG_ERROR([no])
4511         fi
4512     fi
4514 AC_SUBST(HAVE_GCC_GGDB2)
4516 dnl ===================================================================
4517 dnl  Test the gcc version
4518 dnl ===================================================================
4519 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4520     AC_MSG_CHECKING([the GCC version])
4521     _gcc_version=`$CC -dumpfullversion`
4522     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4523         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4524     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4526     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4528     if test "$gcc_full_version" -lt 70000; then
4529         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4530     fi
4531 else
4532     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4533     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4534     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4535     # (which reports itself as GCC 4.2.1).
4536     GCC_VERSION=
4538 AC_SUBST(GCC_VERSION)
4540 dnl Set the ENABLE_DBGUTIL variable
4541 dnl ===================================================================
4542 AC_MSG_CHECKING([whether to build with additional debug utilities])
4543 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4544     ENABLE_DBGUTIL="TRUE"
4545     # this is an extra var so it can have different default on different MSVC
4546     # versions (in case there are version specific problems with it)
4547     MSVC_USE_DEBUG_RUNTIME="TRUE"
4549     AC_MSG_RESULT([yes])
4550     # cppunit and graphite expose STL in public headers
4551     if test "$with_system_cppunit" = "yes"; then
4552         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4553     else
4554         with_system_cppunit=no
4555     fi
4556     if test "$with_system_graphite" = "yes"; then
4557         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4558     else
4559         with_system_graphite=no
4560     fi
4561     if test "$with_system_orcus" = "yes"; then
4562         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4563     else
4564         with_system_orcus=no
4565     fi
4566     if test "$with_system_libcmis" = "yes"; then
4567         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4568     else
4569         with_system_libcmis=no
4570     fi
4571     if test "$with_system_hunspell" = "yes"; then
4572         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4573     else
4574         with_system_hunspell=no
4575     fi
4576     if test "$with_system_gpgmepp" = "yes"; then
4577         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4578     else
4579         with_system_gpgmepp=no
4580     fi
4581     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4582     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4583     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4584     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4585     # of those two is using the system variant:
4586     if test "$with_system_libnumbertext" = "yes"; then
4587         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4588     else
4589         with_system_libnumbertext=no
4590     fi
4591     if test "$with_system_libwps" = "yes"; then
4592         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4593     else
4594         with_system_libwps=no
4595     fi
4596 else
4597     ENABLE_DBGUTIL=""
4598     MSVC_USE_DEBUG_RUNTIME=""
4599     AC_MSG_RESULT([no])
4601 AC_SUBST(ENABLE_DBGUTIL)
4602 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4604 dnl Set the ENABLE_DEBUG variable.
4605 dnl ===================================================================
4606 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4607     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4609 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4610     if test -z "$libo_fuzzed_enable_debug"; then
4611         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4612     else
4613         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4614         enable_debug=yes
4615     fi
4618 AC_MSG_CHECKING([whether to do a debug build])
4619 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4620     ENABLE_DEBUG="TRUE"
4621     if test -n "$ENABLE_DBGUTIL" ; then
4622         AC_MSG_RESULT([yes (dbgutil)])
4623     else
4624         AC_MSG_RESULT([yes])
4625     fi
4626 else
4627     ENABLE_DEBUG=""
4628     AC_MSG_RESULT([no])
4630 AC_SUBST(ENABLE_DEBUG)
4632 dnl ===================================================================
4633 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4634 dnl This is done only after compiler checks (need to know if Clang is
4635 dnl used, for different defaults) and after checking if a debug build
4636 dnl is wanted (non-debug builds get the default linker if not explicitly
4637 dnl specified otherwise).
4638 dnl All checks for linker features/options should come after this.
4639 dnl ===================================================================
4640 check_use_ld()
4642     use_ld=-fuse-ld=${1%%:*}
4643     use_ld_path=${1#*:}
4644     if test "$use_ld_path" != "$1"; then
4645         if test "$COM_IS_CLANG" = TRUE; then
4646             if test "$CLANGVER" -ge 120000; then
4647                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4648             else
4649                 use_ld="-fuse-ld=${use_ld_path}"
4650             fi
4651         else
4652             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4653             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4654             # pickup the alternative linker, when called by libtool for linking.
4655             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4656             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4657         fi
4658     fi
4659     use_ld_fail_if_error=$2
4660     use_ld_ok=
4661     AC_MSG_CHECKING([for $use_ld linker support])
4662     use_ld_ldflags_save="$LDFLAGS"
4663     LDFLAGS="$LDFLAGS $use_ld"
4664     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4665 #include <stdio.h>
4666         ],[
4667 printf ("hello world\n");
4668         ])], USE_LD=$use_ld, [])
4669     if test -n "$USE_LD"; then
4670         AC_MSG_RESULT( yes )
4671         use_ld_ok=yes
4672     else
4673         if test -n "$use_ld_fail_if_error"; then
4674             AC_MSG_ERROR( no )
4675         else
4676             AC_MSG_RESULT( no )
4677         fi
4678     fi
4679     if test -n "$use_ld_ok"; then
4680         dnl keep the value of LDFLAGS
4681         return 0
4682     fi
4683     LDFLAGS="$use_ld_ldflags_save"
4684     return 1
4686 USE_LD=
4687 if test "$enable_ld" != "no"; then
4688     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4689         if test -n "$enable_ld"; then
4690             check_use_ld "$enable_ld" fail_if_error
4691         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4692             dnl non-debug builds default to the default linker
4693             true
4694         elif test -n "$COM_IS_CLANG"; then
4695             check_use_ld lld
4696             if test $? -ne 0; then
4697                 check_use_ld gold
4698                 if test $? -ne 0; then
4699                     check_use_ld mold
4700                 fi
4701             fi
4702         else
4703             # For gcc first try gold, new versions also support lld/mold.
4704             check_use_ld gold
4705             if test $? -ne 0; then
4706                 check_use_ld lld
4707                 if test $? -ne 0; then
4708                     check_use_ld mold
4709                 fi
4710             fi
4711         fi
4712         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4713         rm conftest.out
4714         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4715         if test -z "$ld_used"; then
4716             ld_used="unknown"
4717         fi
4718         AC_MSG_CHECKING([for linker that is used])
4719         AC_MSG_RESULT([$ld_used])
4720         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4721             if echo "$ld_used" | grep -q "^GNU ld"; then
4722                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4723                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4724             fi
4725         fi
4726     else
4727         if test "$enable_ld" = "yes"; then
4728             AC_MSG_ERROR([--enable-ld not supported])
4729         fi
4730     fi
4732 AC_SUBST(USE_LD)
4733 AC_SUBST(LD)
4735 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4736 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4737     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4738     bsymbolic_functions_ldflags_save=$LDFLAGS
4739     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4740     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4741 #include <stdio.h>
4742         ],[
4743 printf ("hello world\n");
4744         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4745     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4746         AC_MSG_RESULT( found )
4747     else
4748         AC_MSG_RESULT( not found )
4749     fi
4750     LDFLAGS=$bsymbolic_functions_ldflags_save
4752 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4754 LD_GC_SECTIONS=
4755 if test "$GCC" = "yes"; then
4756     for flag in "--gc-sections" "-dead_strip"; do
4757         AC_MSG_CHECKING([for $flag linker support])
4758         ldflags_save=$LDFLAGS
4759         LDFLAGS="$LDFLAGS -Wl,$flag"
4760         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4761 #include <stdio.h>
4762             ],[
4763 printf ("hello world\n");
4764             ])],[
4765             LD_GC_SECTIONS="-Wl,$flag"
4766             AC_MSG_RESULT( found )
4767             ], [
4768             AC_MSG_RESULT( not found )
4769             ])
4770         LDFLAGS=$ldflags_save
4771         if test -n "$LD_GC_SECTIONS"; then
4772             break
4773         fi
4774     done
4776 AC_SUBST(LD_GC_SECTIONS)
4778 HAVE_EXTERNAL_DWARF=
4779 if test "$enable_split_debug" != no; then
4780     use_split_debug=
4781     if test -n "$ENABLE_LTO"; then
4782         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4783     elif test "$enable_split_debug" = yes; then
4784         use_split_debug=1
4785     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4786     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4787         use_split_debug=1
4788     fi
4789     if test -n "$use_split_debug"; then
4790         if test "$_os" = "Emscripten"; then
4791             TEST_CC_FLAG=-gseparate-dwarf
4792         else
4793             TEST_CC_FLAG=-gsplit-dwarf
4794         fi
4795         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4796         save_CFLAGS=$CFLAGS
4797         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4798         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4799         CFLAGS=$save_CFLAGS
4800         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4801             AC_MSG_RESULT([yes])
4802         else
4803             if test "$enable_split_debug" = yes; then
4804                 AC_MSG_ERROR([no])
4805             else
4806                 AC_MSG_RESULT([no])
4807             fi
4808         fi
4809     fi
4810     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4811         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4812         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4813     fi
4815 AC_SUBST(HAVE_EXTERNAL_DWARF)
4817 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4818 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4819 save_CFLAGS=$CFLAGS
4820 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4821 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4822 CFLAGS=$save_CFLAGS
4823 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4824     AC_MSG_RESULT([yes])
4825 else
4826     AC_MSG_RESULT([no])
4828 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4830 ENABLE_GDB_INDEX=
4831 if test "$enable_gdb_index" != "no"; then
4832     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4833     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4834         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4835         save_CFLAGS=$CFLAGS
4836         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
4837         have_ggnu_pubnames=
4838         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4839         if test "$have_ggnu_pubnames" != "TRUE"; then
4840             if test "$enable_gdb_index" = "yes"; then
4841                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4842             else
4843                 AC_MSG_RESULT( no )
4844             fi
4845         else
4846             AC_MSG_RESULT( yes )
4847             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4848             ldflags_save=$LDFLAGS
4849             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4850             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4851 #include <stdio.h>
4852                 ],[
4853 printf ("hello world\n");
4854                 ])], ENABLE_GDB_INDEX=TRUE, [])
4855             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4856                 AC_MSG_RESULT( yes )
4857             else
4858                 if test "$enable_gdb_index" = "yes"; then
4859                     AC_MSG_ERROR( no )
4860                 else
4861                     AC_MSG_RESULT( no )
4862                 fi
4863             fi
4864             LDFLAGS=$ldflags_save
4865         fi
4866         CFLAGS=$save_CFLAGS
4867         fi
4868     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4869         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4870         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4871     fi
4873 AC_SUBST(ENABLE_GDB_INDEX)
4875 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4876     enable_sal_log=yes
4878 if test "$enable_sal_log" = yes; then
4879     ENABLE_SAL_LOG=TRUE
4881 AC_SUBST(ENABLE_SAL_LOG)
4883 dnl Check for enable symbols option
4884 dnl ===================================================================
4885 AC_MSG_CHECKING([whether to generate debug information])
4886 if test -z "$enable_symbols"; then
4887     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4888         enable_symbols=yes
4889     else
4890         enable_symbols=no
4891     fi
4893 if test "$enable_symbols" = yes; then
4894     ENABLE_SYMBOLS_FOR=all
4895     AC_MSG_RESULT([yes])
4896 elif test "$enable_symbols" = no; then
4897     ENABLE_SYMBOLS_FOR=
4898     AC_MSG_RESULT([no])
4899 else
4900     # Selective debuginfo.
4901     ENABLE_SYMBOLS_FOR="$enable_symbols"
4902     AC_MSG_RESULT([for "$enable_symbols"])
4904 AC_SUBST(ENABLE_SYMBOLS_FOR)
4906 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4907     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4908     AC_MSG_CHECKING([whether enough memory is available for linking])
4909     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4910     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4911     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4912         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4913     else
4914         AC_MSG_RESULT([yes])
4915     fi
4918 ENABLE_OPTIMIZED=
4919 ENABLE_OPTIMIZED_DEBUG=
4920 AC_MSG_CHECKING([whether to compile with optimization flags])
4921 if test -z "$enable_optimized"; then
4922     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4923         enable_optimized=no
4924     else
4925         enable_optimized=yes
4926     fi
4928 if test "$enable_optimized" = yes; then
4929     ENABLE_OPTIMIZED=TRUE
4930     AC_MSG_RESULT([yes])
4931 elif test "$enable_optimized" = debug; then
4932     ENABLE_OPTIMIZED_DEBUG=TRUE
4933     AC_MSG_RESULT([yes (debug)])
4934     HAVE_GCC_OG=
4935     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4936         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4937         save_CFLAGS=$CFLAGS
4938         CFLAGS="$CFLAGS -Werror -Og"
4939         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4940         CFLAGS=$save_CFLAGS
4941         if test "$HAVE_GCC_OG" = "TRUE"; then
4942             AC_MSG_RESULT([yes])
4943         else
4944             AC_MSG_RESULT([no])
4945         fi
4946     fi
4947     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4948         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4949     fi
4950 else
4951     AC_MSG_RESULT([no])
4953 AC_SUBST(ENABLE_OPTIMIZED)
4954 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4957 # determine CPUNAME, OS, ...
4959 case "$host_os" in
4961 aix*)
4962     COM=GCC
4963     CPUNAME=POWERPC
4964     OS=AIX
4965     RTL_OS=AIX
4966     RTL_ARCH=PowerPC
4967     PLATFORMID=aix_powerpc
4968     P_SEP=:
4969     ;;
4971 cygwin*|wsl*)
4972     # Already handled
4973     ;;
4975 darwin*)
4976     COM=GCC
4977     OS=MACOSX
4978     RTL_OS=MacOSX
4979     P_SEP=:
4981     case "$host_cpu" in
4982     aarch64|arm64)
4983         if test "$enable_ios_simulator" = "yes"; then
4984             OS=iOS
4985         else
4986             CPUNAME=AARCH64
4987             RTL_ARCH=AARCH64
4988             PLATFORMID=macosx_aarch64
4989         fi
4990         ;;
4991     x86_64)
4992         if test "$enable_ios_simulator" = "yes"; then
4993             OS=iOS
4994         fi
4995         CPUNAME=X86_64
4996         RTL_ARCH=X86_64
4997         PLATFORMID=macosx_x86_64
4998         ;;
4999     *)
5000         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5001         ;;
5002     esac
5003     ;;
5005 ios*)
5006     COM=GCC
5007     OS=iOS
5008     RTL_OS=iOS
5009     P_SEP=:
5011     case "$host_cpu" in
5012     aarch64|arm64)
5013         if test "$enable_ios_simulator" = "yes"; then
5014             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5015         fi
5016         ;;
5017     *)
5018         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5019         ;;
5020     esac
5021     CPUNAME=AARCH64
5022     RTL_ARCH=AARCH64
5023     PLATFORMID=ios_arm64
5024     ;;
5026 dragonfly*)
5027     COM=GCC
5028     OS=DRAGONFLY
5029     RTL_OS=DragonFly
5030     P_SEP=:
5032     case "$host_cpu" in
5033     i*86)
5034         CPUNAME=INTEL
5035         RTL_ARCH=x86
5036         PLATFORMID=dragonfly_x86
5037         ;;
5038     x86_64)
5039         CPUNAME=X86_64
5040         RTL_ARCH=X86_64
5041         PLATFORMID=dragonfly_x86_64
5042         ;;
5043     *)
5044         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5045         ;;
5046     esac
5047     ;;
5049 freebsd*)
5050     COM=GCC
5051     RTL_OS=FreeBSD
5052     OS=FREEBSD
5053     P_SEP=:
5055     case "$host_cpu" in
5056     aarch64)
5057         CPUNAME=AARCH64
5058         PLATFORMID=freebsd_aarch64
5059         RTL_ARCH=AARCH64
5060         ;;
5061     i*86)
5062         CPUNAME=INTEL
5063         RTL_ARCH=x86
5064         PLATFORMID=freebsd_x86
5065         ;;
5066     x86_64|amd64)
5067         CPUNAME=X86_64
5068         RTL_ARCH=X86_64
5069         PLATFORMID=freebsd_x86_64
5070         ;;
5071     powerpc64)
5072         CPUNAME=POWERPC64
5073         RTL_ARCH=PowerPC_64
5074         PLATFORMID=freebsd_powerpc64
5075         ;;
5076     powerpc|powerpcspe)
5077         CPUNAME=POWERPC
5078         RTL_ARCH=PowerPC
5079         PLATFORMID=freebsd_powerpc
5080         ;;
5081     *)
5082         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5083         ;;
5084     esac
5085     ;;
5087 haiku*)
5088     COM=GCC
5089     GUIBASE=haiku
5090     RTL_OS=Haiku
5091     OS=HAIKU
5092     P_SEP=:
5094     case "$host_cpu" in
5095     i*86)
5096         CPUNAME=INTEL
5097         RTL_ARCH=x86
5098         PLATFORMID=haiku_x86
5099         ;;
5100     x86_64|amd64)
5101         CPUNAME=X86_64
5102         RTL_ARCH=X86_64
5103         PLATFORMID=haiku_x86_64
5104         ;;
5105     *)
5106         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5107         ;;
5108     esac
5109     ;;
5111 kfreebsd*)
5112     COM=GCC
5113     OS=LINUX
5114     RTL_OS=kFreeBSD
5115     P_SEP=:
5117     case "$host_cpu" in
5119     i*86)
5120         CPUNAME=INTEL
5121         RTL_ARCH=x86
5122         PLATFORMID=kfreebsd_x86
5123         ;;
5124     x86_64)
5125         CPUNAME=X86_64
5126         RTL_ARCH=X86_64
5127         PLATFORMID=kfreebsd_x86_64
5128         ;;
5129     *)
5130         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5131         ;;
5132     esac
5133     ;;
5135 linux-gnu*|linux-musl*)
5136     COM=GCC
5137     OS=LINUX
5138     RTL_OS=Linux
5139     P_SEP=:
5141     case "$host_cpu" in
5143     aarch64)
5144         CPUNAME=AARCH64
5145         PLATFORMID=linux_aarch64
5146         RTL_ARCH=AARCH64
5147         EPM_FLAGS="-a arm64"
5148         ;;
5149     alpha)
5150         CPUNAME=AXP
5151         RTL_ARCH=ALPHA
5152         PLATFORMID=linux_alpha
5153         ;;
5154     arm*)
5155         CPUNAME=ARM
5156         EPM_FLAGS="-a arm"
5157         RTL_ARCH=ARM_EABI
5158         PLATFORMID=linux_arm_eabi
5159         case "$host_cpu" in
5160         arm*-linux)
5161             RTL_ARCH=ARM_OABI
5162             PLATFORMID=linux_arm_oabi
5163             ;;
5164         esac
5165         ;;
5166     hppa)
5167         CPUNAME=HPPA
5168         RTL_ARCH=HPPA
5169         EPM_FLAGS="-a hppa"
5170         PLATFORMID=linux_hppa
5171         ;;
5172     i*86)
5173         CPUNAME=INTEL
5174         RTL_ARCH=x86
5175         PLATFORMID=linux_x86
5176         ;;
5177     ia64)
5178         CPUNAME=IA64
5179         RTL_ARCH=IA64
5180         PLATFORMID=linux_ia64
5181         ;;
5182     mips)
5183         CPUNAME=MIPS
5184         RTL_ARCH=MIPS_EB
5185         EPM_FLAGS="-a mips"
5186         PLATFORMID=linux_mips_eb
5187         ;;
5188     mips64)
5189         CPUNAME=MIPS64
5190         RTL_ARCH=MIPS64_EB
5191         EPM_FLAGS="-a mips64"
5192         PLATFORMID=linux_mips64_eb
5193         ;;
5194     mips64el)
5195         CPUNAME=MIPS64
5196         RTL_ARCH=MIPS64_EL
5197         EPM_FLAGS="-a mips64el"
5198         PLATFORMID=linux_mips64_el
5199         ;;
5200     mipsel)
5201         CPUNAME=MIPS
5202         RTL_ARCH=MIPS_EL
5203         EPM_FLAGS="-a mipsel"
5204         PLATFORMID=linux_mips_el
5205         ;;
5206     riscv64)
5207         CPUNAME=RISCV64
5208         RTL_ARCH=RISCV64
5209         EPM_FLAGS="-a riscv64"
5210         PLATFORMID=linux_riscv64
5211         ;;
5212     m68k)
5213         CPUNAME=M68K
5214         RTL_ARCH=M68K
5215         PLATFORMID=linux_m68k
5216         ;;
5217     powerpc)
5218         CPUNAME=POWERPC
5219         RTL_ARCH=PowerPC
5220         PLATFORMID=linux_powerpc
5221         ;;
5222     powerpc64)
5223         CPUNAME=POWERPC64
5224         RTL_ARCH=PowerPC_64
5225         PLATFORMID=linux_powerpc64
5226         ;;
5227     powerpc64le)
5228         CPUNAME=POWERPC64
5229         RTL_ARCH=PowerPC_64_LE
5230         PLATFORMID=linux_powerpc64_le
5231         ;;
5232     sparc)
5233         CPUNAME=SPARC
5234         RTL_ARCH=SPARC
5235         PLATFORMID=linux_sparc
5236         ;;
5237     sparc64)
5238         CPUNAME=SPARC64
5239         RTL_ARCH=SPARC64
5240         PLATFORMID=linux_sparc64
5241         ;;
5242     s390)
5243         CPUNAME=S390
5244         RTL_ARCH=S390
5245         PLATFORMID=linux_s390
5246         ;;
5247     s390x)
5248         CPUNAME=S390X
5249         RTL_ARCH=S390x
5250         PLATFORMID=linux_s390x
5251         ;;
5252     x86_64)
5253         CPUNAME=X86_64
5254         RTL_ARCH=X86_64
5255         PLATFORMID=linux_x86_64
5256         ;;
5257     loongarch64)
5258         CPUNAME=LOONGARCH64
5259         RTL_ARCH=LOONGARCH64
5260         PLATFORMID=linux_loongarch64
5261         ;;
5262     *)
5263         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5264         ;;
5265     esac
5266     ;;
5268 linux-android*)
5269     COM=GCC
5270     OS=ANDROID
5271     RTL_OS=Android
5272     P_SEP=:
5274     case "$host_cpu" in
5276     arm|armel)
5277         CPUNAME=ARM
5278         RTL_ARCH=ARM_EABI
5279         PLATFORMID=android_arm_eabi
5280         ;;
5281     aarch64)
5282         CPUNAME=AARCH64
5283         RTL_ARCH=AARCH64
5284         PLATFORMID=android_aarch64
5285         ;;
5286     i*86)
5287         CPUNAME=INTEL
5288         RTL_ARCH=x86
5289         PLATFORMID=android_x86
5290         ;;
5291     x86_64)
5292         CPUNAME=X86_64
5293         RTL_ARCH=X86_64
5294         PLATFORMID=android_x86_64
5295         ;;
5296     *)
5297         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5298         ;;
5299     esac
5300     ;;
5302 *netbsd*)
5303     COM=GCC
5304     OS=NETBSD
5305     RTL_OS=NetBSD
5306     P_SEP=:
5308     case "$host_cpu" in
5309     i*86)
5310         CPUNAME=INTEL
5311         RTL_ARCH=x86
5312         PLATFORMID=netbsd_x86
5313         ;;
5314     powerpc)
5315         CPUNAME=POWERPC
5316         RTL_ARCH=PowerPC
5317         PLATFORMID=netbsd_powerpc
5318         ;;
5319     sparc)
5320         CPUNAME=SPARC
5321         RTL_ARCH=SPARC
5322         PLATFORMID=netbsd_sparc
5323         ;;
5324     x86_64)
5325         CPUNAME=X86_64
5326         RTL_ARCH=X86_64
5327         PLATFORMID=netbsd_x86_64
5328         ;;
5329     *)
5330         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5331         ;;
5332     esac
5333     ;;
5335 openbsd*)
5336     COM=GCC
5337     OS=OPENBSD
5338     RTL_OS=OpenBSD
5339     P_SEP=:
5341     case "$host_cpu" in
5342     i*86)
5343         CPUNAME=INTEL
5344         RTL_ARCH=x86
5345         PLATFORMID=openbsd_x86
5346         ;;
5347     x86_64)
5348         CPUNAME=X86_64
5349         RTL_ARCH=X86_64
5350         PLATFORMID=openbsd_x86_64
5351         ;;
5352     *)
5353         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5354         ;;
5355     esac
5356     SOLARINC="$SOLARINC -I/usr/local/include"
5357     ;;
5359 solaris*)
5360     COM=GCC
5361     OS=SOLARIS
5362     RTL_OS=Solaris
5363     P_SEP=:
5365     case "$host_cpu" in
5366     i*86)
5367         CPUNAME=INTEL
5368         RTL_ARCH=x86
5369         PLATFORMID=solaris_x86
5370         ;;
5371     sparc)
5372         CPUNAME=SPARC
5373         RTL_ARCH=SPARC
5374         PLATFORMID=solaris_sparc
5375         ;;
5376     sparc64)
5377         CPUNAME=SPARC64
5378         RTL_ARCH=SPARC64
5379         PLATFORMID=solaris_sparc64
5380         ;;
5381     *)
5382         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5383         ;;
5384     esac
5385     SOLARINC="$SOLARINC -I/usr/local/include"
5386     ;;
5388 emscripten*)
5389     COM=GCC
5390     OS=EMSCRIPTEN
5391     RTL_OS=Emscripten
5392     P_SEP=:
5394     case "$host_cpu" in
5395     wasm32|wasm64)
5396         ;;
5397     *)
5398         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5399         ;;
5400     esac
5401     CPUNAME=INTEL
5402     RTL_ARCH=x86
5403     PLATFORMID=linux_x86
5404     ;;
5407     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5408     ;;
5409 esac
5411 DISABLE_GUI=""
5412 if test "$enable_gui" = "no"; then
5413     if test "$using_x11" != yes; then
5414         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5415     fi
5416     USING_X11=
5417     DISABLE_GUI=TRUE
5418     test_epoxy=no
5419 else
5420     AC_DEFINE(HAVE_FEATURE_UI)
5422 AC_SUBST(DISABLE_GUI)
5424 if test "$with_x" = "no"; then
5425     USING_X11=
5428 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5429     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5432 if test "$using_x11" = yes; then
5433     if test "$USING_X11" = TRUE; then
5434         AC_DEFINE(USING_X11)
5435     else
5436         disable_x11_tests
5437         if test "$DISABLE_DYNLOADING" = TRUE; then
5438             test_qt5=yes
5439         fi
5440     fi
5441 else
5442     if test "$USING_X11" = TRUE; then
5443         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5444     fi
5447 WORKDIR="${BUILDDIR}/workdir"
5448 INSTDIR="${BUILDDIR}/instdir"
5449 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5450 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5451 AC_SUBST(COM)
5452 AC_SUBST(CPUNAME)
5453 AC_SUBST(RTL_OS)
5454 AC_SUBST(RTL_ARCH)
5455 AC_SUBST(EPM_FLAGS)
5456 AC_SUBST(USING_X11)
5457 AC_SUBST([INSTDIR])
5458 AC_SUBST([INSTROOT])
5459 AC_SUBST([INSTROOTBASE])
5460 AC_SUBST(OS)
5461 AC_SUBST(P_SEP)
5462 AC_SUBST(WORKDIR)
5463 AC_SUBST(PLATFORMID)
5464 AC_SUBST(WINDOWS_X64)
5465 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5466 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5468 if test "$OS" = WNT -a "$COM" = MSC; then
5469     case "$CPUNAME" in
5470     INTEL) CPPU_ENV=msci ;;
5471     X86_64) CPPU_ENV=mscx ;;
5472     AARCH64) CPPU_ENV=msca ;;
5473     *)
5474         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5475         ;;
5476     esac
5477 else
5478     CPPU_ENV=gcc3
5480 AC_SUBST(CPPU_ENV)
5482 dnl ===================================================================
5483 dnl Test which package format to use
5484 dnl ===================================================================
5485 AC_MSG_CHECKING([which package format to use])
5486 if test -n "$with_package_format" -a "$with_package_format" != no; then
5487     for i in $with_package_format; do
5488         case "$i" in
5489         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5490             ;;
5491         *)
5492             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5493 aix - AIX software distribution
5494 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5495 deb - Debian software distribution
5496 pkg - Solaris software distribution
5497 rpm - RedHat software distribution
5499 LibreOffice additionally supports:
5500 archive - .tar.gz or .zip
5501 dmg - macOS .dmg
5502 installed - installation tree
5503 msi - Windows .msi
5504         ])
5505             ;;
5506         esac
5507     done
5508     # fakeroot is needed to ensure correct file ownerships/permissions
5509     # inside deb packages and tar archives created on Linux and Solaris.
5510     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5511         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5512         if test "$FAKEROOT" = "no"; then
5513             AC_MSG_ERROR(
5514                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5515         fi
5516     fi
5517     PKGFORMAT="$with_package_format"
5518     AC_MSG_RESULT([$PKGFORMAT])
5519 else
5520     PKGFORMAT=
5521     AC_MSG_RESULT([none])
5523 AC_SUBST(PKGFORMAT)
5525 dnl ===================================================================
5526 dnl handle help related options
5528 dnl If you change help related options, please update README.help
5529 dnl ===================================================================
5531 ENABLE_HTMLHELP=
5532 HELP_OMINDEX_PAGE=
5533 HELP_ONLINE=
5534 WITH_HELPPACKS=
5536 AC_MSG_CHECKING([which help to build])
5537 if test -n "$with_help" -a "$with_help" != "no"; then
5538     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5539     BUILD_TYPE="$BUILD_TYPE HELP"
5540     case "$with_help" in
5541     "html")
5542         ENABLE_HTMLHELP=TRUE
5543         WITH_HELPPACKS=TRUE
5544         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5545         AC_MSG_RESULT([HTML (local)])
5546         ;;
5547     "online")
5548         ENABLE_HTMLHELP=TRUE
5549         HELP_ONLINE=TRUE
5550         AC_MSG_RESULT([HTML (online)])
5551         ;;
5552     yes)
5553         WITH_HELPPACKS=TRUE
5554         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5555         AC_MSG_RESULT([XML (local)])
5556         ;;
5557     *)
5558         AC_MSG_ERROR([Unknown --with-help=$with_help])
5559         ;;
5560     esac
5561 else
5562     AC_MSG_RESULT([no])
5565 AC_MSG_CHECKING([if we need to build the help index tooling])
5566 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5567     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5568     test_clucene=yes
5569     AC_MSG_RESULT([yes])
5570 else
5571     AC_MSG_RESULT([no])
5574 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5575 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5576     if test "$HELP_ONLINE" != TRUE; then
5577         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5578     fi
5579     case "$with_omindex" in
5580     "server")
5581         HELP_OMINDEX_PAGE=TRUE
5582         AC_MSG_RESULT([SERVER])
5583         ;;
5584     "noxap")
5585         AC_MSG_RESULT([NOXAP])
5586         ;;
5587     *)
5588         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5589         ;;
5590     esac
5591 else
5592     AC_MSG_RESULT([no])
5595 AC_MSG_CHECKING([whether to include the XML-help support])
5596 if test "$enable_xmlhelp" = yes; then
5597     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5598     test_clucene=yes
5599     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5600     AC_MSG_RESULT([yes])
5601 else
5602     if test "$with_help" = yes; then
5603         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5604     fi
5605     AC_MSG_RESULT([no])
5608 dnl Test whether to integrate helppacks into the product's installer
5609 AC_MSG_CHECKING([for helppack integration])
5610 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5611     AC_MSG_RESULT([no integration])
5612 else
5613     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5614     AC_MSG_RESULT([integration])
5617 AC_SUBST([ENABLE_HTMLHELP])
5618 AC_SUBST([HELP_OMINDEX_PAGE])
5619 AC_SUBST([HELP_ONLINE])
5620 # WITH_HELPPACKS is used only in configure
5622 dnl ===================================================================
5623 dnl Set up a different compiler to produce tools to run on the build
5624 dnl machine when doing cross-compilation
5625 dnl ===================================================================
5627 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5628 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5629 if test "$cross_compiling" = "yes"; then
5630     AC_MSG_CHECKING([for BUILD platform configuration])
5631     echo
5632     rm -rf CONF-FOR-BUILD config_build.mk
5633     mkdir CONF-FOR-BUILD
5634     # Here must be listed all files needed when running the configure script. In particular, also
5635     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5636     # keep them in the same order as there.
5637     (cd $SRC_ROOT && tar cf - \
5638         config.guess \
5639         bin/get_config_variables \
5640         solenv/bin/getcompver.awk \
5641         solenv/inc/langlist.mk \
5642         download.lst \
5643         config_host.mk.in \
5644         config_host_lang.mk.in \
5645         Makefile.in \
5646         lo.xcent.in \
5647         bin/bffvalidator.sh.in \
5648         bin/odfvalidator.sh.in \
5649         bin/officeotron.sh.in \
5650         hardened_runtime.xcent.in \
5651         instsetoo_native/util/openoffice.lst.in \
5652         config_host/*.in \
5653         sysui/desktop/macosx/Info.plist.in \
5654         .vscode/vs-code-template.code-workspace.in \
5655         solenv/lockfile/autoconf.h.in \
5656         ) \
5657     | (cd CONF-FOR-BUILD && tar xf -)
5658     cp configure CONF-FOR-BUILD
5659     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5660     (
5661     unset COM USING_X11 OS CPUNAME
5662     unset CC CXX SYSBASE CFLAGS
5663     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5664     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5665     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5666     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5667     if test -n "$CC_FOR_BUILD"; then
5668         export CC="$CC_FOR_BUILD"
5669         CC_BASE=`first_arg_basename "$CC"`
5670     fi
5671     if test -n "$CXX_FOR_BUILD"; then
5672         export CXX="$CXX_FOR_BUILD"
5673         CXX_BASE=`first_arg_basename "$CXX"`
5674     fi
5675     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5676     cd CONF-FOR-BUILD
5678     # Handle host configuration, which affects the cross-toolset too
5679     sub_conf_opts=""
5680     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5681     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5682     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5683     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5684     if test -n "$ENABLE_JAVA"; then
5685         case "$_os" in
5686         Android)
5687             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5688             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5689             ;;
5690         *)
5691             if test -z "$with_jdk_home"; then
5692                 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.])
5693             fi
5694             ;;
5695         esac
5696     else
5697         sub_conf_opts="$sub_conf_opts --without-java"
5698     fi
5699     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5700     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5701     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5702     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5703     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5704     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5705     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5706     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5707     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5708     if test "$_os" = "Emscripten"; then
5709         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5710         if test "${with_main_module+set}" = set; then
5711             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5712         else
5713             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5714         fi
5715     fi
5717     # Don't bother having configure look for stuff not needed for the build platform anyway
5718     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5719     sub_conf_defaults=" \
5720         --build="$build_alias" \
5721         --disable-cairo-canvas \
5722         --disable-cups \
5723         --disable-customtarget-components \
5724         --disable-firebird-sdbc \
5725         --disable-gpgmepp \
5726         --disable-gstreamer-1-0 \
5727         --disable-gtk3 \
5728         --disable-gtk4 \
5729         --disable-libcmis \
5730         --disable-mariadb-sdbc \
5731         --disable-nss \
5732         --disable-online-update \
5733         --disable-opencl \
5734         --disable-pdfimport \
5735         --disable-postgresql-sdbc \
5736         --disable-skia \
5737         --disable-xmlhelp \
5738         --enable-dynamic-loading \
5739         --enable-icecream="$enable_icecream" \
5740         --without-doxygen \
5741         --without-webdav \
5742         --without-x \
5743         --with-tls=openssl \
5745     # single quotes added for better readability in case of spaces
5746     echo "    Running CONF-FOR-BUILD/configure" \
5747         $sub_conf_defaults \
5748         --with-parallelism="'$with_parallelism'" \
5749         --with-theme="'$with_theme'" \
5750         --with-vendor="'$with_vendor'" \
5751         $sub_conf_opts \
5752         $with_build_platform_configure_options \
5753         --srcdir=$srcdir
5755     ./configure \
5756         $sub_conf_defaults \
5757         --with-parallelism="$with_parallelism" \
5758         --with-theme="$with_theme" \
5759         "--with-vendor=$with_vendor" \
5760         $sub_conf_opts \
5761         $with_build_platform_configure_options \
5762         --srcdir=$srcdir \
5763         2>&1 | sed -e 's/^/    /'
5764     if test [${PIPESTATUS[0]}] -ne 0; then
5765         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5766     fi
5768     # filter permitted build targets
5769     PERMITTED_BUILD_TARGETS="
5770         AVMEDIA
5771         BOOST
5772         CAIRO
5773         CLUCENE
5774         CURL
5775         DBCONNECTIVITY
5776         DESKTOP
5777         DRAGONBOX
5778         DYNLOADING
5779         EPOXY
5780         EXPAT
5781         GLM
5782         GRAPHITE
5783         HARFBUZZ
5784         HELPTOOLS
5785         ICU
5786         LCMS2
5787         LIBJPEG_TURBO
5788         LIBLANGTAG
5789         LibO
5790         LIBFFI
5791         LIBPN
5792         LIBTIFF
5793         LIBWEBP
5794         LIBXML2
5795         LIBXSLT
5796         MDDS
5797         NATIVE
5798         OPENSSL
5799         ORCUS
5800         PYTHON
5801         SCRIPTING
5802         ZLIB
5804     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5805     # newlined lists, to use grep as a filter
5806     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5807     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5808     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5809     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5811     cp config_host.mk ../config_build.mk
5812     cp config_host_lang.mk ../config_build_lang.mk
5813     mv config.log ../config.Build.log
5814     mkdir -p ../config_build
5815     mv config_host/*.h ../config_build
5816     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5818     # all these will get a _FOR_BUILD postfix
5819     DIRECT_FOR_BUILD_SETTINGS="
5820         CC
5821         CPPU_ENV
5822         CXX
5823         ILIB
5824         JAVA_HOME
5825         JAVAIFLAGS
5826         JDK
5827         JDK_SECURITYMANAGER_DISALLOWED
5828         LIBO_BIN_FOLDER
5829         LIBO_LIB_FOLDER
5830         LIBO_URE_LIB_FOLDER
5831         LIBO_URE_MISC_FOLDER
5832         OS
5833         SDKDIRNAME
5834         SYSTEM_LIBXML
5835         SYSTEM_LIBXSLT
5837     # these overwrite host config with build config
5838     OVERWRITING_SETTINGS="
5839         ANT
5840         ANT_HOME
5841         ANT_LIB
5842         JAVA_CLASSPATH_NOT_SET
5843         JAVA_SOURCE_VER
5844         JAVA_TARGET_VER
5845         JAVACFLAGS
5846         JAVACOMPILER
5847         JAVADOC
5848         JAVADOCISGJDOC
5849         LOCKFILE
5850         SYSTEM_GENBRK
5851         SYSTEM_GENCCODE
5852         SYSTEM_GENCMN
5854     # these need some special handling
5855     EXTRA_HANDLED_SETTINGS="
5856         INSTDIR
5857         INSTROOT
5858         PATH
5859         WORKDIR
5861     OLD_PATH=$PATH
5862     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5863     BUILD_PATH=$PATH
5864     PATH=$OLD_PATH
5866     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5867     echo "$line" >>build-config
5869     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5870         VV='$'$V
5871         VV=`eval "echo $VV"`
5872         if test -n "$VV"; then
5873             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5874             echo "$line" >>build-config
5875         fi
5876     done
5878     for V in $OVERWRITING_SETTINGS; do
5879         VV='$'$V
5880         VV=`eval "echo $VV"`
5881         if test -n "$VV"; then
5882             line=${V}='${'${V}:-$VV'}'
5883             echo "$line" >>build-config
5884         fi
5885     done
5887     for V in INSTDIR INSTROOT WORKDIR; do
5888         VV='$'$V
5889         VV=`eval "echo $VV"`
5890         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5891         if test -n "$VV"; then
5892             line="${V}_FOR_BUILD='$VV'"
5893             echo "$line" >>build-config
5894         fi
5895     done
5897     )
5898     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5899     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])
5900     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5901              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5903     eval `cat CONF-FOR-BUILD/build-config`
5905     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5907     rm -rf CONF-FOR-BUILD
5908 else
5909     OS_FOR_BUILD="$OS"
5910     CC_FOR_BUILD="$CC"
5911     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5912     CXX_FOR_BUILD="$CXX"
5913     INSTDIR_FOR_BUILD="$INSTDIR"
5914     INSTROOT_FOR_BUILD="$INSTROOT"
5915     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5916     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5917     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5918     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5919     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5920     WORKDIR_FOR_BUILD="$WORKDIR"
5922 AC_SUBST(OS_FOR_BUILD)
5923 AC_SUBST(INSTDIR_FOR_BUILD)
5924 AC_SUBST(INSTROOT_FOR_BUILD)
5925 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5926 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5927 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5928 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5929 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5930 AC_SUBST(WORKDIR_FOR_BUILD)
5931 AC_SUBST(CC_FOR_BUILD)
5932 AC_SUBST(CXX_FOR_BUILD)
5933 AC_SUBST(CPPU_ENV_FOR_BUILD)
5935 dnl ===================================================================
5936 dnl Check for lockfile deps
5937 dnl ===================================================================
5938 if test -z "$CROSS_COMPILING"; then
5939     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
5940     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
5941     AC_MSG_CHECKING([which lockfile binary to use])
5942     case "$with_system_lockfile" in
5943     yes)
5944         AC_MSG_RESULT([external])
5945         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
5946         ;;
5947     no)
5948         AC_MSG_RESULT([internal])
5949         ;;
5950     *)
5951         if test -x "$with_system_lockfile"; then
5952             LOCKFILE="$with_system_lockfile"
5953         else
5954             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
5955         fi
5956         AC_MSG_RESULT([$with_system_lockfile])
5957         ;;
5958     esac
5961 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
5962     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
5965 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
5966 AC_CHECK_FUNCS([utime utimes])
5967 AC_SUBST(LOCKFILE)
5969 dnl ===================================================================
5970 dnl Check for syslog header
5971 dnl ===================================================================
5972 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5974 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5975 dnl ===================================================================
5976 AC_MSG_CHECKING([whether to turn warnings to errors])
5977 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5978     ENABLE_WERROR="TRUE"
5979     PYTHONWARNINGS="error"
5980     AC_MSG_RESULT([yes])
5981 else
5982     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5983         ENABLE_WERROR="TRUE"
5984         PYTHONWARNINGS="error"
5985         AC_MSG_RESULT([yes])
5986     else
5987         AC_MSG_RESULT([no])
5988     fi
5990 AC_SUBST(ENABLE_WERROR)
5991 AC_SUBST(PYTHONWARNINGS)
5993 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5994 dnl ===================================================================
5995 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5996 if test -z "$enable_assert_always_abort"; then
5997    if test "$ENABLE_DEBUG" = TRUE; then
5998        enable_assert_always_abort=yes
5999    else
6000        enable_assert_always_abort=no
6001    fi
6003 if test "$enable_assert_always_abort" = "yes"; then
6004     ASSERT_ALWAYS_ABORT="TRUE"
6005     AC_MSG_RESULT([yes])
6006 else
6007     ASSERT_ALWAYS_ABORT="FALSE"
6008     AC_MSG_RESULT([no])
6010 AC_SUBST(ASSERT_ALWAYS_ABORT)
6012 # Determine whether to use ooenv for the instdir installation
6013 # ===================================================================
6014 if test $_os != "WINNT" -a $_os != "Darwin"; then
6015     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6016     if test -z "$enable_ooenv"; then
6017         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6018             enable_ooenv=yes
6019         else
6020             enable_ooenv=no
6021         fi
6022     fi
6023     if test "$enable_ooenv" = "no"; then
6024         AC_MSG_RESULT([no])
6025     else
6026         ENABLE_OOENV="TRUE"
6027         AC_MSG_RESULT([yes])
6028     fi
6030 AC_SUBST(ENABLE_OOENV)
6032 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6033     if test "$enable_qt5" = "no"; then
6034         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6035     else
6036         enable_qt5=yes
6037     fi
6040 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6041 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6042     AC_MSG_RESULT([yes])
6043     ENABLE_PAGEIN=TRUE
6044     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6045 else
6046     AC_MSG_RESULT([no])
6048 AC_SUBST(ENABLE_PAGEIN)
6050 dnl ===================================================================
6051 dnl check for cups support
6052 dnl ===================================================================
6054 AC_MSG_CHECKING([whether to enable CUPS support])
6055 if test "$test_cups" = yes -a "$enable_cups" != no; then
6056     ENABLE_CUPS=TRUE
6057     AC_MSG_RESULT([yes])
6059     AC_MSG_CHECKING([whether cups support is present])
6060     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6061     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6062     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6063         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6064     fi
6065 else
6066     AC_MSG_RESULT([no])
6069 AC_SUBST(ENABLE_CUPS)
6071 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.4.1],,system,TRUE)
6073 dnl whether to find & fetch external tarballs?
6074 dnl ===================================================================
6075 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6076    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6077        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6078    else
6079        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6080    fi
6082 if test -z "$TARFILE_LOCATION"; then
6083     if test -d "$SRC_ROOT/src" ; then
6084         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6085         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6086     fi
6087     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6088 else
6089     AbsolutePath "$TARFILE_LOCATION"
6090     PathFormat "${absolute_path}"
6091     TARFILE_LOCATION="${formatted_path_unix}"
6093 AC_SUBST(TARFILE_LOCATION)
6095 AC_MSG_CHECKING([whether we want to fetch tarballs])
6096 if test "$enable_fetch_external" != "no"; then
6097     if test "$with_all_tarballs" = "yes"; then
6098         AC_MSG_RESULT([yes, all of them])
6099         DO_FETCH_TARBALLS="ALL"
6100     else
6101         AC_MSG_RESULT([yes, if we use them])
6102         DO_FETCH_TARBALLS="TRUE"
6103     fi
6104 else
6105     AC_MSG_RESULT([no])
6106     DO_FETCH_TARBALLS=
6108 AC_SUBST(DO_FETCH_TARBALLS)
6110 dnl Test whether to include MySpell dictionaries
6111 dnl ===================================================================
6112 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6113 if test "$with_myspell_dicts" = "yes"; then
6114     AC_MSG_RESULT([yes])
6115     WITH_MYSPELL_DICTS=TRUE
6116     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6117     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6118 else
6119     AC_MSG_RESULT([no])
6120     WITH_MYSPELL_DICTS=
6122 AC_SUBST(WITH_MYSPELL_DICTS)
6124 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6125 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6126     if test "$with_system_dicts" = yes; then
6127         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6128     fi
6129     with_system_dicts=no
6132 AC_MSG_CHECKING([whether to use dicts from external paths])
6133 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6134     AC_MSG_RESULT([yes])
6135     SYSTEM_DICTS=TRUE
6136     AC_MSG_CHECKING([for spelling dictionary directory])
6137     if test -n "$with_external_dict_dir"; then
6138         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6139     else
6140         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6141         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6142             DICT_SYSTEM_DIR=file:///usr/share/myspell
6143         fi
6144     fi
6145     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6146     AC_MSG_CHECKING([for hyphenation patterns directory])
6147     if test -n "$with_external_hyph_dir"; then
6148         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6149     else
6150         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6151     fi
6152     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6153     AC_MSG_CHECKING([for thesaurus directory])
6154     if test -n "$with_external_thes_dir"; then
6155         THES_SYSTEM_DIR=file://$with_external_thes_dir
6156     else
6157         THES_SYSTEM_DIR=file:///usr/share/mythes
6158     fi
6159     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6160 else
6161     AC_MSG_RESULT([no])
6162     SYSTEM_DICTS=
6164 AC_SUBST(SYSTEM_DICTS)
6165 AC_SUBST(DICT_SYSTEM_DIR)
6166 AC_SUBST(HYPH_SYSTEM_DIR)
6167 AC_SUBST(THES_SYSTEM_DIR)
6169 dnl ===================================================================
6170 dnl Precompiled headers.
6171 ENABLE_PCH=""
6172 AC_MSG_CHECKING([whether to enable pch feature])
6173 if test -z "$enable_pch"; then
6174     if test "$_os" = "WINNT"; then
6175         # Enabled by default on Windows.
6176         enable_pch=yes
6177         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6178         if test -z "$enable_ccache" -a "$SCCACHE"; then
6179             CCACHE=""
6180         fi
6181     else
6182         enable_pch=no
6183     fi
6185 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6186     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6188 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6189     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6191 if test "$enable_pch" = "system"; then
6192     ENABLE_PCH="1"
6193     AC_MSG_RESULT([yes (system headers)])
6194 elif test "$enable_pch" = "base"; then
6195     ENABLE_PCH="2"
6196     AC_MSG_RESULT([yes (system and base headers)])
6197 elif test "$enable_pch" = "normal"; then
6198     ENABLE_PCH="3"
6199     AC_MSG_RESULT([yes (normal)])
6200 elif test "$enable_pch" = "full"; then
6201     ENABLE_PCH="4"
6202     AC_MSG_RESULT([yes (full)])
6203 elif test "$enable_pch" = "yes"; then
6204     # Pick a suitable default.
6205     if test "$GCC" = "yes"; then
6206         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6207         # while making the PCHs larger and rebuilds more likely.
6208         ENABLE_PCH="2"
6209         AC_MSG_RESULT([yes (system and base headers)])
6210     else
6211         # With MSVC the highest level makes a significant difference,
6212         # and it was the default when there used to be no PCH levels.
6213         ENABLE_PCH="4"
6214         AC_MSG_RESULT([yes (full)])
6215     fi
6216 elif test "$enable_pch" = "no"; then
6217     AC_MSG_RESULT([no])
6218 else
6219     AC_MSG_ERROR([Unknown value for --enable-pch])
6221 AC_SUBST(ENABLE_PCH)
6222 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6223 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6224     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6225     if test "$CCACHE_BIN" != "not found"; then
6226         AC_MSG_CHECKING([ccache version])
6227         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6228         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6229         AC_MSG_RESULT([$CCACHE_VERSION])
6230         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6231         if test "$CCACHE_NUMVER" -gt "030701"; then
6232             AC_MSG_RESULT([yes])
6233         else
6234             AC_MSG_RESULT([no (not newer than 3.7.1)])
6235             CCACHE_DEPEND_MODE=
6236         fi
6237     fi
6240 PCH_INSTANTIATE_TEMPLATES=
6241 if test -n "$ENABLE_PCH"; then
6242     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6243     save_CFLAGS=$CFLAGS
6244     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6245     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6246     CFLAGS=$save_CFLAGS
6247     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6248         AC_MSG_RESULT(yes)
6249     else
6250         AC_MSG_RESULT(no)
6251     fi
6253 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6255 BUILDING_PCH_WITH_OBJ=
6256 if test -n "$ENABLE_PCH"; then
6257     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6258     save_CFLAGS=$CFLAGS
6259     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6260     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6261     CFLAGS=$save_CFLAGS
6262     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6263         AC_MSG_RESULT(yes)
6264     else
6265         AC_MSG_RESULT(no)
6266     fi
6268 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6270 PCH_CODEGEN=
6271 PCH_NO_CODEGEN=
6272 fpch_prefix=
6273 if test "$COM" = MSC; then
6274     fpch_prefix="-Xclang "
6276 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6277     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6278     save_CFLAGS=$CFLAGS
6279     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6280     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6281         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6282     CFLAGS=$save_CFLAGS
6283     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6284     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6285         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6286     CFLAGS=$save_CFLAGS
6287     if test -n "$PCH_CODEGEN"; then
6288         AC_MSG_RESULT(yes)
6289     else
6290         AC_MSG_RESULT(no)
6291     fi
6293 AC_SUBST(PCH_CODEGEN)
6294 AC_SUBST(PCH_NO_CODEGEN)
6295 PCH_DEBUGINFO=
6296 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6297     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6298     save_CFLAGS=$CFLAGS
6299     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6300     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6301     CFLAGS=$save_CFLAGS
6302     if test -n "$PCH_DEBUGINFO"; then
6303         AC_MSG_RESULT(yes)
6304     else
6305         AC_MSG_RESULT(no)
6306     fi
6308 AC_SUBST(PCH_DEBUGINFO)
6310 TAB=`printf '\t'`
6312 AC_MSG_CHECKING([the GNU Make version])
6313 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6314 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6315 if test "$_make_longver" -ge "038200"; then
6316     AC_MSG_RESULT([$GNUMAKE $_make_version])
6317 else
6318     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6321 # find if gnumake support file function
6322 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6323 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6324 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6325     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6327 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6328 \$(file >test.txt,Success )
6330 .PHONY: all
6331 all:
6332 <TAB>@cat test.txt
6335 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6336 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6337     HAVE_GNUMAKE_FILE_FUNC=TRUE
6338     AC_MSG_RESULT([yes])
6339 else
6340     AC_MSG_RESULT([no])
6342 rm -rf $TESTGMAKEFILEFUNC
6343 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6345 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6346 STALE_MAKE=
6347 if test "$_make_ver_check" = ""; then
6348    STALE_MAKE=TRUE
6351 HAVE_LD_HASH_STYLE=FALSE
6352 WITH_LINKER_HASH_STYLE=
6353 AC_MSG_CHECKING([for --hash-style gcc linker support])
6354 if test "$GCC" = "yes"; then
6355     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6356         hash_styles="gnu sysv"
6357     elif test "$with_linker_hash_style" = "no"; then
6358         hash_styles=
6359     else
6360         hash_styles="$with_linker_hash_style"
6361     fi
6363     for hash_style in $hash_styles; do
6364         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6365         hash_style_ldflags_save=$LDFLAGS
6366         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6368         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6369             [
6370 #include <stdio.h>
6371             ],[
6372 printf ("");
6373             ])],
6374             [
6375                   HAVE_LD_HASH_STYLE=TRUE
6376                   WITH_LINKER_HASH_STYLE=$hash_style
6377             ],
6378             [HAVE_LD_HASH_STYLE=FALSE],
6379             [HAVE_LD_HASH_STYLE=FALSE])
6380         LDFLAGS=$hash_style_ldflags_save
6381     done
6383     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6384         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6385     else
6386         AC_MSG_RESULT( no )
6387     fi
6388     LDFLAGS=$hash_style_ldflags_save
6389 else
6390     AC_MSG_RESULT( no )
6392 AC_SUBST(HAVE_LD_HASH_STYLE)
6393 AC_SUBST(WITH_LINKER_HASH_STYLE)
6395 dnl ===================================================================
6396 dnl Check whether there's a Perl version available.
6397 dnl ===================================================================
6398 if test -z "$with_perl_home"; then
6399     AC_PATH_PROG(PERL, perl)
6400 else
6401     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6402     _perl_path="$with_perl_home/bin/perl"
6403     if test -x "$_perl_path"; then
6404         PERL=$_perl_path
6405     else
6406         AC_MSG_ERROR([$_perl_path not found])
6407     fi
6410 dnl ===================================================================
6411 dnl Testing for Perl version 5 or greater.
6412 dnl $] is the Perl version variable, it is returned as an integer
6413 dnl ===================================================================
6414 if test "$PERL"; then
6415     AC_MSG_CHECKING([the Perl version])
6416     ${PERL} -e "exit($]);"
6417     _perl_version=$?
6418     if test "$_perl_version" -lt 5; then
6419         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6420     fi
6421     AC_MSG_RESULT([Perl $_perl_version])
6422 else
6423     AC_MSG_ERROR([Perl not found, install Perl 5])
6426 dnl ===================================================================
6427 dnl Testing for required Perl modules
6428 dnl ===================================================================
6430 AC_MSG_CHECKING([for required Perl modules])
6431 perl_use_string="use Cwd ; use Digest::MD5"
6432 if test "$_os" = "WINNT"; then
6433     if test -n "$PKGFORMAT"; then
6434         for i in $PKGFORMAT; do
6435             case "$i" in
6436             msi)
6437                 # for getting fonts versions to use in MSI
6438                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6439                 ;;
6440             esac
6441         done
6442     fi
6444 if test "$with_system_hsqldb" = "yes"; then
6445     perl_use_string="$perl_use_string ; use Archive::Zip"
6447 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6448     # OpenSSL needs that to build
6449     perl_use_string="$perl_use_string ; use FindBin"
6451 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6452     AC_MSG_RESULT([all modules found])
6453 else
6454     AC_MSG_RESULT([failed to find some modules])
6455     # Find out which modules are missing.
6456     for i in $perl_use_string; do
6457         if test "$i" != "use" -a "$i" != ";"; then
6458             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6459                 missing_perl_modules="$missing_perl_modules $i"
6460             fi
6461         fi
6462     done
6463     AC_MSG_ERROR([
6464     The missing Perl modules are: $missing_perl_modules
6465     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6468 dnl ===================================================================
6469 dnl Check for pkg-config
6470 dnl ===================================================================
6471 if test "$_os" != "WINNT"; then
6472     PKG_PROG_PKG_CONFIG
6474 AC_SUBST(PKG_CONFIG)
6475 AC_SUBST(PKG_CONFIG_PATH)
6476 AC_SUBST(PKG_CONFIG_LIBDIR)
6478 if test "$_os" != "WINNT"; then
6480     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6481     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6482     # explicitly. Or put /path/to/compiler in PATH yourself.
6484     toolprefix=gcc
6485     if test "$COM_IS_CLANG" = "TRUE"; then
6486         toolprefix=llvm
6487     fi
6488     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6489     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6490     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6491     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6492     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6493     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6495 AC_SUBST(AR)
6496 AC_SUBST(NM)
6497 AC_SUBST(OBJDUMP)
6498 AC_SUBST(RANLIB)
6499 AC_SUBST(READELF)
6500 AC_SUBST(STRIP)
6502 dnl ===================================================================
6503 dnl pkg-config checks on macOS
6504 dnl ===================================================================
6506 if test $_os = Darwin; then
6507     AC_MSG_CHECKING([for bogus pkg-config])
6508     if test -n "$PKG_CONFIG"; then
6509         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6510             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6511         else
6512             if test "$enable_bogus_pkg_config" = "yes"; then
6513                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6514             else
6515                 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.])
6516             fi
6517         fi
6518     else
6519         AC_MSG_RESULT([no, good])
6520     fi
6523 find_csc()
6525     # Return value: $csctest
6527     unset csctest
6529     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6530     if test -n "$regvalue"; then
6531         csctest=$regvalue
6532         return
6533     fi
6536 find_al()
6538     # Return value: $altest
6540     unset altest
6542     # We need this check to detect 4.6.1 or above.
6543     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6544         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6545         PathFormat "$regvalue"
6546         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6547             altest=$regvalue
6548             return
6549         fi
6550     done
6552     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6553     for x in $reglist; do
6554         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6555         PathFormat "$regvalue"
6556         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6557             altest=$regvalue
6558             return
6559         fi
6560     done
6563 find_dotnetsdk46()
6565     unset frametest
6567     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
6568         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6569         if test -n "$regvalue"; then
6570             frametest=$regvalue
6571             return
6572         fi
6573     done
6576 find_winsdk_version()
6578     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6579     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6581     unset winsdktest winsdkbinsubdir winsdklibsubdir
6583     case "$1" in
6584     8.0|8.0A)
6585         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6586         if test -n "$regvalue"; then
6587             winsdktest=$regvalue
6588             winsdklibsubdir=win8
6589             return
6590         fi
6591         ;;
6592     8.1|8.1A)
6593         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6594         if test -n "$regvalue"; then
6595             winsdktest=$regvalue
6596             winsdklibsubdir=winv6.3
6597             return
6598         fi
6599         ;;
6600     10.0)
6601         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6602         if test -n "$regvalue"; then
6603             winsdktest=$regvalue
6604             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6605             if test -n "$regvalue"; then
6606                 winsdkbinsubdir="$regvalue".0
6607                 winsdklibsubdir=$winsdkbinsubdir
6608                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6609                 local tmppath_unix=$(cygpath -u "$tmppath")
6610                 # test exist the SDK path
6611                 if test -d "$tmppath_unix"; then
6612                    # when path is convertible to a short path then path is okay
6613                    cygpath -d "$tmppath" >/dev/null 2>&1
6614                    if test $? -ne 0; then
6615                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6616                    fi
6617                 else
6618                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6619                 fi
6620             fi
6621             return
6622         fi
6623         ;;
6624     esac
6627 find_winsdk()
6629     # Return value: From find_winsdk_version
6631     unset winsdktest
6633     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6634         find_winsdk_version $ver
6635         if test -n "$winsdktest"; then
6636             return
6637         fi
6638     done
6641 find_msms()
6643     # Return value: $msmdir
6644     local version="$1"
6646     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6647     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6648     local my_msm_dir
6650     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6652     msmdir=
6653     case "$VCVER" in
6654     16.0 | 17.0 | 17.4)
6655         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6656             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6657             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6658             if test -e "$my_msm_dir${my_msm_file}"; then
6659                 msmdir=$my_msm_dir
6660             fi
6661         done
6662         ;;
6663     esac
6665     if test -n "$msmdir"; then
6666         msmdir=`cygpath -m "$msmdir"`
6667         AC_MSG_RESULT([$msmdir])
6668     else
6669         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6670             AC_MSG_FAILURE([not found])
6671         else
6672             AC_MSG_WARN([not found (check config.log)])
6673             add_warning "MSM ${my_msm_file} not found"
6674         fi
6675     fi
6678 find_msvc_x64_dlls()
6680     # Return value: $msvcdllpath, $msvcdlls
6682     AC_MSG_CHECKING([for MSVC x64 DLL path])
6684     dnl Order crtver in increasing order. Then check the directories returned by
6685     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6686     dnl the result will be the highest CRT version found in the highest directory.
6688     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6689     case "$VCVER" in
6690     16.0 | 17.0 | 17.4)
6691         for crtver in 141 142 143; do
6692             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6693                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6694                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6695                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6696                 fi
6697             done
6698         done
6699         ;;
6700     esac
6701     AC_MSG_RESULT([$msvcdllpath])
6702     AC_MSG_CHECKING([for MSVC x64 DLLs])
6703     msvcdlls="msvcp140.dll vcruntime140.dll"
6704     for dll in $msvcdlls; do
6705         if ! test -f "$msvcdllpath/$dll"; then
6706             AC_MSG_FAILURE([missing $dll])
6707         fi
6708     done
6709     AC_MSG_RESULT([found all ($msvcdlls)])
6712 dnl =========================================
6713 dnl Check for the Windows  SDK.
6714 dnl =========================================
6715 if test "$_os" = "WINNT"; then
6716     AC_MSG_CHECKING([for Windows SDK])
6717     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6718         find_winsdk
6719         WINDOWS_SDK_HOME=$winsdktest
6721         # normalize if found
6722         if test -n "$WINDOWS_SDK_HOME"; then
6723             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6724             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6725         fi
6727         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6728     fi
6730     if test -n "$WINDOWS_SDK_HOME"; then
6731         # Remove a possible trailing backslash
6732         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6734         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6735              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6736              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6737             have_windows_sdk_headers=yes
6738         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6739              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6740              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6741             have_windows_sdk_headers=yes
6742         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6743              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6744              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6745             have_windows_sdk_headers=yes
6746         else
6747             have_windows_sdk_headers=no
6748         fi
6750         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6751             have_windows_sdk_libs=yes
6752         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6753             have_windows_sdk_libs=yes
6754         else
6755             have_windows_sdk_libs=no
6756         fi
6758         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6759             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6760 the  Windows SDK are installed.])
6761         fi
6762     fi
6764     if test -z "$WINDOWS_SDK_HOME"; then
6765         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6766     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6767         WINDOWS_SDK_VERSION=80
6768         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6769     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6770         WINDOWS_SDK_VERSION=81
6771         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6772     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6773         WINDOWS_SDK_VERSION=10
6774         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6775     else
6776         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6777     fi
6778     PathFormat "$WINDOWS_SDK_HOME"
6779     WINDOWS_SDK_HOME="$formatted_path"
6780     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6781     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6782         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6783         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6784             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6785         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6786             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6787         fi
6788     fi
6790     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6791     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6792     dnl but not in v8.0), so allow this to be overridden with a
6793     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6794     dnl and configuration error if no WiLangId.vbs is found would arguably be
6795     dnl better, but I do not know under which conditions exactly it is needed by
6796     dnl msiglobal.pm:
6797     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6798         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6799         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6800         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6801             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6802             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6803         fi
6804         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6805             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6806             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6807         fi
6808         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6809             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6810             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6811         fi
6812     fi
6813     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6814         if test -n "$with_package_format" -a "$with_package_format" != no; then
6815             for i in "$with_package_format"; do
6816                 if test "$i" = "msi"; then
6817                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6818                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6819                     fi
6820                 fi
6821             done
6822         fi
6823     fi
6825 AC_SUBST(WINDOWS_SDK_HOME)
6826 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6827 AC_SUBST(WINDOWS_SDK_VERSION)
6828 AC_SUBST(WINDOWS_SDK_WILANGID)
6830 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6831     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6832     dnl dir, it also determines that dir's path w/o an arch segment if any,
6833     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6834     AC_MSG_CHECKING([for midl.exe])
6836     find_winsdk
6837     PathFormat "$winsdktest"
6838     winsdktest_unix="$formatted_path_unix"
6840     if test -n "$winsdkbinsubdir" \
6841         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6842     then
6843         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6844         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
6845     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6846         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6847         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6848     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
6849         MIDL_PATH=$winsdktest/Bin
6850         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6851     fi
6852     PathFormat "$MIDL_PATH"
6853     if test ! -f "$formatted_path_unix/midl.exe"; then
6854         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6855     else
6856         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6857     fi
6859     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6860     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6862     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6863          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6864          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6865          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6866     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6867          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6868          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6869          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6870     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6871          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6872          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6873          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6874     else
6875         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6876     fi
6878     dnl Check csc.exe
6879     AC_MSG_CHECKING([for csc.exe])
6880     find_csc
6881     PathFormat "$csctest"
6882     csctest_unix="$formatted_path_unix"
6883     if test -f "$csctest_unix/csc.exe"; then
6884         CSC_PATH="$csctest"
6885     fi
6886     if test ! -f "$csctest_unix/csc.exe"; then
6887         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6888     else
6889         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6890     fi
6892     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6894     dnl Check al.exe
6895     AC_MSG_CHECKING([for al.exe])
6896     if test -n "$winsdkbinsubdir" \
6897         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6898     then
6899         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6900     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
6901         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6902     elif test -f "$winsdktest_unix/Bin/al.exe"; then
6903         AL_PATH="$winsdktest/Bin"
6904     fi
6906     if test -z "$AL_PATH"; then
6907         find_al
6908         PathFormat "$altest"
6909         altest_unix="$formatted_path_unix"
6910         if test -f "$altest_unix/bin/al.exe"; then
6911             AL_PATH="$altest/bin"
6912         elif test -f "$altest_unix/al.exe"; then
6913             AL_PATH="$altest"
6914         fi
6915     fi
6916     PathFormat "$AL_PATH"
6917     if test ! -f "$formatted_path_unix/al.exe"; then
6918         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6919     else
6920         AC_MSG_RESULT([$AL_PATH/al.exe])
6921     fi
6923     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6925     dnl Check mscoree.lib / .NET Framework dir
6926     AC_MSG_CHECKING(.NET Framework)
6927     find_dotnetsdk46
6928     PathFormat "$frametest"
6929     frametest="$formatted_path_unix"
6930     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6931         DOTNET_FRAMEWORK_HOME="$frametest"
6932     else
6933         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6934             DOTNET_FRAMEWORK_HOME="$winsdktest"
6935         fi
6936     fi
6937     PathFormat "$DOTNET_FRAMEWORK_HOME"
6938     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
6939         AC_MSG_ERROR([mscoree.lib not found])
6940     fi
6941     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6943     PathFormat "$MIDL_PATH"
6944     MIDL_PATH="$formatted_path"
6946     PathFormat "$AL_PATH"
6947     AL_PATH="$formatted_path"
6949     PathFormat "$DOTNET_FRAMEWORK_HOME"
6950     DOTNET_FRAMEWORK_HOME="$formatted_path"
6952     PathFormat "$CSC_PATH"
6953     CSC_PATH="$formatted_path"
6956 dnl ===================================================================
6957 dnl Testing for C++ compiler and version...
6958 dnl ===================================================================
6960 if test "$_os" != "WINNT"; then
6961     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6962     save_CXXFLAGS=$CXXFLAGS
6963     AC_PROG_CXX
6964     CXXFLAGS=$save_CXXFLAGS
6965     if test -z "$CXX_BASE"; then
6966         CXX_BASE=`first_arg_basename "$CXX"`
6967     fi
6970 dnl check for GNU C++ compiler version
6971 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6972     AC_MSG_CHECKING([the GNU C++ compiler version])
6974     _gpp_version=`$CXX -dumpversion`
6975     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6977     if test "$_gpp_majmin" -lt "700"; then
6978         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6979     else
6980         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6981     fi
6983     dnl see https://code.google.com/p/android/issues/detail?id=41770
6984         glibcxx_threads=no
6985         AC_LANG_PUSH([C++])
6986         AC_REQUIRE_CPP
6987         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6988         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6989             #include <bits/c++config.h>]],[[
6990             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6991             && !defined(_GLIBCXX__PTHREADS) \
6992             && !defined(_GLIBCXX_HAS_GTHREADS)
6993             choke me
6994             #endif
6995         ]])],[AC_MSG_RESULT([yes])
6996         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6997         AC_LANG_POP([C++])
6998         if test $glibcxx_threads = yes; then
6999             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7000         fi
7002 AC_SUBST(BOOST_CXXFLAGS)
7005 # prefx CXX with ccache if needed
7007 if test "$CCACHE" != ""; then
7008     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7009     AC_LANG_PUSH([C++])
7010     save_CXXFLAGS=$CXXFLAGS
7011     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7012     # msvc does not fail on unknown options, check stdout
7013     if test "$COM" = MSC; then
7014         CXXFLAGS="$CXXFLAGS -nologo"
7015     fi
7016     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7017     ac_cxx_werror_flag=yes
7018     dnl an empty program will do, we're checking the compiler flags
7019     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7020                       [use_ccache=yes], [use_ccache=no])
7021     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7022         AC_MSG_RESULT([yes])
7023     else
7024         CXX="$CCACHE $CXX"
7025         CXX_BASE="ccache $CXX_BASE"
7026         AC_MSG_RESULT([no])
7027     fi
7028     CXXFLAGS=$save_CXXFLAGS
7029     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7030     AC_LANG_POP([C++])
7033 dnl ===================================================================
7034 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7035 dnl ===================================================================
7037 if test "$_os" != "WINNT"; then
7038     AC_PROG_CXXCPP
7040     dnl Check whether there's a C pre-processor.
7041     AC_PROG_CPP
7045 dnl ===================================================================
7046 dnl Find integral type sizes and alignments
7047 dnl ===================================================================
7049 if test "$_os" != "WINNT"; then
7051     AC_CHECK_SIZEOF(long)
7052     AC_CHECK_SIZEOF(short)
7053     AC_CHECK_SIZEOF(int)
7054     AC_CHECK_SIZEOF(long long)
7055     AC_CHECK_SIZEOF(double)
7056     AC_CHECK_SIZEOF(void*)
7057     AC_CHECK_SIZEOF(size_t)
7059     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7060     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7061     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7062     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7063     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7064     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7066     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7067     m4_pattern_allow([AC_CHECK_ALIGNOF])
7068     m4_ifdef([AC_CHECK_ALIGNOF],
7069         [
7070             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7071             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7072             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7073             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7074         ],
7075         [
7076             case "$_os-$host_cpu" in
7077             Linux-i686)
7078                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7079                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7080                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7081                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7082                 ;;
7083             Linux-x86_64)
7084                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7085                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7086                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7087                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7088                 ;;
7089             *)
7090                 if test -z "$ac_cv_alignof_short" -o \
7091                         -z "$ac_cv_alignof_int" -o \
7092                         -z "$ac_cv_alignof_long" -o \
7093                         -z "$ac_cv_alignof_double"; then
7094                    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.])
7095                 fi
7096                 ;;
7097             esac
7098         ])
7100     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7101     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7102     if test $ac_cv_sizeof_long -eq 8; then
7103         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7104     elif test $ac_cv_sizeof_double -eq 8; then
7105         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7106     else
7107         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7108     fi
7110     dnl Check for large file support
7111     AC_SYS_LARGEFILE
7112     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7113         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7114     fi
7115     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7116         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7117     fi
7118 else
7119     # Hardcode for MSVC
7120     SAL_TYPES_SIZEOFSHORT=2
7121     SAL_TYPES_SIZEOFINT=4
7122     SAL_TYPES_SIZEOFLONG=4
7123     SAL_TYPES_SIZEOFLONGLONG=8
7124     if test $WIN_HOST_BITS -eq 32; then
7125         SAL_TYPES_SIZEOFPOINTER=4
7126         SIZEOF_SIZE_T=4
7127     else
7128         SAL_TYPES_SIZEOFPOINTER=8
7129         SIZEOF_SIZE_T=8
7130     fi
7131     SAL_TYPES_ALIGNMENT2=2
7132     SAL_TYPES_ALIGNMENT4=4
7133     SAL_TYPES_ALIGNMENT8=8
7134     LFS_CFLAGS=''
7136 AC_SUBST(LFS_CFLAGS)
7137 AC_SUBST(SIZEOF_SIZE_T)
7139 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7140 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7141 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7142 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7143 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7144 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7145 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7146 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7148 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7149 AC_MSG_CHECKING([whether jumbo sheets are supported])
7150 if test "$_os" != "WINNT"; then
7151     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7152         AC_MSG_RESULT([yes])
7153         ENABLE_JUMBO_SHEETS=TRUE
7154         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7155     else
7156         AC_MSG_RESULT([no])
7157     fi
7158 else
7159     if test $WIN_HOST_BITS -gt 32; then
7160         # 64bit windows is special-cased for tools::Long because long is 32bit
7161         AC_MSG_RESULT([yes])
7162         ENABLE_JUMBO_SHEETS=TRUE
7163         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7164     else
7165         AC_MSG_RESULT([no])
7166     fi
7168 AC_SUBST(ENABLE_JUMBO_SHEETS)
7170 dnl ===================================================================
7171 dnl Check whether to enable runtime optimizations
7172 dnl ===================================================================
7173 ENABLE_RUNTIME_OPTIMIZATIONS=
7174 AC_MSG_CHECKING([whether to enable runtime optimizations])
7175 if test -z "$enable_runtime_optimizations"; then
7176     for i in $CC; do
7177         case $i in
7178         -fsanitize=*)
7179             enable_runtime_optimizations=no
7180             break
7181             ;;
7182         esac
7183     done
7185 if test "$enable_runtime_optimizations" != no; then
7186     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7187     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7188     AC_MSG_RESULT([yes])
7189 else
7190     AC_MSG_RESULT([no])
7192 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7194 dnl ===================================================================
7195 dnl Check if valgrind headers are available
7196 dnl ===================================================================
7197 ENABLE_VALGRIND=
7198 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7199     prev_cppflags=$CPPFLAGS
7200     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7201     # or where does it come from?
7202     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7203     AC_CHECK_HEADER([valgrind/valgrind.h],
7204         [ENABLE_VALGRIND=TRUE])
7205     CPPFLAGS=$prev_cppflags
7207 AC_SUBST([ENABLE_VALGRIND])
7208 if test -z "$ENABLE_VALGRIND"; then
7209     if test "$with_valgrind" = yes; then
7210         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7211     fi
7212     VALGRIND_CFLAGS=
7214 AC_SUBST([VALGRIND_CFLAGS])
7217 dnl ===================================================================
7218 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7219 dnl ===================================================================
7221 # We need at least the sys/sdt.h include header.
7222 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7223 if test "$SDT_H_FOUND" = "TRUE"; then
7224     # Found sys/sdt.h header, now make sure the c++ compiler works.
7225     # Old g++ versions had problems with probes in constructors/destructors.
7226     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7227     AC_LANG_PUSH([C++])
7228     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7229     #include <sys/sdt.h>
7230     class ProbeClass
7231     {
7232     private:
7233       int& ref;
7234       const char *name;
7236     public:
7237       ProbeClass(int& v, const char *n) : ref(v), name(n)
7238       {
7239         DTRACE_PROBE2(_test_, cons, name, ref);
7240       }
7242       void method(int min)
7243       {
7244         DTRACE_PROBE3(_test_, meth, name, ref, min);
7245         ref -= min;
7246       }
7248       ~ProbeClass()
7249       {
7250         DTRACE_PROBE2(_test_, dest, name, ref);
7251       }
7252     };
7253     ]],[[
7254     int i = 64;
7255     DTRACE_PROBE1(_test_, call, i);
7256     ProbeClass inst = ProbeClass(i, "call");
7257     inst.method(24);
7258     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7259           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7260     AC_LANG_POP([C++])
7262 AC_CONFIG_HEADERS([config_host/config_probes.h])
7264 dnl ===================================================================
7265 dnl GCC features
7266 dnl ===================================================================
7267 HAVE_GCC_STACK_CLASH_PROTECTION=
7268 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7269     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7270     save_CFLAGS=$CFLAGS
7271     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7272     AC_LINK_IFELSE(
7273         [AC_LANG_PROGRAM(, [[return 0;]])],
7274         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7275         [AC_MSG_RESULT([no])])
7276     CFLAGS=$save_CFLAGS
7278     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7279     save_CFLAGS=$CFLAGS
7280     CFLAGS="$CFLAGS -Werror -mno-avx"
7281     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7282     CFLAGS=$save_CFLAGS
7283     if test "$HAVE_GCC_AVX" = "TRUE"; then
7284         AC_MSG_RESULT([yes])
7285     else
7286         AC_MSG_RESULT([no])
7287     fi
7289     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7290     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7291     int v = 0;
7292     if (__sync_add_and_fetch(&v, 1) != 1 ||
7293         __sync_sub_and_fetch(&v, 1) != 0)
7294         return 1;
7295     __sync_synchronize();
7296     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7297         v != 1)
7298         return 1;
7299     return 0;
7300 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7301     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7302         AC_MSG_RESULT([yes])
7303         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7304     else
7305         AC_MSG_RESULT([no])
7306     fi
7308     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7309     AC_LANG_PUSH([C++])
7310     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7311             #include <cstddef>
7312             #include <cxxabi.h>
7313             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7314         ])], [
7315             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7316             AC_MSG_RESULT([yes])
7317         ], [AC_MSG_RESULT([no])])
7318     AC_LANG_POP([C++])
7320     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7321     AC_LANG_PUSH([C++])
7322     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7323             #include <cstddef>
7324             #include <cxxabi.h>
7325             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7326         ])], [
7327             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7328             AC_MSG_RESULT([yes])
7329         ], [AC_MSG_RESULT([no])])
7330     AC_LANG_POP([C++])
7332     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7333     AC_LANG_PUSH([C++])
7334     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7335             #include <cxxabi.h>
7336             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7337         ])], [
7338             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7339             AC_MSG_RESULT([yes])
7340         ], [AC_MSG_RESULT([no])])
7341     AC_LANG_POP([C++])
7343     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7344     AC_LANG_PUSH([C++])
7345     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7346             #include <cstddef>
7347             #include <cxxabi.h>
7348             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7349         ])], [
7350             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7351             AC_MSG_RESULT([yes])
7352         ], [AC_MSG_RESULT([no])])
7353     AC_LANG_POP([C++])
7355     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7356     AC_LANG_PUSH([C++])
7357     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7358             #include <cstddef>
7359             #include <cxxabi.h>
7360             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7361         ])], [
7362             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7363             AC_MSG_RESULT([yes])
7364         ], [AC_MSG_RESULT([no])])
7365     AC_LANG_POP([C++])
7367     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7368     AC_LANG_PUSH([C++])
7369     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7370             #include <cxxabi.h>
7371             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7372         ])], [
7373             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[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_current_exception_type 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_current_exception_type(); }
7383         ])], [
7384             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7385             AC_MSG_RESULT([yes])
7386         ], [AC_MSG_RESULT([no])])
7387     AC_LANG_POP([C++])
7389     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7390     AC_LANG_PUSH([C++])
7391     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7392             #include <cxxabi.h>
7393             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7394         ])], [
7395             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7396             AC_MSG_RESULT([yes])
7397         ], [AC_MSG_RESULT([no])])
7398     AC_LANG_POP([C++])
7400     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7401     AC_LANG_PUSH([C++])
7402     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7403             #include <cstddef>
7404             #include <cxxabi.h>
7405             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7406         ])], [
7407             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7408             AC_MSG_RESULT([yes])
7409         ], [AC_MSG_RESULT([no])])
7410     AC_LANG_POP([C++])
7412     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7413     AC_LANG_PUSH([C++])
7414     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7415             #include <cstddef>
7416             #include <cxxabi.h>
7417             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7418         ])], [
7419             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7420             AC_MSG_RESULT([yes])
7421         ], [AC_MSG_RESULT([no])])
7422     AC_LANG_POP([C++])
7425 AC_SUBST(HAVE_GCC_AVX)
7426 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7427 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7429 dnl ===================================================================
7430 dnl Identify the C++ library
7431 dnl ===================================================================
7433 AC_MSG_CHECKING([what the C++ library is])
7434 HAVE_LIBSTDCPP=
7435 HAVE_LIBCPP=
7436 AC_LANG_PUSH([C++])
7437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7438 #include <utility>
7439 #ifndef __GLIBCXX__
7440 foo bar
7441 #endif
7442 ]])],
7443     [CPP_LIBRARY=GLIBCXX
7444      cpp_library_name="GNU libstdc++"
7445      HAVE_LIBSTDCPP=TRUE
7446     ],
7447     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7448 #include <utility>
7449 #ifndef _LIBCPP_VERSION
7450 foo bar
7451 #endif
7452 ]])],
7453     [CPP_LIBRARY=LIBCPP
7454      cpp_library_name="LLVM libc++"
7455      AC_DEFINE([HAVE_LIBCPP])
7456      HAVE_LIBCPP=TRUE
7457     ],
7458     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7459 #include <utility>
7460 #ifndef _MSC_VER
7461 foo bar
7462 #endif
7463 ]])],
7464     [CPP_LIBRARY=MSVCRT
7465      cpp_library_name="Microsoft"
7466     ],
7467     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7468 AC_MSG_RESULT([$cpp_library_name])
7469 AC_LANG_POP([C++])
7470 AC_SUBST([HAVE_LIBSTDCPP])
7471 AC_SUBST([HAVE_LIBCPP])
7473 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7474 then
7475     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7476     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7477     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7478     # although there will be backwards compatibility).
7479     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7480     # and there would be undefined references to debug functions.
7481     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7482     # So check if debug mode can be used and disable or downgrade it to assertions
7483     # if needed.
7484     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7485     AC_LANG_PUSH([C++])
7486     libcpp_debug_links=
7487     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7488 #define _LIBCPP_DEBUG 0 // only assertions
7489 #include <vector>
7490 int main()
7492     std::vector<int> v;
7493     v.push_back( 1 );
7494     return v[ 3 ];
7496 ]])], [libcpp_debug_links=1])
7497     if test -n "$libcpp_debug_links"; then
7498         # we can use at least assertions, check if debug mode works
7499         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7500 #define _LIBCPP_DEBUG 1 // debug mode
7501 #include <string>
7502 #include <vector>
7503 int foo(const std::vector<int>& v) { return *v.begin(); }
7504 int main()
7506     std::vector<int> v;
7507     v.push_back( 1 );
7508     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7509     return (foo(v) + s.size()) != 0 ? 0 : 1;
7511 ]])],
7512         [AC_MSG_RESULT(yes)
7513          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7514         ],
7515         [AC_MSG_RESULT(no, using only assertions)
7516          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7517         ]
7518         )
7519     else
7520         AC_MSG_RESULT(no)
7521     fi
7522     AC_LANG_POP([C++])
7524 AC_SUBST([LIBCPP_DEBUG])
7526 dnl ===================================================================
7527 dnl Check for gperf
7528 dnl ===================================================================
7529 AC_PATH_PROG(GPERF, gperf)
7530 if test -z "$GPERF"; then
7531     AC_MSG_ERROR([gperf not found but needed. Install it.])
7533 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7534     GPERF=`cygpath -m $GPERF`
7536 AC_MSG_CHECKING([whether gperf is new enough])
7537 my_gperf_ver1=$($GPERF --version | head -n 1)
7538 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7539 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7540 if test "$my_gperf_ver3" -ge 301; then
7541     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7542 else
7543     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7545 AC_SUBST(GPERF)
7547 dnl ===================================================================
7548 dnl Check for system libcmis
7549 dnl ===================================================================
7550 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2],enabled)
7552 dnl ===================================================================
7553 dnl C++11
7554 dnl ===================================================================
7556 if test -z "${CXXFLAGS_CXX11+x}"; then
7557     AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7558     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7559         if test "$with_latest_c__" = yes; then
7560             CXXFLAGS_CXX11=-std:c++latest
7561         else
7562             CXXFLAGS_CXX11=-std:c++17
7563         fi
7564         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7565     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7566         my_flags='-std=c++17 -std=c++1z'
7567         if test "$with_latest_c__" = yes; then
7568             my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7569         fi
7570         for flag in $my_flags; do
7571             if test "$COM" = MSC; then
7572                 flag="-Xclang $flag"
7573             fi
7574             save_CXXFLAGS=$CXXFLAGS
7575             CXXFLAGS="$CXXFLAGS $flag -Werror"
7576             if test "$SYSTEM_LIBCMIS" = TRUE; then
7577                 CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7578             fi
7579             AC_LANG_PUSH([C++])
7580             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7581                 #include <algorithm>
7582                 #include <functional>
7583                 #include <vector>
7585                 #if defined SYSTEM_LIBCMIS
7586                 // See ucb/source/ucp/cmis/auth_provider.hxx:
7587                 #if !defined __clang__
7588                 #pragma GCC diagnostic push
7589                 #pragma GCC diagnostic ignored "-Wdeprecated"
7590                 #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7591                 #endif
7592                 #include <libcmis/libcmis.hxx>
7593                 #if !defined __clang__
7594                 #pragma GCC diagnostic pop
7595                 #endif
7596                 #endif
7598                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7599                     std::sort(v.begin(), v.end(), fn);
7600                 }
7601                 ]])],[CXXFLAGS_CXX11=$flag])
7602             AC_LANG_POP([C++])
7603             CXXFLAGS=$save_CXXFLAGS
7604             if test -n "$CXXFLAGS_CXX11"; then
7605                 break
7606             fi
7607         done
7608     fi
7609     if test -n "$CXXFLAGS_CXX11"; then
7610         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7611     else
7612         AC_MSG_ERROR(no)
7613     fi
7615 AC_SUBST(CXXFLAGS_CXX11)
7617 if test "$GCC" = "yes"; then
7618     save_CXXFLAGS=$CXXFLAGS
7619     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7620     CHECK_L_ATOMIC
7621     CXXFLAGS=$save_CXXFLAGS
7622     AC_SUBST(ATOMIC_LIB)
7625 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7626 save_CXXFLAGS=$CXXFLAGS
7627 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7628 AC_LANG_PUSH([C++])
7630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7631 #include <stddef.h>
7633 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7635 namespace
7637         struct b
7638         {
7639                 int i;
7640                 int j;
7641         };
7643 ]], [[
7644 struct a
7646         int i;
7647         int j;
7649 a thinga[]={{0,0}, {1,1}};
7650 b thingb[]={{0,0}, {1,1}};
7651 size_t i = sizeof(sal_n_array_size(thinga));
7652 size_t j = sizeof(sal_n_array_size(thingb));
7653 return !(i != 0 && j != 0);
7655     ], [ AC_MSG_RESULT(yes) ],
7656     [ AC_MSG_ERROR(no)])
7657 AC_LANG_POP([C++])
7658 CXXFLAGS=$save_CXXFLAGS
7660 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7661 if test "$GCC" = yes; then
7662     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7663     AC_LANG_PUSH([C++])
7664     save_CXXFLAGS=$CXXFLAGS
7665     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7666     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7667     CXXFLAGS=$save_CXXFLAGS
7668     AC_LANG_POP([C++])
7669     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7670         AC_MSG_RESULT([yes])
7671     else
7672         AC_MSG_RESULT([no])
7673     fi
7675 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7677 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7678 AC_LANG_PUSH([C++])
7679 save_CXXFLAGS=$CXXFLAGS
7680 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7681 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7682         #include <algorithm>
7683         #include <initializer_list>
7684         #include <vector>
7685         template<typename T> class S {
7686         private:
7687             std::vector<T> v_;
7688         public:
7689             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7690         };
7691         constinit S<int> s{3, 2, 1};
7692     ])], [
7693         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7694         AC_MSG_RESULT([yes])
7695     ], [AC_MSG_RESULT([no])])
7696 CXXFLAGS=$save_CXXFLAGS
7697 AC_LANG_POP([C++])
7699 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7700 AC_LANG_PUSH([C++])
7701 save_CXXFLAGS=$CXXFLAGS
7702 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7703 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7704         #include <span>
7705         #include <type_traits>
7706         // Don't check size_type directly, as it was called index_type before P1872R0:
7707         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7708     ])], [
7709         AC_DEFINE([HAVE_CPP_SPAN],[1])
7710         AC_MSG_RESULT([yes])
7711     ], [AC_MSG_RESULT([no])])
7712 CXXFLAGS=$save_CXXFLAGS
7713 AC_LANG_POP([C++])
7715 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7716 AC_LANG_PUSH([C++])
7717 save_CXXFLAGS=$CXXFLAGS
7718 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7719 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7720         struct S1 { S1(S1 &&); };
7721         struct S2: S1 {};
7722         S1 f(S2 s) { return s; }
7723     ])], [
7724         AC_DEFINE([HAVE_P1155R3],[1])
7725         AC_MSG_RESULT([yes])
7726     ], [AC_MSG_RESULT([no])])
7727 CXXFLAGS=$save_CXXFLAGS
7728 AC_LANG_POP([C++])
7730 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7731 HAVE_CXX20_ATOMIC_REF=
7732 AC_LANG_PUSH([C++])
7733 save_CXXFLAGS=$CXXFLAGS
7734 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7735 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7736         #include <atomic>
7737         int x;
7738         std::atomic_ref<int> y(x);
7739     ])], [
7740         HAVE_CXX20_ATOMIC_REF=TRUE
7741         AC_MSG_RESULT([yes])
7742     ], [AC_MSG_RESULT([no])])
7743 CXXFLAGS=$save_CXXFLAGS
7744 AC_LANG_POP([C++])
7745 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7747 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7748 dnl which is included in -Wextra anyway):
7749 HAVE_WDEPRECATED_COPY_DTOR=
7750 if test "$GCC" = yes; then
7751     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7752     AC_LANG_PUSH([C++])
7753     save_CXXFLAGS=$CXXFLAGS
7754     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7755     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7756             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7757             AC_MSG_RESULT([yes])
7758         ], [AC_MSG_RESULT([no])])
7759     CXXFLAGS=$save_CXXFLAGS
7760     AC_LANG_POP([C++])
7762 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7764 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7765 dnl uninitialized warning for code like
7767 dnl   OString f();
7768 dnl   boost::optional<OString> * g(bool b) {
7769 dnl       boost::optional<OString> o;
7770 dnl       if (b) o = f();
7771 dnl       return new boost::optional<OString>(o);
7772 dnl   }
7774 dnl (as is e.g. present, in a slightly more elaborate form, in
7775 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7776 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7777 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7778 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7779     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7780     AC_LANG_PUSH([C++])
7781     save_CXXFLAGS=$CXXFLAGS
7782     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7783     if test "$ENABLE_OPTIMIZED" = TRUE; then
7784         CXXFLAGS="$CXXFLAGS -O2"
7785     else
7786         CXXFLAGS="$CXXFLAGS -O0"
7787     fi
7788     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7789             #include <new>
7790             void f1(int);
7791             struct S1 {
7792                 ~S1() { f1(n); }
7793                 int n = 0;
7794             };
7795             struct S2 {
7796                 S2() {}
7797                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7798                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7799                 void set(S1 s) {
7800                     new (stg) S1(s);
7801                     init = true;
7802                 }
7803                 bool init = false;
7804                 char stg[sizeof (S1)];
7805             } ;
7806             S1 f2();
7807             S2 * f3(bool b) {
7808                 S2 o;
7809                 if (b) o.set(f2());
7810                 return new S2(o);
7811             }
7812         ]])], [AC_MSG_RESULT([no])], [
7813             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7814             AC_MSG_RESULT([yes])
7815         ])
7816     CXXFLAGS=$save_CXXFLAGS
7817     AC_LANG_POP([C++])
7819 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7821 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7822 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7823 dnl hits us e.g. with GCC 10 and --enable-optimized at
7825 dnl   In file included from include/rtl/string.hxx:49,
7826 dnl                    from include/rtl/ustring.hxx:43,
7827 dnl                    from include/osl/file.hxx:35,
7828 dnl                    from include/codemaker/global.hxx:28,
7829 dnl                    from include/codemaker/options.hxx:23,
7830 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7831 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7832 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,
7833 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,
7834 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,
7835 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7836 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7837 dnl      78 |         memcpy( buffer, data, length );
7838 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7839 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7840 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7841     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7842     AC_LANG_PUSH([C++])
7843     save_CXXFLAGS=$CXXFLAGS
7844     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7845     if test "$ENABLE_OPTIMIZED" = TRUE; then
7846         CXXFLAGS="$CXXFLAGS -O2"
7847     else
7848         CXXFLAGS="$CXXFLAGS -O0"
7849     fi
7850     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7851     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7852             void fill(char const * begin, char const * end, char c);
7853             struct q {
7854                 char ids[4];
7855                 char username[6];
7856             };
7857             void test(q & c) {
7858                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7859                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7860             }
7861         ]])], [AC_MSG_RESULT([no])], [
7862             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7863             AC_MSG_RESULT([yes])
7864         ])
7865     CXXFLAGS=$save_CXXFLAGS
7866     AC_LANG_POP([C++])
7868 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7870 HAVE_DLLEXPORTINLINES=
7871 if test "$_os" = "WINNT"; then
7872     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7873     AC_LANG_PUSH([C++])
7874     save_CXXFLAGS=$CXXFLAGS
7875     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7876     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7877             HAVE_DLLEXPORTINLINES=TRUE
7878             AC_MSG_RESULT([yes])
7879         ], [AC_MSG_RESULT([no])])
7880     CXXFLAGS=$save_CXXFLAGS
7881     AC_LANG_POP([C++])
7883 AC_SUBST([HAVE_DLLEXPORTINLINES])
7885 dnl ===================================================================
7886 dnl CPU Intrinsics support - SSE, AVX
7887 dnl ===================================================================
7889 CXXFLAGS_INTRINSICS_SSE2=
7890 CXXFLAGS_INTRINSICS_SSSE3=
7891 CXXFLAGS_INTRINSICS_SSE41=
7892 CXXFLAGS_INTRINSICS_SSE42=
7893 CXXFLAGS_INTRINSICS_AVX=
7894 CXXFLAGS_INTRINSICS_AVX2=
7895 CXXFLAGS_INTRINSICS_AVX512=
7896 CXXFLAGS_INTRINSICS_AVX512F=
7897 CXXFLAGS_INTRINSICS_F16C=
7898 CXXFLAGS_INTRINSICS_FMA=
7900 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7901     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7902     flag_sse2=-msse2
7903     flag_ssse3=-mssse3
7904     flag_sse41=-msse4.1
7905     flag_sse42=-msse4.2
7906     flag_avx=-mavx
7907     flag_avx2=-mavx2
7908     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7909     flag_avx512f=-mavx512f
7910     flag_f16c=-mf16c
7911     flag_fma=-mfma
7912 else
7913     # With MSVC using -arch is in fact not necessary for being able
7914     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7915     # even if compiled with -arch:AVX, the -arch option really only affects
7916     # instructions generated for C/C++ code.
7917     # So use the matching same (or lower) -arch options, but only in order
7918     # to generate the best matching instructions for the C++ code surrounding
7919     # the intrinsics.
7920     # SSE2 is the default for x86/x64, so no need to specify the option.
7921     flag_sse2=
7922     # No specific options for these, use the next lower.
7923     flag_ssse3="$flag_sse2"
7924     flag_sse41="$flag_sse2"
7925     flag_sse42="$flag_sse2"
7926     flag_avx=-arch:AVX
7927     flag_avx2=-arch:AVX2
7928     flag_avx512=-arch:AVX512
7929     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7930     flag_avx512f=-arch:AVX2
7931     # No MSVC options for these.
7932     flag_f16c="$flag_sse2"
7933     flag_fma="$flag_sse2"
7936 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7937 AC_LANG_PUSH([C++])
7938 save_CXXFLAGS=$CXXFLAGS
7939 CXXFLAGS="$CXXFLAGS $flag_sse2"
7940 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7941     #include <emmintrin.h>
7942     int main () {
7943         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7944         c = _mm_xor_si128 (a, b);
7945         return 0;
7946     }
7947     ])],
7948     [can_compile_sse2=yes],
7949     [can_compile_sse2=no])
7950 AC_LANG_POP([C++])
7951 CXXFLAGS=$save_CXXFLAGS
7952 AC_MSG_RESULT([${can_compile_sse2}])
7953 if test "${can_compile_sse2}" = "yes" ; then
7954     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7957 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7958 AC_LANG_PUSH([C++])
7959 save_CXXFLAGS=$CXXFLAGS
7960 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7961 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7962     #include <tmmintrin.h>
7963     int main () {
7964         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7965         c = _mm_maddubs_epi16 (a, b);
7966         return 0;
7967     }
7968     ])],
7969     [can_compile_ssse3=yes],
7970     [can_compile_ssse3=no])
7971 AC_LANG_POP([C++])
7972 CXXFLAGS=$save_CXXFLAGS
7973 AC_MSG_RESULT([${can_compile_ssse3}])
7974 if test "${can_compile_ssse3}" = "yes" ; then
7975     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7978 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7979 AC_LANG_PUSH([C++])
7980 save_CXXFLAGS=$CXXFLAGS
7981 CXXFLAGS="$CXXFLAGS $flag_sse41"
7982 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7983     #include <smmintrin.h>
7984     int main () {
7985         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7986         c = _mm_cmpeq_epi64 (a, b);
7987         return 0;
7988     }
7989     ])],
7990     [can_compile_sse41=yes],
7991     [can_compile_sse41=no])
7992 AC_LANG_POP([C++])
7993 CXXFLAGS=$save_CXXFLAGS
7994 AC_MSG_RESULT([${can_compile_sse41}])
7995 if test "${can_compile_sse41}" = "yes" ; then
7996     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7999 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8000 AC_LANG_PUSH([C++])
8001 save_CXXFLAGS=$CXXFLAGS
8002 CXXFLAGS="$CXXFLAGS $flag_sse42"
8003 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8004     #include <nmmintrin.h>
8005     int main () {
8006         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8007         c = _mm_cmpgt_epi64 (a, b);
8008         return 0;
8009     }
8010     ])],
8011     [can_compile_sse42=yes],
8012     [can_compile_sse42=no])
8013 AC_LANG_POP([C++])
8014 CXXFLAGS=$save_CXXFLAGS
8015 AC_MSG_RESULT([${can_compile_sse42}])
8016 if test "${can_compile_sse42}" = "yes" ; then
8017     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8020 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8021 AC_LANG_PUSH([C++])
8022 save_CXXFLAGS=$CXXFLAGS
8023 CXXFLAGS="$CXXFLAGS $flag_avx"
8024 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8025     #include <immintrin.h>
8026     int main () {
8027         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8028         c = _mm256_xor_ps(a, b);
8029         return 0;
8030     }
8031     ])],
8032     [can_compile_avx=yes],
8033     [can_compile_avx=no])
8034 AC_LANG_POP([C++])
8035 CXXFLAGS=$save_CXXFLAGS
8036 AC_MSG_RESULT([${can_compile_avx}])
8037 if test "${can_compile_avx}" = "yes" ; then
8038     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8041 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8042 AC_LANG_PUSH([C++])
8043 save_CXXFLAGS=$CXXFLAGS
8044 CXXFLAGS="$CXXFLAGS $flag_avx2"
8045 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8046     #include <immintrin.h>
8047     int main () {
8048         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8049         c = _mm256_maddubs_epi16(a, b);
8050         return 0;
8051     }
8052     ])],
8053     [can_compile_avx2=yes],
8054     [can_compile_avx2=no])
8055 AC_LANG_POP([C++])
8056 CXXFLAGS=$save_CXXFLAGS
8057 AC_MSG_RESULT([${can_compile_avx2}])
8058 if test "${can_compile_avx2}" = "yes" ; then
8059     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8062 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8063 AC_LANG_PUSH([C++])
8064 save_CXXFLAGS=$CXXFLAGS
8065 CXXFLAGS="$CXXFLAGS $flag_avx512"
8066 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8067     #include <immintrin.h>
8068     int main () {
8069         __m512i a = _mm512_loadu_si512(0);
8070         __m512d v1 = _mm512_load_pd(0);
8071         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8072         __m512d v2 = _mm512_abs_pd(v1);
8073         return 0;
8074     }
8075     ])],
8076     [can_compile_avx512=yes],
8077     [can_compile_avx512=no])
8078 AC_LANG_POP([C++])
8079 CXXFLAGS=$save_CXXFLAGS
8080 AC_MSG_RESULT([${can_compile_avx512}])
8081 if test "${can_compile_avx512}" = "yes" ; then
8082     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8083     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8086 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8087 AC_LANG_PUSH([C++])
8088 save_CXXFLAGS=$CXXFLAGS
8089 CXXFLAGS="$CXXFLAGS $flag_f16c"
8090 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8091     #include <immintrin.h>
8092     int main () {
8093         __m128i a = _mm_set1_epi32 (0);
8094         __m128 c;
8095         c = _mm_cvtph_ps(a);
8096         return 0;
8097     }
8098     ])],
8099     [can_compile_f16c=yes],
8100     [can_compile_f16c=no])
8101 AC_LANG_POP([C++])
8102 CXXFLAGS=$save_CXXFLAGS
8103 AC_MSG_RESULT([${can_compile_f16c}])
8104 if test "${can_compile_f16c}" = "yes" ; then
8105     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8108 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8109 AC_LANG_PUSH([C++])
8110 save_CXXFLAGS=$CXXFLAGS
8111 CXXFLAGS="$CXXFLAGS $flag_fma"
8112 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8113     #include <immintrin.h>
8114     int main () {
8115         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8116         d = _mm256_fmadd_ps(a, b, c);
8117         return 0;
8118     }
8119     ])],
8120     [can_compile_fma=yes],
8121     [can_compile_fma=no])
8122 AC_LANG_POP([C++])
8123 CXXFLAGS=$save_CXXFLAGS
8124 AC_MSG_RESULT([${can_compile_fma}])
8125 if test "${can_compile_fma}" = "yes" ; then
8126     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8129 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8130 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8131 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8132 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8133 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8134 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8135 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8136 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8137 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8138 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8140 dnl ===================================================================
8141 dnl system stl sanity tests
8142 dnl ===================================================================
8143 if test "$_os" != "WINNT"; then
8145     AC_LANG_PUSH([C++])
8147     save_CPPFLAGS="$CPPFLAGS"
8148     if test -n "$MACOSX_SDK_PATH"; then
8149         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8150     fi
8152     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8153     # only.
8154     if test "$CPP_LIBRARY" = GLIBCXX; then
8155         dnl gcc#19664, gcc#22482, rhbz#162935
8156         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8157         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8158         AC_MSG_RESULT([$stlvisok])
8159         if test "$stlvisok" = "no"; then
8160             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8161         fi
8162     fi
8164     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8165     # when we don't make any dynamic libraries?
8166     if test "$DISABLE_DYNLOADING" = ""; then
8167         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8168         cat > conftestlib1.cc <<_ACEOF
8169 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8170 struct S2: S1<int> { virtual ~S2(); };
8171 S2::~S2() {}
8172 _ACEOF
8173         cat > conftestlib2.cc <<_ACEOF
8174 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8175 struct S2: S1<int> { virtual ~S2(); };
8176 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8177 _ACEOF
8178         gccvisinlineshiddenok=yes
8179         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8180             gccvisinlineshiddenok=no
8181         else
8182             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8183             dnl known to not work with -z defs (unsetting which makes the test
8184             dnl moot, though):
8185             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8186             if test "$COM_IS_CLANG" = TRUE; then
8187                 for i in $CXX $CXXFLAGS; do
8188                     case $i in
8189                     -fsanitize=*)
8190                         my_linkflagsnoundefs=
8191                         break
8192                         ;;
8193                     esac
8194                 done
8195             fi
8196             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8197                 gccvisinlineshiddenok=no
8198             fi
8199         fi
8201         rm -fr libconftest*
8202         AC_MSG_RESULT([$gccvisinlineshiddenok])
8203         if test "$gccvisinlineshiddenok" = "no"; then
8204             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8205         fi
8206     fi
8208    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8209     cat >visibility.cxx <<_ACEOF
8210 #pragma GCC visibility push(hidden)
8211 struct __attribute__ ((visibility ("default"))) TestStruct {
8212   static void Init();
8214 __attribute__ ((visibility ("default"))) void TestFunc() {
8215   TestStruct::Init();
8217 _ACEOF
8218     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8219         gccvisbroken=yes
8220     else
8221         case "$host_cpu" in
8222         i?86|x86_64)
8223             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8224                 gccvisbroken=no
8225             else
8226                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8227                     gccvisbroken=no
8228                 else
8229                     gccvisbroken=yes
8230                 fi
8231             fi
8232             ;;
8233         *)
8234             gccvisbroken=no
8235             ;;
8236         esac
8237     fi
8238     rm -f visibility.s visibility.cxx
8240     AC_MSG_RESULT([$gccvisbroken])
8241     if test "$gccvisbroken" = "yes"; then
8242         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8243     fi
8245     CPPFLAGS="$save_CPPFLAGS"
8247     AC_MSG_CHECKING([if CET endbranch is recognized])
8248 cat > endbr.s <<_ACEOF
8249 endbr32
8250 _ACEOF
8251     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8252     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8253         AC_MSG_RESULT([yes])
8254         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8255     else
8256         AC_MSG_RESULT([no])
8257     fi
8258     rm -f endbr.s endbr.o
8259     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8261     AC_LANG_POP([C++])
8264 dnl ===================================================================
8265 dnl  Clang++ tests
8266 dnl ===================================================================
8268 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8269 if test "$GCC" = "yes"; then
8270     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8271     AC_LANG_PUSH([C++])
8272     save_CXXFLAGS=$CXXFLAGS
8273     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8274     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8275     CXXFLAGS=$save_CXXFLAGS
8276     AC_LANG_POP([C++])
8277     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8278         AC_MSG_RESULT([yes])
8279     else
8280         AC_MSG_RESULT([no])
8281     fi
8283 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8285 dnl ===================================================================
8286 dnl Compiler plugins
8287 dnl ===================================================================
8289 COMPILER_PLUGINS=
8290 # currently only Clang
8292 if test "$COM_IS_CLANG" != "TRUE"; then
8293     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8294         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8295         enable_compiler_plugins=no
8296     fi
8299 COMPILER_PLUGINS_COM_IS_CLANG=
8300 if test "$COM_IS_CLANG" = "TRUE"; then
8301     if test -n "$enable_compiler_plugins"; then
8302         compiler_plugins="$enable_compiler_plugins"
8303     elif test -n "$ENABLE_DBGUTIL"; then
8304         compiler_plugins=test
8305     else
8306         compiler_plugins=no
8307     fi
8308     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8309         if test "$CLANGVER" -lt 120001; then
8310             if test "$compiler_plugins" = yes; then
8311                 AC_MSG_ERROR(
8312                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8313             else
8314                 compiler_plugins=no
8315             fi
8316         fi
8317     fi
8318     if test "$compiler_plugins" != "no"; then
8319         dnl The prefix where Clang resides, override to where Clang resides if
8320         dnl using a source build:
8321         if test -z "$CLANGDIR"; then
8322             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8323         fi
8324         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8325         if test -z "$COMPILER_PLUGINS_CXX"; then
8326             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8327         fi
8328         clangbindir=$CLANGDIR/bin
8329         if test "$build_os" = "cygwin"; then
8330             clangbindir=$(cygpath -u "$clangbindir")
8331         fi
8332         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8333         if test -n "$LLVM_CONFIG"; then
8334             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8335             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8336             if test -z "$CLANGLIBDIR"; then
8337                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8338             fi
8339             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8340             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8341             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8342                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8343                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8344                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8345                 fi
8346             fi
8347             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8348             clangobjdir=$($LLVM_CONFIG --obj-root)
8349             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8350                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8351             fi
8352         fi
8353         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8354         AC_LANG_PUSH([C++])
8355         save_CXX=$CXX
8356         save_CXXCPP=$CXXCPP
8357         save_CPPFLAGS=$CPPFLAGS
8358         save_CXXFLAGS=$CXXFLAGS
8359         save_LDFLAGS=$LDFLAGS
8360         save_LIBS=$LIBS
8361         CXX=$COMPILER_PLUGINS_CXX
8362         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8363         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8364         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8365         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8366             [COMPILER_PLUGINS=TRUE],
8367             [
8368             if test "$compiler_plugins" = "yes"; then
8369                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8370             else
8371                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8372                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8373             fi
8374             ])
8375         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8376         dnl comment in compilerplugins/Makefile-clang.mk:
8377         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8378             LDFLAGS=""
8379             AC_MSG_CHECKING([for clang libraries to use])
8380             if test -z "$CLANGTOOLLIBS"; then
8381                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8382                 AC_LINK_IFELSE([
8383                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8384                         [[ clang::FullSourceLoc().dump(); ]])
8385                 ],[CLANGTOOLLIBS="$LIBS"],[])
8386             fi
8387             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8388             dnl list of individual -lclang* (but note that that list can become outdated over time,
8389             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8390             dnl needs to include -lclangSupport now"):
8391             if test -z "$CLANGTOOLLIBS"; then
8392                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8393  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8394                 AC_LINK_IFELSE([
8395                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8396                         [[ clang::FullSourceLoc().dump(); ]])
8397                 ],[CLANGTOOLLIBS="$LIBS"],[])
8398             fi
8399             AC_MSG_RESULT([$CLANGTOOLLIBS])
8400             if test -z "$CLANGTOOLLIBS"; then
8401                 if test "$compiler_plugins" = "yes"; then
8402                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8403                 else
8404                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8405                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8406                 fi
8407                 COMPILER_PLUGINS=
8408             fi
8409             if test -n "$COMPILER_PLUGINS"; then
8410                 if test -z "$CLANGSYSINCLUDE"; then
8411                     if test -n "$LLVM_CONFIG"; then
8412                         # Path to the clang system headers (no idea if there's a better way to get it).
8413                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8414                     fi
8415                 fi
8416             fi
8417         fi
8418         CXX=$save_CXX
8419         CXXCPP=$save_CXXCPP
8420         CPPFLAGS=$save_CPPFLAGS
8421         CXXFLAGS=$save_CXXFLAGS
8422         LDFLAGS=$save_LDFLAGS
8423         LIBS="$save_LIBS"
8424         AC_LANG_POP([C++])
8426         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8427         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8428             #ifndef __clang__
8429             you lose
8430             #endif
8431             int foo=42;
8432             ]])],
8433             [AC_MSG_RESULT([yes])
8434              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8435             [AC_MSG_RESULT([no])])
8436         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8437     fi
8438 else
8439     if test "$enable_compiler_plugins" = "yes"; then
8440         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8441     fi
8443 COMPILER_PLUGINS_ANALYZER_PCH=
8444 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8445     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8447 AC_SUBST(COMPILER_PLUGINS)
8448 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8449 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8450 AC_SUBST(COMPILER_PLUGINS_CXX)
8451 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8452 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8453 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8454 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8455 AC_SUBST(CLANGDIR)
8456 AC_SUBST(CLANGLIBDIR)
8457 AC_SUBST(CLANGTOOLLIBS)
8458 AC_SUBST(CLANGSYSINCLUDE)
8460 # Plugin to help linker.
8461 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8462 # This makes --enable-lto build with clang work.
8463 AC_SUBST(LD_PLUGIN)
8465 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8466 AC_SUBST(HAVE_POSIX_FALLOCATE)
8468 JITC_PROCESSOR_TYPE=""
8469 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8470     # IBMs JDK needs this...
8471     JITC_PROCESSOR_TYPE=6
8472     export JITC_PROCESSOR_TYPE
8474 AC_SUBST([JITC_PROCESSOR_TYPE])
8476 # Misc Windows Stuff
8477 AC_ARG_WITH(ucrt-dir,
8478     AS_HELP_STRING([--with-ucrt-dir],
8479         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8480         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8481         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8482             Windows6.1-KB2999226-x64.msu
8483             Windows6.1-KB2999226-x86.msu
8484             Windows8.1-KB2999226-x64.msu
8485             Windows8.1-KB2999226-x86.msu
8486             Windows8-RT-KB2999226-x64.msu
8487             Windows8-RT-KB2999226-x86.msu
8488         A zip archive including those files is available from Microsoft site:
8489         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8492 UCRT_REDISTDIR="$with_ucrt_dir"
8493 if test $_os = "WINNT"; then
8494     find_msvc_x64_dlls
8495     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8496     MSVC_DLLS="$msvcdlls"
8497     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8498         with_redist=143
8499     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8500         with_redist=142
8501     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8502         with_redist=141
8503     fi
8504     for i in $PKGFORMAT; do
8505         if test "$i" = msi; then
8506             find_msms "$with_redist"
8507             if test -n "$msmdir"; then
8508                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8509                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8510             fi
8511             break
8512         fi
8513     done
8515     if test "$UCRT_REDISTDIR" = "no"; then
8516         dnl explicitly disabled
8517         UCRT_REDISTDIR=""
8518     else
8519         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8520                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8521                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8522                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8523                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8524                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8525             UCRT_REDISTDIR=""
8526             if test -n "$PKGFORMAT"; then
8527                for i in $PKGFORMAT; do
8528                    case "$i" in
8529                    msi)
8530                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8531                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8532                        ;;
8533                    esac
8534                done
8535             fi
8536         fi
8537     fi
8540 AC_SUBST(UCRT_REDISTDIR)
8541 AC_SUBST(MSVC_DLL_PATH)
8542 AC_SUBST(MSVC_DLLS)
8543 AC_SUBST(MSM_PATH)
8546 dnl ===================================================================
8547 dnl Checks for Java
8548 dnl ===================================================================
8549 if test "$ENABLE_JAVA" != ""; then
8551     # Windows-specific tests
8552     if test "$build_os" = "cygwin"; then
8553         if test -z "$with_jdk_home"; then
8554             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8555             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8556             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8557             if test -n "$regvalue"; then
8558                 ver=$regvalue
8559                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8560                 with_jdk_home=$regvalue
8561             fi
8562             howfound="found automatically"
8563         else
8564             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8565             howfound="you passed"
8566         fi
8568         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8569             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8570         fi
8571     fi
8573     # 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.
8574     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8575     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8576         with_jdk_home=`/usr/libexec/java_home`
8577     fi
8579     JAVA_HOME=; export JAVA_HOME
8580     if test -z "$with_jdk_home"; then
8581         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8582     else
8583         _java_path="$with_jdk_home/bin/$with_java"
8584         dnl Check if there is a Java interpreter at all.
8585         if test -x "$_java_path"; then
8586             JAVAINTERPRETER=$_java_path
8587         else
8588             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8589         fi
8590     fi
8592     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8593     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8594     dnl loaded by java to run JunitTests:
8595     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8596         shortjdkhome=`cygpath -d "$with_jdk_home"`
8597         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
8598             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8599             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8600         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
8601             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8602             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8603         fi
8605         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8606             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8607         fi
8608         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8609     elif test "$cross_compiling" != "yes"; then
8610         case $CPUNAME in
8611             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64)
8612                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8613                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8614                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8615                 fi
8616                 ;;
8617             *) # assumption: everything else 32-bit
8618                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8619                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8620                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8621                 fi
8622                 ;;
8623         esac
8624     fi
8627 dnl ===================================================================
8628 dnl Checks for JDK.
8629 dnl ===================================================================
8631 # Whether all the complexity here actually is needed any more or not, no idea.
8633 JDK_SECURITYMANAGER_DISALLOWED=
8634 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8635     _gij_longver=0
8636     AC_MSG_CHECKING([the installed JDK])
8637     if test -n "$JAVAINTERPRETER"; then
8638         dnl java -version sends output to stderr!
8639         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8640             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8641         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8642             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8643         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8644             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8645         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8646             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8647         else
8648             JDK=sun
8650             dnl Sun JDK specific tests
8651             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8652             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8654             if test "$_jdk_ver" -lt 10900; then
8655                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8656             fi
8657             if test "$_jdk_ver" -gt 10900; then
8658                 JAVA_CLASSPATH_NOT_SET=TRUE
8659             fi
8660             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8661             dnl completely removed in some Java version > 18 (see
8662             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8663             if test "$_jdk_ver" -ge 180000; then
8664                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8665             fi
8667             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8668             if test "$_os" = "WINNT"; then
8669                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8670             fi
8671             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8673             # set to limit VM usage for JunitTests
8674             JAVAIFLAGS=-Xmx64M
8675             # set to limit VM usage for javac
8676             JAVACFLAGS=-J-Xmx128M
8677         fi
8678     else
8679         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8680     fi
8681 else
8682     if test -z "$ENABLE_JAVA"; then
8683         dnl Java disabled
8684         JAVA_HOME=
8685         export JAVA_HOME
8686     elif test "$cross_compiling" = "yes"; then
8687         # Just assume compatibility of build and host JDK
8688         JDK=$JDK_FOR_BUILD
8689         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8690     fi
8693 dnl ===================================================================
8694 dnl Checks for javac
8695 dnl ===================================================================
8696 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8697     javacompiler="javac"
8698     : ${JAVA_SOURCE_VER=8}
8699     : ${JAVA_TARGET_VER=8}
8700     if test -z "$with_jdk_home"; then
8701         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8702     else
8703         _javac_path="$with_jdk_home/bin/$javacompiler"
8704         dnl Check if there is a Java compiler at all.
8705         if test -x "$_javac_path"; then
8706             JAVACOMPILER=$_javac_path
8707         fi
8708     fi
8709     if test -z "$JAVACOMPILER"; then
8710         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8711     fi
8712     if test "$build_os" = "cygwin"; then
8713         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8714             JAVACOMPILER="${JAVACOMPILER}.exe"
8715         fi
8716         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8717     fi
8720 dnl ===================================================================
8721 dnl Checks for javadoc
8722 dnl ===================================================================
8723 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8724     if test -z "$with_jdk_home"; then
8725         AC_PATH_PROG(JAVADOC, javadoc)
8726     else
8727         _javadoc_path="$with_jdk_home/bin/javadoc"
8728         dnl Check if there is a javadoc at all.
8729         if test -x "$_javadoc_path"; then
8730             JAVADOC=$_javadoc_path
8731         else
8732             AC_PATH_PROG(JAVADOC, javadoc)
8733         fi
8734     fi
8735     if test -z "$JAVADOC"; then
8736         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8737     fi
8738     if test "$build_os" = "cygwin"; then
8739         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8740             JAVADOC="${JAVADOC}.exe"
8741         fi
8742         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8743     fi
8745     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8746     JAVADOCISGJDOC="yes"
8747     fi
8749 AC_SUBST(JAVADOC)
8750 AC_SUBST(JAVADOCISGJDOC)
8752 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8753     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8754     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8755         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8756            # try to recover first by looking whether we have an alternative
8757            # system as in Debian or newer SuSEs where following /usr/bin/javac
8758            # over /etc/alternatives/javac leads to the right bindir where we
8759            # just need to strip a bit away to get a valid JAVA_HOME
8760            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8761         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8762             # maybe only one level of symlink (e.g. on Mac)
8763             JAVA_HOME=$(readlink $JAVACOMPILER)
8764             if test "$(dirname $JAVA_HOME)" = "."; then
8765                 # we've got no path to trim back
8766                 JAVA_HOME=""
8767             fi
8768         else
8769             # else warn
8770             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8771             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8772             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8773             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8774         fi
8775         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8776         if test "$JAVA_HOME" != "/usr"; then
8777             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8778                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8779                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8780                 dnl Tiger already returns a JDK path...
8781                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8782             else
8783                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8784                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8785                 dnl that checks which version to run
8786                 if test -f "$JAVA_HOME"; then
8787                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8788                 fi
8789             fi
8790         fi
8791     fi
8792     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8794     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8795     if test -z "$JAVA_HOME"; then
8796         if test "x$with_jdk_home" = "x"; then
8797             cat > findhome.java <<_ACEOF
8798 [import java.io.File;
8800 class findhome
8802     public static void main(String args[])
8803     {
8804         String jrelocation = System.getProperty("java.home");
8805         File jre = new File(jrelocation);
8806         System.out.println(jre.getParent());
8807     }
8809 _ACEOF
8810             AC_MSG_CHECKING([if javac works])
8811             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8812             AC_TRY_EVAL(javac_cmd)
8813             if test $? = 0 -a -f ./findhome.class; then
8814                 AC_MSG_RESULT([javac works])
8815             else
8816                 echo "configure: javac test failed" >&5
8817                 cat findhome.java >&5
8818                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8819             fi
8820             AC_MSG_CHECKING([if gij knows its java.home])
8821             JAVA_HOME=`$JAVAINTERPRETER findhome`
8822             if test $? = 0 -a "$JAVA_HOME" != ""; then
8823                 AC_MSG_RESULT([$JAVA_HOME])
8824             else
8825                 echo "configure: java test failed" >&5
8826                 cat findhome.java >&5
8827                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8828             fi
8829             # clean-up after ourselves
8830             rm -f ./findhome.java ./findhome.class
8831         else
8832             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8833         fi
8834     fi
8836     # now check if $JAVA_HOME is really valid
8837     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8838         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8839             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8840             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8841             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8842             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8843             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8844             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8845         fi
8846     fi
8847     PathFormat "$JAVA_HOME"
8848     JAVA_HOME="$formatted_path"
8851 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8852     "$_os" != Darwin
8853 then
8854     AC_MSG_CHECKING([for JAWT lib])
8855     if test "$_os" = WINNT; then
8856         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8857         JAWTLIB=jawt.lib
8858     else
8859         case "$host_cpu" in
8860         arm*)
8861             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8862             JAVA_ARCH=$my_java_arch
8863             ;;
8864         i*86)
8865             my_java_arch=i386
8866             ;;
8867         m68k)
8868             my_java_arch=m68k
8869             ;;
8870         powerpc)
8871             my_java_arch=ppc
8872             ;;
8873         powerpc64)
8874             my_java_arch=ppc64
8875             ;;
8876         powerpc64le)
8877             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8878             JAVA_ARCH=$my_java_arch
8879             ;;
8880         sparc64)
8881             my_java_arch=sparcv9
8882             ;;
8883         x86_64)
8884             my_java_arch=amd64
8885             ;;
8886         *)
8887             my_java_arch=$host_cpu
8888             ;;
8889         esac
8890         # This is where JDK9 puts the library
8891         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8892             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8893         else
8894             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8895         fi
8896         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8897     fi
8898     AC_MSG_RESULT([$JAWTLIB])
8900 AC_SUBST(JAWTLIB)
8902 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8903     case "$host_os" in
8905     aix*)
8906         JAVAINC="-I$JAVA_HOME/include"
8907         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8908         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8909         ;;
8911     cygwin*|wsl*)
8912         JAVAINC="-I$JAVA_HOME/include/win32"
8913         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8914         ;;
8916     darwin*)
8917         if test -d "$JAVA_HOME/include/darwin"; then
8918             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8919         else
8920             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8921         fi
8922         ;;
8924     dragonfly*)
8925         JAVAINC="-I$JAVA_HOME/include"
8926         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8927         ;;
8929     freebsd*)
8930         JAVAINC="-I$JAVA_HOME/include"
8931         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8932         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8933         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8934         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8935         ;;
8937     k*bsd*-gnu*)
8938         JAVAINC="-I$JAVA_HOME/include"
8939         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8940         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8941         ;;
8943     linux-gnu*)
8944         JAVAINC="-I$JAVA_HOME/include"
8945         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8946         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8947         ;;
8949     *netbsd*)
8950         JAVAINC="-I$JAVA_HOME/include"
8951         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8952         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8953        ;;
8955     openbsd*)
8956         JAVAINC="-I$JAVA_HOME/include"
8957         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8958         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8959         ;;
8961     solaris*)
8962         JAVAINC="-I$JAVA_HOME/include"
8963         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8964         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8965         ;;
8966     esac
8968 SOLARINC="$SOLARINC $JAVAINC"
8970 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8971     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8972     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8973     JDK_FOR_BUILD=$JDK
8974     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
8977 AC_SUBST(JAVACFLAGS)
8978 AC_SUBST(JAVACOMPILER)
8979 AC_SUBST(JAVAINTERPRETER)
8980 AC_SUBST(JAVAIFLAGS)
8981 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8982 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8983 AC_SUBST(JAVA_HOME)
8984 AC_SUBST(JAVA_HOME_FOR_BUILD)
8985 AC_SUBST(JDK)
8986 AC_SUBST(JDK_FOR_BUILD)
8987 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
8988 AC_SUBST(JAVA_SOURCE_VER)
8989 AC_SUBST(JAVA_TARGET_VER)
8992 dnl ===================================================================
8993 dnl Export file validation
8994 dnl ===================================================================
8995 AC_MSG_CHECKING([whether to enable export file validation])
8996 if test "$with_export_validation" != "no"; then
8997     if test -z "$ENABLE_JAVA"; then
8998         if test "$with_export_validation" = "yes"; then
8999             AC_MSG_ERROR([requested, but Java is disabled])
9000         else
9001             AC_MSG_RESULT([no, as Java is disabled])
9002         fi
9003     elif ! test -d "${SRC_ROOT}/schema"; then
9004         if test "$with_export_validation" = "yes"; then
9005             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9006         else
9007             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9008         fi
9009     else
9010         AC_MSG_RESULT([yes])
9011         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9013         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9014         if test -z "$ODFVALIDATOR"; then
9015             # remember to download the ODF toolkit with validator later
9016             AC_MSG_NOTICE([no odfvalidator found, will download it])
9017             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9018             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9020             # and fetch name of odfvalidator jar name from download.lst
9021             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9022             AC_SUBST(ODFVALIDATOR_JAR)
9024             if test -z "$ODFVALIDATOR_JAR"; then
9025                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9026             fi
9027         fi
9028         if test "$build_os" = "cygwin"; then
9029             # In case of Cygwin it will be executed from Windows,
9030             # so we need to run bash and absolute path to validator
9031             # so instead of "odfvalidator" it will be
9032             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9033             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9034         else
9035             ODFVALIDATOR="sh $ODFVALIDATOR"
9036         fi
9037         AC_SUBST(ODFVALIDATOR)
9040         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9041         if test -z "$OFFICEOTRON"; then
9042             # remember to download the officeotron with validator later
9043             AC_MSG_NOTICE([no officeotron found, will download it])
9044             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9045             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9047             # and fetch name of officeotron jar name from download.lst
9048             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9049             AC_SUBST(OFFICEOTRON_JAR)
9051             if test -z "$OFFICEOTRON_JAR"; then
9052                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9053             fi
9054         else
9055             # check version of existing officeotron
9056             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9057             if test 0"$OFFICEOTRON_VER" -lt 704; then
9058                 AC_MSG_ERROR([officeotron too old])
9059             fi
9060         fi
9061         if test "$build_os" = "cygwin"; then
9062             # In case of Cygwin it will be executed from Windows,
9063             # so we need to run bash and absolute path to validator
9064             # so instead of "odfvalidator" it will be
9065             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9066             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9067         else
9068             OFFICEOTRON="sh $OFFICEOTRON"
9069         fi
9070     fi
9071     AC_SUBST(OFFICEOTRON)
9072 else
9073     AC_MSG_RESULT([no])
9076 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9077 if test "$with_bffvalidator" != "no"; then
9078     AC_DEFINE(HAVE_BFFVALIDATOR)
9080     if test "$with_export_validation" = "no"; then
9081         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9082     fi
9084     if test "$with_bffvalidator" = "yes"; then
9085         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9086     else
9087         BFFVALIDATOR="$with_bffvalidator"
9088     fi
9090     if test "$build_os" = "cygwin"; then
9091         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9092             AC_MSG_RESULT($BFFVALIDATOR)
9093         else
9094             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9095         fi
9096     elif test -n "$BFFVALIDATOR"; then
9097         # We are not in Cygwin but need to run Windows binary with wine
9098         AC_PATH_PROGS(WINE, wine)
9100         # so swap in a shell wrapper that converts paths transparently
9101         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9102         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9103         AC_SUBST(BFFVALIDATOR_EXE)
9104         AC_MSG_RESULT($BFFVALIDATOR)
9105     else
9106         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9107     fi
9108     AC_SUBST(BFFVALIDATOR)
9109 else
9110     AC_MSG_RESULT([no])
9113 dnl ===================================================================
9114 dnl Check for epm (not needed for Windows)
9115 dnl ===================================================================
9116 AC_MSG_CHECKING([whether to enable EPM for packing])
9117 if test "$enable_epm" = "yes"; then
9118     AC_MSG_RESULT([yes])
9119     if test "$_os" != "WINNT"; then
9120         if test $_os = Darwin; then
9121             EPM=internal
9122         elif test -n "$with_epm"; then
9123             EPM=$with_epm
9124         else
9125             AC_PATH_PROG(EPM, epm, no)
9126         fi
9127         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9128             AC_MSG_NOTICE([EPM will be built.])
9129             BUILD_TYPE="$BUILD_TYPE EPM"
9130             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9131         else
9132             # Gentoo has some epm which is something different...
9133             AC_MSG_CHECKING([whether the found epm is the right epm])
9134             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9135                 AC_MSG_RESULT([yes])
9136             else
9137                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9138             fi
9139             AC_MSG_CHECKING([epm version])
9140             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9141             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9142                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9143                 AC_MSG_RESULT([OK, >= 3.7])
9144             else
9145                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9146                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9147             fi
9148         fi
9149     fi
9151     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9152         AC_MSG_CHECKING([for rpm])
9153         for a in "$RPM" rpmbuild rpm; do
9154             $a --usage >/dev/null 2> /dev/null
9155             if test $? -eq 0; then
9156                 RPM=$a
9157                 break
9158             else
9159                 $a --version >/dev/null 2> /dev/null
9160                 if test $? -eq 0; then
9161                     RPM=$a
9162                     break
9163                 fi
9164             fi
9165         done
9166         if test -z "$RPM"; then
9167             AC_MSG_ERROR([not found])
9168         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9169             RPM_PATH=`which $RPM`
9170             AC_MSG_RESULT([$RPM_PATH])
9171             SCPDEFS="$SCPDEFS -DWITH_RPM"
9172         else
9173             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9174         fi
9175     fi
9176     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9177         AC_PATH_PROG(DPKG, dpkg, no)
9178         if test "$DPKG" = "no"; then
9179             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9180         fi
9181     fi
9182     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9183        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9184         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9185             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9186                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9187                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9188                     AC_MSG_RESULT([yes])
9189                 else
9190                     AC_MSG_RESULT([no])
9191                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9192                         _pt="rpm"
9193                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9194                         add_warning "the rpms will need to be installed with --nodeps"
9195                     else
9196                         _pt="pkg"
9197                     fi
9198                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9199                     add_warning "the ${_pt}s will not be relocatable"
9200                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9201                                  relocation will work, you need to patch your epm with the
9202                                  patch in epm/epm-3.7.patch or build with
9203                                  --with-epm=internal which will build a suitable epm])
9204                 fi
9205             fi
9206         fi
9207     fi
9208     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9209         AC_PATH_PROG(PKGMK, pkgmk, no)
9210         if test "$PKGMK" = "no"; then
9211             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9212         fi
9213     fi
9214     AC_SUBST(RPM)
9215     AC_SUBST(DPKG)
9216     AC_SUBST(PKGMK)
9217 else
9218     for i in $PKGFORMAT; do
9219         case "$i" in
9220         aix | bsd | deb | pkg | rpm | native | portable)
9221             AC_MSG_ERROR(
9222                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9223             ;;
9224         esac
9225     done
9226     AC_MSG_RESULT([no])
9227     EPM=NO
9229 AC_SUBST(EPM)
9231 ENABLE_LWP=
9232 if test "$enable_lotuswordpro" = "yes"; then
9233     ENABLE_LWP="TRUE"
9235 AC_SUBST(ENABLE_LWP)
9237 dnl ===================================================================
9238 dnl Check for building ODK
9239 dnl ===================================================================
9240 AC_MSG_CHECKING([whether to build the ODK])
9241 if test "$enable_odk" = yes; then
9242     if test "$DISABLE_DYNLOADING" = TRUE; then
9243         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9244     fi
9245     AC_MSG_RESULT([yes])
9246     BUILD_TYPE="$BUILD_TYPE ODK"
9247 else
9248     AC_MSG_RESULT([no])
9251 if test "$enable_odk" != yes; then
9252     unset DOXYGEN
9253 else
9254     if test "$with_doxygen" = no; then
9255         AC_MSG_CHECKING([for doxygen])
9256         unset DOXYGEN
9257         AC_MSG_RESULT([no])
9258     else
9259         if test "$with_doxygen" = yes; then
9260             AC_PATH_PROG([DOXYGEN], [doxygen])
9261             if test -z "$DOXYGEN"; then
9262                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9263             fi
9264             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9265                 if ! dot -V 2>/dev/null; then
9266                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9267                 fi
9268             fi
9269         else
9270             AC_MSG_CHECKING([for doxygen])
9271             DOXYGEN=$with_doxygen
9272             AC_MSG_RESULT([$DOXYGEN])
9273         fi
9274         if test -n "$DOXYGEN"; then
9275             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9276             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9277             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9278                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9279             fi
9280         fi
9281     fi
9283 AC_SUBST([DOXYGEN])
9285 dnl ==================================================================
9286 dnl libfuzzer
9287 dnl ==================================================================
9288 AC_MSG_CHECKING([whether to enable fuzzers])
9289 if test "$enable_fuzzers" != yes; then
9290     AC_MSG_RESULT([no])
9291 else
9292     if test -z $LIB_FUZZING_ENGINE; then
9293       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9294     fi
9295     AC_MSG_RESULT([yes])
9296     ENABLE_FUZZERS="TRUE"
9297     AC_DEFINE([ENABLE_FUZZERS],1)
9298     AC_DEFINE([VCL_FLOAT_DEVICE_PIXEL],1)
9299     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9301 AC_SUBST(LIB_FUZZING_ENGINE)
9303 dnl ===================================================================
9304 dnl Check for system zlib
9305 dnl ===================================================================
9306 if test "$with_system_zlib" = "auto"; then
9307     case "$_os" in
9308     WINNT)
9309         with_system_zlib="$with_system_libs"
9310         ;;
9311     *)
9312         if test "$enable_fuzzers" != "yes"; then
9313             with_system_zlib=yes
9314         else
9315             with_system_zlib=no
9316         fi
9317         ;;
9318     esac
9321 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9322 dnl and has no pkg-config for it at least on some tinderboxes,
9323 dnl so leaving that out for now
9324 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9325 AC_MSG_CHECKING([which zlib to use])
9326 if test "$with_system_zlib" = "yes"; then
9327     AC_MSG_RESULT([external])
9328     SYSTEM_ZLIB=TRUE
9329     AC_CHECK_HEADER(zlib.h, [],
9330         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9331     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9332         [AC_MSG_ERROR(zlib not found or functional)], [])
9333 else
9334     AC_MSG_RESULT([internal])
9335     SYSTEM_ZLIB=
9336     BUILD_TYPE="$BUILD_TYPE ZLIB"
9337     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9338     if test "$COM" = "MSC"; then
9339         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9340     else
9341         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9342     fi
9344 AC_SUBST(ZLIB_CFLAGS)
9345 AC_SUBST(ZLIB_LIBS)
9346 AC_SUBST(SYSTEM_ZLIB)
9348 dnl ===================================================================
9349 dnl Check for system jpeg
9350 dnl ===================================================================
9351 AC_MSG_CHECKING([which libjpeg to use])
9352 if test "$with_system_jpeg" = "yes"; then
9353     AC_MSG_RESULT([external])
9354     SYSTEM_LIBJPEG=TRUE
9355     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9356         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9357     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9358         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9359 else
9360     SYSTEM_LIBJPEG=
9361     AC_MSG_RESULT([internal, libjpeg-turbo])
9362     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9364     case "$host_cpu" in
9365     x86_64 | amd64 | i*86 | x86 | ia32)
9366         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9367         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9368             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9369                 NASM="$LODE_HOME/opt/bin/nasm"
9370             elif test -x "/opt/lo/bin/nasm"; then
9371                 NASM="/opt/lo/bin/nasm"
9372             fi
9373         fi
9375         if test -n "$NASM"; then
9376             AC_MSG_CHECKING([for object file format of host system])
9377             case "$host_os" in
9378               cygwin* | mingw* | pw32* | wsl*)
9379                 case "$host_cpu" in
9380                   x86_64)
9381                     objfmt='Win64-COFF'
9382                     ;;
9383                   *)
9384                     objfmt='Win32-COFF'
9385                     ;;
9386                 esac
9387               ;;
9388               msdosdjgpp* | go32*)
9389                 objfmt='COFF'
9390               ;;
9391               os2-emx*) # not tested
9392                 objfmt='MSOMF' # obj
9393               ;;
9394               linux*coff* | linux*oldld*)
9395                 objfmt='COFF' # ???
9396               ;;
9397               linux*aout*)
9398                 objfmt='a.out'
9399               ;;
9400               linux*)
9401                 case "$host_cpu" in
9402                   x86_64)
9403                     objfmt='ELF64'
9404                     ;;
9405                   *)
9406                     objfmt='ELF'
9407                     ;;
9408                 esac
9409               ;;
9410               kfreebsd* | freebsd* | netbsd* | openbsd*)
9411                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9412                   objfmt='BSD-a.out'
9413                 else
9414                   case "$host_cpu" in
9415                     x86_64 | amd64)
9416                       objfmt='ELF64'
9417                       ;;
9418                     *)
9419                       objfmt='ELF'
9420                       ;;
9421                   esac
9422                 fi
9423               ;;
9424               solaris* | sunos* | sysv* | sco*)
9425                 case "$host_cpu" in
9426                   x86_64)
9427                     objfmt='ELF64'
9428                     ;;
9429                   *)
9430                     objfmt='ELF'
9431                     ;;
9432                 esac
9433               ;;
9434               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9435                 case "$host_cpu" in
9436                   x86_64)
9437                     objfmt='Mach-O64'
9438                     ;;
9439                   *)
9440                     objfmt='Mach-O'
9441                     ;;
9442                 esac
9443               ;;
9444               *)
9445                 objfmt='ELF ?'
9446               ;;
9447             esac
9449             AC_MSG_RESULT([$objfmt])
9450             if test "$objfmt" = 'ELF ?'; then
9451               objfmt='ELF'
9452               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9453             fi
9455             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9456             case "$objfmt" in
9457               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9458               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9459               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9460               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9461               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9462               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9463               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9464               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9465               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9466               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9467               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9468             esac
9469             AC_MSG_RESULT([$NAFLAGS])
9471             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9472             cat > conftest.asm << EOF
9473             [%line __oline__ "configure"
9474                     section .text
9475                     global  _main,main
9476             _main:
9477             main:   xor     eax,eax
9478                     ret
9479             ]
9481             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9482             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9483               AC_MSG_RESULT(yes)
9484             else
9485               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9486               cat conftest.asm >&AS_MESSAGE_LOG_FD
9487               rm -rf conftest*
9488               AC_MSG_RESULT(no)
9489               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9490               NASM=""
9491             fi
9493         fi
9495         if test -z "$NASM"; then
9496 cat << _EOS
9497 ****************************************************************************
9498 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9499 To get one please:
9501 _EOS
9502             if test "$build_os" = "cygwin"; then
9503 cat << _EOS
9504 install a pre-compiled binary for Win32
9506 mkdir -p /opt/lo/bin
9507 cd /opt/lo/bin
9508 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9509 chmod +x nasm
9511 or get and install one from http://www.nasm.us/
9513 Then re-run autogen.sh
9515 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9516 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9518 _EOS
9519             else
9520 cat << _EOS
9521 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9523 _EOS
9524             fi
9525             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9526             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9527         fi
9528       ;;
9529     esac
9532 AC_SUBST(NASM)
9533 AC_SUBST(NAFLAGS)
9534 AC_SUBST(LIBJPEG_CFLAGS)
9535 AC_SUBST(LIBJPEG_LIBS)
9536 AC_SUBST(SYSTEM_LIBJPEG)
9538 dnl ===================================================================
9539 dnl Check for system clucene
9540 dnl ===================================================================
9541 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9542 if test "$SYSTEM_CLUCENE" = TRUE; then
9543     AC_LANG_PUSH([C++])
9544     save_CXXFLAGS=$CXXFLAGS
9545     save_CPPFLAGS=$CPPFLAGS
9546     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9547     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9548     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9549     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9550     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9551                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9552     CXXFLAGS=$save_CXXFLAGS
9553     CPPFLAGS=$save_CPPFLAGS
9554     AC_LANG_POP([C++])
9555     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9558 dnl ===================================================================
9559 dnl Check for system expat
9560 dnl ===================================================================
9561 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9563 dnl ===================================================================
9564 dnl Check for system xmlsec
9565 dnl ===================================================================
9566 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9568 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9569 if test "$enable_eot" = "yes"; then
9570     ENABLE_EOT="TRUE"
9571     AC_DEFINE([ENABLE_EOT])
9572     AC_MSG_RESULT([yes])
9574     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9575 else
9576     ENABLE_EOT=
9577     AC_MSG_RESULT([no])
9579 AC_SUBST([ENABLE_EOT])
9581 dnl ===================================================================
9582 dnl Check for DLP libs
9583 dnl ===================================================================
9584 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9585 AS_IF([test "$COM" = "MSC"],
9586       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9587       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9589 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9590 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9592 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9594 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9596 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9597 AS_IF([test "$COM" = "MSC"],
9598       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9599       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9601 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9602 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9604 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9606 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9607 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9609 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9611 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9613 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9615 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9616 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9618 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9619 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9621 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9623 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9624 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9626 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9628 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9630 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9632 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9634 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9635 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9637 dnl ===================================================================
9638 dnl Check for system lcms2
9639 dnl ===================================================================
9640 if test "$with_system_lcms2" != "yes"; then
9641     SYSTEM_LCMS2=
9643 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9644 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9645 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9646 if test "$GCC" = "yes"; then
9647     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9649 if test "$COM" = "MSC"; then # override the above
9650     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9653 dnl ===================================================================
9654 dnl Check for system cppunit
9655 dnl ===================================================================
9656 if test "$_os" != "Android" ; then
9657     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9660 dnl ===================================================================
9661 dnl Check whether freetype is available
9663 dnl FreeType has 3 different kinds of versions
9664 dnl * release, like 2.4.10
9665 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9666 dnl * soname
9667 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9669 dnl 9.9.3 is 2.2.0
9670 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9671 dnl ===================================================================
9672 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9673 if test "x$ac_config_site_64bit_host" = xYES; then
9674     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9675 else
9676     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9678 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9680 # ===================================================================
9681 # Check for system libxslt
9682 # to prevent incompatibilities between internal libxml2 and external libxslt,
9683 # or vice versa, use with_system_libxml here
9684 # ===================================================================
9685 if test "$with_system_libxml" = "auto"; then
9686     case "$_os" in
9687     WINNT|iOS|Android)
9688         with_system_libxml="$with_system_libs"
9689         ;;
9690     Emscripten)
9691         with_system_libxml=no
9692         ;;
9693     *)
9694         if test "$enable_fuzzers" != "yes"; then
9695             with_system_libxml=yes
9696         else
9697             with_system_libxml=no
9698         fi
9699         ;;
9700     esac
9703 AC_MSG_CHECKING([which libxslt to use])
9704 if test "$with_system_libxml" = "yes"; then
9705     AC_MSG_RESULT([external])
9706     SYSTEM_LIBXSLT=TRUE
9707     if test "$_os" = "Darwin"; then
9708         dnl make sure to use SDK path
9709         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9710         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9711         dnl omit -L/usr/lib
9712         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9713         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9714     else
9715         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9716         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9717         FilterLibs "${LIBXSLT_LIBS}"
9718         LIBXSLT_LIBS="${filteredlibs}"
9719         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9720         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9721         FilterLibs "${LIBEXSLT_LIBS}"
9722         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9723     fi
9725     dnl Check for xsltproc
9726     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9727     if test "$XSLTPROC" = "no"; then
9728         AC_MSG_ERROR([xsltproc is required])
9729     fi
9730 else
9731     AC_MSG_RESULT([internal])
9732     SYSTEM_LIBXSLT=
9733     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9735 AC_SUBST(SYSTEM_LIBXSLT)
9736 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9737     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9739 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9741 AC_SUBST(LIBEXSLT_CFLAGS)
9742 AC_SUBST(LIBEXSLT_LIBS)
9743 AC_SUBST(LIBXSLT_CFLAGS)
9744 AC_SUBST(LIBXSLT_LIBS)
9745 AC_SUBST(XSLTPROC)
9747 # ===================================================================
9748 # Check for system libxml
9749 # ===================================================================
9750 AC_MSG_CHECKING([which libxml to use])
9751 if test "$with_system_libxml" = "yes"; then
9752     AC_MSG_RESULT([external])
9753     SYSTEM_LIBXML=TRUE
9754     if test "$_os" = "Darwin"; then
9755         dnl make sure to use SDK path
9756         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9757         dnl omit -L/usr/lib
9758         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9759     elif test $_os = iOS; then
9760         dnl make sure to use SDK path
9761         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9762         LIBXML_CFLAGS="-I$usr/include/libxml2"
9763         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9764     else
9765         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9766         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9767         FilterLibs "${LIBXML_LIBS}"
9768         LIBXML_LIBS="${filteredlibs}"
9769     fi
9771     dnl Check for xmllint
9772     AC_PATH_PROG(XMLLINT, xmllint, no)
9773     if test "$XMLLINT" = "no"; then
9774         AC_MSG_ERROR([xmllint is required])
9775     fi
9776 else
9777     AC_MSG_RESULT([internal])
9778     SYSTEM_LIBXML=
9779     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9780     if test "$COM" = "MSC"; then
9781         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9782     fi
9783     if test "$COM" = "MSC"; then
9784         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9785     else
9786         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9787         if test "$DISABLE_DYNLOADING" = TRUE; then
9788             LIBXML_LIBS="$LIBXML_LIBS -lm"
9789         fi
9790     fi
9791     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9793 AC_SUBST(SYSTEM_LIBXML)
9794 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9795     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9797 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9798 AC_SUBST(LIBXML_CFLAGS)
9799 AC_SUBST(LIBXML_LIBS)
9800 AC_SUBST(XMLLINT)
9802 # =====================================================================
9803 # Checking for a Python interpreter with version >= 3.3.
9804 # Optionally user can pass an option to configure, i. e.
9805 # ./configure PYTHON=/usr/bin/python
9806 # =====================================================================
9807 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9808     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9809     # unless PYTHON is defined as above which allows 'system'
9810     enable_python=internal
9812 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9813     if test -n "$PYTHON"; then
9814         PYTHON_FOR_BUILD=$PYTHON
9815     else
9816         # This allows a lack of system python with no error, we use internal one in that case.
9817         AM_PATH_PYTHON([3.3],, [:])
9818         # Clean PYTHON_VERSION checked below if cross-compiling
9819         PYTHON_VERSION=""
9820         if test "$PYTHON" != ":"; then
9821             PYTHON_FOR_BUILD=$PYTHON
9822         fi
9823     fi
9826 # Checks for Python to use for Pyuno
9827 AC_MSG_CHECKING([which Python to use for Pyuno])
9828 case "$enable_python" in
9829 no|disable)
9830     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9831         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9832         # requirement from the choice whether to include Python stuff in the installer, but why
9833         # bother?
9834         AC_MSG_ERROR([Python is required at build time.])
9835     fi
9836     enable_python=no
9837     AC_MSG_RESULT([none])
9838     ;;
9839 ""|yes|auto)
9840     if test "$DISABLE_SCRIPTING" = TRUE; then
9841         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9842             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9843         fi
9844         AC_MSG_RESULT([none, overridden by --disable-scripting])
9845         enable_python=no
9846     elif test $build_os = cygwin -o $build_os = wsl; then
9847         dnl When building on Windows we don't attempt to use any installed
9848         dnl "system"  Python.
9849         AC_MSG_RESULT([fully internal])
9850         enable_python=internal
9851     elif test "$cross_compiling" = yes; then
9852         AC_MSG_RESULT([system])
9853         enable_python=system
9854     else
9855         # Unset variables set by the above AM_PATH_PYTHON so that
9856         # we actually do check anew.
9857         AC_MSG_RESULT([])
9858         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
9859         AM_PATH_PYTHON([3.3],, [:])
9860         AC_MSG_CHECKING([which Python to use for Pyuno])
9861         if test "$PYTHON" = ":"; then
9862             if test -z "$PYTHON_FOR_BUILD"; then
9863                 AC_MSG_RESULT([fully internal])
9864             else
9865                 AC_MSG_RESULT([internal])
9866             fi
9867             enable_python=internal
9868         else
9869             AC_MSG_RESULT([system])
9870             enable_python=system
9871         fi
9872     fi
9873     ;;
9874 internal)
9875     AC_MSG_RESULT([internal])
9876     ;;
9877 fully-internal)
9878     AC_MSG_RESULT([fully internal])
9879     enable_python=internal
9880     ;;
9881 system)
9882     AC_MSG_RESULT([system])
9883     if test "$_os" = Darwin -a -z "$PYTHON"; then
9884         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9885     fi
9886     ;;
9888     AC_MSG_ERROR([Incorrect --enable-python option])
9889     ;;
9890 esac
9892 if test $enable_python != no; then
9893     BUILD_TYPE="$BUILD_TYPE PYUNO"
9896 if test $enable_python = system; then
9897     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9898         # Fallback: Accept these in the environment, or as set above
9899         # for MacOSX.
9900         :
9901     elif test "$cross_compiling" != yes; then
9902         # Unset variables set by the above AM_PATH_PYTHON so that
9903         # we actually do check anew.
9904         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
9905         # This causes an error if no python command is found
9906         AM_PATH_PYTHON([3.3])
9907         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9908         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9909         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9910         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9911         if test -z "$PKG_CONFIG"; then
9912             PYTHON_CFLAGS="-I$python_include"
9913             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9914         elif $PKG_CONFIG --exists python-$python_version-embed; then
9915             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9916             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9917         elif $PKG_CONFIG --exists python-$python_version; then
9918             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9919             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9920         else
9921             PYTHON_CFLAGS="-I$python_include"
9922             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9923         fi
9924         FilterLibs "${PYTHON_LIBS}"
9925         PYTHON_LIBS="${filteredlibs}"
9926     else
9927         dnl How to find out the cross-compilation Python installation path?
9928         AC_MSG_CHECKING([for python version])
9929         AS_IF([test -n "$PYTHON_VERSION"],
9930               [AC_MSG_RESULT([$PYTHON_VERSION])],
9931               [AC_MSG_RESULT([not found])
9932                AC_MSG_ERROR([no usable python found])])
9933         test -n "$PYTHON_CFLAGS" && break
9934     fi
9936     dnl Check if the headers really work
9937     save_CPPFLAGS="$CPPFLAGS"
9938     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9939     AC_CHECK_HEADER(Python.h)
9940     CPPFLAGS="$save_CPPFLAGS"
9942     # let the PYTHON_FOR_BUILD match the same python installation that
9943     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9944     # better for PythonTests.
9945     PYTHON_FOR_BUILD=$PYTHON
9948 if test "$with_lxml" != no; then
9949     if test -z "$PYTHON_FOR_BUILD"; then
9950         case $build_os in
9951             cygwin)
9952                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9953                 ;;
9954             *)
9955                 if test "$cross_compiling" != yes ; then
9956                     BUILD_TYPE="$BUILD_TYPE LXML"
9957                 fi
9958                 ;;
9959         esac
9960     else
9961         AC_MSG_CHECKING([for python lxml])
9962         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9963             AC_MSG_RESULT([yes])
9964         else
9965             case $build_os in
9966                 cygwin)
9967                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9968                     ;;
9969                 *)
9970                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9971                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9972                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9973                         else
9974                             BUILD_TYPE="$BUILD_TYPE LXML"
9975                             AC_MSG_RESULT([no, using internal lxml])
9976                         fi
9977                     else
9978                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9979                     fi
9980                     ;;
9981             esac
9982         fi
9983     fi
9986 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
9987     SYSTEM_PYTHON=
9988     PYTHON_VERSION_MAJOR=3
9989     PYTHON_VERSION_MINOR=8
9990     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15
9991     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9992         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9993     fi
9994     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9996     # Embedded Python dies without Home set
9997     if test "$HOME" = ""; then
9998         export HOME=""
9999     fi
10002 dnl By now enable_python should be "system", "internal" or "no"
10003 case $enable_python in
10004 system)
10005     SYSTEM_PYTHON=TRUE
10007     if test "x$ac_cv_header_Python_h" != "xyes"; then
10008        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10009     fi
10011     AC_LANG_PUSH(C)
10012     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10013     AC_MSG_CHECKING([for correct python library version])
10014        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10015 #include <Python.h>
10017 int main(int argc, char **argv) {
10018    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10019    else return 1;
10021        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10022     AC_LANG_POP(C)
10024     dnl FIXME Check if the Python library can be linked with, too?
10025     ;;
10027 internal)
10028     BUILD_TYPE="$BUILD_TYPE PYTHON"
10029     if test "$OS" = LINUX -o "$OS" = WNT ; then
10030         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10031     fi
10032     ;;
10034     DISABLE_PYTHON=TRUE
10035     SYSTEM_PYTHON=
10036     ;;
10038     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10039     ;;
10040 esac
10042 AC_SUBST(DISABLE_PYTHON)
10043 AC_SUBST(SYSTEM_PYTHON)
10044 AC_SUBST(PYTHON_CFLAGS)
10045 AC_SUBST(PYTHON_FOR_BUILD)
10046 AC_SUBST(PYTHON_LIBS)
10047 AC_SUBST(PYTHON_VERSION)
10048 AC_SUBST(PYTHON_VERSION_MAJOR)
10049 AC_SUBST(PYTHON_VERSION_MINOR)
10051 AC_MSG_CHECKING([whether to build LibreLogo])
10052 case "$enable_python" in
10053 no|disable)
10054     AC_MSG_RESULT([no; Python disabled])
10055     ;;
10057     if test "${enable_librelogo}" = "no"; then
10058         AC_MSG_RESULT([no])
10059     else
10060         AC_MSG_RESULT([yes])
10061         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10062         AC_DEFINE([ENABLE_LIBRELOGO],1)
10063     fi
10064     ;;
10065 esac
10066 AC_SUBST(ENABLE_LIBRELOGO)
10068 ENABLE_MARIADBC=
10069 MARIADBC_MAJOR=1
10070 MARIADBC_MINOR=0
10071 MARIADBC_MICRO=2
10072 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10073 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10074     ENABLE_MARIADBC=TRUE
10075     AC_MSG_RESULT([yes])
10076     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10077 else
10078     AC_MSG_RESULT([no])
10080 AC_SUBST(ENABLE_MARIADBC)
10081 AC_SUBST(MARIADBC_MAJOR)
10082 AC_SUBST(MARIADBC_MINOR)
10083 AC_SUBST(MARIADBC_MICRO)
10085 if test "$ENABLE_MARIADBC" = "TRUE"; then
10086     dnl ===================================================================
10087     dnl Check for system MariaDB
10088     dnl ===================================================================
10089     AC_MSG_CHECKING([which MariaDB to use])
10090     if test "$with_system_mariadb" = "yes"; then
10091         AC_MSG_RESULT([external])
10092         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10093         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10094         if test -z "$MARIADBCONFIG"; then
10095             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10096             if test -z "$MARIADBCONFIG"; then
10097                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10098                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10099             fi
10100         fi
10101         AC_MSG_CHECKING([MariaDB version])
10102         MARIADB_VERSION=`$MARIADBCONFIG --version`
10103         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10104         if test "$MARIADB_MAJOR" -ge "5"; then
10105             AC_MSG_RESULT([OK])
10106         else
10107             AC_MSG_ERROR([too old, use 5.0.x or later])
10108         fi
10109         AC_MSG_CHECKING([for MariaDB Client library])
10110         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10111         if test "$COM_IS_CLANG" = TRUE; then
10112             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10113         fi
10114         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10115         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10116         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10117         dnl linux32:
10118         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10119             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10120             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10121                 | sed -e 's|/lib64/|/lib/|')
10122         fi
10123         FilterLibs "${MARIADB_LIBS}"
10124         MARIADB_LIBS="${filteredlibs}"
10125         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10126         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10127         if test "$enable_bundle_mariadb" = "yes"; then
10128             AC_MSG_RESULT([yes])
10129             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10130             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10132 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10134 /g' | grep -E '(mysqlclient|mariadb)')
10135             if test "$_os" = "Darwin"; then
10136                 LIBMARIADB=${LIBMARIADB}.dylib
10137             elif test "$_os" = "WINNT"; then
10138                 LIBMARIADB=${LIBMARIADB}.dll
10139             else
10140                 LIBMARIADB=${LIBMARIADB}.so
10141             fi
10142             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10143             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10144             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10145                 AC_MSG_RESULT([found.])
10146                 PathFormat "$LIBMARIADB_PATH"
10147                 LIBMARIADB_PATH="$formatted_path"
10148             else
10149                 AC_MSG_ERROR([not found.])
10150             fi
10151         else
10152             AC_MSG_RESULT([no])
10153             BUNDLE_MARIADB_CONNECTOR_C=
10154         fi
10155     else
10156         AC_MSG_RESULT([internal])
10157         SYSTEM_MARIADB_CONNECTOR_C=
10158         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10159         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10160         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10161     fi
10163     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10164     AC_SUBST(MARIADB_CFLAGS)
10165     AC_SUBST(MARIADB_LIBS)
10166     AC_SUBST(LIBMARIADB)
10167     AC_SUBST(LIBMARIADB_PATH)
10168     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10171 dnl ===================================================================
10172 dnl Check for system hsqldb
10173 dnl ===================================================================
10174 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10175     AC_MSG_CHECKING([which hsqldb to use])
10176     if test "$with_system_hsqldb" = "yes"; then
10177         AC_MSG_RESULT([external])
10178         SYSTEM_HSQLDB=TRUE
10179         if test -z $HSQLDB_JAR; then
10180             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10181         fi
10182         if ! test -f $HSQLDB_JAR; then
10183                AC_MSG_ERROR(hsqldb.jar not found.)
10184         fi
10185         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10186         export HSQLDB_JAR
10187         if $PERL -e \
10188            'use Archive::Zip;
10189             my $file = "$ENV{'HSQLDB_JAR'}";
10190             my $zip = Archive::Zip->new( $file );
10191             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10192             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10193             {
10194                 push @l, split(/\n/, $mf);
10195                 foreach my $line (@l)
10196                 {
10197                     if ($line =~ m/Specification-Version:/)
10198                     {
10199                         ($t, $version) = split (/:/,$line);
10200                         $version =~ s/^\s//;
10201                         ($a, $b, $c, $d) = split (/\./,$version);
10202                         if ($c == "0" && $d > "8")
10203                         {
10204                             exit 0;
10205                         }
10206                         else
10207                         {
10208                             exit 1;
10209                         }
10210                     }
10211                 }
10212             }
10213             else
10214             {
10215                 exit 1;
10216             }'; then
10217             AC_MSG_RESULT([yes])
10218         else
10219             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10220         fi
10221     else
10222         AC_MSG_RESULT([internal])
10223         SYSTEM_HSQLDB=
10224         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10225         NEED_ANT=TRUE
10226     fi
10227 else
10228     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10229         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10230     fi
10232 AC_SUBST(SYSTEM_HSQLDB)
10233 AC_SUBST(HSQLDB_JAR)
10235 dnl ===================================================================
10236 dnl Check for PostgreSQL stuff
10237 dnl ===================================================================
10238 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10239 if test "x$enable_postgresql_sdbc" != "xno"; then
10240     AC_MSG_RESULT([yes])
10241     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10243     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10244         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10245     fi
10246     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10247         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10248     fi
10250     postgres_interface=""
10251     if test "$with_system_postgresql" = "yes"; then
10252         postgres_interface="external PostgreSQL"
10253         SYSTEM_POSTGRESQL=TRUE
10254         if test "$_os" = Darwin; then
10255             supp_path=''
10256             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10257                 pg_supp_path="$P_SEP$d$pg_supp_path"
10258             done
10259         fi
10260         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10261         if test -n "$PGCONFIG"; then
10262             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10263             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10264         else
10265             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10266               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10267               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10268             ],[
10269               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10270             ])
10271         fi
10272         FilterLibs "${POSTGRESQL_LIB}"
10273         POSTGRESQL_LIB="${filteredlibs}"
10274     else
10275         # if/when anything else than PostgreSQL uses Kerberos,
10276         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10277         WITH_KRB5=
10278         WITH_GSSAPI=
10279         case "$_os" in
10280         Darwin)
10281             # macOS has system MIT Kerberos 5 since 10.4
10282             if test "$with_krb5" != "no"; then
10283                 WITH_KRB5=TRUE
10284                 save_LIBS=$LIBS
10285                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10286                 # that the libraries where these functions are located on macOS will change, is it?
10287                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10288                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10289                 KRB5_LIBS=$LIBS
10290                 LIBS=$save_LIBS
10291                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10292                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10293                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10294                 LIBS=$save_LIBS
10295             fi
10296             if test "$with_gssapi" != "no"; then
10297                 WITH_GSSAPI=TRUE
10298                 save_LIBS=$LIBS
10299                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10300                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10301                 GSSAPI_LIBS=$LIBS
10302                 LIBS=$save_LIBS
10303             fi
10304             ;;
10305         WINNT)
10306             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10307                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10308             fi
10309             ;;
10310         Linux|GNU|*BSD|DragonFly)
10311             if test "$with_krb5" != "no"; then
10312                 WITH_KRB5=TRUE
10313                 save_LIBS=$LIBS
10314                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10315                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10316                 KRB5_LIBS=$LIBS
10317                 LIBS=$save_LIBS
10318                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10319                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10320                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10321                 LIBS=$save_LIBS
10322             fi
10323             if test "$with_gssapi" != "no"; then
10324                 WITH_GSSAPI=TRUE
10325                 save_LIBS=$LIBS
10326                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10327                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10328                 GSSAPI_LIBS=$LIBS
10329                 LIBS=$save_LIBS
10330             fi
10331             ;;
10332         *)
10333             if test "$with_krb5" = "yes"; then
10334                 WITH_KRB5=TRUE
10335                 save_LIBS=$LIBS
10336                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10337                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10338                 KRB5_LIBS=$LIBS
10339                 LIBS=$save_LIBS
10340                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10341                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10342                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10343                 LIBS=$save_LIBS
10344             fi
10345             if test "$with_gssapi" = "yes"; then
10346                 WITH_GSSAPI=TRUE
10347                 save_LIBS=$LIBS
10348                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10349                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10350                 LIBS=$save_LIBS
10351                 GSSAPI_LIBS=$LIBS
10352             fi
10353         esac
10355         if test -n "$with_libpq_path"; then
10356             SYSTEM_POSTGRESQL=TRUE
10357             postgres_interface="external libpq"
10358             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10359             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10360         else
10361             SYSTEM_POSTGRESQL=
10362             postgres_interface="internal"
10363             POSTGRESQL_LIB=""
10364             POSTGRESQL_INC="%OVERRIDE_ME%"
10365             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10366         fi
10367     fi
10369     AC_MSG_CHECKING([PostgreSQL C interface])
10370     AC_MSG_RESULT([$postgres_interface])
10372     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10373         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10374         save_CFLAGS=$CFLAGS
10375         save_CPPFLAGS=$CPPFLAGS
10376         save_LIBS=$LIBS
10377         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10378         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10379         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10380         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10381             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10382         CFLAGS=$save_CFLAGS
10383         CPPFLAGS=$save_CPPFLAGS
10384         LIBS=$save_LIBS
10385     fi
10386     BUILD_POSTGRESQL_SDBC=TRUE
10387 else
10388     AC_MSG_RESULT([no])
10390 AC_SUBST(WITH_KRB5)
10391 AC_SUBST(WITH_GSSAPI)
10392 AC_SUBST(GSSAPI_LIBS)
10393 AC_SUBST(KRB5_LIBS)
10394 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10395 AC_SUBST(SYSTEM_POSTGRESQL)
10396 AC_SUBST(POSTGRESQL_INC)
10397 AC_SUBST(POSTGRESQL_LIB)
10399 dnl ===================================================================
10400 dnl Check for Firebird stuff
10401 dnl ===================================================================
10402 ENABLE_FIREBIRD_SDBC=
10403 if test "$enable_firebird_sdbc" = "yes" ; then
10404     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10406     dnl ===================================================================
10407     dnl Check for system Firebird
10408     dnl ===================================================================
10409     AC_MSG_CHECKING([which Firebird to use])
10410     if test "$with_system_firebird" = "yes"; then
10411         AC_MSG_RESULT([external])
10412         SYSTEM_FIREBIRD=TRUE
10413         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10414         if test -z "$FIREBIRDCONFIG"; then
10415             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10416             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10417                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10418             ])
10419             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10420         else
10421             AC_MSG_NOTICE([fb_config found])
10422             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10423             AC_MSG_CHECKING([for Firebird Client library])
10424             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10425             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10426             FilterLibs "${FIREBIRD_LIBS}"
10427             FIREBIRD_LIBS="${filteredlibs}"
10428         fi
10429         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10430         AC_MSG_CHECKING([Firebird version])
10431         if test -n "${FIREBIRD_VERSION}"; then
10432             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10433             if test "$FIREBIRD_MAJOR" -ge "3"; then
10434                 AC_MSG_RESULT([OK])
10435             else
10436                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10437             fi
10438         else
10439             save_CFLAGS="${CFLAGS}"
10440             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10441             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10442 #if defined(FB_API_VER) && FB_API_VER == 30
10443 int fb_api_is_30(void) { return 0; }
10444 #else
10445 #error "Wrong Firebird API version"
10446 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10447             CFLAGS="$save_CFLAGS"
10448         fi
10449         ENABLE_FIREBIRD_SDBC=TRUE
10450         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10451     elif test "$enable_database_connectivity" = no; then
10452         AC_MSG_RESULT([none])
10453     elif test "$cross_compiling" = "yes"; then
10454         AC_MSG_RESULT([none])
10455     else
10456         dnl Embedded Firebird has version 3.0
10457         dnl We need libatomic_ops for any non X86/X64 system
10458         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10459             dnl ===================================================================
10460             dnl Check for system libatomic_ops
10461             dnl ===================================================================
10462             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10463             if test "$with_system_libatomic_ops" = "yes"; then
10464                 SYSTEM_LIBATOMIC_OPS=TRUE
10465                 AC_CHECK_HEADERS(atomic_ops.h, [],
10466                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10467             else
10468                 SYSTEM_LIBATOMIC_OPS=
10469                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10470                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10471                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10472             fi
10473         fi
10475         AC_MSG_RESULT([internal])
10476         SYSTEM_FIREBIRD=
10477         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10478         FIREBIRD_LIBS="-lfbclient"
10480         if test "$with_system_libtommath" = "yes"; then
10481             SYSTEM_LIBTOMMATH=TRUE
10482             dnl check for tommath presence
10483             save_LIBS=$LIBS
10484             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10485             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10486             LIBS=$save_LIBS
10487         else
10488             SYSTEM_LIBTOMMATH=
10489             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10490             LIBTOMMATH_LIBS="-ltommath"
10491             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10492         fi
10494         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10495         ENABLE_FIREBIRD_SDBC=TRUE
10496         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10497     fi
10499 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10500 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10501 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10502 AC_SUBST(LIBATOMIC_OPS_LIBS)
10503 AC_SUBST(SYSTEM_FIREBIRD)
10504 AC_SUBST(FIREBIRD_CFLAGS)
10505 AC_SUBST(FIREBIRD_LIBS)
10506 AC_SUBST(SYSTEM_LIBTOMMATH)
10507 AC_SUBST(LIBTOMMATH_CFLAGS)
10508 AC_SUBST(LIBTOMMATH_LIBS)
10510 dnl ===================================================================
10511 dnl Check for system curl
10512 dnl ===================================================================
10513 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10515 dnl ===================================================================
10516 dnl Check for system boost
10517 dnl ===================================================================
10518 AC_MSG_CHECKING([which boost to use])
10519 if test "$with_system_boost" = "yes"; then
10520     AC_MSG_RESULT([external])
10521     SYSTEM_BOOST=TRUE
10522     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10523     AX_BOOST_DATE_TIME
10524     AX_BOOST_FILESYSTEM
10525     AX_BOOST_IOSTREAMS
10526     AX_BOOST_LOCALE
10527     AC_LANG_PUSH([C++])
10528     save_CXXFLAGS=$CXXFLAGS
10529     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10530     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10531        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10532     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10533        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10534     CXXFLAGS=$save_CXXFLAGS
10535     AC_LANG_POP([C++])
10536     # this is in m4/ax_boost_base.m4
10537     FilterLibs "${BOOST_LDFLAGS}"
10538     BOOST_LDFLAGS="${filteredlibs}"
10539 else
10540     AC_MSG_RESULT([internal])
10541     BUILD_TYPE="$BUILD_TYPE BOOST"
10542     SYSTEM_BOOST=
10543     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10544         # use warning-suppressing wrapper headers
10545         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10546     else
10547         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10548     fi
10550 AC_SUBST(SYSTEM_BOOST)
10552 dnl ===================================================================
10553 dnl Check for system mdds
10554 dnl ===================================================================
10555 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10556 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.0 >= 2.0.0])
10558 dnl ===================================================================
10559 dnl Check for system dragonbox
10560 dnl ===================================================================
10561 AC_MSG_CHECKING([which dragonbox to use])
10562 if test "$with_system_dragonbox" = "yes"; then
10563     AC_MSG_RESULT([external])
10564     SYSTEM_DRAGONBOX=TRUE
10565     AC_LANG_PUSH([C++])
10566     save_CPPFLAGS=$CPPFLAGS
10567     # This is where upstream installs to, unfortunately no .pc or so...
10568     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.0.0
10569     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10570     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10571        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10572     AC_LANG_POP([C++])
10573     CPPFLAGS=$save_CPPFLAGS
10574 else
10575     AC_MSG_RESULT([internal])
10576     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10577     SYSTEM_DRAGONBOX=
10579 AC_SUBST([SYSTEM_DRAGONBOX])
10580 AC_SUBST([DRAGONBOX_CFLAGS])
10582 dnl ===================================================================
10583 dnl Check for system libfixmath
10584 dnl ===================================================================
10585 AC_MSG_CHECKING([which libfixmath to use])
10586 if test "$with_system_libfixmath" = "yes"; then
10587     AC_MSG_RESULT([external])
10588     SYSTEM_LIBFIXMATH=TRUE
10589     AC_LANG_PUSH([C++])
10590     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10591        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10592     AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib not found or functional)], [])
10593     AC_LANG_POP([C++])
10594 else
10595     AC_MSG_RESULT([internal])
10596     SYSTEM_LIBFIXMATH=
10598 AC_SUBST([SYSTEM_LIBFIXMATH])
10600 dnl ===================================================================
10601 dnl Check for system glm
10602 dnl ===================================================================
10603 AC_MSG_CHECKING([which glm to use])
10604 if test "$with_system_glm" = "yes"; then
10605     AC_MSG_RESULT([external])
10606     SYSTEM_GLM=TRUE
10607     AC_LANG_PUSH([C++])
10608     AC_CHECK_HEADER([glm/glm.hpp], [],
10609        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10610     AC_LANG_POP([C++])
10611 else
10612     AC_MSG_RESULT([internal])
10613     BUILD_TYPE="$BUILD_TYPE GLM"
10614     SYSTEM_GLM=
10615     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10617 AC_SUBST([GLM_CFLAGS])
10618 AC_SUBST([SYSTEM_GLM])
10620 dnl ===================================================================
10621 dnl Check for system odbc
10622 dnl ===================================================================
10623 AC_MSG_CHECKING([which odbc headers to use])
10624 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
10625     AC_MSG_RESULT([external])
10626     SYSTEM_ODBC_HEADERS=TRUE
10628     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10629         save_CPPFLAGS=$CPPFLAGS
10630         find_winsdk
10631         PathFormat "$winsdktest"
10632         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"
10633         AC_CHECK_HEADER(sqlext.h, [],
10634             [AC_MSG_ERROR(odbc not found. install odbc)],
10635             [#include <windows.h>])
10636         CPPFLAGS=$save_CPPFLAGS
10637     else
10638         AC_CHECK_HEADER(sqlext.h, [],
10639             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10640     fi
10641 elif test "$enable_database_connectivity" = no; then
10642     AC_MSG_RESULT([none])
10643 else
10644     AC_MSG_RESULT([internal])
10645     SYSTEM_ODBC_HEADERS=
10647 AC_SUBST(SYSTEM_ODBC_HEADERS)
10649 dnl ===================================================================
10650 dnl Check for system NSS
10651 dnl ===================================================================
10652 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10653     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10654     AC_DEFINE(HAVE_FEATURE_NSS)
10655     ENABLE_NSS=TRUE
10656 elif test $_os != iOS ; then
10657     with_tls=openssl
10659 AC_SUBST(ENABLE_NSS)
10661 dnl ===================================================================
10662 dnl Enable LDAP support
10663 dnl ===================================================================
10665 if test "$test_openldap" = yes; then
10666     AC_MSG_CHECKING([whether to enable LDAP support])
10667     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10668         AC_MSG_RESULT([yes])
10669         ENABLE_LDAP=TRUE
10670     else
10671         if test "$enable_ldap" != "yes"; then
10672             AC_MSG_RESULT([no])
10673         else
10674             AC_MSG_RESULT([no (needs NSS or system openldap)])
10675         fi
10676     fi
10678 dnl ===================================================================
10679 dnl Check for system openldap
10680 dnl ===================================================================
10682     if test "$ENABLE_LDAP" = TRUE; then
10683         AC_MSG_CHECKING([which openldap library to use])
10684         if test "$with_system_openldap" = yes; then
10685             AC_MSG_RESULT([external])
10686             SYSTEM_OPENLDAP=TRUE
10687             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10688             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10689             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10690         else
10691             AC_MSG_RESULT([internal])
10692             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10693         fi
10694     fi
10697 AC_SUBST(ENABLE_LDAP)
10698 AC_SUBST(SYSTEM_OPENLDAP)
10700 dnl ===================================================================
10701 dnl Check for TLS/SSL and cryptographic implementation to use
10702 dnl ===================================================================
10703 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10704 if test -n "$with_tls"; then
10705     case $with_tls in
10706     openssl)
10707         AC_DEFINE(USE_TLS_OPENSSL)
10708         TLS=OPENSSL
10709         AC_MSG_RESULT([$TLS])
10711         if test "$enable_openssl" != "yes"; then
10712             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10713         fi
10715         # warn that OpenSSL has been selected but not all TLS code has this option
10716         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10717         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10718         ;;
10719     nss)
10720         AC_DEFINE(USE_TLS_NSS)
10721         TLS=NSS
10722         AC_MSG_RESULT([$TLS])
10723         ;;
10724     no)
10725         AC_MSG_RESULT([none])
10726         AC_MSG_WARN([Skipping TLS/SSL])
10727         ;;
10728     *)
10729         AC_MSG_RESULT([])
10730         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10731 openssl - OpenSSL
10732 nss - Mozilla's Network Security Services (NSS)
10733     ])
10734         ;;
10735     esac
10736 else
10737     # default to using NSS, it results in smaller oox lib
10738     AC_DEFINE(USE_TLS_NSS)
10739     TLS=NSS
10740     AC_MSG_RESULT([$TLS])
10742 AC_SUBST(TLS)
10744 dnl ===================================================================
10745 dnl Check for system sane
10746 dnl ===================================================================
10747 AC_MSG_CHECKING([which sane header to use])
10748 if test "$with_system_sane" = "yes"; then
10749     AC_MSG_RESULT([external])
10750     AC_CHECK_HEADER(sane/sane.h, [],
10751       [AC_MSG_ERROR(sane not found. install sane)], [])
10752 else
10753     AC_MSG_RESULT([internal])
10754     BUILD_TYPE="$BUILD_TYPE SANE"
10757 dnl ===================================================================
10758 dnl Check for system icu
10759 dnl ===================================================================
10760 ICU_MAJOR=72
10761 ICU_MINOR=1
10762 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10763 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10764 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10765 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10766 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10767 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 4.6])
10768 if test "$SYSTEM_ICU" = TRUE; then
10769     AC_LANG_PUSH([C++])
10770     AC_MSG_CHECKING([for unicode/rbbi.h])
10771     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10772     AC_LANG_POP([C++])
10774     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10775     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10776     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10778     if test "$ICU_MAJOR" -ge 50; then
10779         AC_MSG_NOTICE([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10780         ICU_MINOR=
10781     fi
10783     if test "$CROSS_COMPILING" != TRUE; then
10784         # using the system icu tools can lead to version confusion, use the
10785         # ones from the build environment when cross-compiling
10786         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10787         if test -z "$SYSTEM_GENBRK"; then
10788             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10789         fi
10790         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10791         if test -z "$SYSTEM_GENCCODE"; then
10792             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10793         fi
10794         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10795         if test -z "$SYSTEM_GENCMN"; then
10796             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10797         fi
10798         if test "$ICU_MAJOR" -lt 49; then
10799             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10800             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10801             ICU_RECLASSIFIED_HEBREW_LETTER=
10802         fi
10803     fi
10805 if test "$ICU_MAJOR" -ge "59"; then
10806     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10807     # with -std=c++11 but not all external libraries can be built with that,
10808     # for those use a bit-compatible typedef uint16_t UChar; see
10809     # icu/source/common/unicode/umachine.h
10810     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10811 else
10812     ICU_UCHAR_TYPE=""
10814 AC_SUBST(SYSTEM_GENBRK)
10815 AC_SUBST(SYSTEM_GENCCODE)
10816 AC_SUBST(SYSTEM_GENCMN)
10817 AC_SUBST(ICU_MAJOR)
10818 AC_SUBST(ICU_MINOR)
10819 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10820 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10821 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10822 AC_SUBST(ICU_UCHAR_TYPE)
10824 dnl ==================================================================
10825 dnl Breakpad
10826 dnl ==================================================================
10827 DEFAULT_CRASHDUMP_VALUE="true"
10828 AC_MSG_CHECKING([whether to enable breakpad])
10829 if test "$enable_breakpad" != yes; then
10830     AC_MSG_RESULT([no])
10831 else
10832     AC_MSG_RESULT([yes])
10833     ENABLE_BREAKPAD="TRUE"
10834     AC_DEFINE(ENABLE_BREAKPAD)
10835     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10836     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10838     AC_MSG_CHECKING([for disable crash dump])
10839     if test "$enable_crashdump" = no; then
10840         DEFAULT_CRASHDUMP_VALUE="false"
10841         AC_MSG_RESULT([yes])
10842     else
10843        AC_MSG_RESULT([no])
10844     fi
10846     AC_MSG_CHECKING([for crashreport config])
10847     if test "$with_symbol_config" = "no"; then
10848         BREAKPAD_SYMBOL_CONFIG="invalid"
10849         AC_MSG_RESULT([no])
10850     else
10851         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10852         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10853         AC_MSG_RESULT([yes])
10854     fi
10855     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10857 AC_SUBST(ENABLE_BREAKPAD)
10858 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10860 dnl ===================================================================
10861 dnl Orcus
10862 dnl ===================================================================
10863 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.17 >= 0.17.2])
10864 if test "$with_system_orcus" != "yes"; then
10865     if test "$SYSTEM_BOOST" = "TRUE"; then
10866         dnl Link with Boost.System
10867         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10868         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10869         dnl in documentation has no effect.
10870         AX_BOOST_SYSTEM
10871     fi
10873 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10874 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10875 AC_SUBST([BOOST_SYSTEM_LIB])
10876 AC_SUBST(SYSTEM_LIBORCUS)
10878 dnl ===================================================================
10879 dnl HarfBuzz
10880 dnl ===================================================================
10882 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10883 GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10884 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10886 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10887 HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10888 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 2.6.0])
10890 if test "$COM" = "MSC"; then # override the above
10891     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10892     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10895 if test "$with_system_harfbuzz" = "yes"; then
10896     if test "$with_system_graphite" = "no"; then
10897         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10898     fi
10899     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10900     save_LIBS="$LIBS"
10901     save_CFLAGS="$CFLAGS"
10902     LIBS="$LIBS $HARFBUZZ_LIBS"
10903     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10904     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10905     LIBS="$save_LIBS"
10906     CFLAGS="$save_CFLAGS"
10907 else
10908     if test "$with_system_graphite" = "yes"; then
10909         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10910     fi
10913 if test "$USING_X11" = TRUE; then
10914     AC_PATH_X
10915     AC_PATH_XTRA
10916     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10918     if test -z "$x_includes"; then
10919         x_includes="default_x_includes"
10920     fi
10921     if test -z "$x_libraries"; then
10922         x_libraries="default_x_libraries"
10923     fi
10924     CFLAGS="$CFLAGS $X_CFLAGS"
10925     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10926     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10927 else
10928     x_includes="no_x_includes"
10929     x_libraries="no_x_libraries"
10932 if test "$USING_X11" = TRUE; then
10933     dnl ===================================================================
10934     dnl Check for extension headers
10935     dnl ===================================================================
10936     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10937      [#include <X11/extensions/shape.h>])
10939     # vcl needs ICE and SM
10940     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10941     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10942         [AC_MSG_ERROR(ICE library not found)])
10943     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10944     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10945         [AC_MSG_ERROR(SM library not found)])
10948 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10949     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10950     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10953 dnl ===================================================================
10954 dnl Check for system Xrender
10955 dnl ===================================================================
10956 AC_MSG_CHECKING([whether to use Xrender])
10957 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10958     AC_MSG_RESULT([yes])
10959     PKG_CHECK_MODULES(XRENDER, xrender)
10960     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10961     FilterLibs "${XRENDER_LIBS}"
10962     XRENDER_LIBS="${filteredlibs}"
10963     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10964       [AC_MSG_ERROR(libXrender not found or functional)], [])
10965     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10966       [AC_MSG_ERROR(Xrender not found. install X)], [])
10967 else
10968     AC_MSG_RESULT([no])
10970 AC_SUBST(XRENDER_CFLAGS)
10971 AC_SUBST(XRENDER_LIBS)
10973 dnl ===================================================================
10974 dnl Check for XRandr
10975 dnl ===================================================================
10976 AC_MSG_CHECKING([whether to enable RandR support])
10977 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10978     AC_MSG_RESULT([yes])
10979     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10980     if test "$ENABLE_RANDR" != "TRUE"; then
10981         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10982                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10983         XRANDR_CFLAGS=" "
10984         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10985           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10986         XRANDR_LIBS="-lXrandr "
10987         ENABLE_RANDR="TRUE"
10988     fi
10989     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10990     FilterLibs "${XRANDR_LIBS}"
10991     XRANDR_LIBS="${filteredlibs}"
10992 else
10993     ENABLE_RANDR=""
10994     AC_MSG_RESULT([no])
10996 AC_SUBST(XRANDR_CFLAGS)
10997 AC_SUBST(XRANDR_LIBS)
10998 AC_SUBST(ENABLE_RANDR)
11000 if test -z "$with_webdav"; then
11001     with_webdav=$test_webdav
11004 AC_MSG_CHECKING([for WebDAV support])
11005 case "$with_webdav" in
11007     AC_MSG_RESULT([no])
11008     WITH_WEBDAV=""
11009     ;;
11011     AC_MSG_RESULT([yes])
11012     # curl is already mandatory (almost) and checked elsewhere
11013     if test "$enable_curl" = "no"; then
11014         AC_MSG_ERROR(["--with-webdav conflicts with --disable-curl"])
11015     fi
11016     WITH_WEBDAV=TRUE
11017     ;;
11018 esac
11019 AC_SUBST(WITH_WEBDAV)
11021 dnl ===================================================================
11022 dnl Check for disabling cve_tests
11023 dnl ===================================================================
11024 AC_MSG_CHECKING([whether to execute CVE tests])
11025 # If not explicitly enabled or disabled, default
11026 if test -z "$enable_cve_tests"; then
11027     case "$OS" in
11028     WNT)
11029         # Default cves off for Windows with its wild and wonderful
11030         # variety of AV software kicking in and panicking
11031         enable_cve_tests=no
11032         ;;
11033     *)
11034         # otherwise yes
11035         enable_cve_tests=yes
11036         ;;
11037     esac
11039 if test "$enable_cve_tests" = "no"; then
11040     AC_MSG_RESULT([no])
11041     DISABLE_CVE_TESTS=TRUE
11042     AC_SUBST(DISABLE_CVE_TESTS)
11043 else
11044     AC_MSG_RESULT([yes])
11047 dnl ===================================================================
11048 dnl Check for system openssl
11049 dnl ===================================================================
11050 ENABLE_OPENSSL=
11051 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11052 if test "$enable_openssl" = "yes"; then
11053     AC_MSG_RESULT([no])
11054     ENABLE_OPENSSL=TRUE
11055     if test "$_os" = Darwin ; then
11056         # OpenSSL is deprecated when building for 10.7 or later.
11057         #
11058         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11059         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11061         with_system_openssl=no
11062         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11063     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11064             && test "$with_system_openssl" != "no"; then
11065         with_system_openssl=yes
11066         SYSTEM_OPENSSL=TRUE
11067         OPENSSL_CFLAGS=
11068         OPENSSL_LIBS="-lssl -lcrypto"
11069     else
11070         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11071     fi
11072     if test "$with_system_openssl" = "yes"; then
11073         AC_MSG_CHECKING([whether openssl supports SHA512])
11074         AC_LANG_PUSH([C])
11075         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11076             SHA512_CTX context;
11077 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11078         AC_LANG_POP(C)
11079     fi
11080 else
11081     AC_MSG_RESULT([yes])
11083     # warn that although OpenSSL is disabled, system libraries may depend on it
11084     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11085     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11088 AC_SUBST([ENABLE_OPENSSL])
11090 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11091     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11092         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11093         enable_cipher_openssl_backend=no
11094     else
11095         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11096     fi
11098 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11099 ENABLE_CIPHER_OPENSSL_BACKEND=
11100 if test "$enable_cipher_openssl_backend" = yes; then
11101     AC_MSG_RESULT([yes])
11102     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11103 else
11104     AC_MSG_RESULT([no])
11106 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11108 dnl ===================================================================
11109 dnl Select the crypto backends used by LO
11110 dnl ===================================================================
11112 if test "$build_crypto" = yes; then
11113     if test "$OS" = WNT; then
11114         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11115         AC_DEFINE([USE_CRYPTO_MSCAPI])
11116     elif test "$ENABLE_NSS" = TRUE; then
11117         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11118         AC_DEFINE([USE_CRYPTO_NSS])
11119     fi
11122 dnl ===================================================================
11123 dnl Check for system redland
11124 dnl ===================================================================
11125 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11126 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11127 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11128 if test "$with_system_redland" = "yes"; then
11129     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11130             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11131 else
11132     RAPTOR_MAJOR="0"
11133     RASQAL_MAJOR="3"
11134     REDLAND_MAJOR="0"
11136 AC_SUBST(RAPTOR_MAJOR)
11137 AC_SUBST(RASQAL_MAJOR)
11138 AC_SUBST(REDLAND_MAJOR)
11140 dnl ===================================================================
11141 dnl Check for system hunspell
11142 dnl ===================================================================
11143 AC_MSG_CHECKING([which libhunspell to use])
11144 if test "$with_system_hunspell" = "yes"; then
11145     AC_MSG_RESULT([external])
11146     SYSTEM_HUNSPELL=TRUE
11147     AC_LANG_PUSH([C++])
11148     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11149     if test "$HUNSPELL_PC" != "TRUE"; then
11150         AC_CHECK_HEADER(hunspell.hxx, [],
11151             [
11152             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11153             [AC_MSG_ERROR(hunspell headers not found.)], [])
11154             ], [])
11155         AC_CHECK_LIB([hunspell], [main], [:],
11156            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11157         HUNSPELL_LIBS=-lhunspell
11158     fi
11159     AC_LANG_POP([C++])
11160     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11161     FilterLibs "${HUNSPELL_LIBS}"
11162     HUNSPELL_LIBS="${filteredlibs}"
11163 else
11164     AC_MSG_RESULT([internal])
11165     SYSTEM_HUNSPELL=
11166     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11167     if test "$COM" = "MSC"; then
11168         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11169     else
11170         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11171     fi
11172     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11174 AC_SUBST(SYSTEM_HUNSPELL)
11175 AC_SUBST(HUNSPELL_CFLAGS)
11176 AC_SUBST(HUNSPELL_LIBS)
11178 dnl ===================================================================
11179 dnl Check for system zxing
11180 dnl ===================================================================
11181 AC_MSG_CHECKING([whether to use zxing])
11182 if test "$enable_zxing" = "no"; then
11183     AC_MSG_RESULT([no])
11184     ENABLE_ZXING=
11185     SYSTEM_ZXING=
11186 else
11187     AC_MSG_RESULT([yes])
11188     ENABLE_ZXING=TRUE
11189     AC_MSG_CHECKING([which libzxing to use])
11190     if test "$with_system_zxing" = "yes"; then
11191         AC_MSG_RESULT([external])
11192         SYSTEM_ZXING=TRUE
11193         ZXING_CFLAGS=
11194         AC_LANG_PUSH([C++])
11195         save_CXXFLAGS=$CXXFLAGS
11196         save_IFS=$IFS
11197         IFS=$P_SEP
11198         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11199             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11200             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11201             dnl unsetting follows the advice at <http://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11202             dnl a=commit;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11203             dnl unsetting IFS."):
11204             IFS=$save_IFS
11205             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11206             dnl ignore them here:
11207             if test -z "$i"; then
11208                 continue
11209             fi
11210             dnl TODO: White space in $i would cause problems:
11211             CXXFLAGS="$save_CXXFLAGS -I$i/ZXing"
11212             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11213                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11214         done
11215         CXXFLAGS=$save_CXXFLAGS
11216         if test -z "$ZXING_CFLAGS"; then
11217             AC_MSG_ERROR(zxing headers not found.)
11218         fi
11219         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11220             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11221             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11222         AC_LANG_POP([C++])
11223         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11224         FilterLibs "${ZXING_LIBS}"
11225         ZXING_LIBS="${filteredlibs}"
11226     else
11227         AC_MSG_RESULT([internal])
11228         SYSTEM_ZXING=
11229         BUILD_TYPE="$BUILD_TYPE ZXING"
11230     fi
11231     if test "$ENABLE_ZXING" = TRUE; then
11232         AC_DEFINE(ENABLE_ZXING)
11233     fi
11235 AC_SUBST(SYSTEM_ZXING)
11236 AC_SUBST(ENABLE_ZXING)
11237 AC_SUBST(ZXING_CFLAGS)
11238 AC_SUBST(ZXING_LIBS)
11240 dnl ===================================================================
11241 dnl Check for system box2d
11242 dnl ===================================================================
11243 AC_MSG_CHECKING([which box2d to use])
11244 if test "$with_system_box2d" = "yes"; then
11245     AC_MSG_RESULT([external])
11246     SYSTEM_BOX2D=TRUE
11247     AC_LANG_PUSH([C++])
11248     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11249         [BOX2D_H_FOUND='FALSE'])
11250     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11251         _BOX2D_LIB=box2d
11252         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11253     else
11254         # fail this. there's no other alternative to check when we are here.
11255         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11256             [AC_MSG_ERROR(box2d headers not found.)])
11257         _BOX2D_LIB=Box2D
11258         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11259     fi
11260     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11261         [ AC_MSG_ERROR(box2d library not found.) ], [])
11262     BOX2D_LIBS=-l$_BOX2D_LIB
11263     AC_LANG_POP([C++])
11264     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11265     FilterLibs "${BOX2D_LIBS}"
11266     BOX2D_LIBS="${filteredlibs}"
11267 else
11268     AC_MSG_RESULT([internal])
11269     SYSTEM_BOX2D=
11270     BUILD_TYPE="$BUILD_TYPE BOX2D"
11272 AC_SUBST(SYSTEM_BOX2D)
11273 AC_SUBST(BOX2D_CFLAGS)
11274 AC_SUBST(BOX2D_LIBS)
11276 dnl ===================================================================
11277 dnl Checking for altlinuxhyph
11278 dnl ===================================================================
11279 AC_MSG_CHECKING([which altlinuxhyph to use])
11280 if test "$with_system_altlinuxhyph" = "yes"; then
11281     AC_MSG_RESULT([external])
11282     SYSTEM_HYPH=TRUE
11283     AC_CHECK_HEADER(hyphen.h, [],
11284        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11285     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11286        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11287        [#include <hyphen.h>])
11288     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11289         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11290     if test -z "$HYPHEN_LIB"; then
11291         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11292            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11293     fi
11294     if test -z "$HYPHEN_LIB"; then
11295         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11296            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11297     fi
11298 else
11299     AC_MSG_RESULT([internal])
11300     SYSTEM_HYPH=
11301     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11302     if test "$COM" = "MSC"; then
11303         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11304     else
11305         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11306     fi
11308 AC_SUBST(SYSTEM_HYPH)
11309 AC_SUBST(HYPHEN_LIB)
11311 dnl ===================================================================
11312 dnl Checking for mythes
11313 dnl ===================================================================
11314 AC_MSG_CHECKING([which mythes to use])
11315 if test "$with_system_mythes" = "yes"; then
11316     AC_MSG_RESULT([external])
11317     SYSTEM_MYTHES=TRUE
11318     AC_LANG_PUSH([C++])
11319     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11320     if test "$MYTHES_PKGCONFIG" = "no"; then
11321         AC_CHECK_HEADER(mythes.hxx, [],
11322             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11323         AC_CHECK_LIB([mythes-1.2], [main], [:],
11324             [ MYTHES_FOUND=no], [])
11325     if test "$MYTHES_FOUND" = "no"; then
11326         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11327                 [ MYTHES_FOUND=no], [])
11328     fi
11329     if test "$MYTHES_FOUND" = "no"; then
11330         AC_MSG_ERROR([mythes library not found!.])
11331     fi
11332     fi
11333     AC_LANG_POP([C++])
11334     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11335     FilterLibs "${MYTHES_LIBS}"
11336     MYTHES_LIBS="${filteredlibs}"
11337 else
11338     AC_MSG_RESULT([internal])
11339     SYSTEM_MYTHES=
11340     BUILD_TYPE="$BUILD_TYPE MYTHES"
11341     if test "$COM" = "MSC"; then
11342         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11343     else
11344         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11345     fi
11347 AC_SUBST(SYSTEM_MYTHES)
11348 AC_SUBST(MYTHES_CFLAGS)
11349 AC_SUBST(MYTHES_LIBS)
11351 dnl ===================================================================
11352 dnl How should we build the linear programming solver ?
11353 dnl ===================================================================
11355 ENABLE_COINMP=
11356 AC_MSG_CHECKING([whether to build with CoinMP])
11357 if test "$enable_coinmp" != "no"; then
11358     ENABLE_COINMP=TRUE
11359     AC_MSG_RESULT([yes])
11360     if test "$with_system_coinmp" = "yes"; then
11361         SYSTEM_COINMP=TRUE
11362         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11363         FilterLibs "${COINMP_LIBS}"
11364         COINMP_LIBS="${filteredlibs}"
11365     else
11366         BUILD_TYPE="$BUILD_TYPE COINMP"
11367     fi
11368 else
11369     AC_MSG_RESULT([no])
11371 AC_SUBST(ENABLE_COINMP)
11372 AC_SUBST(SYSTEM_COINMP)
11373 AC_SUBST(COINMP_CFLAGS)
11374 AC_SUBST(COINMP_LIBS)
11376 ENABLE_LPSOLVE=
11377 AC_MSG_CHECKING([whether to build with lpsolve])
11378 if test "$enable_lpsolve" != "no"; then
11379     ENABLE_LPSOLVE=TRUE
11380     AC_MSG_RESULT([yes])
11381 else
11382     AC_MSG_RESULT([no])
11384 AC_SUBST(ENABLE_LPSOLVE)
11386 if test "$ENABLE_LPSOLVE" = TRUE; then
11387     AC_MSG_CHECKING([which lpsolve to use])
11388     if test "$with_system_lpsolve" = "yes"; then
11389         AC_MSG_RESULT([external])
11390         SYSTEM_LPSOLVE=TRUE
11391         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11392            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11393         save_LIBS=$LIBS
11394         # some systems need this. Like Ubuntu...
11395         AC_CHECK_LIB(m, floor)
11396         AC_CHECK_LIB(dl, dlopen)
11397         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11398             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11399         LIBS=$save_LIBS
11400     else
11401         AC_MSG_RESULT([internal])
11402         SYSTEM_LPSOLVE=
11403         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11404     fi
11406 AC_SUBST(SYSTEM_LPSOLVE)
11408 dnl ===================================================================
11409 dnl Checking for libexttextcat
11410 dnl ===================================================================
11411 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11412 if test "$with_system_libexttextcat" = "yes"; then
11413     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11415 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11417 dnl ===================================================================
11418 dnl Checking for libnumbertext
11419 dnl ===================================================================
11420 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11421 if test "$with_system_libnumbertext" = "yes"; then
11422     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11423     SYSTEM_LIBNUMBERTEXT=YES
11424 else
11425     SYSTEM_LIBNUMBERTEXT=
11427 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11428 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11430 dnl ***************************************
11431 dnl testing libc version for Linux...
11432 dnl ***************************************
11433 if test "$_os" = "Linux"; then
11434     AC_MSG_CHECKING([whether the libc is recent enough])
11435     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11436     #include <features.h>
11437     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11438     #error glibc >= 2.1 is required
11439     #endif
11440     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11443 dnl =========================================
11444 dnl Check for uuidgen
11445 dnl =========================================
11446 if test "$_os" = "WINNT"; then
11447     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11448     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11449     UUIDGEN=uuidgen.exe
11450     AC_SUBST(UUIDGEN)
11451 else
11452     AC_PATH_PROG([UUIDGEN], [uuidgen])
11453     if test -z "$UUIDGEN"; then
11454         AC_MSG_WARN([uuid is needed for building installation sets])
11455     fi
11458 dnl ***************************************
11459 dnl Checking for bison and flex
11460 dnl ***************************************
11461 AC_PATH_PROG(BISON, bison)
11462 if test -z "$BISON"; then
11463     AC_MSG_ERROR([no bison found in \$PATH, install it])
11464 else
11465     AC_MSG_CHECKING([the bison version])
11466     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11467     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11468     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11469     dnl cause
11470     dnl
11471     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]
11472     dnl   typedef union YYSTYPE
11473     dnl           ~~~~~~^~~~~~~
11474     dnl
11475     dnl while at least 3.4.1 is know to be good:
11476     if test "$COMPILER_PLUGINS" = TRUE; then
11477         if test "$_bison_longver" -lt 2004; then
11478             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11479         fi
11480     else
11481         if test "$_bison_longver" -lt 2000; then
11482             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11483         fi
11484     fi
11486 AC_SUBST([BISON])
11488 AC_PATH_PROG(FLEX, flex)
11489 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11490     FLEX=`cygpath -m $FLEX`
11492 if test -z "$FLEX"; then
11493     AC_MSG_ERROR([no flex found in \$PATH, install it])
11494 else
11495     AC_MSG_CHECKING([the flex version])
11496     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11497     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11498         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11499     fi
11501 AC_SUBST([FLEX])
11503 AC_PATH_PROG(DIFF, diff)
11504 if test -z "$DIFF"; then
11505     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11507 AC_SUBST([DIFF])
11509 AC_PATH_PROG(UNIQ, uniq)
11510 if test -z "$UNIQ"; then
11511     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11513 AC_SUBST([UNIQ])
11515 dnl ***************************************
11516 dnl Checking for patch
11517 dnl ***************************************
11518 AC_PATH_PROG(PATCH, patch)
11519 if test -z "$PATCH"; then
11520     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11523 dnl On Solaris or macOS, check if --with-gnu-patch was used
11524 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11525     if test -z "$with_gnu_patch"; then
11526         GNUPATCH=$PATCH
11527     else
11528         if test -x "$with_gnu_patch"; then
11529             GNUPATCH=$with_gnu_patch
11530         else
11531             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11532         fi
11533     fi
11535     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11536     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11537         AC_MSG_RESULT([yes])
11538     else
11539         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11540             AC_MSG_RESULT([no, but accepted (Apple patch)])
11541             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11542         else
11543             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11544         fi
11545     fi
11546 else
11547     GNUPATCH=$PATCH
11550 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11551     GNUPATCH=`cygpath -m $GNUPATCH`
11554 dnl We also need to check for --with-gnu-cp
11556 if test -z "$with_gnu_cp"; then
11557     # check the place where the good stuff is hidden on Solaris...
11558     if test -x /usr/gnu/bin/cp; then
11559         GNUCP=/usr/gnu/bin/cp
11560     else
11561         AC_PATH_PROGS(GNUCP, gnucp cp)
11562     fi
11563     if test -z $GNUCP; then
11564         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11565     fi
11566 else
11567     if test -x "$with_gnu_cp"; then
11568         GNUCP=$with_gnu_cp
11569     else
11570         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11571     fi
11574 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11575     GNUCP=`cygpath -m $GNUCP`
11578 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11579 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11580     AC_MSG_RESULT([yes])
11581 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11582     AC_MSG_RESULT([yes])
11583 else
11584     case "$build_os" in
11585     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11586         x_GNUCP=[\#]
11587         GNUCP=''
11588         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11589         ;;
11590     *)
11591         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11592         ;;
11593     esac
11596 AC_SUBST(GNUPATCH)
11597 AC_SUBST(GNUCP)
11598 AC_SUBST(x_GNUCP)
11600 dnl ***************************************
11601 dnl testing assembler path
11602 dnl ***************************************
11603 ML_EXE=""
11604 if test "$_os" = "WINNT"; then
11605     case "$WIN_HOST_ARCH" in
11606     x86) assembler=ml.exe ;;
11607     x64) assembler=ml64.exe ;;
11608     arm64) assembler=armasm64.exe ;;
11609     esac
11611     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11612     if test -f "$MSVC_HOST_PATH/$assembler"; then
11613         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11614         AC_MSG_RESULT([$ML_EXE])
11615     else
11616         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11617     fi
11620 AC_SUBST(ML_EXE)
11622 dnl ===================================================================
11623 dnl We need zip and unzip
11624 dnl ===================================================================
11625 AC_PATH_PROG(ZIP, zip)
11626 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11627 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11628     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],,)
11631 AC_PATH_PROG(UNZIP, unzip)
11632 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11634 dnl ===================================================================
11635 dnl Zip must be a specific type for different build types.
11636 dnl ===================================================================
11637 if test $build_os = cygwin; then
11638     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11639         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11640     fi
11643 dnl ===================================================================
11644 dnl We need touch with -h option support.
11645 dnl ===================================================================
11646 AC_PATH_PROG(TOUCH, touch)
11647 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11648 touch "$WARNINGS_FILE"
11649 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11650     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],,)
11653 dnl ===================================================================
11654 dnl Check for system epoxy
11655 dnl ===================================================================
11656 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11657 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11659 dnl ===================================================================
11660 dnl Set vcl option: coordinate device in double or sal_Int32
11661 dnl ===================================================================
11663 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11664 if test "$enable_float_device_pixel" = yes; then
11665     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11666     AC_MSG_RESULT([double])
11667 else
11668     AC_MSG_RESULT([sal_Int32])
11671 dnl ===================================================================
11672 dnl Show which vclplugs will be built.
11673 dnl ===================================================================
11674 R=""
11676 libo_ENABLE_VCLPLUG([gen])
11677 libo_ENABLE_VCLPLUG([gtk3])
11678 libo_ENABLE_VCLPLUG([gtk3_kde5])
11679 libo_ENABLE_VCLPLUG([gtk4])
11680 libo_ENABLE_VCLPLUG([kf5])
11681 libo_ENABLE_VCLPLUG([qt5])
11682 libo_ENABLE_VCLPLUG([qt6])
11684 if test "$_os" = "WINNT"; then
11685     R="$R win"
11686 elif test "$_os" = "Darwin"; then
11687     R="$R osx"
11688 elif test "$_os" = "iOS"; then
11689     R="ios"
11690 elif test "$_os" = Android; then
11691     R="android"
11694 build_vcl_plugins="$R"
11695 if test -z "$build_vcl_plugins"; then
11696     build_vcl_plugins=" none"
11698 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11699 VCL_PLUGIN_INFO=$R
11700 AC_SUBST([VCL_PLUGIN_INFO])
11702 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11703     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11706 dnl ===================================================================
11707 dnl Check for GTK libraries
11708 dnl ===================================================================
11710 GTK3_CFLAGS=""
11711 GTK3_LIBS=""
11712 ENABLE_GTKTILEDVIEWER=""
11713 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11714     if test "$with_system_cairo" = no; then
11715         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.'
11716     fi
11717     : ${with_system_cairo:=yes}
11718     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)
11719     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11720     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11721     FilterLibs "${GTK3_LIBS}"
11722     GTK3_LIBS="${filteredlibs}"
11724     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11725     if test "$with_system_epoxy" != "yes"; then
11726         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11727         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11728                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11729     fi
11730 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
11731     PathFormat "${with_gtk3_build}/lib/pkgconfig"
11732     if test "$build_os" = "cygwin"; then
11733         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
11734         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
11735     fi
11737     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
11738     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
11739     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11740     FilterLibs "${GTK3_LIBS}"
11741     GTK3_LIBS="${filteredlibs}"
11742     ENABLE_GTKTILEDVIEWER="yes"
11744 AC_SUBST(GTK3_LIBS)
11745 AC_SUBST(GTK3_CFLAGS)
11746 AC_SUBST(ENABLE_GTKTILEDVIEWER)
11748 GTK4_CFLAGS=""
11749 GTK4_LIBS=""
11750 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11751     if test "$with_system_cairo" = no; then
11752         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11753     fi
11754     : ${with_system_cairo:=yes}
11755     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11756     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11757     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11758     FilterLibs "${GTK4_LIBS}"
11759     GTK4_LIBS="${filteredlibs}"
11761     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11762     if test "$with_system_epoxy" != "yes"; then
11763         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11764         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11765                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11766     fi
11768 AC_SUBST(GTK4_LIBS)
11769 AC_SUBST(GTK4_CFLAGS)
11771 if test "$enable_introspection" = yes; then
11772     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11773         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11774     else
11775         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11776     fi
11779 dnl ===================================================================
11780 dnl check for dbus support
11781 dnl ===================================================================
11782 ENABLE_DBUS=""
11783 DBUS_CFLAGS=""
11784 DBUS_LIBS=""
11785 DBUS_GLIB_CFLAGS=""
11786 DBUS_GLIB_LIBS=""
11787 DBUS_HAVE_GLIB=""
11789 if test "$enable_dbus" = "no"; then
11790     test_dbus=no
11793 AC_MSG_CHECKING([whether to enable DBUS support])
11794 if test "$test_dbus" = "yes"; then
11795     ENABLE_DBUS="TRUE"
11796     AC_MSG_RESULT([yes])
11797     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11798     AC_DEFINE(ENABLE_DBUS)
11799     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11800     FilterLibs "${DBUS_LIBS}"
11801     DBUS_LIBS="${filteredlibs}"
11803     # Glib is needed for BluetoothServer
11804     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11805     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11806         [
11807             DBUS_HAVE_GLIB="TRUE"
11808             AC_DEFINE(DBUS_HAVE_GLIB,1)
11809         ],
11810         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11811     )
11812 else
11813     AC_MSG_RESULT([no])
11816 AC_SUBST(ENABLE_DBUS)
11817 AC_SUBST(DBUS_CFLAGS)
11818 AC_SUBST(DBUS_LIBS)
11819 AC_SUBST(DBUS_GLIB_CFLAGS)
11820 AC_SUBST(DBUS_GLIB_LIBS)
11821 AC_SUBST(DBUS_HAVE_GLIB)
11823 AC_MSG_CHECKING([whether to enable Impress remote control])
11824 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11825     AC_MSG_RESULT([yes])
11826     ENABLE_SDREMOTE=TRUE
11827     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
11828         <true/>"
11829     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11831     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11832         # The Bluetooth code doesn't compile with macOS SDK 10.15
11833         if test "$enable_sdremote_bluetooth" = yes; then
11834             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11835         fi
11836         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
11837         enable_sdremote_bluetooth=no
11838     fi
11839     # If not explicitly enabled or disabled, default
11840     if test -z "$enable_sdremote_bluetooth"; then
11841         case "$OS" in
11842         LINUX|MACOSX|WNT)
11843             # Default to yes for these
11844             enable_sdremote_bluetooth=yes
11845             ;;
11846         *)
11847             # otherwise no
11848             enable_sdremote_bluetooth=no
11849             ;;
11850         esac
11851     fi
11852     # $enable_sdremote_bluetooth is guaranteed non-empty now
11854     if test "$enable_sdremote_bluetooth" != "no"; then
11855         if test "$OS" = "LINUX"; then
11856             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11857                 AC_MSG_RESULT([yes])
11858                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11859                 dnl ===================================================================
11860                 dnl Check for system bluez
11861                 dnl ===================================================================
11862                 AC_MSG_CHECKING([which Bluetooth header to use])
11863                 if test "$with_system_bluez" = "yes"; then
11864                     AC_MSG_RESULT([external])
11865                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11866                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11867                     SYSTEM_BLUEZ=TRUE
11868                 else
11869                     AC_MSG_RESULT([internal])
11870                     SYSTEM_BLUEZ=
11871                 fi
11872             else
11873                 AC_MSG_RESULT([no, dbus disabled])
11874                 ENABLE_SDREMOTE_BLUETOOTH=
11875                 SYSTEM_BLUEZ=
11876             fi
11877         else
11878             AC_MSG_RESULT([yes])
11879             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11880             SYSTEM_BLUEZ=
11881             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
11882         <key>com.apple.security.device.bluetooth</key>
11883         <true/>"
11884         fi
11885     else
11886         AC_MSG_RESULT([no])
11887         ENABLE_SDREMOTE_BLUETOOTH=
11888         SYSTEM_BLUEZ=
11889     fi
11890 else
11891     ENABLE_SDREMOTE=
11892     SYSTEM_BLUEZ=
11893     AC_MSG_RESULT([no])
11895 AC_SUBST(ENABLE_SDREMOTE)
11896 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11897 AC_SUBST(SDREMOTE_ENTITLEMENT)
11898 AC_SUBST(SYSTEM_BLUEZ)
11900 dnl ===================================================================
11901 dnl Check whether to enable GIO support
11902 dnl ===================================================================
11903 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11904     AC_MSG_CHECKING([whether to enable GIO support])
11905     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11906         dnl Need at least 2.26 for the dbus support.
11907         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11908                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11909         if test "$ENABLE_GIO" = "TRUE"; then
11910             AC_DEFINE(ENABLE_GIO)
11911             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11912             FilterLibs "${GIO_LIBS}"
11913             GIO_LIBS="${filteredlibs}"
11914         fi
11915     else
11916         AC_MSG_RESULT([no])
11917     fi
11919 AC_SUBST(ENABLE_GIO)
11920 AC_SUBST(GIO_CFLAGS)
11921 AC_SUBST(GIO_LIBS)
11924 dnl ===================================================================
11926 SPLIT_APP_MODULES=""
11927 if test "$enable_split_app_modules" = "yes"; then
11928     SPLIT_APP_MODULES="TRUE"
11930 AC_SUBST(SPLIT_APP_MODULES)
11932 SPLIT_OPT_FEATURES=""
11933 if test "$enable_split_opt_features" = "yes"; then
11934     SPLIT_OPT_FEATURES="TRUE"
11936 AC_SUBST(SPLIT_OPT_FEATURES)
11938 dnl ===================================================================
11939 dnl Check whether the GStreamer libraries are available.
11940 dnl ===================================================================
11942 ENABLE_GSTREAMER_1_0=""
11944 if test "$test_gstreamer_1_0" = yes; then
11946     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11947     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11948         ENABLE_GSTREAMER_1_0="TRUE"
11949         AC_MSG_RESULT([yes])
11950         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11951         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11952         FilterLibs "${GSTREAMER_1_0_LIBS}"
11953         GSTREAMER_1_0_LIBS="${filteredlibs}"
11954         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11955     else
11956         AC_MSG_RESULT([no])
11957     fi
11959 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11960 AC_SUBST(GSTREAMER_1_0_LIBS)
11961 AC_SUBST(ENABLE_GSTREAMER_1_0)
11963 ENABLE_OPENGL_TRANSITIONS=
11964 ENABLE_OPENGL_CANVAS=
11965 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11966    : # disable
11967 elif test "$_os" = "Darwin"; then
11968     # We use frameworks on macOS, no need for detail checks
11969     ENABLE_OPENGL_TRANSITIONS=TRUE
11970     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11971     ENABLE_OPENGL_CANVAS=TRUE
11972 elif test $_os = WINNT; then
11973     ENABLE_OPENGL_TRANSITIONS=TRUE
11974     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11975     ENABLE_OPENGL_CANVAS=TRUE
11976 else
11977     if test "$USING_X11" = TRUE; then
11978         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11979         ENABLE_OPENGL_TRANSITIONS=TRUE
11980         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11981         ENABLE_OPENGL_CANVAS=TRUE
11982     fi
11985 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11986 AC_SUBST(ENABLE_OPENGL_CANVAS)
11988 dnl =================================================
11989 dnl Check whether to build with OpenCL support.
11990 dnl =================================================
11992 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11993     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11994     # platform (optional at run-time, used through clew).
11995     BUILD_TYPE="$BUILD_TYPE OPENCL"
11996     AC_DEFINE(HAVE_FEATURE_OPENCL)
11999 dnl =================================================
12000 dnl Check whether to build with dconf support.
12001 dnl =================================================
12003 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12004     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
12005         if test "$enable_dconf" = yes; then
12006             AC_MSG_ERROR([dconf not found])
12007         else
12008             enable_dconf=no
12009         fi])
12011 AC_MSG_CHECKING([whether to enable dconf])
12012 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12013     DCONF_CFLAGS=
12014     DCONF_LIBS=
12015     ENABLE_DCONF=
12016     AC_MSG_RESULT([no])
12017 else
12018     ENABLE_DCONF=TRUE
12019     AC_DEFINE(ENABLE_DCONF)
12020     AC_MSG_RESULT([yes])
12022 AC_SUBST([DCONF_CFLAGS])
12023 AC_SUBST([DCONF_LIBS])
12024 AC_SUBST([ENABLE_DCONF])
12026 # pdf import?
12027 AC_MSG_CHECKING([whether to build the PDF import feature])
12028 ENABLE_PDFIMPORT=
12029 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12030     AC_MSG_RESULT([yes])
12031     ENABLE_PDFIMPORT=TRUE
12032     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12033 else
12034     AC_MSG_RESULT([no])
12037 # Pdfium?
12038 AC_MSG_CHECKING([whether to build PDFium])
12039 ENABLE_PDFIUM=
12040 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12041     AC_MSG_RESULT([yes])
12042     ENABLE_PDFIUM=TRUE
12043     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12044 else
12045     AC_MSG_RESULT([no])
12047 AC_SUBST(ENABLE_PDFIUM)
12049 if test "$ENABLE_PDFIUM" = "TRUE"; then
12050     AC_MSG_CHECKING([which OpenJPEG library to use])
12051     if test "$with_system_openjpeg" = "yes"; then
12052         SYSTEM_OPENJPEG2=TRUE
12053         AC_MSG_RESULT([external])
12054         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12055         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12056         FilterLibs "${OPENJPEG2_LIBS}"
12057         OPENJPEG2_LIBS="${filteredlibs}"
12058     else
12059         SYSTEM_OPENJPEG2=FALSE
12060         AC_MSG_RESULT([internal])
12061     fi
12063     AC_MSG_CHECKING([which Abseil library to use])
12064     if test "$with_system_abseil" = "yes"; then
12065         AC_MSG_RESULT([external])
12066         SYSTEM_ABSEIL=TRUE
12067         AC_LANG_PUSH([C++])
12068         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
12069                         [AC_MSG_ERROR(abseil headers not found.)], [])
12070         AC_CHECK_HEADER(absl/types/bad_variant_access.h, [],
12071                         [AC_MSG_ERROR(abseil headers not found.)], [])
12072         AC_CHECK_LIB([absl_bad_optional_access], [main], [],
12073                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
12074         AC_CHECK_LIB([absl_bad_variant_access], [main], [],
12075                      [AC_MSG_ERROR([libabsl_bad_variant_access library not found.])])
12076         ABSEIL_LIBS="-labsl_bad_optional_access -labsl_bad_variant_access"
12077         AC_LANG_POP([C++])
12078         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12079         FilterLibs "${ABSEIL_LIBS}"
12080         ABSEIL_LIBS="${filteredlibs}"
12081     else
12082         AC_MSG_RESULT([internal])
12083     fi
12085 AC_SUBST(SYSTEM_OPENJPEG2)
12086 AC_SUBST(SYSTEM_ABSEIL)
12087 AC_SUBST(ABSEIL_CFLAGS)
12088 AC_SUBST(ABSEIL_LIBS)
12090 dnl ===================================================================
12091 dnl Check for poppler
12092 dnl ===================================================================
12093 ENABLE_POPPLER=
12094 AC_MSG_CHECKING([whether to build Poppler])
12095 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12096     AC_MSG_RESULT([yes])
12097     ENABLE_POPPLER=TRUE
12098     AC_DEFINE(HAVE_FEATURE_POPPLER)
12099 else
12100     AC_MSG_RESULT([no])
12102 AC_SUBST(ENABLE_POPPLER)
12104 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12105     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12108 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12109     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12112 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12113     dnl ===================================================================
12114     dnl Check for system poppler
12115     dnl ===================================================================
12116     AC_MSG_CHECKING([which PDF import poppler to use])
12117     if test "$with_system_poppler" = "yes"; then
12118         AC_MSG_RESULT([external])
12119         SYSTEM_POPPLER=TRUE
12120         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12121         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12122         FilterLibs "${POPPLER_LIBS}"
12123         POPPLER_LIBS="${filteredlibs}"
12124     else
12125         AC_MSG_RESULT([internal])
12126         SYSTEM_POPPLER=
12127         BUILD_TYPE="$BUILD_TYPE POPPLER"
12128     fi
12129     AC_DEFINE([ENABLE_PDFIMPORT],1)
12131 AC_SUBST(ENABLE_PDFIMPORT)
12132 AC_SUBST(SYSTEM_POPPLER)
12133 AC_SUBST(POPPLER_CFLAGS)
12134 AC_SUBST(POPPLER_LIBS)
12136 # Skia?
12137 ENABLE_SKIA=
12138 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12139     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12140     if test "$SYSTEM_FREETYPE" = TRUE; then
12141         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12142             [skia_freetype_ok=yes],
12143             [skia_freetype_ok=no])
12144     else # internal is ok
12145         skia_freetype_ok=yes
12146     fi
12147     AC_MSG_CHECKING([whether to build Skia])
12148     if test "$skia_freetype_ok" = "yes"; then
12149         if test "$enable_skia" = "debug"; then
12150             AC_MSG_RESULT([yes (debug)])
12151             ENABLE_SKIA_DEBUG=TRUE
12152         else
12153             AC_MSG_RESULT([yes])
12154             ENABLE_SKIA_DEBUG=
12155         fi
12156         ENABLE_SKIA=TRUE
12157         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12158                 AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12159         fi
12161         AC_DEFINE(HAVE_FEATURE_SKIA)
12162         BUILD_TYPE="$BUILD_TYPE SKIA"
12164         if test "$OS" = "MACOSX"; then
12165             AC_DEFINE(SK_SUPPORT_GPU,1)
12166             AC_DEFINE(SK_METAL,1)
12167             SKIA_GPU=METAL
12168             AC_SUBST(SKIA_GPU)
12169         else
12170             AC_DEFINE(SK_SUPPORT_GPU,1)
12171             AC_DEFINE(SK_VULKAN,1)
12172             SKIA_GPU=VULKAN
12173             AC_SUBST(SKIA_GPU)
12174         fi
12175     else
12176         AC_MSG_RESULT([no (freetype too old)])
12177         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12178     fi
12180 else
12181     AC_MSG_CHECKING([whether to build Skia])
12182     AC_MSG_RESULT([no])
12184 AC_SUBST(ENABLE_SKIA)
12185 AC_SUBST(ENABLE_SKIA_DEBUG)
12187 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12188 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12189 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12190 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12191 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12192 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12193 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12194 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12195 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12196 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12197 HAVE_LO_CLANG_DLLEXPORTINLINES=
12199 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12200     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12201         AC_MSG_CHECKING([for Clang])
12202         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12203     else
12204         if test "$_os" = "WINNT"; then
12205             AC_MSG_CHECKING([for clang-cl])
12206             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12207                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12208             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12209                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12210             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12211                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12212             fi
12213             if test -n "$LO_CLANG_CC"; then
12214                 dnl explicitly set -m32/-m64
12215                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12216                 LO_CLANG_CXX="$LO_CLANG_CC"
12217                 AC_MSG_RESULT([$LO_CLANG_CC])
12218             else
12219                 AC_MSG_RESULT([no])
12220             fi
12222             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12223             echo "#include <stdlib.h>" > conftest.c
12224             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12225                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12226             rm -f conftest.c conftest.obj
12227             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12228                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12229             else
12230                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12231             fi
12232         else
12233             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12234             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12235         fi
12236     fi
12237     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12238         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12239         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12240         if test "$clang2_ver" -lt 50002; then
12241             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12242             LO_CLANG_CC=
12243             LO_CLANG_CXX=
12244         fi
12245     fi
12246     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12247         save_CXX="$CXX"
12248         CXX="$LO_CLANG_CXX"
12249         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12250         AC_LANG_PUSH([C++])
12251         save_CXXFLAGS=$CXXFLAGS
12252         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12253         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12254                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12255                 AC_MSG_RESULT([yes])
12256             ], [AC_MSG_RESULT([no])])
12257         CXXFLAGS=$save_CXXFLAGS
12258         AC_LANG_POP([C++])
12259         CXX="$save_CXX"
12260         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12261             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.])
12262         fi
12263     fi
12264     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12265         # Skia is the default on Windows and Mac, so hard-require Clang.
12266         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12267         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12268             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12269         else
12270             AC_MSG_WARN([Clang compiler not found.])
12271         fi
12272     else
12274         save_CXX="$CXX"
12275         CXX="$LO_CLANG_CXX"
12276         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12277         flag_sse2=-msse2
12278         flag_ssse3=-mssse3
12279         flag_sse41=-msse4.1
12280         flag_sse42=-msse4.2
12281         flag_avx=-mavx
12282         flag_avx2=-mavx2
12283         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12284         flag_avx512f=-mavx512f
12285         flag_f16c=-mf16c
12286         flag_fma=-mfma
12288         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12289         AC_LANG_PUSH([C++])
12290         save_CXXFLAGS=$CXXFLAGS
12291         CXXFLAGS="$CXXFLAGS $flag_sse2"
12292         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12293             #include <emmintrin.h>
12294             int main () {
12295                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12296                 c = _mm_xor_si128 (a, b);
12297                 return 0;
12298             }
12299             ])],
12300             [can_compile_sse2=yes],
12301             [can_compile_sse2=no])
12302         AC_LANG_POP([C++])
12303         CXXFLAGS=$save_CXXFLAGS
12304         AC_MSG_RESULT([${can_compile_sse2}])
12305         if test "${can_compile_sse2}" = "yes" ; then
12306             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12307         fi
12309         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12310         AC_LANG_PUSH([C++])
12311         save_CXXFLAGS=$CXXFLAGS
12312         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12313         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12314             #include <tmmintrin.h>
12315             int main () {
12316                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12317                 c = _mm_maddubs_epi16 (a, b);
12318                 return 0;
12319             }
12320             ])],
12321             [can_compile_ssse3=yes],
12322             [can_compile_ssse3=no])
12323         AC_LANG_POP([C++])
12324         CXXFLAGS=$save_CXXFLAGS
12325         AC_MSG_RESULT([${can_compile_ssse3}])
12326         if test "${can_compile_ssse3}" = "yes" ; then
12327             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12328         fi
12330         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12331         AC_LANG_PUSH([C++])
12332         save_CXXFLAGS=$CXXFLAGS
12333         CXXFLAGS="$CXXFLAGS $flag_sse41"
12334         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12335             #include <smmintrin.h>
12336             int main () {
12337                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12338                 c = _mm_cmpeq_epi64 (a, b);
12339                 return 0;
12340             }
12341             ])],
12342             [can_compile_sse41=yes],
12343             [can_compile_sse41=no])
12344         AC_LANG_POP([C++])
12345         CXXFLAGS=$save_CXXFLAGS
12346         AC_MSG_RESULT([${can_compile_sse41}])
12347         if test "${can_compile_sse41}" = "yes" ; then
12348             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12349         fi
12351         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12352         AC_LANG_PUSH([C++])
12353         save_CXXFLAGS=$CXXFLAGS
12354         CXXFLAGS="$CXXFLAGS $flag_sse42"
12355         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12356             #include <nmmintrin.h>
12357             int main () {
12358                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12359                 c = _mm_cmpgt_epi64 (a, b);
12360                 return 0;
12361             }
12362             ])],
12363             [can_compile_sse42=yes],
12364             [can_compile_sse42=no])
12365         AC_LANG_POP([C++])
12366         CXXFLAGS=$save_CXXFLAGS
12367         AC_MSG_RESULT([${can_compile_sse42}])
12368         if test "${can_compile_sse42}" = "yes" ; then
12369             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12370         fi
12372         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12373         AC_LANG_PUSH([C++])
12374         save_CXXFLAGS=$CXXFLAGS
12375         CXXFLAGS="$CXXFLAGS $flag_avx"
12376         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12377             #include <immintrin.h>
12378             int main () {
12379                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12380                 c = _mm256_xor_ps(a, b);
12381                 return 0;
12382             }
12383             ])],
12384             [can_compile_avx=yes],
12385             [can_compile_avx=no])
12386         AC_LANG_POP([C++])
12387         CXXFLAGS=$save_CXXFLAGS
12388         AC_MSG_RESULT([${can_compile_avx}])
12389         if test "${can_compile_avx}" = "yes" ; then
12390             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12391         fi
12393         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12394         AC_LANG_PUSH([C++])
12395         save_CXXFLAGS=$CXXFLAGS
12396         CXXFLAGS="$CXXFLAGS $flag_avx2"
12397         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12398             #include <immintrin.h>
12399             int main () {
12400                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12401                 c = _mm256_maddubs_epi16(a, b);
12402                 return 0;
12403             }
12404             ])],
12405             [can_compile_avx2=yes],
12406             [can_compile_avx2=no])
12407         AC_LANG_POP([C++])
12408         CXXFLAGS=$save_CXXFLAGS
12409         AC_MSG_RESULT([${can_compile_avx2}])
12410         if test "${can_compile_avx2}" = "yes" ; then
12411             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12412         fi
12414         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12415         AC_LANG_PUSH([C++])
12416         save_CXXFLAGS=$CXXFLAGS
12417         CXXFLAGS="$CXXFLAGS $flag_avx512"
12418         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12419             #include <immintrin.h>
12420             int main () {
12421                 __m512i a = _mm512_loadu_si512(0);
12422                 __m512d v1 = _mm512_load_pd(0);
12423                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12424                 __m512d v2 = _mm512_abs_pd(v1);
12425                 return 0;
12426             }
12427             ])],
12428             [can_compile_avx512=yes],
12429             [can_compile_avx512=no])
12430         AC_LANG_POP([C++])
12431         CXXFLAGS=$save_CXXFLAGS
12432         AC_MSG_RESULT([${can_compile_avx512}])
12433         if test "${can_compile_avx512}" = "yes" ; then
12434             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12435             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12436         fi
12438         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12439         AC_LANG_PUSH([C++])
12440         save_CXXFLAGS=$CXXFLAGS
12441         CXXFLAGS="$CXXFLAGS $flag_f16c"
12442         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12443             #include <immintrin.h>
12444             int main () {
12445                 __m128i a = _mm_set1_epi32 (0);
12446                 __m128 c;
12447                 c = _mm_cvtph_ps(a);
12448                 return 0;
12449             }
12450             ])],
12451             [can_compile_f16c=yes],
12452             [can_compile_f16c=no])
12453         AC_LANG_POP([C++])
12454         CXXFLAGS=$save_CXXFLAGS
12455         AC_MSG_RESULT([${can_compile_f16c}])
12456         if test "${can_compile_f16c}" = "yes" ; then
12457             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12458         fi
12460         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12461         AC_LANG_PUSH([C++])
12462         save_CXXFLAGS=$CXXFLAGS
12463         CXXFLAGS="$CXXFLAGS $flag_fma"
12464         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12465             #include <immintrin.h>
12466             int main () {
12467                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12468                 d = _mm256_fmadd_ps(a, b, c);
12469                 return 0;
12470             }
12471             ])],
12472             [can_compile_fma=yes],
12473             [can_compile_fma=no])
12474         AC_LANG_POP([C++])
12475         CXXFLAGS=$save_CXXFLAGS
12476         AC_MSG_RESULT([${can_compile_fma}])
12477         if test "${can_compile_fma}" = "yes" ; then
12478             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12479         fi
12481         CXX="$save_CXX"
12482     fi
12485 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12487 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12488     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12489     AC_LANG_PUSH([C])
12490     save_CC="$CC"
12491     CC="$LO_CLANG_CC"
12492     save_CFLAGS=$CFLAGS
12493     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12494     dnl an empty program will do, we're checking the compiler flags
12495     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12496                       [use_ccache=yes], [use_ccache=no])
12497     CFLAGS=$save_CFLAGS
12498     CC=$save_CC
12499     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12500         AC_MSG_RESULT([yes])
12501     else
12502         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12503         AC_MSG_RESULT([no])
12504     fi
12505     AC_LANG_POP([C])
12507     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12508     AC_LANG_PUSH([C++])
12509     save_CXX="$CXX"
12510     CXX="$LO_CLANG_CXX"
12511     save_CXXFLAGS=$CXXFLAGS
12512     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12513     dnl an empty program will do, we're checking the compiler flags
12514     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12515                       [use_ccache=yes], [use_ccache=no])
12516     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12517         AC_MSG_RESULT([yes])
12518     else
12519         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12520         AC_MSG_RESULT([no])
12521     fi
12522     CXXFLAGS=$save_CXXFLAGS
12523     CXX=$save_CXX
12524     AC_LANG_POP([C++])
12527 AC_SUBST(LO_CLANG_CC)
12528 AC_SUBST(LO_CLANG_CXX)
12529 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12530 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12531 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12532 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12533 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12534 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12535 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12536 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12537 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12538 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12539 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12540 AC_SUBST(CLANG_USE_LD)
12541 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12543 SYSTEM_GPGMEPP=
12545 AC_MSG_CHECKING([whether to enable gpgmepp])
12546 if test "$enable_gpgmepp" = no; then
12547     AC_MSG_RESULT([no])
12548 elif test "$enable_mpl_subset" = "yes"; then
12549     AC_MSG_RESULT([no (MPL only])
12550 elif test "$enable_fuzzers" = "yes"; then
12551     AC_MSG_RESULT([no (oss-fuzz)])
12552 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12553     AC_MSG_RESULT([yes])
12554     dnl ===================================================================
12555     dnl Check for system gpgme
12556     dnl ===================================================================
12557     AC_MSG_CHECKING([which gpgmepp to use])
12558     if test "$with_system_gpgmepp" = "yes"; then
12559         AC_MSG_RESULT([external])
12560         SYSTEM_GPGMEPP=TRUE
12562         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12563         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12564             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12565         AC_CHECK_HEADER(gpgme.h, [],
12566             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12567         AC_CHECK_LIB(gpgmepp, main, [],
12568             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12569         GPGMEPP_LIBS=-lgpgmepp
12570     else
12571         AC_MSG_RESULT([internal])
12572         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12574         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12575         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12576         if test "$_os" != "WINNT"; then
12577             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12578             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12579         fi
12580     fi
12581     ENABLE_GPGMEPP=TRUE
12582     AC_DEFINE([HAVE_FEATURE_GPGME])
12583     AC_PATH_PROG(GPG, gpg)
12584     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12585     # so let's exclude that manually for the moment
12586     if test -n "$GPG" -a "$_os" != "WINNT"; then
12587         # make sure we not only have a working gpgme, but a full working
12588         # gpg installation to run OpenPGP signature verification
12589         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12590     fi
12591     if test "$_os" = "Linux"; then
12592       uid=`id -u`
12593       AC_MSG_CHECKING([for /run/user/$uid])
12594       if test -d /run/user/$uid; then
12595         AC_MSG_RESULT([yes])
12596         AC_PATH_PROG(GPGCONF, gpgconf)
12598         # Older versions of gpgconf are not working as expected, since
12599         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12600         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12601         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12602         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12603         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12604         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12605         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12606           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12607           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12608           if $GPGCONF --dump-options > /dev/null ; then
12609             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12610               AC_MSG_RESULT([yes])
12611               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12612               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12613             else
12614               AC_MSG_RESULT([no])
12615             fi
12616           else
12617             AC_MSG_RESULT([no. missing or broken gpgconf?])
12618           fi
12619         else
12620           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12621         fi
12622       else
12623         AC_MSG_RESULT([no])
12624      fi
12625    fi
12626 else
12627     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12629 AC_SUBST(ENABLE_GPGMEPP)
12630 AC_SUBST(SYSTEM_GPGMEPP)
12631 AC_SUBST(GPG_ERROR_CFLAGS)
12632 AC_SUBST(GPG_ERROR_LIBS)
12633 AC_SUBST(LIBASSUAN_CFLAGS)
12634 AC_SUBST(LIBASSUAN_LIBS)
12635 AC_SUBST(GPGMEPP_CFLAGS)
12636 AC_SUBST(GPGMEPP_LIBS)
12638 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12639 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12640     AC_MSG_RESULT([yes])
12641     ENABLE_MEDIAWIKI=TRUE
12642     BUILD_TYPE="$BUILD_TYPE XSLTML"
12643     if test  "x$with_java" = "xno"; then
12644         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12645     fi
12646 else
12647     AC_MSG_RESULT([no])
12648     ENABLE_MEDIAWIKI=
12649     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12651 AC_SUBST(ENABLE_MEDIAWIKI)
12653 AC_MSG_CHECKING([whether to build the Report Builder])
12654 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12655     AC_MSG_RESULT([yes])
12656     ENABLE_REPORTBUILDER=TRUE
12657     AC_MSG_CHECKING([which jfreereport libs to use])
12658     if test "$with_system_jfreereport" = "yes"; then
12659         SYSTEM_JFREEREPORT=TRUE
12660         AC_MSG_RESULT([external])
12661         if test -z $SAC_JAR; then
12662             SAC_JAR=/usr/share/java/sac.jar
12663         fi
12664         if ! test -f $SAC_JAR; then
12665              AC_MSG_ERROR(sac.jar not found.)
12666         fi
12668         if test -z $LIBXML_JAR; then
12669             if test -f /usr/share/java/libxml-1.0.0.jar; then
12670                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12671             elif test -f /usr/share/java/libxml.jar; then
12672                 LIBXML_JAR=/usr/share/java/libxml.jar
12673             else
12674                 AC_MSG_ERROR(libxml.jar replacement not found.)
12675             fi
12676         elif ! test -f $LIBXML_JAR; then
12677             AC_MSG_ERROR(libxml.jar not found.)
12678         fi
12680         if test -z $FLUTE_JAR; then
12681             if test -f /usr/share/java/flute-1.3.0.jar; then
12682                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12683             elif test -f /usr/share/java/flute.jar; then
12684                 FLUTE_JAR=/usr/share/java/flute.jar
12685             else
12686                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12687             fi
12688         elif ! test -f $FLUTE_JAR; then
12689             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12690         fi
12692         if test -z $JFREEREPORT_JAR; then
12693             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12694                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12695             elif test -f /usr/share/java/flow-engine.jar; then
12696                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12697             else
12698                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12699             fi
12700         elif ! test -f  $JFREEREPORT_JAR; then
12701                 AC_MSG_ERROR(jfreereport.jar not found.)
12702         fi
12704         if test -z $LIBLAYOUT_JAR; then
12705             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12706                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12707             elif test -f /usr/share/java/liblayout.jar; then
12708                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12709             else
12710                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12711             fi
12712         elif ! test -f $LIBLAYOUT_JAR; then
12713                 AC_MSG_ERROR(liblayout.jar not found.)
12714         fi
12716         if test -z $LIBLOADER_JAR; then
12717             if test -f /usr/share/java/libloader-1.0.0.jar; then
12718                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12719             elif test -f /usr/share/java/libloader.jar; then
12720                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12721             else
12722                 AC_MSG_ERROR(libloader.jar replacement not found.)
12723             fi
12724         elif ! test -f  $LIBLOADER_JAR; then
12725             AC_MSG_ERROR(libloader.jar not found.)
12726         fi
12728         if test -z $LIBFORMULA_JAR; then
12729             if test -f /usr/share/java/libformula-0.2.0.jar; then
12730                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12731             elif test -f /usr/share/java/libformula.jar; then
12732                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12733             else
12734                 AC_MSG_ERROR(libformula.jar replacement not found.)
12735             fi
12736         elif ! test -f $LIBFORMULA_JAR; then
12737                 AC_MSG_ERROR(libformula.jar not found.)
12738         fi
12740         if test -z $LIBREPOSITORY_JAR; then
12741             if test -f /usr/share/java/librepository-1.0.0.jar; then
12742                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12743             elif test -f /usr/share/java/librepository.jar; then
12744                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12745             else
12746                 AC_MSG_ERROR(librepository.jar replacement not found.)
12747             fi
12748         elif ! test -f $LIBREPOSITORY_JAR; then
12749             AC_MSG_ERROR(librepository.jar not found.)
12750         fi
12752         if test -z $LIBFONTS_JAR; then
12753             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12754                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12755             elif test -f /usr/share/java/libfonts.jar; then
12756                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12757             else
12758                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12759             fi
12760         elif ! test -f $LIBFONTS_JAR; then
12761                 AC_MSG_ERROR(libfonts.jar not found.)
12762         fi
12764         if test -z $LIBSERIALIZER_JAR; then
12765             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12766                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12767             elif test -f /usr/share/java/libserializer.jar; then
12768                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12769             else
12770                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12771             fi
12772         elif ! test -f $LIBSERIALIZER_JAR; then
12773                 AC_MSG_ERROR(libserializer.jar not found.)
12774         fi
12776         if test -z $LIBBASE_JAR; then
12777             if test -f /usr/share/java/libbase-1.0.0.jar; then
12778                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12779             elif test -f /usr/share/java/libbase.jar; then
12780                 LIBBASE_JAR=/usr/share/java/libbase.jar
12781             else
12782                 AC_MSG_ERROR(libbase.jar replacement not found.)
12783             fi
12784         elif ! test -f $LIBBASE_JAR; then
12785             AC_MSG_ERROR(libbase.jar not found.)
12786         fi
12788     else
12789         AC_MSG_RESULT([internal])
12790         SYSTEM_JFREEREPORT=
12791         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12792         NEED_ANT=TRUE
12793     fi
12794 else
12795     AC_MSG_RESULT([no])
12796     ENABLE_REPORTBUILDER=
12797     SYSTEM_JFREEREPORT=
12799 AC_SUBST(ENABLE_REPORTBUILDER)
12800 AC_SUBST(SYSTEM_JFREEREPORT)
12801 AC_SUBST(SAC_JAR)
12802 AC_SUBST(LIBXML_JAR)
12803 AC_SUBST(FLUTE_JAR)
12804 AC_SUBST(JFREEREPORT_JAR)
12805 AC_SUBST(LIBBASE_JAR)
12806 AC_SUBST(LIBLAYOUT_JAR)
12807 AC_SUBST(LIBLOADER_JAR)
12808 AC_SUBST(LIBFORMULA_JAR)
12809 AC_SUBST(LIBREPOSITORY_JAR)
12810 AC_SUBST(LIBFONTS_JAR)
12811 AC_SUBST(LIBSERIALIZER_JAR)
12813 # scripting provider for BeanShell?
12814 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12815 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12816     AC_MSG_RESULT([yes])
12817     ENABLE_SCRIPTING_BEANSHELL=TRUE
12819     dnl ===================================================================
12820     dnl Check for system beanshell
12821     dnl ===================================================================
12822     AC_MSG_CHECKING([which beanshell to use])
12823     if test "$with_system_beanshell" = "yes"; then
12824         AC_MSG_RESULT([external])
12825         SYSTEM_BSH=TRUE
12826         if test -z $BSH_JAR; then
12827             BSH_JAR=/usr/share/java/bsh.jar
12828         fi
12829         if ! test -f $BSH_JAR; then
12830             AC_MSG_ERROR(bsh.jar not found.)
12831         fi
12832     else
12833         AC_MSG_RESULT([internal])
12834         SYSTEM_BSH=
12835         BUILD_TYPE="$BUILD_TYPE BSH"
12836     fi
12837 else
12838     AC_MSG_RESULT([no])
12839     ENABLE_SCRIPTING_BEANSHELL=
12840     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12842 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12843 AC_SUBST(SYSTEM_BSH)
12844 AC_SUBST(BSH_JAR)
12846 # scripting provider for JavaScript?
12847 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12848 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12849     AC_MSG_RESULT([yes])
12850     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12852     dnl ===================================================================
12853     dnl Check for system rhino
12854     dnl ===================================================================
12855     AC_MSG_CHECKING([which rhino to use])
12856     if test "$with_system_rhino" = "yes"; then
12857         AC_MSG_RESULT([external])
12858         SYSTEM_RHINO=TRUE
12859         if test -z $RHINO_JAR; then
12860             RHINO_JAR=/usr/share/java/js.jar
12861         fi
12862         if ! test -f $RHINO_JAR; then
12863             AC_MSG_ERROR(js.jar not found.)
12864         fi
12865     else
12866         AC_MSG_RESULT([internal])
12867         SYSTEM_RHINO=
12868         BUILD_TYPE="$BUILD_TYPE RHINO"
12869         NEED_ANT=TRUE
12870     fi
12871 else
12872     AC_MSG_RESULT([no])
12873     ENABLE_SCRIPTING_JAVASCRIPT=
12874     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12876 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12877 AC_SUBST(SYSTEM_RHINO)
12878 AC_SUBST(RHINO_JAR)
12880 # This is only used in Qt5/Qt6/KF5 checks to determine if /usr/lib64
12881 # paths should be added to library search path. So lets put all 64-bit
12882 # platforms there.
12883 supports_multilib=
12884 case "$host_cpu" in
12885 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
12886     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12887         supports_multilib="yes"
12888     fi
12889     ;;
12891     ;;
12892 esac
12894 dnl ===================================================================
12895 dnl QT5 Integration
12896 dnl ===================================================================
12898 QT5_CFLAGS=""
12899 QT5_LIBS=""
12900 QMAKE5="qmake"
12901 MOC5="moc"
12902 QT5_GOBJECT_CFLAGS=""
12903 QT5_GOBJECT_LIBS=""
12904 QT5_HAVE_GOBJECT=""
12905 QT5_PLATFORMS_SRCDIR=""
12906 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12907         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12908         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12909 then
12910     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12911     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12913     if test -n "$supports_multilib"; then
12914         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12915     fi
12917     qt5_test_include="QtWidgets/qapplication.h"
12918     if test "$_os" = "Emscripten"; then
12919         qt5_test_library="libQt5Widgets.a"
12920     else
12921         qt5_test_library="libQt5Widgets.so"
12922     fi
12924     dnl Check for qmake5
12925     if test -n "$QT5DIR"; then
12926         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12927     else
12928         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12929     fi
12930     if test "$QMAKE5" = "no"; then
12931         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12932     else
12933         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12934         if test -z "$qmake5_test_ver"; then
12935             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12936         fi
12937         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12938         qt5_minimal_minor="6"
12939         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12940             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12941         else
12942             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12943         fi
12944     fi
12946     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12947     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12948     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12949     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12951     AC_MSG_CHECKING([for Qt5 headers])
12952     qt5_incdir="no"
12953     for inc_dir in $qt5_incdirs; do
12954         if test -r "$inc_dir/$qt5_test_include"; then
12955             qt5_incdir="$inc_dir"
12956             break
12957         fi
12958     done
12959     AC_MSG_RESULT([$qt5_incdir])
12960     if test "x$qt5_incdir" = "xno"; then
12961         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12962     fi
12963     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12964     AC_LANG_PUSH([C++])
12965     save_CPPFLAGS=$CPPFLAGS
12966     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12967     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12968         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12969     CPPFLAGS=$save_CPPFLAGS
12970     AC_LANG_POP([C++])
12972     AC_MSG_CHECKING([for Qt5 libraries])
12973     qt5_libdir="no"
12974     for lib_dir in $qt5_libdirs; do
12975         if test -r "$lib_dir/$qt5_test_library"; then
12976             qt5_libdir="$lib_dir"
12977             break
12978         fi
12979     done
12980     AC_MSG_RESULT([$qt5_libdir])
12981     if test "x$qt5_libdir" = "xno"; then
12982         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12983     fi
12985     if test "$_os" = "Emscripten"; then
12986         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12987             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12988         fi
12989         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12990             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12991         fi
12993         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
12994         if ! test -x "$EMSDK_LLVM_NM"; then
12995             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
12996         fi
12997         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
12998             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
12999         fi
13000         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13001         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
13002             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13003         fi
13004         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
13005             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
13006         fi
13007     fi
13009     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13010     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13011     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13012     if test "$_os" = "Emscripten"; then
13013         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13014     fi
13016     if test "$USING_X11" = TRUE; then
13017         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13018         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
13019             QT5_HAVE_XCB_ICCCM=1
13020             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
13021         ],[
13022             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
13023             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
13024         ])
13025         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13026         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13027         QT5_USING_X11=1
13028         AC_DEFINE(QT5_USING_X11)
13029     fi
13031     dnl Check for Meta Object Compiler
13033     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13034     if test "$MOC5" = "no"; then
13035         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13036 the root of your Qt installation by exporting QT5DIR before running "configure".])
13037     fi
13039     if test "$test_gstreamer_1_0" = yes; then
13040         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13041                 QT5_HAVE_GOBJECT=1
13042                 AC_DEFINE(QT5_HAVE_GOBJECT)
13043             ],
13044             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13045         )
13046     fi
13048 AC_SUBST(QT5_CFLAGS)
13049 AC_SUBST(QT5_LIBS)
13050 AC_SUBST(MOC5)
13051 AC_SUBST(QT5_GOBJECT_CFLAGS)
13052 AC_SUBST(QT5_GOBJECT_LIBS)
13053 AC_SUBST(QT5_HAVE_GOBJECT)
13054 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13056 dnl ===================================================================
13057 dnl QT6 Integration
13058 dnl ===================================================================
13060 QT6_CFLAGS=""
13061 QT6_LIBS=""
13062 QMAKE6="qmake"
13063 MOC6="moc"
13064 QT6_PLATFORMS_SRCDIR=""
13065 if test \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13066 then
13067     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13068     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13070     if test -n "$supports_multilib"; then
13071         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13072     fi
13074     qt6_test_include="QtWidgets/qapplication.h"
13075     if test "$_os" = "Emscripten"; then
13076         qt6_test_library="libQt6Widgets.a"
13077     else
13078         qt6_test_library="libQt6Widgets.so"
13079     fi
13081     dnl Check for qmake6
13082     if test -n "$QT6DIR"; then
13083         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13084     else
13085         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13086     fi
13087     if test "$QMAKE6" = "no"; then
13088         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13089     else
13090         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13091         if test -z "$qmake6_test_ver"; then
13092             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13093         fi
13094         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13095     fi
13097     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13098     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13099     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13100     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13102     AC_MSG_CHECKING([for Qt6 headers])
13103     qt6_incdir="no"
13104     for inc_dir in $qt6_incdirs; do
13105         if test -r "$inc_dir/$qt6_test_include"; then
13106             qt6_incdir="$inc_dir"
13107             break
13108         fi
13109     done
13110     AC_MSG_RESULT([$qt6_incdir])
13111     if test "x$qt6_incdir" = "xno"; then
13112         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13113     fi
13114     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13115     AC_LANG_PUSH([C++])
13116     save_CPPFLAGS=$CPPFLAGS
13117     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13118     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13119         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13120     CPPFLAGS=$save_CPPFLAGS
13121     AC_LANG_POP([C++])
13123     AC_MSG_CHECKING([for Qt6 libraries])
13124     qt6_libdir="no"
13125     for lib_dir in $qt6_libdirs; do
13126         if test -r "$lib_dir/$qt6_test_library"; then
13127             qt6_libdir="$lib_dir"
13128             break
13129         fi
13130     done
13131     AC_MSG_RESULT([$qt6_libdir])
13132     if test "x$qt6_libdir" = "xno"; then
13133         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13134     fi
13136     if test "$_os" = "Emscripten"; then
13137         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13138             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13139         fi
13140         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13141             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13142         fi
13143     fi
13145     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13146     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13147     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13148     if test "$_os" = "Emscripten"; then
13149         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13150     fi
13152     if test "$USING_X11" = TRUE; then
13153         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13154         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13155         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13156         QT6_USING_X11=1
13157         AC_DEFINE(QT6_USING_X11)
13158     fi
13160     dnl Check for Meta Object Compiler
13162     for lib_dir in $qt6_libdirs; do
13163         if test -z "$qt6_libexec_dirs"; then
13164             qt6_libexec_dirs="$lib_dir/libexec"
13165         else
13166             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13167         fi
13168     done
13169     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$qt6_libexec_dirs:$PATH])
13170     if test "$MOC6" = "no"; then
13171         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13172 the root of your Qt installation by exporting QT6DIR before running "configure".])
13173     fi
13175 AC_SUBST(QT6_CFLAGS)
13176 AC_SUBST(QT6_LIBS)
13177 AC_SUBST(MOC6)
13178 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13180 dnl ===================================================================
13181 dnl KF5 Integration
13182 dnl ===================================================================
13184 KF5_CFLAGS=""
13185 KF5_LIBS=""
13186 KF5_CONFIG="kf5-config"
13187 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13188         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13189 then
13190     if test "$OS" = "HAIKU"; then
13191         haiku_arch="`echo $RTL_ARCH | tr X x`"
13192         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13193         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13194     fi
13196     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13197     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13198     if test -n "$supports_multilib"; then
13199         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13200     fi
13202     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13203     kf5_test_library="libKF5KIOFileWidgets.so"
13204     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13206     dnl kf5 KDE4 support compatibility installed
13207     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13208     if test "$KF5_CONFIG" != "no"; then
13209         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13210         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13211     fi
13213     dnl Check for KF5 headers
13214     AC_MSG_CHECKING([for KF5 headers])
13215     kf5_incdir="no"
13216     for kf5_check in $kf5_incdirs; do
13217         if test -r "$kf5_check/$kf5_test_include"; then
13218             kf5_incdir="$kf5_check/KF5"
13219             break
13220         fi
13221     done
13222     AC_MSG_RESULT([$kf5_incdir])
13223     if test "x$kf5_incdir" = "xno"; then
13224         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13225     fi
13227     dnl Check for KF5 libraries
13228     AC_MSG_CHECKING([for KF5 libraries])
13229     kf5_libdir="no"
13230     for kf5_check in $kf5_libdirs; do
13231         if test -r "$kf5_check/$kf5_test_library"; then
13232             kf5_libdir="$kf5_check"
13233             break
13234         fi
13235     done
13237     AC_MSG_RESULT([$kf5_libdir])
13238     if test "x$kf5_libdir" = "xno"; then
13239         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13240     fi
13242     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"
13243     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13244     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13246     if test "$USING_X11" = TRUE; then
13247         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13248     fi
13250     AC_LANG_PUSH([C++])
13251     save_CXXFLAGS=$CXXFLAGS
13252     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13253     AC_MSG_CHECKING([whether KDE is >= 5.0])
13254        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13255 #include <kcoreaddons_version.h>
13257 int main(int argc, char **argv) {
13258        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13259        else return 1;
13261        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13262     CXXFLAGS=$save_CXXFLAGS
13263     AC_LANG_POP([C++])
13265 AC_SUBST(KF5_CFLAGS)
13266 AC_SUBST(KF5_LIBS)
13268 dnl ===================================================================
13269 dnl Test whether to include Evolution 2 support
13270 dnl ===================================================================
13271 AC_MSG_CHECKING([whether to enable evolution 2 support])
13272 if test "$enable_evolution2" = yes; then
13273     AC_MSG_RESULT([yes])
13274     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13275     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13276     FilterLibs "${GOBJECT_LIBS}"
13277     GOBJECT_LIBS="${filteredlibs}"
13278     ENABLE_EVOAB2="TRUE"
13279 else
13280     AC_MSG_RESULT([no])
13282 AC_SUBST(ENABLE_EVOAB2)
13283 AC_SUBST(GOBJECT_CFLAGS)
13284 AC_SUBST(GOBJECT_LIBS)
13286 dnl ===================================================================
13287 dnl Test which themes to include
13288 dnl ===================================================================
13289 AC_MSG_CHECKING([which themes to include])
13290 # if none given use default subset of available themes
13291 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13292     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_svg"
13295 WITH_THEMES=""
13296 if test "x$with_theme" != "xno"; then
13297     for theme in $with_theme; do
13298         case $theme in
13299         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_svg) real_theme="$theme" ;;
13300         default) real_theme=colibre ;;
13301         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13302         esac
13303         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13304     done
13306 AC_MSG_RESULT([$WITH_THEMES])
13307 AC_SUBST([WITH_THEMES])
13308 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13309 for theme in $with_theme; do
13310     case $theme in
13311     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13312     *) ;;
13313     esac
13314 done
13316 ###############################################################################
13317 # Extensions checking
13318 ###############################################################################
13319 AC_MSG_CHECKING([for extensions integration])
13320 if test "x$enable_extension_integration" != "xno"; then
13321     WITH_EXTENSION_INTEGRATION=TRUE
13322     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13323     AC_MSG_RESULT([yes, use integration])
13324 else
13325     WITH_EXTENSION_INTEGRATION=
13326     AC_MSG_RESULT([no, do not integrate])
13328 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13330 dnl Should any extra extensions be included?
13331 dnl There are standalone tests for each of these below.
13332 WITH_EXTRA_EXTENSIONS=
13333 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13335 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13336 if test "x$with_java" != "xno"; then
13337     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13340 AC_MSG_CHECKING([whether to build opens___.ttf])
13341 if test "$enable_build_opensymbol" = "yes"; then
13342     AC_MSG_RESULT([yes])
13343     AC_PATH_PROG(FONTFORGE, fontforge)
13344     if test -z "$FONTFORGE"; then
13345         AC_MSG_ERROR([fontforge not installed])
13346     fi
13347 else
13348     AC_MSG_RESULT([no])
13349     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13351 AC_SUBST(FONTFORGE)
13353 dnl ===================================================================
13354 dnl Test whether to include fonts
13355 dnl ===================================================================
13356 AC_MSG_CHECKING([whether to include third-party fonts])
13357 if test "$with_fonts" != "no"; then
13358     AC_MSG_RESULT([yes])
13359     WITH_FONTS=TRUE
13360     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13361     AC_DEFINE(HAVE_MORE_FONTS)
13362 else
13363     AC_MSG_RESULT([no])
13364     WITH_FONTS=
13365     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13367 AC_SUBST(WITH_FONTS)
13370 dnl ===================================================================
13371 dnl Test whether to enable online update service
13372 dnl ===================================================================
13373 AC_MSG_CHECKING([whether to enable online update])
13374 ENABLE_ONLINE_UPDATE=
13375 ENABLE_ONLINE_UPDATE_MAR=
13376 UPDATE_CONFIG=
13377 if test "$enable_online_update" = ""; then
13378     AC_MSG_RESULT([no])
13379 else
13380     if test "$enable_online_update" = "mar"; then
13381         AC_MSG_RESULT([yes - MAR-based online update])
13382         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13383         if test "$with_update_config" = ""; then
13384             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13385         fi
13386         UPDATE_CONFIG="$with_update_config"
13387         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13388     elif test "$enable_online_update" = "yes"; then
13389         AC_MSG_RESULT([yes])
13390         ENABLE_ONLINE_UPDATE="TRUE"
13391     else
13392         AC_MSG_RESULT([no])
13393     fi
13395 AC_SUBST(ENABLE_ONLINE_UPDATE)
13396 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13397 AC_SUBST(UPDATE_CONFIG)
13400 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13401 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13402     if test "x$with_privacy_policy_url" = "xundefined"; then
13403         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13404     fi
13406 AC_SUBST(PRIVACY_POLICY_URL)
13407 dnl ===================================================================
13408 dnl Test whether we need bzip2
13409 dnl ===================================================================
13410 SYSTEM_BZIP2=
13411 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13412     AC_MSG_CHECKING([whether to use system bzip2])
13413     if test "$with_system_bzip2" = yes; then
13414         SYSTEM_BZIP2=TRUE
13415         AC_MSG_RESULT([yes])
13416         PKG_CHECK_MODULES(BZIP2, bzip2)
13417         FilterLibs "${BZIP2_LIBS}"
13418         BZIP2_LIBS="${filteredlibs}"
13419     else
13420         AC_MSG_RESULT([no])
13421         BUILD_TYPE="$BUILD_TYPE BZIP2"
13422     fi
13424 AC_SUBST(SYSTEM_BZIP2)
13425 AC_SUBST(BZIP2_CFLAGS)
13426 AC_SUBST(BZIP2_LIBS)
13428 dnl ===================================================================
13429 dnl Test whether to enable extension update
13430 dnl ===================================================================
13431 AC_MSG_CHECKING([whether to enable extension update])
13432 ENABLE_EXTENSION_UPDATE=
13433 if test "x$enable_extension_update" = "xno"; then
13434     AC_MSG_RESULT([no])
13435 else
13436     AC_MSG_RESULT([yes])
13437     ENABLE_EXTENSION_UPDATE="TRUE"
13438     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13439     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13441 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13444 dnl ===================================================================
13445 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13446 dnl ===================================================================
13447 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13448 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13449     AC_MSG_RESULT([no])
13450     ENABLE_SILENT_MSI=
13451 else
13452     AC_MSG_RESULT([yes])
13453     ENABLE_SILENT_MSI=TRUE
13454     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13456 AC_SUBST(ENABLE_SILENT_MSI)
13458 AC_MSG_CHECKING([whether and how to use Xinerama])
13459 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13460     if test "$x_libraries" = "default_x_libraries"; then
13461         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13462         if test "x$XINERAMALIB" = x; then
13463            XINERAMALIB="/usr/lib"
13464         fi
13465     else
13466         XINERAMALIB="$x_libraries"
13467     fi
13468     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13469         # we have both versions, let the user decide but use the dynamic one
13470         # per default
13471         USE_XINERAMA=TRUE
13472         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13473             XINERAMA_LINK=dynamic
13474         else
13475             XINERAMA_LINK=static
13476         fi
13477     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13478         # we have only the dynamic version
13479         USE_XINERAMA=TRUE
13480         XINERAMA_LINK=dynamic
13481     elif test -e "$XINERAMALIB/libXinerama.a"; then
13482         # static version
13483         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13484             USE_XINERAMA=TRUE
13485             XINERAMA_LINK=static
13486         else
13487             USE_XINERAMA=
13488             XINERAMA_LINK=none
13489         fi
13490     else
13491         # no Xinerama
13492         USE_XINERAMA=
13493         XINERAMA_LINK=none
13494     fi
13495     if test "$USE_XINERAMA" = "TRUE"; then
13496         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13497         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13498             [AC_MSG_ERROR(Xinerama header not found.)], [])
13499         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13500         if test "x$XEXTLIB" = x; then
13501            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13502         fi
13503         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13504         if test "$_os" = "FreeBSD"; then
13505             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13506         fi
13507         if test "$_os" = "Linux"; then
13508             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13509         fi
13510         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13511             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13512     else
13513         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13514     fi
13515 else
13516     USE_XINERAMA=
13517     XINERAMA_LINK=none
13518     AC_MSG_RESULT([no])
13520 AC_SUBST(USE_XINERAMA)
13521 AC_SUBST(XINERAMA_LINK)
13523 dnl ===================================================================
13524 dnl Test whether to build cairo or rely on the system version
13525 dnl ===================================================================
13527 if test "$test_cairo" = "yes"; then
13528     AC_MSG_CHECKING([whether to use the system cairo])
13530     : ${with_system_cairo:=$with_system_libs}
13531     if test "$with_system_cairo" = "yes"; then
13532         SYSTEM_CAIRO=TRUE
13533         AC_MSG_RESULT([yes])
13535         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
13536         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13537         FilterLibs "${CAIRO_LIBS}"
13538         CAIRO_LIBS="${filteredlibs}"
13540         if test "$test_xrender" = "yes"; then
13541             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13542             AC_LANG_PUSH([C])
13543             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13544 #ifdef PictStandardA8
13545 #else
13546       return fail;
13547 #endif
13548 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13550             AC_LANG_POP([C])
13551         fi
13552     else
13553         AC_MSG_RESULT([no])
13554         BUILD_TYPE="$BUILD_TYPE CAIRO"
13555     fi
13557     if test "$enable_cairo_canvas" != no; then
13558         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13559         ENABLE_CAIRO_CANVAS=TRUE
13560     fi
13563 AC_SUBST(CAIRO_CFLAGS)
13564 AC_SUBST(CAIRO_LIBS)
13565 AC_SUBST(ENABLE_CAIRO_CANVAS)
13566 AC_SUBST(SYSTEM_CAIRO)
13568 dnl ===================================================================
13569 dnl Test whether to use avahi
13570 dnl ===================================================================
13571 if test "$_os" = "WINNT"; then
13572     # Windows uses bundled mDNSResponder
13573     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13574 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13575     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13576                       [ENABLE_AVAHI="TRUE"])
13577     AC_DEFINE(HAVE_FEATURE_AVAHI)
13578     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13579     FilterLibs "${AVAHI_LIBS}"
13580     AVAHI_LIBS="${filteredlibs}"
13583 AC_SUBST(ENABLE_AVAHI)
13584 AC_SUBST(AVAHI_CFLAGS)
13585 AC_SUBST(AVAHI_LIBS)
13587 dnl ===================================================================
13588 dnl Test whether to use liblangtag
13589 dnl ===================================================================
13590 SYSTEM_LIBLANGTAG=
13591 AC_MSG_CHECKING([whether to use system liblangtag])
13592 if test "$with_system_liblangtag" = yes; then
13593     SYSTEM_LIBLANGTAG=TRUE
13594     AC_MSG_RESULT([yes])
13595     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13596     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13597     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13598     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13599     FilterLibs "${LIBLANGTAG_LIBS}"
13600     LIBLANGTAG_LIBS="${filteredlibs}"
13601 else
13602     SYSTEM_LIBLANGTAG=
13603     AC_MSG_RESULT([no])
13604     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13605     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13606     if test "$COM" = "MSC"; then
13607         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13608     else
13609         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13610     fi
13612 AC_SUBST(SYSTEM_LIBLANGTAG)
13613 AC_SUBST(LIBLANGTAG_CFLAGS)
13614 AC_SUBST(LIBLANGTAG_LIBS)
13616 dnl ===================================================================
13617 dnl Test whether to build libpng or rely on the system version
13618 dnl ===================================================================
13620 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13621 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13622 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13624 dnl ===================================================================
13625 dnl Test whether to build libtiff or rely on the system version
13626 dnl ===================================================================
13628 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
13630 dnl ===================================================================
13631 dnl Test whether to build libwebp or rely on the system version
13632 dnl ===================================================================
13634 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13636 dnl ===================================================================
13637 dnl Check for runtime JVM search path
13638 dnl ===================================================================
13639 if test "$ENABLE_JAVA" != ""; then
13640     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13641     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13642         AC_MSG_RESULT([yes])
13643         if ! test -d "$with_jvm_path"; then
13644             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13645         fi
13646         if ! test -d "$with_jvm_path"jvm; then
13647             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13648         fi
13649         JVM_ONE_PATH_CHECK="$with_jvm_path"
13650         AC_SUBST(JVM_ONE_PATH_CHECK)
13651     else
13652         AC_MSG_RESULT([no])
13653     fi
13656 dnl ===================================================================
13657 dnl Test for the presence of Ant and that it works
13658 dnl ===================================================================
13660 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13661     ANT_HOME=; export ANT_HOME
13662     WITH_ANT_HOME=; export WITH_ANT_HOME
13663     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13664         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13665             if test "$_os" = "WINNT"; then
13666                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13667             else
13668                 with_ant_home="$LODE_HOME/opt/ant"
13669             fi
13670         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13671             with_ant_home="$LODE_HOME/opt/ant"
13672         fi
13673     fi
13674     if test -z "$with_ant_home"; then
13675         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13676     else
13677         if test "$_os" = "WINNT"; then
13678             # AC_PATH_PROGS needs unix path
13679             with_ant_home=`cygpath -u "$with_ant_home"`
13680         fi
13681         AbsolutePath "$with_ant_home"
13682         with_ant_home=$absolute_path
13683         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13684         WITH_ANT_HOME=$with_ant_home
13685         ANT_HOME=$with_ant_home
13686     fi
13688     if test -z "$ANT"; then
13689         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13690     else
13691         # resolve relative or absolute symlink
13692         while test -h "$ANT"; do
13693             a_cwd=`pwd`
13694             a_basename=`basename "$ANT"`
13695             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13696             cd "`dirname "$ANT"`"
13697             cd "`dirname "$a_script"`"
13698             ANT="`pwd`"/"`basename "$a_script"`"
13699             cd "$a_cwd"
13700         done
13702         AC_MSG_CHECKING([if $ANT works])
13703         mkdir -p conftest.dir
13704         a_cwd=$(pwd)
13705         cd conftest.dir
13706         cat > conftest.java << EOF
13707         public class conftest {
13708             int testmethod(int a, int b) {
13709                     return a + b;
13710             }
13711         }
13714         cat > conftest.xml << EOF
13715         <project name="conftest" default="conftest">
13716         <target name="conftest">
13717             <javac srcdir="." includes="conftest.java">
13718             </javac>
13719         </target>
13720         </project>
13723         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13724         if test $? = 0 -a -f ./conftest.class; then
13725             AC_MSG_RESULT([Ant works])
13726             if test -z "$WITH_ANT_HOME"; then
13727                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13728                 if test -z "$ANT_HOME"; then
13729                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13730                 fi
13731             else
13732                 ANT_HOME="$WITH_ANT_HOME"
13733             fi
13734         else
13735             echo "configure: Ant test failed" >&5
13736             cat conftest.java >&5
13737             cat conftest.xml >&5
13738             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13739         fi
13740         cd "$a_cwd"
13741         rm -fr conftest.dir
13742     fi
13743     if test -z "$ANT_HOME"; then
13744         ANT_HOME="NO_ANT_HOME"
13745     else
13746         PathFormat "$ANT_HOME"
13747         ANT_HOME="$formatted_path"
13748         PathFormat "$ANT"
13749         ANT="$formatted_path"
13750     fi
13752     dnl Checking for ant.jar
13753     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13754         AC_MSG_CHECKING([Ant lib directory])
13755         if test -f $ANT_HOME/lib/ant.jar; then
13756             ANT_LIB="$ANT_HOME/lib"
13757         else
13758             if test -f $ANT_HOME/ant.jar; then
13759                 ANT_LIB="$ANT_HOME"
13760             else
13761                 if test -f /usr/share/java/ant.jar; then
13762                     ANT_LIB=/usr/share/java
13763                 else
13764                     if test -f /usr/share/ant-core/lib/ant.jar; then
13765                         ANT_LIB=/usr/share/ant-core/lib
13766                     else
13767                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13768                             ANT_LIB="$ANT_HOME/lib/ant"
13769                         else
13770                             if test -f /usr/share/lib/ant/ant.jar; then
13771                                 ANT_LIB=/usr/share/lib/ant
13772                             else
13773                                 AC_MSG_ERROR([Ant libraries not found!])
13774                             fi
13775                         fi
13776                     fi
13777                 fi
13778             fi
13779         fi
13780         PathFormat "$ANT_LIB"
13781         ANT_LIB="$formatted_path"
13782         AC_MSG_RESULT([Ant lib directory found.])
13783     fi
13785     ant_minver=1.6.0
13786     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13788     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13789     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13790     ant_version_major=`echo $ant_version | cut -d. -f1`
13791     ant_version_minor=`echo $ant_version | cut -d. -f2`
13792     echo "configure: ant_version $ant_version " >&5
13793     echo "configure: ant_version_major $ant_version_major " >&5
13794     echo "configure: ant_version_minor $ant_version_minor " >&5
13795     if test "$ant_version_major" -ge "2"; then
13796         AC_MSG_RESULT([yes, $ant_version])
13797     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13798         AC_MSG_RESULT([yes, $ant_version])
13799     else
13800         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13801     fi
13803     rm -f conftest* core core.* *.core
13805 AC_SUBST(ANT)
13806 AC_SUBST(ANT_HOME)
13807 AC_SUBST(ANT_LIB)
13809 OOO_JUNIT_JAR=
13810 HAMCREST_JAR=
13811 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13812     AC_MSG_CHECKING([for JUnit 4])
13813     if test "$with_junit" = "yes"; then
13814         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13815             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13816         elif test -e /usr/share/java/junit4.jar; then
13817             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13818         else
13819            if test -e /usr/share/lib/java/junit.jar; then
13820               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13821            else
13822               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13823            fi
13824         fi
13825     else
13826         OOO_JUNIT_JAR=$with_junit
13827     fi
13828     if test "$_os" = "WINNT"; then
13829         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13830     fi
13831     printf 'import org.junit.Before;' > conftest.java
13832     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13833         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13834     else
13835         AC_MSG_ERROR(
13836 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13837  specify its pathname via --with-junit=..., or disable it via --without-junit])
13838     fi
13839     rm -f conftest.class conftest.java
13840     if test $OOO_JUNIT_JAR != ""; then
13841         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13842     fi
13844     AC_MSG_CHECKING([for included Hamcrest])
13845     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13846     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13847         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13848     else
13849         AC_MSG_RESULT([Not included])
13850         AC_MSG_CHECKING([for standalone hamcrest jar.])
13851         if test "$with_hamcrest" = "yes"; then
13852             if test -e /usr/share/lib/java/hamcrest.jar; then
13853                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13854             elif test -e /usr/share/java/hamcrest/core.jar; then
13855                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13856             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13857                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13858             else
13859                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13860             fi
13861         else
13862             HAMCREST_JAR=$with_hamcrest
13863         fi
13864         if test "$_os" = "WINNT"; then
13865             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13866         fi
13867         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13868             AC_MSG_RESULT([$HAMCREST_JAR])
13869         else
13870             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),
13871                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13872         fi
13873     fi
13874     rm -f conftest.class conftest.java
13876 AC_SUBST(OOO_JUNIT_JAR)
13877 AC_SUBST(HAMCREST_JAR)
13880 AC_SUBST(SCPDEFS)
13883 # check for wget and curl
13885 WGET=
13886 CURL=
13888 if test "$enable_fetch_external" != "no"; then
13890 CURL=`which curl 2>/dev/null`
13892 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13893     # wget new enough?
13894     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13895     if test $? -eq 0; then
13896         WGET=$i
13897         break
13898     fi
13899 done
13901 if test -z "$WGET" -a -z "$CURL"; then
13902     AC_MSG_ERROR([neither wget nor curl found!])
13907 AC_SUBST(WGET)
13908 AC_SUBST(CURL)
13911 # check for sha256sum
13913 SHA256SUM=
13915 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13916     eval "$i -a 256 --version" > /dev/null 2>&1
13917     ret=$?
13918     if test $ret -eq 0; then
13919         SHA256SUM="$i -a 256"
13920         break
13921     fi
13922 done
13924 if test -z "$SHA256SUM"; then
13925     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13926         eval "$i --version" > /dev/null 2>&1
13927         ret=$?
13928         if test $ret -eq 0; then
13929             SHA256SUM=$i
13930             break
13931         fi
13932     done
13935 if test -z "$SHA256SUM"; then
13936     AC_MSG_ERROR([no sha256sum found!])
13939 AC_SUBST(SHA256SUM)
13941 dnl ===================================================================
13942 dnl Dealing with l10n options
13943 dnl ===================================================================
13944 AC_MSG_CHECKING([which languages to be built])
13945 # get list of all languages
13946 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13947 # the sed command does the following:
13948 #   + if a line ends with a backslash, append the next line to it
13949 #   + adds " on the beginning of the value (after =)
13950 #   + adds " at the end of the value
13951 #   + removes en-US; we want to put it on the beginning
13952 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13953 [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)]
13954 ALL_LANGS="en-US $completelangiso"
13955 # check the configured localizations
13956 WITH_LANG="$with_lang"
13958 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13959 # (Norwegian is "nb" and "nn".)
13960 if test "$WITH_LANG" = "no"; then
13961     WITH_LANG=
13964 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13965     AC_MSG_RESULT([en-US])
13966 else
13967     AC_MSG_RESULT([$WITH_LANG])
13968     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13969     if test -z "$MSGFMT"; then
13970         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13971             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13972         elif test -x "/opt/lo/bin/msgfmt"; then
13973             MSGFMT="/opt/lo/bin/msgfmt"
13974         else
13975             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13976             if test -z "$MSGFMT"; then
13977                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13978             fi
13979         fi
13980     fi
13981     if test -z "$MSGUNIQ"; then
13982         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13983             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13984         elif test -x "/opt/lo/bin/msguniq"; then
13985             MSGUNIQ="/opt/lo/bin/msguniq"
13986         else
13987             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13988             if test -z "$MSGUNIQ"; then
13989                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13990             fi
13991         fi
13992     fi
13994 AC_SUBST(MSGFMT)
13995 AC_SUBST(MSGUNIQ)
13996 # check that the list is valid
13997 for lang in $WITH_LANG; do
13998     test "$lang" = "ALL" && continue
13999     # need to check for the exact string, so add space before and after the list of all languages
14000     for vl in $ALL_LANGS; do
14001         if test "$vl" = "$lang"; then
14002            break
14003         fi
14004     done
14005     if test "$vl" != "$lang"; then
14006         # if you're reading this - you prolly quoted your languages remove the quotes ...
14007         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14008     fi
14009 done
14010 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14011     echo $WITH_LANG | grep -q en-US
14012     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14014 # list with substituted ALL
14015 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14016 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14017 test "$WITH_LANG" = "en-US" && WITH_LANG=
14018 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14019     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14020     ALL_LANGS=`echo $ALL_LANGS qtz`
14022 AC_SUBST(ALL_LANGS)
14023 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14024 AC_SUBST(WITH_LANG)
14025 AC_SUBST(WITH_LANG_LIST)
14026 AC_SUBST(GIT_NEEDED_SUBMODULES)
14028 WITH_POOR_HELP_LOCALIZATIONS=
14029 if test -d "$SRC_ROOT/translations/source"; then
14030     for l in `ls -1 $SRC_ROOT/translations/source`; do
14031         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14032             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14033         fi
14034     done
14036 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14038 if test -n "$with_locales" -a "$with_locales" != ALL; then
14039     WITH_LOCALES="$with_locales"
14041     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14042     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14043     # config_host/config_locales.h.in
14044     for locale in $WITH_LOCALES; do
14045         lang=${locale%_*}
14047         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14049         case $lang in
14050         hi|mr*ne)
14051             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14052             ;;
14053         bg|ru)
14054             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14055             ;;
14056         esac
14057     done
14058 else
14059     AC_DEFINE(WITH_LOCALE_ALL)
14061 AC_SUBST(WITH_LOCALES)
14063 dnl git submodule update --reference
14064 dnl ===================================================================
14065 if test -n "${GIT_REFERENCE_SRC}"; then
14066     for repo in ${GIT_NEEDED_SUBMODULES}; do
14067         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14068             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14069         fi
14070     done
14072 AC_SUBST(GIT_REFERENCE_SRC)
14074 dnl git submodules linked dirs
14075 dnl ===================================================================
14076 if test -n "${GIT_LINK_SRC}"; then
14077     for repo in ${GIT_NEEDED_SUBMODULES}; do
14078         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14079             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14080         fi
14081     done
14083 AC_SUBST(GIT_LINK_SRC)
14085 dnl branding
14086 dnl ===================================================================
14087 AC_MSG_CHECKING([for alternative branding images directory])
14088 # initialize mapped arrays
14089 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14090 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14092 if test -z "$with_branding" -o "$with_branding" = "no"; then
14093     AC_MSG_RESULT([none])
14094     DEFAULT_BRAND_IMAGES="$brand_files"
14095 else
14096     if ! test -d $with_branding ; then
14097         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14098     else
14099         AC_MSG_RESULT([$with_branding])
14100         CUSTOM_BRAND_DIR="$with_branding"
14101         for lfile in $brand_files
14102         do
14103             if ! test -f $with_branding/$lfile ; then
14104                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14105                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14106             else
14107                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14108             fi
14109         done
14110         check_for_progress="yes"
14111     fi
14113 AC_SUBST([BRAND_INTRO_IMAGES])
14114 AC_SUBST([CUSTOM_BRAND_DIR])
14115 AC_SUBST([CUSTOM_BRAND_IMAGES])
14116 AC_SUBST([DEFAULT_BRAND_IMAGES])
14119 AC_MSG_CHECKING([for 'intro' progress settings])
14120 PROGRESSBARCOLOR=
14121 PROGRESSSIZE=
14122 PROGRESSPOSITION=
14123 PROGRESSFRAMECOLOR=
14124 PROGRESSTEXTCOLOR=
14125 PROGRESSTEXTBASELINE=
14127 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14128     source "$with_branding/progress.conf"
14129     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14130 else
14131     AC_MSG_RESULT([none])
14134 AC_SUBST(PROGRESSBARCOLOR)
14135 AC_SUBST(PROGRESSSIZE)
14136 AC_SUBST(PROGRESSPOSITION)
14137 AC_SUBST(PROGRESSFRAMECOLOR)
14138 AC_SUBST(PROGRESSTEXTCOLOR)
14139 AC_SUBST(PROGRESSTEXTBASELINE)
14142 dnl ===================================================================
14143 dnl Custom build version
14144 dnl ===================================================================
14145 AC_MSG_CHECKING([for extra build ID])
14146 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14147     EXTRA_BUILDID="$with_extra_buildid"
14149 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14150 if test -n "$EXTRA_BUILDID" ; then
14151     AC_MSG_RESULT([$EXTRA_BUILDID])
14152 else
14153     AC_MSG_RESULT([not set])
14155 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14157 OOO_VENDOR=
14158 AC_MSG_CHECKING([for vendor])
14159 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14160     OOO_VENDOR="$USERNAME"
14162     if test -z "$OOO_VENDOR"; then
14163         OOO_VENDOR="$USER"
14164     fi
14166     if test -z "$OOO_VENDOR"; then
14167         OOO_VENDOR="`id -u -n`"
14168     fi
14170     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14171 else
14172     OOO_VENDOR="$with_vendor"
14173     AC_MSG_RESULT([$OOO_VENDOR])
14175 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14176 AC_SUBST(OOO_VENDOR)
14178 if test "$_os" = "Android" ; then
14179     ANDROID_PACKAGE_NAME=
14180     AC_MSG_CHECKING([for Android package name])
14181     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14182         if test -n "$ENABLE_DEBUG"; then
14183             # Default to the package name that makes ndk-gdb happy.
14184             ANDROID_PACKAGE_NAME="org.libreoffice"
14185         else
14186             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14187         fi
14189         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14190     else
14191         ANDROID_PACKAGE_NAME="$with_android_package_name"
14192         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14193     fi
14194     AC_SUBST(ANDROID_PACKAGE_NAME)
14197 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14198 if test "$with_compat_oowrappers" = "yes"; then
14199     WITH_COMPAT_OOWRAPPERS=TRUE
14200     AC_MSG_RESULT(yes)
14201 else
14202     WITH_COMPAT_OOWRAPPERS=
14203     AC_MSG_RESULT(no)
14205 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14207 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14208 AC_MSG_CHECKING([for install dirname])
14209 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14210     INSTALLDIRNAME="$with_install_dirname"
14212 AC_MSG_RESULT([$INSTALLDIRNAME])
14213 AC_SUBST(INSTALLDIRNAME)
14215 AC_MSG_CHECKING([for prefix])
14216 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14217 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14218 PREFIXDIR="$prefix"
14219 AC_MSG_RESULT([$PREFIXDIR])
14220 AC_SUBST(PREFIXDIR)
14222 LIBDIR=[$(eval echo $(eval echo $libdir))]
14223 AC_SUBST(LIBDIR)
14225 DATADIR=[$(eval echo $(eval echo $datadir))]
14226 AC_SUBST(DATADIR)
14228 MANDIR=[$(eval echo $(eval echo $mandir))]
14229 AC_SUBST(MANDIR)
14231 DOCDIR=[$(eval echo $(eval echo $docdir))]
14232 AC_SUBST(DOCDIR)
14234 BINDIR=[$(eval echo $(eval echo $bindir))]
14235 AC_SUBST(BINDIR)
14237 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14238 AC_SUBST(INSTALLDIR)
14240 TESTINSTALLDIR="${BUILDDIR}/test-install"
14241 AC_SUBST(TESTINSTALLDIR)
14244 # ===================================================================
14245 # OAuth2 id and secrets
14246 # ===================================================================
14248 AC_MSG_CHECKING([for Google Drive client id and secret])
14249 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14250     AC_MSG_RESULT([not set])
14251     GDRIVE_CLIENT_ID="\"\""
14252     GDRIVE_CLIENT_SECRET="\"\""
14253 else
14254     AC_MSG_RESULT([set])
14255     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14256     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14258 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14259 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14261 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14262 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14263     AC_MSG_RESULT([not set])
14264     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14265     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14266 else
14267     AC_MSG_RESULT([set])
14268     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14269     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14271 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14272 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14274 AC_MSG_CHECKING([for OneDrive client id and secret])
14275 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14276     AC_MSG_RESULT([not set])
14277     ONEDRIVE_CLIENT_ID="\"\""
14278     ONEDRIVE_CLIENT_SECRET="\"\""
14279 else
14280     AC_MSG_RESULT([set])
14281     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14282     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14284 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14285 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14288 dnl ===================================================================
14289 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14290 dnl --enable-dependency-tracking configure option
14291 dnl ===================================================================
14292 AC_MSG_CHECKING([whether to enable dependency tracking])
14293 if test "$enable_dependency_tracking" = "no"; then
14294     nodep=TRUE
14295     AC_MSG_RESULT([no])
14296 else
14297     AC_MSG_RESULT([yes])
14299 AC_SUBST(nodep)
14301 dnl ===================================================================
14302 dnl Number of CPUs to use during the build
14303 dnl ===================================================================
14304 AC_MSG_CHECKING([for number of processors to use])
14305 # plain --with-parallelism is just the default
14306 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14307     if test "$with_parallelism" = "no"; then
14308         PARALLELISM=0
14309     else
14310         PARALLELISM=$with_parallelism
14311     fi
14312 else
14313     if test "$enable_icecream" = "yes"; then
14314         PARALLELISM="40"
14315     else
14316         case `uname -s` in
14318         Darwin|FreeBSD|NetBSD|OpenBSD)
14319             PARALLELISM=`sysctl -n hw.ncpu`
14320             ;;
14322         Linux)
14323             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14324         ;;
14325         # what else than above does profit here *and* has /proc?
14326         *)
14327             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14328             ;;
14329         esac
14331         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14332         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14333     fi
14336 if test $PARALLELISM -eq 0; then
14337     AC_MSG_RESULT([explicit make -j option needed])
14338 else
14339     AC_MSG_RESULT([$PARALLELISM])
14341 AC_SUBST(PARALLELISM)
14344 # Set up ILIB for MSVC build
14346 ILIB1=
14347 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
14348     ILIB="."
14349     if test -n "$JAVA_HOME"; then
14350         ILIB="$ILIB;$JAVA_HOME/lib"
14351     fi
14352     ILIB1=-link
14353     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14354     ILIB="$ILIB;$formatted_path"
14355     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14356     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14357     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14358     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14359         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14360         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14361     fi
14362     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14363     ucrtlibpath_formatted=$formatted_path
14364     ILIB="$ILIB;$ucrtlibpath_formatted"
14365     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14366     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14367         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14368         ILIB="$ILIB;$formatted_path"
14369     else
14370         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14371         ILIB="$ILIB;$formatted_path"
14372     fi
14374     if test "$cross_compiling" != "yes"; then
14375         ILIB_FOR_BUILD="$ILIB"
14376     fi
14378 AC_SUBST(ILIB)
14379 AC_SUBST(ILIB_FOR_BUILD)
14381 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14382 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14383 dnl from consteval constructor initializing const variable",
14384 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14385 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14386 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14387 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'",
14388 dnl <https://developercommunity.visualstudio.com/t/1581879> "Bogus error C7595 with consteval
14389 dnl constructor in ternary expression (/std:c++latest)", or
14390 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14391 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14392 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14393 dnl && "Ptr must be a pointer to Val type!"' failed.":
14394 AC_LANG_PUSH([C++])
14395 save_CXX=$CXX
14396 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14397     CXX="env LIB=$ILIB $CXX"
14399 save_CXXFLAGS=$CXXFLAGS
14400 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14401 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14402         struct S {
14403             consteval S() { i = 1; }
14404             int i = 0;
14405         };
14406         S const s;
14408         struct S1 { consteval S1(int) {} };
14409         struct S2 {
14410             S1 x;
14411             S2(): x(0) {}
14412         };
14414         struct S3 {
14415             consteval S3() {}
14416             union {
14417                 int a;
14418                 unsigned b = 0;
14419             };
14420         };
14421         void f() { S3(); }
14423         struct S4 { consteval S4() = default; };
14424         void f4(bool b) { b ? S4() : S4(); }
14426         struct S5 {
14427             consteval S5() { c = 0; }
14428             char * f() { return &c; }
14429             union {
14430                 char c;
14431                 int i;
14432             };
14433         };
14434         auto s5 = S5().f();
14435     ], [
14436         return (s.i == 1) ? 0 : 1;
14437     ])], [
14438         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14439         AC_MSG_RESULT([yes])
14440     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14441 CXX=$save_CXX
14442 CXXFLAGS=$save_CXXFLAGS
14443 AC_LANG_POP([C++])
14445 # ===================================================================
14446 # Creating bigger shared library to link against
14447 # ===================================================================
14448 AC_MSG_CHECKING([whether to create huge library])
14449 MERGELIBS=
14451 if test $_os = iOS -o $_os = Android; then
14452     # Never any point in mergelibs for these as we build just static
14453     # libraries anyway...
14454     enable_mergelibs=no
14457 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14458     if test $_os != Linux -a $_os != WINNT; then
14459         add_warning "--enable-mergelibs is not tested for this platform"
14460     fi
14461     MERGELIBS="TRUE"
14462     AC_MSG_RESULT([yes])
14463     AC_DEFINE(ENABLE_MERGELIBS)
14464 else
14465     AC_MSG_RESULT([no])
14467 AC_SUBST([MERGELIBS])
14469 dnl ===================================================================
14470 dnl icerun is a wrapper that stops us spawning tens of processes
14471 dnl locally - for tools that can't be executed on the compile cluster
14472 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14473 dnl ===================================================================
14474 AC_MSG_CHECKING([whether to use icerun wrapper])
14475 ICECREAM_RUN=
14476 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14477     ICECREAM_RUN=icerun
14478     AC_MSG_RESULT([yes])
14479 else
14480     AC_MSG_RESULT([no])
14482 AC_SUBST(ICECREAM_RUN)
14484 dnl ===================================================================
14485 dnl Setup the ICECC_VERSION for the build the same way it was set for
14486 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14487 dnl ===================================================================
14488 x_ICECC_VERSION=[\#]
14489 if test -n "$ICECC_VERSION" ; then
14490     x_ICECC_VERSION=
14492 AC_SUBST(x_ICECC_VERSION)
14493 AC_SUBST(ICECC_VERSION)
14495 dnl ===================================================================
14497 AC_MSG_CHECKING([MPL subset])
14498 MPL_SUBSET=
14500 if test "$enable_mpl_subset" = "yes"; then
14501     warn_report=false
14502     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14503         warn_report=true
14504     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14505         warn_report=true
14506     fi
14507     if test "$warn_report" = "true"; then
14508         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14509     fi
14510     if test "x$enable_postgresql_sdbc" != "xno"; then
14511         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14512     fi
14513     if test "$enable_lotuswordpro" = "yes"; then
14514         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14515     fi
14516     if test -n "$ENABLE_POPPLER"; then
14517         if test "x$SYSTEM_POPPLER" = "x"; then
14518             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14519         fi
14520     fi
14521     # cf. m4/libo_check_extension.m4
14522     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14523         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14524     fi
14525     for theme in $WITH_THEMES; do
14526         case $theme in
14527         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14528             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14529         *) : ;;
14530         esac
14531     done
14533     ENABLE_OPENGL_TRANSITIONS=
14535     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14536         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14537     fi
14539     MPL_SUBSET="TRUE"
14540     AC_DEFINE(MPL_HAVE_SUBSET)
14541     AC_MSG_RESULT([only])
14542 else
14543     AC_MSG_RESULT([no restrictions])
14545 AC_SUBST(MPL_SUBSET)
14547 dnl ===================================================================
14549 AC_MSG_CHECKING([formula logger])
14550 ENABLE_FORMULA_LOGGER=
14552 if test "x$enable_formula_logger" = "xyes"; then
14553     AC_MSG_RESULT([yes])
14554     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14555     ENABLE_FORMULA_LOGGER=TRUE
14556 elif test -n "$ENABLE_DBGUTIL" ; then
14557     AC_MSG_RESULT([yes])
14558     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14559     ENABLE_FORMULA_LOGGER=TRUE
14560 else
14561     AC_MSG_RESULT([no])
14564 AC_SUBST(ENABLE_FORMULA_LOGGER)
14566 dnl ===================================================================
14567 dnl Checking for active Antivirus software.
14568 dnl ===================================================================
14570 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14571     AC_MSG_CHECKING([for active Antivirus software])
14572     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
14573     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
14574     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14575         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14576             AC_MSG_RESULT([found])
14577             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14578             echo $EICAR_STRING > $SRC_ROOT/eicar
14579             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14580             rm $SRC_ROOT/eicar
14581             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14582                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14583             fi
14584             echo $EICAR_STRING > $BUILDDIR/eicar
14585             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14586             rm $BUILDDIR/eicar
14587             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14588                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14589             fi
14590             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"
14591         else
14592             AC_MSG_RESULT([not found])
14593         fi
14594     else
14595         AC_MSG_RESULT([n/a])
14596     fi
14599 dnl ===================================================================
14600 dnl Setting up the environment.
14601 dnl ===================================================================
14602 AC_MSG_NOTICE([setting up the build environment variables...])
14604 AC_SUBST(COMPATH)
14606 if test "$build_os" = "cygwin" -o "$build_os" = wsl; then
14607     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14608         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14609         ATL_INCLUDE="$COMPATH/atlmfc/include"
14610     elif test -d "$COMPATH/atlmfc/lib"; then
14611         ATL_LIB="$COMPATH/atlmfc/lib"
14612         ATL_INCLUDE="$COMPATH/atlmfc/include"
14613     else
14614         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14615         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14616     fi
14617     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14618     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14619     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14622 if test "$build_os" = "cygwin"; then
14623     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14624     PathFormat "/usr/bin/find.exe"
14625     FIND="$formatted_path"
14626     PathFormat "/usr/bin/sort.exe"
14627     SORT="$formatted_path"
14628     PathFormat "/usr/bin/grep.exe"
14629     WIN_GREP="$formatted_path"
14630     PathFormat "/usr/bin/ls.exe"
14631     WIN_LS="$formatted_path"
14632     PathFormat "/usr/bin/touch.exe"
14633     WIN_TOUCH="$formatted_path"
14634 else
14635     FIND=find
14636     SORT=sort
14639 AC_SUBST(ATL_INCLUDE)
14640 AC_SUBST(ATL_LIB)
14641 AC_SUBST(FIND)
14642 AC_SUBST(SORT)
14643 AC_SUBST(WIN_GREP)
14644 AC_SUBST(WIN_LS)
14645 AC_SUBST(WIN_TOUCH)
14647 AC_SUBST(BUILD_TYPE)
14649 AC_SUBST(SOLARINC)
14651 PathFormat "$PERL"
14652 PERL="$formatted_path"
14653 AC_SUBST(PERL)
14655 if test -n "$TMPDIR"; then
14656     TEMP_DIRECTORY="$TMPDIR"
14657 else
14658     TEMP_DIRECTORY="/tmp"
14660 if test "$build_os" = "cygwin"; then
14661     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14663 AC_SUBST(TEMP_DIRECTORY)
14665 # setup the PATH for the environment
14666 if test -n "$LO_PATH_FOR_BUILD"; then
14667     LO_PATH="$LO_PATH_FOR_BUILD"
14668     case "$host_os" in
14669     cygwin*|wsl*)
14670         pathmunge "$MSVC_HOST_PATH" "before"
14671         ;;
14672     esac
14673 else
14674     LO_PATH="$PATH"
14676     case "$host_os" in
14678     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14679         if test "$ENABLE_JAVA" != ""; then
14680             pathmunge "$JAVA_HOME/bin" "after"
14681         fi
14682         ;;
14684     cygwin*|wsl*)
14685         # Win32 make needs native paths
14686         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14687             LO_PATH=`cygpath -p -m "$PATH"`
14688         fi
14689         if test "$WIN_BUILD_ARCH" = "x64"; then
14690             # needed for msi packaging
14691             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14692         fi
14693         # .NET 4.6 and higher don't have bin directory
14694         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14695             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14696         fi
14697         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14698         pathmunge "$CSC_PATH" "before"
14699         pathmunge "$MIDL_PATH" "before"
14700         pathmunge "$AL_PATH" "before"
14701         pathmunge "$MSVC_MULTI_PATH" "before"
14702         pathmunge "$MSVC_BUILD_PATH" "before"
14703         if test -n "$MSBUILD_PATH" ; then
14704             pathmunge "$MSBUILD_PATH" "before"
14705         fi
14706         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14707         if test "$ENABLE_JAVA" != ""; then
14708             if test -d "$JAVA_HOME/jre/bin/client"; then
14709                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14710             fi
14711             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14712                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14713             fi
14714             pathmunge "$JAVA_HOME/bin" "before"
14715         fi
14716         pathmunge "$MSVC_HOST_PATH" "before"
14717         ;;
14719     solaris*)
14720         pathmunge "/usr/css/bin" "before"
14721         if test "$ENABLE_JAVA" != ""; then
14722             pathmunge "$JAVA_HOME/bin" "after"
14723         fi
14724         ;;
14725     esac
14728 AC_SUBST(LO_PATH)
14730 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14731 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14732     x_LO_ELFCHECK_ALLOWLIST=
14733 else
14734     x_LO_ELFCHECK_ALLOWLIST=[\#]
14736 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14737 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14739 libo_FUZZ_SUMMARY
14741 # Generate a configuration sha256 we can use for deps
14742 if test -f config_host.mk; then
14743     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14745 if test -f config_host_lang.mk; then
14746     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14749 CFLAGS=$my_original_CFLAGS
14750 CXXFLAGS=$my_original_CXXFLAGS
14751 CPPFLAGS=$my_original_CPPFLAGS
14753 AC_CONFIG_LINKS([include:include])
14755 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14756 # BUILD platform configuration] - otherwise breaks cross building
14757 AC_CONFIG_FILES([config_host.mk
14758                  config_host_lang.mk
14759                  Makefile
14760                  lo.xcent
14761                  bin/bffvalidator.sh
14762                  bin/odfvalidator.sh
14763                  bin/officeotron.sh
14764                  hardened_runtime.xcent
14765                  instsetoo_native/util/openoffice.lst
14766                  sysui/desktop/macosx/Info.plist
14767                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
14769 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
14770 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14771 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14772 AC_CONFIG_HEADERS([config_host/config_clang.h])
14773 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14774 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14775 AC_CONFIG_HEADERS([config_host/config_eot.h])
14776 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14777 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14778 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14779 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14780 AC_CONFIG_HEADERS([config_host/config_features.h])
14781 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14782 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14783 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14784 AC_CONFIG_HEADERS([config_host/config_folders.h])
14785 AC_CONFIG_HEADERS([config_host/config_fonts.h])
14786 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14787 AC_CONFIG_HEADERS([config_host/config_gio.h])
14788 AC_CONFIG_HEADERS([config_host/config_global.h])
14789 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14790 AC_CONFIG_HEADERS([config_host/config_java.h])
14791 AC_CONFIG_HEADERS([config_host/config_langs.h])
14792 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14793 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14794 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14795 AC_CONFIG_HEADERS([config_host/config_locales.h])
14796 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14797 AC_CONFIG_HEADERS([config_host/config_oox.h])
14798 AC_CONFIG_HEADERS([config_host/config_options.h])
14799 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14800 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14801 AC_CONFIG_HEADERS([config_host/config_skia.h])
14802 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14803 AC_CONFIG_HEADERS([config_host/config_validation.h])
14804 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14805 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14806 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14807 AC_CONFIG_HEADERS([config_host/config_version.h])
14808 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14809 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14810 AC_CONFIG_HEADERS([config_host/config_python.h])
14811 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14812 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
14813 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
14814 AC_OUTPUT
14816 if test "$CROSS_COMPILING" = TRUE; then
14817     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14820 # touch the config timestamp file
14821 if test ! -f config_host.mk.stamp; then
14822     echo > config_host.mk.stamp
14823 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14824     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14825 else
14826     echo > config_host.mk.stamp
14829 # touch the config lang timestamp file
14830 if test ! -f config_host_lang.mk.stamp; then
14831     echo > config_host_lang.mk.stamp
14832 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14833     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14834 else
14835     echo > config_host_lang.mk.stamp
14839 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14840         -a "$build_os" = "cygwin"; then
14842 cat << _EOS
14843 ****************************************************************************
14844 WARNING:
14845 Your make version is known to be horribly slow, and hard to debug
14846 problems with. To get a reasonably functional make please do:
14848 to install a pre-compiled binary make for Win32
14850  mkdir -p /opt/lo/bin
14851  cd /opt/lo/bin
14852  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14853  cp make-4.2.1-msvc.exe make
14854  chmod +x make
14856 to install from source:
14857 place yourself in a working directory of you choice.
14859  git clone git://git.savannah.gnu.org/make.git
14861  [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"]
14862  set PATH=%PATH%;C:\Cygwin\bin
14863  [or Cygwin64, if that is what you have]
14864  cd path-to-make-repo-you-cloned-above
14865  build_w32.bat --without-guile
14867 should result in a WinRel/gnumake.exe.
14868 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14870 Then re-run autogen.sh
14872 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14873 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14875 _EOS
14876 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14877     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14882 cat << _EOF
14883 ****************************************************************************
14885 To show information on various make targets and make flags, run:
14886 $GNUMAKE help
14888 To just build, run:
14889 $GNUMAKE
14891 _EOF
14893 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14894     cat << _EOF
14895 After the build has finished successfully, you can immediately run what you built using the command:
14896 _EOF
14898     if test $_os = Darwin; then
14899         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14900     else
14901         echo instdir/program/soffice
14902     fi
14903     cat << _EOF
14905 If you want to run the unit tests, run:
14906 $GNUMAKE check
14908 _EOF
14911 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
14912     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14913     cat "$WARNINGS_FILE_FOR_BUILD"
14914     echo
14917 if test -s "$WARNINGS_FILE"; then
14918     echo "HOST config ($WARNINGS_FILE)"
14919     cat "$WARNINGS_FILE"
14922 # Remove unneeded emconfigure artifacts
14923 rm -f a.out a.wasm a.out.js a.out.wasm
14925 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: