Update git submodules
[LibreOffice.git] / configure.ac
blob86896f3c4c805ee5d5fa8702ab165f757af30362
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.6.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     if test "$COM" = "MSC"; then
50         for f in $1; do
51             if test "x$f" != "x${f#-L}"; then
52                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
53             elif test "x$f" != "x${f#-l}"; then
54                 filteredlibs="$filteredlibs ${f:2}.lib"
55             else
56                 filteredlibs="$filteredlibs $f"
57             fi
58         done
59     else
60         for f in $1; do
61             case "$f" in
62                 # let's start with Fedora's paths for now
63                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
64                     # ignore it: on UNIXoids it is searched by default anyway
65                     # but if it's given explicitly then it may override other paths
66                     # (on macOS it would be an error to use it instead of SDK)
67                     ;;
68                 *)
69                     filteredlibs="$filteredlibs $f"
70                     ;;
71             esac
72         done
73     fi
76 PathFormat()
78     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
79     # function is called also on Unix.
80     #
81     # Return value: $formatted_path and $formatted_path_unix.
82     #
83     # $formatted_path is the argument in Windows format, but using forward slashes instead of
84     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
85     # or shell metacharacters).
86     #
87     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
88     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
89     # Unix pathname.
90     #
91     # Errors out if 8.3 names are needed but aren't present for some of the path components.
93     # Examples:
94     #
95     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
96     #
97     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
98     #
99     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
100     #
101     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
102     #
103     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
104     #
105     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
106     #
107     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
109     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
110         printf "PathFormat $1 ==> "
111     fi
113     formatted_path="$1"
114     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
115         if test "$build_os" = "wsl"; then
116             formatted_path=$(echo "$formatted_path" | tr -d '\r')
117         fi
119         pf_conv_to_dos=
120         # spaces,parentheses,brackets,braces are problematic in pathname
121         # so are backslashes
122         case "$formatted_path" in
123             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
124                 pf_conv_to_dos="yes"
125             ;;
126         esac
127         if test "$pf_conv_to_dos" = "yes"; then
128             if test "$build_os" = "wsl"; then
129                 case "$formatted_path" in
130                     /*)
131                         formatted_path=$(wslpath -w "$formatted_path")
132                         ;;
133                 esac
134                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
135             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
136                 formatted_path=`cygpath -sm "$formatted_path"`
137             else
138                 formatted_path=`cygpath -d "$formatted_path"`
139             fi
140             if test $? -ne 0;  then
141                 AC_MSG_ERROR([path conversion failed for "$1".])
142             fi
143         fi
144         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
145         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
146         if test "$fp_count_slash$fp_count_colon" != "00"; then
147             if test "$fp_count_colon" = "0"; then
148                 new_formatted_path=`realpath "$formatted_path"`
149                 if test $? -ne 0;  then
150                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
151                 else
152                     formatted_path="$new_formatted_path"
153                 fi
154             fi
155             if test "$build_os" = "wsl"; then
156                 if test "$fp_count_colon" != "0"; then
157                     formatted_path=$(wslpath "$formatted_path")
158                     local final_slash=
159                     case "$formatted_path" in
160                         */)
161                             final_slash=/
162                             ;;
163                     esac
164                     formatted_path=$(wslpath -m $formatted_path)
165                     case "$formatted_path" in
166                         */)
167                             ;;
168                         *)
169                             formatted_path="$formatted_path"$final_slash
170                             ;;
171                     esac
172                 else
173                     formatted_path=$(wslpath -m "$formatted_path")
174                 fi
175             else
176                 formatted_path=`cygpath -m "$formatted_path"`
177             fi
178             if test $? -ne 0;  then
179                 AC_MSG_ERROR([path conversion failed for "$1".])
180             fi
181         fi
182         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
183         if test "$fp_count_space" != "0"; then
184             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
185         fi
186     fi
187     if test "$build_os" = "wsl"; then
188         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
189         formatted_path_unix=$(wslpath "$formatted_path")
190     else
191         # But Cygwin can
192         formatted_path_unix="$formatted_path"
193     fi
196 AbsolutePath()
198     # There appears to be no simple and portable method to get an absolute and
199     # canonical path, so we try creating the directory if does not exist and
200     # utilizing the shell and pwd.
202     # Args: $1: A possibly relative pathname
203     # Return value: $absolute_path
205     # Convert to unix path, mkdir would treat c:/path as a relative path.
206     PathFormat "$1"
207     local rel="$formatted_path_unix"
208     absolute_path=""
209     test ! -e "$rel" && mkdir -p "$rel"
210     if test -d "$rel" ; then
211         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
212         absolute_path="$(pwd)"
213         cd - > /dev/null
214     else
215         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
216     fi
219 WARNINGS_FILE=config.warn
220 WARNINGS_FILE_FOR_BUILD=config.Build.warn
221 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
222 have_WARNINGS="no"
223 add_warning()
225     if test "$have_WARNINGS" = "no"; then
226         echo "*************************************" > "$WARNINGS_FILE"
227         have_WARNINGS="yes"
228         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
229             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
230             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
231         else
232             COLORWARN="* WARNING :"
233         fi
234     fi
235     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
238 dnl Some Mac User have the bad habit of letting a lot of crap
239 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
240 dnl that confuse the build.
241 dnl For the ones that use LODE, let's be nice and protect them
242 dnl from themselves
244 mac_sanitize_path()
246     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
247 dnl a common but nevertheless necessary thing that may be in a fancy
248 dnl path location is git, so make sure we have it
249     mac_git_path=`which git 2>/dev/null`
250     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
251         mac_path="$mac_path:`dirname $mac_git_path`"
252     fi
253 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
254 dnl path location is gpg, so make sure we find it
255     mac_gpg_path=`which gpg 2>/dev/null`
256     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
257         mac_path="$mac_path:`dirname $mac_gpg_path`"
258     fi
259     PATH="$mac_path"
260     unset mac_path
261     unset mac_git_path
262     unset mac_gpg_path
265 dnl semantically test a three digits version
266 dnl $1 - $3 = minimal version
267 dnl $4 - $6 = current version
269 check_semantic_version_three()
271     test "$4" -gt "$1" \
272         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
273         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
274     return $?
277 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
278 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
279 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
281 check_semantic_version_three_prefixed()
283     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
284     eval local MIN_MINOR="\$${1}_${2}_MINOR"
285     eval local MIN_TINY="\$${1}_${2}_TINY"
286     eval local CUR_MAJOR="\$${1}_MAJOR"
287     eval local CUR_MINOR="\$${1}_MINOR"
288     eval local CUR_TINY="\$${1}_TINY"
289     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
290     return $?
293 echo "********************************************************************"
294 echo "*"
295 echo "*   Running ${PACKAGE_NAME} build configuration."
296 echo "*"
297 echo "********************************************************************"
298 echo ""
300 dnl ===================================================================
301 dnl checks build and host OSes
302 dnl do this before argument processing to allow for platform dependent defaults
303 dnl ===================================================================
305 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
306 # Linux on WSL) trust that.
307 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
308     ac_cv_host="x86_64-pc-wsl"
309     ac_cv_host_cpu="x86_64"
310     ac_cv_host_os="wsl"
311     ac_cv_build="$ac_cv_host"
312     ac_cv_build_cpu="$ac_cv_host_cpu"
313     ac_cv_build_os="$ac_cv_host_os"
315     # Emulation of Cygwin's cygpath command for WSL.
316     cygpath()
317     {
318         if test -n "$UNITTEST_WSL_CYGPATH"; then
319             echo -n cygpath "$@" "==> "
320         fi
322         # Cygwin's real cygpath has a plethora of options but we use only a few here.
323         local args="$@"
324         local opt
325         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
326         OPTIND=1
328         while getopts dmuwlsp opt; do
329             case "$opt" in
330                 \?)
331                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
332                     ;;
333                 ?)
334                     eval opt_$opt=yes
335                     ;;
336             esac
337         done
339         shift $((OPTIND-1))
341         if test $# -ne 1; then
342             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
343         fi
345         local input="$1"
347         local result
349         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
350             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
352             if test -n "$opt_u"; then
353                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
354             fi
356             case "$input" in
357                 /mnt/*)
358                     # A Windows file in WSL format
359                     input=$(wslpath -w "$input")
360                     ;;
361                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
362                     # Already in Windows format
363                     ;;
364                 /*)
365                     input=$(wslpath -w "$input")
366                     ;;
367                 *)
368                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
369                     ;;
370             esac
371             if test -n "$opt_d" -o -n "$opt_s"; then
372                 input=$($WSL_LO_HELPER --8.3 "$input")
373             fi
374             if test -n "$opt_m"; then
375                 input="${input//\\//}"
376             fi
377             echo "$input"
378         else
379             # Print Unix path
381             case "$input" in
382                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
383                     wslpath -u "$input"
384                     ;;
385                 /)
386                     echo "$input"
387                     ;;
388                 *)
389                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
390                     ;;
391             esac
392         fi
393     }
395     if test -n "$UNITTEST_WSL_CYGPATH"; then
396         BUILDDIR=.
398         # Nothing special with these file names, just arbitrary ones picked to test with
399         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
400         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
401         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
402         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
403         # At least on my machine for instance this file does have an 8.3 name
404         cygpath -d /mnt/c/windows/WindowsUpdate.log
405         # But for instance this one doesn't
406         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
407         cygpath -ws /mnt/c/windows/WindowsUpdate.log
408         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
409         cygpath -ms /mnt/c/windows/WindowsUpdate.log
411         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
412         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
414         exit 0
415     fi
417     if test -z "$WSL_LO_HELPER"; then
418         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
419             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
420         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
421             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
422         fi
423     fi
424     if test -z "$WSL_LO_HELPER"; then
425         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
426     fi
429 AC_CANONICAL_HOST
430 AC_CANONICAL_BUILD
432 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
433     BUILDDIR=.
434     GREP=grep
436     # Use of PathFormat must be after AC_CANONICAL_BUILD above
437     PathFormat /
438     printf "$formatted_path , $formatted_path_unix\n"
440     PathFormat $PWD
441     printf "$formatted_path , $formatted_path_unix\n"
443     PathFormat "$PROGRAMFILESX86"
444     printf "$formatted_path , $formatted_path_unix\n"
446     exit 0
449 AC_MSG_CHECKING([for product name])
450 PRODUCTNAME="AC_PACKAGE_NAME"
451 if test -n "$with_product_name" -a "$with_product_name" != no; then
452     PRODUCTNAME="$with_product_name"
454 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
455     PRODUCTNAME="${PRODUCTNAME}Dev"
457 AC_MSG_RESULT([$PRODUCTNAME])
458 AC_SUBST(PRODUCTNAME)
459 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
460 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
462 dnl ===================================================================
463 dnl Our version is defined by the AC_INIT() at the top of this script.
464 dnl ===================================================================
466 AC_MSG_CHECKING([for package version])
467 if test -n "$with_package_version" -a "$with_package_version" != no; then
468     PACKAGE_VERSION="$with_package_version"
470 AC_MSG_RESULT([$PACKAGE_VERSION])
472 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
474 LIBO_VERSION_MAJOR=$1
475 LIBO_VERSION_MINOR=$2
476 LIBO_VERSION_MICRO=$3
477 LIBO_VERSION_PATCH=$4
479 LIBO_VERSION_SUFFIX=$5
481 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
482 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
483 # they get undoubled before actually passed to sed.
484 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
485 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
486 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
487 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
489 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
490 # three non-negative integers. Please find more information about CFBundleVersion at
491 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
493 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
494 # of at most three non-negative integers. Please find more information about
495 # CFBundleShortVersionString at
496 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
498 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
500 if test "$enable_macosx_sandbox" = yes; then
501     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
502     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
503 else
504     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
505     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
508 AC_SUBST(LIBO_VERSION_MAJOR)
509 AC_SUBST(LIBO_VERSION_MINOR)
510 AC_SUBST(LIBO_VERSION_MICRO)
511 AC_SUBST(LIBO_VERSION_PATCH)
512 AC_SUBST(LIBO_VERSION_SUFFIX)
513 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
514 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
515 AC_SUBST(MACOSX_BUNDLE_VERSION)
517 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
518 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
519 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
520 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
522 LIBO_THIS_YEAR=`date +%Y`
523 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
525 # replace backslashes, to get a valid c++ string
526 config_args=$(echo $ac_configure_args | tr '\\' '/')
527 AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
529 dnl ===================================================================
530 dnl Product version
531 dnl ===================================================================
532 AC_MSG_CHECKING([for product version])
533 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
534 AC_MSG_RESULT([$PRODUCTVERSION])
535 AC_SUBST(PRODUCTVERSION)
537 AC_PROG_EGREP
538 # AC_PROG_EGREP doesn't set GREP on all systems as well
539 AC_PATH_PROG(GREP, grep)
541 BUILDDIR=`pwd`
542 cd $srcdir
543 SRC_ROOT=`pwd`
544 cd $BUILDDIR
545 x_Cygwin=[\#]
547 dnl ======================================
548 dnl Required GObject introspection version
549 dnl ======================================
550 INTROSPECTION_REQUIRED_VERSION=1.32.0
552 dnl ===================================================================
553 dnl Search all the common names for GNU Make
554 dnl ===================================================================
555 AC_MSG_CHECKING([for GNU Make])
557 # try to use our own make if it is available and GNUMAKE was not already defined
558 if test -z "$GNUMAKE"; then
559     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
560         GNUMAKE="$LODE_HOME/opt/bin/make"
561     elif test -x "/opt/lo/bin/make"; then
562         GNUMAKE="/opt/lo/bin/make"
563     fi
566 GNUMAKE_WIN_NATIVE=
567 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
568     if test -n "$a"; then
569         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
570         if test $? -eq 0;  then
571             if test "$build_os" = "cygwin"; then
572                 if test -n "$($a -v | grep 'Built for Windows')" ; then
573                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
574                     GNUMAKE_WIN_NATIVE="TRUE"
575                 else
576                     GNUMAKE=`which $a`
577                 fi
578             else
579                 GNUMAKE=`which $a`
580             fi
581             break
582         fi
583     fi
584 done
585 AC_MSG_RESULT($GNUMAKE)
586 if test -z "$GNUMAKE"; then
587     AC_MSG_ERROR([not found. install GNU Make.])
588 else
589     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
590         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
591     fi
594 win_short_path_for_make()
596     local short_path="$1"
597     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
598         cygpath -sm "$short_path"
599     else
600         cygpath -u "$(cygpath -d "$short_path")"
601     fi
605 if test "$build_os" = "cygwin"; then
606     PathFormat "$SRC_ROOT"
607     SRC_ROOT="$formatted_path"
608     PathFormat "$BUILDDIR"
609     BUILDDIR="$formatted_path"
610     x_Cygwin=
611     AC_MSG_CHECKING(for explicit COMSPEC)
612     if test -z "$COMSPEC"; then
613         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
614     else
615         AC_MSG_RESULT([found: $COMSPEC])
616     fi
619 AC_SUBST(SRC_ROOT)
620 AC_SUBST(BUILDDIR)
621 AC_SUBST(x_Cygwin)
622 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
623 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
624 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
626 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
627     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
630 # need sed in os checks...
631 AC_PATH_PROGS(SED, sed)
632 if test -z "$SED"; then
633     AC_MSG_ERROR([install sed to run this script])
636 # Set the ENABLE_LTO variable
637 # ===================================================================
638 AC_MSG_CHECKING([whether to use link-time optimization])
639 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
640     ENABLE_LTO="TRUE"
641     AC_MSG_RESULT([yes])
642 else
643     ENABLE_LTO=""
644     AC_MSG_RESULT([no])
646 AC_SUBST(ENABLE_LTO)
648 AC_ARG_ENABLE(fuzz-options,
649     AS_HELP_STRING([--enable-fuzz-options],
650         [Randomly enable or disable each of those configurable options
651          that are supposed to be freely selectable without interdependencies,
652          or where bad interaction from interdependencies is automatically avoided.])
655 dnl ===================================================================
656 dnl When building for Android, --with-android-ndk,
657 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
658 dnl mandatory
659 dnl ===================================================================
661 AC_ARG_WITH(android-ndk,
662     AS_HELP_STRING([--with-android-ndk],
663         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
666 AC_ARG_WITH(android-ndk-toolchain-version,
667     AS_HELP_STRING([--with-android-ndk-toolchain-version],
668         [Specify which toolchain version to use, of those present in the
669         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
670         with_android_ndk_toolchain_version=clang5.0)
672 AC_ARG_WITH(android-sdk,
673     AS_HELP_STRING([--with-android-sdk],
674         [Specify location of the Android SDK. Mandatory when building for Android.]),
677 AC_ARG_WITH(android-api-level,
678     AS_HELP_STRING([--with-android-api-level],
679         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
682 ANDROID_NDK_DIR=
683 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
684     with_android_ndk="$SRC_ROOT/external/android-ndk"
686 if test -n "$with_android_ndk"; then
687     eval ANDROID_NDK_DIR=$with_android_ndk
689     # Set up a lot of pre-canned defaults
691     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
692         if test ! -f $ANDROID_NDK_DIR/source.properties; then
693             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
694         fi
695         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
696     else
697         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
698     fi
699     if test -z "$ANDROID_NDK_VERSION";  then
700         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
701     fi
702     case $ANDROID_NDK_VERSION in
703     r9*|r10*)
704         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
705         ;;
706     11.1.*|12.1.*|13.1.*|14.1.*)
707         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
708         ;;
709     16.*|17.*|18.*|19.*|20.*|21.*|22.*)
710         ;;
711     *)
712         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* to 22.* have been used successfully. Proceed at your own risk.])
713         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* to 22.* have been used successfully. Proceed at your own risk."
714         ;;
715     esac
717     ANDROID_API_LEVEL=16
718     if test -n "$with_android_api_level" ; then
719         ANDROID_API_LEVEL="$with_android_api_level"
720     fi
722     android_cpu=$host_cpu
723     if test $host_cpu = arm; then
724         android_platform_prefix=arm-linux-androideabi
725         android_gnu_prefix=$android_platform_prefix
726         LLVM_TRIPLE=armv7a-linux-androideabi
727         ANDROID_APP_ABI=armeabi-v7a
728         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
729     elif test $host_cpu = aarch64; then
730         android_platform_prefix=aarch64-linux-android
731         android_gnu_prefix=$android_platform_prefix
732         LLVM_TRIPLE=$android_platform_prefix
733         # minimum android version that supports aarch64
734         if test "$ANDROID_API_LEVEL" -lt "21" ; then
735             ANDROID_API_LEVEL=21
736         fi
737         ANDROID_APP_ABI=arm64-v8a
738     elif test $host_cpu = x86_64; then
739         android_platform_prefix=x86_64-linux-android
740         android_gnu_prefix=$android_platform_prefix
741         LLVM_TRIPLE=$android_platform_prefix
742         # minimum android version that supports x86_64
743         ANDROID_API_LEVEL=21
744         ANDROID_APP_ABI=x86_64
745     else
746         # host_cpu is something like "i386" or "i686" I guess, NDK uses
747         # "x86" in some contexts
748         android_cpu=x86
749         android_platform_prefix=$android_cpu
750         android_gnu_prefix=i686-linux-android
751         LLVM_TRIPLE=$android_gnu_prefix
752         ANDROID_APP_ABI=x86
753     fi
755     case "$with_android_ndk_toolchain_version" in
756     clang5.0)
757         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
758         ;;
759     *)
760         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
761     esac
763     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
765     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
766     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
767     # manage to link the (app-specific) single huge .so that is built for the app in
768     # android/source/ if there is debug information in a significant part of the object files.
769     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
770     # all objects have been built with debug information.)
771     case $build_os in
772     linux-gnu*)
773         android_HOST_TAG=linux-x86_64
774         ;;
775     darwin*)
776         android_HOST_TAG=darwin-x86_64
777         ;;
778     *)
779         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
780         # ndk would also support windows and windows-x86_64
781         ;;
782     esac
783     android_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
784     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
785     dnl TODO: NSS build uses it...
786     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_DIR/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
787     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
789     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
790     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
791     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
792     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
793     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
795     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
796     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
797     if test "$ENABLE_LTO" = TRUE; then
798         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
799         # $CC and $CXX when building external libraries
800         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
801     fi
803     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
805     if test -z "$CC"; then
806         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
807         CC_BASE="clang"
808     fi
809     if test -z "$CXX"; then
810         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
811         CXX_BASE="clang++"
812     fi
814 AC_SUBST(ANDROID_NDK_DIR)
815 AC_SUBST(ANDROID_APP_ABI)
816 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
818 dnl ===================================================================
819 dnl --with-android-sdk
820 dnl ===================================================================
821 ANDROID_SDK_DIR=
822 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
823     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
825 if test -n "$with_android_sdk"; then
826     eval ANDROID_SDK_DIR=$with_android_sdk
827     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
829 AC_SUBST(ANDROID_SDK_DIR)
831 AC_ARG_ENABLE([android-lok],
832     AS_HELP_STRING([--enable-android-lok],
833         [The Android app from the android/ subdir needs several tweaks all
834          over the place that break the LOK when used in the Online-based
835          Android app.  This switch indicates that the intent of this build is
836          actually the Online-based, non-modified LOK.])
838 ENABLE_ANDROID_LOK=
839 if test -n "$ANDROID_NDK_DIR" ; then
840     if test "$enable_android_lok" = yes; then
841         ENABLE_ANDROID_LOK=TRUE
842         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
843         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
844     else
845         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
846     fi
848 AC_SUBST([ENABLE_ANDROID_LOK])
850 libo_FUZZ_ARG_ENABLE([android-editing],
851     AS_HELP_STRING([--enable-android-editing],
852         [Enable the experimental editing feature on Android.])
854 ENABLE_ANDROID_EDITING=
855 if test "$enable_android_editing" = yes; then
856     ENABLE_ANDROID_EDITING=TRUE
858 AC_SUBST([ENABLE_ANDROID_EDITING])
860 disable_database_connectivity_dependencies()
862     enable_evolution2=no
863     enable_firebird_sdbc=no
864     enable_mariadb_sdbc=no
865     enable_postgresql_sdbc=no
866     enable_report_builder=no
869 # ===================================================================
871 # Start initial platform setup
873 # The using_* variables reflect platform support and should not be
874 # changed after the "End initial platform setup" block.
875 # This is also true for most test_* variables.
876 # ===================================================================
877 build_crypto=yes
878 test_clucene=no
879 test_gdb_index=no
880 test_openldap=yes
881 test_split_debug=no
882 test_webdav=yes
883 usable_dlapi=yes
885 # There is currently just iOS not using salplug, so this explicitly enables it.
886 # must: using_freetype_fontconfig
887 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
888 # must: using_x11
890 # Default values, as such probably valid just for Linux, set
891 # differently below just for Mac OSX, but at least better than
892 # hardcoding these as we used to do. Much of this is duplicated also
893 # in solenv for old build system and for gbuild, ideally we should
894 # perhaps define stuff like this only here in configure.ac?
896 LINKFLAGSSHL="-shared"
897 PICSWITCH="-fpic"
898 DLLPOST=".so"
900 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
902 INSTROOTBASESUFFIX=
903 INSTROOTCONTENTSUFFIX=
904 SDKDIRNAME=sdk
906 HOST_PLATFORM="$host"
908 host_cpu_for_clang="$host_cpu"
910 case "$host_os" in
912 solaris*)
913     using_freetype_fontconfig=yes
914     using_x11=yes
915     build_skia=yes
916     _os=SunOS
918     dnl ===========================================================
919     dnl Check whether we're using Solaris 10 - SPARC or Intel.
920     dnl ===========================================================
921     AC_MSG_CHECKING([the Solaris operating system release])
922     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
923     if test "$_os_release" -lt "10"; then
924         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
925     else
926         AC_MSG_RESULT([ok ($_os_release)])
927     fi
929     dnl Check whether we're using a SPARC or i386 processor
930     AC_MSG_CHECKING([the processor type])
931     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
932         AC_MSG_RESULT([ok ($host_cpu)])
933     else
934         AC_MSG_ERROR([only SPARC and i386 processors are supported])
935     fi
936     ;;
938 linux-gnu*|k*bsd*-gnu*|linux-musl*)
939     using_freetype_fontconfig=yes
940     using_x11=yes
941     build_skia=yes
942     test_gdb_index=yes
943     test_split_debug=yes
944     if test "$enable_fuzzers" = yes; then
945         test_system_freetype=no
946     fi
947     _os=Linux
948     ;;
950 gnu)
951     using_freetype_fontconfig=yes
952     using_x11=no
953     _os=GNU
954      ;;
956 cygwin*|wsl*)
957     # When building on Windows normally with MSVC under Cygwin,
958     # configure thinks that the host platform (the platform the
959     # built code will run on) is Cygwin, even if it obviously is
960     # Windows, which in Autoconf terminology is called
961     # "mingw32". (Which is misleading as MinGW is the name of the
962     # tool-chain, not an operating system.)
964     # Somewhat confusing, yes. But this configure script doesn't
965     # look at $host etc that much, it mostly uses its own $_os
966     # variable, set here in this case statement.
968     using_freetype_fontconfig=no
969     using_x11=no
970     test_unix_dlapi=no
971     test_openldap=no
972     enable_pagein=no
973     build_skia=yes
974     _os=WINNT
976     DLLPOST=".dll"
977     LINKFLAGSNOUNDEFS=
979     if test "$host_cpu" = "aarch64"; then
980         build_skia=no
981         enable_gpgmepp=no
982         enable_coinmp=no
983         enable_firebird_sdbc=no
984     fi
985     ;;
987 darwin*) # macOS
988     using_freetype_fontconfig=no
989     using_x11=no
990     build_skia=yes
991     enable_pagein=no
992     if test -n "$LODE_HOME" ; then
993         mac_sanitize_path
994         AC_MSG_NOTICE([sanitized the PATH to $PATH])
995     fi
996     _os=Darwin
997     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
998     INSTROOTCONTENTSUFFIX=/Contents
999     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1000     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1001     LINKFLAGSSHL="-dynamiclib -single_module"
1003     # -fPIC is default
1004     PICSWITCH=""
1006     DLLPOST=".dylib"
1008     # -undefined error is the default
1009     LINKFLAGSNOUNDEFS=""
1010     case "$host_cpu" in
1011     aarch64|arm64)
1012         # Apple's Clang uses "arm64"
1013         host_cpu_for_clang=arm64
1014     esac
1017 ios*) # iOS
1018     using_freetype_fontconfig=no
1019     using_x11=no
1020     build_crypto=no
1021     test_libcmis=no
1022     test_openldap=no
1023     test_webdav=no
1024     if test -n "$LODE_HOME" ; then
1025         mac_sanitize_path
1026         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1027     fi
1028     enable_gpgmepp=no
1029     _os=iOS
1030     enable_mpl_subset=yes
1031     enable_lotuswordpro=no
1032     disable_database_connectivity_dependencies
1033     enable_coinmp=no
1034     enable_lpsolve=no
1035     enable_extension_integration=no
1036     enable_xmlhelp=no
1037     with_ppds=no
1038     if test "$enable_ios_simulator" = "yes"; then
1039         host=x86_64-apple-darwin
1040     fi
1041     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1042     LINKFLAGSSHL="-dynamiclib -single_module"
1044     # -fPIC is default
1045     PICSWITCH=""
1047     DLLPOST=".dylib"
1049     # -undefined error is the default
1050     LINKFLAGSNOUNDEFS=""
1052     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1053     # part, so use aarch64-apple-darwin for now.
1054     HOST_PLATFORM=aarch64-apple-darwin
1056     # Apple's Clang uses "arm64"
1057     host_cpu_for_clang=arm64
1060 freebsd*)
1061     using_freetype_fontconfig=yes
1062     using_x11=yes
1063     build_skia=yes
1064     AC_MSG_CHECKING([the FreeBSD operating system release])
1065     if test -n "$with_os_version"; then
1066         OSVERSION="$with_os_version"
1067     else
1068         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1069     fi
1070     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1071     AC_MSG_CHECKING([which thread library to use])
1072     if test "$OSVERSION" -lt "500016"; then
1073         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1074         PTHREAD_LIBS="-pthread"
1075     elif test "$OSVERSION" -lt "502102"; then
1076         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1077         PTHREAD_LIBS="-lc_r"
1078     else
1079         PTHREAD_CFLAGS=""
1080         PTHREAD_LIBS="-pthread"
1081     fi
1082     AC_MSG_RESULT([$PTHREAD_LIBS])
1083     _os=FreeBSD
1084     ;;
1086 *netbsd*)
1087     using_freetype_fontconfig=yes
1088     using_x11=yes
1089     test_gtk3_kde5=no
1090     build_skia=yes
1091     PTHREAD_LIBS="-pthread -lpthread"
1092     _os=NetBSD
1093     ;;
1095 openbsd*)
1096     using_freetype_fontconfig=yes
1097     using_x11=yes
1098     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1099     PTHREAD_LIBS="-pthread"
1100     _os=OpenBSD
1101     ;;
1103 dragonfly*)
1104     using_freetype_fontconfig=yes
1105     using_x11=yes
1106     build_skia=yes
1107     PTHREAD_LIBS="-pthread"
1108     _os=DragonFly
1109     ;;
1111 linux-android*)
1112     # API exists, but seems not really usable since Android 7 AFAIK
1113     usable_dlapi=no
1114     using_freetype_fontconfig=yes
1115     using_headless_plugin=no
1116     using_x11=no
1117     build_crypto=no
1118     test_openldap=no
1119     test_system_freetype=no
1120     test_webdav=no
1121     disable_database_connectivity_dependencies
1122     enable_lotuswordpro=no
1123     enable_mpl_subset=yes
1124     enable_cairo_canvas=no
1125     enable_coinmp=yes
1126     enable_lpsolve=no
1127     enable_odk=no
1128     enable_python=no
1129     enable_xmlhelp=no
1130     _os=Android
1131     ;;
1133 haiku*)
1134     using_freetype_fontconfig=yes
1135     using_x11=no
1136     test_gtk3=no
1137     test_gtk3_kde5=no
1138     test_kf5=yes
1139     enable_odk=no
1140     enable_coinmp=no
1141     enable_pdfium=no
1142     enable_sdremote=no
1143     enable_postgresql_sdbc=no
1144     enable_firebird_sdbc=no
1145     _os=Haiku
1146     ;;
1148 emscripten)
1149     # API currently just exists in headers, not code
1150     usable_dlapi=no
1151     using_freetype_fontconfig=yes
1152     using_x11=yes
1153     test_openldap=no
1154     test_qt5=yes
1155     test_split_debug=yes
1156     test_system_freetype=no
1157     enable_compiler_plugins=no
1158     enable_customtarget_components=yes
1159     enable_split_debug=yes
1160     enable_wasm_strip=yes
1161     with_system_zlib=no
1162     with_theme="colibre"
1163     _os=Emscripten
1164     ;;
1167     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1168     ;;
1169 esac
1171 AC_SUBST(HOST_PLATFORM)
1173 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1174     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1177 # Set defaults, if not set by platform
1178 test "${test_cups+set}" = set || test_cups="$using_x11"
1179 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1180 test "${test_gen+set}" = set || test_gen="$using_x11"
1181 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1182 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1183 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1184 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1185 # don't handle test_qt5, so it can disable test_kf5 later
1186 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1187 test "${test_randr+set}" = set || test_randr="$using_x11"
1188 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1189 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1191 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1192 # Make sure fontconfig and freetype test both either system or not
1193 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1194 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1196 # convenience / platform overriding "fixes"
1197 # Don't sort!
1198 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1199 test "$test_kf5" = yes && test_qt5=yes
1200 test "$test_gtk3" != yes && enable_gtk3=no
1201 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1202 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1203 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1205 # Keep in sync with the above $using_x11 depending test default list
1206 disable_x11_tests()
1208     test_cups=no
1209     test_dbus=no
1210     test_gen=no
1211     test_gstreamer_1_0=no
1212     test_gtk3_kde5=no
1213     test_gtk3=no
1214     test_gtk4=no
1215     test_kf5=no
1216     test_qt5=no
1217     test_qt6=no
1218     test_randr=no
1219     test_xrender=no
1222 test "$using_x11" = yes && USING_X11=TRUE
1224 if test "$using_freetype_fontconfig" = yes; then
1225     AC_DEFINE(USE_HEADLESS_CODE)
1226     USE_HEADLESS_CODE=TRUE
1227     if test "$using_headless_plugin" = yes; then
1228         AC_DEFINE(ENABLE_HEADLESS)
1229         ENABLE_HEADLESS=TRUE
1230     fi
1231 else
1232     test_fontconfig=no
1233     test_freetype=no
1236 AC_SUBST(ENABLE_HEADLESS)
1237 AC_SUBST(USE_HEADLESS_CODE)
1239 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1240 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1241 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1242 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1244 # ===================================================================
1246 # End initial platform setup
1248 # ===================================================================
1250 if test "$_os" = "Android" ; then
1251     # Verify that the NDK and SDK options are proper
1252     if test -z "$with_android_ndk"; then
1253         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1254     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1255         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1256     fi
1258     if test -z "$ANDROID_SDK_DIR"; then
1259         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1260     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1261         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1262     fi
1265 AC_SUBST(SDKDIRNAME)
1267 AC_SUBST(PTHREAD_CFLAGS)
1268 AC_SUBST(PTHREAD_LIBS)
1270 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1271 # By default use the ones specified by our build system,
1272 # but explicit override is possible.
1273 AC_MSG_CHECKING(for explicit AFLAGS)
1274 if test -n "$AFLAGS"; then
1275     AC_MSG_RESULT([$AFLAGS])
1276     x_AFLAGS=
1277 else
1278     AC_MSG_RESULT(no)
1279     x_AFLAGS=[\#]
1281 AC_MSG_CHECKING(for explicit CFLAGS)
1282 if test -n "$CFLAGS"; then
1283     AC_MSG_RESULT([$CFLAGS])
1284     x_CFLAGS=
1285 else
1286     AC_MSG_RESULT(no)
1287     x_CFLAGS=[\#]
1289 AC_MSG_CHECKING(for explicit CXXFLAGS)
1290 if test -n "$CXXFLAGS"; then
1291     AC_MSG_RESULT([$CXXFLAGS])
1292     x_CXXFLAGS=
1293 else
1294     AC_MSG_RESULT(no)
1295     x_CXXFLAGS=[\#]
1297 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1298 if test -n "$OBJCFLAGS"; then
1299     AC_MSG_RESULT([$OBJCFLAGS])
1300     x_OBJCFLAGS=
1301 else
1302     AC_MSG_RESULT(no)
1303     x_OBJCFLAGS=[\#]
1305 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1306 if test -n "$OBJCXXFLAGS"; then
1307     AC_MSG_RESULT([$OBJCXXFLAGS])
1308     x_OBJCXXFLAGS=
1309 else
1310     AC_MSG_RESULT(no)
1311     x_OBJCXXFLAGS=[\#]
1313 AC_MSG_CHECKING(for explicit LDFLAGS)
1314 if test -n "$LDFLAGS"; then
1315     AC_MSG_RESULT([$LDFLAGS])
1316     x_LDFLAGS=
1317 else
1318     AC_MSG_RESULT(no)
1319     x_LDFLAGS=[\#]
1321 AC_SUBST(AFLAGS)
1322 AC_SUBST(CFLAGS)
1323 AC_SUBST(CXXFLAGS)
1324 AC_SUBST(OBJCFLAGS)
1325 AC_SUBST(OBJCXXFLAGS)
1326 AC_SUBST(LDFLAGS)
1327 AC_SUBST(x_AFLAGS)
1328 AC_SUBST(x_CFLAGS)
1329 AC_SUBST(x_CXXFLAGS)
1330 AC_SUBST(x_OBJCFLAGS)
1331 AC_SUBST(x_OBJCXXFLAGS)
1332 AC_SUBST(x_LDFLAGS)
1334 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1335 my_original_CFLAGS=$CFLAGS
1336 my_original_CXXFLAGS=$CXXFLAGS
1337 my_original_CPPFLAGS=$CPPFLAGS
1339 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1340 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1341 dnl AC_PROG_CC internally.
1342 if test "$_os" != "WINNT"; then
1343     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1344     save_CFLAGS=$CFLAGS
1345     AC_PROG_CC
1346     CFLAGS=$save_CFLAGS
1347     if test -z "$CC_BASE"; then
1348         CC_BASE=`first_arg_basename "$CC"`
1349     fi
1352 if test "$_os" != "WINNT"; then
1353     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1354 else
1355     ENDIANNESS=little
1357 AC_SUBST(ENDIANNESS)
1359 if test "$usable_dlapi" != no; then
1360     AC_DEFINE([HAVE_DLAPI])
1361     if test "$test_unix_dlapi" != no; then
1362         save_LIBS="$LIBS"
1363         AC_SEARCH_LIBS([dlsym], [dl],
1364             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1365             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1366         LIBS="$save_LIBS"
1367         AC_DEFINE([HAVE_UNIX_DLAPI])
1368     fi
1370 AC_SUBST(UNIX_DLAPI_LIBS)
1372 # Check for a (GNU) backtrace implementation
1373 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1374 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1375 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1376     save_LIBS="$LIBS"
1377     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1378         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1379         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1380     LIBS="$save_LIBS"
1382 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1383     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1386 dnl ===================================================================
1387 dnl Sanity checks for Emscripten SDK setup
1388 dnl ===================================================================
1390 EMSCRIPTEN_MIN_MAJOR=2
1391 EMSCRIPTEN_MIN_MINOR=0
1392 EMSCRIPTEN_MIN_TINY=31
1393 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1395 if test "$_os" = "Emscripten"; then
1396     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1397     AS_IF([test -z "$EMSDK"],
1398           [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1399     EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1400     if test -f "$EMSCRIPTEN_VERSION_H"; then
1401         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1402         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1403         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1404     else
1405         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1406         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1407         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1408         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1409     fi
1411     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1413     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1414     if test $? -eq 0; then
1415         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1416     else
1417         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1418     fi
1420     EMSCRIPTEN_ERROR=0
1421     if ! which emconfigure >/dev/null 2>&1; then
1422         AC_MSG_WARN([emconfigure must be in your \$PATH])
1423         EMSCRIPTEN_ERROR=1
1424     fi
1425     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1426         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1427         EMSCRIPTEN_ERROR=1
1428     fi
1429     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1430     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1431         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1432         EMSCRIPTEN_ERROR=1
1433     fi
1434     if test $EMSCRIPTEN_ERROR -ne 0; then
1435         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1436     fi
1438 AC_SUBST(EMSDK_FILE_PACKAGER)
1440 ###############################################################################
1441 # Extensions switches --enable/--disable
1442 ###############################################################################
1443 # By default these should be enabled unless having extra dependencies.
1444 # If there is extra dependency over configure options then the enable should
1445 # be automagic based on whether the requiring feature is enabled or not.
1446 # All this options change anything only with --enable-extension-integration.
1448 # The name of this option and its help string makes it sound as if
1449 # extensions are built anyway, just not integrated in the installer,
1450 # if you use --disable-extension-integration. Is that really the
1451 # case?
1453 AC_ARG_ENABLE(ios-simulator,
1454     AS_HELP_STRING([--enable-ios-simulator],
1455         [build for iOS simulator])
1458 libo_FUZZ_ARG_ENABLE(extension-integration,
1459     AS_HELP_STRING([--disable-extension-integration],
1460         [Disable integration of the built extensions in the installer of the
1461          product. Use this switch to disable the integration.])
1464 AC_ARG_ENABLE(avmedia,
1465     AS_HELP_STRING([--disable-avmedia],
1466         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1467 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1469 AC_ARG_ENABLE(database-connectivity,
1470     AS_HELP_STRING([--disable-database-connectivity],
1471         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1474 # This doesn't mean not building (or "integrating") extensions
1475 # (although it probably should; i.e. it should imply
1476 # --disable-extension-integration I guess), it means not supporting
1477 # any extension mechanism at all
1478 libo_FUZZ_ARG_ENABLE(extensions,
1479     AS_HELP_STRING([--disable-extensions],
1480         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1483 AC_ARG_ENABLE(scripting,
1484     AS_HELP_STRING([--disable-scripting],
1485         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1486 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1488 # This is mainly for Android and iOS, but could potentially be used in some
1489 # special case otherwise, too, so factored out as a separate setting
1491 AC_ARG_ENABLE(dynamic-loading,
1492     AS_HELP_STRING([--disable-dynamic-loading],
1493         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1496 libo_FUZZ_ARG_ENABLE(report-builder,
1497     AS_HELP_STRING([--disable-report-builder],
1498         [Disable the Report Builder.])
1501 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1502     AS_HELP_STRING([--enable-ext-wiki-publisher],
1503         [Enable the Wiki Publisher extension.])
1506 libo_FUZZ_ARG_ENABLE(lpsolve,
1507     AS_HELP_STRING([--disable-lpsolve],
1508         [Disable compilation of the lp solve solver ])
1510 libo_FUZZ_ARG_ENABLE(coinmp,
1511     AS_HELP_STRING([--disable-coinmp],
1512         [Disable compilation of the CoinMP solver ])
1515 libo_FUZZ_ARG_ENABLE(pdfimport,
1516     AS_HELP_STRING([--disable-pdfimport],
1517         [Disable building the PDF import feature.])
1520 libo_FUZZ_ARG_ENABLE(pdfium,
1521     AS_HELP_STRING([--disable-pdfium],
1522         [Disable building PDFium. Results in unsecure PDF signature verification.])
1525 libo_FUZZ_ARG_ENABLE(skia,
1526     AS_HELP_STRING([--disable-skia],
1527         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1530 ###############################################################################
1532 dnl ---------- *** ----------
1534 libo_FUZZ_ARG_ENABLE(mergelibs,
1535     AS_HELP_STRING([--enable-mergelibs],
1536         [Merge several of the smaller libraries into one big, "merged", one.])
1539 libo_FUZZ_ARG_ENABLE(breakpad,
1540     AS_HELP_STRING([--enable-breakpad],
1541         [Enables breakpad for crash reporting.])
1544 libo_FUZZ_ARG_ENABLE(crashdump,
1545     AS_HELP_STRING([--disable-crashdump],
1546         [Disable dump.ini and dump-file, when --enable-breakpad])
1549 AC_ARG_ENABLE(fetch-external,
1550     AS_HELP_STRING([--disable-fetch-external],
1551         [Disables fetching external tarballs from web sources.])
1554 AC_ARG_ENABLE(fuzzers,
1555     AS_HELP_STRING([--enable-fuzzers],
1556         [Enables building libfuzzer targets for fuzz testing.])
1559 libo_FUZZ_ARG_ENABLE(pch,
1560     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1561         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1562          Using 'system' will include only external headers, 'base' will add also headers
1563          from base modules, 'normal' will also add all headers except from the module built,
1564          'full' will use all suitable headers even from a module itself.])
1567 libo_FUZZ_ARG_ENABLE(epm,
1568     AS_HELP_STRING([--enable-epm],
1569         [LibreOffice includes self-packaging code, that requires epm, however epm is
1570          useless for large scale package building.])
1573 libo_FUZZ_ARG_ENABLE(odk,
1574     AS_HELP_STRING([--enable-odk],
1575         [Enable building the Office Development Kit, the part that extensions need to build against])
1578 AC_ARG_ENABLE(mpl-subset,
1579     AS_HELP_STRING([--enable-mpl-subset],
1580         [Don't compile any pieces which are not MPL or more liberally licensed])
1583 libo_FUZZ_ARG_ENABLE(evolution2,
1584     AS_HELP_STRING([--enable-evolution2],
1585         [Allows the built-in evolution 2 addressbook connectivity build to be
1586          enabled.])
1589 AC_ARG_ENABLE(avahi,
1590     AS_HELP_STRING([--enable-avahi],
1591         [Determines whether to use Avahi to advertise Impress to remote controls.])
1594 libo_FUZZ_ARG_ENABLE(werror,
1595     AS_HELP_STRING([--enable-werror],
1596         [Turn warnings to errors. (Has no effect in modules where the treating
1597          of warnings as errors is disabled explicitly.)]),
1600 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1601     AS_HELP_STRING([--enable-assert-always-abort],
1602         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1605 libo_FUZZ_ARG_ENABLE(dbgutil,
1606     AS_HELP_STRING([--enable-dbgutil],
1607         [Provide debugging support from --enable-debug and include additional debugging
1608          utilities such as object counting or more expensive checks.
1609          This is the recommended option for developers.
1610          Note that this makes the build ABI incompatible, it is not possible to mix object
1611          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1613 libo_FUZZ_ARG_ENABLE(debug,
1614     AS_HELP_STRING([--enable-debug],
1615         [Include debugging information, disable compiler optimization and inlining plus
1616          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1618 libo_FUZZ_ARG_ENABLE(split-debug,
1619     AS_HELP_STRING([--disable-split-debug],
1620         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1621          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1623 libo_FUZZ_ARG_ENABLE(gdb-index,
1624     AS_HELP_STRING([--disable-gdb-index],
1625         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1626          The feature requires a linker that supports the --gdb-index option.]))
1628 libo_FUZZ_ARG_ENABLE(sal-log,
1629     AS_HELP_STRING([--enable-sal-log],
1630         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1632 libo_FUZZ_ARG_ENABLE(symbols,
1633     AS_HELP_STRING([--enable-symbols],
1634         [Generate debug information.
1635          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1636          otherwise. It is possible to explicitly specify gbuild build targets
1637          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1638          everything in the directory; there is no ordering, more specific overrides
1639          more general, and disabling takes precedence).
1640          Example: --enable-symbols="all -sw/ -Library_sc".]))
1642 libo_FUZZ_ARG_ENABLE(optimized,
1643     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1644         [Whether to compile with optimization flags.
1645          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1646          otherwise. Using 'debug' will try to use only optimizations that should
1647          not interfere with debugging. For Emscripten we default to optimized (-O1)
1648          debug build, as otherwise binaries become too large.]))
1650 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1651     AS_HELP_STRING([--disable-runtime-optimizations],
1652         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1653          JVM JIT) that are known to interact badly with certain dynamic analysis
1654          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1655          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1656          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1658 AC_ARG_WITH(valgrind,
1659     AS_HELP_STRING([--with-valgrind],
1660         [Make availability of Valgrind headers a hard requirement.]))
1662 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1663     AS_HELP_STRING([--enable-compiler-plugins],
1664         [Enable compiler plugins that will perform additional checks during
1665          building. Enabled automatically by --enable-dbgutil.
1666          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1667 COMPILER_PLUGINS_DEBUG=
1668 if test "$enable_compiler_plugins" = debug; then
1669     enable_compiler_plugins=yes
1670     COMPILER_PLUGINS_DEBUG=TRUE
1673 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1674     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1675         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1676          relevant in the --disable-compiler-plugins case.]))
1678 libo_FUZZ_ARG_ENABLE(ooenv,
1679     AS_HELP_STRING([--enable-ooenv],
1680         [Enable ooenv for the instdir installation.]))
1682 AC_ARG_ENABLE(lto,
1683     AS_HELP_STRING([--enable-lto],
1684         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1685          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1686          linker.)]))
1688 AC_ARG_ENABLE(python,
1689     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1690         [Enables or disables Python support at run-time.
1691          Also specifies what Python to use at build-time.
1692          'fully-internal' even forces the internal version for uses of Python
1693          during the build.
1694          On macOS the only choices are
1695          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1696          ]))
1698 libo_FUZZ_ARG_ENABLE(gtk3,
1699     AS_HELP_STRING([--disable-gtk3],
1700         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1701 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1703 AC_ARG_ENABLE(gtk4,
1704     AS_HELP_STRING([--enable-gtk4],
1705         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1707 AC_ARG_ENABLE(introspection,
1708     AS_HELP_STRING([--enable-introspection],
1709         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1710          Linux distributions.)]))
1712 AC_ARG_ENABLE(split-app-modules,
1713     AS_HELP_STRING([--enable-split-app-modules],
1714         [Split file lists for app modules, e.g. base, calc.
1715          Has effect only with make distro-pack-install]),
1718 AC_ARG_ENABLE(split-opt-features,
1719     AS_HELP_STRING([--enable-split-opt-features],
1720         [Split file lists for some optional features, e.g. pyuno, testtool.
1721          Has effect only with make distro-pack-install]),
1724 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1725     AS_HELP_STRING([--disable-cairo-canvas],
1726         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1729 libo_FUZZ_ARG_ENABLE(dbus,
1730     AS_HELP_STRING([--disable-dbus],
1731         [Determines whether to enable features that depend on dbus.
1732          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1733 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1735 libo_FUZZ_ARG_ENABLE(sdremote,
1736     AS_HELP_STRING([--disable-sdremote],
1737         [Determines whether to enable Impress remote control (i.e. the server component).]),
1738 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1740 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1741     AS_HELP_STRING([--disable-sdremote-bluetooth],
1742         [Determines whether to build sdremote with bluetooth support.
1743          Requires dbus on Linux.]))
1745 libo_FUZZ_ARG_ENABLE(gio,
1746     AS_HELP_STRING([--disable-gio],
1747         [Determines whether to use the GIO support.]),
1748 ,test "${enable_gio+set}" = set || enable_gio=yes)
1750 AC_ARG_ENABLE(qt5,
1751     AS_HELP_STRING([--enable-qt5],
1752         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1753          available.]),
1756 AC_ARG_ENABLE(qt6,
1757     AS_HELP_STRING([--enable-qt6],
1758         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1759          available.]),
1762 AC_ARG_ENABLE(kf5,
1763     AS_HELP_STRING([--enable-kf5],
1764         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1765          KF5 are available.]),
1768 AC_ARG_ENABLE(gtk3_kde5,
1769     AS_HELP_STRING([--enable-gtk3-kde5],
1770         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1771          platforms where Gtk3, Qt5 and Plasma is available.]),
1774 AC_ARG_ENABLE(gen,
1775     AS_HELP_STRING([--enable-gen],
1776         [To select the gen backend in case of --disable-dynamic-loading.
1777          Per default auto-enabled when X11 is used.]),
1778 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1780 AC_ARG_ENABLE(gui,
1781     AS_HELP_STRING([--disable-gui],
1782         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1783 ,enable_gui=yes)
1785 libo_FUZZ_ARG_ENABLE(randr,
1786     AS_HELP_STRING([--disable-randr],
1787         [Disable RandR support in the vcl project.]),
1788 ,test "${enable_randr+set}" = set || enable_randr=yes)
1790 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1791     AS_HELP_STRING([--disable-gstreamer-1-0],
1792         [Disable building with the gstreamer 1.0 avmedia backend.]),
1793 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1795 libo_FUZZ_ARG_ENABLE([eot],
1796     [AS_HELP_STRING([--enable-eot],
1797         [Enable support for Embedded OpenType fonts.])],
1798 ,test "${enable_eot+set}" = set || enable_eot=no)
1800 libo_FUZZ_ARG_ENABLE(cve-tests,
1801     AS_HELP_STRING([--disable-cve-tests],
1802         [Prevent CVE tests to be executed]),
1805 AC_ARG_ENABLE(build-opensymbol,
1806     AS_HELP_STRING([--enable-build-opensymbol],
1807         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1808          fontforge installed.]),
1811 AC_ARG_ENABLE(dependency-tracking,
1812     AS_HELP_STRING([--enable-dependency-tracking],
1813         [Do not reject slow dependency extractors.])[
1814   --disable-dependency-tracking
1815                           Disables generation of dependency information.
1816                           Speed up one-time builds.],
1819 AC_ARG_ENABLE(icecream,
1820     AS_HELP_STRING([--enable-icecream],
1821         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1822          It defaults to /opt/icecream for the location of the icecream gcc/g++
1823          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1826 AC_ARG_ENABLE(ld,
1827     AS_HELP_STRING([--enable-ld=<linker>],
1828         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1829          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1830          If <linker> contains any ':', the part before the first ':' is used as the value of
1831          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1832          needed for Clang 12).]),
1835 libo_FUZZ_ARG_ENABLE(cups,
1836     AS_HELP_STRING([--disable-cups],
1837         [Do not build cups support.])
1840 AC_ARG_ENABLE(ccache,
1841     AS_HELP_STRING([--disable-ccache],
1842         [Do not try to use ccache automatically.
1843          By default we will try to detect if ccache is available; in that case if
1844          CC/CXX are not yet set, and --enable-icecream is not given, we
1845          attempt to use ccache. --disable-ccache disables ccache completely.
1846          Additionally ccache's depend mode is enabled if possible,
1847          use --enable-ccache=nodepend to enable ccache without depend mode.
1851 AC_ARG_ENABLE(z7-debug,
1852     AS_HELP_STRING([--enable-z7-debug],
1853         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1854          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1855          Enabled by default if ccache is detected.]))
1857 libo_FUZZ_ARG_ENABLE(online-update,
1858     AS_HELP_STRING([--enable-online-update],
1859         [Enable the online update service that will check for new versions of
1860          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.
1861          If the value is "mar", the experimental Mozilla-like update will be
1862          enabled instead of the traditional update mechanism.]),
1865 AC_ARG_WITH(update-config,
1866     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1867                    [Path to the update config ini file]))
1869 libo_FUZZ_ARG_ENABLE(extension-update,
1870     AS_HELP_STRING([--disable-extension-update],
1871         [Disable possibility to update installed extensions.]),
1874 libo_FUZZ_ARG_ENABLE(release-build,
1875     AS_HELP_STRING([--enable-release-build],
1876         [Enable release build. Note that the "release build" choice is orthogonal to
1877          whether symbols are present, debug info is generated, or optimization
1878          is done.
1879          See https://wiki.documentfoundation.org/Development/DevBuild]),
1882 AC_ARG_ENABLE(windows-build-signing,
1883     AS_HELP_STRING([--enable-windows-build-signing],
1884         [Enable signing of windows binaries (*.exe, *.dll)]),
1887 AC_ARG_ENABLE(silent-msi,
1888     AS_HELP_STRING([--enable-silent-msi],
1889         [Enable MSI with LIMITUI=1 (silent install).]),
1892 AC_ARG_ENABLE(macosx-code-signing,
1893     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1894         [Sign executables, dylibs, frameworks and the app bundle. If you
1895          don't provide an identity the first suitable certificate
1896          in your keychain is used.]),
1899 AC_ARG_ENABLE(macosx-package-signing,
1900     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1901         [Create a .pkg suitable for uploading to the Mac App Store and sign
1902          it. If you don't provide an identity the first suitable certificate
1903          in your keychain is used.]),
1906 AC_ARG_ENABLE(macosx-sandbox,
1907     AS_HELP_STRING([--enable-macosx-sandbox],
1908         [Make the app bundle run in a sandbox. Requires code signing.
1909          Is required by apps distributed in the Mac App Store, and implies
1910          adherence to App Store rules.]),
1913 AC_ARG_WITH(macosx-bundle-identifier,
1914     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1915         [Define the macOS bundle identifier. Default is the somewhat weird
1916          org.libreoffice.script ("script", huh?).]),
1917 ,with_macosx_bundle_identifier=org.libreoffice.script)
1919 AC_ARG_WITH(macosx-provisioning-profile,
1920     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
1921         [Specify the path to a provisioning profile to use]),
1924 AC_ARG_WITH(product-name,
1925     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1926         [Define the product name. Default is AC_PACKAGE_NAME.]),
1927 ,with_product_name=$PRODUCTNAME)
1929 libo_FUZZ_ARG_ENABLE(community-flavor,
1930     AS_HELP_STRING([--disable-community-flavor],
1931         [Disable the Community branding.]),
1934 AC_ARG_WITH(package-version,
1935     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1936         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1939 libo_FUZZ_ARG_ENABLE(readonly-installset,
1940     AS_HELP_STRING([--enable-readonly-installset],
1941         [Prevents any attempts by LibreOffice to write into its installation. That means
1942          at least that no "system-wide" extensions can be added. Partly experimental work in
1943          progress, probably not fully implemented. Always enabled for macOS.]),
1946 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1947     AS_HELP_STRING([--disable-mariadb-sdbc],
1948         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1951 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1952     AS_HELP_STRING([--disable-postgresql-sdbc],
1953         [Disable the build of the PostgreSQL-SDBC driver.])
1956 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1957     AS_HELP_STRING([--disable-lotuswordpro],
1958         [Disable the build of the Lotus Word Pro filter.]),
1959 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1961 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1962     AS_HELP_STRING([--disable-firebird-sdbc],
1963         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1964 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1966 AC_ARG_ENABLE(bogus-pkg-config,
1967     AS_HELP_STRING([--enable-bogus-pkg-config],
1968         [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.]),
1971 AC_ARG_ENABLE(openssl,
1972     AS_HELP_STRING([--disable-openssl],
1973         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1974          components will use NSS. Work in progress,
1975          use only if you are hacking on it.]),
1976 ,enable_openssl=yes)
1978 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1979     AS_HELP_STRING([--enable-cipher-openssl-backend],
1980         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1981          Requires --enable-openssl.]))
1983 AC_ARG_ENABLE(nss,
1984     AS_HELP_STRING([--disable-nss],
1985         [Disable using NSS. If disabled,
1986          components will use openssl. Work in progress,
1987          use only if you are hacking on it.]),
1988 ,enable_nss=yes)
1990 AC_ARG_ENABLE(library-bin-tar,
1991     AS_HELP_STRING([--enable-library-bin-tar],
1992         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1993         Some libraries can save their build result in a tarball
1994         stored in TARFILE_LOCATION. That binary tarball is
1995         uniquely identified by the source tarball,
1996         the content of the config_host.mk file and the content
1997         of the top-level directory in core for that library
1998         If this option is enabled, then if such a tarfile exist, it will be untarred
1999         instead of the source tarfile, and the build step will be skipped for that
2000         library.
2001         If a proper tarfile does not exist, then the normal source-based
2002         build is done for that library and a proper binary tarfile is created
2003         for the next time.]),
2006 AC_ARG_ENABLE(dconf,
2007     AS_HELP_STRING([--disable-dconf],
2008         [Disable the dconf configuration backend (enabled by default where
2009          available).]))
2011 libo_FUZZ_ARG_ENABLE(formula-logger,
2012     AS_HELP_STRING(
2013         [--enable-formula-logger],
2014         [Enable formula logger for logging formula calculation flow in Calc.]
2015     )
2018 AC_ARG_ENABLE(ldap,
2019     AS_HELP_STRING([--disable-ldap],
2020         [Disable LDAP support.]),
2021 ,enable_ldap=yes)
2023 AC_ARG_ENABLE(opencl,
2024     AS_HELP_STRING([--disable-opencl],
2025         [Disable OpenCL support.]),
2026 ,enable_opencl=yes)
2028 libo_FUZZ_ARG_ENABLE(librelogo,
2029     AS_HELP_STRING([--disable-librelogo],
2030         [Do not build LibreLogo.]),
2031 ,enable_librelogo=yes)
2033 AC_ARG_ENABLE(wasm-strip,
2034     AS_HELP_STRING([--enable-wasm-strip],
2035         [Strip the static build like for WASM/emscripten platform.]),
2038 AC_ARG_WITH(main-module,
2039     AS_HELP_STRING([--with-main-module=<writer/calc>],
2040         [Specify which main module to build for wasm.
2041         Default value is 'writer'.]),
2044 AC_ARG_ENABLE(wasm-exceptions,
2045     AS_HELP_STRING([--enable-wasm-exceptions],
2046         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2047         matter of fact, this is currently not finished by any implementation)
2048         (see https://webassembly.org/roadmap/ for the current state]),
2051 AC_ARG_ENABLE(xmlhelp,
2052     AS_HELP_STRING([--disable-xmlhelp],
2053         [Disable XML help support]),
2054 ,enable_xmlhelp=yes)
2056 AC_ARG_ENABLE(customtarget-components,
2057     AS_HELP_STRING([--enable-customtarget-components],
2058         [Generates the static UNO object constructor mapping from the build.]))
2060 AC_ARG_ENABLE(float_device_pixel,
2061     AS_HELP_STRING([--enable-float-device-pixel],
2062                    [Uses doubles for VCL device coordinates instead of 32-bit integers.]),
2065 dnl ===================================================================
2066 dnl Optional Packages (--with/without-)
2067 dnl ===================================================================
2069 AC_ARG_WITH(gcc-home,
2070     AS_HELP_STRING([--with-gcc-home],
2071         [Specify the location of gcc/g++ manually. This can be used in conjunction
2072          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2073          non-default path.]),
2076 AC_ARG_WITH(gnu-patch,
2077     AS_HELP_STRING([--with-gnu-patch],
2078         [Specify location of GNU patch on Solaris or FreeBSD.]),
2081 AC_ARG_WITH(build-platform-configure-options,
2082     AS_HELP_STRING([--with-build-platform-configure-options],
2083         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2086 AC_ARG_WITH(gnu-cp,
2087     AS_HELP_STRING([--with-gnu-cp],
2088         [Specify location of GNU cp on Solaris or FreeBSD.]),
2091 AC_ARG_WITH(external-tar,
2092     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2093         [Specify an absolute path of where to find (and store) tarfiles.]),
2094     TARFILE_LOCATION=$withval ,
2097 AC_ARG_WITH(referenced-git,
2098     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2099         [Specify another checkout directory to reference. This makes use of
2100                  git submodule update --reference, and saves a lot of diskspace
2101                  when having multiple trees side-by-side.]),
2102     GIT_REFERENCE_SRC=$withval ,
2105 AC_ARG_WITH(linked-git,
2106     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2107         [Specify a directory where the repositories of submodules are located.
2108          This uses a method similar to git-new-workdir to get submodules.]),
2109     GIT_LINK_SRC=$withval ,
2112 AC_ARG_WITH(galleries,
2113     AS_HELP_STRING([--with-galleries],
2114         [Specify how galleries should be built. It is possible either to
2115          build these internally from source ("build"),
2116          or to disable them ("no")]),
2119 AC_ARG_WITH(theme,
2120     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2121         [Choose which themes to include. By default those themes with an '*' are included.
2122          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2123          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2124          *elementary, *elementary_svg,
2125          *karasa_jaga, *karasa_jaga_svg,
2126          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2127          *sukapura, *sukapura_svg.]),
2130 libo_FUZZ_ARG_WITH(helppack-integration,
2131     AS_HELP_STRING([--without-helppack-integration],
2132         [It will not integrate the helppacks to the installer
2133          of the product. Please use this switch to use the online help
2134          or separate help packages.]),
2137 libo_FUZZ_ARG_WITH(fonts,
2138     AS_HELP_STRING([--without-fonts],
2139         [LibreOffice includes some third-party fonts to provide a reliable basis for
2140          help content, templates, samples, etc. When these fonts are already
2141          known to be available on the system then you should use this option.]),
2144 AC_ARG_WITH(epm,
2145     AS_HELP_STRING([--with-epm],
2146         [Decides which epm to use. Default is to use the one from the system if
2147          one is built. When either this is not there or you say =internal epm
2148          will be built.]),
2151 AC_ARG_WITH(package-format,
2152     AS_HELP_STRING([--with-package-format],
2153         [Specify package format(s) for LibreOffice installation sets. The
2154          implicit --without-package-format leads to no installation sets being
2155          generated. Possible values: archive, bsd, deb, dmg,
2156          installed, msi, pkg, and rpm.
2157          Example: --with-package-format='deb rpm']),
2160 AC_ARG_WITH(tls,
2161     AS_HELP_STRING([--with-tls],
2162         [Decides which TLS/SSL and cryptographic implementations to use for
2163          LibreOffice's code. Default is to use NSS although OpenSSL is also
2164          possible. Notice that selecting NSS restricts the usage of OpenSSL
2165          in LO's code but selecting OpenSSL doesn't restrict by now the
2166          usage of NSS in LO's code. Possible values: openssl, nss.
2167          Example: --with-tls="nss"]),
2170 AC_ARG_WITH(system-libs,
2171     AS_HELP_STRING([--with-system-libs],
2172         [Use libraries already on system -- enables all --with-system-* flags.]),
2175 AC_ARG_WITH(system-bzip2,
2176     AS_HELP_STRING([--with-system-bzip2],
2177         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2178     [with_system_bzip2="$with_system_libs"])
2180 AC_ARG_WITH(system-headers,
2181     AS_HELP_STRING([--with-system-headers],
2182         [Use headers already on system -- enables all --with-system-* flags for
2183          external packages whose headers are the only entities used i.e.
2184          boost/odbc/sane-header(s).]),,
2185     [with_system_headers="$with_system_libs"])
2187 AC_ARG_WITH(system-jars,
2188     AS_HELP_STRING([--without-system-jars],
2189         [When building with --with-system-libs, also the needed jars are expected
2190          on the system. Use this to disable that]),,
2191     [with_system_jars="$with_system_libs"])
2193 AC_ARG_WITH(system-cairo,
2194     AS_HELP_STRING([--with-system-cairo],
2195         [Use cairo libraries already on system.  Happens automatically for
2196          (implicit) --enable-gtk3.]))
2198 AC_ARG_WITH(system-epoxy,
2199     AS_HELP_STRING([--with-system-epoxy],
2200         [Use epoxy libraries already on system.  Happens automatically for
2201          (implicit) --enable-gtk3.]),,
2202        [with_system_epoxy="$with_system_libs"])
2204 AC_ARG_WITH(myspell-dicts,
2205     AS_HELP_STRING([--with-myspell-dicts],
2206         [Adds myspell dictionaries to the LibreOffice installation set]),
2209 AC_ARG_WITH(system-dicts,
2210     AS_HELP_STRING([--without-system-dicts],
2211         [Do not use dictionaries from system paths.]),
2214 AC_ARG_WITH(external-dict-dir,
2215     AS_HELP_STRING([--with-external-dict-dir],
2216         [Specify external dictionary dir.]),
2219 AC_ARG_WITH(external-hyph-dir,
2220     AS_HELP_STRING([--with-external-hyph-dir],
2221         [Specify external hyphenation pattern dir.]),
2224 AC_ARG_WITH(external-thes-dir,
2225     AS_HELP_STRING([--with-external-thes-dir],
2226         [Specify external thesaurus dir.]),
2229 AC_ARG_WITH(system-zlib,
2230     AS_HELP_STRING([--with-system-zlib],
2231         [Use zlib already on system.]),,
2232     [with_system_zlib=auto])
2234 AC_ARG_WITH(system-jpeg,
2235     AS_HELP_STRING([--with-system-jpeg],
2236         [Use jpeg already on system.]),,
2237     [with_system_jpeg="$with_system_libs"])
2239 AC_ARG_WITH(system-expat,
2240     AS_HELP_STRING([--with-system-expat],
2241         [Use expat already on system.]),,
2242     [with_system_expat="$with_system_libs"])
2244 AC_ARG_WITH(system-libxml,
2245     AS_HELP_STRING([--with-system-libxml],
2246         [Use libxml/libxslt already on system.]),,
2247     [with_system_libxml=auto])
2249 AC_ARG_WITH(system-openldap,
2250     AS_HELP_STRING([--with-system-openldap],
2251         [Use the OpenLDAP LDAP SDK already on system.]),,
2252     [with_system_openldap="$with_system_libs"])
2254 libo_FUZZ_ARG_ENABLE(poppler,
2255     AS_HELP_STRING([--disable-poppler],
2256         [Disable building Poppler.])
2259 AC_ARG_WITH(system-poppler,
2260     AS_HELP_STRING([--with-system-poppler],
2261         [Use system poppler (only needed for PDF import).]),,
2262     [with_system_poppler="$with_system_libs"])
2264 AC_ARG_WITH(system-abseil,
2265     AS_HELP_STRING([--with-system-abseil],
2266         [Use the abseil libraries already on system.]),,
2267     [with_system_abseil="$with_system_libs"])
2269 AC_ARG_WITH(system-openjpeg,
2270     AS_HELP_STRING([--with-system-openjpeg],
2271         [Use the OpenJPEG library already on system.]),,
2272     [with_system_openjpeg="$with_system_libs"])
2274 libo_FUZZ_ARG_ENABLE(gpgmepp,
2275     AS_HELP_STRING([--disable-gpgmepp],
2276         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2279 AC_ARG_WITH(system-gpgmepp,
2280     AS_HELP_STRING([--with-system-gpgmepp],
2281         [Use gpgmepp already on system]),,
2282     [with_system_gpgmepp="$with_system_libs"])
2284 AC_ARG_WITH(system-mariadb,
2285     AS_HELP_STRING([--with-system-mariadb],
2286         [Use MariaDB/MySQL libraries already on system.]),,
2287     [with_system_mariadb="$with_system_libs"])
2289 AC_ARG_ENABLE(bundle-mariadb,
2290     AS_HELP_STRING([--enable-bundle-mariadb],
2291         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2294 AC_ARG_WITH(system-postgresql,
2295     AS_HELP_STRING([--with-system-postgresql],
2296         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2297          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2298     [with_system_postgresql="$with_system_libs"])
2300 AC_ARG_WITH(libpq-path,
2301     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2302         [Use this PostgreSQL C interface (libpq) installation for building
2303          the PostgreSQL-SDBC extension.]),
2306 AC_ARG_WITH(system-firebird,
2307     AS_HELP_STRING([--with-system-firebird],
2308         [Use Firebird libraries already on system, for building the Firebird-SDBC
2309          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2310     [with_system_firebird="$with_system_libs"])
2312 AC_ARG_WITH(system-libtommath,
2313             AS_HELP_STRING([--with-system-libtommath],
2314                            [Use libtommath already on system]),,
2315             [with_system_libtommath="$with_system_libs"])
2317 AC_ARG_WITH(system-hsqldb,
2318     AS_HELP_STRING([--with-system-hsqldb],
2319         [Use hsqldb already on system.]))
2321 AC_ARG_WITH(hsqldb-jar,
2322     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2323         [Specify path to jarfile manually.]),
2324     HSQLDB_JAR=$withval)
2326 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2327     AS_HELP_STRING([--disable-scripting-beanshell],
2328         [Disable support for scripts in BeanShell.]),
2332 AC_ARG_WITH(system-beanshell,
2333     AS_HELP_STRING([--with-system-beanshell],
2334         [Use beanshell already on system.]),,
2335     [with_system_beanshell="$with_system_jars"])
2337 AC_ARG_WITH(beanshell-jar,
2338     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2339         [Specify path to jarfile manually.]),
2340     BSH_JAR=$withval)
2342 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2343     AS_HELP_STRING([--disable-scripting-javascript],
2344         [Disable support for scripts in JavaScript.]),
2348 AC_ARG_WITH(system-rhino,
2349     AS_HELP_STRING([--with-system-rhino],
2350         [Use rhino already on system.]),,)
2351 #    [with_system_rhino="$with_system_jars"])
2352 # Above is not used as we have different debug interface
2353 # patched into internal rhino. This code needs to be fixed
2354 # before we can enable it by default.
2356 AC_ARG_WITH(rhino-jar,
2357     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2358         [Specify path to jarfile manually.]),
2359     RHINO_JAR=$withval)
2361 AC_ARG_WITH(system-jfreereport,
2362     AS_HELP_STRING([--with-system-jfreereport],
2363         [Use JFreeReport already on system.]),,
2364     [with_system_jfreereport="$with_system_jars"])
2366 AC_ARG_WITH(sac-jar,
2367     AS_HELP_STRING([--with-sac-jar=JARFILE],
2368         [Specify path to jarfile manually.]),
2369     SAC_JAR=$withval)
2371 AC_ARG_WITH(libxml-jar,
2372     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2373         [Specify path to jarfile manually.]),
2374     LIBXML_JAR=$withval)
2376 AC_ARG_WITH(flute-jar,
2377     AS_HELP_STRING([--with-flute-jar=JARFILE],
2378         [Specify path to jarfile manually.]),
2379     FLUTE_JAR=$withval)
2381 AC_ARG_WITH(jfreereport-jar,
2382     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2383         [Specify path to jarfile manually.]),
2384     JFREEREPORT_JAR=$withval)
2386 AC_ARG_WITH(liblayout-jar,
2387     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2388         [Specify path to jarfile manually.]),
2389     LIBLAYOUT_JAR=$withval)
2391 AC_ARG_WITH(libloader-jar,
2392     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2393         [Specify path to jarfile manually.]),
2394     LIBLOADER_JAR=$withval)
2396 AC_ARG_WITH(libformula-jar,
2397     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2398         [Specify path to jarfile manually.]),
2399     LIBFORMULA_JAR=$withval)
2401 AC_ARG_WITH(librepository-jar,
2402     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2403         [Specify path to jarfile manually.]),
2404     LIBREPOSITORY_JAR=$withval)
2406 AC_ARG_WITH(libfonts-jar,
2407     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2408         [Specify path to jarfile manually.]),
2409     LIBFONTS_JAR=$withval)
2411 AC_ARG_WITH(libserializer-jar,
2412     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2413         [Specify path to jarfile manually.]),
2414     LIBSERIALIZER_JAR=$withval)
2416 AC_ARG_WITH(libbase-jar,
2417     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2418         [Specify path to jarfile manually.]),
2419     LIBBASE_JAR=$withval)
2421 AC_ARG_WITH(system-odbc,
2422     AS_HELP_STRING([--with-system-odbc],
2423         [Use the odbc headers already on system.]),,
2424     [with_system_odbc="auto"])
2426 AC_ARG_WITH(system-sane,
2427     AS_HELP_STRING([--with-system-sane],
2428         [Use sane.h already on system.]),,
2429     [with_system_sane="$with_system_headers"])
2431 AC_ARG_WITH(system-bluez,
2432     AS_HELP_STRING([--with-system-bluez],
2433         [Use bluetooth.h already on system.]),,
2434     [with_system_bluez="$with_system_headers"])
2436 AC_ARG_WITH(system-boost,
2437     AS_HELP_STRING([--with-system-boost],
2438         [Use boost already on system.]),,
2439     [with_system_boost="$with_system_headers"])
2441 AC_ARG_WITH(system-dragonbox,
2442     AS_HELP_STRING([--with-system-dragonbox],
2443         [Use dragonbox already on system.]),,
2444     [with_system_dragonbox="$with_system_headers"])
2446 AC_ARG_WITH(system-libfixmath,
2447     AS_HELP_STRING([--with-system-libfixmath],
2448         [Use libfixmath already on system.]),,
2449     [with_system_libfixmath="$with_system_libs"])
2451 AC_ARG_WITH(system-glm,
2452     AS_HELP_STRING([--with-system-glm],
2453         [Use glm already on system.]),,
2454     [with_system_glm="$with_system_headers"])
2456 AC_ARG_WITH(system-hunspell,
2457     AS_HELP_STRING([--with-system-hunspell],
2458         [Use libhunspell already on system.]),,
2459     [with_system_hunspell="$with_system_libs"])
2461 libo_FUZZ_ARG_ENABLE(zxing,
2462     AS_HELP_STRING([--disable-zxing],
2463        [Disable use of zxing external library.]))
2465 AC_ARG_WITH(system-zxing,
2466     AS_HELP_STRING([--with-system-zxing],
2467         [Use libzxing already on system.]),,
2468     [with_system_zxing="$with_system_libs"])
2470 AC_ARG_WITH(system-box2d,
2471     AS_HELP_STRING([--with-system-box2d],
2472         [Use box2d already on system.]),,
2473     [with_system_box2d="$with_system_libs"])
2475 AC_ARG_WITH(system-mythes,
2476     AS_HELP_STRING([--with-system-mythes],
2477         [Use mythes already on system.]),,
2478     [with_system_mythes="$with_system_libs"])
2480 AC_ARG_WITH(system-altlinuxhyph,
2481     AS_HELP_STRING([--with-system-altlinuxhyph],
2482         [Use ALTLinuxhyph already on system.]),,
2483     [with_system_altlinuxhyph="$with_system_libs"])
2485 AC_ARG_WITH(system-lpsolve,
2486     AS_HELP_STRING([--with-system-lpsolve],
2487         [Use lpsolve already on system.]),,
2488     [with_system_lpsolve="$with_system_libs"])
2490 AC_ARG_WITH(system-coinmp,
2491     AS_HELP_STRING([--with-system-coinmp],
2492         [Use CoinMP already on system.]),,
2493     [with_system_coinmp="$with_system_libs"])
2495 AC_ARG_WITH(system-liblangtag,
2496     AS_HELP_STRING([--with-system-liblangtag],
2497         [Use liblangtag library already on system.]),,
2498     [with_system_liblangtag="$with_system_libs"])
2500 AC_ARG_WITH(system-lockfile,
2501     AS_HELP_STRING([--with-system-lockfile[=file]],
2502         [Detect a system lockfile program or use the \$file argument.]))
2504 AC_ARG_WITH(webdav,
2505     AS_HELP_STRING([--without-webdav],
2506         [Disable WebDAV support in the UCB.]))
2508 AC_ARG_WITH(linker-hash-style,
2509     AS_HELP_STRING([--with-linker-hash-style],
2510         [Use linker with --hash-style=<style> when linking shared objects.
2511          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2512          if supported on the build system, and "sysv" otherwise.]))
2514 AC_ARG_WITH(jdk-home,
2515     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2516         [If you have installed JDK 9 or later on your system please supply the
2517          path here. Note that this is not the location of the java command but the
2518          location of the entire distribution. In case of cross-compiling, this
2519          is the JDK of the host os. Use --with-build-platform-configure-options
2520          to point to a different build platform JDK.]),
2523 AC_ARG_WITH(help,
2524     AS_HELP_STRING([--with-help],
2525         [Enable the build of help. There is a special parameter "common" that
2526          can be used to bundle only the common part, .e.g help-specific icons.
2527          This is useful when you build the helpcontent separately.])
2528     [
2529                           Usage:     --with-help    build the old local help
2530                                  --without-help     no local help (default)
2531                                  --with-help=html   build the new HTML local help
2532                                  --with-help=online build the new HTML online help
2533     ],
2536 AC_ARG_WITH(omindex,
2537    AS_HELP_STRING([--with-omindex],
2538         [Enable the support of xapian-omega index for online help.])
2539    [
2540                          Usage: --with-omindex=server prepare the pages for omindex
2541                                 but let xapian-omega be built in server.
2542                                 --with-omindex=noxap do not prepare online pages
2543                                 for xapian-omega
2544   ],
2547 libo_FUZZ_ARG_WITH(java,
2548     AS_HELP_STRING([--with-java=<java command>],
2549         [Specify the name of the Java interpreter command. Typically "java"
2550          which is the default.
2552          To build without support for Java components, applets, accessibility
2553          or the XML filters written in Java, use --without-java or --with-java=no.]),
2554     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2555     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2558 AC_ARG_WITH(jvm-path,
2559     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2560         [Use a specific JVM search path at runtime.
2561          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2564 AC_ARG_WITH(ant-home,
2565     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2566         [If you have installed Apache Ant on your system, please supply the path here.
2567          Note that this is not the location of the Ant binary but the location
2568          of the entire distribution.]),
2571 AC_ARG_WITH(symbol-config,
2572     AS_HELP_STRING([--with-symbol-config],
2573         [Configuration for the crashreport symbol upload]),
2574         [],
2575         [with_symbol_config=no])
2577 AC_ARG_WITH(export-validation,
2578     AS_HELP_STRING([--without-export-validation],
2579         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2580 ,with_export_validation=auto)
2582 AC_ARG_WITH(bffvalidator,
2583     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2584         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2585          Requires installed Microsoft Office Binary File Format Validator.
2586          Note: export-validation (--with-export-validation) is required to be turned on.
2587          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2588 ,with_bffvalidator=no)
2590 libo_FUZZ_ARG_WITH(junit,
2591     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2592         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2593          --without-junit disables those tests. Not relevant in the --without-java case.]),
2594 ,with_junit=yes)
2596 AC_ARG_WITH(hamcrest,
2597     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2598         [Specifies the hamcrest jar file to use for JUnit-based tests.
2599          --without-junit disables those tests. Not relevant in the --without-java case.]),
2600 ,with_hamcrest=yes)
2602 AC_ARG_WITH(perl-home,
2603     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2604         [If you have installed Perl 5 Distribution, on your system, please
2605          supply the path here. Note that this is not the location of the Perl
2606          binary but the location of the entire distribution.]),
2609 libo_FUZZ_ARG_WITH(doxygen,
2610     AS_HELP_STRING(
2611         [--with-doxygen=<absolute path to doxygen executable>],
2612         [Specifies the doxygen executable to use when generating ODK C/C++
2613          documentation. --without-doxygen disables generation of ODK C/C++
2614          documentation. Not relevant in the --disable-odk case.]),
2615 ,with_doxygen=yes)
2617 AC_ARG_WITH(visual-studio,
2618     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2619         [Specify which Visual Studio version to use in case several are
2620          installed. Currently 2019 (default) and 2022 are supported.]),
2623 AC_ARG_WITH(windows-sdk,
2624     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2625         [Specify which Windows SDK, or "Windows Kit", version to use
2626          in case the one that came with the selected Visual Studio
2627          is not what you want for some reason. Note that not all compiler/SDK
2628          combinations are supported. The intent is that this option should not
2629          be needed.]),
2632 AC_ARG_WITH(lang,
2633     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2634         [Use this option to build LibreOffice with additional UI language support.
2635          English (US) is always included by default.
2636          Separate multiple languages with space.
2637          For all languages, use --with-lang=ALL.]),
2640 AC_ARG_WITH(locales,
2641     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2642         [Use this option to limit the locale information built in.
2643          Separate multiple locales with space.
2644          Very experimental and might well break stuff.
2645          Just a desperate measure to shrink code and data size.
2646          By default all the locales available is included.
2647          Just works with --disable-dynloading. Defaults to "ALL".
2648          This option is completely unrelated to --with-lang.])
2649     [
2650                           Affects also our character encoding conversion
2651                           tables for encodings mainly targeted for a
2652                           particular locale, like EUC-CN and EUC-TW for
2653                           zh, ISO-2022-JP for ja.
2655                           Affects also our add-on break iterator data for
2656                           some languages.
2658                           For the default, all locales, don't use this switch at all.
2659                           Specifying just the language part of a locale means all matching
2660                           locales will be included.
2661     ],
2664 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2665 libo_FUZZ_ARG_WITH(krb5,
2666     AS_HELP_STRING([--with-krb5],
2667         [Enable MIT Kerberos 5 support in modules that support it.
2668          By default automatically enabled on platforms
2669          where a good system Kerberos 5 is available.]),
2672 libo_FUZZ_ARG_WITH(gssapi,
2673     AS_HELP_STRING([--with-gssapi],
2674         [Enable GSSAPI support in modules that support it.
2675          By default automatically enabled on platforms
2676          where a good system GSSAPI is available.]),
2679 libo_FUZZ_ARG_WITH(lxml,
2680     AS_HELP_STRING([--without-lxml],
2681         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2682          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2683          report widget classes and ids.]),
2686 libo_FUZZ_ARG_WITH(latest-c++,
2687     AS_HELP_STRING([--with-latest-c++],
2688         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2689          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2690         [with_latest_c__=no])
2692 AC_ARG_WITH(gtk3-build,
2693     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2694         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2695          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2697 dnl ===================================================================
2698 dnl Branding
2699 dnl ===================================================================
2701 AC_ARG_WITH(branding,
2702     AS_HELP_STRING([--with-branding=/path/to/images],
2703         [Use given path to retrieve branding images set.])
2704     [
2705                           Search for intro.png about.svg and logo.svg.
2706                           If any is missing, default ones will be used instead.
2708                           Search also progress.conf for progress
2709                           settings on intro screen :
2711                           PROGRESSBARCOLOR="255,255,255" Set color of
2712                           progress bar. Comma separated RGB decimal values.
2713                           PROGRESSSIZE="407,6" Set size of progress bar.
2714                           Comma separated decimal values (width, height).
2715                           PROGRESSPOSITION="61,317" Set position of progress
2716                           bar from left,top. Comma separated decimal values.
2717                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2718                           bar frame. Comma separated RGB decimal values.
2719                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2720                           bar text. Comma separated RGB decimal values.
2721                           PROGRESSTEXTBASELINE="287" Set vertical position of
2722                           progress bar text from top. Decimal value.
2724                           Default values will be used if not found.
2725     ],
2729 AC_ARG_WITH(extra-buildid,
2730     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2731         [Show addition build identification in about dialog.]),
2735 AC_ARG_WITH(vendor,
2736     AS_HELP_STRING([--with-vendor="John the Builder"],
2737         [Set vendor of the build.]),
2740 AC_ARG_WITH(privacy-policy-url,
2741     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2742         [The URL to your privacy policy (needed when
2743          enabling online-update or crashreporting via breakpad)]),
2744         [if test "x$with_privacy_policy_url" = "xyes"; then
2745             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2746          elif test "x$with_privacy_policy_url" = "xno"; then
2747             with_privacy_policy_url="undefined"
2748          fi]
2749 ,[with_privacy_policy_url="undefined"])
2751 AC_ARG_WITH(android-package-name,
2752     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2753         [Set Android package name of the build.]),
2756 AC_ARG_WITH(compat-oowrappers,
2757     AS_HELP_STRING([--with-compat-oowrappers],
2758         [Install oo* wrappers in parallel with
2759          lo* ones to keep backward compatibility.
2760          Has effect only with make distro-pack-install]),
2763 AC_ARG_WITH(os-version,
2764     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2765         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2768 AC_ARG_WITH(parallelism,
2769     AS_HELP_STRING([--with-parallelism],
2770         [Number of jobs to run simultaneously during build. Parallel builds can
2771         save a lot of time on multi-cpu machines. Defaults to the number of
2772         CPUs on the machine, unless you configure --enable-icecream - then to
2773         40.]),
2776 AC_ARG_WITH(all-tarballs,
2777     AS_HELP_STRING([--with-all-tarballs],
2778         [Download all external tarballs unconditionally]))
2780 AC_ARG_WITH(gdrive-client-id,
2781     AS_HELP_STRING([--with-gdrive-client-id],
2782         [Provides the client id of the application for OAuth2 authentication
2783         on Google Drive. If either this or --with-gdrive-client-secret is
2784         empty, the feature will be disabled]),
2787 AC_ARG_WITH(gdrive-client-secret,
2788     AS_HELP_STRING([--with-gdrive-client-secret],
2789         [Provides the client secret of the application for OAuth2
2790         authentication on Google Drive. If either this or
2791         --with-gdrive-client-id is empty, the feature will be disabled]),
2794 AC_ARG_WITH(alfresco-cloud-client-id,
2795     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2796         [Provides the client id of the application for OAuth2 authentication
2797         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2798         empty, the feature will be disabled]),
2801 AC_ARG_WITH(alfresco-cloud-client-secret,
2802     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2803         [Provides the client secret of the application for OAuth2
2804         authentication on Alfresco Cloud. If either this or
2805         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2808 AC_ARG_WITH(onedrive-client-id,
2809     AS_HELP_STRING([--with-onedrive-client-id],
2810         [Provides the client id of the application for OAuth2 authentication
2811         on OneDrive. If either this or --with-onedrive-client-secret is
2812         empty, the feature will be disabled]),
2815 AC_ARG_WITH(onedrive-client-secret,
2816     AS_HELP_STRING([--with-onedrive-client-secret],
2817         [Provides the client secret of the application for OAuth2
2818         authentication on OneDrive. If either this or
2819         --with-onedrive-client-id is empty, the feature will be disabled]),
2821 dnl ===================================================================
2822 dnl Do we want to use pre-build binary tarball for recompile
2823 dnl ===================================================================
2825 if test "$enable_library_bin_tar" = "yes" ; then
2826     USE_LIBRARY_BIN_TAR=TRUE
2827 else
2828     USE_LIBRARY_BIN_TAR=
2830 AC_SUBST(USE_LIBRARY_BIN_TAR)
2832 dnl ===================================================================
2833 dnl Test whether build target is Release Build
2834 dnl ===================================================================
2835 AC_MSG_CHECKING([whether build target is Release Build])
2836 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2837     AC_MSG_RESULT([no])
2838     ENABLE_RELEASE_BUILD=
2839     GET_TASK_ALLOW_ENTITLEMENT='
2840         <!-- We want to be able to debug a hardened process when not building for release -->
2841         <key>com.apple.security.get-task-allow</key>
2842         <true/>'
2843 else
2844     AC_MSG_RESULT([yes])
2845     ENABLE_RELEASE_BUILD=TRUE
2846     GET_TASK_ALLOW_ENTITLEMENT=''
2848 AC_SUBST(ENABLE_RELEASE_BUILD)
2849 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2851 AC_MSG_CHECKING([whether to build a Community flavor])
2852 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2853     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2854     AC_MSG_RESULT([yes])
2855 else
2856     AC_MSG_RESULT([no])
2859 dnl ===================================================================
2860 dnl Test whether to sign Windows Build
2861 dnl ===================================================================
2862 AC_MSG_CHECKING([whether to sign windows build])
2863 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2864     AC_MSG_RESULT([yes])
2865     WINDOWS_BUILD_SIGNING="TRUE"
2866 else
2867     AC_MSG_RESULT([no])
2868     WINDOWS_BUILD_SIGNING="FALSE"
2870 AC_SUBST(WINDOWS_BUILD_SIGNING)
2872 dnl ===================================================================
2873 dnl MacOSX build and runtime environment options
2874 dnl ===================================================================
2876 AC_ARG_WITH(macosx-version-min-required,
2877     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2878         [set the minimum OS version needed to run the built LibreOffice])
2879     [
2880                           e. g.: --with-macosx-version-min-required=10.15
2881     ],
2884 dnl ===================================================================
2885 dnl Check for incompatible options set by fuzzing, and reset those
2886 dnl automatically to working combinations
2887 dnl ===================================================================
2889 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2890         "$enable_dbus" != "$enable_avahi"; then
2891     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2892     enable_avahi=$enable_dbus
2895 add_lopath_after ()
2897     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2898         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2899     fi
2902 add_lopath_before ()
2904     local IFS=${P_SEP}
2905     local path_cleanup
2906     local dir
2907     for dir in $LO_PATH ; do
2908         if test "$dir" != "$1" ; then
2909             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2910         fi
2911     done
2912     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2915 dnl ===================================================================
2916 dnl check for required programs (grep, awk, sed, bash)
2917 dnl ===================================================================
2919 pathmunge ()
2921     local new_path
2922     if test -n "$1"; then
2923         if test "$build_os" = "cygwin"; then
2924             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2925                 PathFormat "$1"
2926                 new_path=`cygpath -sm "$formatted_path"`
2927             else
2928                 PathFormat "$1"
2929                 new_path=`cygpath -u "$formatted_path"`
2930             fi
2931         else
2932             new_path="$1"
2933         fi
2934         if test "$2" = "after"; then
2935             add_lopath_after "$new_path"
2936         else
2937             add_lopath_before "$new_path"
2938         fi
2939     fi
2942 AC_PROG_AWK
2943 AC_PATH_PROG( AWK, $AWK)
2944 if test -z "$AWK"; then
2945     AC_MSG_ERROR([install awk to run this script])
2948 AC_PATH_PROG(BASH, bash)
2949 if test -z "$BASH"; then
2950     AC_MSG_ERROR([bash not found in \$PATH])
2952 AC_SUBST(BASH)
2954 # prefer parallel compression tools, if available
2955 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2956 if test -z "$COMPRESSIONTOOL"; then
2957     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2958     if test -z "$COMPRESSIONTOOL"; then
2959         AC_MSG_ERROR([gzip not found in \$PATH])
2960     fi
2962 AC_SUBST(COMPRESSIONTOOL)
2964 AC_MSG_CHECKING([for GNU or BSD tar])
2965 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
2966     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
2967     if test $? -eq 0;  then
2968         GNUTAR=$a
2969         break
2970     fi
2971 done
2972 AC_MSG_RESULT($GNUTAR)
2973 if test -z "$GNUTAR"; then
2974     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2976 AC_SUBST(GNUTAR)
2978 AC_MSG_CHECKING([for tar's option to strip components])
2979 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
2980 if test $? -eq 0; then
2981     STRIP_COMPONENTS="--strip-components"
2982 else
2983     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
2984     if test $? -eq 0; then
2985         STRIP_COMPONENTS="--strip-path"
2986     else
2987         STRIP_COMPONENTS="unsupported"
2988     fi
2990 AC_MSG_RESULT($STRIP_COMPONENTS)
2991 if test x$STRIP_COMPONENTS = xunsupported; then
2992     AC_MSG_ERROR([you need a tar that is able to strip components.])
2994 AC_SUBST(STRIP_COMPONENTS)
2996 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2997 dnl desktop OSes from "mobile" ones.
2999 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3000 dnl In other words, that when building for an OS that is not a
3001 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3003 dnl Note the direction of the implication; there is no assumption that
3004 dnl cross-compiling would imply a non-desktop OS.
3006 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3007     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3008     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3009     if test "$_os" != Emscripten; then
3010         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3011     fi
3014 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3015 # also work with the default gtk3 plugin.
3016 if test "$enable_wasm_strip" = "yes"; then
3017     enable_avmedia=no
3018     enable_cmis=no
3019     enable_coinmp=no
3020     enable_cups=no
3021     test "$_os" = Emscripten && enable_curl=no
3022     enable_database_connectivity=no
3023     enable_dbus=no
3024     enable_dconf=no
3025     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3026     enable_extension_integration=no
3027     enable_extensions=no
3028     enable_extension_update=no
3029     enable_gio=no
3030     enable_gpgmepp=no
3031     enable_ldap=no
3032     enable_lotuswordpro=no
3033     enable_lpsolve=no
3034     enable_nss=no
3035     enable_odk=no
3036     enable_online_update=no
3037     enable_opencl=no
3038     enable_pdfimport=no
3039     enable_randr=no
3040     enable_report_builder=no
3041     enable_scripting=no
3042     enable_sdremote_bluetooth=no
3043     enable_skia=no
3044     enable_xmlhelp=no
3045     enable_zxing=no
3046     test_libepubgen=no
3047     test_libcdr=no
3048     test_libcmis=no
3049     test_libetonyek=no
3050     test_libfreehand=no
3051     test_libmspub=no
3052     test_libpagemaker=no
3053     test_libqxp=no
3054     test_libvisio=no
3055     test_libzmf=no
3056     test_webdav=no
3057     with_galleries=no
3058     with_webdav=no
3059     with_x=no
3061     test "${with_fonts+set}" = set || with_fonts=yes
3062     test "${with_locales+set}" = set || with_locales=en
3064     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3065     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3066     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3067     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3068 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3069     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3070     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3071     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3072     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3073 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3074     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3075     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3076     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3077     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3078     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3079     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3080     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3081     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3084 EMSCRIPTEN_NEH_MAJOR=3
3085 EMSCRIPTEN_NEH_MINOR=1
3086 EMSCRIPTEN_NEH_TINY=3
3087 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3089 if test "$enable_wasm_exceptions" = yes; then
3090     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3091     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3092     if test $? -ne 0; then
3093         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3094     else
3095         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3096     fi
3097     ENABLE_WASM_EXCEPTIONS=TRUE
3099 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3101 # Whether to build "avmedia" functionality or not.
3103 if test "$enable_avmedia" = yes; then
3104     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3105     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3106 else
3107     test_gstreamer_1_0=no
3110 # Decide whether to build database connectivity stuff (including Base) or not.
3111 if test "$enable_database_connectivity" != no; then
3112     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3113     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3114 else
3115     if test "$_os" = iOS; then
3116         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3117     fi
3118     disable_database_connectivity_dependencies
3121 if test -z "$enable_extensions"; then
3122     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3123     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3124         enable_extensions=yes
3125     fi
3128 DISABLE_SCRIPTING=''
3129 if test "$enable_scripting" = yes; then
3130     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3131     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3132 else
3133     DISABLE_SCRIPTING='TRUE'
3134     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3137 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3138     # Disable dynamic_loading always for iOS and Android
3139     enable_dynamic_loading=no
3140 elif test -z "$enable_dynamic_loading"; then
3141     # Otherwise enable it unless specifically disabled
3142     enable_dynamic_loading=yes
3145 DISABLE_DYNLOADING=''
3146 if test "$enable_dynamic_loading" = yes; then
3147     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3148 else
3149     DISABLE_DYNLOADING='TRUE'
3150     if test $_os != iOS -a $_os != Android; then
3151         enable_database_connectivity=no
3152         enable_nss=no
3153         enable_odk=no
3154         enable_python=no
3155         enable_skia=no
3156         with_java=no
3157     fi
3159 AC_SUBST(DISABLE_DYNLOADING)
3161 ENABLE_CUSTOMTARGET_COMPONENTS=
3162 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3163     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3164     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3165         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3166     fi
3168 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3170 if test "$enable_extensions" = yes; then
3171     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3172     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3173 else
3174     enable_extension_integration=no
3175     enable_extension_update=no
3178 # remember SYSBASE value
3179 AC_SUBST(SYSBASE)
3181 dnl ===================================================================
3182 dnl  Sort out various gallery compilation options
3183 dnl ===================================================================
3184 WITH_GALLERY_BUILD=TRUE
3185 AC_MSG_CHECKING([how to build and package galleries])
3186 if test -n "${with_galleries}"; then
3187     if test "$with_galleries" = "build"; then
3188         if test "$enable_database_connectivity" = no; then
3189             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3190         fi
3191         AC_MSG_RESULT([build from source images internally])
3192     elif test "$with_galleries" = "no"; then
3193         WITH_GALLERY_BUILD=
3194         AC_MSG_RESULT([disable non-internal gallery build])
3195     else
3196         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3197     fi
3198 else
3199     if test $_os != iOS -a $_os != Android; then
3200         AC_MSG_RESULT([internal src images for desktop])
3201     else
3202         WITH_GALLERY_BUILD=
3203         AC_MSG_RESULT([disable src image build])
3204     fi
3206 AC_SUBST(WITH_GALLERY_BUILD)
3208 dnl ===================================================================
3209 dnl  Checks if ccache is available
3210 dnl ===================================================================
3211 CCACHE_DEPEND_MODE=
3212 if test "$enable_ccache" = "no"; then
3213     CCACHE=""
3214 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3215     case "%$CC%$CXX%" in
3216     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3217     # assume that's good then
3218     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3219         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3220         CCACHE_DEPEND_MODE=1
3221         ;;
3222     *)
3223         # try to use our own ccache if it is available and CCACHE was not already defined
3224         if test -z "$CCACHE"; then
3225             if test "$_os" = "WINNT"; then
3226                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3227             fi
3228             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3229                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3230             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3231                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3232             fi
3233         fi
3234         AC_PATH_PROG([CCACHE],[ccache],[not found])
3235         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3236             CCACHE=`win_short_path_for_make "$CCACHE"`
3237             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3238             rm -f conftest.txt
3239             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3240             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3241             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3242                 AC_MSG_RESULT(yes)
3243             else
3244                 AC_MSG_RESULT(no)
3245                 CCACHE="not found"
3246             fi
3247             rm -f conftest.txt
3248         fi
3249         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3250             # on windows/VC perhaps sccache is around?
3251             case "%$CC%$CXX%" in
3252             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3253             # assume that's good then
3254             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3255                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3256                 CCACHE_DEPEND_MODE=1
3257                 SCCACHE=1
3258                 ;;
3259             *)
3260                 # for sharing code below, reuse CCACHE env var
3261                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3262                 if test "$CCACHE" != "not found"; then
3263                     CCACHE=`win_short_path_for_make "$CCACHE"`
3264                     SCCACHE=1
3265                     CCACHE_DEPEND_MODE=1
3266                 fi
3267                 ;;
3268             esac
3269         fi
3270         if test "$CCACHE" = "not found"; then
3271             CCACHE=""
3272         fi
3273         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3274             CCACHE_DEPEND_MODE=1
3275             # Need to check for ccache version: otherwise prevents
3276             # caching of the results (like "-x objective-c++" for Mac)
3277             if test $_os = Darwin -o $_os = iOS; then
3278                 # Check ccache version
3279                 AC_MSG_CHECKING([whether version of ccache is suitable])
3280                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3281                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3282                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3283                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3284                 else
3285                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3286                     CCACHE=""
3287                     CCACHE_DEPEND_MODE=
3288                 fi
3289             fi
3290         fi
3291         ;;
3292     esac
3293 else
3294     CCACHE=""
3296 if test "$enable_ccache" = "nodepend"; then
3297     CCACHE_DEPEND_MODE=""
3299 AC_SUBST(CCACHE_DEPEND_MODE)
3301 # sccache defaults are good enough
3302 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3303     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3304     # -p works with both 4.2 and 4.4
3305     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//'])
3306     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3307     if test "$ccache_size" = ""; then
3308         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3309         if test "$ccache_size" = ""; then
3310             ccache_size=0
3311         fi
3312         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3313         if test $ccache_size -lt 1024; then
3314             CCACHE=""
3315             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3316             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3317         else
3318             # warn that ccache may be too small for debug build
3319             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3320             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3321         fi
3322     else
3323         if test $ccache_size -lt 5; then
3324             #warn that ccache may be too small for debug build
3325             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3326             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3327         fi
3328     fi
3331 ENABLE_Z7_DEBUG=
3332 if test "$enable_z7_debug" != no; then
3333     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3334         ENABLE_Z7_DEBUG=TRUE
3335     fi
3336 else
3337     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3338     add_warning "ccache will not work with --disable-z7-debug"
3340 AC_SUBST(ENABLE_Z7_DEBUG)
3342 dnl ===================================================================
3343 dnl  Checks for C compiler,
3344 dnl  The check for the C++ compiler is later on.
3345 dnl ===================================================================
3346 if test "$_os" != "WINNT"; then
3347     GCC_HOME_SET="true"
3348     AC_MSG_CHECKING([gcc home])
3349     if test -z "$with_gcc_home"; then
3350         if test "$enable_icecream" = "yes"; then
3351             if test -d "/usr/lib/icecc/bin"; then
3352                 GCC_HOME="/usr/lib/icecc/"
3353             elif test -d "/usr/libexec/icecc/bin"; then
3354                 GCC_HOME="/usr/libexec/icecc/"
3355             elif test -d "/opt/icecream/bin"; then
3356                 GCC_HOME="/opt/icecream/"
3357             else
3358                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3360             fi
3361         else
3362             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3363             GCC_HOME_SET="false"
3364         fi
3365     else
3366         GCC_HOME="$with_gcc_home"
3367     fi
3368     AC_MSG_RESULT($GCC_HOME)
3369     AC_SUBST(GCC_HOME)
3371     if test "$GCC_HOME_SET" = "true"; then
3372         if test -z "$CC"; then
3373             CC="$GCC_HOME/bin/gcc"
3374             CC_BASE="gcc"
3375         fi
3376         if test -z "$CXX"; then
3377             CXX="$GCC_HOME/bin/g++"
3378             CXX_BASE="g++"
3379         fi
3380     fi
3383 COMPATH=`dirname "$CC"`
3384 if test "$COMPATH" = "."; then
3385     AC_PATH_PROGS(COMPATH, $CC)
3386     dnl double square bracket to get single because of M4 quote...
3387     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3389 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3391 dnl ===================================================================
3392 dnl Java support
3393 dnl ===================================================================
3394 AC_MSG_CHECKING([whether to build with Java support])
3395 if test "$with_java" != "no"; then
3396     if test "$DISABLE_SCRIPTING" = TRUE; then
3397         AC_MSG_RESULT([no, overridden by --disable-scripting])
3398         ENABLE_JAVA=""
3399         with_java=no
3400     else
3401         AC_MSG_RESULT([yes])
3402         ENABLE_JAVA="TRUE"
3403         AC_DEFINE(HAVE_FEATURE_JAVA)
3404     fi
3405 else
3406     AC_MSG_RESULT([no])
3407     ENABLE_JAVA=""
3410 AC_SUBST(ENABLE_JAVA)
3412 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3414 dnl ENABLE_JAVA="" indicate no Java support at all
3416 dnl ===================================================================
3417 dnl Check macOS SDK and compiler
3418 dnl ===================================================================
3420 if test $_os = Darwin; then
3422     # The SDK in the currently selected Xcode should be found.
3424     AC_MSG_CHECKING([what macOS SDK to use])
3425     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3426     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3427     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3428     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3429     # problems that existed in the PPC days with target versions not being respected or random
3430     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3431     # SDK version is enough, no need to do both...
3432     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3433     if test ! -d "$MACOSX_SDK_PATH"; then
3434         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3435     fi
3436     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3437     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3438     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3439     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3440     # 10.10.2 is 101002
3441     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3442     # correct version in case such an old SDK is specified, it will be rejected later anyway
3443     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3444     if test $MACOSX_SDK_VERSION -lt 101500; then
3445         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3446     fi
3447     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3448         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3449     fi
3450     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3452     AC_MSG_CHECKING([what minimum version of macOS to require])
3453     if test "$with_macosx_version_min_required" = "" ; then
3454         if test "$host_cpu" = x86_64; then
3455             with_macosx_version_min_required="10.15";
3456         else
3457             with_macosx_version_min_required="11.0";
3458         fi
3459     fi
3460     # see same notes about MACOSX_SDK_VERSION above
3461     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3462     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3463         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3464     fi
3465     AC_MSG_RESULT([$with_macosx_version_min_required])
3467     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3468     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3469         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3470     else
3471         AC_MSG_RESULT([yes])
3472     fi
3474     # export this so that "xcrun" invocations later return matching values
3475     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3476     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3477     export DEVELOPER_DIR
3478     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3479     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3481     AC_MSG_CHECKING([whether Xcode is new enough])
3482     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3483     my_xcode_ver2=${my_xcode_ver1#Xcode }
3484     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3485     if test "$my_xcode_ver3" -ge 1205; then
3486         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3487     else
3488         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3489     fi
3491     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3492     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3494     LIBTOOL=/usr/bin/libtool
3495     INSTALL_NAME_TOOL=install_name_tool
3496     if test -z "$save_CC"; then
3497         stdlib=-stdlib=libc++
3499         AC_MSG_CHECKING([what C compiler to use])
3500         CC="`xcrun -find clang`"
3501         CC_BASE=`first_arg_basename "$CC"`
3502         if test "$host_cpu" = x86_64; then
3503             CC+=" -target x86_64-apple-macos"
3504         else
3505             CC+=" -target arm64-apple-macos"
3506         fi
3507         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3508         AC_MSG_RESULT([$CC])
3510         AC_MSG_CHECKING([what C++ compiler to use])
3511         CXX="`xcrun -find clang++`"
3512         CXX_BASE=`first_arg_basename "$CXX"`
3513         if test "$host_cpu" = x86_64; then
3514             CXX+=" -target x86_64-apple-macos"
3515         else
3516             CXX+=" -target arm64-apple-macos"
3517         fi
3518         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3519         AC_MSG_RESULT([$CXX])
3521         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3522         AR=`xcrun -find ar`
3523         NM=`xcrun -find nm`
3524         STRIP=`xcrun -find strip`
3525         LIBTOOL=`xcrun -find libtool`
3526         RANLIB=`xcrun -find ranlib`
3527     fi
3529     AC_MSG_CHECKING([whether to do code signing])
3531     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3532         AC_MSG_RESULT([no])
3533     else
3534         if test "$enable_macosx_code_signing" = yes; then
3535             # By default use the first suitable certificate (?).
3537             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3538             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3539             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3540             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3541             # "Developer ID Application" one.
3542             identity="Developer ID Application:"
3543         else
3544             identity=$enable_macosx_code_signing
3545         fi
3546         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3547         if test -n "$identity"; then
3548             MACOSX_CODESIGNING_IDENTITY=$identity
3549             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3550             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3551         else
3552             AC_MSG_ERROR([cannot determine identity to use])
3553         fi
3554     fi
3556     AC_MSG_CHECKING([whether to create a Mac App Store package])
3558     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3559         AC_MSG_RESULT([no])
3560     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3561         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3562     else
3563         if test "$enable_macosx_package_signing" = yes; then
3564             # By default use the first suitable certificate.
3565             # It should be a "3rd Party Mac Developer Installer" one
3566             identity="3rd Party Mac Developer Installer:"
3567         else
3568             identity=$enable_macosx_package_signing
3569         fi
3570         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3571         if test -n "$identity"; then
3572             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3573             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3574             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3575         else
3576             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3577         fi
3578     fi
3580     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3581         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3582     fi
3584     AC_MSG_CHECKING([whether to sandbox the application])
3586     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3587         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3588     elif test "$enable_macosx_sandbox" = yes; then
3589         ENABLE_MACOSX_SANDBOX=TRUE
3590         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3591         AC_MSG_RESULT([yes])
3592     else
3593         AC_MSG_RESULT([no])
3594     fi
3596     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3597     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3598     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3600     if test -n "$with_macosx_provisioning_profile" ; then
3601         if test ! -f "$with_macosx_provisioning_profile"; then
3602             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3603         else
3604             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3605             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3606                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3607                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3608                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3609         fi
3610     fi
3612 AC_SUBST(MACOSX_SDK_PATH)
3613 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3614 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3615 AC_SUBST(INSTALL_NAME_TOOL)
3616 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3617 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3618 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3619 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3620 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3621 AC_SUBST(MACOSX_PROVISIONING_INFO)
3622 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3623 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3624 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3626 dnl ===================================================================
3627 dnl Check iOS SDK and compiler
3628 dnl ===================================================================
3630 if test $_os = iOS; then
3631     AC_MSG_CHECKING([what iOS SDK to use])
3633     if test "$enable_ios_simulator" = "yes"; then
3634         platformlc=iphonesimulator
3635         versionmin=-mios-simulator-version-min=14.5
3636     else
3637         platformlc=iphoneos
3638         versionmin=-miphoneos-version-min=14.5
3639     fi
3641     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3643     if ! test -d "$sysroot"; then
3644         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3645     fi
3647     AC_MSG_RESULT($sysroot)
3649     stdlib="-stdlib=libc++"
3651     AC_MSG_CHECKING([what C compiler to use])
3652     CC="`xcrun -find clang`"
3653     CC_BASE=`first_arg_basename "$CC"`
3654     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3655     AC_MSG_RESULT([$CC])
3657     AC_MSG_CHECKING([what C++ compiler to use])
3658     CXX="`xcrun -find clang++`"
3659     CXX_BASE=`first_arg_basename "$CXX"`
3660     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3661     AC_MSG_RESULT([$CXX])
3663     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3664     AR=`xcrun -find ar`
3665     NM=`xcrun -find nm`
3666     STRIP=`xcrun -find strip`
3667     LIBTOOL=`xcrun -find libtool`
3668     RANLIB=`xcrun -find ranlib`
3671 AC_MSG_CHECKING([whether to treat the installation as read-only])
3673 if test $_os = Darwin; then
3674     enable_readonly_installset=yes
3675 elif test "$enable_extensions" != yes; then
3676     enable_readonly_installset=yes
3678 if test "$enable_readonly_installset" = yes; then
3679     AC_MSG_RESULT([yes])
3680     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3681 else
3682     AC_MSG_RESULT([no])
3685 dnl ===================================================================
3686 dnl Structure of install set
3687 dnl ===================================================================
3689 if test $_os = Darwin; then
3690     LIBO_BIN_FOLDER=MacOS
3691     LIBO_ETC_FOLDER=Resources
3692     LIBO_LIBEXEC_FOLDER=MacOS
3693     LIBO_LIB_FOLDER=Frameworks
3694     LIBO_LIB_PYUNO_FOLDER=Resources
3695     LIBO_SHARE_FOLDER=Resources
3696     LIBO_SHARE_HELP_FOLDER=Resources/help
3697     LIBO_SHARE_JAVA_FOLDER=Resources/java
3698     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3699     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3700     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3701     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3702     LIBO_URE_BIN_FOLDER=MacOS
3703     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3704     LIBO_URE_LIB_FOLDER=Frameworks
3705     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3706     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3707 elif test $_os = WINNT; then
3708     LIBO_BIN_FOLDER=program
3709     LIBO_ETC_FOLDER=program
3710     LIBO_LIBEXEC_FOLDER=program
3711     LIBO_LIB_FOLDER=program
3712     LIBO_LIB_PYUNO_FOLDER=program
3713     LIBO_SHARE_FOLDER=share
3714     LIBO_SHARE_HELP_FOLDER=help
3715     LIBO_SHARE_JAVA_FOLDER=program/classes
3716     LIBO_SHARE_PRESETS_FOLDER=presets
3717     LIBO_SHARE_READMES_FOLDER=readmes
3718     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3719     LIBO_SHARE_SHELL_FOLDER=program/shell
3720     LIBO_URE_BIN_FOLDER=program
3721     LIBO_URE_ETC_FOLDER=program
3722     LIBO_URE_LIB_FOLDER=program
3723     LIBO_URE_MISC_FOLDER=program
3724     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3725 else
3726     LIBO_BIN_FOLDER=program
3727     LIBO_ETC_FOLDER=program
3728     LIBO_LIBEXEC_FOLDER=program
3729     LIBO_LIB_FOLDER=program
3730     LIBO_LIB_PYUNO_FOLDER=program
3731     LIBO_SHARE_FOLDER=share
3732     LIBO_SHARE_HELP_FOLDER=help
3733     LIBO_SHARE_JAVA_FOLDER=program/classes
3734     LIBO_SHARE_PRESETS_FOLDER=presets
3735     LIBO_SHARE_READMES_FOLDER=readmes
3736     if test "$enable_fuzzers" != yes; then
3737         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3738     else
3739         LIBO_SHARE_RESOURCE_FOLDER=resource
3740     fi
3741     LIBO_SHARE_SHELL_FOLDER=program/shell
3742     LIBO_URE_BIN_FOLDER=program
3743     LIBO_URE_ETC_FOLDER=program
3744     LIBO_URE_LIB_FOLDER=program
3745     LIBO_URE_MISC_FOLDER=program
3746     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3748 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3749 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3750 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3751 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3752 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3753 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3754 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3755 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3756 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3757 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3758 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3759 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3760 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3761 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3762 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3763 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3765 # Not all of them needed in config_host.mk, add more if need arises
3766 AC_SUBST(LIBO_BIN_FOLDER)
3767 AC_SUBST(LIBO_ETC_FOLDER)
3768 AC_SUBST(LIBO_LIB_FOLDER)
3769 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3770 AC_SUBST(LIBO_SHARE_FOLDER)
3771 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3772 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3773 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3774 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3775 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3776 AC_SUBST(LIBO_URE_BIN_FOLDER)
3777 AC_SUBST(LIBO_URE_ETC_FOLDER)
3778 AC_SUBST(LIBO_URE_LIB_FOLDER)
3779 AC_SUBST(LIBO_URE_MISC_FOLDER)
3780 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3782 dnl ===================================================================
3783 dnl Windows specific tests and stuff
3784 dnl ===================================================================
3786 reg_get_value()
3788     # Return value: $regvalue
3789     unset regvalue
3791     if test "$build_os" = "wsl"; then
3792         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null)
3793         return
3794     fi
3796     local _regentry="/proc/registry${1}/${2}"
3797     if test -f "$_regentry"; then
3798         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3799         # Registry keys read via /proc/registry* are always \0 terminated!
3800         local _regvalue=$(tr -d '\0' < "$_regentry")
3801         if test $? -eq 0; then
3802             regvalue=$_regvalue
3803         fi
3804     fi
3807 # Get a value from the 32-bit side of the Registry
3808 reg_get_value_32()
3810     reg_get_value "32" "$1"
3813 # Get a value from the 64-bit side of the Registry
3814 reg_get_value_64()
3816     reg_get_value "64" "$1"
3819 reg_list_values()
3821     # Return value: $reglist
3822     unset reglist
3824     if test "$build_os" = "wsl"; then
3825         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
3826         return
3827     fi
3829     reglist=$(ls "/proc/registry${1}/${2}")
3832 # List values from the 32-bit side of the Registry
3833 reg_list_values_32()
3835     reg_list_values "32" "$1"
3838 # List values from the 64-bit side of the Registry
3839 reg_list_values_64()
3841     reg_list_values "64" "$1"
3844 case "$host_os" in
3845 cygwin*|wsl*)
3846     COM=MSC
3847     OS=WNT
3848     RTL_OS=Windows
3849     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3850         P_SEP=";"
3851     else
3852         P_SEP=:
3853     fi
3854     case "$host_cpu" in
3855     x86_64)
3856         CPUNAME=X86_64
3857         RTL_ARCH=X86_64
3858         PLATFORMID=windows_x86_64
3859         WINDOWS_X64=1
3860         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3861         WIN_HOST_ARCH="x64"
3862         WIN_MULTI_ARCH="x86"
3863         WIN_HOST_BITS=64
3864         ;;
3865     i*86)
3866         CPUNAME=INTEL
3867         RTL_ARCH=x86
3868         PLATFORMID=windows_x86
3869         WIN_HOST_ARCH="x86"
3870         WIN_HOST_BITS=32
3871         WIN_OTHER_ARCH="x64"
3872         ;;
3873     aarch64)
3874         CPUNAME=AARCH64
3875         RTL_ARCH=AARCH64
3876         PLATFORMID=windows_aarch64
3877         WINDOWS_X64=1
3878         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3879         WIN_HOST_ARCH="arm64"
3880         WIN_HOST_BITS=64
3881         with_ucrt_dir=no
3882         ;;
3883     *)
3884         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3885         ;;
3886     esac
3888     case "$build_cpu" in
3889     x86_64) WIN_BUILD_ARCH="x64" ;;
3890     i*86) WIN_BUILD_ARCH="x86" ;;
3891     aarch64) WIN_BUILD_ARCH="arm64" ;;
3892     *)
3893         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3894         ;;
3895     esac
3897     SCPDEFS="$SCPDEFS -D_MSC_VER"
3898     ;;
3899 esac
3901 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3902 # other-arch won't, but wouldn't break the build (x64 on x86).
3903 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3904     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3908 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
3909     # To allow building Windows multi-arch releases without cross-tooling
3910     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
3911         cross_compiling="yes"
3912     fi
3915 if test "$cross_compiling" = "yes"; then
3916     export CROSS_COMPILING=TRUE
3917     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3918         ENABLE_WASM_STRIP=TRUE
3919     fi
3920     if test "$_os" = "Emscripten"; then
3921         if test "$with_main_module" = "calc"; then
3922             ENABLE_WASM_STRIP_WRITER=TRUE
3923         elif test "$with_main_module" = "writer"; then
3924             ENABLE_WASM_STRIP_CALC=TRUE
3925         fi
3926     fi
3927 else
3928     CROSS_COMPILING=
3929     BUILD_TYPE="$BUILD_TYPE NATIVE"
3931 AC_SUBST(CROSS_COMPILING)
3932 AC_SUBST(ENABLE_WASM_STRIP)
3933 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
3934 AC_SUBST(ENABLE_WASM_STRIP_CALC)
3936 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3937 # NOTE: must _not_ be used for bundled external libraries!
3938 ISYSTEM=
3939 if test "$GCC" = "yes"; then
3940     AC_MSG_CHECKING( for -isystem )
3941     save_CFLAGS=$CFLAGS
3942     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
3943     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3944     CFLAGS=$save_CFLAGS
3945     if test -n "$ISYSTEM"; then
3946         AC_MSG_RESULT(yes)
3947     else
3948         AC_MSG_RESULT(no)
3949     fi
3951 if test -z "$ISYSTEM"; then
3952     # fall back to using -I
3953     ISYSTEM=-I
3955 AC_SUBST(ISYSTEM)
3957 dnl ===================================================================
3958 dnl  Check which Visual Studio compiler is used
3959 dnl ===================================================================
3961 map_vs_year_to_version()
3963     # Return value: $vsversion
3965     unset vsversion
3967     case $1 in
3968     2019)
3969         vsversion=16;;
3970     2022)
3971         vsversion=17;;
3972     2022preview)
3973         vsversion=17.5;;
3974     *)
3975         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3976     esac
3979 vs_versions_to_check()
3981     # Args: $1 (optional) : versions to check, in the order of preference
3982     # Return value: $vsversions
3984     unset vsversions
3986     if test -n "$1"; then
3987         map_vs_year_to_version "$1"
3988         vsversions=$vsversion
3989     else
3990         # Default version is 2019
3991         vsversions="16"
3992     fi
3995 win_get_env_from_vsdevcmdbat()
3997     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3998     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
3999     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" >> $WRAPPERBATCHFILEPATH
4000     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4001     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4002     local result
4003     if test "$build_os" = "wsl"; then
4004         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4005     else
4006         chmod +x $WRAPPERBATCHFILEPATH
4007         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4008     fi
4009     rm -f $WRAPPERBATCHFILEPATH
4010     printf '%s' "$result"
4013 find_ucrt()
4015     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4016     if test -n "$regvalue"; then
4017         PathFormat "$regvalue"
4018         UCRTSDKDIR=$formatted_path_unix
4019         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4020         UCRTVERSION=$regvalue
4021         # Rest if not exist
4022         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4023           UCRTSDKDIR=
4024         fi
4025     fi
4026     if test -z "$UCRTSDKDIR"; then
4027         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4028         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4029         if test -f "$ide_env_file"; then
4030             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4031             UCRTSDKDIR=$formatted_path
4032             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4033             dnl Hack needed at least by tml:
4034             if test "$UCRTVERSION" = 10.0.15063.0 \
4035                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4036                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4037             then
4038                 UCRTVERSION=10.0.14393.0
4039             fi
4040         else
4041           AC_MSG_ERROR([No UCRT found])
4042         fi
4043     fi
4046 find_msvc()
4048     # Find Visual C++
4049     # Args: $1 (optional) : The VS version year
4050     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4052     unset vctest vctoolset vcnumwithdot vcbuildnumber
4054     vs_versions_to_check "$1"
4055     if test "$build_os" = wsl; then
4056         vswhere="$PROGRAMFILESX86"
4057         if test -z "$vswhere"; then
4058             vswhere="c:\\Program Files (x86)"
4059         fi
4060     else
4061         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4062     fi
4063     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4064     PathFormat "$vswhere"
4065     vswhere=$formatted_path_unix
4066     for ver in $vsversions; do
4067         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4068         if test -z "$vswhereoutput"; then
4069             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4070         fi
4071         # Fall back to all MS products (this includes VC++ Build Tools)
4072         if ! test -n "$vswhereoutput"; then
4073             AC_MSG_CHECKING([VC++ Build Tools and similar])
4074             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4075         fi
4076         if test -n "$vswhereoutput"; then
4077             PathFormat "$vswhereoutput"
4078             vctest=$formatted_path_unix
4079             break
4080         fi
4081     done
4083     if test -n "$vctest"; then
4084         vcnumwithdot="$ver"
4085         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4086             vcnumwithdot=$vcnumwithdot.0
4087         fi
4088         case "$vcnumwithdot" in
4089         16.0)
4090             vcyear=2019
4091             vctoolset=v142
4092             ;;
4093         17.0 | 17.5)
4094             vcyear=2022
4095             vctoolset=v143
4096             ;;
4097         esac
4098         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4100     fi
4103 test_cl_exe()
4105     AC_MSG_CHECKING([$1 compiler])
4107     CL_EXE_PATH="$2/cl.exe"
4109     if test ! -f "$CL_EXE_PATH"; then
4110         if test "$1" = "multi-arch"; then
4111             AC_MSG_WARN([no compiler (cl.exe) in $2])
4112             return 1
4113         else
4114             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4115         fi
4116     fi
4118     dnl ===========================================================
4119     dnl  Check for the corresponding mspdb*.dll
4120     dnl ===========================================================
4122     # MSVC 15.0 has libraries from 14.0?
4123     mspdbnum="140"
4125     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4126         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4127     fi
4129     # The compiles has to find its shared libraries
4130     OLD_PATH="$PATH"
4131     TEMP_PATH=`cygpath -d "$2"`
4132     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4134     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4135         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4136     fi
4138     PATH="$OLD_PATH"
4140     AC_MSG_RESULT([$CL_EXE_PATH])
4143 SOLARINC=
4144 MSBUILD_PATH=
4145 DEVENV=
4146 if test "$_os" = "WINNT"; then
4147     AC_MSG_CHECKING([Visual C++])
4148     find_msvc "$with_visual_studio"
4149     if test -z "$vctest"; then
4150         if test -n "$with_visual_studio"; then
4151             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4152         else
4153             AC_MSG_ERROR([no Visual Studio installation found])
4154         fi
4155     fi
4156     AC_MSG_RESULT([])
4158     VC_PRODUCT_DIR="$vctest/VC"
4159     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4161     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4162     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4163         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4164         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4165         if test $? -ne 0; then
4166             WIN_MULTI_ARCH=""
4167             WIN_OTHER_ARCH=""
4168         fi
4169     fi
4171     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4172         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4173         test_cl_exe "build" "$MSVC_BUILD_PATH"
4174     fi
4176     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4177         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4178         test_cl_exe "host" "$MSVC_HOST_PATH"
4179     else
4180         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4181     fi
4183     AC_MSG_CHECKING([for short pathname of VC product directory])
4184     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4185     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4187     UCRTSDKDIR=
4188     UCRTVERSION=
4190     AC_MSG_CHECKING([for UCRT location])
4191     find_ucrt
4192     # find_ucrt errors out if it doesn't find it
4193     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4194     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4195     ucrtincpath_formatted=$formatted_path
4196     # SOLARINC is used for external modules and must be set too.
4197     # And no, it's not sufficient to set SOLARINC only, as configure
4198     # itself doesn't honour it.
4199     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4200     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4201     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4202     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4204     AC_SUBST(UCRTSDKDIR)
4205     AC_SUBST(UCRTVERSION)
4207     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4208     # Find the proper version of MSBuild.exe to use based on the VS version
4209     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4210     if test -z "$regvalue" ; then
4211         if test "$WIN_BUILD_ARCH" != "x64"; then
4212             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4213         else
4214             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4215         fi
4216     fi
4217     if test -d "$regvalue" ; then
4218         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4219         AC_MSG_RESULT([$regvalue])
4220     else
4221         AC_MSG_ERROR([MSBuild.exe location not found])
4222     fi
4224     # Find the version of devenv.exe
4225     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4226     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4227     DEVENV_unix=$(cygpath -u "$DEVENV")
4228     if test ! -e "$DEVENV_unix"; then
4229         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4230     fi
4232     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4233     dnl needed when building CLR code:
4234     if test -z "$MSVC_CXX"; then
4235         # This gives us a posix path with 8.3 filename restrictions
4236         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4237     fi
4239     if test -z "$CC"; then
4240         CC=$MSVC_CXX
4241         CC_BASE=`first_arg_basename "$CC"`
4242     fi
4243     if test -z "$CXX"; then
4244         CXX=$MSVC_CXX
4245         CXX_BASE=`first_arg_basename "$CXX"`
4246     fi
4248     if test -n "$CC"; then
4249         # Remove /cl.exe from CC case insensitive
4250         AC_MSG_NOTICE([found Visual C++ $vcyear])
4252         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4253         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4255         PathFormat "$COMPATH"
4256         COMPATH=`win_short_path_for_make "$formatted_path"`
4258         VCVER=$vcnumwithdot
4259         VCTOOLSET=$vctoolset
4261         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4262         # are always "better", we list them in reverse chronological order.
4264         case "$vcnumwithdot" in
4265         16.0 | 17.0 | 17.5)
4266             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4267             ;;
4268         esac
4270         # The expectation is that --with-windows-sdk should not need to be used
4271         if test -n "$with_windows_sdk"; then
4272             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4273             *" "$with_windows_sdk" "*)
4274                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4275                 ;;
4276             *)
4277                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4278                 ;;
4279             esac
4280         fi
4282         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4283         ac_objext=obj
4284         ac_exeext=exe
4286     else
4287         AC_MSG_ERROR([Visual C++ not found after all, huh])
4288     fi
4290     # ERROR if VS version < 16.5
4291     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4292     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4293         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4294         // between Visual Studio versions and _MSC_VER:
4295         #if _MSC_VER < 1925
4296         #error
4297         #endif
4298     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4300     # WARN if VS version < 16.10
4301     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4302     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4303         #if _MSC_VER < 1929
4304         #error
4305         #endif
4306     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4308     if test $vs2019_recommended_version = yes; then
4309         AC_MSG_RESULT([yes])
4310     else
4311         AC_MSG_WARN([no])
4312         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."
4313     fi
4315     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4316     # version of the Explorer extension (and maybe other small
4317     # bits, too) needed when installing a 32-bit LibreOffice on a
4318     # 64-bit OS. The 64-bit Explorer extension is a feature that
4319     # has been present since long in OOo. Don't confuse it with
4320     # building LibreOffice itself as 64-bit code.
4322     BUILD_X64=
4323     CXX_X64_BINARY=
4325     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4326         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4327         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4328              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4329         then
4330             BUILD_X64=TRUE
4331             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4332             AC_MSG_RESULT([found])
4333         else
4334             AC_MSG_RESULT([not found])
4335             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4336         fi
4337     elif test "$WIN_HOST_ARCH" = "x64"; then
4338         CXX_X64_BINARY=$CXX
4339     fi
4340     AC_SUBST(BUILD_X64)
4342     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4343     AC_SUBST(CXX_X64_BINARY)
4345     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4346     # needed to support TWAIN scan on both 32- and 64-bit systems
4348     case "$WIN_HOST_ARCH" in
4349     x64)
4350         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4351         if test -n "$CXX_X86_BINARY"; then
4352             BUILD_X86=TRUE
4353             AC_MSG_RESULT([preset])
4354         elif test -n "$WIN_MULTI_ARCH"; then
4355             BUILD_X86=TRUE
4356             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4357             AC_MSG_RESULT([found])
4358         else
4359             AC_MSG_RESULT([not found])
4360             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4361         fi
4362         ;;
4363     x86)
4364         BUILD_X86=TRUE
4365         CXX_X86_BINARY=$MSVC_CXX
4366         ;;
4367     esac
4368     AC_SUBST(BUILD_X86)
4369     AC_SUBST(CXX_X86_BINARY)
4371 AC_SUBST(VCVER)
4372 AC_SUBST(VCTOOLSET)
4373 AC_SUBST(DEVENV)
4374 AC_SUBST(MSVC_CXX)
4376 COM_IS_CLANG=
4377 AC_MSG_CHECKING([whether the compiler is actually Clang])
4378 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4379     #ifndef __clang__
4380     you lose
4381     #endif
4382     int foo=42;
4383     ]])],
4384     [AC_MSG_RESULT([yes])
4385      COM_IS_CLANG=TRUE],
4386     [AC_MSG_RESULT([no])])
4387 AC_SUBST(COM_IS_CLANG)
4389 CLANGVER=
4390 if test "$COM_IS_CLANG" = TRUE; then
4391     AC_MSG_CHECKING([whether Clang is new enough])
4392     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4393         #if !defined __apple_build_version__
4394         #error
4395         #endif
4396         ]])],
4397         [my_apple_clang=yes],[my_apple_clang=])
4398     if test "$my_apple_clang" = yes; then
4399         AC_MSG_RESULT([assumed yes (Apple Clang)])
4400     elif test "$_os" = Emscripten; then
4401         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4402     else
4403         if test "$_os" = WINNT; then
4404             dnl In which case, assume clang-cl:
4405             my_args="/EP /TC"
4406         else
4407             my_args="-E -P"
4408         fi
4409         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4410         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4411         CLANGVER=`echo $clang_version \
4412             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4413         if test "$CLANGVER" -ge 80001; then
4414             AC_MSG_RESULT([yes ($clang_version)])
4415         else
4416             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 8.0.1])
4417         fi
4418         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4419         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4420     fi
4423 SHOWINCLUDES_PREFIX=
4424 if test "$_os" = WINNT; then
4425     dnl We need to guess the prefix of the -showIncludes output, it can be
4426     dnl localized
4427     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4428     echo "#include <stdlib.h>" > conftest.c
4429     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4430         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4431     rm -f conftest.c conftest.obj
4432     if test -z "$SHOWINCLUDES_PREFIX"; then
4433         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4434     else
4435         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4436     fi
4438 AC_SUBST(SHOWINCLUDES_PREFIX)
4441 # prefix C with ccache if needed
4443 if test "$CCACHE" != ""; then
4444     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4446     AC_LANG_PUSH([C])
4447     save_CFLAGS=$CFLAGS
4448     CFLAGS="$CFLAGS --ccache-skip -O2"
4449     # msvc does not fail on unknown options, check stdout
4450     if test "$COM" = MSC; then
4451         CFLAGS="$CFLAGS -nologo"
4452     fi
4453     save_ac_c_werror_flag=$ac_c_werror_flag
4454     ac_c_werror_flag=yes
4455     dnl an empty program will do, we're checking the compiler flags
4456     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4457                       [use_ccache=yes], [use_ccache=no])
4458     CFLAGS=$save_CFLAGS
4459     ac_c_werror_flag=$save_ac_c_werror_flag
4460     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4461         AC_MSG_RESULT([yes])
4462     else
4463         CC="$CCACHE $CC"
4464         CC_BASE="ccache $CC_BASE"
4465         AC_MSG_RESULT([no])
4466     fi
4467     AC_LANG_POP([C])
4470 # ===================================================================
4471 # check various GCC options that Clang does not support now but maybe
4472 # will somewhen in the future, check them even for GCC, so that the
4473 # flags are set
4474 # ===================================================================
4476 HAVE_GCC_GGDB2=
4477 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4478     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4479     save_CFLAGS=$CFLAGS
4480     CFLAGS="$CFLAGS -Werror -ggdb2"
4481     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4482     CFLAGS=$save_CFLAGS
4483     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4484         AC_MSG_RESULT([yes])
4485     else
4486         AC_MSG_RESULT([no])
4487     fi
4489     if test "$host_cpu" = "m68k"; then
4490         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4491         save_CFLAGS=$CFLAGS
4492         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4493         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4494         CFLAGS=$save_CFLAGS
4495         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4496             AC_MSG_RESULT([yes])
4497         else
4498             AC_MSG_ERROR([no])
4499         fi
4500     fi
4502 AC_SUBST(HAVE_GCC_GGDB2)
4504 dnl ===================================================================
4505 dnl  Test the gcc version
4506 dnl ===================================================================
4507 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4508     AC_MSG_CHECKING([the GCC version])
4509     _gcc_version=`$CC -dumpfullversion`
4510     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4511         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4512     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4514     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4516     if test "$gcc_full_version" -lt 70000; then
4517         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4518     fi
4519 else
4520     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4521     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4522     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4523     # (which reports itself as GCC 4.2.1).
4524     GCC_VERSION=
4526 AC_SUBST(GCC_VERSION)
4528 dnl Set the ENABLE_DBGUTIL variable
4529 dnl ===================================================================
4530 AC_MSG_CHECKING([whether to build with additional debug utilities])
4531 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4532     ENABLE_DBGUTIL="TRUE"
4533     # this is an extra var so it can have different default on different MSVC
4534     # versions (in case there are version specific problems with it)
4535     MSVC_USE_DEBUG_RUNTIME="TRUE"
4537     AC_MSG_RESULT([yes])
4538     # cppunit and graphite expose STL in public headers
4539     if test "$with_system_cppunit" = "yes"; then
4540         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4541     else
4542         with_system_cppunit=no
4543     fi
4544     if test "$with_system_graphite" = "yes"; then
4545         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4546     else
4547         with_system_graphite=no
4548     fi
4549     if test "$with_system_orcus" = "yes"; then
4550         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4551     else
4552         with_system_orcus=no
4553     fi
4554     if test "$with_system_libcmis" = "yes"; then
4555         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4556     else
4557         with_system_libcmis=no
4558     fi
4559     if test "$with_system_hunspell" = "yes"; then
4560         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4561     else
4562         with_system_hunspell=no
4563     fi
4564     if test "$with_system_gpgmepp" = "yes"; then
4565         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4566     else
4567         with_system_gpgmepp=no
4568     fi
4569     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4570     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4571     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4572     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4573     # of those two is using the system variant:
4574     if test "$with_system_libnumbertext" = "yes"; then
4575         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4576     else
4577         with_system_libnumbertext=no
4578     fi
4579     if test "$with_system_libwps" = "yes"; then
4580         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4581     else
4582         with_system_libwps=no
4583     fi
4584 else
4585     ENABLE_DBGUTIL=""
4586     MSVC_USE_DEBUG_RUNTIME=""
4587     AC_MSG_RESULT([no])
4589 AC_SUBST(ENABLE_DBGUTIL)
4590 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4592 dnl Set the ENABLE_DEBUG variable.
4593 dnl ===================================================================
4594 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4595     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4597 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4598     if test -z "$libo_fuzzed_enable_debug"; then
4599         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4600     else
4601         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4602         enable_debug=yes
4603     fi
4606 AC_MSG_CHECKING([whether to do a debug build])
4607 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4608     ENABLE_DEBUG="TRUE"
4609     if test -n "$ENABLE_DBGUTIL" ; then
4610         AC_MSG_RESULT([yes (dbgutil)])
4611     else
4612         AC_MSG_RESULT([yes])
4613     fi
4614 else
4615     ENABLE_DEBUG=""
4616     AC_MSG_RESULT([no])
4618 AC_SUBST(ENABLE_DEBUG)
4620 dnl ===================================================================
4621 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4622 dnl This is done only after compiler checks (need to know if Clang is
4623 dnl used, for different defaults) and after checking if a debug build
4624 dnl is wanted (non-debug builds get the default linker if not explicitly
4625 dnl specified otherwise).
4626 dnl All checks for linker features/options should come after this.
4627 dnl ===================================================================
4628 check_use_ld()
4630     use_ld=-fuse-ld=${1%%:*}
4631     use_ld_path=${1#*:}
4632     if test "$use_ld_path" != "$1"; then
4633         if test "$COM_IS_CLANG" = TRUE; then
4634             if test "$CLANGVER" -ge 120000; then
4635                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4636             else
4637                 use_ld="-fuse-ld=${use_ld_path}"
4638             fi
4639         else
4640             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4641             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4642             # pickup the alternative linker, when called by libtool for linking.
4643             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4644             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4645         fi
4646     fi
4647     use_ld_fail_if_error=$2
4648     use_ld_ok=
4649     AC_MSG_CHECKING([for $use_ld linker support])
4650     use_ld_ldflags_save="$LDFLAGS"
4651     LDFLAGS="$LDFLAGS $use_ld"
4652     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4653 #include <stdio.h>
4654         ],[
4655 printf ("hello world\n");
4656         ])], USE_LD=$use_ld, [])
4657     if test -n "$USE_LD"; then
4658         AC_MSG_RESULT( yes )
4659         use_ld_ok=yes
4660     else
4661         if test -n "$use_ld_fail_if_error"; then
4662             AC_MSG_ERROR( no )
4663         else
4664             AC_MSG_RESULT( no )
4665         fi
4666     fi
4667     if test -n "$use_ld_ok"; then
4668         dnl keep the value of LDFLAGS
4669         return 0
4670     fi
4671     LDFLAGS="$use_ld_ldflags_save"
4672     return 1
4674 USE_LD=
4675 if test "$enable_ld" != "no"; then
4676     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4677         if test -n "$enable_ld"; then
4678             check_use_ld "$enable_ld" fail_if_error
4679         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4680             dnl non-debug builds default to the default linker
4681             true
4682         elif test -n "$COM_IS_CLANG"; then
4683             check_use_ld lld
4684             if test $? -ne 0; then
4685                 check_use_ld gold
4686                 if test $? -ne 0; then
4687                     check_use_ld mold
4688                 fi
4689             fi
4690         else
4691             # For gcc first try gold, new versions also support lld/mold.
4692             check_use_ld gold
4693             if test $? -ne 0; then
4694                 check_use_ld lld
4695                 if test $? -ne 0; then
4696                     check_use_ld mold
4697                 fi
4698             fi
4699         fi
4700         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4701         rm conftest.out
4702         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4703         if test -z "$ld_used"; then
4704             ld_used="unknown"
4705         fi
4706         AC_MSG_CHECKING([for linker that is used])
4707         AC_MSG_RESULT([$ld_used])
4708         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4709             if echo "$ld_used" | grep -q "^GNU ld"; then
4710                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4711                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4712             fi
4713         fi
4714     else
4715         if test "$enable_ld" = "yes"; then
4716             AC_MSG_ERROR([--enable-ld not supported])
4717         fi
4718     fi
4720 AC_SUBST(USE_LD)
4721 AC_SUBST(LD)
4723 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4724 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4725     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4726     bsymbolic_functions_ldflags_save=$LDFLAGS
4727     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4728     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4729 #include <stdio.h>
4730         ],[
4731 printf ("hello world\n");
4732         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4733     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4734         AC_MSG_RESULT( found )
4735     else
4736         AC_MSG_RESULT( not found )
4737     fi
4738     LDFLAGS=$bsymbolic_functions_ldflags_save
4740 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4742 LD_GC_SECTIONS=
4743 if test "$GCC" = "yes"; then
4744     for flag in "--gc-sections" "-dead_strip"; do
4745         AC_MSG_CHECKING([for $flag linker support])
4746         ldflags_save=$LDFLAGS
4747         LDFLAGS="$LDFLAGS -Wl,$flag"
4748         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4749 #include <stdio.h>
4750             ],[
4751 printf ("hello world\n");
4752             ])],[
4753             LD_GC_SECTIONS="-Wl,$flag"
4754             AC_MSG_RESULT( found )
4755             ], [
4756             AC_MSG_RESULT( not found )
4757             ])
4758         LDFLAGS=$ldflags_save
4759         if test -n "$LD_GC_SECTIONS"; then
4760             break
4761         fi
4762     done
4764 AC_SUBST(LD_GC_SECTIONS)
4766 HAVE_EXTERNAL_DWARF=
4767 if test "$enable_split_debug" != no; then
4768     use_split_debug=
4769     if test -n "$ENABLE_LTO"; then
4770         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4771     elif test "$enable_split_debug" = yes; then
4772         use_split_debug=1
4773     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4774     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4775         use_split_debug=1
4776     fi
4777     if test -n "$use_split_debug"; then
4778         if test "$_os" = "Emscripten"; then
4779             TEST_CC_FLAG=-gseparate-dwarf
4780         else
4781             TEST_CC_FLAG=-gsplit-dwarf
4782         fi
4783         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4784         save_CFLAGS=$CFLAGS
4785         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4786         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4787         CFLAGS=$save_CFLAGS
4788         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4789             AC_MSG_RESULT([yes])
4790         else
4791             if test "$enable_split_debug" = yes; then
4792                 AC_MSG_ERROR([no])
4793             else
4794                 AC_MSG_RESULT([no])
4795             fi
4796         fi
4797     fi
4798     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4799         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4800         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4801     fi
4803 AC_SUBST(HAVE_EXTERNAL_DWARF)
4805 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4806 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4807 save_CFLAGS=$CFLAGS
4808 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4809 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4810 CFLAGS=$save_CFLAGS
4811 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4812     AC_MSG_RESULT([yes])
4813 else
4814     AC_MSG_RESULT([no])
4816 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4818 ENABLE_GDB_INDEX=
4819 if test "$enable_gdb_index" != "no"; then
4820     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4821     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4822         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4823         save_CFLAGS=$CFLAGS
4824         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
4825         have_ggnu_pubnames=
4826         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4827         if test "$have_ggnu_pubnames" != "TRUE"; then
4828             if test "$enable_gdb_index" = "yes"; then
4829                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4830             else
4831                 AC_MSG_RESULT( no )
4832             fi
4833         else
4834             AC_MSG_RESULT( yes )
4835             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4836             ldflags_save=$LDFLAGS
4837             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4838             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4839 #include <stdio.h>
4840                 ],[
4841 printf ("hello world\n");
4842                 ])], ENABLE_GDB_INDEX=TRUE, [])
4843             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4844                 AC_MSG_RESULT( yes )
4845             else
4846                 if test "$enable_gdb_index" = "yes"; then
4847                     AC_MSG_ERROR( no )
4848                 else
4849                     AC_MSG_RESULT( no )
4850                 fi
4851             fi
4852             LDFLAGS=$ldflags_save
4853         fi
4854         CFLAGS=$save_CFLAGS
4855         fi
4856     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4857         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4858         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4859     fi
4861 AC_SUBST(ENABLE_GDB_INDEX)
4863 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4864     enable_sal_log=yes
4866 if test "$enable_sal_log" = yes; then
4867     ENABLE_SAL_LOG=TRUE
4869 AC_SUBST(ENABLE_SAL_LOG)
4871 dnl Check for enable symbols option
4872 dnl ===================================================================
4873 AC_MSG_CHECKING([whether to generate debug information])
4874 if test -z "$enable_symbols"; then
4875     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4876         enable_symbols=yes
4877     else
4878         enable_symbols=no
4879     fi
4881 if test "$enable_symbols" = yes; then
4882     ENABLE_SYMBOLS_FOR=all
4883     AC_MSG_RESULT([yes])
4884 elif test "$enable_symbols" = no; then
4885     ENABLE_SYMBOLS_FOR=
4886     AC_MSG_RESULT([no])
4887 else
4888     # Selective debuginfo.
4889     ENABLE_SYMBOLS_FOR="$enable_symbols"
4890     AC_MSG_RESULT([for "$enable_symbols"])
4892 AC_SUBST(ENABLE_SYMBOLS_FOR)
4894 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4895     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4896     AC_MSG_CHECKING([whether enough memory is available for linking])
4897     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4898     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4899     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4900         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4901     else
4902         AC_MSG_RESULT([yes])
4903     fi
4906 ENABLE_OPTIMIZED=
4907 ENABLE_OPTIMIZED_DEBUG=
4908 AC_MSG_CHECKING([whether to compile with optimization flags])
4909 if test -z "$enable_optimized"; then
4910     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4911         enable_optimized=no
4912     else
4913         enable_optimized=yes
4914     fi
4916 if test "$enable_optimized" = yes; then
4917     ENABLE_OPTIMIZED=TRUE
4918     AC_MSG_RESULT([yes])
4919 elif test "$enable_optimized" = debug; then
4920     ENABLE_OPTIMIZED_DEBUG=TRUE
4921     AC_MSG_RESULT([yes (debug)])
4922     HAVE_GCC_OG=
4923     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4924         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4925         save_CFLAGS=$CFLAGS
4926         CFLAGS="$CFLAGS -Werror -Og"
4927         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4928         CFLAGS=$save_CFLAGS
4929         if test "$HAVE_GCC_OG" = "TRUE"; then
4930             AC_MSG_RESULT([yes])
4931         else
4932             AC_MSG_RESULT([no])
4933         fi
4934     fi
4935     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4936         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4937     fi
4938 else
4939     AC_MSG_RESULT([no])
4941 AC_SUBST(ENABLE_OPTIMIZED)
4942 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4945 # determine CPUNAME, OS, ...
4947 case "$host_os" in
4949 cygwin*|wsl*)
4950     # Already handled
4951     ;;
4953 darwin*)
4954     COM=GCC
4955     OS=MACOSX
4956     RTL_OS=MacOSX
4957     P_SEP=:
4959     case "$host_cpu" in
4960     aarch64|arm64)
4961         if test "$enable_ios_simulator" = "yes"; then
4962             OS=iOS
4963         else
4964             CPUNAME=AARCH64
4965             RTL_ARCH=AARCH64
4966             PLATFORMID=macosx_aarch64
4967         fi
4968         ;;
4969     x86_64)
4970         if test "$enable_ios_simulator" = "yes"; then
4971             OS=iOS
4972         fi
4973         CPUNAME=X86_64
4974         RTL_ARCH=X86_64
4975         PLATFORMID=macosx_x86_64
4976         ;;
4977     *)
4978         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4979         ;;
4980     esac
4981     ;;
4983 ios*)
4984     COM=GCC
4985     OS=iOS
4986     RTL_OS=iOS
4987     P_SEP=:
4989     case "$host_cpu" in
4990     aarch64|arm64)
4991         if test "$enable_ios_simulator" = "yes"; then
4992             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4993         fi
4994         ;;
4995     *)
4996         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4997         ;;
4998     esac
4999     CPUNAME=AARCH64
5000     RTL_ARCH=AARCH64
5001     PLATFORMID=ios_arm64
5002     ;;
5004 dragonfly*)
5005     COM=GCC
5006     OS=DRAGONFLY
5007     RTL_OS=DragonFly
5008     P_SEP=:
5010     case "$host_cpu" in
5011     i*86)
5012         CPUNAME=INTEL
5013         RTL_ARCH=x86
5014         PLATFORMID=dragonfly_x86
5015         ;;
5016     x86_64)
5017         CPUNAME=X86_64
5018         RTL_ARCH=X86_64
5019         PLATFORMID=dragonfly_x86_64
5020         ;;
5021     *)
5022         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5023         ;;
5024     esac
5025     ;;
5027 freebsd*)
5028     COM=GCC
5029     RTL_OS=FreeBSD
5030     OS=FREEBSD
5031     P_SEP=:
5033     case "$host_cpu" in
5034     aarch64)
5035         CPUNAME=AARCH64
5036         PLATFORMID=freebsd_aarch64
5037         RTL_ARCH=AARCH64
5038         ;;
5039     i*86)
5040         CPUNAME=INTEL
5041         RTL_ARCH=x86
5042         PLATFORMID=freebsd_x86
5043         ;;
5044     x86_64|amd64)
5045         CPUNAME=X86_64
5046         RTL_ARCH=X86_64
5047         PLATFORMID=freebsd_x86_64
5048         ;;
5049     powerpc64)
5050         CPUNAME=POWERPC64
5051         RTL_ARCH=PowerPC_64
5052         PLATFORMID=freebsd_powerpc64
5053         ;;
5054     powerpc|powerpcspe)
5055         CPUNAME=POWERPC
5056         RTL_ARCH=PowerPC
5057         PLATFORMID=freebsd_powerpc
5058         ;;
5059     *)
5060         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5061         ;;
5062     esac
5063     ;;
5065 haiku*)
5066     COM=GCC
5067     GUIBASE=haiku
5068     RTL_OS=Haiku
5069     OS=HAIKU
5070     P_SEP=:
5072     case "$host_cpu" in
5073     i*86)
5074         CPUNAME=INTEL
5075         RTL_ARCH=x86
5076         PLATFORMID=haiku_x86
5077         ;;
5078     x86_64|amd64)
5079         CPUNAME=X86_64
5080         RTL_ARCH=X86_64
5081         PLATFORMID=haiku_x86_64
5082         ;;
5083     *)
5084         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5085         ;;
5086     esac
5087     ;;
5089 kfreebsd*)
5090     COM=GCC
5091     OS=LINUX
5092     RTL_OS=kFreeBSD
5093     P_SEP=:
5095     case "$host_cpu" in
5097     i*86)
5098         CPUNAME=INTEL
5099         RTL_ARCH=x86
5100         PLATFORMID=kfreebsd_x86
5101         ;;
5102     x86_64)
5103         CPUNAME=X86_64
5104         RTL_ARCH=X86_64
5105         PLATFORMID=kfreebsd_x86_64
5106         ;;
5107     *)
5108         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5109         ;;
5110     esac
5111     ;;
5113 linux-gnu*|linux-musl*)
5114     COM=GCC
5115     OS=LINUX
5116     RTL_OS=Linux
5117     P_SEP=:
5119     case "$host_cpu" in
5121     aarch64)
5122         CPUNAME=AARCH64
5123         PLATFORMID=linux_aarch64
5124         RTL_ARCH=AARCH64
5125         EPM_FLAGS="-a arm64"
5126         ;;
5127     alpha)
5128         CPUNAME=AXP
5129         RTL_ARCH=ALPHA
5130         PLATFORMID=linux_alpha
5131         ;;
5132     arm*)
5133         CPUNAME=ARM
5134         EPM_FLAGS="-a arm"
5135         RTL_ARCH=ARM_EABI
5136         PLATFORMID=linux_arm_eabi
5137         case "$host_cpu" in
5138         arm*-linux)
5139             RTL_ARCH=ARM_OABI
5140             PLATFORMID=linux_arm_oabi
5141             ;;
5142         esac
5143         ;;
5144     hppa)
5145         CPUNAME=HPPA
5146         RTL_ARCH=HPPA
5147         EPM_FLAGS="-a hppa"
5148         PLATFORMID=linux_hppa
5149         ;;
5150     i*86)
5151         CPUNAME=INTEL
5152         RTL_ARCH=x86
5153         PLATFORMID=linux_x86
5154         ;;
5155     ia64)
5156         CPUNAME=IA64
5157         RTL_ARCH=IA64
5158         PLATFORMID=linux_ia64
5159         ;;
5160     mips)
5161         CPUNAME=MIPS
5162         RTL_ARCH=MIPS_EB
5163         EPM_FLAGS="-a mips"
5164         PLATFORMID=linux_mips_eb
5165         ;;
5166     mips64)
5167         CPUNAME=MIPS64
5168         RTL_ARCH=MIPS64_EB
5169         EPM_FLAGS="-a mips64"
5170         PLATFORMID=linux_mips64_eb
5171         ;;
5172     mips64el)
5173         CPUNAME=MIPS64
5174         RTL_ARCH=MIPS64_EL
5175         EPM_FLAGS="-a mips64el"
5176         PLATFORMID=linux_mips64_el
5177         ;;
5178     mipsel)
5179         CPUNAME=MIPS
5180         RTL_ARCH=MIPS_EL
5181         EPM_FLAGS="-a mipsel"
5182         PLATFORMID=linux_mips_el
5183         ;;
5184     riscv64)
5185         CPUNAME=RISCV64
5186         RTL_ARCH=RISCV64
5187         EPM_FLAGS="-a riscv64"
5188         PLATFORMID=linux_riscv64
5189         ;;
5190     m68k)
5191         CPUNAME=M68K
5192         RTL_ARCH=M68K
5193         PLATFORMID=linux_m68k
5194         ;;
5195     powerpc)
5196         CPUNAME=POWERPC
5197         RTL_ARCH=PowerPC
5198         PLATFORMID=linux_powerpc
5199         ;;
5200     powerpc64)
5201         CPUNAME=POWERPC64
5202         RTL_ARCH=PowerPC_64
5203         PLATFORMID=linux_powerpc64
5204         ;;
5205     powerpc64le)
5206         CPUNAME=POWERPC64
5207         RTL_ARCH=PowerPC_64_LE
5208         PLATFORMID=linux_powerpc64_le
5209         ;;
5210     sparc)
5211         CPUNAME=SPARC
5212         RTL_ARCH=SPARC
5213         PLATFORMID=linux_sparc
5214         ;;
5215     sparc64)
5216         CPUNAME=SPARC64
5217         RTL_ARCH=SPARC64
5218         PLATFORMID=linux_sparc64
5219         ;;
5220     s390x)
5221         CPUNAME=S390X
5222         RTL_ARCH=S390x
5223         PLATFORMID=linux_s390x
5224         ;;
5225     x86_64)
5226         CPUNAME=X86_64
5227         RTL_ARCH=X86_64
5228         PLATFORMID=linux_x86_64
5229         ;;
5230     loongarch64)
5231         CPUNAME=LOONGARCH64
5232         RTL_ARCH=LOONGARCH64
5233         PLATFORMID=linux_loongarch64
5234         ;;
5235     *)
5236         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5237         ;;
5238     esac
5239     ;;
5241 linux-android*)
5242     COM=GCC
5243     OS=ANDROID
5244     RTL_OS=Android
5245     P_SEP=:
5247     case "$host_cpu" in
5249     arm|armel)
5250         CPUNAME=ARM
5251         RTL_ARCH=ARM_EABI
5252         PLATFORMID=android_arm_eabi
5253         ;;
5254     aarch64)
5255         CPUNAME=AARCH64
5256         RTL_ARCH=AARCH64
5257         PLATFORMID=android_aarch64
5258         ;;
5259     i*86)
5260         CPUNAME=INTEL
5261         RTL_ARCH=x86
5262         PLATFORMID=android_x86
5263         ;;
5264     x86_64)
5265         CPUNAME=X86_64
5266         RTL_ARCH=X86_64
5267         PLATFORMID=android_x86_64
5268         ;;
5269     *)
5270         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5271         ;;
5272     esac
5273     ;;
5275 *netbsd*)
5276     COM=GCC
5277     OS=NETBSD
5278     RTL_OS=NetBSD
5279     P_SEP=:
5281     case "$host_cpu" in
5282     i*86)
5283         CPUNAME=INTEL
5284         RTL_ARCH=x86
5285         PLATFORMID=netbsd_x86
5286         ;;
5287     powerpc)
5288         CPUNAME=POWERPC
5289         RTL_ARCH=PowerPC
5290         PLATFORMID=netbsd_powerpc
5291         ;;
5292     sparc)
5293         CPUNAME=SPARC
5294         RTL_ARCH=SPARC
5295         PLATFORMID=netbsd_sparc
5296         ;;
5297     x86_64)
5298         CPUNAME=X86_64
5299         RTL_ARCH=X86_64
5300         PLATFORMID=netbsd_x86_64
5301         ;;
5302     *)
5303         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5304         ;;
5305     esac
5306     ;;
5308 openbsd*)
5309     COM=GCC
5310     OS=OPENBSD
5311     RTL_OS=OpenBSD
5312     P_SEP=:
5314     case "$host_cpu" in
5315     i*86)
5316         CPUNAME=INTEL
5317         RTL_ARCH=x86
5318         PLATFORMID=openbsd_x86
5319         ;;
5320     x86_64)
5321         CPUNAME=X86_64
5322         RTL_ARCH=X86_64
5323         PLATFORMID=openbsd_x86_64
5324         ;;
5325     *)
5326         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5327         ;;
5328     esac
5329     SOLARINC="$SOLARINC -I/usr/local/include"
5330     ;;
5332 solaris*)
5333     COM=GCC
5334     OS=SOLARIS
5335     RTL_OS=Solaris
5336     P_SEP=:
5338     case "$host_cpu" in
5339     i*86)
5340         CPUNAME=INTEL
5341         RTL_ARCH=x86
5342         PLATFORMID=solaris_x86
5343         ;;
5344     sparc)
5345         CPUNAME=SPARC
5346         RTL_ARCH=SPARC
5347         PLATFORMID=solaris_sparc
5348         ;;
5349     sparc64)
5350         CPUNAME=SPARC64
5351         RTL_ARCH=SPARC64
5352         PLATFORMID=solaris_sparc64
5353         ;;
5354     *)
5355         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5356         ;;
5357     esac
5358     SOLARINC="$SOLARINC -I/usr/local/include"
5359     ;;
5361 emscripten*)
5362     COM=GCC
5363     OS=EMSCRIPTEN
5364     RTL_OS=Emscripten
5365     P_SEP=:
5367     case "$host_cpu" in
5368     wasm32|wasm64)
5369         ;;
5370     *)
5371         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5372         ;;
5373     esac
5374     CPUNAME=INTEL
5375     RTL_ARCH=x86
5376     PLATFORMID=linux_x86
5377     ;;
5380     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5381     ;;
5382 esac
5384 DISABLE_GUI=""
5385 if test "$enable_gui" = "no"; then
5386     if test "$using_x11" != yes; then
5387         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5388     fi
5389     USING_X11=
5390     DISABLE_GUI=TRUE
5391     test_epoxy=no
5392 else
5393     AC_DEFINE(HAVE_FEATURE_UI)
5395 AC_SUBST(DISABLE_GUI)
5397 if test "$with_x" = "no"; then
5398     USING_X11=
5401 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5402     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5405 if test "$using_x11" = yes; then
5406     if test "$USING_X11" = TRUE; then
5407         AC_DEFINE(USING_X11)
5408     else
5409         disable_x11_tests
5410         if test "$DISABLE_DYNLOADING" = TRUE; then
5411             test_qt5=yes
5412         fi
5413     fi
5414 else
5415     if test "$USING_X11" = TRUE; then
5416         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5417     fi
5420 WORKDIR="${BUILDDIR}/workdir"
5421 INSTDIR="${BUILDDIR}/instdir"
5422 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5423 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5424 AC_SUBST(COM)
5425 AC_SUBST(CPUNAME)
5426 AC_SUBST(RTL_OS)
5427 AC_SUBST(RTL_ARCH)
5428 AC_SUBST(EPM_FLAGS)
5429 AC_SUBST(USING_X11)
5430 AC_SUBST([INSTDIR])
5431 AC_SUBST([INSTROOT])
5432 AC_SUBST([INSTROOTBASE])
5433 AC_SUBST(OS)
5434 AC_SUBST(P_SEP)
5435 AC_SUBST(WORKDIR)
5436 AC_SUBST(PLATFORMID)
5437 AC_SUBST(WINDOWS_X64)
5438 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5439 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5441 if test "$OS" = WNT -a "$COM" = MSC; then
5442     case "$CPUNAME" in
5443     INTEL) CPPU_ENV=msci ;;
5444     X86_64) CPPU_ENV=mscx ;;
5445     AARCH64) CPPU_ENV=msca ;;
5446     *)
5447         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5448         ;;
5449     esac
5450 else
5451     CPPU_ENV=gcc3
5453 AC_SUBST(CPPU_ENV)
5455 dnl ===================================================================
5456 dnl Test which package format to use
5457 dnl ===================================================================
5458 AC_MSG_CHECKING([which package format to use])
5459 if test -n "$with_package_format" -a "$with_package_format" != no; then
5460     for i in $with_package_format; do
5461         case "$i" in
5462         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5463             ;;
5464         *)
5465             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5466 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5467 deb - Debian software distribution
5468 pkg - Solaris software distribution
5469 rpm - RedHat software distribution
5471 LibreOffice additionally supports:
5472 archive - .tar.gz or .zip
5473 dmg - macOS .dmg
5474 installed - installation tree
5475 msi - Windows .msi
5476         ])
5477             ;;
5478         esac
5479     done
5480     # fakeroot is needed to ensure correct file ownerships/permissions
5481     # inside deb packages and tar archives created on Linux and Solaris.
5482     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5483         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5484         if test "$FAKEROOT" = "no"; then
5485             AC_MSG_ERROR(
5486                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5487         fi
5488     fi
5489     PKGFORMAT="$with_package_format"
5490     AC_MSG_RESULT([$PKGFORMAT])
5491 else
5492     PKGFORMAT=
5493     AC_MSG_RESULT([none])
5495 AC_SUBST(PKGFORMAT)
5497 dnl ===================================================================
5498 dnl handle help related options
5500 dnl If you change help related options, please update README.help
5501 dnl ===================================================================
5503 ENABLE_HTMLHELP=
5504 HELP_OMINDEX_PAGE=
5505 HELP_ONLINE=
5506 WITH_HELPPACKS=
5508 AC_MSG_CHECKING([which help to build])
5509 if test -n "$with_help" -a "$with_help" != "no"; then
5510     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5511     BUILD_TYPE="$BUILD_TYPE HELP"
5512     case "$with_help" in
5513     "html")
5514         ENABLE_HTMLHELP=TRUE
5515         WITH_HELPPACKS=TRUE
5516         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5517         AC_MSG_RESULT([HTML (local)])
5518         ;;
5519     "online")
5520         ENABLE_HTMLHELP=TRUE
5521         HELP_ONLINE=TRUE
5522         AC_MSG_RESULT([HTML (online)])
5523         ;;
5524     yes)
5525         WITH_HELPPACKS=TRUE
5526         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5527         AC_MSG_RESULT([XML (local)])
5528         ;;
5529     *)
5530         AC_MSG_ERROR([Unknown --with-help=$with_help])
5531         ;;
5532     esac
5533 else
5534     AC_MSG_RESULT([no])
5537 AC_MSG_CHECKING([if we need to build the help index tooling])
5538 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5539     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5540     test_clucene=yes
5541     AC_MSG_RESULT([yes])
5542 else
5543     AC_MSG_RESULT([no])
5546 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5547 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5548     if test "$HELP_ONLINE" != TRUE; then
5549         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5550     fi
5551     case "$with_omindex" in
5552     "server")
5553         HELP_OMINDEX_PAGE=TRUE
5554         AC_MSG_RESULT([SERVER])
5555         ;;
5556     "noxap")
5557         AC_MSG_RESULT([NOXAP])
5558         ;;
5559     *)
5560         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5561         ;;
5562     esac
5563 else
5564     AC_MSG_RESULT([no])
5567 AC_MSG_CHECKING([whether to include the XML-help support])
5568 if test "$enable_xmlhelp" = yes; then
5569     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5570     test_clucene=yes
5571     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5572     AC_MSG_RESULT([yes])
5573 else
5574     if test "$with_help" = yes; then
5575         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5576     fi
5577     AC_MSG_RESULT([no])
5580 dnl Test whether to integrate helppacks into the product's installer
5581 AC_MSG_CHECKING([for helppack integration])
5582 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5583     AC_MSG_RESULT([no integration])
5584 else
5585     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5586     AC_MSG_RESULT([integration])
5589 AC_SUBST([ENABLE_HTMLHELP])
5590 AC_SUBST([HELP_OMINDEX_PAGE])
5591 AC_SUBST([HELP_ONLINE])
5592 # WITH_HELPPACKS is used only in configure
5594 dnl ===================================================================
5595 dnl Set up a different compiler to produce tools to run on the build
5596 dnl machine when doing cross-compilation
5597 dnl ===================================================================
5599 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5600 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5601 if test "$cross_compiling" = "yes"; then
5602     AC_MSG_CHECKING([for BUILD platform configuration])
5603     echo
5604     rm -rf CONF-FOR-BUILD config_build.mk
5605     mkdir CONF-FOR-BUILD
5606     # Here must be listed all files needed when running the configure script. In particular, also
5607     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5608     # keep them in the same order as there.
5609     (cd $SRC_ROOT && tar cf - \
5610         config.guess \
5611         bin/get_config_variables \
5612         solenv/bin/getcompver.awk \
5613         solenv/inc/langlist.mk \
5614         download.lst \
5615         config_host.mk.in \
5616         config_host_lang.mk.in \
5617         Makefile.in \
5618         lo.xcent.in \
5619         bin/bffvalidator.sh.in \
5620         bin/odfvalidator.sh.in \
5621         bin/officeotron.sh.in \
5622         hardened_runtime.xcent.in \
5623         instsetoo_native/util/openoffice.lst.in \
5624         config_host/*.in \
5625         sysui/desktop/macosx/Info.plist.in \
5626         .vscode/vs-code-template.code-workspace.in \
5627         solenv/lockfile/autoconf.h.in \
5628         ) \
5629     | (cd CONF-FOR-BUILD && tar xf -)
5630     cp configure CONF-FOR-BUILD
5631     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5632     (
5633     unset COM USING_X11 OS CPUNAME
5634     unset CC CXX SYSBASE CFLAGS
5635     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5636     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5637     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5638     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5639     if test -n "$CC_FOR_BUILD"; then
5640         export CC="$CC_FOR_BUILD"
5641         CC_BASE=`first_arg_basename "$CC"`
5642     fi
5643     if test -n "$CXX_FOR_BUILD"; then
5644         export CXX="$CXX_FOR_BUILD"
5645         CXX_BASE=`first_arg_basename "$CXX"`
5646     fi
5647     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5648     cd CONF-FOR-BUILD
5650     # Handle host configuration, which affects the cross-toolset too
5651     sub_conf_opts=""
5652     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5653     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5654     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5655     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5656     if test -n "$ENABLE_JAVA"; then
5657         case "$_os" in
5658         Android)
5659             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5660             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5661             ;;
5662         *)
5663             if test -z "$with_jdk_home"; then
5664                 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.])
5665             fi
5666             ;;
5667         esac
5668     else
5669         sub_conf_opts="$sub_conf_opts --without-java"
5670     fi
5671     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5672     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5673     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5674     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5675     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5676     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5677     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5678     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5679     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5680     if test "$_os" = "Emscripten"; then
5681         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5682         if test "${with_main_module+set}" = set; then
5683             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5684         else
5685             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5686         fi
5687     fi
5689     # Don't bother having configure look for stuff not needed for the build platform anyway
5690     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5691     sub_conf_defaults=" \
5692         --build="$build_alias" \
5693         --disable-cairo-canvas \
5694         --disable-cups \
5695         --disable-customtarget-components \
5696         --disable-firebird-sdbc \
5697         --disable-gpgmepp \
5698         --disable-gstreamer-1-0 \
5699         --disable-gtk3 \
5700         --disable-gtk4 \
5701         --disable-libcmis \
5702         --disable-mariadb-sdbc \
5703         --disable-nss \
5704         --disable-online-update \
5705         --disable-opencl \
5706         --disable-openssl \
5707         --disable-pdfimport \
5708         --disable-postgresql-sdbc \
5709         --disable-skia \
5710         --disable-xmlhelp \
5711         --enable-dynamic-loading \
5712         --enable-icecream="$enable_icecream" \
5713         --without-doxygen \
5714         --without-tls \
5715         --without-webdav \
5716         --without-x \
5718     # single quotes added for better readability in case of spaces
5719     echo "    Running CONF-FOR-BUILD/configure" \
5720         $sub_conf_defaults \
5721         --with-parallelism="'$with_parallelism'" \
5722         --with-theme="'$with_theme'" \
5723         --with-vendor="'$with_vendor'" \
5724         $sub_conf_opts \
5725         $with_build_platform_configure_options \
5726         --srcdir=$srcdir
5728     ./configure \
5729         $sub_conf_defaults \
5730         --with-parallelism="$with_parallelism" \
5731         --with-theme="$with_theme" \
5732         "--with-vendor=$with_vendor" \
5733         $sub_conf_opts \
5734         $with_build_platform_configure_options \
5735         --srcdir=$srcdir \
5736         2>&1 | sed -e 's/^/    /'
5737     if test [${PIPESTATUS[0]}] -ne 0; then
5738         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5739     fi
5741     # filter permitted build targets
5742     PERMITTED_BUILD_TARGETS="
5743         AVMEDIA
5744         BOOST
5745         CAIRO
5746         CLUCENE
5747         CURL
5748         DBCONNECTIVITY
5749         DESKTOP
5750         DRAGONBOX
5751         DYNLOADING
5752         EPOXY
5753         EXPAT
5754         GLM
5755         GRAPHITE
5756         HARFBUZZ
5757         HELPTOOLS
5758         ICU
5759         LCMS2
5760         LIBJPEG_TURBO
5761         LIBLANGTAG
5762         LibO
5763         LIBFFI
5764         LIBPN
5765         LIBTIFF
5766         LIBWEBP
5767         LIBXML2
5768         LIBXSLT
5769         MDDS
5770         NATIVE
5771         ORCUS
5772         PYTHON
5773         SCRIPTING
5774         ZLIB
5776     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5777     # newlined lists, to use grep as a filter
5778     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5779     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5780     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5781     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5783     cp config_host.mk ../config_build.mk
5784     cp config_host_lang.mk ../config_build_lang.mk
5785     mv config.log ../config.Build.log
5786     mkdir -p ../config_build
5787     mv config_host/*.h ../config_build
5788     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5790     # all these will get a _FOR_BUILD postfix
5791     DIRECT_FOR_BUILD_SETTINGS="
5792         CC
5793         CPPU_ENV
5794         CXX
5795         ILIB
5796         JAVA_HOME
5797         JAVAIFLAGS
5798         JDK
5799         JDK_SECURITYMANAGER_DISALLOWED
5800         LIBO_BIN_FOLDER
5801         LIBO_LIB_FOLDER
5802         LIBO_URE_LIB_FOLDER
5803         LIBO_URE_MISC_FOLDER
5804         OS
5805         SDKDIRNAME
5806         SYSTEM_LIBXML
5807         SYSTEM_LIBXSLT
5809     # these overwrite host config with build config
5810     OVERWRITING_SETTINGS="
5811         ANT
5812         ANT_HOME
5813         ANT_LIB
5814         JAVA_CLASSPATH_NOT_SET
5815         JAVA_SOURCE_VER
5816         JAVA_TARGET_VER
5817         JAVACFLAGS
5818         JAVACOMPILER
5819         JAVADOC
5820         JAVADOCISGJDOC
5821         LOCKFILE
5822         SYSTEM_GENBRK
5823         SYSTEM_GENCCODE
5824         SYSTEM_GENCMN
5826     # these need some special handling
5827     EXTRA_HANDLED_SETTINGS="
5828         INSTDIR
5829         INSTROOT
5830         PATH
5831         WORKDIR
5833     OLD_PATH=$PATH
5834     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5835     BUILD_PATH=$PATH
5836     PATH=$OLD_PATH
5838     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5839     echo "$line" >>build-config
5841     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5842         VV='$'$V
5843         VV=`eval "echo $VV"`
5844         if test -n "$VV"; then
5845             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5846             echo "$line" >>build-config
5847         fi
5848     done
5850     for V in $OVERWRITING_SETTINGS; do
5851         VV='$'$V
5852         VV=`eval "echo $VV"`
5853         if test -n "$VV"; then
5854             line=${V}='${'${V}:-$VV'}'
5855             echo "$line" >>build-config
5856         fi
5857     done
5859     for V in INSTDIR INSTROOT WORKDIR; do
5860         VV='$'$V
5861         VV=`eval "echo $VV"`
5862         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5863         if test -n "$VV"; then
5864             line="${V}_FOR_BUILD='$VV'"
5865             echo "$line" >>build-config
5866         fi
5867     done
5869     )
5870     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5871     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])
5872     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5873              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5875     eval `cat CONF-FOR-BUILD/build-config`
5877     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5879     rm -rf CONF-FOR-BUILD
5880 else
5881     OS_FOR_BUILD="$OS"
5882     CC_FOR_BUILD="$CC"
5883     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5884     CXX_FOR_BUILD="$CXX"
5885     INSTDIR_FOR_BUILD="$INSTDIR"
5886     INSTROOT_FOR_BUILD="$INSTROOT"
5887     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5888     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5889     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5890     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5891     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5892     WORKDIR_FOR_BUILD="$WORKDIR"
5894 AC_SUBST(OS_FOR_BUILD)
5895 AC_SUBST(INSTDIR_FOR_BUILD)
5896 AC_SUBST(INSTROOT_FOR_BUILD)
5897 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5898 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5899 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5900 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5901 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5902 AC_SUBST(WORKDIR_FOR_BUILD)
5903 AC_SUBST(CC_FOR_BUILD)
5904 AC_SUBST(CXX_FOR_BUILD)
5905 AC_SUBST(CPPU_ENV_FOR_BUILD)
5907 dnl ===================================================================
5908 dnl Check for lockfile deps
5909 dnl ===================================================================
5910 if test -z "$CROSS_COMPILING"; then
5911     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
5912     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
5913     AC_MSG_CHECKING([which lockfile binary to use])
5914     case "$with_system_lockfile" in
5915     yes)
5916         AC_MSG_RESULT([external])
5917         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
5918         ;;
5919     no)
5920         AC_MSG_RESULT([internal])
5921         ;;
5922     *)
5923         if test -x "$with_system_lockfile"; then
5924             LOCKFILE="$with_system_lockfile"
5925         else
5926             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
5927         fi
5928         AC_MSG_RESULT([$with_system_lockfile])
5929         ;;
5930     esac
5933 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
5934     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
5937 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
5938 AC_CHECK_FUNCS([utime utimes])
5939 AC_SUBST(LOCKFILE)
5941 dnl ===================================================================
5942 dnl Check for syslog header
5943 dnl ===================================================================
5944 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5946 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5947 dnl ===================================================================
5948 AC_MSG_CHECKING([whether to turn warnings to errors])
5949 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5950     ENABLE_WERROR="TRUE"
5951     PYTHONWARNINGS="error"
5952     AC_MSG_RESULT([yes])
5953 else
5954     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5955         ENABLE_WERROR="TRUE"
5956         PYTHONWARNINGS="error"
5957         AC_MSG_RESULT([yes])
5958     else
5959         AC_MSG_RESULT([no])
5960     fi
5962 AC_SUBST(ENABLE_WERROR)
5963 AC_SUBST(PYTHONWARNINGS)
5965 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5966 dnl ===================================================================
5967 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5968 if test -z "$enable_assert_always_abort"; then
5969    if test "$ENABLE_DEBUG" = TRUE; then
5970        enable_assert_always_abort=yes
5971    else
5972        enable_assert_always_abort=no
5973    fi
5975 if test "$enable_assert_always_abort" = "yes"; then
5976     ASSERT_ALWAYS_ABORT="TRUE"
5977     AC_MSG_RESULT([yes])
5978 else
5979     ASSERT_ALWAYS_ABORT="FALSE"
5980     AC_MSG_RESULT([no])
5982 AC_SUBST(ASSERT_ALWAYS_ABORT)
5984 # Determine whether to use ooenv for the instdir installation
5985 # ===================================================================
5986 if test $_os != "WINNT" -a $_os != "Darwin"; then
5987     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5988     if test -z "$enable_ooenv"; then
5989         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5990             enable_ooenv=yes
5991         else
5992             enable_ooenv=no
5993         fi
5994     fi
5995     if test "$enable_ooenv" = "no"; then
5996         AC_MSG_RESULT([no])
5997     else
5998         ENABLE_OOENV="TRUE"
5999         AC_MSG_RESULT([yes])
6000     fi
6002 AC_SUBST(ENABLE_OOENV)
6004 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6005     if test "$enable_qt5" = "no"; then
6006         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6007     else
6008         enable_qt5=yes
6009     fi
6012 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6013 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6014     AC_MSG_RESULT([yes])
6015     ENABLE_PAGEIN=TRUE
6016     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6017 else
6018     AC_MSG_RESULT([no])
6020 AC_SUBST(ENABLE_PAGEIN)
6022 dnl ===================================================================
6023 dnl check for cups support
6024 dnl ===================================================================
6026 AC_MSG_CHECKING([whether to enable CUPS support])
6027 if test "$test_cups" = yes -a "$enable_cups" != no; then
6028     ENABLE_CUPS=TRUE
6029     AC_MSG_RESULT([yes])
6031     AC_MSG_CHECKING([whether cups support is present])
6032     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6033     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6034     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6035         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6036     fi
6037 else
6038     AC_MSG_RESULT([no])
6041 AC_SUBST(ENABLE_CUPS)
6043 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.4.1],,system,TRUE)
6045 dnl whether to find & fetch external tarballs?
6046 dnl ===================================================================
6047 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6048    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6049        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6050    else
6051        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6052    fi
6054 if test -z "$TARFILE_LOCATION"; then
6055     if test -d "$SRC_ROOT/src" ; then
6056         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6057         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6058     fi
6059     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6060 else
6061     AbsolutePath "$TARFILE_LOCATION"
6062     PathFormat "${absolute_path}"
6063     TARFILE_LOCATION="${formatted_path_unix}"
6065 AC_SUBST(TARFILE_LOCATION)
6067 AC_MSG_CHECKING([whether we want to fetch tarballs])
6068 if test "$enable_fetch_external" != "no"; then
6069     if test "$with_all_tarballs" = "yes"; then
6070         AC_MSG_RESULT([yes, all of them])
6071         DO_FETCH_TARBALLS="ALL"
6072     else
6073         AC_MSG_RESULT([yes, if we use them])
6074         DO_FETCH_TARBALLS="TRUE"
6075     fi
6076 else
6077     AC_MSG_RESULT([no])
6078     DO_FETCH_TARBALLS=
6080 AC_SUBST(DO_FETCH_TARBALLS)
6082 dnl Test whether to include MySpell dictionaries
6083 dnl ===================================================================
6084 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6085 if test "$with_myspell_dicts" = "yes"; then
6086     AC_MSG_RESULT([yes])
6087     WITH_MYSPELL_DICTS=TRUE
6088     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6089     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6090 else
6091     AC_MSG_RESULT([no])
6092     WITH_MYSPELL_DICTS=
6094 AC_SUBST(WITH_MYSPELL_DICTS)
6096 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6097 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6098     if test "$with_system_dicts" = yes; then
6099         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6100     fi
6101     with_system_dicts=no
6104 AC_MSG_CHECKING([whether to use dicts from external paths])
6105 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6106     AC_MSG_RESULT([yes])
6107     SYSTEM_DICTS=TRUE
6108     AC_MSG_CHECKING([for spelling dictionary directory])
6109     if test -n "$with_external_dict_dir"; then
6110         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6111     else
6112         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6113         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6114             DICT_SYSTEM_DIR=file:///usr/share/myspell
6115         fi
6116     fi
6117     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6118     AC_MSG_CHECKING([for hyphenation patterns directory])
6119     if test -n "$with_external_hyph_dir"; then
6120         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6121     else
6122         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6123     fi
6124     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6125     AC_MSG_CHECKING([for thesaurus directory])
6126     if test -n "$with_external_thes_dir"; then
6127         THES_SYSTEM_DIR=file://$with_external_thes_dir
6128     else
6129         THES_SYSTEM_DIR=file:///usr/share/mythes
6130     fi
6131     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6132 else
6133     AC_MSG_RESULT([no])
6134     SYSTEM_DICTS=
6136 AC_SUBST(SYSTEM_DICTS)
6137 AC_SUBST(DICT_SYSTEM_DIR)
6138 AC_SUBST(HYPH_SYSTEM_DIR)
6139 AC_SUBST(THES_SYSTEM_DIR)
6141 dnl ===================================================================
6142 dnl Precompiled headers.
6143 ENABLE_PCH=""
6144 AC_MSG_CHECKING([whether to enable pch feature])
6145 if test -z "$enable_pch"; then
6146     if test "$_os" = "WINNT"; then
6147         # Enabled by default on Windows.
6148         enable_pch=yes
6149         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6150         if test -z "$enable_ccache" -a "$SCCACHE"; then
6151             CCACHE=""
6152         fi
6153     else
6154         enable_pch=no
6155     fi
6157 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6158     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6160 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6161     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6163 if test "$enable_pch" = "system"; then
6164     ENABLE_PCH="1"
6165     AC_MSG_RESULT([yes (system headers)])
6166 elif test "$enable_pch" = "base"; then
6167     ENABLE_PCH="2"
6168     AC_MSG_RESULT([yes (system and base headers)])
6169 elif test "$enable_pch" = "normal"; then
6170     ENABLE_PCH="3"
6171     AC_MSG_RESULT([yes (normal)])
6172 elif test "$enable_pch" = "full"; then
6173     ENABLE_PCH="4"
6174     AC_MSG_RESULT([yes (full)])
6175 elif test "$enable_pch" = "yes"; then
6176     # Pick a suitable default.
6177     if test "$GCC" = "yes"; then
6178         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6179         # while making the PCHs larger and rebuilds more likely.
6180         ENABLE_PCH="2"
6181         AC_MSG_RESULT([yes (system and base headers)])
6182     else
6183         # With MSVC the highest level makes a significant difference,
6184         # and it was the default when there used to be no PCH levels.
6185         ENABLE_PCH="4"
6186         AC_MSG_RESULT([yes (full)])
6187     fi
6188 elif test "$enable_pch" = "no"; then
6189     AC_MSG_RESULT([no])
6190 else
6191     AC_MSG_ERROR([Unknown value for --enable-pch])
6193 AC_SUBST(ENABLE_PCH)
6194 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6195 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6196     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6197     if test "$CCACHE_BIN" != "not found"; then
6198         AC_MSG_CHECKING([ccache version])
6199         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6200         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6201         AC_MSG_RESULT([$CCACHE_VERSION])
6202         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6203         if test "$CCACHE_NUMVER" -gt "030701"; then
6204             AC_MSG_RESULT([yes])
6205         else
6206             AC_MSG_RESULT([no (not newer than 3.7.1)])
6207             CCACHE_DEPEND_MODE=
6208         fi
6209     fi
6212 PCH_INSTANTIATE_TEMPLATES=
6213 if test -n "$ENABLE_PCH"; then
6214     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6215     save_CFLAGS=$CFLAGS
6216     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6217     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6218     CFLAGS=$save_CFLAGS
6219     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6220         AC_MSG_RESULT(yes)
6221     else
6222         AC_MSG_RESULT(no)
6223     fi
6225 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6227 BUILDING_PCH_WITH_OBJ=
6228 if test -n "$ENABLE_PCH"; then
6229     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6230     save_CFLAGS=$CFLAGS
6231     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6232     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6233     CFLAGS=$save_CFLAGS
6234     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6235         AC_MSG_RESULT(yes)
6236     else
6237         AC_MSG_RESULT(no)
6238     fi
6240 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6242 PCH_CODEGEN=
6243 PCH_NO_CODEGEN=
6244 fpch_prefix=
6245 if test "$COM" = MSC; then
6246     fpch_prefix="-Xclang "
6248 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6249     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6250     save_CFLAGS=$CFLAGS
6251     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6252     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6253         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6254     CFLAGS=$save_CFLAGS
6255     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6256     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6257         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6258     CFLAGS=$save_CFLAGS
6259     if test -n "$PCH_CODEGEN"; then
6260         AC_MSG_RESULT(yes)
6261     else
6262         AC_MSG_RESULT(no)
6263     fi
6265 AC_SUBST(PCH_CODEGEN)
6266 AC_SUBST(PCH_NO_CODEGEN)
6267 PCH_DEBUGINFO=
6268 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6269     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6270     save_CFLAGS=$CFLAGS
6271     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6272     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6273     CFLAGS=$save_CFLAGS
6274     if test -n "$PCH_DEBUGINFO"; then
6275         AC_MSG_RESULT(yes)
6276     else
6277         AC_MSG_RESULT(no)
6278     fi
6280 AC_SUBST(PCH_DEBUGINFO)
6282 TAB=`printf '\t'`
6284 AC_MSG_CHECKING([the GNU Make version])
6285 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6286 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6287 if test "$_make_longver" -ge "040000"; then
6288     AC_MSG_RESULT([$GNUMAKE $_make_version])
6289 else
6290     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6293 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6294 STALE_MAKE=
6295 if test "$_make_ver_check" = ""; then
6296    STALE_MAKE=TRUE
6299 HAVE_LD_HASH_STYLE=FALSE
6300 WITH_LINKER_HASH_STYLE=
6301 AC_MSG_CHECKING([for --hash-style gcc linker support])
6302 if test "$GCC" = "yes"; then
6303     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6304         hash_styles="gnu sysv"
6305     elif test "$with_linker_hash_style" = "no"; then
6306         hash_styles=
6307     else
6308         hash_styles="$with_linker_hash_style"
6309     fi
6311     for hash_style in $hash_styles; do
6312         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6313         hash_style_ldflags_save=$LDFLAGS
6314         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6316         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6317             [
6318 #include <stdio.h>
6319             ],[
6320 printf ("");
6321             ])],
6322             [
6323                   HAVE_LD_HASH_STYLE=TRUE
6324                   WITH_LINKER_HASH_STYLE=$hash_style
6325             ],
6326             [HAVE_LD_HASH_STYLE=FALSE],
6327             [HAVE_LD_HASH_STYLE=FALSE])
6328         LDFLAGS=$hash_style_ldflags_save
6329     done
6331     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6332         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6333     else
6334         AC_MSG_RESULT( no )
6335     fi
6336     LDFLAGS=$hash_style_ldflags_save
6337 else
6338     AC_MSG_RESULT( no )
6340 AC_SUBST(HAVE_LD_HASH_STYLE)
6341 AC_SUBST(WITH_LINKER_HASH_STYLE)
6343 dnl ===================================================================
6344 dnl Check whether there's a Perl version available.
6345 dnl ===================================================================
6346 if test -z "$with_perl_home"; then
6347     AC_PATH_PROG(PERL, perl)
6348 else
6349     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6350     _perl_path="$with_perl_home/bin/perl"
6351     if test -x "$_perl_path"; then
6352         PERL=$_perl_path
6353     else
6354         AC_MSG_ERROR([$_perl_path not found])
6355     fi
6358 dnl ===================================================================
6359 dnl Testing for Perl version 5 or greater.
6360 dnl $] is the Perl version variable, it is returned as an integer
6361 dnl ===================================================================
6362 if test "$PERL"; then
6363     AC_MSG_CHECKING([the Perl version])
6364     ${PERL} -e "exit($]);"
6365     _perl_version=$?
6366     if test "$_perl_version" -lt 5; then
6367         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6368     fi
6369     AC_MSG_RESULT([Perl $_perl_version])
6370 else
6371     AC_MSG_ERROR([Perl not found, install Perl 5])
6374 dnl ===================================================================
6375 dnl Testing for required Perl modules
6376 dnl ===================================================================
6378 AC_MSG_CHECKING([for required Perl modules])
6379 perl_use_string="use Cwd ; use Digest::MD5"
6380 if test "$_os" = "WINNT"; then
6381     if test -n "$PKGFORMAT"; then
6382         for i in $PKGFORMAT; do
6383             case "$i" in
6384             msi)
6385                 # for getting fonts versions to use in MSI
6386                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6387                 ;;
6388             esac
6389         done
6390     fi
6392 if test "$with_system_hsqldb" = "yes"; then
6393     perl_use_string="$perl_use_string ; use Archive::Zip"
6395 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6396     # OpenSSL needs that to build
6397     perl_use_string="$perl_use_string ; use FindBin"
6399 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6400     AC_MSG_RESULT([all modules found])
6401 else
6402     AC_MSG_RESULT([failed to find some modules])
6403     # Find out which modules are missing.
6404     for i in $perl_use_string; do
6405         if test "$i" != "use" -a "$i" != ";"; then
6406             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6407                 missing_perl_modules="$missing_perl_modules $i"
6408             fi
6409         fi
6410     done
6411     AC_MSG_ERROR([
6412     The missing Perl modules are: $missing_perl_modules
6413     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6416 dnl ===================================================================
6417 dnl Check for pkg-config
6418 dnl ===================================================================
6419 if test "$_os" != "WINNT"; then
6420     PKG_PROG_PKG_CONFIG
6422 AC_SUBST(PKG_CONFIG)
6423 AC_SUBST(PKG_CONFIG_PATH)
6424 AC_SUBST(PKG_CONFIG_LIBDIR)
6426 if test "$_os" != "WINNT"; then
6428     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6429     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6430     # explicitly. Or put /path/to/compiler in PATH yourself.
6432     toolprefix=gcc
6433     if test "$COM_IS_CLANG" = "TRUE"; then
6434         toolprefix=llvm
6435     fi
6436     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6437     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6438     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6439     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6440     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6441     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6443 AC_SUBST(AR)
6444 AC_SUBST(NM)
6445 AC_SUBST(OBJDUMP)
6446 AC_SUBST(RANLIB)
6447 AC_SUBST(READELF)
6448 AC_SUBST(STRIP)
6450 dnl ===================================================================
6451 dnl pkg-config checks on macOS
6452 dnl ===================================================================
6454 if test $_os = Darwin; then
6455     AC_MSG_CHECKING([for bogus pkg-config])
6456     if test -n "$PKG_CONFIG"; then
6457         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6458             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6459         else
6460             if test "$enable_bogus_pkg_config" = "yes"; then
6461                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6462             else
6463                 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.])
6464             fi
6465         fi
6466     else
6467         AC_MSG_RESULT([no, good])
6468     fi
6471 find_csc()
6473     # Return value: $csctest
6475     unset csctest
6477     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6478     if test -n "$regvalue"; then
6479         csctest=$regvalue
6480         return
6481     fi
6484 find_al()
6486     # Return value: $altest
6488     unset altest
6490     # We need this check to detect 4.6.1 or above.
6491     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6492         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6493         PathFormat "$regvalue"
6494         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6495             altest=$regvalue
6496             return
6497         fi
6498     done
6500     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6501     for x in $reglist; do
6502         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6503         PathFormat "$regvalue"
6504         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6505             altest=$regvalue
6506             return
6507         fi
6508     done
6511 find_dotnetsdk46()
6513     unset frametest
6515     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
6516         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6517         if test -n "$regvalue"; then
6518             frametest=$regvalue
6519             return
6520         fi
6521     done
6524 find_winsdk_version()
6526     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6527     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6529     unset winsdktest winsdkbinsubdir winsdklibsubdir
6531     case "$1" in
6532     8.0|8.0A)
6533         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6534         if test -n "$regvalue"; then
6535             winsdktest=$regvalue
6536             winsdklibsubdir=win8
6537             return
6538         fi
6539         ;;
6540     8.1|8.1A)
6541         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6542         if test -n "$regvalue"; then
6543             winsdktest=$regvalue
6544             winsdklibsubdir=winv6.3
6545             return
6546         fi
6547         ;;
6548     10.0)
6549         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6550         if test -n "$regvalue"; then
6551             winsdktest=$regvalue
6552             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6553             if test -n "$regvalue"; then
6554                 winsdkbinsubdir="$regvalue".0
6555                 winsdklibsubdir=$winsdkbinsubdir
6556                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6557                 local tmppath_unix=$(cygpath -u "$tmppath")
6558                 # test exist the SDK path
6559                 if test -d "$tmppath_unix"; then
6560                    # when path is convertible to a short path then path is okay
6561                    cygpath -d "$tmppath" >/dev/null 2>&1
6562                    if test $? -ne 0; then
6563                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6564                    fi
6565                 else
6566                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6567                 fi
6568             fi
6569             return
6570         fi
6571         ;;
6572     esac
6575 find_winsdk()
6577     # Return value: From find_winsdk_version
6579     unset winsdktest
6581     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6582         find_winsdk_version $ver
6583         if test -n "$winsdktest"; then
6584             return
6585         fi
6586     done
6589 find_msms()
6591     # Return value: $msmdir
6592     local version="$1"
6594     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6595     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6596     local my_msm_dir
6598     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6600     msmdir=
6601     case "$VCVER" in
6602     16.0 | 17.0 | 17.5)
6603         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6604             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6605             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6606             if test -e "$my_msm_dir${my_msm_file}"; then
6607                 msmdir=$my_msm_dir
6608             fi
6609         done
6610         ;;
6611     esac
6613     if test -n "$msmdir"; then
6614         msmdir=`cygpath -m "$msmdir"`
6615         AC_MSG_RESULT([$msmdir])
6616     else
6617         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6618             AC_MSG_FAILURE([not found])
6619         else
6620             AC_MSG_WARN([not found (check config.log)])
6621             add_warning "MSM ${my_msm_file} not found"
6622         fi
6623     fi
6626 find_msvc_x64_dlls()
6628     # Return value: $msvcdllpath, $msvcdlls
6630     AC_MSG_CHECKING([for MSVC x64 DLL path])
6632     dnl Order crtver in increasing order. Then check the directories returned by
6633     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6634     dnl the result will be the highest CRT version found in the highest directory.
6636     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6637     case "$VCVER" in
6638     16.0 | 17.0 | 17.5)
6639         for crtver in 141 142 143; do
6640             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6641                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6642                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6643                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6644                 fi
6645             done
6646         done
6647         ;;
6648     esac
6649     AC_MSG_RESULT([$msvcdllpath])
6650     AC_MSG_CHECKING([for MSVC x64 DLLs])
6651     msvcdlls="msvcp140.dll vcruntime140.dll"
6652     for dll in $msvcdlls; do
6653         if ! test -f "$msvcdllpath/$dll"; then
6654             AC_MSG_FAILURE([missing $dll])
6655         fi
6656     done
6657     AC_MSG_RESULT([found all ($msvcdlls)])
6660 dnl =========================================
6661 dnl Check for the Windows  SDK.
6662 dnl =========================================
6663 if test "$_os" = "WINNT"; then
6664     AC_MSG_CHECKING([for Windows SDK])
6665     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6666         find_winsdk
6667         WINDOWS_SDK_HOME=$winsdktest
6669         # normalize if found
6670         if test -n "$WINDOWS_SDK_HOME"; then
6671             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6672             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6673         fi
6675         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6676     fi
6678     if test -n "$WINDOWS_SDK_HOME"; then
6679         # Remove a possible trailing backslash
6680         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6682         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6683              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6684              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6685             have_windows_sdk_headers=yes
6686         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6687              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6688              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6689             have_windows_sdk_headers=yes
6690         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6691              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6692              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6693             have_windows_sdk_headers=yes
6694         else
6695             have_windows_sdk_headers=no
6696         fi
6698         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6699             have_windows_sdk_libs=yes
6700         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6701             have_windows_sdk_libs=yes
6702         else
6703             have_windows_sdk_libs=no
6704         fi
6706         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6707             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6708 the  Windows SDK are installed.])
6709         fi
6710     fi
6712     if test -z "$WINDOWS_SDK_HOME"; then
6713         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6714     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6715         WINDOWS_SDK_VERSION=80
6716         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6717     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6718         WINDOWS_SDK_VERSION=81
6719         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6720     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6721         WINDOWS_SDK_VERSION=10
6722         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6723     else
6724         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6725     fi
6726     PathFormat "$WINDOWS_SDK_HOME"
6727     WINDOWS_SDK_HOME="$formatted_path"
6728     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6729     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6730         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6731         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6732             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6733         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6734             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6735         fi
6736     fi
6738     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6739     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6740     dnl but not in v8.0), so allow this to be overridden with a
6741     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6742     dnl and configuration error if no WiLangId.vbs is found would arguably be
6743     dnl better, but I do not know under which conditions exactly it is needed by
6744     dnl msiglobal.pm:
6745     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6746         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6747         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6748         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6749             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6750             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6751         fi
6752         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6753             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6754             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6755         fi
6756         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6757             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6758             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6759         fi
6760     fi
6761     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6762         if test -n "$with_package_format" -a "$with_package_format" != no; then
6763             for i in "$with_package_format"; do
6764                 if test "$i" = "msi"; then
6765                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6766                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6767                     fi
6768                 fi
6769             done
6770         fi
6771     fi
6773 AC_SUBST(WINDOWS_SDK_HOME)
6774 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6775 AC_SUBST(WINDOWS_SDK_VERSION)
6776 AC_SUBST(WINDOWS_SDK_WILANGID)
6778 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6779     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6780     dnl dir, it also determines that dir's path w/o an arch segment if any,
6781     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6782     AC_MSG_CHECKING([for midl.exe])
6784     find_winsdk
6785     PathFormat "$winsdktest"
6786     winsdktest_unix="$formatted_path_unix"
6788     if test -n "$winsdkbinsubdir" \
6789         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6790     then
6791         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6792         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
6793     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6794         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6795         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6796     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
6797         MIDL_PATH=$winsdktest/Bin
6798         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6799     fi
6800     PathFormat "$MIDL_PATH"
6801     if test ! -f "$formatted_path_unix/midl.exe"; then
6802         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6803     else
6804         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6805     fi
6807     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6808     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6810     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6811          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6812          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6813          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6814     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6815          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6816          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6817          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6818     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6819          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6820          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6821          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6822     else
6823         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6824     fi
6826     dnl Check csc.exe
6827     AC_MSG_CHECKING([for csc.exe])
6828     find_csc
6829     PathFormat "$csctest"
6830     csctest_unix="$formatted_path_unix"
6831     if test -f "$csctest_unix/csc.exe"; then
6832         CSC_PATH="$csctest"
6833     fi
6834     if test ! -f "$csctest_unix/csc.exe"; then
6835         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6836     else
6837         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6838     fi
6840     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6842     dnl Check al.exe
6843     AC_MSG_CHECKING([for al.exe])
6844     if test -n "$winsdkbinsubdir" \
6845         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6846     then
6847         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6848     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
6849         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6850     elif test -f "$winsdktest_unix/Bin/al.exe"; then
6851         AL_PATH="$winsdktest/Bin"
6852     fi
6854     if test -z "$AL_PATH"; then
6855         find_al
6856         PathFormat "$altest"
6857         altest_unix="$formatted_path_unix"
6858         if test -f "$altest_unix/bin/al.exe"; then
6859             AL_PATH="$altest/bin"
6860         elif test -f "$altest_unix/al.exe"; then
6861             AL_PATH="$altest"
6862         fi
6863     fi
6864     PathFormat "$AL_PATH"
6865     if test ! -f "$formatted_path_unix/al.exe"; then
6866         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6867     else
6868         AC_MSG_RESULT([$AL_PATH/al.exe])
6869     fi
6871     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6873     dnl Check mscoree.lib / .NET Framework dir
6874     AC_MSG_CHECKING(.NET Framework)
6875     find_dotnetsdk46
6876     PathFormat "$frametest"
6877     frametest="$formatted_path_unix"
6878     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6879         DOTNET_FRAMEWORK_HOME="$frametest"
6880     else
6881         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6882             DOTNET_FRAMEWORK_HOME="$winsdktest"
6883         fi
6884     fi
6885     PathFormat "$DOTNET_FRAMEWORK_HOME"
6886     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
6887         AC_MSG_ERROR([mscoree.lib not found])
6888     fi
6889     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6891     PathFormat "$MIDL_PATH"
6892     MIDL_PATH="$formatted_path"
6894     PathFormat "$AL_PATH"
6895     AL_PATH="$formatted_path"
6897     PathFormat "$DOTNET_FRAMEWORK_HOME"
6898     DOTNET_FRAMEWORK_HOME="$formatted_path"
6900     PathFormat "$CSC_PATH"
6901     CSC_PATH="$formatted_path"
6904 dnl ===================================================================
6905 dnl Testing for C++ compiler and version...
6906 dnl ===================================================================
6908 if test "$_os" != "WINNT"; then
6909     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6910     save_CXXFLAGS=$CXXFLAGS
6911     AC_PROG_CXX
6912     CXXFLAGS=$save_CXXFLAGS
6913     if test -z "$CXX_BASE"; then
6914         CXX_BASE=`first_arg_basename "$CXX"`
6915     fi
6918 dnl check for GNU C++ compiler version
6919 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6920     AC_MSG_CHECKING([the GNU C++ compiler version])
6922     _gpp_version=`$CXX -dumpversion`
6923     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6925     if test "$_gpp_majmin" -lt "700"; then
6926         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6927     else
6928         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6929     fi
6931     dnl see https://issuetracker.google.com/issues/36962819
6932         glibcxx_threads=no
6933         AC_LANG_PUSH([C++])
6934         AC_REQUIRE_CPP
6935         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6936         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6937             #include <bits/c++config.h>]],[[
6938             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6939             && !defined(_GLIBCXX__PTHREADS) \
6940             && !defined(_GLIBCXX_HAS_GTHREADS)
6941             choke me
6942             #endif
6943         ]])],[AC_MSG_RESULT([yes])
6944         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6945         AC_LANG_POP([C++])
6946         if test $glibcxx_threads = yes; then
6947             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6948         fi
6950 AC_SUBST(BOOST_CXXFLAGS)
6953 # prefx CXX with ccache if needed
6955 if test "$CCACHE" != ""; then
6956     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6957     AC_LANG_PUSH([C++])
6958     save_CXXFLAGS=$CXXFLAGS
6959     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6960     # msvc does not fail on unknown options, check stdout
6961     if test "$COM" = MSC; then
6962         CXXFLAGS="$CXXFLAGS -nologo"
6963     fi
6964     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
6965     ac_cxx_werror_flag=yes
6966     dnl an empty program will do, we're checking the compiler flags
6967     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6968                       [use_ccache=yes], [use_ccache=no])
6969     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6970         AC_MSG_RESULT([yes])
6971     else
6972         CXX="$CCACHE $CXX"
6973         CXX_BASE="ccache $CXX_BASE"
6974         AC_MSG_RESULT([no])
6975     fi
6976     CXXFLAGS=$save_CXXFLAGS
6977     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
6978     AC_LANG_POP([C++])
6981 dnl ===================================================================
6982 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6983 dnl ===================================================================
6985 if test "$_os" != "WINNT"; then
6986     AC_PROG_CXXCPP
6988     dnl Check whether there's a C pre-processor.
6989     AC_PROG_CPP
6993 dnl ===================================================================
6994 dnl Find integral type sizes and alignments
6995 dnl ===================================================================
6997 if test "$_os" != "WINNT"; then
6999     AC_CHECK_SIZEOF(long)
7000     AC_CHECK_SIZEOF(short)
7001     AC_CHECK_SIZEOF(int)
7002     AC_CHECK_SIZEOF(long long)
7003     AC_CHECK_SIZEOF(double)
7004     AC_CHECK_SIZEOF(void*)
7005     AC_CHECK_SIZEOF(size_t)
7007     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7008     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7009     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7010     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7011     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7012     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7014     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7015     m4_pattern_allow([AC_CHECK_ALIGNOF])
7016     m4_ifdef([AC_CHECK_ALIGNOF],
7017         [
7018             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7019             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7020             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7021             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7022         ],
7023         [
7024             case "$_os-$host_cpu" in
7025             Linux-i686)
7026                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7027                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7028                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7029                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7030                 ;;
7031             Linux-x86_64)
7032                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7033                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7034                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7035                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7036                 ;;
7037             *)
7038                 if test -z "$ac_cv_alignof_short" -o \
7039                         -z "$ac_cv_alignof_int" -o \
7040                         -z "$ac_cv_alignof_long" -o \
7041                         -z "$ac_cv_alignof_double"; then
7042                    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.])
7043                 fi
7044                 ;;
7045             esac
7046         ])
7048     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7049     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7050     if test $ac_cv_sizeof_long -eq 8; then
7051         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7052     elif test $ac_cv_sizeof_double -eq 8; then
7053         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7054     else
7055         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7056     fi
7058     dnl Check for large file support
7059     AC_SYS_LARGEFILE
7060     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7061         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7062     fi
7063     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7064         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7065     fi
7066 else
7067     # Hardcode for MSVC
7068     SAL_TYPES_SIZEOFSHORT=2
7069     SAL_TYPES_SIZEOFINT=4
7070     SAL_TYPES_SIZEOFLONG=4
7071     SAL_TYPES_SIZEOFLONGLONG=8
7072     if test $WIN_HOST_BITS -eq 32; then
7073         SAL_TYPES_SIZEOFPOINTER=4
7074         SIZEOF_SIZE_T=4
7075     else
7076         SAL_TYPES_SIZEOFPOINTER=8
7077         SIZEOF_SIZE_T=8
7078     fi
7079     SAL_TYPES_ALIGNMENT2=2
7080     SAL_TYPES_ALIGNMENT4=4
7081     SAL_TYPES_ALIGNMENT8=8
7082     LFS_CFLAGS=''
7084 AC_SUBST(LFS_CFLAGS)
7085 AC_SUBST(SIZEOF_SIZE_T)
7087 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7088 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7089 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7090 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7091 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7092 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7093 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7094 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7096 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7097 AC_MSG_CHECKING([whether jumbo sheets are supported])
7098 if test "$_os" != "WINNT"; then
7099     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7100         AC_MSG_RESULT([yes])
7101         ENABLE_JUMBO_SHEETS=TRUE
7102         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7103     else
7104         AC_MSG_RESULT([no])
7105     fi
7106 else
7107     if test $WIN_HOST_BITS -gt 32; then
7108         # 64bit windows is special-cased for tools::Long because long is 32bit
7109         AC_MSG_RESULT([yes])
7110         ENABLE_JUMBO_SHEETS=TRUE
7111         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7112     else
7113         AC_MSG_RESULT([no])
7114     fi
7116 AC_SUBST(ENABLE_JUMBO_SHEETS)
7118 dnl ===================================================================
7119 dnl Check whether to enable runtime optimizations
7120 dnl ===================================================================
7121 ENABLE_RUNTIME_OPTIMIZATIONS=
7122 AC_MSG_CHECKING([whether to enable runtime optimizations])
7123 if test -z "$enable_runtime_optimizations"; then
7124     for i in $CC; do
7125         case $i in
7126         -fsanitize=*)
7127             enable_runtime_optimizations=no
7128             break
7129             ;;
7130         esac
7131     done
7133 if test "$enable_runtime_optimizations" != no; then
7134     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7135     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7136     AC_MSG_RESULT([yes])
7137 else
7138     AC_MSG_RESULT([no])
7140 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7142 dnl ===================================================================
7143 dnl Check if valgrind headers are available
7144 dnl ===================================================================
7145 ENABLE_VALGRIND=
7146 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7147     prev_cppflags=$CPPFLAGS
7148     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7149     # or where does it come from?
7150     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7151     AC_CHECK_HEADER([valgrind/valgrind.h],
7152         [ENABLE_VALGRIND=TRUE])
7153     CPPFLAGS=$prev_cppflags
7155 AC_SUBST([ENABLE_VALGRIND])
7156 if test -z "$ENABLE_VALGRIND"; then
7157     if test "$with_valgrind" = yes; then
7158         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7159     fi
7160     VALGRIND_CFLAGS=
7162 AC_SUBST([VALGRIND_CFLAGS])
7165 dnl ===================================================================
7166 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7167 dnl ===================================================================
7169 # We need at least the sys/sdt.h include header.
7170 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7171 if test "$SDT_H_FOUND" = "TRUE"; then
7172     # Found sys/sdt.h header, now make sure the c++ compiler works.
7173     # Old g++ versions had problems with probes in constructors/destructors.
7174     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7175     AC_LANG_PUSH([C++])
7176     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7177     #include <sys/sdt.h>
7178     class ProbeClass
7179     {
7180     private:
7181       int& ref;
7182       const char *name;
7184     public:
7185       ProbeClass(int& v, const char *n) : ref(v), name(n)
7186       {
7187         DTRACE_PROBE2(_test_, cons, name, ref);
7188       }
7190       void method(int min)
7191       {
7192         DTRACE_PROBE3(_test_, meth, name, ref, min);
7193         ref -= min;
7194       }
7196       ~ProbeClass()
7197       {
7198         DTRACE_PROBE2(_test_, dest, name, ref);
7199       }
7200     };
7201     ]],[[
7202     int i = 64;
7203     DTRACE_PROBE1(_test_, call, i);
7204     ProbeClass inst = ProbeClass(i, "call");
7205     inst.method(24);
7206     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7207           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7208     AC_LANG_POP([C++])
7210 AC_CONFIG_HEADERS([config_host/config_probes.h])
7212 dnl ===================================================================
7213 dnl GCC features
7214 dnl ===================================================================
7215 HAVE_GCC_STACK_CLASH_PROTECTION=
7216 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7217     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7218     save_CFLAGS=$CFLAGS
7219     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7220     AC_LINK_IFELSE(
7221         [AC_LANG_PROGRAM(, [[return 0;]])],
7222         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7223         [AC_MSG_RESULT([no])])
7224     CFLAGS=$save_CFLAGS
7226     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7227     save_CFLAGS=$CFLAGS
7228     CFLAGS="$CFLAGS -Werror -mno-avx"
7229     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7230     CFLAGS=$save_CFLAGS
7231     if test "$HAVE_GCC_AVX" = "TRUE"; then
7232         AC_MSG_RESULT([yes])
7233     else
7234         AC_MSG_RESULT([no])
7235     fi
7237     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7238     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7239     int v = 0;
7240     if (__sync_add_and_fetch(&v, 1) != 1 ||
7241         __sync_sub_and_fetch(&v, 1) != 0)
7242         return 1;
7243     __sync_synchronize();
7244     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7245         v != 1)
7246         return 1;
7247     return 0;
7248 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7249     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7250         AC_MSG_RESULT([yes])
7251         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7252     else
7253         AC_MSG_RESULT([no])
7254     fi
7256     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7257     AC_LANG_PUSH([C++])
7258     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7259             #include <cstddef>
7260             #include <cxxabi.h>
7261             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7262         ])], [
7263             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7264             AC_MSG_RESULT([yes])
7265         ], [AC_MSG_RESULT([no])])
7266     AC_LANG_POP([C++])
7268     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7269     AC_LANG_PUSH([C++])
7270     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7271             #include <cstddef>
7272             #include <cxxabi.h>
7273             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7274         ])], [
7275             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7276             AC_MSG_RESULT([yes])
7277         ], [AC_MSG_RESULT([no])])
7278     AC_LANG_POP([C++])
7280     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7281     AC_LANG_PUSH([C++])
7282     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7283             #include <cxxabi.h>
7284             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7285         ])], [
7286             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7287             AC_MSG_RESULT([yes])
7288         ], [AC_MSG_RESULT([no])])
7289     AC_LANG_POP([C++])
7291     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7292     AC_LANG_PUSH([C++])
7293     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7294             #include <cstddef>
7295             #include <cxxabi.h>
7296             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7297         ])], [
7298             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7299             AC_MSG_RESULT([yes])
7300         ], [AC_MSG_RESULT([no])])
7301     AC_LANG_POP([C++])
7303     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7304     AC_LANG_PUSH([C++])
7305     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7306             #include <cstddef>
7307             #include <cxxabi.h>
7308             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7309         ])], [
7310             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7311             AC_MSG_RESULT([yes])
7312         ], [AC_MSG_RESULT([no])])
7313     AC_LANG_POP([C++])
7315     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7316     AC_LANG_PUSH([C++])
7317     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7318             #include <cxxabi.h>
7319             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7320         ])], [
7321             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7322             AC_MSG_RESULT([yes])
7323         ], [AC_MSG_RESULT([no])])
7324     AC_LANG_POP([C++])
7326     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7327     AC_LANG_PUSH([C++])
7328     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7329             #include <cxxabi.h>
7330             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7331         ])], [
7332             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7333             AC_MSG_RESULT([yes])
7334         ], [AC_MSG_RESULT([no])])
7335     AC_LANG_POP([C++])
7337     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7338     AC_LANG_PUSH([C++])
7339     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7340             #include <cxxabi.h>
7341             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7342         ])], [
7343             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7344             AC_MSG_RESULT([yes])
7345         ], [AC_MSG_RESULT([no])])
7346     AC_LANG_POP([C++])
7348     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7349     AC_LANG_PUSH([C++])
7350     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7351             #include <cstddef>
7352             #include <cxxabi.h>
7353             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7354         ])], [
7355             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7356             AC_MSG_RESULT([yes])
7357         ], [AC_MSG_RESULT([no])])
7358     AC_LANG_POP([C++])
7360     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7361     AC_LANG_PUSH([C++])
7362     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7363             #include <cstddef>
7364             #include <cxxabi.h>
7365             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7366         ])], [
7367             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7368             AC_MSG_RESULT([yes])
7369         ], [AC_MSG_RESULT([no])])
7370     AC_LANG_POP([C++])
7373 AC_SUBST(HAVE_GCC_AVX)
7374 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7375 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7377 dnl ===================================================================
7378 dnl Identify the C++ library
7379 dnl ===================================================================
7381 AC_MSG_CHECKING([what the C++ library is])
7382 HAVE_LIBSTDCPP=
7383 HAVE_LIBCPP=
7384 AC_LANG_PUSH([C++])
7385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7386 #include <utility>
7387 #ifndef __GLIBCXX__
7388 foo bar
7389 #endif
7390 ]])],
7391     [CPP_LIBRARY=GLIBCXX
7392      cpp_library_name="GNU libstdc++"
7393      HAVE_LIBSTDCPP=TRUE
7394     ],
7395     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7396 #include <utility>
7397 #ifndef _LIBCPP_VERSION
7398 foo bar
7399 #endif
7400 ]])],
7401     [CPP_LIBRARY=LIBCPP
7402      cpp_library_name="LLVM libc++"
7403      AC_DEFINE([HAVE_LIBCPP])
7404      HAVE_LIBCPP=TRUE
7405     ],
7406     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7407 #include <utility>
7408 #ifndef _MSC_VER
7409 foo bar
7410 #endif
7411 ]])],
7412     [CPP_LIBRARY=MSVCRT
7413      cpp_library_name="Microsoft"
7414     ],
7415     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7416 AC_MSG_RESULT([$cpp_library_name])
7417 AC_LANG_POP([C++])
7418 AC_SUBST([HAVE_LIBSTDCPP])
7419 AC_SUBST([HAVE_LIBCPP])
7421 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7422 then
7423     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7424     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7425     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7426     # although there will be backwards compatibility).
7427     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7428     # and there would be undefined references to debug functions.
7429     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7430     # So check if debug mode can be used and disable or downgrade it to assertions
7431     # if needed.
7432     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7433     AC_LANG_PUSH([C++])
7434     libcpp_debug_links=
7435     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7436 #define _LIBCPP_DEBUG 0 // only assertions
7437 #include <vector>
7438 int main()
7440     std::vector<int> v;
7441     v.push_back( 1 );
7442     return v[ 3 ];
7444 ]])], [libcpp_debug_links=1])
7445     if test -n "$libcpp_debug_links"; then
7446         # we can use at least assertions, check if debug mode works
7447         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7448 #define _LIBCPP_DEBUG 1 // debug mode
7449 #include <string>
7450 #include <vector>
7451 int foo(const std::vector<int>& v) { return *v.begin(); }
7452 int main()
7454     std::vector<int> v;
7455     v.push_back( 1 );
7456     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7457     return (foo(v) + s.size()) != 0 ? 0 : 1;
7459 ]])],
7460         [AC_MSG_RESULT(yes)
7461          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7462         ],
7463         [AC_MSG_RESULT(no, using only assertions)
7464          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7465         ]
7466         )
7467     else
7468         AC_MSG_RESULT(no)
7469     fi
7470     AC_LANG_POP([C++])
7472 AC_SUBST([LIBCPP_DEBUG])
7474 dnl ===================================================================
7475 dnl Check for gperf
7476 dnl ===================================================================
7477 AC_PATH_PROG(GPERF, gperf)
7478 if test -z "$GPERF"; then
7479     AC_MSG_ERROR([gperf not found but needed. Install it.])
7481 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7482     GPERF=`cygpath -m $GPERF`
7484 AC_MSG_CHECKING([whether gperf is new enough])
7485 my_gperf_ver1=$($GPERF --version | head -n 1)
7486 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7487 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7488 if test "$my_gperf_ver3" -ge 301; then
7489     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7490 else
7491     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7493 AC_SUBST(GPERF)
7495 dnl ===================================================================
7496 dnl Check for system libcmis
7497 dnl ===================================================================
7498 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2],enabled)
7500 dnl ===================================================================
7501 dnl C++11
7502 dnl ===================================================================
7504 if test -z "${CXXFLAGS_CXX11+x}"; then
7505     AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7506     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7507         if test "$with_latest_c__" = yes; then
7508             CXXFLAGS_CXX11=-std:c++latest
7509         else
7510             CXXFLAGS_CXX11=-std:c++17
7511         fi
7512         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7513     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7514         my_flags='-std=c++17 -std=c++1z'
7515         if test "$with_latest_c__" = yes; then
7516             my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7517         fi
7518         for flag in $my_flags; do
7519             if test "$COM" = MSC; then
7520                 flag="-Xclang $flag"
7521             fi
7522             save_CXXFLAGS=$CXXFLAGS
7523             CXXFLAGS="$CXXFLAGS $flag -Werror"
7524             if test "$SYSTEM_LIBCMIS" = TRUE; then
7525                 CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7526             fi
7527             AC_LANG_PUSH([C++])
7528             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7529                 #include <algorithm>
7530                 #include <functional>
7531                 #include <vector>
7533                 #if defined SYSTEM_LIBCMIS
7534                 // See ucb/source/ucp/cmis/auth_provider.hxx:
7535                 #if !defined __clang__
7536                 #pragma GCC diagnostic push
7537                 #pragma GCC diagnostic ignored "-Wdeprecated"
7538                 #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7539                 #endif
7540                 #include <libcmis/libcmis.hxx>
7541                 #if !defined __clang__
7542                 #pragma GCC diagnostic pop
7543                 #endif
7544                 #endif
7546                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7547                     std::sort(v.begin(), v.end(), fn);
7548                 }
7549                 ]])],[CXXFLAGS_CXX11=$flag])
7550             AC_LANG_POP([C++])
7551             CXXFLAGS=$save_CXXFLAGS
7552             if test -n "$CXXFLAGS_CXX11"; then
7553                 break
7554             fi
7555         done
7556     fi
7557     if test -n "$CXXFLAGS_CXX11"; then
7558         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7559     else
7560         AC_MSG_ERROR(no)
7561     fi
7563 AC_SUBST(CXXFLAGS_CXX11)
7565 if test "$GCC" = "yes"; then
7566     save_CXXFLAGS=$CXXFLAGS
7567     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7568     CHECK_L_ATOMIC
7569     CXXFLAGS=$save_CXXFLAGS
7570     AC_SUBST(ATOMIC_LIB)
7573 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7574 save_CXXFLAGS=$CXXFLAGS
7575 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7576 AC_LANG_PUSH([C++])
7578 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7579 #include <stddef.h>
7581 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7583 namespace
7585         struct b
7586         {
7587                 int i;
7588                 int j;
7589         };
7591 ]], [[
7592 struct a
7594         int i;
7595         int j;
7597 a thinga[]={{0,0}, {1,1}};
7598 b thingb[]={{0,0}, {1,1}};
7599 size_t i = sizeof(sal_n_array_size(thinga));
7600 size_t j = sizeof(sal_n_array_size(thingb));
7601 return !(i != 0 && j != 0);
7603     ], [ AC_MSG_RESULT(yes) ],
7604     [ AC_MSG_ERROR(no)])
7605 AC_LANG_POP([C++])
7606 CXXFLAGS=$save_CXXFLAGS
7608 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7609 if test "$GCC" = yes; then
7610     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7611     AC_LANG_PUSH([C++])
7612     save_CXXFLAGS=$CXXFLAGS
7613     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7614     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7615     CXXFLAGS=$save_CXXFLAGS
7616     AC_LANG_POP([C++])
7617     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7618         AC_MSG_RESULT([yes])
7619     else
7620         AC_MSG_RESULT([no])
7621     fi
7623 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7625 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7626 AC_LANG_PUSH([C++])
7627 save_CXXFLAGS=$CXXFLAGS
7628 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7629 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7630         #include <algorithm>
7631         #include <initializer_list>
7632         #include <vector>
7633         template<typename T> class S {
7634         private:
7635             std::vector<T> v_;
7636         public:
7637             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7638         };
7639         constinit S<int> s{3, 2, 1};
7640     ])], [
7641         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7642         AC_MSG_RESULT([yes])
7643     ], [AC_MSG_RESULT([no])])
7644 CXXFLAGS=$save_CXXFLAGS
7645 AC_LANG_POP([C++])
7647 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7648 AC_LANG_PUSH([C++])
7649 save_CXXFLAGS=$CXXFLAGS
7650 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7651 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7652         #include <span>
7653         #include <type_traits>
7654         // Don't check size_type directly, as it was called index_type before P1872R0:
7655         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7656     ])], [
7657         AC_DEFINE([HAVE_CPP_SPAN],[1])
7658         AC_MSG_RESULT([yes])
7659     ], [AC_MSG_RESULT([no])])
7660 CXXFLAGS=$save_CXXFLAGS
7661 AC_LANG_POP([C++])
7663 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7664 AC_LANG_PUSH([C++])
7665 save_CXXFLAGS=$CXXFLAGS
7666 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7667 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7668         struct S1 { S1(S1 &&); };
7669         struct S2: S1 {};
7670         S1 f(S2 s) { return s; }
7671     ])], [
7672         AC_DEFINE([HAVE_P1155R3],[1])
7673         AC_MSG_RESULT([yes])
7674     ], [AC_MSG_RESULT([no])])
7675 CXXFLAGS=$save_CXXFLAGS
7676 AC_LANG_POP([C++])
7678 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7679 HAVE_CXX20_ATOMIC_REF=
7680 AC_LANG_PUSH([C++])
7681 save_CXXFLAGS=$CXXFLAGS
7682 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7683 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7684         #include <atomic>
7685         int x;
7686         std::atomic_ref<int> y(x);
7687     ])], [
7688         HAVE_CXX20_ATOMIC_REF=TRUE
7689         AC_MSG_RESULT([yes])
7690     ], [AC_MSG_RESULT([no])])
7691 CXXFLAGS=$save_CXXFLAGS
7692 AC_LANG_POP([C++])
7693 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7695 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7696 dnl which is included in -Wextra anyway):
7697 HAVE_WDEPRECATED_COPY_DTOR=
7698 if test "$GCC" = yes; then
7699     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7700     AC_LANG_PUSH([C++])
7701     save_CXXFLAGS=$CXXFLAGS
7702     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7703     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7704             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7705             AC_MSG_RESULT([yes])
7706         ], [AC_MSG_RESULT([no])])
7707     CXXFLAGS=$save_CXXFLAGS
7708     AC_LANG_POP([C++])
7710 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7712 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7713 dnl uninitialized warning for code like
7715 dnl   OString f();
7716 dnl   boost::optional<OString> * g(bool b) {
7717 dnl       boost::optional<OString> o;
7718 dnl       if (b) o = f();
7719 dnl       return new boost::optional<OString>(o);
7720 dnl   }
7722 dnl (as is e.g. present, in a slightly more elaborate form, in
7723 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7724 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7725 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7726 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7727     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7728     AC_LANG_PUSH([C++])
7729     save_CXXFLAGS=$CXXFLAGS
7730     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7731     if test "$ENABLE_OPTIMIZED" = TRUE; then
7732         CXXFLAGS="$CXXFLAGS -O2"
7733     else
7734         CXXFLAGS="$CXXFLAGS -O0"
7735     fi
7736     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7737             #include <new>
7738             void f1(int);
7739             struct S1 {
7740                 ~S1() { f1(n); }
7741                 int n = 0;
7742             };
7743             struct S2 {
7744                 S2() {}
7745                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7746                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7747                 void set(S1 s) {
7748                     new (stg) S1(s);
7749                     init = true;
7750                 }
7751                 bool init = false;
7752                 char stg[sizeof (S1)];
7753             } ;
7754             S1 f2();
7755             S2 * f3(bool b) {
7756                 S2 o;
7757                 if (b) o.set(f2());
7758                 return new S2(o);
7759             }
7760         ]])], [AC_MSG_RESULT([no])], [
7761             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7762             AC_MSG_RESULT([yes])
7763         ])
7764     CXXFLAGS=$save_CXXFLAGS
7765     AC_LANG_POP([C++])
7767 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7769 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7770 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7771 dnl hits us e.g. with GCC 10 and --enable-optimized at
7773 dnl   In file included from include/rtl/string.hxx:49,
7774 dnl                    from include/rtl/ustring.hxx:43,
7775 dnl                    from include/osl/file.hxx:35,
7776 dnl                    from include/codemaker/global.hxx:28,
7777 dnl                    from include/codemaker/options.hxx:23,
7778 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7779 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7780 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,
7781 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,
7782 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,
7783 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7784 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7785 dnl      78 |         memcpy( buffer, data, length );
7786 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7787 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7788 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7789     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7790     AC_LANG_PUSH([C++])
7791     save_CXXFLAGS=$CXXFLAGS
7792     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7793     if test "$ENABLE_OPTIMIZED" = TRUE; then
7794         CXXFLAGS="$CXXFLAGS -O2"
7795     else
7796         CXXFLAGS="$CXXFLAGS -O0"
7797     fi
7798     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7799     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7800             void fill(char const * begin, char const * end, char c);
7801             struct q {
7802                 char ids[4];
7803                 char username[6];
7804             };
7805             void test(q & c) {
7806                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7807                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7808             }
7809         ]])], [AC_MSG_RESULT([no])], [
7810             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7811             AC_MSG_RESULT([yes])
7812         ])
7813     CXXFLAGS=$save_CXXFLAGS
7814     AC_LANG_POP([C++])
7816 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7818 HAVE_DLLEXPORTINLINES=
7819 if test "$_os" = "WINNT"; then
7820     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7821     AC_LANG_PUSH([C++])
7822     save_CXXFLAGS=$CXXFLAGS
7823     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7824     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7825             HAVE_DLLEXPORTINLINES=TRUE
7826             AC_MSG_RESULT([yes])
7827         ], [AC_MSG_RESULT([no])])
7828     CXXFLAGS=$save_CXXFLAGS
7829     AC_LANG_POP([C++])
7831 AC_SUBST([HAVE_DLLEXPORTINLINES])
7833 dnl ===================================================================
7834 dnl CPU Intrinsics support - SSE, AVX
7835 dnl ===================================================================
7837 CXXFLAGS_INTRINSICS_SSE2=
7838 CXXFLAGS_INTRINSICS_SSSE3=
7839 CXXFLAGS_INTRINSICS_SSE41=
7840 CXXFLAGS_INTRINSICS_SSE42=
7841 CXXFLAGS_INTRINSICS_AVX=
7842 CXXFLAGS_INTRINSICS_AVX2=
7843 CXXFLAGS_INTRINSICS_AVX512=
7844 CXXFLAGS_INTRINSICS_AVX512F=
7845 CXXFLAGS_INTRINSICS_F16C=
7846 CXXFLAGS_INTRINSICS_FMA=
7848 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7849     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7850     flag_sse2=-msse2
7851     flag_ssse3=-mssse3
7852     flag_sse41=-msse4.1
7853     flag_sse42=-msse4.2
7854     flag_avx=-mavx
7855     flag_avx2=-mavx2
7856     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7857     flag_avx512f=-mavx512f
7858     flag_f16c=-mf16c
7859     flag_fma=-mfma
7860 else
7861     # With MSVC using -arch is in fact not necessary for being able
7862     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7863     # even if compiled with -arch:AVX, the -arch option really only affects
7864     # instructions generated for C/C++ code.
7865     # So use the matching same (or lower) -arch options, but only in order
7866     # to generate the best matching instructions for the C++ code surrounding
7867     # the intrinsics.
7868     # SSE2 is the default for x86/x64, so no need to specify the option.
7869     flag_sse2=
7870     # No specific options for these, use the next lower.
7871     flag_ssse3="$flag_sse2"
7872     flag_sse41="$flag_sse2"
7873     flag_sse42="$flag_sse2"
7874     flag_avx=-arch:AVX
7875     flag_avx2=-arch:AVX2
7876     flag_avx512=-arch:AVX512
7877     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7878     flag_avx512f=-arch:AVX2
7879     # No MSVC options for these.
7880     flag_f16c="$flag_sse2"
7881     flag_fma="$flag_sse2"
7884 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7885 AC_LANG_PUSH([C++])
7886 save_CXXFLAGS=$CXXFLAGS
7887 CXXFLAGS="$CXXFLAGS $flag_sse2"
7888 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7889     #include <emmintrin.h>
7890     int main () {
7891         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7892         c = _mm_xor_si128 (a, b);
7893         return 0;
7894     }
7895     ])],
7896     [can_compile_sse2=yes],
7897     [can_compile_sse2=no])
7898 AC_LANG_POP([C++])
7899 CXXFLAGS=$save_CXXFLAGS
7900 AC_MSG_RESULT([${can_compile_sse2}])
7901 if test "${can_compile_sse2}" = "yes" ; then
7902     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7905 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7906 AC_LANG_PUSH([C++])
7907 save_CXXFLAGS=$CXXFLAGS
7908 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7909 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7910     #include <tmmintrin.h>
7911     int main () {
7912         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7913         c = _mm_maddubs_epi16 (a, b);
7914         return 0;
7915     }
7916     ])],
7917     [can_compile_ssse3=yes],
7918     [can_compile_ssse3=no])
7919 AC_LANG_POP([C++])
7920 CXXFLAGS=$save_CXXFLAGS
7921 AC_MSG_RESULT([${can_compile_ssse3}])
7922 if test "${can_compile_ssse3}" = "yes" ; then
7923     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7926 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7927 AC_LANG_PUSH([C++])
7928 save_CXXFLAGS=$CXXFLAGS
7929 CXXFLAGS="$CXXFLAGS $flag_sse41"
7930 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7931     #include <smmintrin.h>
7932     int main () {
7933         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7934         c = _mm_cmpeq_epi64 (a, b);
7935         return 0;
7936     }
7937     ])],
7938     [can_compile_sse41=yes],
7939     [can_compile_sse41=no])
7940 AC_LANG_POP([C++])
7941 CXXFLAGS=$save_CXXFLAGS
7942 AC_MSG_RESULT([${can_compile_sse41}])
7943 if test "${can_compile_sse41}" = "yes" ; then
7944     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7947 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7948 AC_LANG_PUSH([C++])
7949 save_CXXFLAGS=$CXXFLAGS
7950 CXXFLAGS="$CXXFLAGS $flag_sse42"
7951 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7952     #include <nmmintrin.h>
7953     int main () {
7954         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7955         c = _mm_cmpgt_epi64 (a, b);
7956         return 0;
7957     }
7958     ])],
7959     [can_compile_sse42=yes],
7960     [can_compile_sse42=no])
7961 AC_LANG_POP([C++])
7962 CXXFLAGS=$save_CXXFLAGS
7963 AC_MSG_RESULT([${can_compile_sse42}])
7964 if test "${can_compile_sse42}" = "yes" ; then
7965     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7968 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7969 AC_LANG_PUSH([C++])
7970 save_CXXFLAGS=$CXXFLAGS
7971 CXXFLAGS="$CXXFLAGS $flag_avx"
7972 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7973     #include <immintrin.h>
7974     int main () {
7975         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7976         c = _mm256_xor_ps(a, b);
7977         return 0;
7978     }
7979     ])],
7980     [can_compile_avx=yes],
7981     [can_compile_avx=no])
7982 AC_LANG_POP([C++])
7983 CXXFLAGS=$save_CXXFLAGS
7984 AC_MSG_RESULT([${can_compile_avx}])
7985 if test "${can_compile_avx}" = "yes" ; then
7986     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7989 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7990 AC_LANG_PUSH([C++])
7991 save_CXXFLAGS=$CXXFLAGS
7992 CXXFLAGS="$CXXFLAGS $flag_avx2"
7993 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7994     #include <immintrin.h>
7995     int main () {
7996         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7997         c = _mm256_maddubs_epi16(a, b);
7998         return 0;
7999     }
8000     ])],
8001     [can_compile_avx2=yes],
8002     [can_compile_avx2=no])
8003 AC_LANG_POP([C++])
8004 CXXFLAGS=$save_CXXFLAGS
8005 AC_MSG_RESULT([${can_compile_avx2}])
8006 if test "${can_compile_avx2}" = "yes" ; then
8007     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8010 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8011 AC_LANG_PUSH([C++])
8012 save_CXXFLAGS=$CXXFLAGS
8013 CXXFLAGS="$CXXFLAGS $flag_avx512"
8014 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8015     #include <immintrin.h>
8016     int main () {
8017         __m512i a = _mm512_loadu_si512(0);
8018         __m512d v1 = _mm512_load_pd(0);
8019         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8020         __m512d v2 = _mm512_abs_pd(v1);
8021         return 0;
8022     }
8023     ])],
8024     [can_compile_avx512=yes],
8025     [can_compile_avx512=no])
8026 AC_LANG_POP([C++])
8027 CXXFLAGS=$save_CXXFLAGS
8028 AC_MSG_RESULT([${can_compile_avx512}])
8029 if test "${can_compile_avx512}" = "yes" ; then
8030     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8031     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8034 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8035 AC_LANG_PUSH([C++])
8036 save_CXXFLAGS=$CXXFLAGS
8037 CXXFLAGS="$CXXFLAGS $flag_f16c"
8038 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8039     #include <immintrin.h>
8040     int main () {
8041         __m128i a = _mm_set1_epi32 (0);
8042         __m128 c;
8043         c = _mm_cvtph_ps(a);
8044         return 0;
8045     }
8046     ])],
8047     [can_compile_f16c=yes],
8048     [can_compile_f16c=no])
8049 AC_LANG_POP([C++])
8050 CXXFLAGS=$save_CXXFLAGS
8051 AC_MSG_RESULT([${can_compile_f16c}])
8052 if test "${can_compile_f16c}" = "yes" ; then
8053     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8056 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8057 AC_LANG_PUSH([C++])
8058 save_CXXFLAGS=$CXXFLAGS
8059 CXXFLAGS="$CXXFLAGS $flag_fma"
8060 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8061     #include <immintrin.h>
8062     int main () {
8063         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8064         d = _mm256_fmadd_ps(a, b, c);
8065         return 0;
8066     }
8067     ])],
8068     [can_compile_fma=yes],
8069     [can_compile_fma=no])
8070 AC_LANG_POP([C++])
8071 CXXFLAGS=$save_CXXFLAGS
8072 AC_MSG_RESULT([${can_compile_fma}])
8073 if test "${can_compile_fma}" = "yes" ; then
8074     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8077 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8078 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8079 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8080 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8081 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8082 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8083 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8084 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8085 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8086 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8088 dnl ===================================================================
8089 dnl system stl sanity tests
8090 dnl ===================================================================
8091 if test "$_os" != "WINNT"; then
8093     AC_LANG_PUSH([C++])
8095     save_CPPFLAGS="$CPPFLAGS"
8096     if test -n "$MACOSX_SDK_PATH"; then
8097         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8098     fi
8100     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8101     # only.
8102     if test "$CPP_LIBRARY" = GLIBCXX; then
8103         dnl gcc#19664, gcc#22482, rhbz#162935
8104         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8105         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8106         AC_MSG_RESULT([$stlvisok])
8107         if test "$stlvisok" = "no"; then
8108             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8109         fi
8110     fi
8112     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8113     # when we don't make any dynamic libraries?
8114     if test "$DISABLE_DYNLOADING" = ""; then
8115         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8116         cat > conftestlib1.cc <<_ACEOF
8117 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8118 struct S2: S1<int> { virtual ~S2(); };
8119 S2::~S2() {}
8120 _ACEOF
8121         cat > conftestlib2.cc <<_ACEOF
8122 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8123 struct S2: S1<int> { virtual ~S2(); };
8124 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8125 _ACEOF
8126         gccvisinlineshiddenok=yes
8127         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8128             gccvisinlineshiddenok=no
8129         else
8130             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8131             dnl known to not work with -z defs (unsetting which makes the test
8132             dnl moot, though):
8133             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8134             if test "$COM_IS_CLANG" = TRUE; then
8135                 for i in $CXX $CXXFLAGS; do
8136                     case $i in
8137                     -fsanitize=*)
8138                         my_linkflagsnoundefs=
8139                         break
8140                         ;;
8141                     esac
8142                 done
8143             fi
8144             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8145                 gccvisinlineshiddenok=no
8146             fi
8147         fi
8149         rm -fr libconftest*
8150         AC_MSG_RESULT([$gccvisinlineshiddenok])
8151         if test "$gccvisinlineshiddenok" = "no"; then
8152             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8153         fi
8154     fi
8156    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8157     cat >visibility.cxx <<_ACEOF
8158 #pragma GCC visibility push(hidden)
8159 struct __attribute__ ((visibility ("default"))) TestStruct {
8160   static void Init();
8162 __attribute__ ((visibility ("default"))) void TestFunc() {
8163   TestStruct::Init();
8165 _ACEOF
8166     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8167         gccvisbroken=yes
8168     else
8169         case "$host_cpu" in
8170         i?86|x86_64)
8171             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8172                 gccvisbroken=no
8173             else
8174                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8175                     gccvisbroken=no
8176                 else
8177                     gccvisbroken=yes
8178                 fi
8179             fi
8180             ;;
8181         *)
8182             gccvisbroken=no
8183             ;;
8184         esac
8185     fi
8186     rm -f visibility.s visibility.cxx
8188     AC_MSG_RESULT([$gccvisbroken])
8189     if test "$gccvisbroken" = "yes"; then
8190         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8191     fi
8193     CPPFLAGS="$save_CPPFLAGS"
8195     AC_MSG_CHECKING([if CET endbranch is recognized])
8196 cat > endbr.s <<_ACEOF
8197 endbr32
8198 _ACEOF
8199     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8200     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8201         AC_MSG_RESULT([yes])
8202         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8203     else
8204         AC_MSG_RESULT([no])
8205     fi
8206     rm -f endbr.s endbr.o
8207     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8209     AC_LANG_POP([C++])
8212 dnl ===================================================================
8213 dnl  Clang++ tests
8214 dnl ===================================================================
8216 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8217 if test "$GCC" = "yes"; then
8218     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8219     AC_LANG_PUSH([C++])
8220     save_CXXFLAGS=$CXXFLAGS
8221     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8222     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8223     CXXFLAGS=$save_CXXFLAGS
8224     AC_LANG_POP([C++])
8225     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8226         AC_MSG_RESULT([yes])
8227     else
8228         AC_MSG_RESULT([no])
8229     fi
8231 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8233 dnl ===================================================================
8234 dnl Compiler plugins
8235 dnl ===================================================================
8237 COMPILER_PLUGINS=
8238 # currently only Clang
8240 if test "$COM_IS_CLANG" != "TRUE"; then
8241     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8242         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8243         enable_compiler_plugins=no
8244     fi
8247 COMPILER_PLUGINS_COM_IS_CLANG=
8248 if test "$COM_IS_CLANG" = "TRUE"; then
8249     if test -n "$enable_compiler_plugins"; then
8250         compiler_plugins="$enable_compiler_plugins"
8251     elif test -n "$ENABLE_DBGUTIL"; then
8252         compiler_plugins=test
8253     else
8254         compiler_plugins=no
8255     fi
8256     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8257         if test "$CLANGVER" -lt 120001; then
8258             if test "$compiler_plugins" = yes; then
8259                 AC_MSG_ERROR(
8260                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8261             else
8262                 compiler_plugins=no
8263             fi
8264         fi
8265     fi
8266     if test "$compiler_plugins" != "no"; then
8267         dnl The prefix where Clang resides, override to where Clang resides if
8268         dnl using a source build:
8269         if test -z "$CLANGDIR"; then
8270             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8271         fi
8272         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8273         if test -z "$COMPILER_PLUGINS_CXX"; then
8274             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8275         fi
8276         clangbindir=$CLANGDIR/bin
8277         if test "$build_os" = "cygwin"; then
8278             clangbindir=$(cygpath -u "$clangbindir")
8279         fi
8280         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8281         if test -n "$LLVM_CONFIG"; then
8282             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8283             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8284             if test -z "$CLANGLIBDIR"; then
8285                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8286             fi
8287             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8288             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8289             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8290                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8291                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8292                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8293                 fi
8294             fi
8295             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8296             clangobjdir=$($LLVM_CONFIG --obj-root)
8297             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8298                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8299             fi
8300         fi
8301         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8302         AC_LANG_PUSH([C++])
8303         save_CXX=$CXX
8304         save_CXXCPP=$CXXCPP
8305         save_CPPFLAGS=$CPPFLAGS
8306         save_CXXFLAGS=$CXXFLAGS
8307         save_LDFLAGS=$LDFLAGS
8308         save_LIBS=$LIBS
8309         CXX=$COMPILER_PLUGINS_CXX
8310         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8311         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8312         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8313         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8314             [COMPILER_PLUGINS=TRUE],
8315             [
8316             if test "$compiler_plugins" = "yes"; then
8317                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8318             else
8319                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8320                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8321             fi
8322             ])
8323         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8324         dnl comment in compilerplugins/Makefile-clang.mk:
8325         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8326             LDFLAGS=""
8327             AC_MSG_CHECKING([for clang libraries to use])
8328             if test -z "$CLANGTOOLLIBS"; then
8329                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8330                 AC_LINK_IFELSE([
8331                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8332                         [[ clang::FullSourceLoc().dump(); ]])
8333                 ],[CLANGTOOLLIBS="$LIBS"],[])
8334             fi
8335             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8336             dnl list of individual -lclang* (but note that that list can become outdated over time,
8337             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8338             dnl needs to include -lclangSupport now"):
8339             if test -z "$CLANGTOOLLIBS"; then
8340                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8341  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8342                 AC_LINK_IFELSE([
8343                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8344                         [[ clang::FullSourceLoc().dump(); ]])
8345                 ],[CLANGTOOLLIBS="$LIBS"],[])
8346             fi
8347             AC_MSG_RESULT([$CLANGTOOLLIBS])
8348             if test -z "$CLANGTOOLLIBS"; then
8349                 if test "$compiler_plugins" = "yes"; then
8350                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8351                 else
8352                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8353                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8354                 fi
8355                 COMPILER_PLUGINS=
8356             fi
8357             if test -n "$COMPILER_PLUGINS"; then
8358                 if test -z "$CLANGSYSINCLUDE"; then
8359                     if test -n "$LLVM_CONFIG"; then
8360                         # Path to the clang system headers (no idea if there's a better way to get it).
8361                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8362                     fi
8363                 fi
8364             fi
8365         fi
8366         CXX=$save_CXX
8367         CXXCPP=$save_CXXCPP
8368         CPPFLAGS=$save_CPPFLAGS
8369         CXXFLAGS=$save_CXXFLAGS
8370         LDFLAGS=$save_LDFLAGS
8371         LIBS="$save_LIBS"
8372         AC_LANG_POP([C++])
8374         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8375         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8376             #ifndef __clang__
8377             you lose
8378             #endif
8379             int foo=42;
8380             ]])],
8381             [AC_MSG_RESULT([yes])
8382              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8383             [AC_MSG_RESULT([no])])
8384         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8385     fi
8386 else
8387     if test "$enable_compiler_plugins" = "yes"; then
8388         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8389     fi
8391 COMPILER_PLUGINS_ANALYZER_PCH=
8392 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8393     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8395 AC_SUBST(COMPILER_PLUGINS)
8396 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8397 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8398 AC_SUBST(COMPILER_PLUGINS_CXX)
8399 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8400 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8401 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8402 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8403 AC_SUBST(CLANGDIR)
8404 AC_SUBST(CLANGLIBDIR)
8405 AC_SUBST(CLANGTOOLLIBS)
8406 AC_SUBST(CLANGSYSINCLUDE)
8408 # Plugin to help linker.
8409 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8410 # This makes --enable-lto build with clang work.
8411 AC_SUBST(LD_PLUGIN)
8413 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8414 AC_SUBST(HAVE_POSIX_FALLOCATE)
8416 JITC_PROCESSOR_TYPE=""
8417 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8418     # IBMs JDK needs this...
8419     JITC_PROCESSOR_TYPE=6
8420     export JITC_PROCESSOR_TYPE
8422 AC_SUBST([JITC_PROCESSOR_TYPE])
8424 # Misc Windows Stuff
8425 AC_ARG_WITH(ucrt-dir,
8426     AS_HELP_STRING([--with-ucrt-dir],
8427         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8428         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8429         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8430             Windows6.1-KB2999226-x64.msu
8431             Windows6.1-KB2999226-x86.msu
8432             Windows8.1-KB2999226-x64.msu
8433             Windows8.1-KB2999226-x86.msu
8434             Windows8-RT-KB2999226-x64.msu
8435             Windows8-RT-KB2999226-x86.msu
8436         A zip archive including those files is available from Microsoft site:
8437         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8440 UCRT_REDISTDIR="$with_ucrt_dir"
8441 if test $_os = "WINNT"; then
8442     find_msvc_x64_dlls
8443     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8444     MSVC_DLLS="$msvcdlls"
8445     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8446         with_redist=143
8447     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8448         with_redist=142
8449     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8450         with_redist=141
8451     fi
8452     for i in $PKGFORMAT; do
8453         if test "$i" = msi; then
8454             find_msms "$with_redist"
8455             if test -n "$msmdir"; then
8456                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8457                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8458             fi
8459             break
8460         fi
8461     done
8463     if test "$UCRT_REDISTDIR" = "no"; then
8464         dnl explicitly disabled
8465         UCRT_REDISTDIR=""
8466     else
8467         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8468                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8469                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8470                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8471                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8472                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8473             UCRT_REDISTDIR=""
8474             if test -n "$PKGFORMAT"; then
8475                for i in $PKGFORMAT; do
8476                    case "$i" in
8477                    msi)
8478                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8479                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8480                        ;;
8481                    esac
8482                done
8483             fi
8484         fi
8485     fi
8488 AC_SUBST(UCRT_REDISTDIR)
8489 AC_SUBST(MSVC_DLL_PATH)
8490 AC_SUBST(MSVC_DLLS)
8491 AC_SUBST(MSM_PATH)
8494 dnl ===================================================================
8495 dnl Checks for Java
8496 dnl ===================================================================
8497 if test "$ENABLE_JAVA" != ""; then
8499     # Windows-specific tests
8500     if test "$build_os" = "cygwin"; then
8501         if test -z "$with_jdk_home"; then
8502             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8503             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8504             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8505             if test -n "$regvalue"; then
8506                 ver=$regvalue
8507                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8508                 with_jdk_home=$regvalue
8509             fi
8510             howfound="found automatically"
8511         else
8512             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8513             howfound="you passed"
8514         fi
8516         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8517             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])
8518         fi
8519     fi
8521     # 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.
8522     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8523     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8524         with_jdk_home=`/usr/libexec/java_home`
8525     fi
8527     JAVA_HOME=; export JAVA_HOME
8528     if test -z "$with_jdk_home"; then
8529         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8530     else
8531         _java_path="$with_jdk_home/bin/$with_java"
8532         dnl Check if there is a Java interpreter at all.
8533         if test -x "$_java_path"; then
8534             JAVAINTERPRETER=$_java_path
8535         else
8536             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8537         fi
8538     fi
8540     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8541     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8542     dnl loaded by java to run JunitTests:
8543     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8544         shortjdkhome=`cygpath -d "$with_jdk_home"`
8545         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
8546             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8547             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8548         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
8549             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8550             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8551         fi
8553         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8554             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8555         fi
8556         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8557     elif test "$cross_compiling" != "yes"; then
8558         case $CPUNAME in
8559             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8560                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8561                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8562                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8563                 fi
8564                 ;;
8565             *) # assumption: everything else 32-bit
8566                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8567                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8568                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8569                 fi
8570                 ;;
8571         esac
8572     fi
8575 dnl ===================================================================
8576 dnl Checks for JDK.
8577 dnl ===================================================================
8579 # Whether all the complexity here actually is needed any more or not, no idea.
8581 JDK_SECURITYMANAGER_DISALLOWED=
8582 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8583     _gij_longver=0
8584     AC_MSG_CHECKING([the installed JDK])
8585     if test -n "$JAVAINTERPRETER"; then
8586         dnl java -version sends output to stderr!
8587         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8588             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8589         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8590             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8591         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8592             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8593         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8594             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8595         else
8596             JDK=sun
8598             dnl Sun JDK specific tests
8599             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8600             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8602             if test "$_jdk_ver" -lt 10900; then
8603                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8604             fi
8605             if test "$_jdk_ver" -gt 10900; then
8606                 JAVA_CLASSPATH_NOT_SET=TRUE
8607             fi
8608             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8609             dnl completely removed in some Java version > 18 (see
8610             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8611             if test "$_jdk_ver" -ge 180000; then
8612                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8613             fi
8615             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8616             if test "$_os" = "WINNT"; then
8617                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8618             fi
8619             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8621             # set to limit VM usage for JunitTests
8622             JAVAIFLAGS=-Xmx64M
8623             # set to limit VM usage for javac
8624             JAVACFLAGS=-J-Xmx128M
8625         fi
8626     else
8627         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8628     fi
8629 else
8630     if test -z "$ENABLE_JAVA"; then
8631         dnl Java disabled
8632         JAVA_HOME=
8633         export JAVA_HOME
8634     elif test "$cross_compiling" = "yes"; then
8635         # Just assume compatibility of build and host JDK
8636         JDK=$JDK_FOR_BUILD
8637         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8638     fi
8641 dnl ===================================================================
8642 dnl Checks for javac
8643 dnl ===================================================================
8644 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8645     javacompiler="javac"
8646     : ${JAVA_SOURCE_VER=8}
8647     : ${JAVA_TARGET_VER=8}
8648     if test -z "$with_jdk_home"; then
8649         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8650     else
8651         _javac_path="$with_jdk_home/bin/$javacompiler"
8652         dnl Check if there is a Java compiler at all.
8653         if test -x "$_javac_path"; then
8654             JAVACOMPILER=$_javac_path
8655         fi
8656     fi
8657     if test -z "$JAVACOMPILER"; then
8658         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8659     fi
8660     if test "$build_os" = "cygwin"; then
8661         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8662             JAVACOMPILER="${JAVACOMPILER}.exe"
8663         fi
8664         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8665     fi
8668 dnl ===================================================================
8669 dnl Checks for javadoc
8670 dnl ===================================================================
8671 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8672     if test -z "$with_jdk_home"; then
8673         AC_PATH_PROG(JAVADOC, javadoc)
8674     else
8675         _javadoc_path="$with_jdk_home/bin/javadoc"
8676         dnl Check if there is a javadoc at all.
8677         if test -x "$_javadoc_path"; then
8678             JAVADOC=$_javadoc_path
8679         else
8680             AC_PATH_PROG(JAVADOC, javadoc)
8681         fi
8682     fi
8683     if test -z "$JAVADOC"; then
8684         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8685     fi
8686     if test "$build_os" = "cygwin"; then
8687         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8688             JAVADOC="${JAVADOC}.exe"
8689         fi
8690         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8691     fi
8693     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8694     JAVADOCISGJDOC="yes"
8695     fi
8697 AC_SUBST(JAVADOC)
8698 AC_SUBST(JAVADOCISGJDOC)
8700 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8701     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8702     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8703         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8704            # try to recover first by looking whether we have an alternative
8705            # system as in Debian or newer SuSEs where following /usr/bin/javac
8706            # over /etc/alternatives/javac leads to the right bindir where we
8707            # just need to strip a bit away to get a valid JAVA_HOME
8708            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8709         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8710             # maybe only one level of symlink (e.g. on Mac)
8711             JAVA_HOME=$(readlink $JAVACOMPILER)
8712             if test "$(dirname $JAVA_HOME)" = "."; then
8713                 # we've got no path to trim back
8714                 JAVA_HOME=""
8715             fi
8716         else
8717             # else warn
8718             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8719             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8720             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8721             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8722         fi
8723         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8724         if test "$JAVA_HOME" != "/usr"; then
8725             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8726                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8727                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8728                 dnl Tiger already returns a JDK path...
8729                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8730             else
8731                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8732                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8733                 dnl that checks which version to run
8734                 if test -f "$JAVA_HOME"; then
8735                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8736                 fi
8737             fi
8738         fi
8739     fi
8740     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8742     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8743     if test -z "$JAVA_HOME"; then
8744         if test "x$with_jdk_home" = "x"; then
8745             cat > findhome.java <<_ACEOF
8746 [import java.io.File;
8748 class findhome
8750     public static void main(String args[])
8751     {
8752         String jrelocation = System.getProperty("java.home");
8753         File jre = new File(jrelocation);
8754         System.out.println(jre.getParent());
8755     }
8757 _ACEOF
8758             AC_MSG_CHECKING([if javac works])
8759             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8760             AC_TRY_EVAL(javac_cmd)
8761             if test $? = 0 -a -f ./findhome.class; then
8762                 AC_MSG_RESULT([javac works])
8763             else
8764                 echo "configure: javac test failed" >&5
8765                 cat findhome.java >&5
8766                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8767             fi
8768             AC_MSG_CHECKING([if gij knows its java.home])
8769             JAVA_HOME=`$JAVAINTERPRETER findhome`
8770             if test $? = 0 -a "$JAVA_HOME" != ""; then
8771                 AC_MSG_RESULT([$JAVA_HOME])
8772             else
8773                 echo "configure: java test failed" >&5
8774                 cat findhome.java >&5
8775                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8776             fi
8777             # clean-up after ourselves
8778             rm -f ./findhome.java ./findhome.class
8779         else
8780             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8781         fi
8782     fi
8784     # now check if $JAVA_HOME is really valid
8785     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8786         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8787             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8788             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8789             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8790             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8791             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8792             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8793         fi
8794     fi
8795     PathFormat "$JAVA_HOME"
8796     JAVA_HOME="$formatted_path"
8799 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8800     "$_os" != Darwin
8801 then
8802     AC_MSG_CHECKING([for JAWT lib])
8803     if test "$_os" = WINNT; then
8804         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8805         JAWTLIB=jawt.lib
8806     else
8807         case "$host_cpu" in
8808         arm*)
8809             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8810             JAVA_ARCH=$my_java_arch
8811             ;;
8812         i*86)
8813             my_java_arch=i386
8814             ;;
8815         m68k)
8816             my_java_arch=m68k
8817             ;;
8818         powerpc)
8819             my_java_arch=ppc
8820             ;;
8821         powerpc64)
8822             my_java_arch=ppc64
8823             ;;
8824         powerpc64le)
8825             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8826             JAVA_ARCH=$my_java_arch
8827             ;;
8828         sparc64)
8829             my_java_arch=sparcv9
8830             ;;
8831         x86_64)
8832             my_java_arch=amd64
8833             ;;
8834         *)
8835             my_java_arch=$host_cpu
8836             ;;
8837         esac
8838         # This is where JDK9 puts the library
8839         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8840             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8841         else
8842             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8843         fi
8844         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8845     fi
8846     AC_MSG_RESULT([$JAWTLIB])
8848 AC_SUBST(JAWTLIB)
8850 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8851     case "$host_os" in
8853     cygwin*|wsl*)
8854         JAVAINC="-I$JAVA_HOME/include/win32"
8855         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8856         ;;
8858     darwin*)
8859         if test -d "$JAVA_HOME/include/darwin"; then
8860             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8861         else
8862             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8863         fi
8864         ;;
8866     dragonfly*)
8867         JAVAINC="-I$JAVA_HOME/include"
8868         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8869         ;;
8871     freebsd*)
8872         JAVAINC="-I$JAVA_HOME/include"
8873         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8874         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8875         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8876         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8877         ;;
8879     k*bsd*-gnu*)
8880         JAVAINC="-I$JAVA_HOME/include"
8881         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8882         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8883         ;;
8885     linux-gnu*)
8886         JAVAINC="-I$JAVA_HOME/include"
8887         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8888         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8889         ;;
8891     *netbsd*)
8892         JAVAINC="-I$JAVA_HOME/include"
8893         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8894         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8895        ;;
8897     openbsd*)
8898         JAVAINC="-I$JAVA_HOME/include"
8899         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8900         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8901         ;;
8903     solaris*)
8904         JAVAINC="-I$JAVA_HOME/include"
8905         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8906         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8907         ;;
8908     esac
8910 SOLARINC="$SOLARINC $JAVAINC"
8912 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8913     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8914     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8915     JDK_FOR_BUILD=$JDK
8916     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
8919 AC_SUBST(JAVACFLAGS)
8920 AC_SUBST(JAVACOMPILER)
8921 AC_SUBST(JAVAINTERPRETER)
8922 AC_SUBST(JAVAIFLAGS)
8923 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8924 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8925 AC_SUBST(JAVA_HOME)
8926 AC_SUBST(JAVA_HOME_FOR_BUILD)
8927 AC_SUBST(JDK)
8928 AC_SUBST(JDK_FOR_BUILD)
8929 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
8930 AC_SUBST(JAVA_SOURCE_VER)
8931 AC_SUBST(JAVA_TARGET_VER)
8934 dnl ===================================================================
8935 dnl Export file validation
8936 dnl ===================================================================
8937 AC_MSG_CHECKING([whether to enable export file validation])
8938 if test "$with_export_validation" != "no"; then
8939     if test -z "$ENABLE_JAVA"; then
8940         if test "$with_export_validation" = "yes"; then
8941             AC_MSG_ERROR([requested, but Java is disabled])
8942         else
8943             AC_MSG_RESULT([no, as Java is disabled])
8944         fi
8945     elif ! test -d "${SRC_ROOT}/schema"; then
8946         if test "$with_export_validation" = "yes"; then
8947             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8948         else
8949             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8950         fi
8951     else
8952         AC_MSG_RESULT([yes])
8953         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8955         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8956         if test -z "$ODFVALIDATOR"; then
8957             # remember to download the ODF toolkit with validator later
8958             AC_MSG_NOTICE([no odfvalidator found, will download it])
8959             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8960             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8962             # and fetch name of odfvalidator jar name from download.lst
8963             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8964             AC_SUBST(ODFVALIDATOR_JAR)
8966             if test -z "$ODFVALIDATOR_JAR"; then
8967                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8968             fi
8969         fi
8970         if test "$build_os" = "cygwin"; then
8971             # In case of Cygwin it will be executed from Windows,
8972             # so we need to run bash and absolute path to validator
8973             # so instead of "odfvalidator" it will be
8974             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8975             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8976         else
8977             ODFVALIDATOR="sh $ODFVALIDATOR"
8978         fi
8979         AC_SUBST(ODFVALIDATOR)
8982         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8983         if test -z "$OFFICEOTRON"; then
8984             # remember to download the officeotron with validator later
8985             AC_MSG_NOTICE([no officeotron found, will download it])
8986             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8987             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8989             # and fetch name of officeotron jar name from download.lst
8990             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8991             AC_SUBST(OFFICEOTRON_JAR)
8993             if test -z "$OFFICEOTRON_JAR"; then
8994                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8995             fi
8996         else
8997             # check version of existing officeotron
8998             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8999             if test 0"$OFFICEOTRON_VER" -lt 704; then
9000                 AC_MSG_ERROR([officeotron too old])
9001             fi
9002         fi
9003         if test "$build_os" = "cygwin"; then
9004             # In case of Cygwin it will be executed from Windows,
9005             # so we need to run bash and absolute path to validator
9006             # so instead of "odfvalidator" it will be
9007             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9008             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9009         else
9010             OFFICEOTRON="sh $OFFICEOTRON"
9011         fi
9012     fi
9013     AC_SUBST(OFFICEOTRON)
9014 else
9015     AC_MSG_RESULT([no])
9018 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9019 if test "$with_bffvalidator" != "no"; then
9020     AC_DEFINE(HAVE_BFFVALIDATOR)
9022     if test "$with_export_validation" = "no"; then
9023         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9024     fi
9026     if test "$with_bffvalidator" = "yes"; then
9027         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9028     else
9029         BFFVALIDATOR="$with_bffvalidator"
9030     fi
9032     if test "$build_os" = "cygwin"; then
9033         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9034             AC_MSG_RESULT($BFFVALIDATOR)
9035         else
9036             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9037         fi
9038     elif test -n "$BFFVALIDATOR"; then
9039         # We are not in Cygwin but need to run Windows binary with wine
9040         AC_PATH_PROGS(WINE, wine)
9042         # so swap in a shell wrapper that converts paths transparently
9043         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9044         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9045         AC_SUBST(BFFVALIDATOR_EXE)
9046         AC_MSG_RESULT($BFFVALIDATOR)
9047     else
9048         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9049     fi
9050     AC_SUBST(BFFVALIDATOR)
9051 else
9052     AC_MSG_RESULT([no])
9055 dnl ===================================================================
9056 dnl Check for epm (not needed for Windows)
9057 dnl ===================================================================
9058 AC_MSG_CHECKING([whether to enable EPM for packing])
9059 if test "$enable_epm" = "yes"; then
9060     AC_MSG_RESULT([yes])
9061     if test "$_os" != "WINNT"; then
9062         if test $_os = Darwin; then
9063             EPM=internal
9064         elif test -n "$with_epm"; then
9065             EPM=$with_epm
9066         else
9067             AC_PATH_PROG(EPM, epm, no)
9068         fi
9069         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9070             AC_MSG_NOTICE([EPM will be built.])
9071             BUILD_TYPE="$BUILD_TYPE EPM"
9072             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9073         else
9074             # Gentoo has some epm which is something different...
9075             AC_MSG_CHECKING([whether the found epm is the right epm])
9076             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9077                 AC_MSG_RESULT([yes])
9078             else
9079                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9080             fi
9081             AC_MSG_CHECKING([epm version])
9082             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9083             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9084                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9085                 AC_MSG_RESULT([OK, >= 3.7])
9086             else
9087                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9088                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9089             fi
9090         fi
9091     fi
9093     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9094         AC_MSG_CHECKING([for rpm])
9095         for a in "$RPM" rpmbuild rpm; do
9096             $a --usage >/dev/null 2> /dev/null
9097             if test $? -eq 0; then
9098                 RPM=$a
9099                 break
9100             else
9101                 $a --version >/dev/null 2> /dev/null
9102                 if test $? -eq 0; then
9103                     RPM=$a
9104                     break
9105                 fi
9106             fi
9107         done
9108         if test -z "$RPM"; then
9109             AC_MSG_ERROR([not found])
9110         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9111             RPM_PATH=`which $RPM`
9112             AC_MSG_RESULT([$RPM_PATH])
9113             SCPDEFS="$SCPDEFS -DWITH_RPM"
9114         else
9115             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9116         fi
9117     fi
9118     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9119         AC_PATH_PROG(DPKG, dpkg, no)
9120         if test "$DPKG" = "no"; then
9121             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9122         fi
9123     fi
9124     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9125        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9126         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9127             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9128                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9129                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9130                     AC_MSG_RESULT([yes])
9131                 else
9132                     AC_MSG_RESULT([no])
9133                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9134                         _pt="rpm"
9135                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9136                         add_warning "the rpms will need to be installed with --nodeps"
9137                     else
9138                         _pt="pkg"
9139                     fi
9140                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9141                     add_warning "the ${_pt}s will not be relocatable"
9142                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9143                                  relocation will work, you need to patch your epm with the
9144                                  patch in epm/epm-3.7.patch or build with
9145                                  --with-epm=internal which will build a suitable epm])
9146                 fi
9147             fi
9148         fi
9149     fi
9150     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9151         AC_PATH_PROG(PKGMK, pkgmk, no)
9152         if test "$PKGMK" = "no"; then
9153             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9154         fi
9155     fi
9156     AC_SUBST(RPM)
9157     AC_SUBST(DPKG)
9158     AC_SUBST(PKGMK)
9159 else
9160     for i in $PKGFORMAT; do
9161         case "$i" in
9162         bsd | deb | pkg | rpm | native | portable)
9163             AC_MSG_ERROR(
9164                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9165             ;;
9166         esac
9167     done
9168     AC_MSG_RESULT([no])
9169     EPM=NO
9171 AC_SUBST(EPM)
9173 ENABLE_LWP=
9174 if test "$enable_lotuswordpro" = "yes"; then
9175     ENABLE_LWP="TRUE"
9177 AC_SUBST(ENABLE_LWP)
9179 dnl ===================================================================
9180 dnl Check for building ODK
9181 dnl ===================================================================
9182 AC_MSG_CHECKING([whether to build the ODK])
9183 if test "$enable_odk" = yes; then
9184     if test "$DISABLE_DYNLOADING" = TRUE; then
9185         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9186     fi
9187     AC_MSG_RESULT([yes])
9188     BUILD_TYPE="$BUILD_TYPE ODK"
9189 else
9190     AC_MSG_RESULT([no])
9193 if test "$enable_odk" != yes; then
9194     unset DOXYGEN
9195 else
9196     if test "$with_doxygen" = no; then
9197         AC_MSG_CHECKING([for doxygen])
9198         unset DOXYGEN
9199         AC_MSG_RESULT([no])
9200     else
9201         if test "$with_doxygen" = yes; then
9202             AC_PATH_PROG([DOXYGEN], [doxygen])
9203             if test -z "$DOXYGEN"; then
9204                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9205             fi
9206             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9207                 if ! dot -V 2>/dev/null; then
9208                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9209                 fi
9210             fi
9211         else
9212             AC_MSG_CHECKING([for doxygen])
9213             DOXYGEN=$with_doxygen
9214             AC_MSG_RESULT([$DOXYGEN])
9215         fi
9216         if test -n "$DOXYGEN"; then
9217             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9218             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9219             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9220                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9221             fi
9222         fi
9223     fi
9225 AC_SUBST([DOXYGEN])
9227 dnl ==================================================================
9228 dnl libfuzzer
9229 dnl ==================================================================
9230 AC_MSG_CHECKING([whether to enable fuzzers])
9231 if test "$enable_fuzzers" != yes; then
9232     AC_MSG_RESULT([no])
9233 else
9234     if test -z $LIB_FUZZING_ENGINE; then
9235       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9236     fi
9237     AC_MSG_RESULT([yes])
9238     ENABLE_FUZZERS="TRUE"
9239     AC_DEFINE([ENABLE_FUZZERS],1)
9240     AC_DEFINE([VCL_FLOAT_DEVICE_PIXEL],1)
9241     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9243 AC_SUBST(LIB_FUZZING_ENGINE)
9245 dnl ===================================================================
9246 dnl Check for system zlib
9247 dnl ===================================================================
9248 if test "$with_system_zlib" = "auto"; then
9249     case "$_os" in
9250     WINNT)
9251         with_system_zlib="$with_system_libs"
9252         ;;
9253     *)
9254         if test "$enable_fuzzers" != "yes"; then
9255             with_system_zlib=yes
9256         else
9257             with_system_zlib=no
9258         fi
9259         ;;
9260     esac
9263 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9264 dnl and has no pkg-config for it at least on some tinderboxes,
9265 dnl so leaving that out for now
9266 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9267 AC_MSG_CHECKING([which zlib to use])
9268 if test "$with_system_zlib" = "yes"; then
9269     AC_MSG_RESULT([external])
9270     SYSTEM_ZLIB=TRUE
9271     AC_CHECK_HEADER(zlib.h, [],
9272         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9273     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9274         [AC_MSG_ERROR(zlib not found or functional)], [])
9275 else
9276     AC_MSG_RESULT([internal])
9277     SYSTEM_ZLIB=
9278     BUILD_TYPE="$BUILD_TYPE ZLIB"
9279     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9280     if test "$COM" = "MSC"; then
9281         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9282     else
9283         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9284     fi
9286 AC_SUBST(ZLIB_CFLAGS)
9287 AC_SUBST(ZLIB_LIBS)
9288 AC_SUBST(SYSTEM_ZLIB)
9290 dnl ===================================================================
9291 dnl Check for system jpeg
9292 dnl ===================================================================
9293 AC_MSG_CHECKING([which libjpeg to use])
9294 if test "$with_system_jpeg" = "yes"; then
9295     AC_MSG_RESULT([external])
9296     SYSTEM_LIBJPEG=TRUE
9297     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9298         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9299     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9300         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9301 else
9302     SYSTEM_LIBJPEG=
9303     AC_MSG_RESULT([internal, libjpeg-turbo])
9304     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9306     case "$host_cpu" in
9307     x86_64 | amd64 | i*86 | x86 | ia32)
9308         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9309         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9310             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9311                 NASM="$LODE_HOME/opt/bin/nasm"
9312             elif test -x "/opt/lo/bin/nasm"; then
9313                 NASM="/opt/lo/bin/nasm"
9314             fi
9315         fi
9317         if test -n "$NASM"; then
9318             AC_MSG_CHECKING([for object file format of host system])
9319             case "$host_os" in
9320               cygwin* | mingw* | pw32* | wsl*)
9321                 case "$host_cpu" in
9322                   x86_64)
9323                     objfmt='Win64-COFF'
9324                     ;;
9325                   *)
9326                     objfmt='Win32-COFF'
9327                     ;;
9328                 esac
9329               ;;
9330               msdosdjgpp* | go32*)
9331                 objfmt='COFF'
9332               ;;
9333               os2-emx*) # not tested
9334                 objfmt='MSOMF' # obj
9335               ;;
9336               linux*coff* | linux*oldld*)
9337                 objfmt='COFF' # ???
9338               ;;
9339               linux*aout*)
9340                 objfmt='a.out'
9341               ;;
9342               linux*)
9343                 case "$host_cpu" in
9344                   x86_64)
9345                     objfmt='ELF64'
9346                     ;;
9347                   *)
9348                     objfmt='ELF'
9349                     ;;
9350                 esac
9351               ;;
9352               kfreebsd* | freebsd* | netbsd* | openbsd*)
9353                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9354                   objfmt='BSD-a.out'
9355                 else
9356                   case "$host_cpu" in
9357                     x86_64 | amd64)
9358                       objfmt='ELF64'
9359                       ;;
9360                     *)
9361                       objfmt='ELF'
9362                       ;;
9363                   esac
9364                 fi
9365               ;;
9366               solaris* | sunos* | sysv* | sco*)
9367                 case "$host_cpu" in
9368                   x86_64)
9369                     objfmt='ELF64'
9370                     ;;
9371                   *)
9372                     objfmt='ELF'
9373                     ;;
9374                 esac
9375               ;;
9376               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9377                 case "$host_cpu" in
9378                   x86_64)
9379                     objfmt='Mach-O64'
9380                     ;;
9381                   *)
9382                     objfmt='Mach-O'
9383                     ;;
9384                 esac
9385               ;;
9386               *)
9387                 objfmt='ELF ?'
9388               ;;
9389             esac
9391             AC_MSG_RESULT([$objfmt])
9392             if test "$objfmt" = 'ELF ?'; then
9393               objfmt='ELF'
9394               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9395             fi
9397             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9398             case "$objfmt" in
9399               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9400               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9401               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9402               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9403               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9404               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9405               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9406               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9407               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9408               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9409               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9410             esac
9411             AC_MSG_RESULT([$NAFLAGS])
9413             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9414             cat > conftest.asm << EOF
9415             [%line __oline__ "configure"
9416                     section .text
9417                     global  _main,main
9418             _main:
9419             main:   xor     eax,eax
9420                     ret
9421             ]
9423             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9424             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9425               AC_MSG_RESULT(yes)
9426             else
9427               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9428               cat conftest.asm >&AS_MESSAGE_LOG_FD
9429               rm -rf conftest*
9430               AC_MSG_RESULT(no)
9431               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9432               NASM=""
9433             fi
9435         fi
9437         if test -z "$NASM"; then
9438 cat << _EOS
9439 ****************************************************************************
9440 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9441 To get one please:
9443 _EOS
9444             if test "$build_os" = "cygwin"; then
9445 cat << _EOS
9446 install a pre-compiled binary for Win32
9448 mkdir -p /opt/lo/bin
9449 cd /opt/lo/bin
9450 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9451 chmod +x nasm
9453 or get and install one from https://www.nasm.us/
9455 Then re-run autogen.sh
9457 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9458 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9460 _EOS
9461             else
9462 cat << _EOS
9463 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9465 _EOS
9466             fi
9467             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9468             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9469         fi
9470       ;;
9471     esac
9474 AC_SUBST(NASM)
9475 AC_SUBST(NAFLAGS)
9476 AC_SUBST(LIBJPEG_CFLAGS)
9477 AC_SUBST(LIBJPEG_LIBS)
9478 AC_SUBST(SYSTEM_LIBJPEG)
9480 dnl ===================================================================
9481 dnl Check for system clucene
9482 dnl ===================================================================
9483 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9484 if test "$SYSTEM_CLUCENE" = TRUE; then
9485     AC_LANG_PUSH([C++])
9486     save_CXXFLAGS=$CXXFLAGS
9487     save_CPPFLAGS=$CPPFLAGS
9488     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9489     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9490     dnl https://sourceforge.net/p/clucene/bugs/200/
9491     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9492     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9493                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9494     CXXFLAGS=$save_CXXFLAGS
9495     CPPFLAGS=$save_CPPFLAGS
9496     AC_LANG_POP([C++])
9497     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9500 dnl ===================================================================
9501 dnl Check for system expat
9502 dnl ===================================================================
9503 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9505 dnl ===================================================================
9506 dnl Check for system xmlsec
9507 dnl ===================================================================
9508 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9510 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9511 if test "$enable_eot" = "yes"; then
9512     ENABLE_EOT="TRUE"
9513     AC_DEFINE([ENABLE_EOT])
9514     AC_MSG_RESULT([yes])
9516     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9517 else
9518     ENABLE_EOT=
9519     AC_MSG_RESULT([no])
9521 AC_SUBST([ENABLE_EOT])
9523 dnl ===================================================================
9524 dnl Check for DLP libs
9525 dnl ===================================================================
9526 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9527 AS_IF([test "$COM" = "MSC"],
9528       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9529       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9531 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9532 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9534 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9536 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9538 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9539 AS_IF([test "$COM" = "MSC"],
9540       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9541       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9543 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9544 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9546 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9548 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9549 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9551 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9553 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9555 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9557 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9558 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9560 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9561 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9563 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9565 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9566 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9568 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9570 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9572 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9574 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9576 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9577 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9579 dnl ===================================================================
9580 dnl Check for system lcms2
9581 dnl ===================================================================
9582 if test "$with_system_lcms2" != "yes"; then
9583     SYSTEM_LCMS2=
9585 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9586 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9587 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9588 if test "$GCC" = "yes"; then
9589     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9591 if test "$COM" = "MSC"; then # override the above
9592     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9595 dnl ===================================================================
9596 dnl Check for system cppunit
9597 dnl ===================================================================
9598 if test "$_os" != "Android" ; then
9599     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9602 dnl ===================================================================
9603 dnl Check whether freetype is available
9605 dnl FreeType has 3 different kinds of versions
9606 dnl * release, like 2.4.10
9607 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9608 dnl * soname
9609 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9611 dnl 9.9.3 is 2.2.0
9612 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9613 dnl ===================================================================
9614 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9615 if test "x$ac_config_site_64bit_host" = xYES; then
9616     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9617 else
9618     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9620 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9622 # ===================================================================
9623 # Check for system libxslt
9624 # to prevent incompatibilities between internal libxml2 and external libxslt,
9625 # or vice versa, use with_system_libxml here
9626 # ===================================================================
9627 if test "$with_system_libxml" = "auto"; then
9628     case "$_os" in
9629     WINNT|iOS|Android)
9630         with_system_libxml="$with_system_libs"
9631         ;;
9632     Emscripten)
9633         with_system_libxml=no
9634         ;;
9635     *)
9636         if test "$enable_fuzzers" != "yes"; then
9637             with_system_libxml=yes
9638         else
9639             with_system_libxml=no
9640         fi
9641         ;;
9642     esac
9645 AC_MSG_CHECKING([which libxslt to use])
9646 if test "$with_system_libxml" = "yes"; then
9647     AC_MSG_RESULT([external])
9648     SYSTEM_LIBXSLT=TRUE
9649     if test "$_os" = "Darwin"; then
9650         dnl make sure to use SDK path
9651         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9652         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9653         dnl omit -L/usr/lib
9654         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9655         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9656     else
9657         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9658         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9659         FilterLibs "${LIBXSLT_LIBS}"
9660         LIBXSLT_LIBS="${filteredlibs}"
9661         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9662         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9663         FilterLibs "${LIBEXSLT_LIBS}"
9664         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9665     fi
9667     dnl Check for xsltproc
9668     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9669     if test "$XSLTPROC" = "no"; then
9670         AC_MSG_ERROR([xsltproc is required])
9671     fi
9672 else
9673     AC_MSG_RESULT([internal])
9674     SYSTEM_LIBXSLT=
9675     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9677 AC_SUBST(SYSTEM_LIBXSLT)
9678 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9679     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9681 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9683 AC_SUBST(LIBEXSLT_CFLAGS)
9684 AC_SUBST(LIBEXSLT_LIBS)
9685 AC_SUBST(LIBXSLT_CFLAGS)
9686 AC_SUBST(LIBXSLT_LIBS)
9687 AC_SUBST(XSLTPROC)
9689 # ===================================================================
9690 # Check for system libxml
9691 # ===================================================================
9692 AC_MSG_CHECKING([which libxml to use])
9693 if test "$with_system_libxml" = "yes"; then
9694     AC_MSG_RESULT([external])
9695     SYSTEM_LIBXML=TRUE
9696     if test "$_os" = "Darwin"; then
9697         dnl make sure to use SDK path
9698         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9699         dnl omit -L/usr/lib
9700         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9701     elif test $_os = iOS; then
9702         dnl make sure to use SDK path
9703         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9704         LIBXML_CFLAGS="-I$usr/include/libxml2"
9705         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9706     else
9707         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9708         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9709         FilterLibs "${LIBXML_LIBS}"
9710         LIBXML_LIBS="${filteredlibs}"
9711     fi
9713     dnl Check for xmllint
9714     AC_PATH_PROG(XMLLINT, xmllint, no)
9715     if test "$XMLLINT" = "no"; then
9716         AC_MSG_ERROR([xmllint is required])
9717     fi
9718 else
9719     AC_MSG_RESULT([internal])
9720     SYSTEM_LIBXML=
9721     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9722     if test "$COM" = "MSC"; then
9723         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9724     fi
9725     if test "$COM" = "MSC"; then
9726         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9727     else
9728         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9729         if test "$DISABLE_DYNLOADING" = TRUE; then
9730             LIBXML_LIBS="$LIBXML_LIBS -lm"
9731         fi
9732     fi
9733     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9735 AC_SUBST(SYSTEM_LIBXML)
9736 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9737     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9739 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9740 AC_SUBST(LIBXML_CFLAGS)
9741 AC_SUBST(LIBXML_LIBS)
9742 AC_SUBST(XMLLINT)
9744 # =====================================================================
9745 # Checking for a Python interpreter with version >= 3.3.
9746 # Optionally user can pass an option to configure, i. e.
9747 # ./configure PYTHON=/usr/bin/python
9748 # =====================================================================
9749 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9750     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9751     # unless PYTHON is defined as above which allows 'system'
9752     enable_python=internal
9754 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9755     if test -n "$PYTHON"; then
9756         PYTHON_FOR_BUILD=$PYTHON
9757     else
9758         # This allows a lack of system python with no error, we use internal one in that case.
9759         AM_PATH_PYTHON([3.3],, [:])
9760         # Clean PYTHON_VERSION checked below if cross-compiling
9761         PYTHON_VERSION=""
9762         if test "$PYTHON" != ":"; then
9763             PYTHON_FOR_BUILD=$PYTHON
9764         fi
9765     fi
9768 # Checks for Python to use for Pyuno
9769 AC_MSG_CHECKING([which Python to use for Pyuno])
9770 case "$enable_python" in
9771 no|disable)
9772     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9773         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9774         # requirement from the choice whether to include Python stuff in the installer, but why
9775         # bother?
9776         AC_MSG_ERROR([Python is required at build time.])
9777     fi
9778     enable_python=no
9779     AC_MSG_RESULT([none])
9780     ;;
9781 ""|yes|auto)
9782     if test "$DISABLE_SCRIPTING" = TRUE; then
9783         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9784             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9785         fi
9786         AC_MSG_RESULT([none, overridden by --disable-scripting])
9787         enable_python=no
9788     elif test $build_os = cygwin -o $build_os = wsl; then
9789         dnl When building on Windows we don't attempt to use any installed
9790         dnl "system"  Python.
9791         AC_MSG_RESULT([fully internal])
9792         enable_python=internal
9793     elif test "$cross_compiling" = yes; then
9794         AC_MSG_RESULT([system])
9795         enable_python=system
9796     else
9797         # Unset variables set by the above AM_PATH_PYTHON so that
9798         # we actually do check anew.
9799         AC_MSG_RESULT([])
9800         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
9801         AM_PATH_PYTHON([3.3],, [:])
9802         AC_MSG_CHECKING([which Python to use for Pyuno])
9803         if test "$PYTHON" = ":"; then
9804             if test -z "$PYTHON_FOR_BUILD"; then
9805                 AC_MSG_RESULT([fully internal])
9806             else
9807                 AC_MSG_RESULT([internal])
9808             fi
9809             enable_python=internal
9810         else
9811             AC_MSG_RESULT([system])
9812             enable_python=system
9813         fi
9814     fi
9815     ;;
9816 internal)
9817     AC_MSG_RESULT([internal])
9818     ;;
9819 fully-internal)
9820     AC_MSG_RESULT([fully internal])
9821     enable_python=internal
9822     ;;
9823 system)
9824     AC_MSG_RESULT([system])
9825     if test "$_os" = Darwin -a -z "$PYTHON"; then
9826         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9827     fi
9828     ;;
9830     AC_MSG_ERROR([Incorrect --enable-python option])
9831     ;;
9832 esac
9834 if test $enable_python != no; then
9835     BUILD_TYPE="$BUILD_TYPE PYUNO"
9838 if test $enable_python = system; then
9839     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9840         # Fallback: Accept these in the environment, or as set above
9841         # for MacOSX.
9842         :
9843     elif test "$cross_compiling" != yes; then
9844         # Unset variables set by the above AM_PATH_PYTHON so that
9845         # we actually do check anew.
9846         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
9847         # This causes an error if no python command is found
9848         AM_PATH_PYTHON([3.3])
9849         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9850         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9851         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9852         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9853         if test -z "$PKG_CONFIG"; then
9854             PYTHON_CFLAGS="-I$python_include"
9855             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9856         elif $PKG_CONFIG --exists python-$python_version-embed; then
9857             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9858             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9859         elif $PKG_CONFIG --exists python-$python_version; then
9860             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9861             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9862         else
9863             PYTHON_CFLAGS="-I$python_include"
9864             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9865         fi
9866         FilterLibs "${PYTHON_LIBS}"
9867         PYTHON_LIBS="${filteredlibs}"
9868     else
9869         dnl How to find out the cross-compilation Python installation path?
9870         AC_MSG_CHECKING([for python version])
9871         AS_IF([test -n "$PYTHON_VERSION"],
9872               [AC_MSG_RESULT([$PYTHON_VERSION])],
9873               [AC_MSG_RESULT([not found])
9874                AC_MSG_ERROR([no usable python found])])
9875         test -n "$PYTHON_CFLAGS" && break
9876     fi
9878     dnl Check if the headers really work
9879     save_CPPFLAGS="$CPPFLAGS"
9880     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9881     AC_CHECK_HEADER(Python.h)
9882     CPPFLAGS="$save_CPPFLAGS"
9884     # let the PYTHON_FOR_BUILD match the same python installation that
9885     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9886     # better for PythonTests.
9887     PYTHON_FOR_BUILD=$PYTHON
9890 if test "$with_lxml" != no; then
9891     if test -z "$PYTHON_FOR_BUILD"; then
9892         case $build_os in
9893             cygwin)
9894                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9895                 ;;
9896             *)
9897                 if test "$cross_compiling" != yes ; then
9898                     BUILD_TYPE="$BUILD_TYPE LXML"
9899                 fi
9900                 ;;
9901         esac
9902     else
9903         AC_MSG_CHECKING([for python lxml])
9904         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9905             AC_MSG_RESULT([yes])
9906         else
9907             case $build_os in
9908                 cygwin)
9909                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9910                     ;;
9911                 *)
9912                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9913                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9914                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9915                         else
9916                             BUILD_TYPE="$BUILD_TYPE LXML"
9917                             AC_MSG_RESULT([no, using internal lxml])
9918                         fi
9919                     else
9920                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9921                     fi
9922                     ;;
9923             esac
9924         fi
9925     fi
9928 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
9929     SYSTEM_PYTHON=
9930     PYTHON_VERSION_MAJOR=3
9931     PYTHON_VERSION_MINOR=8
9932     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.16
9933     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9934         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9935     fi
9936     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9938     # Embedded Python dies without Home set
9939     if test "$HOME" = ""; then
9940         export HOME=""
9941     fi
9944 dnl By now enable_python should be "system", "internal" or "no"
9945 case $enable_python in
9946 system)
9947     SYSTEM_PYTHON=TRUE
9949     if test "x$ac_cv_header_Python_h" != "xyes"; then
9950        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9951     fi
9953     AC_LANG_PUSH(C)
9954     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9955     AC_MSG_CHECKING([for correct python library version])
9956        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9957 #include <Python.h>
9959 int main(int argc, char **argv) {
9960    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9961    else return 1;
9963        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9964     AC_LANG_POP(C)
9966     dnl FIXME Check if the Python library can be linked with, too?
9967     ;;
9969 internal)
9970     BUILD_TYPE="$BUILD_TYPE PYTHON"
9971     if test "$OS" = LINUX -o "$OS" = WNT ; then
9972         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9973     fi
9974     ;;
9976     DISABLE_PYTHON=TRUE
9977     SYSTEM_PYTHON=
9978     ;;
9980     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9981     ;;
9982 esac
9984 AC_SUBST(DISABLE_PYTHON)
9985 AC_SUBST(SYSTEM_PYTHON)
9986 AC_SUBST(PYTHON_CFLAGS)
9987 AC_SUBST(PYTHON_FOR_BUILD)
9988 AC_SUBST(PYTHON_LIBS)
9989 AC_SUBST(PYTHON_VERSION)
9990 AC_SUBST(PYTHON_VERSION_MAJOR)
9991 AC_SUBST(PYTHON_VERSION_MINOR)
9993 AC_MSG_CHECKING([whether to build LibreLogo])
9994 case "$enable_python" in
9995 no|disable)
9996     AC_MSG_RESULT([no; Python disabled])
9997     ;;
9999     if test "${enable_librelogo}" = "no"; then
10000         AC_MSG_RESULT([no])
10001     else
10002         AC_MSG_RESULT([yes])
10003         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10004         AC_DEFINE([ENABLE_LIBRELOGO],1)
10005     fi
10006     ;;
10007 esac
10008 AC_SUBST(ENABLE_LIBRELOGO)
10010 ENABLE_MARIADBC=
10011 MARIADBC_MAJOR=1
10012 MARIADBC_MINOR=0
10013 MARIADBC_MICRO=2
10014 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10015 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10016     ENABLE_MARIADBC=TRUE
10017     AC_MSG_RESULT([yes])
10018     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10019 else
10020     AC_MSG_RESULT([no])
10022 AC_SUBST(ENABLE_MARIADBC)
10023 AC_SUBST(MARIADBC_MAJOR)
10024 AC_SUBST(MARIADBC_MINOR)
10025 AC_SUBST(MARIADBC_MICRO)
10027 if test "$ENABLE_MARIADBC" = "TRUE"; then
10028     dnl ===================================================================
10029     dnl Check for system MariaDB
10030     dnl ===================================================================
10031     AC_MSG_CHECKING([which MariaDB to use])
10032     if test "$with_system_mariadb" = "yes"; then
10033         AC_MSG_RESULT([external])
10034         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10035         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10036         if test -z "$MARIADBCONFIG"; then
10037             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10038             if test -z "$MARIADBCONFIG"; then
10039                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10040                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10041             fi
10042         fi
10043         AC_MSG_CHECKING([MariaDB version])
10044         MARIADB_VERSION=`$MARIADBCONFIG --version`
10045         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10046         if test "$MARIADB_MAJOR" -ge "5"; then
10047             AC_MSG_RESULT([OK])
10048         else
10049             AC_MSG_ERROR([too old, use 5.0.x or later])
10050         fi
10051         AC_MSG_CHECKING([for MariaDB Client library])
10052         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10053         if test "$COM_IS_CLANG" = TRUE; then
10054             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10055         fi
10056         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10057         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10058         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10059         dnl linux32:
10060         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10061             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10062             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10063                 | sed -e 's|/lib64/|/lib/|')
10064         fi
10065         FilterLibs "${MARIADB_LIBS}"
10066         MARIADB_LIBS="${filteredlibs}"
10067         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10068         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10069         if test "$enable_bundle_mariadb" = "yes"; then
10070             AC_MSG_RESULT([yes])
10071             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10072             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10074 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10076 /g' | grep -E '(mysqlclient|mariadb)')
10077             if test "$_os" = "Darwin"; then
10078                 LIBMARIADB=${LIBMARIADB}.dylib
10079             elif test "$_os" = "WINNT"; then
10080                 LIBMARIADB=${LIBMARIADB}.dll
10081             else
10082                 LIBMARIADB=${LIBMARIADB}.so
10083             fi
10084             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10085             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10086             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10087                 AC_MSG_RESULT([found.])
10088                 PathFormat "$LIBMARIADB_PATH"
10089                 LIBMARIADB_PATH="$formatted_path"
10090             else
10091                 AC_MSG_ERROR([not found.])
10092             fi
10093         else
10094             AC_MSG_RESULT([no])
10095             BUNDLE_MARIADB_CONNECTOR_C=
10096         fi
10097     else
10098         AC_MSG_RESULT([internal])
10099         SYSTEM_MARIADB_CONNECTOR_C=
10100         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10101         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10102         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10103     fi
10105     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10106     AC_SUBST(MARIADB_CFLAGS)
10107     AC_SUBST(MARIADB_LIBS)
10108     AC_SUBST(LIBMARIADB)
10109     AC_SUBST(LIBMARIADB_PATH)
10110     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10113 dnl ===================================================================
10114 dnl Check for system hsqldb
10115 dnl ===================================================================
10116 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10117     AC_MSG_CHECKING([which hsqldb to use])
10118     if test "$with_system_hsqldb" = "yes"; then
10119         AC_MSG_RESULT([external])
10120         SYSTEM_HSQLDB=TRUE
10121         if test -z $HSQLDB_JAR; then
10122             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10123         fi
10124         if ! test -f $HSQLDB_JAR; then
10125                AC_MSG_ERROR(hsqldb.jar not found.)
10126         fi
10127         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10128         export HSQLDB_JAR
10129         if $PERL -e \
10130            'use Archive::Zip;
10131             my $file = "$ENV{'HSQLDB_JAR'}";
10132             my $zip = Archive::Zip->new( $file );
10133             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10134             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10135             {
10136                 push @l, split(/\n/, $mf);
10137                 foreach my $line (@l)
10138                 {
10139                     if ($line =~ m/Specification-Version:/)
10140                     {
10141                         ($t, $version) = split (/:/,$line);
10142                         $version =~ s/^\s//;
10143                         ($a, $b, $c, $d) = split (/\./,$version);
10144                         if ($c == "0" && $d > "8")
10145                         {
10146                             exit 0;
10147                         }
10148                         else
10149                         {
10150                             exit 1;
10151                         }
10152                     }
10153                 }
10154             }
10155             else
10156             {
10157                 exit 1;
10158             }'; then
10159             AC_MSG_RESULT([yes])
10160         else
10161             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10162         fi
10163     else
10164         AC_MSG_RESULT([internal])
10165         SYSTEM_HSQLDB=
10166         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10167         NEED_ANT=TRUE
10168     fi
10169 else
10170     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10171         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10172     fi
10174 AC_SUBST(SYSTEM_HSQLDB)
10175 AC_SUBST(HSQLDB_JAR)
10177 dnl ===================================================================
10178 dnl Check for PostgreSQL stuff
10179 dnl ===================================================================
10180 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10181 if test "x$enable_postgresql_sdbc" != "xno"; then
10182     AC_MSG_RESULT([yes])
10183     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10185     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10186         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10187     fi
10188     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10189         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10190     fi
10192     postgres_interface=""
10193     if test "$with_system_postgresql" = "yes"; then
10194         postgres_interface="external PostgreSQL"
10195         SYSTEM_POSTGRESQL=TRUE
10196         if test "$_os" = Darwin; then
10197             supp_path=''
10198             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10199                 pg_supp_path="$P_SEP$d$pg_supp_path"
10200             done
10201         fi
10202         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10203         if test -n "$PGCONFIG"; then
10204             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10205             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10206         else
10207             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10208               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10209               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10210             ],[
10211               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10212             ])
10213         fi
10214         FilterLibs "${POSTGRESQL_LIB}"
10215         POSTGRESQL_LIB="${filteredlibs}"
10216     else
10217         # if/when anything else than PostgreSQL uses Kerberos,
10218         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10219         WITH_KRB5=
10220         WITH_GSSAPI=
10221         case "$_os" in
10222         Darwin)
10223             # macOS has system MIT Kerberos 5 since 10.4
10224             if test "$with_krb5" != "no"; then
10225                 WITH_KRB5=TRUE
10226                 save_LIBS=$LIBS
10227                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10228                 # that the libraries where these functions are located on macOS will change, is it?
10229                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10230                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10231                 KRB5_LIBS=$LIBS
10232                 LIBS=$save_LIBS
10233                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10234                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10235                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10236                 LIBS=$save_LIBS
10237             fi
10238             if test "$with_gssapi" != "no"; then
10239                 WITH_GSSAPI=TRUE
10240                 save_LIBS=$LIBS
10241                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10242                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10243                 GSSAPI_LIBS=$LIBS
10244                 LIBS=$save_LIBS
10245             fi
10246             ;;
10247         WINNT)
10248             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10249                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10250             fi
10251             ;;
10252         Linux|GNU|*BSD|DragonFly)
10253             if test "$with_krb5" != "no"; then
10254                 WITH_KRB5=TRUE
10255                 save_LIBS=$LIBS
10256                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10257                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10258                 KRB5_LIBS=$LIBS
10259                 LIBS=$save_LIBS
10260                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10261                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10262                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10263                 LIBS=$save_LIBS
10264             fi
10265             if test "$with_gssapi" != "no"; then
10266                 WITH_GSSAPI=TRUE
10267                 save_LIBS=$LIBS
10268                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10269                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10270                 GSSAPI_LIBS=$LIBS
10271                 LIBS=$save_LIBS
10272             fi
10273             ;;
10274         *)
10275             if test "$with_krb5" = "yes"; then
10276                 WITH_KRB5=TRUE
10277                 save_LIBS=$LIBS
10278                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10279                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10280                 KRB5_LIBS=$LIBS
10281                 LIBS=$save_LIBS
10282                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10283                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10284                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10285                 LIBS=$save_LIBS
10286             fi
10287             if test "$with_gssapi" = "yes"; then
10288                 WITH_GSSAPI=TRUE
10289                 save_LIBS=$LIBS
10290                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10291                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10292                 LIBS=$save_LIBS
10293                 GSSAPI_LIBS=$LIBS
10294             fi
10295         esac
10297         if test -n "$with_libpq_path"; then
10298             SYSTEM_POSTGRESQL=TRUE
10299             postgres_interface="external libpq"
10300             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10301             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10302         else
10303             SYSTEM_POSTGRESQL=
10304             postgres_interface="internal"
10305             POSTGRESQL_LIB=""
10306             POSTGRESQL_INC="%OVERRIDE_ME%"
10307             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10308         fi
10309     fi
10311     AC_MSG_CHECKING([PostgreSQL C interface])
10312     AC_MSG_RESULT([$postgres_interface])
10314     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10315         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10316         save_CFLAGS=$CFLAGS
10317         save_CPPFLAGS=$CPPFLAGS
10318         save_LIBS=$LIBS
10319         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10320         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10321         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10322         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10323             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10324         CFLAGS=$save_CFLAGS
10325         CPPFLAGS=$save_CPPFLAGS
10326         LIBS=$save_LIBS
10327     fi
10328     BUILD_POSTGRESQL_SDBC=TRUE
10329 else
10330     AC_MSG_RESULT([no])
10332 AC_SUBST(WITH_KRB5)
10333 AC_SUBST(WITH_GSSAPI)
10334 AC_SUBST(GSSAPI_LIBS)
10335 AC_SUBST(KRB5_LIBS)
10336 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10337 AC_SUBST(SYSTEM_POSTGRESQL)
10338 AC_SUBST(POSTGRESQL_INC)
10339 AC_SUBST(POSTGRESQL_LIB)
10341 dnl ===================================================================
10342 dnl Check for Firebird stuff
10343 dnl ===================================================================
10344 ENABLE_FIREBIRD_SDBC=
10345 if test "$enable_firebird_sdbc" = "yes" ; then
10346     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10348     dnl ===================================================================
10349     dnl Check for system Firebird
10350     dnl ===================================================================
10351     AC_MSG_CHECKING([which Firebird to use])
10352     if test "$with_system_firebird" = "yes"; then
10353         AC_MSG_RESULT([external])
10354         SYSTEM_FIREBIRD=TRUE
10355         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10356         if test -z "$FIREBIRDCONFIG"; then
10357             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10358             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10359                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10360             ])
10361             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10362         else
10363             AC_MSG_NOTICE([fb_config found])
10364             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10365             AC_MSG_CHECKING([for Firebird Client library])
10366             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10367             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10368             FilterLibs "${FIREBIRD_LIBS}"
10369             FIREBIRD_LIBS="${filteredlibs}"
10370         fi
10371         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10372         AC_MSG_CHECKING([Firebird version])
10373         if test -n "${FIREBIRD_VERSION}"; then
10374             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10375             if test "$FIREBIRD_MAJOR" -ge "3"; then
10376                 AC_MSG_RESULT([OK])
10377             else
10378                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10379             fi
10380         else
10381             save_CFLAGS="${CFLAGS}"
10382             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10383             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10384 #if defined(FB_API_VER) && FB_API_VER == 30
10385 int fb_api_is_30(void) { return 0; }
10386 #else
10387 #error "Wrong Firebird API version"
10388 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10389             CFLAGS="$save_CFLAGS"
10390         fi
10391         ENABLE_FIREBIRD_SDBC=TRUE
10392         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10393     elif test "$enable_database_connectivity" = no; then
10394         AC_MSG_RESULT([none])
10395     elif test "$cross_compiling" = "yes"; then
10396         AC_MSG_RESULT([none])
10397     else
10398         dnl Embedded Firebird has version 3.0
10399         dnl We need libatomic_ops for any non X86/X64 system
10400         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10401             dnl ===================================================================
10402             dnl Check for system libatomic_ops
10403             dnl ===================================================================
10404             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10405             if test "$with_system_libatomic_ops" = "yes"; then
10406                 SYSTEM_LIBATOMIC_OPS=TRUE
10407                 AC_CHECK_HEADERS(atomic_ops.h, [],
10408                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10409             else
10410                 SYSTEM_LIBATOMIC_OPS=
10411                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10412                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10413                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10414             fi
10415         fi
10417         AC_MSG_RESULT([internal])
10418         SYSTEM_FIREBIRD=
10419         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10420         FIREBIRD_LIBS="-lfbclient"
10422         if test "$with_system_libtommath" = "yes"; then
10423             SYSTEM_LIBTOMMATH=TRUE
10424             dnl check for tommath presence
10425             save_LIBS=$LIBS
10426             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10427             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10428             LIBS=$save_LIBS
10429         else
10430             SYSTEM_LIBTOMMATH=
10431             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10432             LIBTOMMATH_LIBS="-ltommath"
10433             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10434         fi
10436         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10437         ENABLE_FIREBIRD_SDBC=TRUE
10438         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10439     fi
10441 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10442 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10443 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10444 AC_SUBST(LIBATOMIC_OPS_LIBS)
10445 AC_SUBST(SYSTEM_FIREBIRD)
10446 AC_SUBST(FIREBIRD_CFLAGS)
10447 AC_SUBST(FIREBIRD_LIBS)
10448 AC_SUBST(SYSTEM_LIBTOMMATH)
10449 AC_SUBST(LIBTOMMATH_CFLAGS)
10450 AC_SUBST(LIBTOMMATH_LIBS)
10452 dnl ===================================================================
10453 dnl Check for system curl
10454 dnl ===================================================================
10455 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10457 dnl ===================================================================
10458 dnl Check for system boost
10459 dnl ===================================================================
10460 AC_MSG_CHECKING([which boost to use])
10461 if test "$with_system_boost" = "yes"; then
10462     AC_MSG_RESULT([external])
10463     SYSTEM_BOOST=TRUE
10464     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10465     AX_BOOST_DATE_TIME
10466     AX_BOOST_FILESYSTEM
10467     AX_BOOST_IOSTREAMS
10468     AX_BOOST_LOCALE
10469     AC_LANG_PUSH([C++])
10470     save_CXXFLAGS=$CXXFLAGS
10471     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10472     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10473        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10474     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10475        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10476     CXXFLAGS=$save_CXXFLAGS
10477     AC_LANG_POP([C++])
10478     # this is in m4/ax_boost_base.m4
10479     FilterLibs "${BOOST_LDFLAGS}"
10480     BOOST_LDFLAGS="${filteredlibs}"
10481 else
10482     AC_MSG_RESULT([internal])
10483     BUILD_TYPE="$BUILD_TYPE BOOST"
10484     SYSTEM_BOOST=
10485     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10486         # use warning-suppressing wrapper headers
10487         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10488     else
10489         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10490     fi
10492 AC_SUBST(SYSTEM_BOOST)
10494 dnl ===================================================================
10495 dnl Check for system mdds
10496 dnl ===================================================================
10497 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10498 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10500 dnl ===================================================================
10501 dnl Check for system dragonbox
10502 dnl ===================================================================
10503 AC_MSG_CHECKING([which dragonbox to use])
10504 if test "$with_system_dragonbox" = "yes"; then
10505     AC_MSG_RESULT([external])
10506     SYSTEM_DRAGONBOX=TRUE
10507     AC_LANG_PUSH([C++])
10508     save_CPPFLAGS=$CPPFLAGS
10509     # This is where upstream installs to, unfortunately no .pc or so...
10510     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10511     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10512     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10513        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10514     AC_LANG_POP([C++])
10515     CPPFLAGS=$save_CPPFLAGS
10516 else
10517     AC_MSG_RESULT([internal])
10518     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10519     SYSTEM_DRAGONBOX=
10521 AC_SUBST([SYSTEM_DRAGONBOX])
10522 AC_SUBST([DRAGONBOX_CFLAGS])
10524 dnl ===================================================================
10525 dnl Check for system libfixmath
10526 dnl ===================================================================
10527 AC_MSG_CHECKING([which libfixmath to use])
10528 if test "$with_system_libfixmath" = "yes"; then
10529     AC_MSG_RESULT([external])
10530     SYSTEM_LIBFIXMATH=TRUE
10531     AC_LANG_PUSH([C++])
10532     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10533        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10534     AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib not found or functional)], [])
10535     AC_LANG_POP([C++])
10536 else
10537     AC_MSG_RESULT([internal])
10538     SYSTEM_LIBFIXMATH=
10540 AC_SUBST([SYSTEM_LIBFIXMATH])
10542 dnl ===================================================================
10543 dnl Check for system glm
10544 dnl ===================================================================
10545 AC_MSG_CHECKING([which glm to use])
10546 if test "$with_system_glm" = "yes"; then
10547     AC_MSG_RESULT([external])
10548     SYSTEM_GLM=TRUE
10549     AC_LANG_PUSH([C++])
10550     AC_CHECK_HEADER([glm/glm.hpp], [],
10551        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10552     AC_LANG_POP([C++])
10553 else
10554     AC_MSG_RESULT([internal])
10555     BUILD_TYPE="$BUILD_TYPE GLM"
10556     SYSTEM_GLM=
10557     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10559 AC_SUBST([GLM_CFLAGS])
10560 AC_SUBST([SYSTEM_GLM])
10562 dnl ===================================================================
10563 dnl Check for system odbc
10564 dnl ===================================================================
10565 AC_MSG_CHECKING([which odbc headers to use])
10566 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
10567     AC_MSG_RESULT([external])
10568     SYSTEM_ODBC_HEADERS=TRUE
10570     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10571         save_CPPFLAGS=$CPPFLAGS
10572         find_winsdk
10573         PathFormat "$winsdktest"
10574         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"
10575         AC_CHECK_HEADER(sqlext.h, [],
10576             [AC_MSG_ERROR(odbc not found. install odbc)],
10577             [#include <windows.h>])
10578         CPPFLAGS=$save_CPPFLAGS
10579     else
10580         AC_CHECK_HEADER(sqlext.h, [],
10581             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10582     fi
10583 elif test "$enable_database_connectivity" = no; then
10584     AC_MSG_RESULT([none])
10585 else
10586     AC_MSG_RESULT([internal])
10587     SYSTEM_ODBC_HEADERS=
10589 AC_SUBST(SYSTEM_ODBC_HEADERS)
10591 dnl ===================================================================
10592 dnl Check for system NSS
10593 dnl ===================================================================
10594 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10595     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10596     AC_DEFINE(HAVE_FEATURE_NSS)
10597     ENABLE_NSS=TRUE
10598 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10599     with_tls=openssl
10601 AC_SUBST(ENABLE_NSS)
10603 dnl ===================================================================
10604 dnl Enable LDAP support
10605 dnl ===================================================================
10607 if test "$test_openldap" = yes; then
10608     AC_MSG_CHECKING([whether to enable LDAP support])
10609     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10610         AC_MSG_RESULT([yes])
10611         ENABLE_LDAP=TRUE
10612     else
10613         if test "$enable_ldap" != "yes"; then
10614             AC_MSG_RESULT([no])
10615         else
10616             AC_MSG_RESULT([no (needs NSS or system openldap)])
10617         fi
10618     fi
10620 dnl ===================================================================
10621 dnl Check for system openldap
10622 dnl ===================================================================
10624     if test "$ENABLE_LDAP" = TRUE; then
10625         AC_MSG_CHECKING([which openldap library to use])
10626         if test "$with_system_openldap" = yes; then
10627             AC_MSG_RESULT([external])
10628             SYSTEM_OPENLDAP=TRUE
10629             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10630             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10631             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10632         else
10633             AC_MSG_RESULT([internal])
10634             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10635         fi
10636     fi
10639 AC_SUBST(ENABLE_LDAP)
10640 AC_SUBST(SYSTEM_OPENLDAP)
10642 dnl ===================================================================
10643 dnl Check for TLS/SSL and cryptographic implementation to use
10644 dnl ===================================================================
10645 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10646 if test -n "$with_tls"; then
10647     case $with_tls in
10648     openssl)
10649         AC_DEFINE(USE_TLS_OPENSSL)
10650         TLS=OPENSSL
10651         AC_MSG_RESULT([$TLS])
10653         if test "$enable_openssl" != "yes"; then
10654             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10655         fi
10657         # warn that OpenSSL has been selected but not all TLS code has this option
10658         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10659         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10660         ;;
10661     nss)
10662         AC_DEFINE(USE_TLS_NSS)
10663         TLS=NSS
10664         AC_MSG_RESULT([$TLS])
10665         ;;
10666     no)
10667         AC_MSG_RESULT([none])
10668         AC_MSG_WARN([Skipping TLS/SSL])
10669         ;;
10670     *)
10671         AC_MSG_RESULT([])
10672         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10673 openssl - OpenSSL
10674 nss - Mozilla's Network Security Services (NSS)
10675     ])
10676         ;;
10677     esac
10678 else
10679     # default to using NSS, it results in smaller oox lib
10680     AC_DEFINE(USE_TLS_NSS)
10681     TLS=NSS
10682     AC_MSG_RESULT([$TLS])
10684 AC_SUBST(TLS)
10686 dnl ===================================================================
10687 dnl Check for system sane
10688 dnl ===================================================================
10689 AC_MSG_CHECKING([which sane header to use])
10690 if test "$with_system_sane" = "yes"; then
10691     AC_MSG_RESULT([external])
10692     AC_CHECK_HEADER(sane/sane.h, [],
10693       [AC_MSG_ERROR(sane not found. install sane)], [])
10694 else
10695     AC_MSG_RESULT([internal])
10696     BUILD_TYPE="$BUILD_TYPE SANE"
10699 dnl ===================================================================
10700 dnl Check for system icu
10701 dnl ===================================================================
10702 ICU_MAJOR=72
10703 ICU_MINOR=1
10704 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10705 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10706 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10707 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10708 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10709 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 4.6])
10710 if test "$SYSTEM_ICU" = TRUE; then
10711     AC_LANG_PUSH([C++])
10712     AC_MSG_CHECKING([for unicode/rbbi.h])
10713     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10714     AC_LANG_POP([C++])
10716     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10717     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10718     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10720     if test "$ICU_MAJOR" -ge 50; then
10721         AC_MSG_NOTICE([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10722         ICU_MINOR=
10723     fi
10725     if test "$CROSS_COMPILING" != TRUE; then
10726         # using the system icu tools can lead to version confusion, use the
10727         # ones from the build environment when cross-compiling
10728         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10729         if test -z "$SYSTEM_GENBRK"; then
10730             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10731         fi
10732         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10733         if test -z "$SYSTEM_GENCCODE"; then
10734             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10735         fi
10736         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10737         if test -z "$SYSTEM_GENCMN"; then
10738             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10739         fi
10740         if test "$ICU_MAJOR" -lt 49; then
10741             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10742             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10743             ICU_RECLASSIFIED_HEBREW_LETTER=
10744         fi
10745     fi
10747 if test "$ICU_MAJOR" -ge "59"; then
10748     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10749     # with -std=c++11 but not all external libraries can be built with that,
10750     # for those use a bit-compatible typedef uint16_t UChar; see
10751     # icu/source/common/unicode/umachine.h
10752     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10753 else
10754     ICU_UCHAR_TYPE=""
10756 AC_SUBST(SYSTEM_GENBRK)
10757 AC_SUBST(SYSTEM_GENCCODE)
10758 AC_SUBST(SYSTEM_GENCMN)
10759 AC_SUBST(ICU_MAJOR)
10760 AC_SUBST(ICU_MINOR)
10761 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10762 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10763 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10764 AC_SUBST(ICU_UCHAR_TYPE)
10766 dnl ==================================================================
10767 dnl Breakpad
10768 dnl ==================================================================
10769 DEFAULT_CRASHDUMP_VALUE="true"
10770 AC_MSG_CHECKING([whether to enable breakpad])
10771 if test "$enable_breakpad" != yes; then
10772     AC_MSG_RESULT([no])
10773 else
10774     AC_MSG_RESULT([yes])
10775     ENABLE_BREAKPAD="TRUE"
10776     AC_DEFINE(ENABLE_BREAKPAD)
10777     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10778     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10780     AC_MSG_CHECKING([for disable crash dump])
10781     if test "$enable_crashdump" = no; then
10782         DEFAULT_CRASHDUMP_VALUE="false"
10783         AC_MSG_RESULT([yes])
10784     else
10785        AC_MSG_RESULT([no])
10786     fi
10788     AC_MSG_CHECKING([for crashreport config])
10789     if test "$with_symbol_config" = "no"; then
10790         BREAKPAD_SYMBOL_CONFIG="invalid"
10791         AC_MSG_RESULT([no])
10792     else
10793         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10794         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10795         AC_MSG_RESULT([yes])
10796     fi
10797     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10799 AC_SUBST(ENABLE_BREAKPAD)
10800 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10802 dnl ===================================================================
10803 dnl Orcus
10804 dnl ===================================================================
10805 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.18.0])
10806 if test "$with_system_orcus" != "yes"; then
10807     if test "$SYSTEM_BOOST" = "TRUE"; then
10808         dnl Link with Boost.System
10809         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10810         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10811         dnl in documentation has no effect.
10812         AX_BOOST_SYSTEM
10813     fi
10815 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10816 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10817 AC_SUBST([BOOST_SYSTEM_LIB])
10818 AC_SUBST(SYSTEM_LIBORCUS)
10820 dnl ===================================================================
10821 dnl HarfBuzz
10822 dnl ===================================================================
10824 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10825 GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10826 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10828 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10829 HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10830 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 2.6.8])
10832 if test "$COM" = "MSC"; then # override the above
10833     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10834     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10837 if test "$with_system_harfbuzz" = "yes"; then
10838     if test "$with_system_graphite" = "no"; then
10839         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10840     fi
10841     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10842     save_LIBS="$LIBS"
10843     save_CFLAGS="$CFLAGS"
10844     LIBS="$LIBS $HARFBUZZ_LIBS"
10845     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10846     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10847     LIBS="$save_LIBS"
10848     CFLAGS="$save_CFLAGS"
10849 else
10850     if test "$with_system_graphite" = "yes"; then
10851         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10852     fi
10855 if test "$USING_X11" = TRUE; then
10856     AC_PATH_X
10857     AC_PATH_XTRA
10858     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10860     if test -z "$x_includes"; then
10861         x_includes="default_x_includes"
10862     fi
10863     if test -z "$x_libraries"; then
10864         x_libraries="default_x_libraries"
10865     fi
10866     CFLAGS="$CFLAGS $X_CFLAGS"
10867     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10868     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10869 else
10870     x_includes="no_x_includes"
10871     x_libraries="no_x_libraries"
10874 if test "$USING_X11" = TRUE; then
10875     dnl ===================================================================
10876     dnl Check for extension headers
10877     dnl ===================================================================
10878     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10879      [#include <X11/extensions/shape.h>])
10881     # vcl needs ICE and SM
10882     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10883     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10884         [AC_MSG_ERROR(ICE library not found)])
10885     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10886     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10887         [AC_MSG_ERROR(SM library not found)])
10890 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10891     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10892     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10895 dnl ===================================================================
10896 dnl Check for system Xrender
10897 dnl ===================================================================
10898 AC_MSG_CHECKING([whether to use Xrender])
10899 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10900     AC_MSG_RESULT([yes])
10901     PKG_CHECK_MODULES(XRENDER, xrender)
10902     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10903     FilterLibs "${XRENDER_LIBS}"
10904     XRENDER_LIBS="${filteredlibs}"
10905     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10906       [AC_MSG_ERROR(libXrender not found or functional)], [])
10907     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10908       [AC_MSG_ERROR(Xrender not found. install X)], [])
10909 else
10910     AC_MSG_RESULT([no])
10912 AC_SUBST(XRENDER_CFLAGS)
10913 AC_SUBST(XRENDER_LIBS)
10915 dnl ===================================================================
10916 dnl Check for XRandr
10917 dnl ===================================================================
10918 AC_MSG_CHECKING([whether to enable RandR support])
10919 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10920     AC_MSG_RESULT([yes])
10921     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10922     if test "$ENABLE_RANDR" != "TRUE"; then
10923         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10924                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10925         XRANDR_CFLAGS=" "
10926         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10927           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10928         XRANDR_LIBS="-lXrandr "
10929         ENABLE_RANDR="TRUE"
10930     fi
10931     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10932     FilterLibs "${XRANDR_LIBS}"
10933     XRANDR_LIBS="${filteredlibs}"
10934 else
10935     ENABLE_RANDR=""
10936     AC_MSG_RESULT([no])
10938 AC_SUBST(XRANDR_CFLAGS)
10939 AC_SUBST(XRANDR_LIBS)
10940 AC_SUBST(ENABLE_RANDR)
10942 if test -z "$with_webdav"; then
10943     with_webdav=$test_webdav
10946 AC_MSG_CHECKING([for WebDAV support])
10947 case "$with_webdav" in
10949     AC_MSG_RESULT([no])
10950     WITH_WEBDAV=""
10951     ;;
10953     AC_MSG_RESULT([yes])
10954     # curl is already mandatory (almost) and checked elsewhere
10955     if test "$enable_curl" = "no"; then
10956         AC_MSG_ERROR(["--with-webdav conflicts with --disable-curl"])
10957     fi
10958     WITH_WEBDAV=TRUE
10959     ;;
10960 esac
10961 AC_SUBST(WITH_WEBDAV)
10963 dnl ===================================================================
10964 dnl Check for disabling cve_tests
10965 dnl ===================================================================
10966 AC_MSG_CHECKING([whether to execute CVE tests])
10967 # If not explicitly enabled or disabled, default
10968 if test -z "$enable_cve_tests"; then
10969     case "$OS" in
10970     WNT)
10971         # Default cves off for Windows with its wild and wonderful
10972         # variety of AV software kicking in and panicking
10973         enable_cve_tests=no
10974         ;;
10975     *)
10976         # otherwise yes
10977         enable_cve_tests=yes
10978         ;;
10979     esac
10981 if test "$enable_cve_tests" = "no"; then
10982     AC_MSG_RESULT([no])
10983     DISABLE_CVE_TESTS=TRUE
10984     AC_SUBST(DISABLE_CVE_TESTS)
10985 else
10986     AC_MSG_RESULT([yes])
10989 dnl ===================================================================
10990 dnl Check for system openssl
10991 dnl ===================================================================
10992 ENABLE_OPENSSL=
10993 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10994 if test "$enable_openssl" = "yes"; then
10995     AC_MSG_RESULT([no])
10996     ENABLE_OPENSSL=TRUE
10997     if test "$_os" = Darwin ; then
10998         # OpenSSL is deprecated when building for 10.7 or later.
10999         #
11000         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11001         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11003         with_system_openssl=no
11004         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11005     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11006             && test "$with_system_openssl" != "no"; then
11007         with_system_openssl=yes
11008         SYSTEM_OPENSSL=TRUE
11009         OPENSSL_CFLAGS=
11010         OPENSSL_LIBS="-lssl -lcrypto"
11011     else
11012         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11013     fi
11014     if test "$with_system_openssl" = "yes"; then
11015         AC_MSG_CHECKING([whether openssl supports SHA512])
11016         AC_LANG_PUSH([C])
11017         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11018             SHA512_CTX context;
11019 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11020         AC_LANG_POP(C)
11021     fi
11022 else
11023     AC_MSG_RESULT([yes])
11025     # warn that although OpenSSL is disabled, system libraries may depend on it
11026     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11027     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11030 AC_SUBST([ENABLE_OPENSSL])
11032 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11033     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11034         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11035         enable_cipher_openssl_backend=no
11036     else
11037         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11038     fi
11040 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11041 ENABLE_CIPHER_OPENSSL_BACKEND=
11042 if test "$enable_cipher_openssl_backend" = yes; then
11043     AC_MSG_RESULT([yes])
11044     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11045 else
11046     AC_MSG_RESULT([no])
11048 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11050 dnl ===================================================================
11051 dnl Select the crypto backends used by LO
11052 dnl ===================================================================
11054 if test "$build_crypto" = yes; then
11055     if test "$OS" = WNT; then
11056         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11057         AC_DEFINE([USE_CRYPTO_MSCAPI])
11058     elif test "$ENABLE_NSS" = TRUE; then
11059         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11060         AC_DEFINE([USE_CRYPTO_NSS])
11061     fi
11064 dnl ===================================================================
11065 dnl Check for system redland
11066 dnl ===================================================================
11067 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11068 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11069 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11070 if test "$with_system_redland" = "yes"; then
11071     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11072             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11073 else
11074     RAPTOR_MAJOR="0"
11075     RASQAL_MAJOR="3"
11076     REDLAND_MAJOR="0"
11078 AC_SUBST(RAPTOR_MAJOR)
11079 AC_SUBST(RASQAL_MAJOR)
11080 AC_SUBST(REDLAND_MAJOR)
11082 dnl ===================================================================
11083 dnl Check for system hunspell
11084 dnl ===================================================================
11085 AC_MSG_CHECKING([which libhunspell to use])
11086 if test "$with_system_hunspell" = "yes"; then
11087     AC_MSG_RESULT([external])
11088     SYSTEM_HUNSPELL=TRUE
11089     AC_LANG_PUSH([C++])
11090     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11091     if test "$HUNSPELL_PC" != "TRUE"; then
11092         AC_CHECK_HEADER(hunspell.hxx, [],
11093             [
11094             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11095             [AC_MSG_ERROR(hunspell headers not found.)], [])
11096             ], [])
11097         AC_CHECK_LIB([hunspell], [main], [:],
11098            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11099         HUNSPELL_LIBS=-lhunspell
11100     fi
11101     AC_LANG_POP([C++])
11102     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11103     FilterLibs "${HUNSPELL_LIBS}"
11104     HUNSPELL_LIBS="${filteredlibs}"
11105 else
11106     AC_MSG_RESULT([internal])
11107     SYSTEM_HUNSPELL=
11108     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11109     if test "$COM" = "MSC"; then
11110         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11111     else
11112         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11113     fi
11114     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11116 AC_SUBST(SYSTEM_HUNSPELL)
11117 AC_SUBST(HUNSPELL_CFLAGS)
11118 AC_SUBST(HUNSPELL_LIBS)
11120 dnl ===================================================================
11121 dnl Check for system zxing
11122 dnl ===================================================================
11123 AC_MSG_CHECKING([whether to use zxing])
11124 if test "$enable_zxing" = "no"; then
11125     AC_MSG_RESULT([no])
11126     ENABLE_ZXING=
11127     SYSTEM_ZXING=
11128 else
11129     AC_MSG_RESULT([yes])
11130     ENABLE_ZXING=TRUE
11131     AC_MSG_CHECKING([which libzxing to use])
11132     if test "$with_system_zxing" = "yes"; then
11133         AC_MSG_RESULT([external])
11134         SYSTEM_ZXING=TRUE
11135         ZXING_CFLAGS=
11136         AC_LANG_PUSH([C++])
11137         save_CXXFLAGS=$CXXFLAGS
11138         save_IFS=$IFS
11139         IFS=$P_SEP
11140         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11141             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11142             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11143             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11144             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11145             dnl unsetting IFS."):
11146             IFS=$save_IFS
11147             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11148             dnl ignore them here:
11149             if test -z "$i"; then
11150                 continue
11151             fi
11152             dnl TODO: White space in $i would cause problems:
11153             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11154             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11155                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11156         done
11157         CXXFLAGS=$save_CXXFLAGS
11158         if test -z "$ZXING_CFLAGS"; then
11159             AC_MSG_ERROR(zxing headers not found.)
11160         fi
11161         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11162             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11163             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11164         AC_LANG_POP([C++])
11165         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11166         FilterLibs "${ZXING_LIBS}"
11167         ZXING_LIBS="${filteredlibs}"
11168     else
11169         AC_MSG_RESULT([internal])
11170         SYSTEM_ZXING=
11171         BUILD_TYPE="$BUILD_TYPE ZXING"
11172     fi
11173     if test "$ENABLE_ZXING" = TRUE; then
11174         AC_DEFINE(ENABLE_ZXING)
11175     fi
11177 AC_SUBST(SYSTEM_ZXING)
11178 AC_SUBST(ENABLE_ZXING)
11179 AC_SUBST(ZXING_CFLAGS)
11180 AC_SUBST(ZXING_LIBS)
11182 dnl ===================================================================
11183 dnl Check for system box2d
11184 dnl ===================================================================
11185 AC_MSG_CHECKING([which box2d to use])
11186 if test "$with_system_box2d" = "yes"; then
11187     AC_MSG_RESULT([external])
11188     SYSTEM_BOX2D=TRUE
11189     AC_LANG_PUSH([C++])
11190     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11191         [BOX2D_H_FOUND='FALSE'])
11192     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11193         _BOX2D_LIB=box2d
11194         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11195     else
11196         # fail this. there's no other alternative to check when we are here.
11197         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11198             [AC_MSG_ERROR(box2d headers not found.)])
11199         _BOX2D_LIB=Box2D
11200         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11201     fi
11202     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11203         [ AC_MSG_ERROR(box2d library not found.) ], [])
11204     BOX2D_LIBS=-l$_BOX2D_LIB
11205     AC_LANG_POP([C++])
11206     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11207     FilterLibs "${BOX2D_LIBS}"
11208     BOX2D_LIBS="${filteredlibs}"
11209 else
11210     AC_MSG_RESULT([internal])
11211     SYSTEM_BOX2D=
11212     BUILD_TYPE="$BUILD_TYPE BOX2D"
11214 AC_SUBST(SYSTEM_BOX2D)
11215 AC_SUBST(BOX2D_CFLAGS)
11216 AC_SUBST(BOX2D_LIBS)
11218 dnl ===================================================================
11219 dnl Checking for altlinuxhyph
11220 dnl ===================================================================
11221 AC_MSG_CHECKING([which altlinuxhyph to use])
11222 if test "$with_system_altlinuxhyph" = "yes"; then
11223     AC_MSG_RESULT([external])
11224     SYSTEM_HYPH=TRUE
11225     AC_CHECK_HEADER(hyphen.h, [],
11226        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11227     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11228        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11229        [#include <hyphen.h>])
11230     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11231         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11232     if test -z "$HYPHEN_LIB"; then
11233         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11234            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11235     fi
11236     if test -z "$HYPHEN_LIB"; then
11237         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11238            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11239     fi
11240 else
11241     AC_MSG_RESULT([internal])
11242     SYSTEM_HYPH=
11243     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11244     if test "$COM" = "MSC"; then
11245         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11246     else
11247         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11248     fi
11250 AC_SUBST(SYSTEM_HYPH)
11251 AC_SUBST(HYPHEN_LIB)
11253 dnl ===================================================================
11254 dnl Checking for mythes
11255 dnl ===================================================================
11256 AC_MSG_CHECKING([which mythes to use])
11257 if test "$with_system_mythes" = "yes"; then
11258     AC_MSG_RESULT([external])
11259     SYSTEM_MYTHES=TRUE
11260     AC_LANG_PUSH([C++])
11261     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11262     if test "$MYTHES_PKGCONFIG" = "no"; then
11263         AC_CHECK_HEADER(mythes.hxx, [],
11264             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11265         AC_CHECK_LIB([mythes-1.2], [main], [:],
11266             [ MYTHES_FOUND=no], [])
11267     if test "$MYTHES_FOUND" = "no"; then
11268         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11269                 [ MYTHES_FOUND=no], [])
11270     fi
11271     if test "$MYTHES_FOUND" = "no"; then
11272         AC_MSG_ERROR([mythes library not found!.])
11273     fi
11274     fi
11275     AC_LANG_POP([C++])
11276     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11277     FilterLibs "${MYTHES_LIBS}"
11278     MYTHES_LIBS="${filteredlibs}"
11279 else
11280     AC_MSG_RESULT([internal])
11281     SYSTEM_MYTHES=
11282     BUILD_TYPE="$BUILD_TYPE MYTHES"
11283     if test "$COM" = "MSC"; then
11284         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11285     else
11286         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11287     fi
11289 AC_SUBST(SYSTEM_MYTHES)
11290 AC_SUBST(MYTHES_CFLAGS)
11291 AC_SUBST(MYTHES_LIBS)
11293 dnl ===================================================================
11294 dnl How should we build the linear programming solver ?
11295 dnl ===================================================================
11297 ENABLE_COINMP=
11298 AC_MSG_CHECKING([whether to build with CoinMP])
11299 if test "$enable_coinmp" != "no"; then
11300     ENABLE_COINMP=TRUE
11301     AC_MSG_RESULT([yes])
11302     if test "$with_system_coinmp" = "yes"; then
11303         SYSTEM_COINMP=TRUE
11304         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11305         FilterLibs "${COINMP_LIBS}"
11306         COINMP_LIBS="${filteredlibs}"
11307     else
11308         BUILD_TYPE="$BUILD_TYPE COINMP"
11309     fi
11310 else
11311     AC_MSG_RESULT([no])
11313 AC_SUBST(ENABLE_COINMP)
11314 AC_SUBST(SYSTEM_COINMP)
11315 AC_SUBST(COINMP_CFLAGS)
11316 AC_SUBST(COINMP_LIBS)
11318 ENABLE_LPSOLVE=
11319 AC_MSG_CHECKING([whether to build with lpsolve])
11320 if test "$enable_lpsolve" != "no"; then
11321     ENABLE_LPSOLVE=TRUE
11322     AC_MSG_RESULT([yes])
11323 else
11324     AC_MSG_RESULT([no])
11326 AC_SUBST(ENABLE_LPSOLVE)
11328 if test "$ENABLE_LPSOLVE" = TRUE; then
11329     AC_MSG_CHECKING([which lpsolve to use])
11330     if test "$with_system_lpsolve" = "yes"; then
11331         AC_MSG_RESULT([external])
11332         SYSTEM_LPSOLVE=TRUE
11333         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11334            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11335         save_LIBS=$LIBS
11336         # some systems need this. Like Ubuntu...
11337         AC_CHECK_LIB(m, floor)
11338         AC_CHECK_LIB(dl, dlopen)
11339         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11340             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11341         LIBS=$save_LIBS
11342     else
11343         AC_MSG_RESULT([internal])
11344         SYSTEM_LPSOLVE=
11345         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11346     fi
11348 AC_SUBST(SYSTEM_LPSOLVE)
11350 dnl ===================================================================
11351 dnl Checking for libexttextcat
11352 dnl ===================================================================
11353 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11354 if test "$with_system_libexttextcat" = "yes"; then
11355     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11357 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11359 dnl ===================================================================
11360 dnl Checking for libnumbertext
11361 dnl ===================================================================
11362 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11363 if test "$with_system_libnumbertext" = "yes"; then
11364     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11365     SYSTEM_LIBNUMBERTEXT=YES
11366 else
11367     SYSTEM_LIBNUMBERTEXT=
11369 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11370 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11372 dnl ***************************************
11373 dnl testing libc version for Linux...
11374 dnl ***************************************
11375 if test "$_os" = "Linux"; then
11376     AC_MSG_CHECKING([whether the libc is recent enough])
11377     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11378     #include <features.h>
11379     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11380     #error glibc >= 2.1 is required
11381     #endif
11382     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11385 dnl =========================================
11386 dnl Check for uuidgen
11387 dnl =========================================
11388 if test "$_os" = "WINNT"; then
11389     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11390     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11391     UUIDGEN=uuidgen.exe
11392     AC_SUBST(UUIDGEN)
11393 else
11394     AC_PATH_PROG([UUIDGEN], [uuidgen])
11395     if test -z "$UUIDGEN"; then
11396         AC_MSG_WARN([uuid is needed for building installation sets])
11397     fi
11400 dnl ***************************************
11401 dnl Checking for bison and flex
11402 dnl ***************************************
11403 AC_PATH_PROG(BISON, bison)
11404 if test -z "$BISON"; then
11405     AC_MSG_ERROR([no bison found in \$PATH, install it])
11406 else
11407     AC_MSG_CHECKING([the bison version])
11408     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11409     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11410     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11411     dnl cause
11412     dnl
11413     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]
11414     dnl   typedef union YYSTYPE
11415     dnl           ~~~~~~^~~~~~~
11416     dnl
11417     dnl while at least 3.4.1 is know to be good:
11418     if test "$COMPILER_PLUGINS" = TRUE; then
11419         if test "$_bison_longver" -lt 2004; then
11420             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11421         fi
11422     else
11423         if test "$_bison_longver" -lt 2000; then
11424             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11425         fi
11426     fi
11428 AC_SUBST([BISON])
11430 AC_PATH_PROG(FLEX, flex)
11431 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11432     FLEX=`cygpath -m $FLEX`
11434 if test -z "$FLEX"; then
11435     AC_MSG_ERROR([no flex found in \$PATH, install it])
11436 else
11437     AC_MSG_CHECKING([the flex version])
11438     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11439     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11440         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11441     fi
11443 AC_SUBST([FLEX])
11445 AC_PATH_PROG(DIFF, diff)
11446 if test -z "$DIFF"; then
11447     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11449 AC_SUBST([DIFF])
11451 AC_PATH_PROG(UNIQ, uniq)
11452 if test -z "$UNIQ"; then
11453     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11455 AC_SUBST([UNIQ])
11457 dnl ***************************************
11458 dnl Checking for patch
11459 dnl ***************************************
11460 AC_PATH_PROG(PATCH, patch)
11461 if test -z "$PATCH"; then
11462     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11465 dnl On Solaris or macOS, check if --with-gnu-patch was used
11466 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11467     if test -z "$with_gnu_patch"; then
11468         GNUPATCH=$PATCH
11469     else
11470         if test -x "$with_gnu_patch"; then
11471             GNUPATCH=$with_gnu_patch
11472         else
11473             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11474         fi
11475     fi
11477     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11478     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11479         AC_MSG_RESULT([yes])
11480     else
11481         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11482             AC_MSG_RESULT([no, but accepted (Apple patch)])
11483             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11484         else
11485             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11486         fi
11487     fi
11488 else
11489     GNUPATCH=$PATCH
11492 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11493     GNUPATCH=`cygpath -m $GNUPATCH`
11496 dnl We also need to check for --with-gnu-cp
11498 if test -z "$with_gnu_cp"; then
11499     # check the place where the good stuff is hidden on Solaris...
11500     if test -x /usr/gnu/bin/cp; then
11501         GNUCP=/usr/gnu/bin/cp
11502     else
11503         AC_PATH_PROGS(GNUCP, gnucp cp)
11504     fi
11505     if test -z $GNUCP; then
11506         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11507     fi
11508 else
11509     if test -x "$with_gnu_cp"; then
11510         GNUCP=$with_gnu_cp
11511     else
11512         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11513     fi
11516 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11517     GNUCP=`cygpath -m $GNUCP`
11520 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11521 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11522     AC_MSG_RESULT([yes])
11523 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11524     AC_MSG_RESULT([yes])
11525 else
11526     case "$build_os" in
11527     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11528         x_GNUCP=[\#]
11529         GNUCP=''
11530         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11531         ;;
11532     *)
11533         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11534         ;;
11535     esac
11538 AC_SUBST(GNUPATCH)
11539 AC_SUBST(GNUCP)
11540 AC_SUBST(x_GNUCP)
11542 dnl ***************************************
11543 dnl testing assembler path
11544 dnl ***************************************
11545 ML_EXE=""
11546 if test "$_os" = "WINNT"; then
11547     case "$WIN_HOST_ARCH" in
11548     x86) assembler=ml.exe ;;
11549     x64) assembler=ml64.exe ;;
11550     arm64) assembler=armasm64.exe ;;
11551     esac
11553     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11554     if test -f "$MSVC_HOST_PATH/$assembler"; then
11555         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11556         AC_MSG_RESULT([$ML_EXE])
11557     else
11558         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11559     fi
11562 AC_SUBST(ML_EXE)
11564 dnl ===================================================================
11565 dnl We need zip and unzip
11566 dnl ===================================================================
11567 AC_PATH_PROG(ZIP, zip)
11568 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11569 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11570     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],,)
11573 AC_PATH_PROG(UNZIP, unzip)
11574 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11576 dnl ===================================================================
11577 dnl Zip must be a specific type for different build types.
11578 dnl ===================================================================
11579 if test $build_os = cygwin; then
11580     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11581         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11582     fi
11585 dnl ===================================================================
11586 dnl We need touch with -h option support.
11587 dnl ===================================================================
11588 AC_PATH_PROG(TOUCH, touch)
11589 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11590 touch "$WARNINGS_FILE"
11591 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11592     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],,)
11595 dnl ===================================================================
11596 dnl Check for system epoxy
11597 dnl ===================================================================
11598 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11599 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11601 dnl ===================================================================
11602 dnl Set vcl option: coordinate device in double or sal_Int32
11603 dnl ===================================================================
11605 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11606 if test "$enable_float_device_pixel" = yes; then
11607     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11608     AC_MSG_RESULT([double])
11609 else
11610     AC_MSG_RESULT([sal_Int32])
11613 dnl ===================================================================
11614 dnl Show which vclplugs will be built.
11615 dnl ===================================================================
11616 R=""
11618 libo_ENABLE_VCLPLUG([gen])
11619 libo_ENABLE_VCLPLUG([gtk3])
11620 libo_ENABLE_VCLPLUG([gtk3_kde5])
11621 libo_ENABLE_VCLPLUG([gtk4])
11622 libo_ENABLE_VCLPLUG([kf5])
11623 libo_ENABLE_VCLPLUG([qt5])
11624 libo_ENABLE_VCLPLUG([qt6])
11626 if test "$_os" = "WINNT"; then
11627     R="$R win"
11628 elif test "$_os" = "Darwin"; then
11629     R="$R osx"
11630 elif test "$_os" = "iOS"; then
11631     R="ios"
11632 elif test "$_os" = Android; then
11633     R="android"
11636 build_vcl_plugins="$R"
11637 if test -z "$build_vcl_plugins"; then
11638     build_vcl_plugins=" none"
11640 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11641 VCL_PLUGIN_INFO=$R
11642 AC_SUBST([VCL_PLUGIN_INFO])
11644 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11645     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11648 dnl ===================================================================
11649 dnl Check for GTK libraries
11650 dnl ===================================================================
11652 GTK3_CFLAGS=""
11653 GTK3_LIBS=""
11654 ENABLE_GTKTILEDVIEWER=""
11655 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11656     if test "$with_system_cairo" = no; then
11657         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.'
11658     fi
11659     : ${with_system_cairo:=yes}
11660     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)
11661     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11662     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11663     FilterLibs "${GTK3_LIBS}"
11664     GTK3_LIBS="${filteredlibs}"
11666     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11667     if test "$with_system_epoxy" != "yes"; then
11668         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11669         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11670                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11671     fi
11672 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
11673     PathFormat "${with_gtk3_build}/lib/pkgconfig"
11674     if test "$build_os" = "cygwin"; then
11675         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
11676         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
11677     fi
11679     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
11680     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
11681     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11682     FilterLibs "${GTK3_LIBS}"
11683     GTK3_LIBS="${filteredlibs}"
11684     ENABLE_GTKTILEDVIEWER="yes"
11686 AC_SUBST(GTK3_LIBS)
11687 AC_SUBST(GTK3_CFLAGS)
11688 AC_SUBST(ENABLE_GTKTILEDVIEWER)
11690 GTK4_CFLAGS=""
11691 GTK4_LIBS=""
11692 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11693     if test "$with_system_cairo" = no; then
11694         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11695     fi
11696     : ${with_system_cairo:=yes}
11697     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11698     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11699     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11700     FilterLibs "${GTK4_LIBS}"
11701     GTK4_LIBS="${filteredlibs}"
11703     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11704     if test "$with_system_epoxy" != "yes"; then
11705         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11706         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11707                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11708     fi
11710 AC_SUBST(GTK4_LIBS)
11711 AC_SUBST(GTK4_CFLAGS)
11713 if test "$enable_introspection" = yes; then
11714     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11715         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11716     else
11717         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11718     fi
11721 dnl ===================================================================
11722 dnl check for dbus support
11723 dnl ===================================================================
11724 ENABLE_DBUS=""
11725 DBUS_CFLAGS=""
11726 DBUS_LIBS=""
11727 DBUS_GLIB_CFLAGS=""
11728 DBUS_GLIB_LIBS=""
11729 DBUS_HAVE_GLIB=""
11731 if test "$enable_dbus" = "no"; then
11732     test_dbus=no
11735 AC_MSG_CHECKING([whether to enable DBUS support])
11736 if test "$test_dbus" = "yes"; then
11737     ENABLE_DBUS="TRUE"
11738     AC_MSG_RESULT([yes])
11739     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11740     AC_DEFINE(ENABLE_DBUS)
11741     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11742     FilterLibs "${DBUS_LIBS}"
11743     DBUS_LIBS="${filteredlibs}"
11745     # Glib is needed for BluetoothServer
11746     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11747     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11748         [
11749             DBUS_HAVE_GLIB="TRUE"
11750             AC_DEFINE(DBUS_HAVE_GLIB,1)
11751         ],
11752         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11753     )
11754 else
11755     AC_MSG_RESULT([no])
11758 AC_SUBST(ENABLE_DBUS)
11759 AC_SUBST(DBUS_CFLAGS)
11760 AC_SUBST(DBUS_LIBS)
11761 AC_SUBST(DBUS_GLIB_CFLAGS)
11762 AC_SUBST(DBUS_GLIB_LIBS)
11763 AC_SUBST(DBUS_HAVE_GLIB)
11765 AC_MSG_CHECKING([whether to enable Impress remote control])
11766 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11767     AC_MSG_RESULT([yes])
11768     ENABLE_SDREMOTE=TRUE
11769     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
11770         <true/>"
11771     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11773     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11774         # The Bluetooth code doesn't compile with macOS SDK 10.15
11775         if test "$enable_sdremote_bluetooth" = yes; then
11776             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11777         fi
11778         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
11779         enable_sdremote_bluetooth=no
11780     fi
11781     # If not explicitly enabled or disabled, default
11782     if test -z "$enable_sdremote_bluetooth"; then
11783         case "$OS" in
11784         LINUX|MACOSX|WNT)
11785             # Default to yes for these
11786             enable_sdremote_bluetooth=yes
11787             ;;
11788         *)
11789             # otherwise no
11790             enable_sdremote_bluetooth=no
11791             ;;
11792         esac
11793     fi
11794     # $enable_sdremote_bluetooth is guaranteed non-empty now
11796     if test "$enable_sdremote_bluetooth" != "no"; then
11797         if test "$OS" = "LINUX"; then
11798             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11799                 AC_MSG_RESULT([yes])
11800                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11801                 dnl ===================================================================
11802                 dnl Check for system bluez
11803                 dnl ===================================================================
11804                 AC_MSG_CHECKING([which Bluetooth header to use])
11805                 if test "$with_system_bluez" = "yes"; then
11806                     AC_MSG_RESULT([external])
11807                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11808                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11809                     SYSTEM_BLUEZ=TRUE
11810                 else
11811                     AC_MSG_RESULT([internal])
11812                     SYSTEM_BLUEZ=
11813                 fi
11814             else
11815                 AC_MSG_RESULT([no, dbus disabled])
11816                 ENABLE_SDREMOTE_BLUETOOTH=
11817                 SYSTEM_BLUEZ=
11818             fi
11819         else
11820             AC_MSG_RESULT([yes])
11821             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11822             SYSTEM_BLUEZ=
11823             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
11824         <key>com.apple.security.device.bluetooth</key>
11825         <true/>"
11826         fi
11827     else
11828         AC_MSG_RESULT([no])
11829         ENABLE_SDREMOTE_BLUETOOTH=
11830         SYSTEM_BLUEZ=
11831     fi
11832 else
11833     ENABLE_SDREMOTE=
11834     SYSTEM_BLUEZ=
11835     AC_MSG_RESULT([no])
11837 AC_SUBST(ENABLE_SDREMOTE)
11838 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11839 AC_SUBST(SDREMOTE_ENTITLEMENT)
11840 AC_SUBST(SYSTEM_BLUEZ)
11842 dnl ===================================================================
11843 dnl Check whether to enable GIO support
11844 dnl ===================================================================
11845 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11846     AC_MSG_CHECKING([whether to enable GIO support])
11847     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11848         dnl Need at least 2.26 for the dbus support.
11849         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11850                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11851         if test "$ENABLE_GIO" = "TRUE"; then
11852             AC_DEFINE(ENABLE_GIO)
11853             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11854             FilterLibs "${GIO_LIBS}"
11855             GIO_LIBS="${filteredlibs}"
11856         fi
11857     else
11858         AC_MSG_RESULT([no])
11859     fi
11861 AC_SUBST(ENABLE_GIO)
11862 AC_SUBST(GIO_CFLAGS)
11863 AC_SUBST(GIO_LIBS)
11866 dnl ===================================================================
11868 SPLIT_APP_MODULES=""
11869 if test "$enable_split_app_modules" = "yes"; then
11870     SPLIT_APP_MODULES="TRUE"
11872 AC_SUBST(SPLIT_APP_MODULES)
11874 SPLIT_OPT_FEATURES=""
11875 if test "$enable_split_opt_features" = "yes"; then
11876     SPLIT_OPT_FEATURES="TRUE"
11878 AC_SUBST(SPLIT_OPT_FEATURES)
11880 dnl ===================================================================
11881 dnl Check whether the GStreamer libraries are available.
11882 dnl ===================================================================
11884 ENABLE_GSTREAMER_1_0=""
11886 if test "$test_gstreamer_1_0" = yes; then
11888     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11889     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11890         ENABLE_GSTREAMER_1_0="TRUE"
11891         AC_MSG_RESULT([yes])
11892         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11893         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11894         FilterLibs "${GSTREAMER_1_0_LIBS}"
11895         GSTREAMER_1_0_LIBS="${filteredlibs}"
11896         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11897     else
11898         AC_MSG_RESULT([no])
11899     fi
11901 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11902 AC_SUBST(GSTREAMER_1_0_LIBS)
11903 AC_SUBST(ENABLE_GSTREAMER_1_0)
11905 ENABLE_OPENGL_TRANSITIONS=
11906 ENABLE_OPENGL_CANVAS=
11907 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11908    : # disable
11909 elif test "$_os" = "Darwin"; then
11910     # We use frameworks on macOS, no need for detail checks
11911     ENABLE_OPENGL_TRANSITIONS=TRUE
11912     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11913     ENABLE_OPENGL_CANVAS=TRUE
11914 elif test $_os = WINNT; then
11915     ENABLE_OPENGL_TRANSITIONS=TRUE
11916     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11917     ENABLE_OPENGL_CANVAS=TRUE
11918 else
11919     if test "$USING_X11" = TRUE; then
11920         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11921         ENABLE_OPENGL_TRANSITIONS=TRUE
11922         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11923         ENABLE_OPENGL_CANVAS=TRUE
11924     fi
11927 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11928 AC_SUBST(ENABLE_OPENGL_CANVAS)
11930 dnl =================================================
11931 dnl Check whether to build with OpenCL support.
11932 dnl =================================================
11934 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11935     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11936     # platform (optional at run-time, used through clew).
11937     BUILD_TYPE="$BUILD_TYPE OPENCL"
11938     AC_DEFINE(HAVE_FEATURE_OPENCL)
11941 dnl =================================================
11942 dnl Check whether to build with dconf support.
11943 dnl =================================================
11945 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11946     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11947         if test "$enable_dconf" = yes; then
11948             AC_MSG_ERROR([dconf not found])
11949         else
11950             enable_dconf=no
11951         fi])
11953 AC_MSG_CHECKING([whether to enable dconf])
11954 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11955     DCONF_CFLAGS=
11956     DCONF_LIBS=
11957     ENABLE_DCONF=
11958     AC_MSG_RESULT([no])
11959 else
11960     ENABLE_DCONF=TRUE
11961     AC_DEFINE(ENABLE_DCONF)
11962     AC_MSG_RESULT([yes])
11964 AC_SUBST([DCONF_CFLAGS])
11965 AC_SUBST([DCONF_LIBS])
11966 AC_SUBST([ENABLE_DCONF])
11968 # pdf import?
11969 AC_MSG_CHECKING([whether to build the PDF import feature])
11970 ENABLE_PDFIMPORT=
11971 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11972     AC_MSG_RESULT([yes])
11973     ENABLE_PDFIMPORT=TRUE
11974     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11975 else
11976     AC_MSG_RESULT([no])
11979 # Pdfium?
11980 AC_MSG_CHECKING([whether to build PDFium])
11981 ENABLE_PDFIUM=
11982 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11983     AC_MSG_RESULT([yes])
11984     ENABLE_PDFIUM=TRUE
11985     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11986 else
11987     AC_MSG_RESULT([no])
11989 AC_SUBST(ENABLE_PDFIUM)
11991 if test "$ENABLE_PDFIUM" = "TRUE"; then
11992     AC_MSG_CHECKING([which OpenJPEG library to use])
11993     if test "$with_system_openjpeg" = "yes"; then
11994         SYSTEM_OPENJPEG2=TRUE
11995         AC_MSG_RESULT([external])
11996         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
11997         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11998         FilterLibs "${OPENJPEG2_LIBS}"
11999         OPENJPEG2_LIBS="${filteredlibs}"
12000     else
12001         SYSTEM_OPENJPEG2=FALSE
12002         AC_MSG_RESULT([internal])
12003     fi
12005     AC_MSG_CHECKING([which Abseil library to use])
12006     if test "$with_system_abseil" = "yes"; then
12007         AC_MSG_RESULT([external])
12008         SYSTEM_ABSEIL=TRUE
12009         AC_LANG_PUSH([C++])
12010         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
12011                         [AC_MSG_ERROR(abseil headers not found.)], [])
12012         AC_CHECK_HEADER(absl/types/bad_variant_access.h, [],
12013                         [AC_MSG_ERROR(abseil headers not found.)], [])
12014         AC_CHECK_LIB([absl_bad_optional_access], [main], [],
12015                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
12016         AC_CHECK_LIB([absl_bad_variant_access], [main], [],
12017                      [AC_MSG_ERROR([libabsl_bad_variant_access library not found.])])
12018         ABSEIL_LIBS="-labsl_bad_optional_access -labsl_bad_variant_access"
12019         AC_LANG_POP([C++])
12020         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12021         FilterLibs "${ABSEIL_LIBS}"
12022         ABSEIL_LIBS="${filteredlibs}"
12023     else
12024         AC_MSG_RESULT([internal])
12025     fi
12027 AC_SUBST(SYSTEM_OPENJPEG2)
12028 AC_SUBST(SYSTEM_ABSEIL)
12029 AC_SUBST(ABSEIL_CFLAGS)
12030 AC_SUBST(ABSEIL_LIBS)
12032 dnl ===================================================================
12033 dnl Check for poppler
12034 dnl ===================================================================
12035 ENABLE_POPPLER=
12036 AC_MSG_CHECKING([whether to build Poppler])
12037 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12038     AC_MSG_RESULT([yes])
12039     ENABLE_POPPLER=TRUE
12040     AC_DEFINE(HAVE_FEATURE_POPPLER)
12041 else
12042     AC_MSG_RESULT([no])
12044 AC_SUBST(ENABLE_POPPLER)
12046 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12047     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12050 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12051     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12054 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12055     dnl ===================================================================
12056     dnl Check for system poppler
12057     dnl ===================================================================
12058     AC_MSG_CHECKING([which PDF import poppler to use])
12059     if test "$with_system_poppler" = "yes"; then
12060         AC_MSG_RESULT([external])
12061         SYSTEM_POPPLER=TRUE
12062         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12063         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12064         FilterLibs "${POPPLER_LIBS}"
12065         POPPLER_LIBS="${filteredlibs}"
12066     else
12067         AC_MSG_RESULT([internal])
12068         SYSTEM_POPPLER=
12069         BUILD_TYPE="$BUILD_TYPE POPPLER"
12070     fi
12071     AC_DEFINE([ENABLE_PDFIMPORT],1)
12073 AC_SUBST(ENABLE_PDFIMPORT)
12074 AC_SUBST(SYSTEM_POPPLER)
12075 AC_SUBST(POPPLER_CFLAGS)
12076 AC_SUBST(POPPLER_LIBS)
12078 # Skia?
12079 ENABLE_SKIA=
12080 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12081     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12082     if test "$SYSTEM_FREETYPE" = TRUE; then
12083         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12084             [skia_freetype_ok=yes],
12085             [skia_freetype_ok=no])
12086     else # internal is ok
12087         skia_freetype_ok=yes
12088     fi
12089     AC_MSG_CHECKING([whether to build Skia])
12090     if test "$skia_freetype_ok" = "yes"; then
12091         if test "$enable_skia" = "debug"; then
12092             AC_MSG_RESULT([yes (debug)])
12093             ENABLE_SKIA_DEBUG=TRUE
12094         else
12095             AC_MSG_RESULT([yes])
12096             ENABLE_SKIA_DEBUG=
12097         fi
12098         ENABLE_SKIA=TRUE
12099         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12100                 AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12101         fi
12103         AC_DEFINE(HAVE_FEATURE_SKIA)
12104         BUILD_TYPE="$BUILD_TYPE SKIA"
12106         if test "$OS" = "MACOSX"; then
12107             AC_DEFINE(SK_SUPPORT_GPU,1)
12108             AC_DEFINE(SK_METAL,1)
12109             SKIA_GPU=METAL
12110             AC_SUBST(SKIA_GPU)
12111         else
12112             AC_DEFINE(SK_SUPPORT_GPU,1)
12113             AC_DEFINE(SK_VULKAN,1)
12114             SKIA_GPU=VULKAN
12115             AC_SUBST(SKIA_GPU)
12116         fi
12117     else
12118         AC_MSG_RESULT([no (freetype too old)])
12119         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12120     fi
12122 else
12123     AC_MSG_CHECKING([whether to build Skia])
12124     AC_MSG_RESULT([no])
12126 AC_SUBST(ENABLE_SKIA)
12127 AC_SUBST(ENABLE_SKIA_DEBUG)
12129 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12130 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12131 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12132 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12133 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12134 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12135 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12136 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12137 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12138 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12139 HAVE_LO_CLANG_DLLEXPORTINLINES=
12141 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12142     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12143         AC_MSG_CHECKING([for Clang])
12144         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12145     else
12146         if test "$_os" = "WINNT"; then
12147             AC_MSG_CHECKING([for clang-cl])
12148             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12149                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12150             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12151                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12152             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12153                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12154             fi
12155             if test -n "$LO_CLANG_CC"; then
12156                 dnl explicitly set -m32/-m64
12157                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12158                 LO_CLANG_CXX="$LO_CLANG_CC"
12159                 AC_MSG_RESULT([$LO_CLANG_CC])
12160             else
12161                 AC_MSG_RESULT([no])
12162             fi
12164             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12165             echo "#include <stdlib.h>" > conftest.c
12166             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12167                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12168             rm -f conftest.c conftest.obj
12169             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12170                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12171             else
12172                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12173             fi
12174         else
12175             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12176             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12177         fi
12178     fi
12179     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12180         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12181         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12182         if test "$clang2_ver" -lt 50002; then
12183             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12184             LO_CLANG_CC=
12185             LO_CLANG_CXX=
12186         fi
12187     fi
12188     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12189         save_CXX="$CXX"
12190         CXX="$LO_CLANG_CXX"
12191         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12192         AC_LANG_PUSH([C++])
12193         save_CXXFLAGS=$CXXFLAGS
12194         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12195         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12196                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12197                 AC_MSG_RESULT([yes])
12198             ], [AC_MSG_RESULT([no])])
12199         CXXFLAGS=$save_CXXFLAGS
12200         AC_LANG_POP([C++])
12201         CXX="$save_CXX"
12202         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12203             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.])
12204         fi
12205     fi
12206     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12207         # Skia is the default on Windows and Mac, so hard-require Clang.
12208         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12209         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12210             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12211         else
12212             AC_MSG_WARN([Clang compiler not found.])
12213         fi
12214     else
12216         save_CXX="$CXX"
12217         CXX="$LO_CLANG_CXX"
12218         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12219         flag_sse2=-msse2
12220         flag_ssse3=-mssse3
12221         flag_sse41=-msse4.1
12222         flag_sse42=-msse4.2
12223         flag_avx=-mavx
12224         flag_avx2=-mavx2
12225         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12226         flag_avx512f=-mavx512f
12227         flag_f16c=-mf16c
12228         flag_fma=-mfma
12230         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12231         AC_LANG_PUSH([C++])
12232         save_CXXFLAGS=$CXXFLAGS
12233         CXXFLAGS="$CXXFLAGS $flag_sse2"
12234         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12235             #include <emmintrin.h>
12236             int main () {
12237                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12238                 c = _mm_xor_si128 (a, b);
12239                 return 0;
12240             }
12241             ])],
12242             [can_compile_sse2=yes],
12243             [can_compile_sse2=no])
12244         AC_LANG_POP([C++])
12245         CXXFLAGS=$save_CXXFLAGS
12246         AC_MSG_RESULT([${can_compile_sse2}])
12247         if test "${can_compile_sse2}" = "yes" ; then
12248             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12249         fi
12251         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12252         AC_LANG_PUSH([C++])
12253         save_CXXFLAGS=$CXXFLAGS
12254         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12255         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12256             #include <tmmintrin.h>
12257             int main () {
12258                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12259                 c = _mm_maddubs_epi16 (a, b);
12260                 return 0;
12261             }
12262             ])],
12263             [can_compile_ssse3=yes],
12264             [can_compile_ssse3=no])
12265         AC_LANG_POP([C++])
12266         CXXFLAGS=$save_CXXFLAGS
12267         AC_MSG_RESULT([${can_compile_ssse3}])
12268         if test "${can_compile_ssse3}" = "yes" ; then
12269             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12270         fi
12272         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12273         AC_LANG_PUSH([C++])
12274         save_CXXFLAGS=$CXXFLAGS
12275         CXXFLAGS="$CXXFLAGS $flag_sse41"
12276         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12277             #include <smmintrin.h>
12278             int main () {
12279                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12280                 c = _mm_cmpeq_epi64 (a, b);
12281                 return 0;
12282             }
12283             ])],
12284             [can_compile_sse41=yes],
12285             [can_compile_sse41=no])
12286         AC_LANG_POP([C++])
12287         CXXFLAGS=$save_CXXFLAGS
12288         AC_MSG_RESULT([${can_compile_sse41}])
12289         if test "${can_compile_sse41}" = "yes" ; then
12290             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12291         fi
12293         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12294         AC_LANG_PUSH([C++])
12295         save_CXXFLAGS=$CXXFLAGS
12296         CXXFLAGS="$CXXFLAGS $flag_sse42"
12297         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12298             #include <nmmintrin.h>
12299             int main () {
12300                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12301                 c = _mm_cmpgt_epi64 (a, b);
12302                 return 0;
12303             }
12304             ])],
12305             [can_compile_sse42=yes],
12306             [can_compile_sse42=no])
12307         AC_LANG_POP([C++])
12308         CXXFLAGS=$save_CXXFLAGS
12309         AC_MSG_RESULT([${can_compile_sse42}])
12310         if test "${can_compile_sse42}" = "yes" ; then
12311             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12312         fi
12314         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12315         AC_LANG_PUSH([C++])
12316         save_CXXFLAGS=$CXXFLAGS
12317         CXXFLAGS="$CXXFLAGS $flag_avx"
12318         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12319             #include <immintrin.h>
12320             int main () {
12321                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12322                 c = _mm256_xor_ps(a, b);
12323                 return 0;
12324             }
12325             ])],
12326             [can_compile_avx=yes],
12327             [can_compile_avx=no])
12328         AC_LANG_POP([C++])
12329         CXXFLAGS=$save_CXXFLAGS
12330         AC_MSG_RESULT([${can_compile_avx}])
12331         if test "${can_compile_avx}" = "yes" ; then
12332             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12333         fi
12335         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12336         AC_LANG_PUSH([C++])
12337         save_CXXFLAGS=$CXXFLAGS
12338         CXXFLAGS="$CXXFLAGS $flag_avx2"
12339         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12340             #include <immintrin.h>
12341             int main () {
12342                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12343                 c = _mm256_maddubs_epi16(a, b);
12344                 return 0;
12345             }
12346             ])],
12347             [can_compile_avx2=yes],
12348             [can_compile_avx2=no])
12349         AC_LANG_POP([C++])
12350         CXXFLAGS=$save_CXXFLAGS
12351         AC_MSG_RESULT([${can_compile_avx2}])
12352         if test "${can_compile_avx2}" = "yes" ; then
12353             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12354         fi
12356         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12357         AC_LANG_PUSH([C++])
12358         save_CXXFLAGS=$CXXFLAGS
12359         CXXFLAGS="$CXXFLAGS $flag_avx512"
12360         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12361             #include <immintrin.h>
12362             int main () {
12363                 __m512i a = _mm512_loadu_si512(0);
12364                 __m512d v1 = _mm512_load_pd(0);
12365                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12366                 __m512d v2 = _mm512_abs_pd(v1);
12367                 return 0;
12368             }
12369             ])],
12370             [can_compile_avx512=yes],
12371             [can_compile_avx512=no])
12372         AC_LANG_POP([C++])
12373         CXXFLAGS=$save_CXXFLAGS
12374         AC_MSG_RESULT([${can_compile_avx512}])
12375         if test "${can_compile_avx512}" = "yes" ; then
12376             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12377             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12378         fi
12380         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12381         AC_LANG_PUSH([C++])
12382         save_CXXFLAGS=$CXXFLAGS
12383         CXXFLAGS="$CXXFLAGS $flag_f16c"
12384         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12385             #include <immintrin.h>
12386             int main () {
12387                 __m128i a = _mm_set1_epi32 (0);
12388                 __m128 c;
12389                 c = _mm_cvtph_ps(a);
12390                 return 0;
12391             }
12392             ])],
12393             [can_compile_f16c=yes],
12394             [can_compile_f16c=no])
12395         AC_LANG_POP([C++])
12396         CXXFLAGS=$save_CXXFLAGS
12397         AC_MSG_RESULT([${can_compile_f16c}])
12398         if test "${can_compile_f16c}" = "yes" ; then
12399             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12400         fi
12402         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12403         AC_LANG_PUSH([C++])
12404         save_CXXFLAGS=$CXXFLAGS
12405         CXXFLAGS="$CXXFLAGS $flag_fma"
12406         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12407             #include <immintrin.h>
12408             int main () {
12409                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12410                 d = _mm256_fmadd_ps(a, b, c);
12411                 return 0;
12412             }
12413             ])],
12414             [can_compile_fma=yes],
12415             [can_compile_fma=no])
12416         AC_LANG_POP([C++])
12417         CXXFLAGS=$save_CXXFLAGS
12418         AC_MSG_RESULT([${can_compile_fma}])
12419         if test "${can_compile_fma}" = "yes" ; then
12420             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12421         fi
12423         CXX="$save_CXX"
12424     fi
12427 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12429 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12430     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12431     AC_LANG_PUSH([C])
12432     save_CC="$CC"
12433     CC="$LO_CLANG_CC"
12434     save_CFLAGS=$CFLAGS
12435     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12436     dnl an empty program will do, we're checking the compiler flags
12437     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12438                       [use_ccache=yes], [use_ccache=no])
12439     CFLAGS=$save_CFLAGS
12440     CC=$save_CC
12441     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12442         AC_MSG_RESULT([yes])
12443     else
12444         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12445         AC_MSG_RESULT([no])
12446     fi
12447     AC_LANG_POP([C])
12449     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12450     AC_LANG_PUSH([C++])
12451     save_CXX="$CXX"
12452     CXX="$LO_CLANG_CXX"
12453     save_CXXFLAGS=$CXXFLAGS
12454     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12455     dnl an empty program will do, we're checking the compiler flags
12456     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12457                       [use_ccache=yes], [use_ccache=no])
12458     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12459         AC_MSG_RESULT([yes])
12460     else
12461         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12462         AC_MSG_RESULT([no])
12463     fi
12464     CXXFLAGS=$save_CXXFLAGS
12465     CXX=$save_CXX
12466     AC_LANG_POP([C++])
12469 AC_SUBST(LO_CLANG_CC)
12470 AC_SUBST(LO_CLANG_CXX)
12471 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12472 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12473 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12474 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12475 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12476 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12477 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12478 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12479 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12480 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12481 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12482 AC_SUBST(CLANG_USE_LD)
12483 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12485 SYSTEM_GPGMEPP=
12487 AC_MSG_CHECKING([whether to enable gpgmepp])
12488 if test "$enable_gpgmepp" = no; then
12489     AC_MSG_RESULT([no])
12490 elif test "$enable_mpl_subset" = "yes"; then
12491     AC_MSG_RESULT([no (MPL only])
12492 elif test "$enable_fuzzers" = "yes"; then
12493     AC_MSG_RESULT([no (oss-fuzz)])
12494 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12495     AC_MSG_RESULT([yes])
12496     dnl ===================================================================
12497     dnl Check for system gpgme
12498     dnl ===================================================================
12499     AC_MSG_CHECKING([which gpgmepp to use])
12500     if test "$with_system_gpgmepp" = "yes"; then
12501         AC_MSG_RESULT([external])
12502         SYSTEM_GPGMEPP=TRUE
12504         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12505         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12506             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12507         AC_CHECK_HEADER(gpgme.h, [],
12508             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12509         AC_CHECK_LIB(gpgmepp, main, [],
12510             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12511         GPGMEPP_LIBS=-lgpgmepp
12512     else
12513         AC_MSG_RESULT([internal])
12514         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12516         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12517         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12518         if test "$_os" != "WINNT"; then
12519             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12520             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12521         fi
12522     fi
12523     ENABLE_GPGMEPP=TRUE
12524     AC_DEFINE([HAVE_FEATURE_GPGME])
12525     AC_PATH_PROG(GPG, gpg)
12526     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12527     # so let's exclude that manually for the moment
12528     if test -n "$GPG" -a "$_os" != "WINNT"; then
12529         # make sure we not only have a working gpgme, but a full working
12530         # gpg installation to run OpenPGP signature verification
12531         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12532     fi
12533     if test "$_os" = "Linux"; then
12534       uid=`id -u`
12535       AC_MSG_CHECKING([for /run/user/$uid])
12536       if test -d /run/user/$uid; then
12537         AC_MSG_RESULT([yes])
12538         AC_PATH_PROG(GPGCONF, gpgconf)
12540         # Older versions of gpgconf are not working as expected, since
12541         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12542         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12543         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12544         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12545         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12546         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12547         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12548           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12549           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12550           if $GPGCONF --dump-options > /dev/null ; then
12551             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12552               AC_MSG_RESULT([yes])
12553               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12554               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12555             else
12556               AC_MSG_RESULT([no])
12557             fi
12558           else
12559             AC_MSG_RESULT([no. missing or broken gpgconf?])
12560           fi
12561         else
12562           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12563         fi
12564       else
12565         AC_MSG_RESULT([no])
12566      fi
12567    fi
12568 else
12569     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12571 AC_SUBST(ENABLE_GPGMEPP)
12572 AC_SUBST(SYSTEM_GPGMEPP)
12573 AC_SUBST(GPG_ERROR_CFLAGS)
12574 AC_SUBST(GPG_ERROR_LIBS)
12575 AC_SUBST(LIBASSUAN_CFLAGS)
12576 AC_SUBST(LIBASSUAN_LIBS)
12577 AC_SUBST(GPGMEPP_CFLAGS)
12578 AC_SUBST(GPGMEPP_LIBS)
12580 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12581 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12582     AC_MSG_RESULT([yes])
12583     ENABLE_MEDIAWIKI=TRUE
12584     BUILD_TYPE="$BUILD_TYPE XSLTML"
12585     if test  "x$with_java" = "xno"; then
12586         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12587     fi
12588 else
12589     AC_MSG_RESULT([no])
12590     ENABLE_MEDIAWIKI=
12591     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12593 AC_SUBST(ENABLE_MEDIAWIKI)
12595 AC_MSG_CHECKING([whether to build the Report Builder])
12596 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12597     AC_MSG_RESULT([yes])
12598     ENABLE_REPORTBUILDER=TRUE
12599     AC_MSG_CHECKING([which jfreereport libs to use])
12600     if test "$with_system_jfreereport" = "yes"; then
12601         SYSTEM_JFREEREPORT=TRUE
12602         AC_MSG_RESULT([external])
12603         if test -z $SAC_JAR; then
12604             SAC_JAR=/usr/share/java/sac.jar
12605         fi
12606         if ! test -f $SAC_JAR; then
12607              AC_MSG_ERROR(sac.jar not found.)
12608         fi
12610         if test -z $LIBXML_JAR; then
12611             if test -f /usr/share/java/libxml-1.0.0.jar; then
12612                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12613             elif test -f /usr/share/java/libxml.jar; then
12614                 LIBXML_JAR=/usr/share/java/libxml.jar
12615             else
12616                 AC_MSG_ERROR(libxml.jar replacement not found.)
12617             fi
12618         elif ! test -f $LIBXML_JAR; then
12619             AC_MSG_ERROR(libxml.jar not found.)
12620         fi
12622         if test -z $FLUTE_JAR; then
12623             if test -f /usr/share/java/flute-1.3.0.jar; then
12624                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12625             elif test -f /usr/share/java/flute.jar; then
12626                 FLUTE_JAR=/usr/share/java/flute.jar
12627             else
12628                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12629             fi
12630         elif ! test -f $FLUTE_JAR; then
12631             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12632         fi
12634         if test -z $JFREEREPORT_JAR; then
12635             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12636                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12637             elif test -f /usr/share/java/flow-engine.jar; then
12638                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12639             else
12640                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12641             fi
12642         elif ! test -f  $JFREEREPORT_JAR; then
12643                 AC_MSG_ERROR(jfreereport.jar not found.)
12644         fi
12646         if test -z $LIBLAYOUT_JAR; then
12647             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12648                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12649             elif test -f /usr/share/java/liblayout.jar; then
12650                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12651             else
12652                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12653             fi
12654         elif ! test -f $LIBLAYOUT_JAR; then
12655                 AC_MSG_ERROR(liblayout.jar not found.)
12656         fi
12658         if test -z $LIBLOADER_JAR; then
12659             if test -f /usr/share/java/libloader-1.0.0.jar; then
12660                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12661             elif test -f /usr/share/java/libloader.jar; then
12662                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12663             else
12664                 AC_MSG_ERROR(libloader.jar replacement not found.)
12665             fi
12666         elif ! test -f  $LIBLOADER_JAR; then
12667             AC_MSG_ERROR(libloader.jar not found.)
12668         fi
12670         if test -z $LIBFORMULA_JAR; then
12671             if test -f /usr/share/java/libformula-0.2.0.jar; then
12672                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12673             elif test -f /usr/share/java/libformula.jar; then
12674                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12675             else
12676                 AC_MSG_ERROR(libformula.jar replacement not found.)
12677             fi
12678         elif ! test -f $LIBFORMULA_JAR; then
12679                 AC_MSG_ERROR(libformula.jar not found.)
12680         fi
12682         if test -z $LIBREPOSITORY_JAR; then
12683             if test -f /usr/share/java/librepository-1.0.0.jar; then
12684                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12685             elif test -f /usr/share/java/librepository.jar; then
12686                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12687             else
12688                 AC_MSG_ERROR(librepository.jar replacement not found.)
12689             fi
12690         elif ! test -f $LIBREPOSITORY_JAR; then
12691             AC_MSG_ERROR(librepository.jar not found.)
12692         fi
12694         if test -z $LIBFONTS_JAR; then
12695             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12696                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12697             elif test -f /usr/share/java/libfonts.jar; then
12698                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12699             else
12700                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12701             fi
12702         elif ! test -f $LIBFONTS_JAR; then
12703                 AC_MSG_ERROR(libfonts.jar not found.)
12704         fi
12706         if test -z $LIBSERIALIZER_JAR; then
12707             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12708                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12709             elif test -f /usr/share/java/libserializer.jar; then
12710                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12711             else
12712                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12713             fi
12714         elif ! test -f $LIBSERIALIZER_JAR; then
12715                 AC_MSG_ERROR(libserializer.jar not found.)
12716         fi
12718         if test -z $LIBBASE_JAR; then
12719             if test -f /usr/share/java/libbase-1.0.0.jar; then
12720                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12721             elif test -f /usr/share/java/libbase.jar; then
12722                 LIBBASE_JAR=/usr/share/java/libbase.jar
12723             else
12724                 AC_MSG_ERROR(libbase.jar replacement not found.)
12725             fi
12726         elif ! test -f $LIBBASE_JAR; then
12727             AC_MSG_ERROR(libbase.jar not found.)
12728         fi
12730     else
12731         AC_MSG_RESULT([internal])
12732         SYSTEM_JFREEREPORT=
12733         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12734         NEED_ANT=TRUE
12735     fi
12736 else
12737     AC_MSG_RESULT([no])
12738     ENABLE_REPORTBUILDER=
12739     SYSTEM_JFREEREPORT=
12741 AC_SUBST(ENABLE_REPORTBUILDER)
12742 AC_SUBST(SYSTEM_JFREEREPORT)
12743 AC_SUBST(SAC_JAR)
12744 AC_SUBST(LIBXML_JAR)
12745 AC_SUBST(FLUTE_JAR)
12746 AC_SUBST(JFREEREPORT_JAR)
12747 AC_SUBST(LIBBASE_JAR)
12748 AC_SUBST(LIBLAYOUT_JAR)
12749 AC_SUBST(LIBLOADER_JAR)
12750 AC_SUBST(LIBFORMULA_JAR)
12751 AC_SUBST(LIBREPOSITORY_JAR)
12752 AC_SUBST(LIBFONTS_JAR)
12753 AC_SUBST(LIBSERIALIZER_JAR)
12755 # scripting provider for BeanShell?
12756 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12757 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12758     AC_MSG_RESULT([yes])
12759     ENABLE_SCRIPTING_BEANSHELL=TRUE
12761     dnl ===================================================================
12762     dnl Check for system beanshell
12763     dnl ===================================================================
12764     AC_MSG_CHECKING([which beanshell to use])
12765     if test "$with_system_beanshell" = "yes"; then
12766         AC_MSG_RESULT([external])
12767         SYSTEM_BSH=TRUE
12768         if test -z $BSH_JAR; then
12769             BSH_JAR=/usr/share/java/bsh.jar
12770         fi
12771         if ! test -f $BSH_JAR; then
12772             AC_MSG_ERROR(bsh.jar not found.)
12773         fi
12774     else
12775         AC_MSG_RESULT([internal])
12776         SYSTEM_BSH=
12777         BUILD_TYPE="$BUILD_TYPE BSH"
12778     fi
12779 else
12780     AC_MSG_RESULT([no])
12781     ENABLE_SCRIPTING_BEANSHELL=
12782     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12784 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12785 AC_SUBST(SYSTEM_BSH)
12786 AC_SUBST(BSH_JAR)
12788 # scripting provider for JavaScript?
12789 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12790 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12791     AC_MSG_RESULT([yes])
12792     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12794     dnl ===================================================================
12795     dnl Check for system rhino
12796     dnl ===================================================================
12797     AC_MSG_CHECKING([which rhino to use])
12798     if test "$with_system_rhino" = "yes"; then
12799         AC_MSG_RESULT([external])
12800         SYSTEM_RHINO=TRUE
12801         if test -z $RHINO_JAR; then
12802             RHINO_JAR=/usr/share/java/js.jar
12803         fi
12804         if ! test -f $RHINO_JAR; then
12805             AC_MSG_ERROR(js.jar not found.)
12806         fi
12807     else
12808         AC_MSG_RESULT([internal])
12809         SYSTEM_RHINO=
12810         BUILD_TYPE="$BUILD_TYPE RHINO"
12811         NEED_ANT=TRUE
12812     fi
12813 else
12814     AC_MSG_RESULT([no])
12815     ENABLE_SCRIPTING_JAVASCRIPT=
12816     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12818 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12819 AC_SUBST(SYSTEM_RHINO)
12820 AC_SUBST(RHINO_JAR)
12822 # This is only used in Qt5/Qt6/KF5 checks to determine if /usr/lib64
12823 # paths should be added to library search path. So lets put all 64-bit
12824 # platforms there.
12825 supports_multilib=
12826 case "$host_cpu" in
12827 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
12828     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12829         supports_multilib="yes"
12830     fi
12831     ;;
12833     ;;
12834 esac
12836 dnl ===================================================================
12837 dnl QT5 Integration
12838 dnl ===================================================================
12840 QT5_CFLAGS=""
12841 QT5_LIBS=""
12842 QMAKE5="qmake"
12843 MOC5="moc"
12844 QT5_GOBJECT_CFLAGS=""
12845 QT5_GOBJECT_LIBS=""
12846 QT5_HAVE_GOBJECT=""
12847 QT5_PLATFORMS_SRCDIR=""
12848 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12849         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12850         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12851 then
12852     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12853     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12855     if test -n "$supports_multilib"; then
12856         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12857     fi
12859     qt5_test_include="QtWidgets/qapplication.h"
12860     if test "$_os" = "Emscripten"; then
12861         qt5_test_library="libQt5Widgets.a"
12862     else
12863         qt5_test_library="libQt5Widgets.so"
12864     fi
12866     dnl Check for qmake5
12867     if test -n "$QT5DIR"; then
12868         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12869     else
12870         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12871     fi
12872     if test "$QMAKE5" = "no"; then
12873         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12874     else
12875         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12876         if test -z "$qmake5_test_ver"; then
12877             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12878         fi
12879         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12880         qt5_minimal_minor="6"
12881         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12882             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12883         else
12884             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12885         fi
12886     fi
12888     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12889     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12890     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12891     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12893     AC_MSG_CHECKING([for Qt5 headers])
12894     qt5_incdir="no"
12895     for inc_dir in $qt5_incdirs; do
12896         if test -r "$inc_dir/$qt5_test_include"; then
12897             qt5_incdir="$inc_dir"
12898             break
12899         fi
12900     done
12901     AC_MSG_RESULT([$qt5_incdir])
12902     if test "x$qt5_incdir" = "xno"; then
12903         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12904     fi
12905     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12906     AC_LANG_PUSH([C++])
12907     save_CPPFLAGS=$CPPFLAGS
12908     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12909     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12910         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12911     CPPFLAGS=$save_CPPFLAGS
12912     AC_LANG_POP([C++])
12914     AC_MSG_CHECKING([for Qt5 libraries])
12915     qt5_libdir="no"
12916     for lib_dir in $qt5_libdirs; do
12917         if test -r "$lib_dir/$qt5_test_library"; then
12918             qt5_libdir="$lib_dir"
12919             break
12920         fi
12921     done
12922     AC_MSG_RESULT([$qt5_libdir])
12923     if test "x$qt5_libdir" = "xno"; then
12924         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12925     fi
12927     if test "$_os" = "Emscripten"; then
12928         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12929             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12930         fi
12931         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12932             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12933         fi
12935         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
12936         if ! test -x "$EMSDK_LLVM_NM"; then
12937             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
12938         fi
12939         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
12940             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
12941         fi
12942         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
12943         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
12944             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
12945         fi
12946         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
12947             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
12948         fi
12949     fi
12951     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12952     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12953     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12954     if test "$_os" = "Emscripten"; then
12955         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12956     fi
12958     if test "$USING_X11" = TRUE; then
12959         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12960         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12961             QT5_HAVE_XCB_ICCCM=1
12962             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12963         ],[
12964             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)])
12965             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12966         ])
12967         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12968         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12969         QT5_USING_X11=1
12970         AC_DEFINE(QT5_USING_X11)
12971     fi
12973     dnl Check for Meta Object Compiler
12975     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12976     if test "$MOC5" = "no"; then
12977         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12978 the root of your Qt installation by exporting QT5DIR before running "configure".])
12979     fi
12981     if test "$test_gstreamer_1_0" = yes; then
12982         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12983                 QT5_HAVE_GOBJECT=1
12984                 AC_DEFINE(QT5_HAVE_GOBJECT)
12985             ],
12986             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12987         )
12988     fi
12990 AC_SUBST(QT5_CFLAGS)
12991 AC_SUBST(QT5_LIBS)
12992 AC_SUBST(MOC5)
12993 AC_SUBST(QT5_GOBJECT_CFLAGS)
12994 AC_SUBST(QT5_GOBJECT_LIBS)
12995 AC_SUBST(QT5_HAVE_GOBJECT)
12996 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12998 dnl ===================================================================
12999 dnl QT6 Integration
13000 dnl ===================================================================
13002 QT6_CFLAGS=""
13003 QT6_LIBS=""
13004 QMAKE6="qmake"
13005 MOC6="moc"
13006 QT6_PLATFORMS_SRCDIR=""
13007 if test \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13008 then
13009     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13010     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13012     if test -n "$supports_multilib"; then
13013         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13014     fi
13016     qt6_test_include="QtWidgets/qapplication.h"
13017     if test "$_os" = "Emscripten"; then
13018         qt6_test_library="libQt6Widgets.a"
13019     else
13020         qt6_test_library="libQt6Widgets.so"
13021     fi
13023     dnl Check for qmake6
13024     if test -n "$QT6DIR"; then
13025         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13026     else
13027         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13028     fi
13029     if test "$QMAKE6" = "no"; then
13030         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13031     else
13032         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13033         if test -z "$qmake6_test_ver"; then
13034             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13035         fi
13036         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13037     fi
13039     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13040     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13041     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13042     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13044     AC_MSG_CHECKING([for Qt6 headers])
13045     qt6_incdir="no"
13046     for inc_dir in $qt6_incdirs; do
13047         if test -r "$inc_dir/$qt6_test_include"; then
13048             qt6_incdir="$inc_dir"
13049             break
13050         fi
13051     done
13052     AC_MSG_RESULT([$qt6_incdir])
13053     if test "x$qt6_incdir" = "xno"; then
13054         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13055     fi
13056     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13057     AC_LANG_PUSH([C++])
13058     save_CPPFLAGS=$CPPFLAGS
13059     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13060     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13061         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13062     CPPFLAGS=$save_CPPFLAGS
13063     AC_LANG_POP([C++])
13065     AC_MSG_CHECKING([for Qt6 libraries])
13066     qt6_libdir="no"
13067     for lib_dir in $qt6_libdirs; do
13068         if test -r "$lib_dir/$qt6_test_library"; then
13069             qt6_libdir="$lib_dir"
13070             break
13071         fi
13072     done
13073     AC_MSG_RESULT([$qt6_libdir])
13074     if test "x$qt6_libdir" = "xno"; then
13075         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13076     fi
13078     if test "$_os" = "Emscripten"; then
13079         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13080             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13081         fi
13082         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13083             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13084         fi
13085     fi
13087     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13088     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13089     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13090     if test "$_os" = "Emscripten"; then
13091         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13092     fi
13094     if test "$USING_X11" = TRUE; then
13095         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13096         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13097         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13098         QT6_USING_X11=1
13099         AC_DEFINE(QT6_USING_X11)
13100     fi
13102     dnl Check for Meta Object Compiler
13104     for lib_dir in $qt6_libdirs; do
13105         if test -z "$qt6_libexec_dirs"; then
13106             qt6_libexec_dirs="$lib_dir/libexec"
13107         else
13108             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13109         fi
13110     done
13111     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$qt6_libexec_dirs:$PATH])
13112     if test "$MOC6" = "no"; then
13113         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13114 the root of your Qt installation by exporting QT6DIR before running "configure".])
13115     fi
13117 AC_SUBST(QT6_CFLAGS)
13118 AC_SUBST(QT6_LIBS)
13119 AC_SUBST(MOC6)
13120 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13122 dnl ===================================================================
13123 dnl KF5 Integration
13124 dnl ===================================================================
13126 KF5_CFLAGS=""
13127 KF5_LIBS=""
13128 KF5_CONFIG="kf5-config"
13129 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13130         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13131 then
13132     if test "$OS" = "HAIKU"; then
13133         haiku_arch="`echo $RTL_ARCH | tr X x`"
13134         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13135         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13136     fi
13138     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13139     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13140     if test -n "$supports_multilib"; then
13141         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13142     fi
13144     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13145     kf5_test_library="libKF5KIOFileWidgets.so"
13146     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13148     dnl kf5 KDE4 support compatibility installed
13149     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13150     if test "$KF5_CONFIG" != "no"; then
13151         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13152         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13153     fi
13155     dnl Check for KF5 headers
13156     AC_MSG_CHECKING([for KF5 headers])
13157     kf5_incdir="no"
13158     for kf5_check in $kf5_incdirs; do
13159         if test -r "$kf5_check/$kf5_test_include"; then
13160             kf5_incdir="$kf5_check/KF5"
13161             break
13162         fi
13163     done
13164     AC_MSG_RESULT([$kf5_incdir])
13165     if test "x$kf5_incdir" = "xno"; then
13166         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13167     fi
13169     dnl Check for KF5 libraries
13170     AC_MSG_CHECKING([for KF5 libraries])
13171     kf5_libdir="no"
13172     for kf5_check in $kf5_libdirs; do
13173         if test -r "$kf5_check/$kf5_test_library"; then
13174             kf5_libdir="$kf5_check"
13175             break
13176         fi
13177     done
13179     AC_MSG_RESULT([$kf5_libdir])
13180     if test "x$kf5_libdir" = "xno"; then
13181         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13182     fi
13184     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"
13185     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13186     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13188     if test "$USING_X11" = TRUE; then
13189         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13190     fi
13192     AC_LANG_PUSH([C++])
13193     save_CXXFLAGS=$CXXFLAGS
13194     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13195     AC_MSG_CHECKING([whether KDE is >= 5.0])
13196        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13197 #include <kcoreaddons_version.h>
13199 int main(int argc, char **argv) {
13200        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13201        else return 1;
13203        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13204     CXXFLAGS=$save_CXXFLAGS
13205     AC_LANG_POP([C++])
13207 AC_SUBST(KF5_CFLAGS)
13208 AC_SUBST(KF5_LIBS)
13210 dnl ===================================================================
13211 dnl Test whether to include Evolution 2 support
13212 dnl ===================================================================
13213 AC_MSG_CHECKING([whether to enable evolution 2 support])
13214 if test "$enable_evolution2" = yes; then
13215     AC_MSG_RESULT([yes])
13216     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13217     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13218     FilterLibs "${GOBJECT_LIBS}"
13219     GOBJECT_LIBS="${filteredlibs}"
13220     ENABLE_EVOAB2="TRUE"
13221 else
13222     AC_MSG_RESULT([no])
13224 AC_SUBST(ENABLE_EVOAB2)
13225 AC_SUBST(GOBJECT_CFLAGS)
13226 AC_SUBST(GOBJECT_LIBS)
13228 dnl ===================================================================
13229 dnl Test which themes to include
13230 dnl ===================================================================
13231 AC_MSG_CHECKING([which themes to include])
13232 # if none given use default subset of available themes
13233 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13234     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"
13237 WITH_THEMES=""
13238 if test "x$with_theme" != "xno"; then
13239     for theme in $with_theme; do
13240         case $theme in
13241         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" ;;
13242         default) real_theme=colibre ;;
13243         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13244         esac
13245         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13246     done
13248 AC_MSG_RESULT([$WITH_THEMES])
13249 AC_SUBST([WITH_THEMES])
13250 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13251 for theme in $with_theme; do
13252     case $theme in
13253     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13254     *) ;;
13255     esac
13256 done
13258 ###############################################################################
13259 # Extensions checking
13260 ###############################################################################
13261 AC_MSG_CHECKING([for extensions integration])
13262 if test "x$enable_extension_integration" != "xno"; then
13263     WITH_EXTENSION_INTEGRATION=TRUE
13264     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13265     AC_MSG_RESULT([yes, use integration])
13266 else
13267     WITH_EXTENSION_INTEGRATION=
13268     AC_MSG_RESULT([no, do not integrate])
13270 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13272 dnl Should any extra extensions be included?
13273 dnl There are standalone tests for each of these below.
13274 WITH_EXTRA_EXTENSIONS=
13275 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13277 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13278 if test "x$with_java" != "xno"; then
13279     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13282 AC_MSG_CHECKING([whether to build opens___.ttf])
13283 if test "$enable_build_opensymbol" = "yes"; then
13284     AC_MSG_RESULT([yes])
13285     AC_PATH_PROG(FONTFORGE, fontforge)
13286     if test -z "$FONTFORGE"; then
13287         AC_MSG_ERROR([fontforge not installed])
13288     fi
13289 else
13290     AC_MSG_RESULT([no])
13291     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13293 AC_SUBST(FONTFORGE)
13295 dnl ===================================================================
13296 dnl Test whether to include fonts
13297 dnl ===================================================================
13298 AC_MSG_CHECKING([whether to include third-party fonts])
13299 if test "$with_fonts" != "no"; then
13300     AC_MSG_RESULT([yes])
13301     WITH_FONTS=TRUE
13302     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13303     AC_DEFINE(HAVE_MORE_FONTS)
13304 else
13305     AC_MSG_RESULT([no])
13306     WITH_FONTS=
13307     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13309 AC_SUBST(WITH_FONTS)
13312 dnl ===================================================================
13313 dnl Test whether to enable online update service
13314 dnl ===================================================================
13315 AC_MSG_CHECKING([whether to enable online update])
13316 ENABLE_ONLINE_UPDATE=
13317 ENABLE_ONLINE_UPDATE_MAR=
13318 UPDATE_CONFIG=
13319 if test "$enable_online_update" = ""; then
13320     AC_MSG_RESULT([no])
13321 else
13322     if test "$enable_online_update" = "mar"; then
13323         AC_MSG_RESULT([yes - MAR-based online update])
13324         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13325         if test "$with_update_config" = ""; then
13326             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13327         fi
13328         UPDATE_CONFIG="$with_update_config"
13329         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13330     elif test "$enable_online_update" = "yes"; then
13331         AC_MSG_RESULT([yes])
13332         ENABLE_ONLINE_UPDATE="TRUE"
13333     else
13334         AC_MSG_RESULT([no])
13335     fi
13337 AC_SUBST(ENABLE_ONLINE_UPDATE)
13338 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13339 AC_SUBST(UPDATE_CONFIG)
13342 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13343 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13344     if test "x$with_privacy_policy_url" = "xundefined"; then
13345         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13346     fi
13348 AC_SUBST(PRIVACY_POLICY_URL)
13349 dnl ===================================================================
13350 dnl Test whether we need bzip2
13351 dnl ===================================================================
13352 SYSTEM_BZIP2=
13353 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13354     AC_MSG_CHECKING([whether to use system bzip2])
13355     if test "$with_system_bzip2" = yes; then
13356         SYSTEM_BZIP2=TRUE
13357         AC_MSG_RESULT([yes])
13358         PKG_CHECK_MODULES(BZIP2, bzip2)
13359         FilterLibs "${BZIP2_LIBS}"
13360         BZIP2_LIBS="${filteredlibs}"
13361     else
13362         AC_MSG_RESULT([no])
13363         BUILD_TYPE="$BUILD_TYPE BZIP2"
13364     fi
13366 AC_SUBST(SYSTEM_BZIP2)
13367 AC_SUBST(BZIP2_CFLAGS)
13368 AC_SUBST(BZIP2_LIBS)
13370 dnl ===================================================================
13371 dnl Test whether to enable extension update
13372 dnl ===================================================================
13373 AC_MSG_CHECKING([whether to enable extension update])
13374 ENABLE_EXTENSION_UPDATE=
13375 if test "x$enable_extension_update" = "xno"; then
13376     AC_MSG_RESULT([no])
13377 else
13378     AC_MSG_RESULT([yes])
13379     ENABLE_EXTENSION_UPDATE="TRUE"
13380     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13381     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13383 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13386 dnl ===================================================================
13387 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13388 dnl ===================================================================
13389 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13390 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13391     AC_MSG_RESULT([no])
13392     ENABLE_SILENT_MSI=
13393 else
13394     AC_MSG_RESULT([yes])
13395     ENABLE_SILENT_MSI=TRUE
13396     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13398 AC_SUBST(ENABLE_SILENT_MSI)
13400 AC_MSG_CHECKING([whether and how to use Xinerama])
13401 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13402     if test "$x_libraries" = "default_x_libraries"; then
13403         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13404         if test "x$XINERAMALIB" = x; then
13405            XINERAMALIB="/usr/lib"
13406         fi
13407     else
13408         XINERAMALIB="$x_libraries"
13409     fi
13410     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13411         # we have both versions, let the user decide but use the dynamic one
13412         # per default
13413         USE_XINERAMA=TRUE
13414         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13415             XINERAMA_LINK=dynamic
13416         else
13417             XINERAMA_LINK=static
13418         fi
13419     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13420         # we have only the dynamic version
13421         USE_XINERAMA=TRUE
13422         XINERAMA_LINK=dynamic
13423     elif test -e "$XINERAMALIB/libXinerama.a"; then
13424         # static version
13425         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13426             USE_XINERAMA=TRUE
13427             XINERAMA_LINK=static
13428         else
13429             USE_XINERAMA=
13430             XINERAMA_LINK=none
13431         fi
13432     else
13433         # no Xinerama
13434         USE_XINERAMA=
13435         XINERAMA_LINK=none
13436     fi
13437     if test "$USE_XINERAMA" = "TRUE"; then
13438         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13439         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13440             [AC_MSG_ERROR(Xinerama header not found.)], [])
13441         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13442         if test "x$XEXTLIB" = x; then
13443            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13444         fi
13445         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13446         if test "$_os" = "FreeBSD"; then
13447             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13448         fi
13449         if test "$_os" = "Linux"; then
13450             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13451         fi
13452         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13453             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13454     else
13455         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13456     fi
13457 else
13458     USE_XINERAMA=
13459     XINERAMA_LINK=none
13460     AC_MSG_RESULT([no])
13462 AC_SUBST(USE_XINERAMA)
13463 AC_SUBST(XINERAMA_LINK)
13465 dnl ===================================================================
13466 dnl Test whether to build cairo or rely on the system version
13467 dnl ===================================================================
13469 if test "$test_cairo" = "yes"; then
13470     AC_MSG_CHECKING([whether to use the system cairo])
13472     : ${with_system_cairo:=$with_system_libs}
13473     if test "$with_system_cairo" = "yes"; then
13474         SYSTEM_CAIRO=TRUE
13475         AC_MSG_RESULT([yes])
13477         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
13478         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13479         FilterLibs "${CAIRO_LIBS}"
13480         CAIRO_LIBS="${filteredlibs}"
13482         if test "$test_xrender" = "yes"; then
13483             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13484             AC_LANG_PUSH([C])
13485             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13486 #ifdef PictStandardA8
13487 #else
13488       return fail;
13489 #endif
13490 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13492             AC_LANG_POP([C])
13493         fi
13494     else
13495         AC_MSG_RESULT([no])
13496         BUILD_TYPE="$BUILD_TYPE CAIRO"
13497     fi
13499     if test "$enable_cairo_canvas" != no; then
13500         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13501         ENABLE_CAIRO_CANVAS=TRUE
13502     fi
13505 AC_SUBST(CAIRO_CFLAGS)
13506 AC_SUBST(CAIRO_LIBS)
13507 AC_SUBST(ENABLE_CAIRO_CANVAS)
13508 AC_SUBST(SYSTEM_CAIRO)
13510 dnl ===================================================================
13511 dnl Test whether to use avahi
13512 dnl ===================================================================
13513 if test "$_os" = "WINNT"; then
13514     # Windows uses bundled mDNSResponder
13515     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13516 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13517     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13518                       [ENABLE_AVAHI="TRUE"])
13519     AC_DEFINE(HAVE_FEATURE_AVAHI)
13520     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13521     FilterLibs "${AVAHI_LIBS}"
13522     AVAHI_LIBS="${filteredlibs}"
13525 AC_SUBST(ENABLE_AVAHI)
13526 AC_SUBST(AVAHI_CFLAGS)
13527 AC_SUBST(AVAHI_LIBS)
13529 dnl ===================================================================
13530 dnl Test whether to use liblangtag
13531 dnl ===================================================================
13532 SYSTEM_LIBLANGTAG=
13533 AC_MSG_CHECKING([whether to use system liblangtag])
13534 if test "$with_system_liblangtag" = yes; then
13535     SYSTEM_LIBLANGTAG=TRUE
13536     AC_MSG_RESULT([yes])
13537     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13538     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13539     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13540     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13541     FilterLibs "${LIBLANGTAG_LIBS}"
13542     LIBLANGTAG_LIBS="${filteredlibs}"
13543 else
13544     SYSTEM_LIBLANGTAG=
13545     AC_MSG_RESULT([no])
13546     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13547     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13548     if test "$COM" = "MSC"; then
13549         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13550     else
13551         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13552     fi
13554 AC_SUBST(SYSTEM_LIBLANGTAG)
13555 AC_SUBST(LIBLANGTAG_CFLAGS)
13556 AC_SUBST(LIBLANGTAG_LIBS)
13558 dnl ===================================================================
13559 dnl Test whether to build libpng or rely on the system version
13560 dnl ===================================================================
13562 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13563 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13564 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13566 dnl ===================================================================
13567 dnl Test whether to build libtiff or rely on the system version
13568 dnl ===================================================================
13570 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
13572 dnl ===================================================================
13573 dnl Test whether to build libwebp or rely on the system version
13574 dnl ===================================================================
13576 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13578 dnl ===================================================================
13579 dnl Check for runtime JVM search path
13580 dnl ===================================================================
13581 if test "$ENABLE_JAVA" != ""; then
13582     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13583     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13584         AC_MSG_RESULT([yes])
13585         if ! test -d "$with_jvm_path"; then
13586             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13587         fi
13588         if ! test -d "$with_jvm_path"jvm; then
13589             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13590         fi
13591         JVM_ONE_PATH_CHECK="$with_jvm_path"
13592         AC_SUBST(JVM_ONE_PATH_CHECK)
13593     else
13594         AC_MSG_RESULT([no])
13595     fi
13598 dnl ===================================================================
13599 dnl Test for the presence of Ant and that it works
13600 dnl ===================================================================
13602 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13603     ANT_HOME=; export ANT_HOME
13604     WITH_ANT_HOME=; export WITH_ANT_HOME
13605     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13606         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13607             if test "$_os" = "WINNT"; then
13608                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13609             else
13610                 with_ant_home="$LODE_HOME/opt/ant"
13611             fi
13612         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13613             with_ant_home="$LODE_HOME/opt/ant"
13614         fi
13615     fi
13616     if test -z "$with_ant_home"; then
13617         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13618     else
13619         if test "$_os" = "WINNT"; then
13620             # AC_PATH_PROGS needs unix path
13621             with_ant_home=`cygpath -u "$with_ant_home"`
13622         fi
13623         AbsolutePath "$with_ant_home"
13624         with_ant_home=$absolute_path
13625         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13626         WITH_ANT_HOME=$with_ant_home
13627         ANT_HOME=$with_ant_home
13628     fi
13630     if test -z "$ANT"; then
13631         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13632     else
13633         # resolve relative or absolute symlink
13634         while test -h "$ANT"; do
13635             a_cwd=`pwd`
13636             a_basename=`basename "$ANT"`
13637             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13638             cd "`dirname "$ANT"`"
13639             cd "`dirname "$a_script"`"
13640             ANT="`pwd`"/"`basename "$a_script"`"
13641             cd "$a_cwd"
13642         done
13644         AC_MSG_CHECKING([if $ANT works])
13645         mkdir -p conftest.dir
13646         a_cwd=$(pwd)
13647         cd conftest.dir
13648         cat > conftest.java << EOF
13649         public class conftest {
13650             int testmethod(int a, int b) {
13651                     return a + b;
13652             }
13653         }
13656         cat > conftest.xml << EOF
13657         <project name="conftest" default="conftest">
13658         <target name="conftest">
13659             <javac srcdir="." includes="conftest.java">
13660             </javac>
13661         </target>
13662         </project>
13665         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13666         if test $? = 0 -a -f ./conftest.class; then
13667             AC_MSG_RESULT([Ant works])
13668             if test -z "$WITH_ANT_HOME"; then
13669                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13670                 if test -z "$ANT_HOME"; then
13671                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13672                 fi
13673             else
13674                 ANT_HOME="$WITH_ANT_HOME"
13675             fi
13676         else
13677             echo "configure: Ant test failed" >&5
13678             cat conftest.java >&5
13679             cat conftest.xml >&5
13680             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13681         fi
13682         cd "$a_cwd"
13683         rm -fr conftest.dir
13684     fi
13685     if test -z "$ANT_HOME"; then
13686         ANT_HOME="NO_ANT_HOME"
13687     else
13688         PathFormat "$ANT_HOME"
13689         ANT_HOME="$formatted_path"
13690         PathFormat "$ANT"
13691         ANT="$formatted_path"
13692     fi
13694     dnl Checking for ant.jar
13695     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13696         AC_MSG_CHECKING([Ant lib directory])
13697         if test -f $ANT_HOME/lib/ant.jar; then
13698             ANT_LIB="$ANT_HOME/lib"
13699         else
13700             if test -f $ANT_HOME/ant.jar; then
13701                 ANT_LIB="$ANT_HOME"
13702             else
13703                 if test -f /usr/share/java/ant.jar; then
13704                     ANT_LIB=/usr/share/java
13705                 else
13706                     if test -f /usr/share/ant-core/lib/ant.jar; then
13707                         ANT_LIB=/usr/share/ant-core/lib
13708                     else
13709                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13710                             ANT_LIB="$ANT_HOME/lib/ant"
13711                         else
13712                             if test -f /usr/share/lib/ant/ant.jar; then
13713                                 ANT_LIB=/usr/share/lib/ant
13714                             else
13715                                 AC_MSG_ERROR([Ant libraries not found!])
13716                             fi
13717                         fi
13718                     fi
13719                 fi
13720             fi
13721         fi
13722         PathFormat "$ANT_LIB"
13723         ANT_LIB="$formatted_path"
13724         AC_MSG_RESULT([Ant lib directory found.])
13725     fi
13727     ant_minver=1.6.0
13728     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13730     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13731     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13732     ant_version_major=`echo $ant_version | cut -d. -f1`
13733     ant_version_minor=`echo $ant_version | cut -d. -f2`
13734     echo "configure: ant_version $ant_version " >&5
13735     echo "configure: ant_version_major $ant_version_major " >&5
13736     echo "configure: ant_version_minor $ant_version_minor " >&5
13737     if test "$ant_version_major" -ge "2"; then
13738         AC_MSG_RESULT([yes, $ant_version])
13739     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13740         AC_MSG_RESULT([yes, $ant_version])
13741     else
13742         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13743     fi
13745     rm -f conftest* core core.* *.core
13747 AC_SUBST(ANT)
13748 AC_SUBST(ANT_HOME)
13749 AC_SUBST(ANT_LIB)
13751 OOO_JUNIT_JAR=
13752 HAMCREST_JAR=
13753 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13754     AC_MSG_CHECKING([for JUnit 4])
13755     if test "$with_junit" = "yes"; then
13756         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13757             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13758         elif test -e /usr/share/java/junit4.jar; then
13759             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13760         else
13761            if test -e /usr/share/lib/java/junit.jar; then
13762               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13763            else
13764               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13765            fi
13766         fi
13767     else
13768         OOO_JUNIT_JAR=$with_junit
13769     fi
13770     if test "$_os" = "WINNT"; then
13771         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13772     fi
13773     printf 'import org.junit.Before;' > conftest.java
13774     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13775         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13776     else
13777         AC_MSG_ERROR(
13778 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13779  specify its pathname via --with-junit=..., or disable it via --without-junit])
13780     fi
13781     rm -f conftest.class conftest.java
13782     if test $OOO_JUNIT_JAR != ""; then
13783         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13784     fi
13786     AC_MSG_CHECKING([for included Hamcrest])
13787     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13788     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13789         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13790     else
13791         AC_MSG_RESULT([Not included])
13792         AC_MSG_CHECKING([for standalone hamcrest jar.])
13793         if test "$with_hamcrest" = "yes"; then
13794             if test -e /usr/share/lib/java/hamcrest.jar; then
13795                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13796             elif test -e /usr/share/java/hamcrest/core.jar; then
13797                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13798             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13799                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13800             else
13801                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13802             fi
13803         else
13804             HAMCREST_JAR=$with_hamcrest
13805         fi
13806         if test "$_os" = "WINNT"; then
13807             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13808         fi
13809         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13810             AC_MSG_RESULT([$HAMCREST_JAR])
13811         else
13812             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),
13813                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13814         fi
13815     fi
13816     rm -f conftest.class conftest.java
13818 AC_SUBST(OOO_JUNIT_JAR)
13819 AC_SUBST(HAMCREST_JAR)
13822 AC_SUBST(SCPDEFS)
13825 # check for wget and curl
13827 WGET=
13828 CURL=
13830 if test "$enable_fetch_external" != "no"; then
13832 CURL=`which curl 2>/dev/null`
13834 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13835     # wget new enough?
13836     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13837     if test $? -eq 0; then
13838         WGET=$i
13839         break
13840     fi
13841 done
13843 if test -z "$WGET" -a -z "$CURL"; then
13844     AC_MSG_ERROR([neither wget nor curl found!])
13849 AC_SUBST(WGET)
13850 AC_SUBST(CURL)
13853 # check for sha256sum
13855 SHA256SUM=
13857 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13858     eval "$i -a 256 --version" > /dev/null 2>&1
13859     ret=$?
13860     if test $ret -eq 0; then
13861         SHA256SUM="$i -a 256"
13862         break
13863     fi
13864 done
13866 if test -z "$SHA256SUM"; then
13867     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13868         eval "$i --version" > /dev/null 2>&1
13869         ret=$?
13870         if test $ret -eq 0; then
13871             SHA256SUM=$i
13872             break
13873         fi
13874     done
13877 if test -z "$SHA256SUM"; then
13878     AC_MSG_ERROR([no sha256sum found!])
13881 AC_SUBST(SHA256SUM)
13883 dnl ===================================================================
13884 dnl Dealing with l10n options
13885 dnl ===================================================================
13886 AC_MSG_CHECKING([which languages to be built])
13887 # get list of all languages
13888 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13889 # the sed command does the following:
13890 #   + if a line ends with a backslash, append the next line to it
13891 #   + adds " on the beginning of the value (after =)
13892 #   + adds " at the end of the value
13893 #   + removes en-US; we want to put it on the beginning
13894 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13895 [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)]
13896 ALL_LANGS="en-US $completelangiso"
13897 # check the configured localizations
13898 WITH_LANG="$with_lang"
13900 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13901 # (Norwegian is "nb" and "nn".)
13902 if test "$WITH_LANG" = "no"; then
13903     WITH_LANG=
13906 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13907     AC_MSG_RESULT([en-US])
13908 else
13909     AC_MSG_RESULT([$WITH_LANG])
13910     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13911     if test -z "$MSGFMT"; then
13912         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13913             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13914         elif test -x "/opt/lo/bin/msgfmt"; then
13915             MSGFMT="/opt/lo/bin/msgfmt"
13916         else
13917             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13918             if test -z "$MSGFMT"; then
13919                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13920             fi
13921         fi
13922     fi
13923     if test -z "$MSGUNIQ"; then
13924         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13925             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13926         elif test -x "/opt/lo/bin/msguniq"; then
13927             MSGUNIQ="/opt/lo/bin/msguniq"
13928         else
13929             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13930             if test -z "$MSGUNIQ"; then
13931                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13932             fi
13933         fi
13934     fi
13936 AC_SUBST(MSGFMT)
13937 AC_SUBST(MSGUNIQ)
13938 # check that the list is valid
13939 for lang in $WITH_LANG; do
13940     test "$lang" = "ALL" && continue
13941     # need to check for the exact string, so add space before and after the list of all languages
13942     for vl in $ALL_LANGS; do
13943         if test "$vl" = "$lang"; then
13944            break
13945         fi
13946     done
13947     if test "$vl" != "$lang"; then
13948         # if you're reading this - you prolly quoted your languages remove the quotes ...
13949         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13950     fi
13951 done
13952 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13953     echo $WITH_LANG | grep -q en-US
13954     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13956 # list with substituted ALL
13957 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13958 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13959 test "$WITH_LANG" = "en-US" && WITH_LANG=
13960 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13961     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13962     ALL_LANGS=`echo $ALL_LANGS qtz`
13964 AC_SUBST(ALL_LANGS)
13965 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13966 AC_SUBST(WITH_LANG)
13967 AC_SUBST(WITH_LANG_LIST)
13968 AC_SUBST(GIT_NEEDED_SUBMODULES)
13970 WITH_POOR_HELP_LOCALIZATIONS=
13971 if test -d "$SRC_ROOT/translations/source"; then
13972     for l in `ls -1 $SRC_ROOT/translations/source`; do
13973         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13974             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13975         fi
13976     done
13978 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13980 if test -n "$with_locales" -a "$with_locales" != ALL; then
13981     WITH_LOCALES="$with_locales"
13983     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13984     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13985     # config_host/config_locales.h.in
13986     for locale in $WITH_LOCALES; do
13987         lang=${locale%_*}
13989         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13991         case $lang in
13992         hi|mr*ne)
13993             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13994             ;;
13995         bg|ru)
13996             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13997             ;;
13998         esac
13999     done
14000 else
14001     AC_DEFINE(WITH_LOCALE_ALL)
14003 AC_SUBST(WITH_LOCALES)
14005 dnl git submodule update --reference
14006 dnl ===================================================================
14007 if test -n "${GIT_REFERENCE_SRC}"; then
14008     for repo in ${GIT_NEEDED_SUBMODULES}; do
14009         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14010             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14011         fi
14012     done
14014 AC_SUBST(GIT_REFERENCE_SRC)
14016 dnl git submodules linked dirs
14017 dnl ===================================================================
14018 if test -n "${GIT_LINK_SRC}"; then
14019     for repo in ${GIT_NEEDED_SUBMODULES}; do
14020         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14021             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14022         fi
14023     done
14025 AC_SUBST(GIT_LINK_SRC)
14027 dnl branding
14028 dnl ===================================================================
14029 AC_MSG_CHECKING([for alternative branding images directory])
14030 # initialize mapped arrays
14031 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14032 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14034 if test -z "$with_branding" -o "$with_branding" = "no"; then
14035     AC_MSG_RESULT([none])
14036     DEFAULT_BRAND_IMAGES="$brand_files"
14037 else
14038     if ! test -d $with_branding ; then
14039         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14040     else
14041         AC_MSG_RESULT([$with_branding])
14042         CUSTOM_BRAND_DIR="$with_branding"
14043         for lfile in $brand_files
14044         do
14045             if ! test -f $with_branding/$lfile ; then
14046                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14047                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14048             else
14049                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14050             fi
14051         done
14052         check_for_progress="yes"
14053     fi
14055 AC_SUBST([BRAND_INTRO_IMAGES])
14056 AC_SUBST([CUSTOM_BRAND_DIR])
14057 AC_SUBST([CUSTOM_BRAND_IMAGES])
14058 AC_SUBST([DEFAULT_BRAND_IMAGES])
14061 AC_MSG_CHECKING([for 'intro' progress settings])
14062 PROGRESSBARCOLOR=
14063 PROGRESSSIZE=
14064 PROGRESSPOSITION=
14065 PROGRESSFRAMECOLOR=
14066 PROGRESSTEXTCOLOR=
14067 PROGRESSTEXTBASELINE=
14069 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14070     source "$with_branding/progress.conf"
14071     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14072 else
14073     AC_MSG_RESULT([none])
14076 AC_SUBST(PROGRESSBARCOLOR)
14077 AC_SUBST(PROGRESSSIZE)
14078 AC_SUBST(PROGRESSPOSITION)
14079 AC_SUBST(PROGRESSFRAMECOLOR)
14080 AC_SUBST(PROGRESSTEXTCOLOR)
14081 AC_SUBST(PROGRESSTEXTBASELINE)
14084 dnl ===================================================================
14085 dnl Custom build version
14086 dnl ===================================================================
14087 AC_MSG_CHECKING([for extra build ID])
14088 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14089     EXTRA_BUILDID="$with_extra_buildid"
14091 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14092 if test -n "$EXTRA_BUILDID" ; then
14093     AC_MSG_RESULT([$EXTRA_BUILDID])
14094 else
14095     AC_MSG_RESULT([not set])
14097 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14099 OOO_VENDOR=
14100 AC_MSG_CHECKING([for vendor])
14101 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14102     OOO_VENDOR="$USERNAME"
14104     if test -z "$OOO_VENDOR"; then
14105         OOO_VENDOR="$USER"
14106     fi
14108     if test -z "$OOO_VENDOR"; then
14109         OOO_VENDOR="`id -u -n`"
14110     fi
14112     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14113 else
14114     OOO_VENDOR="$with_vendor"
14115     AC_MSG_RESULT([$OOO_VENDOR])
14117 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14118 AC_SUBST(OOO_VENDOR)
14120 if test "$_os" = "Android" ; then
14121     ANDROID_PACKAGE_NAME=
14122     AC_MSG_CHECKING([for Android package name])
14123     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14124         if test -n "$ENABLE_DEBUG"; then
14125             # Default to the package name that makes ndk-gdb happy.
14126             ANDROID_PACKAGE_NAME="org.libreoffice"
14127         else
14128             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14129         fi
14131         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14132     else
14133         ANDROID_PACKAGE_NAME="$with_android_package_name"
14134         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14135     fi
14136     AC_SUBST(ANDROID_PACKAGE_NAME)
14139 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14140 if test "$with_compat_oowrappers" = "yes"; then
14141     WITH_COMPAT_OOWRAPPERS=TRUE
14142     AC_MSG_RESULT(yes)
14143 else
14144     WITH_COMPAT_OOWRAPPERS=
14145     AC_MSG_RESULT(no)
14147 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14149 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14150 AC_MSG_CHECKING([for install dirname])
14151 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14152     INSTALLDIRNAME="$with_install_dirname"
14154 AC_MSG_RESULT([$INSTALLDIRNAME])
14155 AC_SUBST(INSTALLDIRNAME)
14157 AC_MSG_CHECKING([for prefix])
14158 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14159 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14160 PREFIXDIR="$prefix"
14161 AC_MSG_RESULT([$PREFIXDIR])
14162 AC_SUBST(PREFIXDIR)
14164 LIBDIR=[$(eval echo $(eval echo $libdir))]
14165 AC_SUBST(LIBDIR)
14167 DATADIR=[$(eval echo $(eval echo $datadir))]
14168 AC_SUBST(DATADIR)
14170 MANDIR=[$(eval echo $(eval echo $mandir))]
14171 AC_SUBST(MANDIR)
14173 DOCDIR=[$(eval echo $(eval echo $docdir))]
14174 AC_SUBST(DOCDIR)
14176 BINDIR=[$(eval echo $(eval echo $bindir))]
14177 AC_SUBST(BINDIR)
14179 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14180 AC_SUBST(INSTALLDIR)
14182 TESTINSTALLDIR="${BUILDDIR}/test-install"
14183 AC_SUBST(TESTINSTALLDIR)
14186 # ===================================================================
14187 # OAuth2 id and secrets
14188 # ===================================================================
14190 AC_MSG_CHECKING([for Google Drive client id and secret])
14191 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14192     AC_MSG_RESULT([not set])
14193     GDRIVE_CLIENT_ID="\"\""
14194     GDRIVE_CLIENT_SECRET="\"\""
14195 else
14196     AC_MSG_RESULT([set])
14197     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14198     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14200 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14201 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14203 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14204 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14205     AC_MSG_RESULT([not set])
14206     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14207     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14208 else
14209     AC_MSG_RESULT([set])
14210     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14211     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14213 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14214 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14216 AC_MSG_CHECKING([for OneDrive client id and secret])
14217 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14218     AC_MSG_RESULT([not set])
14219     ONEDRIVE_CLIENT_ID="\"\""
14220     ONEDRIVE_CLIENT_SECRET="\"\""
14221 else
14222     AC_MSG_RESULT([set])
14223     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14224     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14226 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14227 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14230 dnl ===================================================================
14231 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14232 dnl --enable-dependency-tracking configure option
14233 dnl ===================================================================
14234 AC_MSG_CHECKING([whether to enable dependency tracking])
14235 if test "$enable_dependency_tracking" = "no"; then
14236     nodep=TRUE
14237     AC_MSG_RESULT([no])
14238 else
14239     AC_MSG_RESULT([yes])
14241 AC_SUBST(nodep)
14243 dnl ===================================================================
14244 dnl Number of CPUs to use during the build
14245 dnl ===================================================================
14246 AC_MSG_CHECKING([for number of processors to use])
14247 # plain --with-parallelism is just the default
14248 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14249     if test "$with_parallelism" = "no"; then
14250         PARALLELISM=0
14251     else
14252         PARALLELISM=$with_parallelism
14253     fi
14254 else
14255     if test "$enable_icecream" = "yes"; then
14256         PARALLELISM="40"
14257     else
14258         case `uname -s` in
14260         Darwin|FreeBSD|NetBSD|OpenBSD)
14261             PARALLELISM=`sysctl -n hw.ncpu`
14262             ;;
14264         Linux)
14265             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14266         ;;
14267         # what else than above does profit here *and* has /proc?
14268         *)
14269             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14270             ;;
14271         esac
14273         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14274         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14275     fi
14278 if test $PARALLELISM -eq 0; then
14279     AC_MSG_RESULT([explicit make -j option needed])
14280 else
14281     AC_MSG_RESULT([$PARALLELISM])
14283 AC_SUBST(PARALLELISM)
14286 # Set up ILIB for MSVC build
14288 ILIB1=
14289 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
14290     ILIB="."
14291     if test -n "$JAVA_HOME"; then
14292         ILIB="$ILIB;$JAVA_HOME/lib"
14293     fi
14294     ILIB1=-link
14295     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14296     ILIB="$ILIB;$formatted_path"
14297     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14298     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14299     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14300     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14301         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14302         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14303     fi
14304     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14305     ucrtlibpath_formatted=$formatted_path
14306     ILIB="$ILIB;$ucrtlibpath_formatted"
14307     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14308     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14309         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14310         ILIB="$ILIB;$formatted_path"
14311     else
14312         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14313         ILIB="$ILIB;$formatted_path"
14314     fi
14316     if test "$cross_compiling" != "yes"; then
14317         ILIB_FOR_BUILD="$ILIB"
14318     fi
14320 AC_SUBST(ILIB)
14321 AC_SUBST(ILIB_FOR_BUILD)
14323 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14324 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14325 dnl from consteval constructor initializing const variable",
14326 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14327 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14328 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14329 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'",
14330 dnl <https://developercommunity.visualstudio.com/t/1581879> "Bogus error C7595 with consteval
14331 dnl constructor in ternary expression (/std:c++latest)", or
14332 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14333 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14334 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14335 dnl && "Ptr must be a pointer to Val type!"' failed.":
14336 AC_LANG_PUSH([C++])
14337 save_CXX=$CXX
14338 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14339     CXX="env LIB=$ILIB $CXX"
14341 save_CXXFLAGS=$CXXFLAGS
14342 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14343 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14344         struct S {
14345             consteval S() { i = 1; }
14346             int i = 0;
14347         };
14348         S const s;
14350         struct S1 { consteval S1(int) {} };
14351         struct S2 {
14352             S1 x;
14353             S2(): x(0) {}
14354         };
14356         struct S3 {
14357             consteval S3() {}
14358             union {
14359                 int a;
14360                 unsigned b = 0;
14361             };
14362         };
14363         void f() { S3(); }
14365         struct S4 { consteval S4() = default; };
14366         void f4(bool b) { b ? S4() : S4(); }
14368         struct S5 {
14369             consteval S5() { c = 0; }
14370             char * f() { return &c; }
14371             union {
14372                 char c;
14373                 int i;
14374             };
14375         };
14376         auto s5 = S5().f();
14377     ], [
14378         return (s.i == 1) ? 0 : 1;
14379     ])], [
14380         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14381         AC_MSG_RESULT([yes])
14382     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14383 CXX=$save_CXX
14384 CXXFLAGS=$save_CXXFLAGS
14385 AC_LANG_POP([C++])
14387 # ===================================================================
14388 # Creating bigger shared library to link against
14389 # ===================================================================
14390 AC_MSG_CHECKING([whether to create huge library])
14391 MERGELIBS=
14393 if test $_os = iOS -o $_os = Android; then
14394     # Never any point in mergelibs for these as we build just static
14395     # libraries anyway...
14396     enable_mergelibs=no
14399 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14400     if test $_os != Linux -a $_os != WINNT; then
14401         add_warning "--enable-mergelibs is not tested for this platform"
14402     fi
14403     MERGELIBS="TRUE"
14404     AC_MSG_RESULT([yes])
14405     AC_DEFINE(ENABLE_MERGELIBS)
14406 else
14407     AC_MSG_RESULT([no])
14409 AC_SUBST([MERGELIBS])
14411 dnl ===================================================================
14412 dnl icerun is a wrapper that stops us spawning tens of processes
14413 dnl locally - for tools that can't be executed on the compile cluster
14414 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14415 dnl ===================================================================
14416 AC_MSG_CHECKING([whether to use icerun wrapper])
14417 ICECREAM_RUN=
14418 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14419     ICECREAM_RUN=icerun
14420     AC_MSG_RESULT([yes])
14421 else
14422     AC_MSG_RESULT([no])
14424 AC_SUBST(ICECREAM_RUN)
14426 dnl ===================================================================
14427 dnl Setup the ICECC_VERSION for the build the same way it was set for
14428 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14429 dnl ===================================================================
14430 x_ICECC_VERSION=[\#]
14431 if test -n "$ICECC_VERSION" ; then
14432     x_ICECC_VERSION=
14434 AC_SUBST(x_ICECC_VERSION)
14435 AC_SUBST(ICECC_VERSION)
14437 dnl ===================================================================
14439 AC_MSG_CHECKING([MPL subset])
14440 MPL_SUBSET=
14442 if test "$enable_mpl_subset" = "yes"; then
14443     warn_report=false
14444     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14445         warn_report=true
14446     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14447         warn_report=true
14448     fi
14449     if test "$warn_report" = "true"; then
14450         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14451     fi
14452     if test "x$enable_postgresql_sdbc" != "xno"; then
14453         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14454     fi
14455     if test "$enable_lotuswordpro" = "yes"; then
14456         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14457     fi
14458     if test -n "$ENABLE_POPPLER"; then
14459         if test "x$SYSTEM_POPPLER" = "x"; then
14460             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14461         fi
14462     fi
14463     # cf. m4/libo_check_extension.m4
14464     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14465         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14466     fi
14467     for theme in $WITH_THEMES; do
14468         case $theme in
14469         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14470             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14471         *) : ;;
14472         esac
14473     done
14475     ENABLE_OPENGL_TRANSITIONS=
14477     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14478         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14479     fi
14481     MPL_SUBSET="TRUE"
14482     AC_DEFINE(MPL_HAVE_SUBSET)
14483     AC_MSG_RESULT([only])
14484 else
14485     AC_MSG_RESULT([no restrictions])
14487 AC_SUBST(MPL_SUBSET)
14489 dnl ===================================================================
14491 AC_MSG_CHECKING([formula logger])
14492 ENABLE_FORMULA_LOGGER=
14494 if test "x$enable_formula_logger" = "xyes"; then
14495     AC_MSG_RESULT([yes])
14496     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14497     ENABLE_FORMULA_LOGGER=TRUE
14498 elif test -n "$ENABLE_DBGUTIL" ; then
14499     AC_MSG_RESULT([yes])
14500     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14501     ENABLE_FORMULA_LOGGER=TRUE
14502 else
14503     AC_MSG_RESULT([no])
14506 AC_SUBST(ENABLE_FORMULA_LOGGER)
14508 dnl ===================================================================
14509 dnl Checking for active Antivirus software.
14510 dnl ===================================================================
14512 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14513     AC_MSG_CHECKING([for active Antivirus software])
14514     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
14515     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
14516     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14517         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14518             AC_MSG_RESULT([found])
14519             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14520             echo $EICAR_STRING > $SRC_ROOT/eicar
14521             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14522             rm $SRC_ROOT/eicar
14523             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14524                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14525             fi
14526             echo $EICAR_STRING > $BUILDDIR/eicar
14527             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14528             rm $BUILDDIR/eicar
14529             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14530                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14531             fi
14532             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"
14533         else
14534             AC_MSG_RESULT([not found])
14535         fi
14536     else
14537         AC_MSG_RESULT([n/a])
14538     fi
14541 dnl ===================================================================
14542 dnl Setting up the environment.
14543 dnl ===================================================================
14544 AC_MSG_NOTICE([setting up the build environment variables...])
14546 AC_SUBST(COMPATH)
14548 if test "$build_os" = "cygwin" -o "$build_os" = wsl; then
14549     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14550         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14551         ATL_INCLUDE="$COMPATH/atlmfc/include"
14552     elif test -d "$COMPATH/atlmfc/lib"; then
14553         ATL_LIB="$COMPATH/atlmfc/lib"
14554         ATL_INCLUDE="$COMPATH/atlmfc/include"
14555     else
14556         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14557         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14558     fi
14559     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14560     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14561     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14564 if test "$build_os" = "cygwin"; then
14565     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14566     PathFormat "/usr/bin/find.exe"
14567     FIND="$formatted_path"
14568     PathFormat "/usr/bin/sort.exe"
14569     SORT="$formatted_path"
14570     PathFormat "/usr/bin/grep.exe"
14571     WIN_GREP="$formatted_path"
14572     PathFormat "/usr/bin/ls.exe"
14573     WIN_LS="$formatted_path"
14574     PathFormat "/usr/bin/touch.exe"
14575     WIN_TOUCH="$formatted_path"
14576 else
14577     FIND=find
14578     SORT=sort
14581 AC_SUBST(ATL_INCLUDE)
14582 AC_SUBST(ATL_LIB)
14583 AC_SUBST(FIND)
14584 AC_SUBST(SORT)
14585 AC_SUBST(WIN_GREP)
14586 AC_SUBST(WIN_LS)
14587 AC_SUBST(WIN_TOUCH)
14589 AC_SUBST(BUILD_TYPE)
14591 AC_SUBST(SOLARINC)
14593 PathFormat "$PERL"
14594 PERL="$formatted_path"
14595 AC_SUBST(PERL)
14597 if test -n "$TMPDIR"; then
14598     TEMP_DIRECTORY="$TMPDIR"
14599 else
14600     TEMP_DIRECTORY="/tmp"
14602 if test "$build_os" = "cygwin"; then
14603     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14605 AC_SUBST(TEMP_DIRECTORY)
14607 # setup the PATH for the environment
14608 if test -n "$LO_PATH_FOR_BUILD"; then
14609     LO_PATH="$LO_PATH_FOR_BUILD"
14610     case "$host_os" in
14611     cygwin*|wsl*)
14612         pathmunge "$MSVC_HOST_PATH" "before"
14613         ;;
14614     esac
14615 else
14616     LO_PATH="$PATH"
14618     case "$host_os" in
14620     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14621         if test "$ENABLE_JAVA" != ""; then
14622             pathmunge "$JAVA_HOME/bin" "after"
14623         fi
14624         ;;
14626     cygwin*|wsl*)
14627         # Win32 make needs native paths
14628         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14629             LO_PATH=`cygpath -p -m "$PATH"`
14630         fi
14631         if test "$WIN_BUILD_ARCH" = "x64"; then
14632             # needed for msi packaging
14633             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14634         fi
14635         # .NET 4.6 and higher don't have bin directory
14636         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14637             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14638         fi
14639         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14640         pathmunge "$CSC_PATH" "before"
14641         pathmunge "$MIDL_PATH" "before"
14642         pathmunge "$AL_PATH" "before"
14643         pathmunge "$MSVC_MULTI_PATH" "before"
14644         pathmunge "$MSVC_BUILD_PATH" "before"
14645         if test -n "$MSBUILD_PATH" ; then
14646             pathmunge "$MSBUILD_PATH" "before"
14647         fi
14648         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14649         if test "$ENABLE_JAVA" != ""; then
14650             if test -d "$JAVA_HOME/jre/bin/client"; then
14651                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14652             fi
14653             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14654                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14655             fi
14656             pathmunge "$JAVA_HOME/bin" "before"
14657         fi
14658         pathmunge "$MSVC_HOST_PATH" "before"
14659         ;;
14661     solaris*)
14662         pathmunge "/usr/css/bin" "before"
14663         if test "$ENABLE_JAVA" != ""; then
14664             pathmunge "$JAVA_HOME/bin" "after"
14665         fi
14666         ;;
14667     esac
14670 AC_SUBST(LO_PATH)
14672 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14673 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14674     x_LO_ELFCHECK_ALLOWLIST=
14675 else
14676     x_LO_ELFCHECK_ALLOWLIST=[\#]
14678 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14679 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14681 libo_FUZZ_SUMMARY
14683 # Generate a configuration sha256 we can use for deps
14684 if test -f config_host.mk; then
14685     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14687 if test -f config_host_lang.mk; then
14688     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14691 CFLAGS=$my_original_CFLAGS
14692 CXXFLAGS=$my_original_CXXFLAGS
14693 CPPFLAGS=$my_original_CPPFLAGS
14695 AC_CONFIG_LINKS([include:include])
14697 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14698 # BUILD platform configuration] - otherwise breaks cross building
14699 AC_CONFIG_FILES([config_host.mk
14700                  config_host_lang.mk
14701                  Makefile
14702                  lo.xcent
14703                  bin/bffvalidator.sh
14704                  bin/odfvalidator.sh
14705                  bin/officeotron.sh
14706                  hardened_runtime.xcent
14707                  instsetoo_native/util/openoffice.lst
14708                  sysui/desktop/macosx/Info.plist
14709                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
14711 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
14712 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14713 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14714 AC_CONFIG_HEADERS([config_host/config_clang.h])
14715 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14716 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14717 AC_CONFIG_HEADERS([config_host/config_eot.h])
14718 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14719 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14720 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14721 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14722 AC_CONFIG_HEADERS([config_host/config_features.h])
14723 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14724 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14725 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14726 AC_CONFIG_HEADERS([config_host/config_folders.h])
14727 AC_CONFIG_HEADERS([config_host/config_fonts.h])
14728 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14729 AC_CONFIG_HEADERS([config_host/config_gio.h])
14730 AC_CONFIG_HEADERS([config_host/config_global.h])
14731 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14732 AC_CONFIG_HEADERS([config_host/config_java.h])
14733 AC_CONFIG_HEADERS([config_host/config_langs.h])
14734 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14735 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14736 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14737 AC_CONFIG_HEADERS([config_host/config_locales.h])
14738 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14739 AC_CONFIG_HEADERS([config_host/config_oox.h])
14740 AC_CONFIG_HEADERS([config_host/config_options.h])
14741 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14742 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14743 AC_CONFIG_HEADERS([config_host/config_skia.h])
14744 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14745 AC_CONFIG_HEADERS([config_host/config_validation.h])
14746 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14747 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14748 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14749 AC_CONFIG_HEADERS([config_host/config_version.h])
14750 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14751 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14752 AC_CONFIG_HEADERS([config_host/config_python.h])
14753 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14754 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
14755 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
14756 AC_OUTPUT
14758 if test "$CROSS_COMPILING" = TRUE; then
14759     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14762 # touch the config timestamp file
14763 if test ! -f config_host.mk.stamp; then
14764     echo > config_host.mk.stamp
14765 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14766     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14767 else
14768     echo > config_host.mk.stamp
14771 # touch the config lang timestamp file
14772 if test ! -f config_host_lang.mk.stamp; then
14773     echo > config_host_lang.mk.stamp
14774 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14775     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14776 else
14777     echo > config_host_lang.mk.stamp
14781 if test \( "$STALE_MAKE" = "TRUE" \) \
14782         -a "$build_os" = "cygwin"; then
14784 cat << _EOS
14785 ****************************************************************************
14786 WARNING:
14787 Your make version is known to be horribly slow, and hard to debug
14788 problems with. To get a reasonably functional make please do:
14790 to install a pre-compiled binary make for Win32
14792  mkdir -p /opt/lo/bin
14793  cd /opt/lo/bin
14794  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14795  cp make-4.2.1-msvc.exe make
14796  chmod +x make
14798 to install from source:
14799 place yourself in a working directory of you choice.
14801  git clone git://git.savannah.gnu.org/make.git
14803  [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"]
14804  set PATH=%PATH%;C:\Cygwin\bin
14805  [or Cygwin64, if that is what you have]
14806  cd path-to-make-repo-you-cloned-above
14807  build_w32.bat --without-guile
14809 should result in a WinRel/gnumake.exe.
14810 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14812 Then re-run autogen.sh
14814 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14815 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14817 _EOS
14821 cat << _EOF
14822 ****************************************************************************
14824 To show information on various make targets and make flags, run:
14825 $GNUMAKE help
14827 To just build, run:
14828 $GNUMAKE
14830 _EOF
14832 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14833     cat << _EOF
14834 After the build has finished successfully, you can immediately run what you built using the command:
14835 _EOF
14837     if test $_os = Darwin; then
14838         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14839     else
14840         echo instdir/program/soffice
14841     fi
14842     cat << _EOF
14844 If you want to run the unit tests, run:
14845 $GNUMAKE check
14847 _EOF
14850 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
14851     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14852     cat "$WARNINGS_FILE_FOR_BUILD"
14853     echo
14856 if test -s "$WARNINGS_FILE"; then
14857     echo "HOST config ($WARNINGS_FILE)"
14858     cat "$WARNINGS_FILE"
14861 # Remove unneeded emconfigure artifacts
14862 rm -f a.out a.wasm a.out.js a.out.wasm
14864 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: