Remove duplicated include
[LibreOffice.git] / configure.ac
blobe41223ff7ec11fe0153a87ac0d1219bd57aa3218
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[24.2.0.0.alpha1+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     if test "$COM" = "MSC"; then
50         for f in $1; do
51             if test "x$f" != "x${f#-L}"; then
52                 filteredlibs="$filteredlibs -LIBPATH:${f:2}"
53             elif test "x$f" != "x${f#-l}"; then
54                 filteredlibs="$filteredlibs ${f:2}.lib"
55             else
56                 filteredlibs="$filteredlibs $f"
57             fi
58         done
59     else
60         for f in $1; do
61             case "$f" in
62                 # let's start with Fedora's paths for now
63                 -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
64                     # ignore it: on UNIXoids it is searched by default anyway
65                     # but if it's given explicitly then it may override other paths
66                     # (on macOS it would be an error to use it instead of SDK)
67                     ;;
68                 *)
69                     filteredlibs="$filteredlibs $f"
70                     ;;
71             esac
72         done
73     fi
76 PathFormat()
78     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
79     # function is called also on Unix.
80     #
81     # Return value: $formatted_path and $formatted_path_unix.
82     #
83     # $formatted_path is the argument in Windows format, but using forward slashes instead of
84     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
85     # or shell metacharacters).
86     #
87     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
88     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
89     # Unix pathname.
90     #
91     # Errors out if 8.3 names are needed but aren't present for some of the path components.
93     # Examples:
94     #
95     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
96     #
97     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
98     #
99     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
100     #
101     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
102     #
103     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
104     #
105     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
106     #
107     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
109     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
110         printf "PathFormat $1 ==> "
111     fi
113     formatted_path="$1"
114     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
115         if test "$build_os" = "wsl"; then
116             formatted_path=$(echo "$formatted_path" | tr -d '\r')
117         fi
119         pf_conv_to_dos=
120         # spaces,parentheses,brackets,braces are problematic in pathname
121         # so are backslashes
122         case "$formatted_path" in
123             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
124                 pf_conv_to_dos="yes"
125             ;;
126         esac
127         if test "$pf_conv_to_dos" = "yes"; then
128             if test "$build_os" = "wsl"; then
129                 case "$formatted_path" in
130                     /*)
131                         formatted_path=$(wslpath -w "$formatted_path")
132                         ;;
133                 esac
134                 formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
135             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
136                 formatted_path=`cygpath -sm "$formatted_path"`
137             else
138                 formatted_path=`cygpath -d "$formatted_path"`
139             fi
140             if test $? -ne 0;  then
141                 AC_MSG_ERROR([path conversion failed for "$1".])
142             fi
143         fi
144         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
145         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
146         if test "$fp_count_slash$fp_count_colon" != "00"; then
147             if test "$fp_count_colon" = "0"; then
148                 new_formatted_path=`realpath "$formatted_path"`
149                 if test $? -ne 0;  then
150                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
151                 else
152                     formatted_path="$new_formatted_path"
153                 fi
154             fi
155             if test "$build_os" = "wsl"; then
156                 if test "$fp_count_colon" != "0"; then
157                     formatted_path=$(wslpath "$formatted_path")
158                     local final_slash=
159                     case "$formatted_path" in
160                         */)
161                             final_slash=/
162                             ;;
163                     esac
164                     formatted_path=$(wslpath -m $formatted_path)
165                     case "$formatted_path" in
166                         */)
167                             ;;
168                         *)
169                             formatted_path="$formatted_path"$final_slash
170                             ;;
171                     esac
172                 else
173                     formatted_path=$(wslpath -m "$formatted_path")
174                 fi
175             else
176                 formatted_path=`cygpath -m "$formatted_path"`
177             fi
178             if test $? -ne 0;  then
179                 AC_MSG_ERROR([path conversion failed for "$1".])
180             fi
181         fi
182         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
183         if test "$fp_count_space" != "0"; then
184             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
185         fi
186     fi
187     if test "$build_os" = "wsl"; then
188         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
189         formatted_path_unix=$(wslpath "$formatted_path")
190     else
191         # But Cygwin can
192         formatted_path_unix="$formatted_path"
193     fi
196 AbsolutePath()
198     # There appears to be no simple and portable method to get an absolute and
199     # canonical path, so we try creating the directory if does not exist and
200     # utilizing the shell and pwd.
202     # Args: $1: A possibly relative pathname
203     # Return value: $absolute_path
205     # Convert to unix path, mkdir would treat c:/path as a relative path.
206     PathFormat "$1"
207     local rel="$formatted_path_unix"
208     absolute_path=""
209     test ! -e "$rel" && mkdir -p "$rel"
210     if test -d "$rel" ; then
211         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
212         absolute_path="$(pwd)"
213         cd - > /dev/null
214     else
215         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
216     fi
219 WARNINGS_FILE=config.warn
220 WARNINGS_FILE_FOR_BUILD=config.Build.warn
221 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
222 have_WARNINGS="no"
223 add_warning()
225     if test "$have_WARNINGS" = "no"; then
226         echo "*************************************" > "$WARNINGS_FILE"
227         have_WARNINGS="yes"
228         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
229             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
230             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
231         else
232             COLORWARN="* WARNING :"
233         fi
234     fi
235     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
238 dnl Some Mac User have the bad habit of letting a lot of crap
239 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
240 dnl that confuse the build.
241 dnl For the ones that use LODE, let's be nice and protect them
242 dnl from themselves
244 mac_sanitize_path()
246     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
247 dnl a common but nevertheless necessary thing that may be in a fancy
248 dnl path location is git, so make sure we have it
249     mac_git_path=`which git 2>/dev/null`
250     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
251         mac_path="$mac_path:`dirname $mac_git_path`"
252     fi
253 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
254 dnl path location is gpg, so make sure we find it
255     mac_gpg_path=`which gpg 2>/dev/null`
256     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
257         mac_path="$mac_path:`dirname $mac_gpg_path`"
258     fi
259     PATH="$mac_path"
260     unset mac_path
261     unset mac_git_path
262     unset mac_gpg_path
265 dnl semantically test a three digits version
266 dnl $1 - $3 = minimal version
267 dnl $4 - $6 = current version
269 check_semantic_version_three()
271     test "$4" -gt "$1" \
272         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
273         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
274     return $?
277 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
278 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
279 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
281 check_semantic_version_three_prefixed()
283     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
284     eval local MIN_MINOR="\$${1}_${2}_MINOR"
285     eval local MIN_TINY="\$${1}_${2}_TINY"
286     eval local CUR_MAJOR="\$${1}_MAJOR"
287     eval local CUR_MINOR="\$${1}_MINOR"
288     eval local CUR_TINY="\$${1}_TINY"
289     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
290     return $?
293 echo "********************************************************************"
294 echo "*"
295 echo "*   Running ${PACKAGE_NAME} build configuration."
296 echo "*"
297 echo "********************************************************************"
298 echo ""
300 dnl ===================================================================
301 dnl checks build and host OSes
302 dnl do this before argument processing to allow for platform dependent defaults
303 dnl ===================================================================
305 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
306 # Linux on WSL) trust that.
307 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
308     ac_cv_host="x86_64-pc-wsl"
309     ac_cv_host_cpu="x86_64"
310     ac_cv_host_os="wsl"
311     ac_cv_build="$ac_cv_host"
312     ac_cv_build_cpu="$ac_cv_host_cpu"
313     ac_cv_build_os="$ac_cv_host_os"
315     # Emulation of Cygwin's cygpath command for WSL.
316     cygpath()
317     {
318         if test -n "$UNITTEST_WSL_CYGPATH"; then
319             echo -n cygpath "$@" "==> "
320         fi
322         # Cygwin's real cygpath has a plethora of options but we use only a few here.
323         local args="$@"
324         local opt
325         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
326         OPTIND=1
328         while getopts dmuwlsp opt; do
329             case "$opt" in
330                 \?)
331                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
332                     ;;
333                 ?)
334                     eval opt_$opt=yes
335                     ;;
336             esac
337         done
339         shift $((OPTIND-1))
341         if test $# -ne 1; then
342             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
343         fi
345         local input="$1"
347         local result
349         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
350             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
352             if test -n "$opt_u"; then
353                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
354             fi
356             case "$input" in
357                 /mnt/*)
358                     # A Windows file in WSL format
359                     input=$(wslpath -w "$input")
360                     ;;
361                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
362                     # Already in Windows format
363                     ;;
364                 /*)
365                     input=$(wslpath -w "$input")
366                     ;;
367                 *)
368                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
369                     ;;
370             esac
371             if test -n "$opt_d" -o -n "$opt_s"; then
372                 input=$($WSL_LO_HELPER --8.3 "$input")
373             fi
374             if test -n "$opt_m"; then
375                 input="${input//\\//}"
376             fi
377             echo "$input"
378         else
379             # Print Unix path
381             case "$input" in
382                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
383                     wslpath -u "$input"
384                     ;;
385                 /)
386                     echo "$input"
387                     ;;
388                 *)
389                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
390                     ;;
391             esac
392         fi
393     }
395     if test -n "$UNITTEST_WSL_CYGPATH"; then
396         BUILDDIR=.
398         # Nothing special with these file names, just arbitrary ones picked to test with
399         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
400         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
401         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
402         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
403         # At least on my machine for instance this file does have an 8.3 name
404         cygpath -d /mnt/c/windows/WindowsUpdate.log
405         # But for instance this one doesn't
406         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
407         cygpath -ws /mnt/c/windows/WindowsUpdate.log
408         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
409         cygpath -ms /mnt/c/windows/WindowsUpdate.log
411         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
412         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
414         exit 0
415     fi
417     if test -z "$WSL_LO_HELPER"; then
418         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
419             WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
420         elif test -x "/opt/lo/bin/wsl-lo-helper"; then
421             WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
422         fi
423     fi
424     if test -z "$WSL_LO_HELPER"; then
425         AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
426     fi
429 AC_CANONICAL_HOST
430 AC_CANONICAL_BUILD
432 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
433     BUILDDIR=.
434     GREP=grep
436     # Use of PathFormat must be after AC_CANONICAL_BUILD above
437     PathFormat /
438     printf "$formatted_path , $formatted_path_unix\n"
440     PathFormat $PWD
441     printf "$formatted_path , $formatted_path_unix\n"
443     PathFormat "$PROGRAMFILESX86"
444     printf "$formatted_path , $formatted_path_unix\n"
446     exit 0
449 AC_MSG_CHECKING([for product name])
450 PRODUCTNAME="AC_PACKAGE_NAME"
451 if test -n "$with_product_name" -a "$with_product_name" != no; then
452     PRODUCTNAME="$with_product_name"
454 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
455     PRODUCTNAME="${PRODUCTNAME}Dev"
457 AC_MSG_RESULT([$PRODUCTNAME])
458 AC_SUBST(PRODUCTNAME)
459 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
460 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
462 dnl ===================================================================
463 dnl Our version is defined by the AC_INIT() at the top of this script.
464 dnl ===================================================================
466 AC_MSG_CHECKING([for package version])
467 if test -n "$with_package_version" -a "$with_package_version" != no; then
468     PACKAGE_VERSION="$with_package_version"
470 AC_MSG_RESULT([$PACKAGE_VERSION])
472 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
474 LIBO_VERSION_MAJOR=$1
475 LIBO_VERSION_MINOR=$2
476 LIBO_VERSION_MICRO=$3
477 LIBO_VERSION_PATCH=$4
479 LIBO_VERSION_SUFFIX=$5
481 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
482 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
483 # they get undoubled before actually passed to sed.
484 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
485 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
486 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
487 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
489 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
490 # three non-negative integers. Please find more information about CFBundleVersion at
491 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
493 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
494 # of at most three non-negative integers. Please find more information about
495 # CFBundleShortVersionString at
496 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
498 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
500 if test "$enable_macosx_sandbox" = yes; then
501     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
502     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
503 else
504     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
505     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
508 AC_SUBST(LIBO_VERSION_MAJOR)
509 AC_SUBST(LIBO_VERSION_MINOR)
510 AC_SUBST(LIBO_VERSION_MICRO)
511 AC_SUBST(LIBO_VERSION_PATCH)
512 AC_SUBST(LIBO_VERSION_SUFFIX)
513 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
514 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
515 AC_SUBST(MACOSX_BUNDLE_VERSION)
517 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
518 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
519 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
520 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
522 git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>&/dev/null`
523 LIBO_THIS_YEAR=${git_date:-2023}
524 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
526 dnl ===================================================================
527 dnl Product version
528 dnl ===================================================================
529 AC_MSG_CHECKING([for product version])
530 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
531 AC_MSG_RESULT([$PRODUCTVERSION])
532 AC_SUBST(PRODUCTVERSION)
534 AC_PROG_EGREP
535 # AC_PROG_EGREP doesn't set GREP on all systems as well
536 AC_PATH_PROG(GREP, grep)
538 BUILDDIR=`pwd`
539 cd $srcdir
540 SRC_ROOT=`pwd`
541 cd $BUILDDIR
542 x_Cygwin=[\#]
544 dnl ======================================
545 dnl Required GObject introspection version
546 dnl ======================================
547 INTROSPECTION_REQUIRED_VERSION=1.32.0
549 dnl ===================================================================
550 dnl Search all the common names for GNU Make
551 dnl ===================================================================
552 AC_MSG_CHECKING([for GNU Make])
554 # try to use our own make if it is available and GNUMAKE was not already defined
555 if test -z "$GNUMAKE"; then
556     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
557         GNUMAKE="$LODE_HOME/opt/bin/make"
558     elif test -x "/opt/lo/bin/make"; then
559         GNUMAKE="/opt/lo/bin/make"
560     fi
563 GNUMAKE_WIN_NATIVE=
564 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
565     if test -n "$a"; then
566         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
567         if test $? -eq 0;  then
568             if test "$build_os" = "cygwin"; then
569                 if test -n "$($a -v | grep 'Built for Windows')" ; then
570                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
571                     GNUMAKE_WIN_NATIVE="TRUE"
572                 else
573                     GNUMAKE=`which $a`
574                 fi
575             else
576                 GNUMAKE=`which $a`
577             fi
578             break
579         fi
580     fi
581 done
582 AC_MSG_RESULT($GNUMAKE)
583 if test -z "$GNUMAKE"; then
584     AC_MSG_ERROR([not found. install GNU Make.])
585 else
586     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
587         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
588     fi
591 win_short_path_for_make()
593     local short_path="$1"
594     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
595         cygpath -sm "$short_path"
596     else
597         cygpath -u "$(cygpath -d "$short_path")"
598     fi
602 if test "$build_os" = "cygwin"; then
603     PathFormat "$SRC_ROOT"
604     SRC_ROOT="$formatted_path"
605     PathFormat "$BUILDDIR"
606     BUILDDIR="$formatted_path"
607     x_Cygwin=
608     AC_MSG_CHECKING(for explicit COMSPEC)
609     if test -z "$COMSPEC"; then
610         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
611     else
612         AC_MSG_RESULT([found: $COMSPEC])
613     fi
616 AC_SUBST(SRC_ROOT)
617 AC_SUBST(BUILDDIR)
618 AC_SUBST(x_Cygwin)
619 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
620 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
621 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
623 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
624     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
627 # need sed in os checks...
628 AC_PATH_PROGS(SED, sed)
629 if test -z "$SED"; then
630     AC_MSG_ERROR([install sed to run this script])
633 # Set the ENABLE_LTO variable
634 # ===================================================================
635 AC_MSG_CHECKING([whether to use link-time optimization])
636 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
637     ENABLE_LTO="TRUE"
638     AC_MSG_RESULT([yes])
639 else
640     ENABLE_LTO=""
641     AC_MSG_RESULT([no])
643 AC_SUBST(ENABLE_LTO)
645 AC_ARG_ENABLE(fuzz-options,
646     AS_HELP_STRING([--enable-fuzz-options],
647         [Randomly enable or disable each of those configurable options
648          that are supposed to be freely selectable without interdependencies,
649          or where bad interaction from interdependencies is automatically avoided.])
652 dnl ===================================================================
653 dnl When building for Android, --with-android-ndk,
654 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
655 dnl mandatory
656 dnl ===================================================================
658 AC_ARG_WITH(android-ndk,
659     AS_HELP_STRING([--with-android-ndk],
660         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
663 AC_ARG_WITH(android-ndk-toolchain-version,
664     AS_HELP_STRING([--with-android-ndk-toolchain-version],
665         [Specify which toolchain version to use, of those present in the
666         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
667         with_android_ndk_toolchain_version=clang5.0)
669 AC_ARG_WITH(android-sdk,
670     AS_HELP_STRING([--with-android-sdk],
671         [Specify location of the Android SDK. Mandatory when building for Android.]),
674 AC_ARG_WITH(android-api-level,
675     AS_HELP_STRING([--with-android-api-level],
676         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
679 ANDROID_NDK_DIR=
680 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
681     with_android_ndk="$SRC_ROOT/external/android-ndk"
683 if test -n "$with_android_ndk"; then
684     eval ANDROID_NDK_DIR=$with_android_ndk
686     ANDROID_API_LEVEL=16
687     if test -n "$with_android_api_level" ; then
688         ANDROID_API_LEVEL="$with_android_api_level"
689     fi
691     if test $host_cpu = arm; then
692         LLVM_TRIPLE=armv7a-linux-androideabi
693         ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
694         ANDROID_APP_ABI=armeabi-v7a
695         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
696     elif test $host_cpu = aarch64; then
697         LLVM_TRIPLE=aarch64-linux-android
698         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
699         # minimum android version that supports aarch64
700         if test "$ANDROID_API_LEVEL" -lt "21" ; then
701             ANDROID_API_LEVEL=21
702         fi
703         ANDROID_APP_ABI=arm64-v8a
704     elif test $host_cpu = x86_64; then
705         LLVM_TRIPLE=x86_64-linux-android
706         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
707         # minimum android version that supports x86_64
708         ANDROID_API_LEVEL=21
709         ANDROID_APP_ABI=x86_64
710     else
711         # host_cpu is something like "i386" or "i686" I guess, NDK uses
712         # "x86" in some contexts
713         LLVM_TRIPLE=i686-linux-android
714         ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
715         ANDROID_APP_ABI=x86
716     fi
718     # Set up a lot of pre-canned defaults
720     if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
721         if test ! -f $ANDROID_NDK_DIR/source.properties; then
722             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
723         fi
724         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
725     else
726         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
727     fi
728     if test -z "$ANDROID_NDK_VERSION";  then
729         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
730     fi
731     case $ANDROID_NDK_VERSION in
732     r9*|r10*)
733         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
734         ;;
735     11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
736         AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
737         ;;
738     23.*)
739         ;;
740     *)
741         # NDK 24 dropped support for API levels < 19
742         if test "$ANDROID_API_LEVEL" -lt "19"; then
743             ANDROID_API_LEVEL=19
744         fi
745         case $ANDROID_NDK_VERSION in
746         24.*|25.*)
747             ;;
748         *)
749             AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
750             add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
751             ;;
752         esac
753         ;;
754     esac
756     case "$with_android_ndk_toolchain_version" in
757     clang5.0)
758         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
759         ;;
760     *)
761         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
762     esac
764     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
766     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
767     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
768     # manage to link the (app-specific) single huge .so that is built for the app in
769     # android/source/ if there is debug information in a significant part of the object files.
770     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
771     # all objects have been built with debug information.)
772     case $build_os in
773     linux-gnu*)
774         android_HOST_TAG=linux-x86_64
775         ;;
776     darwin*)
777         android_HOST_TAG=darwin-x86_64
778         ;;
779     *)
780         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
781         # ndk would also support windows and windows-x86_64
782         ;;
783     esac
784     ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
785     ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
787     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
788     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
789     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
790     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
791     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
793     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
794     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
795     if test "$ENABLE_LTO" = TRUE; then
796         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
797         # $CC and $CXX when building external libraries
798         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
799     fi
801     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
803     if test -z "$CC"; then
804         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
805         CC_BASE="clang"
806     fi
807     if test -z "$CXX"; then
808         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
809         CXX_BASE="clang++"
810     fi
812 AC_SUBST(ANDROID_NDK_DIR)
813 AC_SUBST(ANDROID_API_LEVEL)
814 AC_SUBST(ANDROID_APP_ABI)
815 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
816 AC_SUBST(ANDROID_SYSROOT_PLATFORM)
817 AC_SUBST(ANDROID_TOOLCHAIN)
819 dnl ===================================================================
820 dnl --with-android-sdk
821 dnl ===================================================================
822 ANDROID_SDK_DIR=
823 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
824     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
826 if test -n "$with_android_sdk"; then
827     eval ANDROID_SDK_DIR=$with_android_sdk
828     PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
830 AC_SUBST(ANDROID_SDK_DIR)
832 AC_ARG_ENABLE([android-lok],
833     AS_HELP_STRING([--enable-android-lok],
834         [The Android app from the android/ subdir needs several tweaks all
835          over the place that break the LOK when used in the Online-based
836          Android app.  This switch indicates that the intent of this build is
837          actually the Online-based, non-modified LOK.])
839 ENABLE_ANDROID_LOK=
840 if test -n "$ANDROID_NDK_DIR" ; then
841     if test "$enable_android_lok" = yes; then
842         ENABLE_ANDROID_LOK=TRUE
843         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
844         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
845     else
846         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
847     fi
849 AC_SUBST([ENABLE_ANDROID_LOK])
851 libo_FUZZ_ARG_ENABLE([android-editing],
852     AS_HELP_STRING([--enable-android-editing],
853         [Enable the experimental editing feature on Android.])
855 ENABLE_ANDROID_EDITING=
856 if test "$enable_android_editing" = yes; then
857     ENABLE_ANDROID_EDITING=TRUE
859 AC_SUBST([ENABLE_ANDROID_EDITING])
861 disable_database_connectivity_dependencies()
863     enable_evolution2=no
864     enable_firebird_sdbc=no
865     enable_mariadb_sdbc=no
866     enable_postgresql_sdbc=no
867     enable_report_builder=no
870 # ===================================================================
872 # Start initial platform setup
874 # The using_* variables reflect platform support and should not be
875 # changed after the "End initial platform setup" block.
876 # This is also true for most test_* variables.
877 # ===================================================================
878 build_crypto=yes
879 test_clucene=no
880 test_gdb_index=no
881 test_openldap=yes
882 test_split_debug=no
883 test_webdav=yes
884 usable_dlapi=yes
886 # There is currently just iOS not using salplug, so this explicitly enables it.
887 # must: using_freetype_fontconfig
888 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
889 # must: using_x11
891 # Default values, as such probably valid just for Linux, set
892 # differently below just for Mac OSX, but at least better than
893 # hardcoding these as we used to do. Much of this is duplicated also
894 # in solenv for old build system and for gbuild, ideally we should
895 # perhaps define stuff like this only here in configure.ac?
897 LINKFLAGSSHL="-shared"
898 PICSWITCH="-fpic"
899 DLLPOST=".so"
901 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
903 INSTROOTBASESUFFIX=
904 INSTROOTCONTENTSUFFIX=
905 SDKDIRNAME=sdk
907 HOST_PLATFORM="$host"
909 host_cpu_for_clang="$host_cpu"
911 case "$host_os" in
913 solaris*)
914     using_freetype_fontconfig=yes
915     using_x11=yes
916     build_skia=yes
917     _os=SunOS
919     dnl ===========================================================
920     dnl Check whether we're using Solaris 10 - SPARC or Intel.
921     dnl ===========================================================
922     AC_MSG_CHECKING([the Solaris operating system release])
923     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
924     if test "$_os_release" -lt "10"; then
925         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
926     else
927         AC_MSG_RESULT([ok ($_os_release)])
928     fi
930     dnl Check whether we're using a SPARC or i386 processor
931     AC_MSG_CHECKING([the processor type])
932     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
933         AC_MSG_RESULT([ok ($host_cpu)])
934     else
935         AC_MSG_ERROR([only SPARC and i386 processors are supported])
936     fi
937     ;;
939 linux-gnu*|k*bsd*-gnu*|linux-musl*)
940     using_freetype_fontconfig=yes
941     using_x11=yes
942     build_skia=yes
943     test_gdb_index=yes
944     test_split_debug=yes
945     if test "$enable_fuzzers" = yes; then
946         test_system_freetype=no
947     fi
948     _os=Linux
949     ;;
951 gnu)
952     using_freetype_fontconfig=yes
953     using_x11=no
954     _os=GNU
955      ;;
957 cygwin*|wsl*)
958     # When building on Windows normally with MSVC under Cygwin,
959     # configure thinks that the host platform (the platform the
960     # built code will run on) is Cygwin, even if it obviously is
961     # Windows, which in Autoconf terminology is called
962     # "mingw32". (Which is misleading as MinGW is the name of the
963     # tool-chain, not an operating system.)
965     # Somewhat confusing, yes. But this configure script doesn't
966     # look at $host etc that much, it mostly uses its own $_os
967     # variable, set here in this case statement.
969     using_freetype_fontconfig=no
970     using_x11=no
971     test_unix_dlapi=no
972     test_openldap=no
973     enable_pagein=no
974     build_skia=yes
975     _os=WINNT
977     DLLPOST=".dll"
978     LINKFLAGSNOUNDEFS=
980     if test "$host_cpu" = "aarch64"; then
981         build_skia=no
982         enable_gpgmepp=no
983         enable_coinmp=no
984         enable_firebird_sdbc=no
985     fi
986     ;;
988 darwin*) # macOS
989     using_freetype_fontconfig=no
990     using_x11=no
991     build_skia=yes
992     enable_pagein=no
993     if test -n "$LODE_HOME" ; then
994         mac_sanitize_path
995         AC_MSG_NOTICE([sanitized the PATH to $PATH])
996     fi
997     _os=Darwin
998     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
999     INSTROOTCONTENTSUFFIX=/Contents
1000     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
1001     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1002     LINKFLAGSSHL="-dynamiclib"
1004     # -fPIC is default
1005     PICSWITCH=""
1007     DLLPOST=".dylib"
1009     # -undefined error is the default
1010     LINKFLAGSNOUNDEFS=""
1011     case "$host_cpu" in
1012     aarch64|arm64)
1013         # Apple's Clang uses "arm64"
1014         host_cpu_for_clang=arm64
1015     esac
1018 ios*) # iOS
1019     using_freetype_fontconfig=no
1020     using_x11=no
1021     build_crypto=no
1022     test_libcmis=no
1023     test_openldap=no
1024     test_webdav=no
1025     if test -n "$LODE_HOME" ; then
1026         mac_sanitize_path
1027         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1028     fi
1029     enable_gpgmepp=no
1030     _os=iOS
1031     enable_mpl_subset=yes
1032     enable_lotuswordpro=no
1033     disable_database_connectivity_dependencies
1034     enable_coinmp=no
1035     enable_lpsolve=no
1036     enable_extension_integration=no
1037     enable_xmlhelp=no
1038     with_ppds=no
1039     if test "$enable_ios_simulator" = "yes"; then
1040         host=x86_64-apple-darwin
1041     fi
1042     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1043     LINKFLAGSSHL="-dynamiclib"
1045     # -fPIC is default
1046     PICSWITCH=""
1048     DLLPOST=".dylib"
1050     # -undefined error is the default
1051     LINKFLAGSNOUNDEFS=""
1053     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1054     # part, so use aarch64-apple-darwin for now.
1055     HOST_PLATFORM=aarch64-apple-darwin
1057     # Apple's Clang uses "arm64"
1058     host_cpu_for_clang=arm64
1061 freebsd*)
1062     using_freetype_fontconfig=yes
1063     using_x11=yes
1064     build_skia=yes
1065     AC_MSG_CHECKING([the FreeBSD operating system release])
1066     if test -n "$with_os_version"; then
1067         OSVERSION="$with_os_version"
1068     else
1069         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1070     fi
1071     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1072     AC_MSG_CHECKING([which thread library to use])
1073     if test "$OSVERSION" -lt "500016"; then
1074         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1075         PTHREAD_LIBS="-pthread"
1076     elif test "$OSVERSION" -lt "502102"; then
1077         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1078         PTHREAD_LIBS="-lc_r"
1079     else
1080         PTHREAD_CFLAGS=""
1081         PTHREAD_LIBS="-pthread"
1082     fi
1083     AC_MSG_RESULT([$PTHREAD_LIBS])
1084     _os=FreeBSD
1085     ;;
1087 *netbsd*)
1088     using_freetype_fontconfig=yes
1089     using_x11=yes
1090     test_gtk3_kde5=no
1091     build_skia=yes
1092     PTHREAD_LIBS="-pthread -lpthread"
1093     _os=NetBSD
1094     ;;
1096 openbsd*)
1097     using_freetype_fontconfig=yes
1098     using_x11=yes
1099     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1100     PTHREAD_LIBS="-pthread"
1101     _os=OpenBSD
1102     ;;
1104 dragonfly*)
1105     using_freetype_fontconfig=yes
1106     using_x11=yes
1107     build_skia=yes
1108     PTHREAD_LIBS="-pthread"
1109     _os=DragonFly
1110     ;;
1112 linux-android*)
1113     # API exists, but seems not really usable since Android 7 AFAIK
1114     usable_dlapi=no
1115     using_freetype_fontconfig=yes
1116     using_headless_plugin=no
1117     using_x11=no
1118     build_crypto=no
1119     test_openldap=no
1120     test_system_freetype=no
1121     test_webdav=no
1122     disable_database_connectivity_dependencies
1123     enable_lotuswordpro=no
1124     enable_mpl_subset=yes
1125     enable_cairo_canvas=no
1126     enable_coinmp=yes
1127     enable_lpsolve=no
1128     enable_odk=no
1129     enable_python=no
1130     enable_xmlhelp=no
1131     _os=Android
1132     ;;
1134 haiku*)
1135     using_freetype_fontconfig=yes
1136     using_x11=no
1137     test_gtk3=no
1138     test_gtk3_kde5=no
1139     test_kf5=yes
1140     test_kf6=yes
1141     enable_odk=no
1142     enable_coinmp=no
1143     enable_pdfium=no
1144     enable_sdremote=no
1145     enable_postgresql_sdbc=no
1146     enable_firebird_sdbc=no
1147     _os=Haiku
1148     ;;
1150 emscripten)
1151     # API currently just exists in headers, not code
1152     usable_dlapi=no
1153     using_freetype_fontconfig=yes
1154     using_x11=yes
1155     test_openldap=no
1156     test_qt5=yes
1157     test_split_debug=yes
1158     test_system_freetype=no
1159     enable_compiler_plugins=no
1160     enable_customtarget_components=yes
1161     enable_split_debug=yes
1162     enable_wasm_strip=yes
1163     with_system_zlib=no
1164     with_theme="colibre"
1165     _os=Emscripten
1166     ;;
1169     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1170     ;;
1171 esac
1173 AC_SUBST(HOST_PLATFORM)
1175 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1176     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1179 # Set defaults, if not set by platform
1180 test "${test_cups+set}" = set || test_cups="$using_x11"
1181 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1182 test "${test_gen+set}" = set || test_gen="$using_x11"
1183 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1184 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1185 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1186 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1187 test "${test_kf6+set}" = set || test_kf6="$using_x11"
1188 # don't handle test_qt5, so it can disable test_kf5 later
1189 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1190 test "${test_randr+set}" = set || test_randr="$using_x11"
1191 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1192 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1194 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1195 # Make sure fontconfig and freetype test both either system or not
1196 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1197 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1199 # convenience / platform overriding "fixes"
1200 # Don't sort!
1201 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1202 test "$test_kf5" = yes && test_qt5=yes
1203 test "$test_gtk3" != yes && enable_gtk3=no
1204 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1205 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1206 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1208 # Keep in sync with the above $using_x11 depending test default list
1209 disable_x11_tests()
1211     test_cups=no
1212     test_dbus=no
1213     test_gen=no
1214     test_gstreamer_1_0=no
1215     test_gtk3_kde5=no
1216     test_gtk3=no
1217     test_gtk4=no
1218     test_kf5=no
1219     test_kf6=no
1220     test_qt5=no
1221     test_qt6=no
1222     test_randr=no
1223     test_xrender=no
1226 test "$using_x11" = yes && USING_X11=TRUE
1228 if test "$using_freetype_fontconfig" = yes; then
1229     AC_DEFINE(USE_HEADLESS_CODE)
1230     USE_HEADLESS_CODE=TRUE
1231     if test "$using_headless_plugin" = yes; then
1232         AC_DEFINE(ENABLE_HEADLESS)
1233         ENABLE_HEADLESS=TRUE
1234     fi
1235 else
1236     test_fontconfig=no
1237     test_freetype=no
1240 AC_SUBST(ENABLE_HEADLESS)
1241 AC_SUBST(USE_HEADLESS_CODE)
1243 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1244 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1245 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1246 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1248 # ===================================================================
1250 # End initial platform setup
1252 # ===================================================================
1254 if test "$_os" = "Android" ; then
1255     # Verify that the NDK and SDK options are proper
1256     if test -z "$with_android_ndk"; then
1257         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1258     elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
1259         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1260     fi
1262     if test -z "$ANDROID_SDK_DIR"; then
1263         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1264     elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
1265         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1266     fi
1269 AC_SUBST(SDKDIRNAME)
1271 AC_SUBST(PTHREAD_CFLAGS)
1272 AC_SUBST(PTHREAD_LIBS)
1274 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1275 # By default use the ones specified by our build system,
1276 # but explicit override is possible.
1277 AC_MSG_CHECKING(for explicit AFLAGS)
1278 if test -n "$AFLAGS"; then
1279     AC_MSG_RESULT([$AFLAGS])
1280     x_AFLAGS=
1281 else
1282     AC_MSG_RESULT(no)
1283     x_AFLAGS=[\#]
1285 AC_MSG_CHECKING(for explicit CFLAGS)
1286 if test -n "$CFLAGS"; then
1287     AC_MSG_RESULT([$CFLAGS])
1288     x_CFLAGS=
1289 else
1290     AC_MSG_RESULT(no)
1291     x_CFLAGS=[\#]
1293 AC_MSG_CHECKING(for explicit CXXFLAGS)
1294 if test -n "$CXXFLAGS"; then
1295     AC_MSG_RESULT([$CXXFLAGS])
1296     x_CXXFLAGS=
1297 else
1298     AC_MSG_RESULT(no)
1299     x_CXXFLAGS=[\#]
1301 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1302 if test -n "$OBJCFLAGS"; then
1303     AC_MSG_RESULT([$OBJCFLAGS])
1304     x_OBJCFLAGS=
1305 else
1306     AC_MSG_RESULT(no)
1307     x_OBJCFLAGS=[\#]
1309 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1310 if test -n "$OBJCXXFLAGS"; then
1311     AC_MSG_RESULT([$OBJCXXFLAGS])
1312     x_OBJCXXFLAGS=
1313 else
1314     AC_MSG_RESULT(no)
1315     x_OBJCXXFLAGS=[\#]
1317 AC_MSG_CHECKING(for explicit LDFLAGS)
1318 if test -n "$LDFLAGS"; then
1319     AC_MSG_RESULT([$LDFLAGS])
1320     x_LDFLAGS=
1321 else
1322     AC_MSG_RESULT(no)
1323     x_LDFLAGS=[\#]
1325 AC_SUBST(AFLAGS)
1326 AC_SUBST(CFLAGS)
1327 AC_SUBST(CXXFLAGS)
1328 AC_SUBST(OBJCFLAGS)
1329 AC_SUBST(OBJCXXFLAGS)
1330 AC_SUBST(LDFLAGS)
1331 AC_SUBST(x_AFLAGS)
1332 AC_SUBST(x_CFLAGS)
1333 AC_SUBST(x_CXXFLAGS)
1334 AC_SUBST(x_OBJCFLAGS)
1335 AC_SUBST(x_OBJCXXFLAGS)
1336 AC_SUBST(x_LDFLAGS)
1338 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1339 my_original_CFLAGS=$CFLAGS
1340 my_original_CXXFLAGS=$CXXFLAGS
1341 my_original_CPPFLAGS=$CPPFLAGS
1343 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1344 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1345 dnl AC_PROG_CC internally.
1346 if test "$_os" != "WINNT"; then
1347     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1348     save_CFLAGS=$CFLAGS
1349     AC_PROG_CC
1350     CFLAGS=$save_CFLAGS
1351     if test -z "$CC_BASE"; then
1352         CC_BASE=`first_arg_basename "$CC"`
1353     fi
1356 if test "$_os" != "WINNT"; then
1357     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1358 else
1359     ENDIANNESS=little
1361 AC_SUBST(ENDIANNESS)
1363 if test "$usable_dlapi" != no; then
1364     AC_DEFINE([HAVE_DLAPI])
1365     if test "$test_unix_dlapi" != no; then
1366         save_LIBS="$LIBS"
1367         AC_SEARCH_LIBS([dlsym], [dl],
1368             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1369             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1370         LIBS="$save_LIBS"
1371         AC_DEFINE([HAVE_UNIX_DLAPI])
1372     fi
1374 AC_SUBST(UNIX_DLAPI_LIBS)
1376 # Check for a (GNU) backtrace implementation
1377 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1378 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1379 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1380     save_LIBS="$LIBS"
1381     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1382         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1383         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1384     LIBS="$save_LIBS"
1386 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1387     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1390 dnl ===================================================================
1391 dnl Sanity checks for Emscripten SDK setup
1392 dnl ===================================================================
1394 EMSCRIPTEN_MIN_MAJOR=2
1395 EMSCRIPTEN_MIN_MINOR=0
1396 EMSCRIPTEN_MIN_TINY=31
1397 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1399 if test "$_os" = "Emscripten"; then
1400     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1401     AS_IF([test -z "$EMSDK"],
1402           [AC_MSG_ERROR([No \$EMSDK environment variable.])])
1403     EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
1404     if test -f "$EMSCRIPTEN_VERSION_H"; then
1405         EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1406         EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1407         EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1408     else
1409         EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1410         EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1411         EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1412         EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1413     fi
1415     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1417     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1418     if test $? -eq 0; then
1419         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1420     else
1421         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1422     fi
1424     EMSCRIPTEN_ERROR=0
1425     if ! which emconfigure >/dev/null 2>&1; then
1426         AC_MSG_WARN([emconfigure must be in your \$PATH])
1427         EMSCRIPTEN_ERROR=1
1428     fi
1429     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1430         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1431         EMSCRIPTEN_ERROR=1
1432     fi
1433     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1434     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1435         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1436         EMSCRIPTEN_ERROR=1
1437     fi
1438     if test $EMSCRIPTEN_ERROR -ne 0; then
1439         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1440     fi
1442 AC_SUBST(EMSDK_FILE_PACKAGER)
1444 ###############################################################################
1445 # Extensions switches --enable/--disable
1446 ###############################################################################
1447 # By default these should be enabled unless having extra dependencies.
1448 # If there is extra dependency over configure options then the enable should
1449 # be automagic based on whether the requiring feature is enabled or not.
1450 # All this options change anything only with --enable-extension-integration.
1452 # The name of this option and its help string makes it sound as if
1453 # extensions are built anyway, just not integrated in the installer,
1454 # if you use --disable-extension-integration. Is that really the
1455 # case?
1457 AC_ARG_ENABLE(ios-simulator,
1458     AS_HELP_STRING([--enable-ios-simulator],
1459         [build for iOS simulator])
1462 libo_FUZZ_ARG_ENABLE(extension-integration,
1463     AS_HELP_STRING([--disable-extension-integration],
1464         [Disable integration of the built extensions in the installer of the
1465          product. Use this switch to disable the integration.])
1468 AC_ARG_ENABLE(avmedia,
1469     AS_HELP_STRING([--disable-avmedia],
1470         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1471 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1473 AC_ARG_ENABLE(database-connectivity,
1474     AS_HELP_STRING([--disable-database-connectivity],
1475         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1478 # This doesn't mean not building (or "integrating") extensions
1479 # (although it probably should; i.e. it should imply
1480 # --disable-extension-integration I guess), it means not supporting
1481 # any extension mechanism at all
1482 libo_FUZZ_ARG_ENABLE(extensions,
1483     AS_HELP_STRING([--disable-extensions],
1484         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1487 AC_ARG_ENABLE(scripting,
1488     AS_HELP_STRING([--disable-scripting],
1489         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1490 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1492 # This is mainly for Android and iOS, but could potentially be used in some
1493 # special case otherwise, too, so factored out as a separate setting
1495 AC_ARG_ENABLE(dynamic-loading,
1496     AS_HELP_STRING([--disable-dynamic-loading],
1497         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1500 libo_FUZZ_ARG_ENABLE(report-builder,
1501     AS_HELP_STRING([--disable-report-builder],
1502         [Disable the Report Builder.])
1505 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1506     AS_HELP_STRING([--enable-ext-wiki-publisher],
1507         [Enable the Wiki Publisher extension.])
1510 libo_FUZZ_ARG_ENABLE(lpsolve,
1511     AS_HELP_STRING([--disable-lpsolve],
1512         [Disable compilation of the lp solve solver ])
1514 libo_FUZZ_ARG_ENABLE(coinmp,
1515     AS_HELP_STRING([--disable-coinmp],
1516         [Disable compilation of the CoinMP solver ])
1519 libo_FUZZ_ARG_ENABLE(pdfimport,
1520     AS_HELP_STRING([--disable-pdfimport],
1521         [Disable building the PDF import feature.])
1524 libo_FUZZ_ARG_ENABLE(pdfium,
1525     AS_HELP_STRING([--disable-pdfium],
1526         [Disable building PDFium. Results in unsecure PDF signature verification.])
1529 libo_FUZZ_ARG_ENABLE(skia,
1530     AS_HELP_STRING([--disable-skia],
1531         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1534 ###############################################################################
1536 dnl ---------- *** ----------
1538 libo_FUZZ_ARG_ENABLE(mergelibs,
1539     AS_HELP_STRING([--enable-mergelibs],
1540         [Merge several of the smaller libraries into one big, "merged", one.])
1543 libo_FUZZ_ARG_ENABLE(breakpad,
1544     AS_HELP_STRING([--enable-breakpad],
1545         [Enables breakpad for crash reporting.])
1548 libo_FUZZ_ARG_ENABLE(crashdump,
1549     AS_HELP_STRING([--disable-crashdump],
1550         [Disable dump.ini and dump-file, when --enable-breakpad])
1553 AC_ARG_ENABLE(fetch-external,
1554     AS_HELP_STRING([--disable-fetch-external],
1555         [Disables fetching external tarballs from web sources.])
1558 AC_ARG_ENABLE(fuzzers,
1559     AS_HELP_STRING([--enable-fuzzers],
1560         [Enables building libfuzzer targets for fuzz testing.])
1563 libo_FUZZ_ARG_ENABLE(pch,
1564     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1565         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1566          Using 'system' will include only external headers, 'base' will add also headers
1567          from base modules, 'normal' will also add all headers except from the module built,
1568          'full' will use all suitable headers even from a module itself.])
1571 libo_FUZZ_ARG_ENABLE(epm,
1572     AS_HELP_STRING([--enable-epm],
1573         [LibreOffice includes self-packaging code, that requires epm, however epm is
1574          useless for large scale package building.])
1577 libo_FUZZ_ARG_ENABLE(odk,
1578     AS_HELP_STRING([--enable-odk],
1579         [Enable building the Office Development Kit, the part that extensions need to build against])
1582 AC_ARG_ENABLE(mpl-subset,
1583     AS_HELP_STRING([--enable-mpl-subset],
1584         [Don't compile any pieces which are not MPL or more liberally licensed])
1587 libo_FUZZ_ARG_ENABLE(evolution2,
1588     AS_HELP_STRING([--enable-evolution2],
1589         [Allows the built-in evolution 2 addressbook connectivity build to be
1590          enabled.])
1593 AC_ARG_ENABLE(avahi,
1594     AS_HELP_STRING([--enable-avahi],
1595         [Determines whether to use Avahi to advertise Impress to remote controls.])
1598 libo_FUZZ_ARG_ENABLE(werror,
1599     AS_HELP_STRING([--enable-werror],
1600         [Turn warnings to errors. (Has no effect in modules where the treating
1601          of warnings as errors is disabled explicitly.)]),
1604 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1605     AS_HELP_STRING([--enable-assert-always-abort],
1606         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1609 libo_FUZZ_ARG_ENABLE(dbgutil,
1610     AS_HELP_STRING([--enable-dbgutil],
1611         [Provide debugging support from --enable-debug and include additional debugging
1612          utilities such as object counting or more expensive checks.
1613          This is the recommended option for developers.
1614          Note that this makes the build ABI incompatible, it is not possible to mix object
1615          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1617 libo_FUZZ_ARG_ENABLE(debug,
1618     AS_HELP_STRING([--enable-debug],
1619         [Include debugging information, disable compiler optimization and inlining plus
1620          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1622 libo_FUZZ_ARG_ENABLE(split-debug,
1623     AS_HELP_STRING([--disable-split-debug],
1624         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1625          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1627 libo_FUZZ_ARG_ENABLE(gdb-index,
1628     AS_HELP_STRING([--disable-gdb-index],
1629         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1630          The feature requires a linker that supports the --gdb-index option.]))
1632 libo_FUZZ_ARG_ENABLE(sal-log,
1633     AS_HELP_STRING([--enable-sal-log],
1634         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1636 libo_FUZZ_ARG_ENABLE(symbols,
1637     AS_HELP_STRING([--enable-symbols],
1638         [Generate debug information.
1639          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1640          otherwise. It is possible to explicitly specify gbuild build targets
1641          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1642          everything in the directory; there is no ordering, more specific overrides
1643          more general, and disabling takes precedence).
1644          Example: --enable-symbols="all -sw/ -Library_sc".]))
1646 libo_FUZZ_ARG_ENABLE(optimized,
1647     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1648         [Whether to compile with optimization flags.
1649          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1650          otherwise. Using 'debug' will try to use only optimizations that should
1651          not interfere with debugging. For Emscripten we default to optimized (-O1)
1652          debug build, as otherwise binaries become too large.]))
1654 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1655     AS_HELP_STRING([--disable-runtime-optimizations],
1656         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1657          JVM JIT) that are known to interact badly with certain dynamic analysis
1658          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1659          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1660          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1662 AC_ARG_WITH(valgrind,
1663     AS_HELP_STRING([--with-valgrind],
1664         [Make availability of Valgrind headers a hard requirement.]))
1666 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1667     AS_HELP_STRING([--enable-compiler-plugins],
1668         [Enable compiler plugins that will perform additional checks during
1669          building. Enabled automatically by --enable-dbgutil.
1670          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1671 COMPILER_PLUGINS_DEBUG=
1672 if test "$enable_compiler_plugins" = debug; then
1673     enable_compiler_plugins=yes
1674     COMPILER_PLUGINS_DEBUG=TRUE
1677 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1678     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1679         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1680          relevant in the --disable-compiler-plugins case.]))
1682 libo_FUZZ_ARG_ENABLE(ooenv,
1683     AS_HELP_STRING([--enable-ooenv],
1684         [Enable ooenv for the instdir installation.]))
1686 AC_ARG_ENABLE(lto,
1687     AS_HELP_STRING([--enable-lto],
1688         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1689          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1690          linker.)]))
1692 AC_ARG_ENABLE(python,
1693     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1694         [Enables or disables Python support at run-time.
1695          Also specifies what Python to use at build-time.
1696          'fully-internal' even forces the internal version for uses of Python
1697          during the build.
1698          On macOS the only choices are
1699          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1700          ]))
1702 libo_FUZZ_ARG_ENABLE(gtk3,
1703     AS_HELP_STRING([--disable-gtk3],
1704         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1705 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1707 AC_ARG_ENABLE(gtk4,
1708     AS_HELP_STRING([--enable-gtk4],
1709         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1711 AC_ARG_ENABLE(atspi-tests,
1712     AS_HELP_STRING([--disable-atspi-tests],
1713         [Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
1715 AC_ARG_ENABLE(introspection,
1716     AS_HELP_STRING([--enable-introspection],
1717         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1718          Linux distributions.)]))
1720 AC_ARG_ENABLE(split-app-modules,
1721     AS_HELP_STRING([--enable-split-app-modules],
1722         [Split file lists for app modules, e.g. base, calc.
1723          Has effect only with make distro-pack-install]),
1726 AC_ARG_ENABLE(split-opt-features,
1727     AS_HELP_STRING([--enable-split-opt-features],
1728         [Split file lists for some optional features, e.g. pyuno, testtool.
1729          Has effect only with make distro-pack-install]),
1732 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1733     AS_HELP_STRING([--disable-cairo-canvas],
1734         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1737 libo_FUZZ_ARG_ENABLE(dbus,
1738     AS_HELP_STRING([--disable-dbus],
1739         [Determines whether to enable features that depend on dbus.
1740          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1741 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1743 libo_FUZZ_ARG_ENABLE(sdremote,
1744     AS_HELP_STRING([--disable-sdremote],
1745         [Determines whether to enable Impress remote control (i.e. the server component).]),
1746 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1748 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1749     AS_HELP_STRING([--disable-sdremote-bluetooth],
1750         [Determines whether to build sdremote with bluetooth support.
1751          Requires dbus on Linux.]))
1753 libo_FUZZ_ARG_ENABLE(gio,
1754     AS_HELP_STRING([--disable-gio],
1755         [Determines whether to use the GIO support.]),
1756 ,test "${enable_gio+set}" = set || enable_gio=yes)
1758 AC_ARG_ENABLE(qt5,
1759     AS_HELP_STRING([--enable-qt5],
1760         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1761          available.]),
1764 AC_ARG_ENABLE(qt6,
1765     AS_HELP_STRING([--enable-qt6],
1766         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1767          available.]),
1770 AC_ARG_ENABLE(kf5,
1771     AS_HELP_STRING([--enable-kf5],
1772         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1773          KF5 are available.]),
1776 AC_ARG_ENABLE(kf6,
1777     AS_HELP_STRING([--enable-kf6],
1778         [Determines whether to use KF6 vclplug on platforms where Qt6 and
1779          KF6 are available.]),
1783 AC_ARG_ENABLE(gtk3_kde5,
1784     AS_HELP_STRING([--enable-gtk3-kde5],
1785         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1786          platforms where Gtk3, Qt5 and Plasma is available.]),
1789 AC_ARG_ENABLE(gen,
1790     AS_HELP_STRING([--enable-gen],
1791         [To select the gen backend in case of --disable-dynamic-loading.
1792          Per default auto-enabled when X11 is used.]),
1793 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1795 AC_ARG_ENABLE(gui,
1796     AS_HELP_STRING([--disable-gui],
1797         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1798 ,enable_gui=yes)
1800 libo_FUZZ_ARG_ENABLE(randr,
1801     AS_HELP_STRING([--disable-randr],
1802         [Disable RandR support in the vcl project.]),
1803 ,test "${enable_randr+set}" = set || enable_randr=yes)
1805 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1806     AS_HELP_STRING([--disable-gstreamer-1-0],
1807         [Disable building with the gstreamer 1.0 avmedia backend.]),
1808 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1810 libo_FUZZ_ARG_ENABLE([eot],
1811     [AS_HELP_STRING([--enable-eot],
1812         [Enable support for Embedded OpenType fonts.])],
1813 ,test "${enable_eot+set}" = set || enable_eot=no)
1815 libo_FUZZ_ARG_ENABLE(cve-tests,
1816     AS_HELP_STRING([--disable-cve-tests],
1817         [Prevent CVE tests to be executed]),
1820 AC_ARG_ENABLE(build-opensymbol,
1821     AS_HELP_STRING([--enable-build-opensymbol],
1822         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1823          fontforge installed.]),
1826 AC_ARG_ENABLE(dependency-tracking,
1827     AS_HELP_STRING([--enable-dependency-tracking],
1828         [Do not reject slow dependency extractors.])[
1829   --disable-dependency-tracking
1830                           Disables generation of dependency information.
1831                           Speed up one-time builds.],
1834 AC_ARG_ENABLE(icecream,
1835     AS_HELP_STRING([--enable-icecream],
1836         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1837          It defaults to /opt/icecream for the location of the icecream gcc/g++
1838          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1841 AC_ARG_ENABLE(ld,
1842     AS_HELP_STRING([--enable-ld=<linker>],
1843         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1844          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1845          If <linker> contains any ':', the part before the first ':' is used as the value of
1846          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1847          needed for Clang 12).]),
1850 libo_FUZZ_ARG_ENABLE(cups,
1851     AS_HELP_STRING([--disable-cups],
1852         [Do not build cups support.])
1855 AC_ARG_ENABLE(ccache,
1856     AS_HELP_STRING([--disable-ccache],
1857         [Do not try to use ccache automatically.
1858          By default we will try to detect if ccache is available; in that case if
1859          CC/CXX are not yet set, and --enable-icecream is not given, we
1860          attempt to use ccache. --disable-ccache disables ccache completely.
1861          Additionally ccache's depend mode is enabled if possible,
1862          use --enable-ccache=nodepend to enable ccache without depend mode.
1866 AC_ARG_ENABLE(z7-debug,
1867     AS_HELP_STRING([--enable-z7-debug],
1868         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1869          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1870          Enabled by default if ccache is detected.]))
1872 libo_FUZZ_ARG_ENABLE(online-update,
1873     AS_HELP_STRING([--enable-online-update],
1874         [Enable the online update service that will check for new versions of
1875          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.
1876          If the value is "mar", the experimental Mozilla-like update will be
1877          enabled instead of the traditional update mechanism.]),
1880 AC_ARG_WITH(update-config,
1881     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1882                    [Path to the update config ini file]))
1884 libo_FUZZ_ARG_ENABLE(extension-update,
1885     AS_HELP_STRING([--disable-extension-update],
1886         [Disable possibility to update installed extensions.]),
1889 libo_FUZZ_ARG_ENABLE(release-build,
1890     AS_HELP_STRING([--enable-release-build],
1891         [Enable release build. Note that the "release build" choice is orthogonal to
1892          whether symbols are present, debug info is generated, or optimization
1893          is done.
1894          See https://wiki.documentfoundation.org/Development/DevBuild]),
1897 AC_ARG_ENABLE(windows-build-signing,
1898     AS_HELP_STRING([--enable-windows-build-signing],
1899         [Enable signing of windows binaries (*.exe, *.dll)]),
1902 AC_ARG_ENABLE(silent-msi,
1903     AS_HELP_STRING([--enable-silent-msi],
1904         [Enable MSI with LIMITUI=1 (silent install).]),
1907 AC_ARG_ENABLE(wix,
1908     AS_HELP_STRING([--enable-wix],
1909         [Build Windows installer using WiX.]),
1912 AC_ARG_ENABLE(macosx-code-signing,
1913     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1914         [Sign executables, dylibs, frameworks and the app bundle. If you
1915          don't provide an identity the first suitable certificate
1916          in your keychain is used.]),
1919 AC_ARG_ENABLE(macosx-package-signing,
1920     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1921         [Create a .pkg suitable for uploading to the Mac App Store and sign
1922          it. If you don't provide an identity the first suitable certificate
1923          in your keychain is used.]),
1926 AC_ARG_ENABLE(macosx-sandbox,
1927     AS_HELP_STRING([--enable-macosx-sandbox],
1928         [Make the app bundle run in a sandbox. Requires code signing.
1929          Is required by apps distributed in the Mac App Store, and implies
1930          adherence to App Store rules.]),
1933 AC_ARG_WITH(macosx-bundle-identifier,
1934     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1935         [Define the macOS bundle identifier. Default is the somewhat weird
1936          org.libreoffice.script ("script", huh?).]),
1937 ,with_macosx_bundle_identifier=org.libreoffice.script)
1939 AC_ARG_WITH(macosx-provisioning-profile,
1940     AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
1941         [Specify the path to a provisioning profile to use]),
1944 AC_ARG_WITH(product-name,
1945     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1946         [Define the product name. Default is AC_PACKAGE_NAME.]),
1947 ,with_product_name=$PRODUCTNAME)
1949 libo_FUZZ_ARG_ENABLE(community-flavor,
1950     AS_HELP_STRING([--disable-community-flavor],
1951         [Disable the Community branding.]),
1954 AC_ARG_WITH(package-version,
1955     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1956         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1959 libo_FUZZ_ARG_ENABLE(readonly-installset,
1960     AS_HELP_STRING([--enable-readonly-installset],
1961         [Prevents any attempts by LibreOffice to write into its installation. That means
1962          at least that no "system-wide" extensions can be added. Partly experimental work in
1963          progress, probably not fully implemented. Always enabled for macOS.]),
1966 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1967     AS_HELP_STRING([--disable-mariadb-sdbc],
1968         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1971 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1972     AS_HELP_STRING([--disable-postgresql-sdbc],
1973         [Disable the build of the PostgreSQL-SDBC driver.])
1976 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1977     AS_HELP_STRING([--disable-lotuswordpro],
1978         [Disable the build of the Lotus Word Pro filter.]),
1979 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1981 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1982     AS_HELP_STRING([--disable-firebird-sdbc],
1983         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1984 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1986 AC_ARG_ENABLE(bogus-pkg-config,
1987     AS_HELP_STRING([--enable-bogus-pkg-config],
1988         [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.]),
1991 AC_ARG_ENABLE(openssl,
1992     AS_HELP_STRING([--disable-openssl],
1993         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1994          components will use NSS. Work in progress,
1995          use only if you are hacking on it.]),
1996 ,enable_openssl=yes)
1998 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1999     AS_HELP_STRING([--enable-cipher-openssl-backend],
2000         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
2001          Requires --enable-openssl.]))
2003 AC_ARG_ENABLE(nss,
2004     AS_HELP_STRING([--disable-nss],
2005         [Disable using NSS. If disabled,
2006          components will use openssl. Work in progress,
2007          use only if you are hacking on it.]),
2008 ,enable_nss=yes)
2010 AC_ARG_ENABLE(library-bin-tar,
2011     AS_HELP_STRING([--enable-library-bin-tar],
2012         [Enable the building and reused of tarball of binary build for some 'external' libraries.
2013         Some libraries can save their build result in a tarball
2014         stored in TARFILE_LOCATION. That binary tarball is
2015         uniquely identified by the source tarball,
2016         the content of the config_host.mk file and the content
2017         of the top-level directory in core for that library
2018         If this option is enabled, then if such a tarfile exist, it will be untarred
2019         instead of the source tarfile, and the build step will be skipped for that
2020         library.
2021         If a proper tarfile does not exist, then the normal source-based
2022         build is done for that library and a proper binary tarfile is created
2023         for the next time.]),
2026 AC_ARG_ENABLE(dconf,
2027     AS_HELP_STRING([--disable-dconf],
2028         [Disable the dconf configuration backend (enabled by default where
2029          available).]))
2031 libo_FUZZ_ARG_ENABLE(formula-logger,
2032     AS_HELP_STRING(
2033         [--enable-formula-logger],
2034         [Enable formula logger for logging formula calculation flow in Calc.]
2035     )
2038 AC_ARG_ENABLE(ldap,
2039     AS_HELP_STRING([--disable-ldap],
2040         [Disable LDAP support.]),
2041 ,enable_ldap=yes)
2043 AC_ARG_ENABLE(opencl,
2044     AS_HELP_STRING([--disable-opencl],
2045         [Disable OpenCL support.]),
2046 ,enable_opencl=yes)
2048 libo_FUZZ_ARG_ENABLE(librelogo,
2049     AS_HELP_STRING([--disable-librelogo],
2050         [Do not build LibreLogo.]),
2051 ,enable_librelogo=yes)
2053 AC_ARG_ENABLE(wasm-strip,
2054     AS_HELP_STRING([--enable-wasm-strip],
2055         [Strip the static build like for WASM/emscripten platform.]),
2058 AC_ARG_WITH(main-module,
2059     AS_HELP_STRING([--with-main-module=<writer/calc>],
2060         [Specify which main module to build for wasm.
2061         Default value is 'writer'.]),
2064 AC_ARG_ENABLE(wasm-exceptions,
2065     AS_HELP_STRING([--enable-wasm-exceptions],
2066         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2067         matter of fact, this is currently not finished by any implementation)
2068         (see https://webassembly.org/roadmap/ for the current state]),
2071 AC_ARG_ENABLE(xmlhelp,
2072     AS_HELP_STRING([--disable-xmlhelp],
2073         [Disable XML help support]),
2074 ,enable_xmlhelp=yes)
2076 AC_ARG_ENABLE(customtarget-components,
2077     AS_HELP_STRING([--enable-customtarget-components],
2078         [Generates the static UNO object constructor mapping from the build.]))
2080 dnl ===================================================================
2081 dnl Optional Packages (--with/without-)
2082 dnl ===================================================================
2084 AC_ARG_WITH(gcc-home,
2085     AS_HELP_STRING([--with-gcc-home],
2086         [Specify the location of gcc/g++ manually. This can be used in conjunction
2087          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2088          non-default path.]),
2091 AC_ARG_WITH(gnu-patch,
2092     AS_HELP_STRING([--with-gnu-patch],
2093         [Specify location of GNU patch on Solaris or FreeBSD.]),
2096 AC_ARG_WITH(build-platform-configure-options,
2097     AS_HELP_STRING([--with-build-platform-configure-options],
2098         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2101 AC_ARG_WITH(gnu-cp,
2102     AS_HELP_STRING([--with-gnu-cp],
2103         [Specify location of GNU cp on Solaris or FreeBSD.]),
2106 AC_ARG_WITH(external-tar,
2107     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2108         [Specify an absolute path of where to find (and store) tarfiles.]),
2109     TARFILE_LOCATION=$withval ,
2112 AC_ARG_WITH(referenced-git,
2113     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2114         [Specify another checkout directory to reference. This makes use of
2115                  git submodule update --reference, and saves a lot of diskspace
2116                  when having multiple trees side-by-side.]),
2117     GIT_REFERENCE_SRC=$withval ,
2120 AC_ARG_WITH(linked-git,
2121     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2122         [Specify a directory where the repositories of submodules are located.
2123          This uses a method similar to git-new-workdir to get submodules.]),
2124     GIT_LINK_SRC=$withval ,
2127 AC_ARG_WITH(galleries,
2128     AS_HELP_STRING([--with-galleries],
2129         [Specify how galleries should be built. It is possible either to
2130          build these internally from source ("build"),
2131          or to disable them ("no")]),
2134 AC_ARG_WITH(templates,
2135     AS_HELP_STRING([--with-templates],
2136         [Specify we build with or without template files. It is possible either to
2137          build with templates ("yes"),
2138          or to disable them ("no")]),
2141 AC_ARG_WITH(theme,
2142     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2143         [Choose which themes to include. By default those themes with an '*' are included.
2144          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2145          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2146          *elementary, *elementary_svg,
2147          *karasa_jaga, *karasa_jaga_svg,
2148          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2149          *sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
2152 libo_FUZZ_ARG_WITH(helppack-integration,
2153     AS_HELP_STRING([--without-helppack-integration],
2154         [It will not integrate the helppacks to the installer
2155          of the product. Please use this switch to use the online help
2156          or separate help packages.]),
2159 libo_FUZZ_ARG_WITH(fonts,
2160     AS_HELP_STRING([--without-fonts],
2161         [LibreOffice includes some third-party fonts to provide a reliable basis for
2162          help content, templates, samples, etc. When these fonts are already
2163          known to be available on the system then you should use this option.]),
2166 AC_ARG_WITH(epm,
2167     AS_HELP_STRING([--with-epm],
2168         [Decides which epm to use. Default is to use the one from the system if
2169          one is built. When either this is not there or you say =internal epm
2170          will be built.]),
2173 AC_ARG_WITH(package-format,
2174     AS_HELP_STRING([--with-package-format],
2175         [Specify package format(s) for LibreOffice installation sets. The
2176          implicit --without-package-format leads to no installation sets being
2177          generated. Possible values: archive, bsd, deb, dmg,
2178          installed, msi, pkg, and rpm.
2179          Example: --with-package-format='deb rpm']),
2182 AC_ARG_WITH(tls,
2183     AS_HELP_STRING([--with-tls],
2184         [Decides which TLS/SSL and cryptographic implementations to use for
2185          LibreOffice's code. Default is to use NSS although OpenSSL is also
2186          possible. Notice that selecting NSS restricts the usage of OpenSSL
2187          in LO's code but selecting OpenSSL doesn't restrict by now the
2188          usage of NSS in LO's code. Possible values: openssl, nss.
2189          Example: --with-tls="nss"]),
2192 AC_ARG_WITH(system-libs,
2193     AS_HELP_STRING([--with-system-libs],
2194         [Use libraries already on system -- enables all --with-system-* flags.]),
2197 AC_ARG_WITH(system-bzip2,
2198     AS_HELP_STRING([--with-system-bzip2],
2199         [Use bzip2 already on system. Used when --enable-online-update=mar
2200         or --enable-python=internal]),,
2201     [with_system_bzip2="$with_system_libs"])
2203 AC_ARG_WITH(system-headers,
2204     AS_HELP_STRING([--with-system-headers],
2205         [Use headers already on system -- enables all --with-system-* flags for
2206          external packages whose headers are the only entities used i.e.
2207          boost/odbc/sane-header(s).]),,
2208     [with_system_headers="$with_system_libs"])
2210 AC_ARG_WITH(system-jars,
2211     AS_HELP_STRING([--without-system-jars],
2212         [When building with --with-system-libs, also the needed jars are expected
2213          on the system. Use this to disable that]),,
2214     [with_system_jars="$with_system_libs"])
2216 AC_ARG_WITH(system-cairo,
2217     AS_HELP_STRING([--with-system-cairo],
2218         [Use cairo libraries already on system.  Happens automatically for
2219          (implicit) --enable-gtk3.]))
2221 AC_ARG_WITH(system-epoxy,
2222     AS_HELP_STRING([--with-system-epoxy],
2223         [Use epoxy libraries already on system.  Happens automatically for
2224          (implicit) --enable-gtk3.]),,
2225        [with_system_epoxy="$with_system_libs"])
2227 AC_ARG_WITH(myspell-dicts,
2228     AS_HELP_STRING([--with-myspell-dicts],
2229         [Adds myspell dictionaries to the LibreOffice installation set]),
2232 AC_ARG_WITH(system-dicts,
2233     AS_HELP_STRING([--without-system-dicts],
2234         [Do not use dictionaries from system paths.]),
2237 AC_ARG_WITH(external-dict-dir,
2238     AS_HELP_STRING([--with-external-dict-dir],
2239         [Specify external dictionary dir.]),
2242 AC_ARG_WITH(external-hyph-dir,
2243     AS_HELP_STRING([--with-external-hyph-dir],
2244         [Specify external hyphenation pattern dir.]),
2247 AC_ARG_WITH(external-thes-dir,
2248     AS_HELP_STRING([--with-external-thes-dir],
2249         [Specify external thesaurus dir.]),
2252 AC_ARG_WITH(system-zlib,
2253     AS_HELP_STRING([--with-system-zlib],
2254         [Use zlib already on system.]),,
2255     [with_system_zlib=auto])
2257 AC_ARG_WITH(system-jpeg,
2258     AS_HELP_STRING([--with-system-jpeg],
2259         [Use jpeg already on system.]),,
2260     [with_system_jpeg="$with_system_libs"])
2262 AC_ARG_WITH(system-expat,
2263     AS_HELP_STRING([--with-system-expat],
2264         [Use expat already on system.]),,
2265     [with_system_expat="$with_system_libs"])
2267 AC_ARG_WITH(system-libxml,
2268     AS_HELP_STRING([--with-system-libxml],
2269         [Use libxml/libxslt already on system.]),,
2270     [with_system_libxml=auto])
2272 AC_ARG_WITH(system-openldap,
2273     AS_HELP_STRING([--with-system-openldap],
2274         [Use the OpenLDAP LDAP SDK already on system.]),,
2275     [with_system_openldap="$with_system_libs"])
2277 libo_FUZZ_ARG_ENABLE(poppler,
2278     AS_HELP_STRING([--disable-poppler],
2279         [Disable building Poppler.])
2282 AC_ARG_WITH(system-poppler,
2283     AS_HELP_STRING([--with-system-poppler],
2284         [Use system poppler (only needed for PDF import).]),,
2285     [with_system_poppler="$with_system_libs"])
2287 AC_ARG_WITH(system-abseil,
2288     AS_HELP_STRING([--with-system-abseil],
2289         [Use the abseil libraries already on system.]),,
2290     [with_system_abseil="$with_system_libs"])
2292 AC_ARG_WITH(system-openjpeg,
2293     AS_HELP_STRING([--with-system-openjpeg],
2294         [Use the OpenJPEG library already on system.]),,
2295     [with_system_openjpeg="$with_system_libs"])
2297 libo_FUZZ_ARG_ENABLE(gpgmepp,
2298     AS_HELP_STRING([--disable-gpgmepp],
2299         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2302 AC_ARG_WITH(system-gpgmepp,
2303     AS_HELP_STRING([--with-system-gpgmepp],
2304         [Use gpgmepp already on system]),,
2305     [with_system_gpgmepp="$with_system_libs"])
2307 AC_ARG_WITH(system-mariadb,
2308     AS_HELP_STRING([--with-system-mariadb],
2309         [Use MariaDB/MySQL libraries already on system.]),,
2310     [with_system_mariadb="$with_system_libs"])
2312 AC_ARG_ENABLE(bundle-mariadb,
2313     AS_HELP_STRING([--enable-bundle-mariadb],
2314         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2317 AC_ARG_WITH(system-postgresql,
2318     AS_HELP_STRING([--with-system-postgresql],
2319         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2320          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2321     [with_system_postgresql="$with_system_libs"])
2323 AC_ARG_WITH(libpq-path,
2324     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2325         [Use this PostgreSQL C interface (libpq) installation for building
2326          the PostgreSQL-SDBC extension.]),
2329 AC_ARG_WITH(system-firebird,
2330     AS_HELP_STRING([--with-system-firebird],
2331         [Use Firebird libraries already on system, for building the Firebird-SDBC
2332          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2333     [with_system_firebird="$with_system_libs"])
2335 AC_ARG_WITH(system-libtommath,
2336             AS_HELP_STRING([--with-system-libtommath],
2337                            [Use libtommath already on system]),,
2338             [with_system_libtommath="$with_system_libs"])
2340 AC_ARG_WITH(system-hsqldb,
2341     AS_HELP_STRING([--with-system-hsqldb],
2342         [Use hsqldb already on system.]))
2344 AC_ARG_WITH(hsqldb-jar,
2345     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2346         [Specify path to jarfile manually.]),
2347     HSQLDB_JAR=$withval)
2349 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2350     AS_HELP_STRING([--disable-scripting-beanshell],
2351         [Disable support for scripts in BeanShell.]),
2355 AC_ARG_WITH(system-beanshell,
2356     AS_HELP_STRING([--with-system-beanshell],
2357         [Use beanshell already on system.]),,
2358     [with_system_beanshell="$with_system_jars"])
2360 AC_ARG_WITH(beanshell-jar,
2361     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2362         [Specify path to jarfile manually.]),
2363     BSH_JAR=$withval)
2365 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2366     AS_HELP_STRING([--disable-scripting-javascript],
2367         [Disable support for scripts in JavaScript.]),
2371 AC_ARG_WITH(system-rhino,
2372     AS_HELP_STRING([--with-system-rhino],
2373         [Use rhino already on system.]),,)
2374 #    [with_system_rhino="$with_system_jars"])
2375 # Above is not used as we have different debug interface
2376 # patched into internal rhino. This code needs to be fixed
2377 # before we can enable it by default.
2379 AC_ARG_WITH(rhino-jar,
2380     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2381         [Specify path to jarfile manually.]),
2382     RHINO_JAR=$withval)
2384 AC_ARG_WITH(system-jfreereport,
2385     AS_HELP_STRING([--with-system-jfreereport],
2386         [Use JFreeReport already on system.]),,
2387     [with_system_jfreereport="$with_system_jars"])
2389 AC_ARG_WITH(sac-jar,
2390     AS_HELP_STRING([--with-sac-jar=JARFILE],
2391         [Specify path to jarfile manually.]),
2392     SAC_JAR=$withval)
2394 AC_ARG_WITH(libxml-jar,
2395     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2396         [Specify path to jarfile manually.]),
2397     LIBXML_JAR=$withval)
2399 AC_ARG_WITH(flute-jar,
2400     AS_HELP_STRING([--with-flute-jar=JARFILE],
2401         [Specify path to jarfile manually.]),
2402     FLUTE_JAR=$withval)
2404 AC_ARG_WITH(jfreereport-jar,
2405     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2406         [Specify path to jarfile manually.]),
2407     JFREEREPORT_JAR=$withval)
2409 AC_ARG_WITH(liblayout-jar,
2410     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2411         [Specify path to jarfile manually.]),
2412     LIBLAYOUT_JAR=$withval)
2414 AC_ARG_WITH(libloader-jar,
2415     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2416         [Specify path to jarfile manually.]),
2417     LIBLOADER_JAR=$withval)
2419 AC_ARG_WITH(libformula-jar,
2420     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2421         [Specify path to jarfile manually.]),
2422     LIBFORMULA_JAR=$withval)
2424 AC_ARG_WITH(librepository-jar,
2425     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2426         [Specify path to jarfile manually.]),
2427     LIBREPOSITORY_JAR=$withval)
2429 AC_ARG_WITH(libfonts-jar,
2430     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2431         [Specify path to jarfile manually.]),
2432     LIBFONTS_JAR=$withval)
2434 AC_ARG_WITH(libserializer-jar,
2435     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2436         [Specify path to jarfile manually.]),
2437     LIBSERIALIZER_JAR=$withval)
2439 AC_ARG_WITH(libbase-jar,
2440     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2441         [Specify path to jarfile manually.]),
2442     LIBBASE_JAR=$withval)
2444 AC_ARG_WITH(system-odbc,
2445     AS_HELP_STRING([--with-system-odbc],
2446         [Use the odbc headers already on system.]),,
2447     [with_system_odbc="auto"])
2449 AC_ARG_WITH(system-sane,
2450     AS_HELP_STRING([--with-system-sane],
2451         [Use sane.h already on system.]),,
2452     [with_system_sane="$with_system_headers"])
2454 AC_ARG_WITH(system-bluez,
2455     AS_HELP_STRING([--with-system-bluez],
2456         [Use bluetooth.h already on system.]),,
2457     [with_system_bluez="$with_system_headers"])
2459 AC_ARG_WITH(system-boost,
2460     AS_HELP_STRING([--with-system-boost],
2461         [Use boost already on system.]),,
2462     [with_system_boost="$with_system_headers"])
2464 AC_ARG_WITH(system-dragonbox,
2465     AS_HELP_STRING([--with-system-dragonbox],
2466         [Use dragonbox already on system.]),,
2467     [with_system_dragonbox="$with_system_headers"])
2469 AC_ARG_WITH(system-frozen,
2470     AS_HELP_STRING([--with-system-frozen],
2471         [Use frozen already on system.]),,
2472     [with_system_frozen="$with_system_headers"])
2474 AC_ARG_WITH(system-libfixmath,
2475     AS_HELP_STRING([--with-system-libfixmath],
2476         [Use libfixmath already on system.]),,
2477     [with_system_libfixmath="$with_system_libs"])
2479 AC_ARG_WITH(system-glm,
2480     AS_HELP_STRING([--with-system-glm],
2481         [Use glm already on system.]),,
2482     [with_system_glm="$with_system_headers"])
2484 AC_ARG_WITH(system-hunspell,
2485     AS_HELP_STRING([--with-system-hunspell],
2486         [Use libhunspell already on system.]),,
2487     [with_system_hunspell="$with_system_libs"])
2489 libo_FUZZ_ARG_ENABLE(cairo-rgba,
2490     AS_HELP_STRING([--enable-cairo-rgba],
2491         [Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
2493 libo_FUZZ_ARG_ENABLE(zxing,
2494     AS_HELP_STRING([--disable-zxing],
2495        [Disable use of zxing external library.]))
2497 AC_ARG_WITH(system-zxing,
2498     AS_HELP_STRING([--with-system-zxing],
2499         [Use libzxing already on system.]),,
2500     [with_system_zxing="$with_system_libs"])
2502 AC_ARG_WITH(system-zxcvbn,
2503     AS_HELP_STRING([--with-system-zxcvbn],
2504         [Use libzxcvbn already on system.]),,
2505     [with_system_zxcvbn="$with_system_libs"])
2507 AC_ARG_WITH(system-box2d,
2508     AS_HELP_STRING([--with-system-box2d],
2509         [Use box2d already on system.]),,
2510     [with_system_box2d="$with_system_libs"])
2512 AC_ARG_WITH(system-mythes,
2513     AS_HELP_STRING([--with-system-mythes],
2514         [Use mythes already on system.]),,
2515     [with_system_mythes="$with_system_libs"])
2517 AC_ARG_WITH(system-altlinuxhyph,
2518     AS_HELP_STRING([--with-system-altlinuxhyph],
2519         [Use ALTLinuxhyph already on system.]),,
2520     [with_system_altlinuxhyph="$with_system_libs"])
2522 AC_ARG_WITH(system-lpsolve,
2523     AS_HELP_STRING([--with-system-lpsolve],
2524         [Use lpsolve already on system.]),,
2525     [with_system_lpsolve="$with_system_libs"])
2527 AC_ARG_WITH(system-coinmp,
2528     AS_HELP_STRING([--with-system-coinmp],
2529         [Use CoinMP already on system.]),,
2530     [with_system_coinmp="$with_system_libs"])
2532 AC_ARG_WITH(system-liblangtag,
2533     AS_HELP_STRING([--with-system-liblangtag],
2534         [Use liblangtag library already on system.]),,
2535     [with_system_liblangtag="$with_system_libs"])
2537 AC_ARG_WITH(system-lockfile,
2538     AS_HELP_STRING([--with-system-lockfile[=file]],
2539         [Detect a system lockfile program or use the \$file argument.]))
2541 AC_ARG_WITH(webdav,
2542     AS_HELP_STRING([--without-webdav],
2543         [Disable WebDAV support in the UCB.]))
2545 AC_ARG_WITH(linker-hash-style,
2546     AS_HELP_STRING([--with-linker-hash-style],
2547         [Use linker with --hash-style=<style> when linking shared objects.
2548          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2549          if supported on the build system, and "sysv" otherwise.]))
2551 AC_ARG_WITH(jdk-home,
2552     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2553         [If you have installed JDK 17 or later on your system please supply the
2554          path here. Note that this is not the location of the java command but the
2555          location of the entire distribution. In case of cross-compiling, this
2556          is the JDK of the host os. Use --with-build-platform-configure-options
2557          to point to a different build platform JDK.]),
2560 AC_ARG_WITH(help,
2561     AS_HELP_STRING([--with-help],
2562         [Enable the build of help. There is a special parameter "common" that
2563          can be used to bundle only the common part, .e.g help-specific icons.
2564          This is useful when you build the helpcontent separately.])
2565     [
2566                           Usage:     --with-help    build the old local help
2567                                  --without-help     no local help (default)
2568                                  --with-help=html   build the new HTML local help
2569                                  --with-help=online build the new HTML online help
2570     ],
2573 AC_ARG_WITH(omindex,
2574    AS_HELP_STRING([--with-omindex],
2575         [Enable the support of xapian-omega index for online help.])
2576    [
2577                          Usage: --with-omindex=server prepare the pages for omindex
2578                                 but let xapian-omega be built in server.
2579                                 --with-omindex=noxap do not prepare online pages
2580                                 for xapian-omega
2581   ],
2584 libo_FUZZ_ARG_WITH(java,
2585     AS_HELP_STRING([--with-java=<java command>],
2586         [Specify the name of the Java interpreter command. Typically "java"
2587          which is the default.
2589          To build without support for Java components, applets, accessibility
2590          or the XML filters written in Java, use --without-java or --with-java=no.]),
2591     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2592     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2595 AC_ARG_WITH(jvm-path,
2596     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2597         [Use a specific JVM search path at runtime.
2598          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2601 AC_ARG_WITH(ant-home,
2602     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2603         [If you have installed Apache Ant on your system, please supply the path here.
2604          Note that this is not the location of the Ant binary but the location
2605          of the entire distribution.]),
2608 AC_ARG_WITH(symbol-config,
2609     AS_HELP_STRING([--with-symbol-config],
2610         [Configuration for the crashreport symbol upload]),
2611         [],
2612         [with_symbol_config=no])
2614 AC_ARG_WITH(export-validation,
2615     AS_HELP_STRING([--without-export-validation],
2616         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2617 ,with_export_validation=auto)
2619 AC_ARG_WITH(bffvalidator,
2620     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2621         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2622          Requires installed Microsoft Office Binary File Format Validator.
2623          Note: export-validation (--with-export-validation) is required to be turned on.
2624          See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2625 ,with_bffvalidator=no)
2627 libo_FUZZ_ARG_WITH(junit,
2628     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2629         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2630          --without-junit disables those tests. Not relevant in the --without-java case.]),
2631 ,with_junit=yes)
2633 AC_ARG_WITH(hamcrest,
2634     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2635         [Specifies the hamcrest jar file to use for JUnit-based tests.
2636          --without-junit disables those tests. Not relevant in the --without-java case.]),
2637 ,with_hamcrest=yes)
2639 AC_ARG_WITH(perl-home,
2640     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2641         [If you have installed Perl 5 Distribution, on your system, please
2642          supply the path here. Note that this is not the location of the Perl
2643          binary but the location of the entire distribution.]),
2646 libo_FUZZ_ARG_WITH(doxygen,
2647     AS_HELP_STRING(
2648         [--with-doxygen=<absolute path to doxygen executable>],
2649         [Specifies the doxygen executable to use when generating ODK C/C++
2650          documentation. --without-doxygen disables generation of ODK C/C++
2651          documentation. Not relevant in the --disable-odk case.]),
2652 ,with_doxygen=yes)
2654 AC_ARG_WITH(visual-studio,
2655     AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
2656         [Specify which Visual Studio version to use in case several are
2657          installed. Currently 2019 (default) and 2022 are supported.]),
2660 AC_ARG_WITH(windows-sdk,
2661     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2662         [Specify which Windows SDK, or "Windows Kit", version to use
2663          in case the one that came with the selected Visual Studio
2664          is not what you want for some reason. Note that not all compiler/SDK
2665          combinations are supported. The intent is that this option should not
2666          be needed.]),
2669 AC_ARG_WITH(lang,
2670     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2671         [Use this option to build LibreOffice with additional UI language support.
2672          English (US) is always included by default.
2673          Separate multiple languages with space.
2674          For all languages, use --with-lang=ALL.]),
2677 AC_ARG_WITH(locales,
2678     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2679         [Use this option to limit the locale information built in.
2680          Separate multiple locales with space.
2681          Very experimental and might well break stuff.
2682          Just a desperate measure to shrink code and data size.
2683          By default all the locales available is included.
2684          Just works with --disable-dynloading. Defaults to "ALL".
2685          This option is completely unrelated to --with-lang.])
2686     [
2687                           Affects also our character encoding conversion
2688                           tables for encodings mainly targeted for a
2689                           particular locale, like EUC-CN and EUC-TW for
2690                           zh, ISO-2022-JP for ja.
2692                           Affects also our add-on break iterator data for
2693                           some languages.
2695                           For the default, all locales, don't use this switch at all.
2696                           Specifying just the language part of a locale means all matching
2697                           locales will be included.
2698     ],
2701 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2702 libo_FUZZ_ARG_WITH(krb5,
2703     AS_HELP_STRING([--with-krb5],
2704         [Enable MIT Kerberos 5 support in modules that support it.
2705          By default automatically enabled on platforms
2706          where a good system Kerberos 5 is available.]),
2709 libo_FUZZ_ARG_WITH(gssapi,
2710     AS_HELP_STRING([--with-gssapi],
2711         [Enable GSSAPI support in modules that support it.
2712          By default automatically enabled on platforms
2713          where a good system GSSAPI is available.]),
2716 libo_FUZZ_ARG_WITH(lxml,
2717     AS_HELP_STRING([--without-lxml],
2718         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2719          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2720          report widget classes and ids.]),
2723 libo_FUZZ_ARG_WITH(latest-c++,
2724     AS_HELP_STRING([--with-latest-c++],
2725         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2726          published standard.  This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
2727         [with_latest_c__=no])
2729 AC_ARG_WITH(gtk3-build,
2730     AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
2731         [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
2732          to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
2734 dnl ===================================================================
2735 dnl Branding
2736 dnl ===================================================================
2738 AC_ARG_WITH(branding,
2739     AS_HELP_STRING([--with-branding=/path/to/images],
2740         [Use given path to retrieve branding images set.])
2741     [
2742                           Search for intro.png about.svg and logo.svg.
2743                           If any is missing, default ones will be used instead.
2745                           Search also progress.conf for progress
2746                           settings on intro screen :
2748                           PROGRESSBARCOLOR="255,255,255" Set color of
2749                           progress bar. Comma separated RGB decimal values.
2750                           PROGRESSSIZE="407,6" Set size of progress bar.
2751                           Comma separated decimal values (width, height).
2752                           PROGRESSPOSITION="61,317" Set position of progress
2753                           bar from left,top. Comma separated decimal values.
2754                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2755                           bar frame. Comma separated RGB decimal values.
2756                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2757                           bar text. Comma separated RGB decimal values.
2758                           PROGRESSTEXTBASELINE="287" Set vertical position of
2759                           progress bar text from top. Decimal value.
2761                           Default values will be used if not found.
2762     ],
2766 AC_ARG_WITH(extra-buildid,
2767     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2768         [Show addition build identification in about dialog.]),
2772 AC_ARG_WITH(vendor,
2773     AS_HELP_STRING([--with-vendor="John the Builder"],
2774         [Set vendor of the build.]),
2777 AC_ARG_WITH(privacy-policy-url,
2778     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2779         [The URL to your privacy policy (needed when
2780          enabling online-update or crashreporting via breakpad)]),
2781         [if test "x$with_privacy_policy_url" = "xyes"; then
2782             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2783          elif test "x$with_privacy_policy_url" = "xno"; then
2784             with_privacy_policy_url="undefined"
2785          fi]
2786 ,[with_privacy_policy_url="undefined"])
2788 AC_ARG_WITH(android-package-name,
2789     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2790         [Set Android package name of the build.]),
2793 AC_ARG_WITH(compat-oowrappers,
2794     AS_HELP_STRING([--with-compat-oowrappers],
2795         [Install oo* wrappers in parallel with
2796          lo* ones to keep backward compatibility.
2797          Has effect only with make distro-pack-install]),
2800 AC_ARG_WITH(os-version,
2801     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2802         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2805 AC_ARG_WITH(parallelism,
2806     AS_HELP_STRING([--with-parallelism],
2807         [Number of jobs to run simultaneously during build. Parallel builds can
2808         save a lot of time on multi-cpu machines. Defaults to the number of
2809         CPUs on the machine, unless you configure --enable-icecream - then to
2810         40.]),
2813 AC_ARG_WITH(all-tarballs,
2814     AS_HELP_STRING([--with-all-tarballs],
2815         [Download all external tarballs unconditionally]))
2817 AC_ARG_WITH(gdrive-client-id,
2818     AS_HELP_STRING([--with-gdrive-client-id],
2819         [Provides the client id of the application for OAuth2 authentication
2820         on Google Drive. If either this or --with-gdrive-client-secret is
2821         empty, the feature will be disabled]),
2824 AC_ARG_WITH(gdrive-client-secret,
2825     AS_HELP_STRING([--with-gdrive-client-secret],
2826         [Provides the client secret of the application for OAuth2
2827         authentication on Google Drive. If either this or
2828         --with-gdrive-client-id is empty, the feature will be disabled]),
2831 AC_ARG_WITH(alfresco-cloud-client-id,
2832     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2833         [Provides the client id of the application for OAuth2 authentication
2834         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2835         empty, the feature will be disabled]),
2838 AC_ARG_WITH(alfresco-cloud-client-secret,
2839     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2840         [Provides the client secret of the application for OAuth2
2841         authentication on Alfresco Cloud. If either this or
2842         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2845 AC_ARG_WITH(onedrive-client-id,
2846     AS_HELP_STRING([--with-onedrive-client-id],
2847         [Provides the client id of the application for OAuth2 authentication
2848         on OneDrive. If either this or --with-onedrive-client-secret is
2849         empty, the feature will be disabled]),
2852 AC_ARG_WITH(onedrive-client-secret,
2853     AS_HELP_STRING([--with-onedrive-client-secret],
2854         [Provides the client secret of the application for OAuth2
2855         authentication on OneDrive. If either this or
2856         --with-onedrive-client-id is empty, the feature will be disabled]),
2859 dnl Check for coredumpctl support to present information about crashing test processes:
2860 AC_ARG_WITH(coredumpctl,
2861     AS_HELP_STRING([--with-coredumpctl],
2862         [Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
2863         processes.]))
2865 AC_ARG_WITH(buildconfig-recorded,
2866     AS_HELP_STRING([--with-buildconfig-recorded],
2867         [Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
2870 AC_MSG_CHECKING([whether to record build config])
2871 if test -z "$with_buildconfig_recorded"; then
2872     with_buildconfig_recorded=no
2874 if test "$with_buildconfig_recorded" = no; then
2875     AC_MSG_RESULT([no])
2876 else
2877     AC_MSG_RESULT([yes])
2878     # replace backslashes, to get a valid c++ string
2879     config_args=$(echo $ac_configure_args | tr '\\' '/')
2880     AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
2881     AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
2884 dnl ===================================================================
2885 dnl Do we want to use pre-build binary tarball for recompile
2886 dnl ===================================================================
2888 if test "$enable_library_bin_tar" = "yes" ; then
2889     USE_LIBRARY_BIN_TAR=TRUE
2890 else
2891     USE_LIBRARY_BIN_TAR=
2893 AC_SUBST(USE_LIBRARY_BIN_TAR)
2895 dnl ===================================================================
2896 dnl Test whether build target is Release Build
2897 dnl ===================================================================
2898 AC_MSG_CHECKING([whether build target is Release Build])
2899 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2900     AC_MSG_RESULT([no])
2901     ENABLE_RELEASE_BUILD=
2902     dnl Pu the value on one line as make (at least on macOS) seems to ignore
2903     dnl the newlines and then complains about spaces.
2904     GET_TASK_ALLOW_ENTITLEMENT='<!-- We want to be able to debug a hardened process when not building for release --><key>com.apple.security.get-task-allow</key><true/>'
2905 else
2906     AC_MSG_RESULT([yes])
2907     ENABLE_RELEASE_BUILD=TRUE
2908     GET_TASK_ALLOW_ENTITLEMENT=
2910 AC_SUBST(ENABLE_RELEASE_BUILD)
2911 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2913 AC_MSG_CHECKING([whether to build a Community flavor])
2914 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2915     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2916     AC_MSG_RESULT([yes])
2917 else
2918     AC_MSG_RESULT([no])
2921 dnl ===================================================================
2922 dnl Test whether to sign Windows Build
2923 dnl ===================================================================
2924 AC_MSG_CHECKING([whether to sign windows build])
2925 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2926     AC_MSG_RESULT([yes])
2927     WINDOWS_BUILD_SIGNING="TRUE"
2928 else
2929     AC_MSG_RESULT([no])
2930     WINDOWS_BUILD_SIGNING="FALSE"
2932 AC_SUBST(WINDOWS_BUILD_SIGNING)
2934 dnl ===================================================================
2935 dnl MacOSX build and runtime environment options
2936 dnl ===================================================================
2938 AC_ARG_WITH(macosx-version-min-required,
2939     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2940         [set the minimum OS version needed to run the built LibreOffice])
2941     [
2942                           e. g.: --with-macosx-version-min-required=10.15
2943     ],
2946 dnl ===================================================================
2947 dnl Check for incompatible options set by fuzzing, and reset those
2948 dnl automatically to working combinations
2949 dnl ===================================================================
2951 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2952         "$enable_dbus" != "$enable_avahi"; then
2953     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2954     enable_avahi=$enable_dbus
2957 add_lopath_after ()
2959     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2960         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2961     fi
2964 add_lopath_before ()
2966     local IFS=${P_SEP}
2967     local path_cleanup
2968     local dir
2969     for dir in $LO_PATH ; do
2970         if test "$dir" != "$1" ; then
2971             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2972         fi
2973     done
2974     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2977 dnl ===================================================================
2978 dnl check for required programs (grep, awk, sed, bash)
2979 dnl ===================================================================
2981 pathmunge ()
2983     local new_path
2984     if test -n "$1"; then
2985         if test "$build_os" = "cygwin"; then
2986             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2987                 PathFormat "$1"
2988                 new_path=`cygpath -sm "$formatted_path"`
2989             else
2990                 PathFormat "$1"
2991                 new_path=`cygpath -u "$formatted_path"`
2992             fi
2993         else
2994             new_path="$1"
2995         fi
2996         if test "$2" = "after"; then
2997             add_lopath_after "$new_path"
2998         else
2999             add_lopath_before "$new_path"
3000         fi
3001     fi
3004 AC_PROG_AWK
3005 AC_PATH_PROG( AWK, $AWK)
3006 if test -z "$AWK"; then
3007     AC_MSG_ERROR([install awk to run this script])
3010 AC_PATH_PROG(BASH, bash)
3011 if test -z "$BASH"; then
3012     AC_MSG_ERROR([bash not found in \$PATH])
3014 AC_SUBST(BASH)
3016 # prefer parallel compression tools, if available
3017 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
3018 if test -z "$COMPRESSIONTOOL"; then
3019     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
3020     if test -z "$COMPRESSIONTOOL"; then
3021         AC_MSG_ERROR([gzip not found in \$PATH])
3022     fi
3024 AC_SUBST(COMPRESSIONTOOL)
3026 AC_MSG_CHECKING([for GNU or BSD tar])
3027 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
3028     $a --version 2> /dev/null | grep -E "GNU|bsdtar"  2>&1 > /dev/null
3029     if test $? -eq 0;  then
3030         GNUTAR=$a
3031         break
3032     fi
3033 done
3034 AC_MSG_RESULT($GNUTAR)
3035 if test -z "$GNUTAR"; then
3036     AC_MSG_ERROR([not found. install GNU or BSD tar.])
3038 AC_SUBST(GNUTAR)
3040 AC_MSG_CHECKING([for tar's option to strip components])
3041 $GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
3042 if test $? -eq 0; then
3043     STRIP_COMPONENTS="--strip-components"
3044 else
3045     $GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
3046     if test $? -eq 0; then
3047         STRIP_COMPONENTS="--strip-path"
3048     else
3049         STRIP_COMPONENTS="unsupported"
3050     fi
3052 AC_MSG_RESULT($STRIP_COMPONENTS)
3053 if test x$STRIP_COMPONENTS = xunsupported; then
3054     AC_MSG_ERROR([you need a tar that is able to strip components.])
3056 AC_SUBST(STRIP_COMPONENTS)
3058 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
3059 dnl desktop OSes from "mobile" ones.
3061 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3062 dnl In other words, that when building for an OS that is not a
3063 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3065 dnl Note the direction of the implication; there is no assumption that
3066 dnl cross-compiling would imply a non-desktop OS.
3068 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3069     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3070     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3071     if test "$_os" != Emscripten; then
3072         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3073     fi
3076 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3077 # also work with the default gtk3 plugin.
3078 if test "$enable_wasm_strip" = "yes"; then
3079     enable_avmedia=no
3080     enable_libcmis=no
3081     enable_coinmp=no
3082     enable_cups=no
3083     test "$_os" = Emscripten && enable_curl=no
3084     enable_database_connectivity=no
3085     enable_dbus=no
3086     enable_dconf=no
3087     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3088     enable_extension_integration=no
3089     enable_extensions=no
3090     enable_extension_update=no
3091     enable_gio=no
3092     enable_gpgmepp=no
3093     enable_ldap=no
3094     enable_lotuswordpro=no
3095     enable_lpsolve=no
3096     enable_nss=no
3097     enable_odk=no
3098     enable_online_update=no
3099     enable_opencl=no
3100     enable_pdfimport=no
3101     enable_randr=no
3102     enable_report_builder=no
3103     enable_scripting=no
3104     enable_sdremote_bluetooth=no
3105     enable_skia=no
3106     enable_xmlhelp=no
3107     enable_zxing=no
3108     test_libepubgen=no
3109     test_libcdr=no
3110     test_libcmis=no
3111     test_libetonyek=no
3112     test_libfreehand=no
3113     test_libmspub=no
3114     test_libpagemaker=no
3115     test_libqxp=no
3116     test_libvisio=no
3117     test_libzmf=no
3118     test_webdav=no
3119     with_galleries=no
3120     with_templates=no
3121     with_webdav=no
3122     with_x=no
3124     test "${with_fonts+set}" = set || with_fonts=yes
3125     test "${with_locales+set}" = set || with_locales=en
3127     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3128     AC_DEFINE(ENABLE_WASM_STRIP_WRITER)
3129     AC_DEFINE(ENABLE_WASM_STRIP_CALC)
3130     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3131 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3132     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3133     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3134     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3135     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3136 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3137     AC_DEFINE(ENABLE_WASM_STRIP_LANGUAGETOOL)
3138     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3139     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3140     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3141     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3142     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3143     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3144     AC_DEFINE(ENABLE_WASM_STRIP_SCEXPORTS)
3147 EMSCRIPTEN_NEH_MAJOR=3
3148 EMSCRIPTEN_NEH_MINOR=1
3149 EMSCRIPTEN_NEH_TINY=3
3150 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3152 if test "$enable_wasm_exceptions" = yes; then
3153     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3154     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3155     if test $? -ne 0; then
3156         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3157     else
3158         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3159     fi
3160     ENABLE_WASM_EXCEPTIONS=TRUE
3162 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3164 # Whether to build "avmedia" functionality or not.
3166 if test "$enable_avmedia" = yes; then
3167     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3168     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3169 else
3170     test_gstreamer_1_0=no
3173 # Decide whether to build database connectivity stuff (including Base) or not.
3174 if test "$enable_database_connectivity" != no; then
3175     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3176     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3177 else
3178     if test "$_os" = iOS; then
3179         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3180     fi
3181     disable_database_connectivity_dependencies
3184 if test -z "$enable_extensions"; then
3185     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3186     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3187         enable_extensions=yes
3188     fi
3191 DISABLE_SCRIPTING=''
3192 if test "$enable_scripting" = yes; then
3193     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3194     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3195 else
3196     DISABLE_SCRIPTING='TRUE'
3197     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3200 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3201     # Disable dynamic_loading always for iOS and Android
3202     enable_dynamic_loading=no
3203 elif test -z "$enable_dynamic_loading"; then
3204     # Otherwise enable it unless specifically disabled
3205     enable_dynamic_loading=yes
3208 DISABLE_DYNLOADING=''
3209 if test "$enable_dynamic_loading" = yes; then
3210     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3211 else
3212     DISABLE_DYNLOADING='TRUE'
3213     if test $_os != iOS -a $_os != Android; then
3214         enable_database_connectivity=no
3215         enable_nss=no
3216         enable_odk=no
3217         enable_python=no
3218         enable_skia=no
3219         with_java=no
3220     fi
3222 AC_SUBST(DISABLE_DYNLOADING)
3224 ENABLE_CUSTOMTARGET_COMPONENTS=
3225 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3226     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3227     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3228         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3229     fi
3231 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3233 if test "$enable_extensions" = yes; then
3234     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3235     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3236 else
3237     enable_extension_integration=no
3238     enable_extension_update=no
3241 # remember SYSBASE value
3242 AC_SUBST(SYSBASE)
3244 dnl ===================================================================
3245 dnl  Sort out various gallery compilation options
3246 dnl ===================================================================
3247 WITH_GALLERY_BUILD=TRUE
3248 AC_MSG_CHECKING([how to build and package galleries])
3249 if test -n "${with_galleries}"; then
3250     if test "$with_galleries" = "build"; then
3251         if test "$enable_database_connectivity" = no; then
3252             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3253         fi
3254         AC_MSG_RESULT([build from source images internally])
3255     elif test "$with_galleries" = "no"; then
3256         WITH_GALLERY_BUILD=
3257         AC_MSG_RESULT([disable non-internal gallery build])
3258     else
3259         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3260     fi
3261 else
3262     if test $_os != iOS -a $_os != Android; then
3263         AC_MSG_RESULT([internal src images for desktop])
3264     else
3265         WITH_GALLERY_BUILD=
3266         AC_MSG_RESULT([disable src image build])
3267     fi
3269 AC_SUBST(WITH_GALLERY_BUILD)
3271 dnl ===================================================================
3272 dnl  Sort out various templates compilation options
3273 dnl ===================================================================
3274 WITH_TEMPLATES=TRUE
3275 AC_MSG_CHECKING([build with or without template files])
3276 if test -n "${with_templates}"; then
3277     if test "$with_templates" = "yes"; then
3278         AC_MSG_RESULT([enable all templates])
3279     elif test "$with_templates" = "no"; then
3280         WITH_TEMPLATES=
3281         AC_MSG_RESULT([disable non-internal templates])
3282     else
3283         AC_MSG_ERROR([unknown value --with-templates=$with_templates])
3284     fi
3285 else
3286     if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
3287         AC_MSG_RESULT([enable all templates])
3288     else
3289         WITH_TEMPLATES=
3290         AC_MSG_RESULT([disable non-internal templates])
3291     fi
3293 AC_SUBST(WITH_TEMPLATES)
3295 dnl ===================================================================
3296 dnl  Checks if ccache is available
3297 dnl ===================================================================
3298 CCACHE_DEPEND_MODE=
3299 if test "$enable_ccache" = "no"; then
3300     CCACHE=""
3301 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3302     case "%$CC%$CXX%" in
3303     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3304     # assume that's good then
3305     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3306         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3307         CCACHE_DEPEND_MODE=1
3308         ;;
3309     *)
3310         # try to use our own ccache if it is available and CCACHE was not already defined
3311         if test -z "$CCACHE"; then
3312             if test "$_os" = "WINNT"; then
3313                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3314             fi
3315             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3316                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3317             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3318                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3319             fi
3320         fi
3321         AC_PATH_PROG([CCACHE],[ccache],[not found])
3322         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3323             CCACHE=`win_short_path_for_make "$CCACHE"`
3324             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3325             rm -f conftest.txt
3326             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3327             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3328             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3329                 AC_MSG_RESULT(yes)
3330             else
3331                 AC_MSG_RESULT(no)
3332                 CCACHE="not found"
3333             fi
3334             rm -f conftest.txt
3335         fi
3336         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3337             # on windows/VC perhaps sccache is around?
3338             case "%$CC%$CXX%" in
3339             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3340             # assume that's good then
3341             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3342                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3343                 CCACHE_DEPEND_MODE=1
3344                 SCCACHE=1
3345                 ;;
3346             *)
3347                 # for sharing code below, reuse CCACHE env var
3348                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3349                 if test "$CCACHE" != "not found"; then
3350                     CCACHE=`win_short_path_for_make "$CCACHE"`
3351                     SCCACHE=1
3352                     CCACHE_DEPEND_MODE=1
3353                 fi
3354                 ;;
3355             esac
3356         fi
3357         if test "$CCACHE" = "not found"; then
3358             CCACHE=""
3359         fi
3360         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3361             CCACHE_DEPEND_MODE=1
3362             # Need to check for ccache version: otherwise prevents
3363             # caching of the results (like "-x objective-c++" for Mac)
3364             if test $_os = Darwin -o $_os = iOS; then
3365                 # Check ccache version
3366                 AC_MSG_CHECKING([whether version of ccache is suitable])
3367                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3368                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3369                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3370                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3371                 else
3372                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3373                     CCACHE=""
3374                     CCACHE_DEPEND_MODE=
3375                 fi
3376             fi
3377         fi
3378         ;;
3379     esac
3380 else
3381     CCACHE=""
3383 if test "$enable_ccache" = "nodepend"; then
3384     CCACHE_DEPEND_MODE=""
3386 AC_SUBST(CCACHE_DEPEND_MODE)
3388 # sccache defaults are good enough
3389 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3390     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3391     # or (...) max_size = 20.0 G
3392     # -p works with both 4.2 and 4.4
3393     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
3394     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3395     if test "$ccache_size" = ""; then
3396         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3397         if test "$ccache_size" = ""; then
3398             ccache_size=0
3399         fi
3400         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3401         if test $ccache_size -lt 1024; then
3402             CCACHE=""
3403             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3404             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3405         else
3406             # warn that ccache may be too small for debug build
3407             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3408             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3409         fi
3410     else
3411         if test $ccache_size -lt 5; then
3412             #warn that ccache may be too small for debug build
3413             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3414             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3415         fi
3416     fi
3419 ENABLE_Z7_DEBUG=
3420 if test "$enable_z7_debug" != no; then
3421     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3422         ENABLE_Z7_DEBUG=TRUE
3423     fi
3424 else
3425     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3426     add_warning "ccache will not work with --disable-z7-debug"
3428 AC_SUBST(ENABLE_Z7_DEBUG)
3430 dnl ===================================================================
3431 dnl  Checks for C compiler,
3432 dnl  The check for the C++ compiler is later on.
3433 dnl ===================================================================
3434 if test "$_os" != "WINNT"; then
3435     GCC_HOME_SET="true"
3436     AC_MSG_CHECKING([gcc home])
3437     if test -z "$with_gcc_home"; then
3438         if test "$enable_icecream" = "yes"; then
3439             if test -d "/usr/lib/icecc/bin"; then
3440                 GCC_HOME="/usr/lib/icecc/"
3441             elif test -d "/usr/libexec/icecc/bin"; then
3442                 GCC_HOME="/usr/libexec/icecc/"
3443             elif test -d "/opt/icecream/bin"; then
3444                 GCC_HOME="/opt/icecream/"
3445             else
3446                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3448             fi
3449         else
3450             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3451             GCC_HOME_SET="false"
3452         fi
3453     else
3454         GCC_HOME="$with_gcc_home"
3455     fi
3456     AC_MSG_RESULT($GCC_HOME)
3457     AC_SUBST(GCC_HOME)
3459     if test "$GCC_HOME_SET" = "true"; then
3460         if test -z "$CC"; then
3461             CC="$GCC_HOME/bin/gcc"
3462             CC_BASE="gcc"
3463         fi
3464         if test -z "$CXX"; then
3465             CXX="$GCC_HOME/bin/g++"
3466             CXX_BASE="g++"
3467         fi
3468     fi
3471 COMPATH=`dirname "$CC"`
3472 if test "$COMPATH" = "."; then
3473     AC_PATH_PROGS(COMPATH, $CC)
3474     dnl double square bracket to get single because of M4 quote...
3475     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3477 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3479 dnl ===================================================================
3480 dnl Java support
3481 dnl ===================================================================
3482 AC_MSG_CHECKING([whether to build with Java support])
3483 if test "$with_java" != "no"; then
3484     if test "$DISABLE_SCRIPTING" = TRUE; then
3485         AC_MSG_RESULT([no, overridden by --disable-scripting])
3486         ENABLE_JAVA=""
3487         with_java=no
3488     else
3489         AC_MSG_RESULT([yes])
3490         ENABLE_JAVA="TRUE"
3491         AC_DEFINE(HAVE_FEATURE_JAVA)
3492     fi
3493 else
3494     AC_MSG_RESULT([no])
3495     ENABLE_JAVA=""
3498 AC_SUBST(ENABLE_JAVA)
3500 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3502 dnl ENABLE_JAVA="" indicate no Java support at all
3504 dnl ===================================================================
3505 dnl Check macOS SDK and compiler
3506 dnl ===================================================================
3508 if test $_os = Darwin; then
3510     # The SDK in the currently selected Xcode should be found.
3512     AC_MSG_CHECKING([what macOS SDK to use])
3513     # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
3514     # really supported anymore, instead you'd use different copies of Xcode, each with their own
3515     # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
3516     # also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
3517     # problems that existed in the PPC days with target versions not being respected or random
3518     # failures seems to be a thing of the past or rather: limiting either the Xcode version or the
3519     # SDK version is enough, no need to do both...
3520     MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
3521     if test ! -d "$MACOSX_SDK_PATH"; then
3522         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3523     fi
3524     macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
3525     MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
3526     # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
3527     # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
3528     # 10.10.2 is 101002
3529     # we don't target the lower versions anymore, so it doesn't matter that we don't generate the
3530     # correct version in case such an old SDK is specified, it will be rejected later anyway
3531     MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3532     if test $MACOSX_SDK_VERSION -lt 101500; then
3533         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.15])
3534     fi
3535     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3536         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)])
3537     fi
3538     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3540     AC_MSG_CHECKING([what minimum version of macOS to require])
3541     if test "$with_macosx_version_min_required" = "" ; then
3542         if test "$host_cpu" = x86_64; then
3543             with_macosx_version_min_required="10.15";
3544         else
3545             with_macosx_version_min_required="11.0";
3546         fi
3547     fi
3548     # see same notes about MACOSX_SDK_VERSION above
3549     MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
3550     if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
3551         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
3552     fi
3553     AC_MSG_RESULT([$with_macosx_version_min_required])
3555     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3556     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3557         AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
3558     else
3559         AC_MSG_RESULT([yes])
3560     fi
3562     # export this so that "xcrun" invocations later return matching values
3563     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3564     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3565     export DEVELOPER_DIR
3566     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3567     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3569     AC_MSG_CHECKING([whether Xcode is new enough])
3570     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3571     my_xcode_ver2=${my_xcode_ver1#Xcode }
3572     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3573     if test "$my_xcode_ver3" -ge 1205; then
3574         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3575         if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
3576             if test "$my_xcode_ver3" -ge 1600; then
3577                 dnl the Xcode 15 relnotes state that the classic linker will disappear in the next version, but nothing about
3578                 dnl fixing the problem with weak symbols/macOS 11 compatibility, so assume for now that Xcode 16 will break it...
3579                 AC_MSG_ERROR([Check that Xcode 16 still supports the old linker/that it doesn't break macOS 11 compatibility, then remove this check]);
3580             fi
3581             if test "$my_xcode_ver3" -ge 1500; then
3582                 AC_MSG_WARN([Xcode 15 has a new linker that causes runtime crashes on macOS 11])
3583                 add_warning "Xcode 15 has a new linker that causes runtime crashes on macOS 11, forcing the old linker."
3584                 add_warning "see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking"
3585                 LDFLAGS="$LDFLAGS -Wl,-ld_classic"
3586                 # if LDFLAGS weren't set already, a check above sets x_LDFLAGS=[#] to comment-out the export LDFLAGS line in config_host.mk
3587                 x_LDFLAGS=
3588             fi
3589         fi
3590     else
3591         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3592     fi
3594     my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
3595     MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
3597     LIBTOOL=/usr/bin/libtool
3598     INSTALL_NAME_TOOL=install_name_tool
3599     if test -z "$save_CC"; then
3600         stdlib=-stdlib=libc++
3602         AC_MSG_CHECKING([what C compiler to use])
3603         CC="`xcrun -find clang`"
3604         CC_BASE=`first_arg_basename "$CC"`
3605         if test "$host_cpu" = x86_64; then
3606             CC+=" -target x86_64-apple-macos"
3607         else
3608             CC+=" -target arm64-apple-macos"
3609         fi
3610         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3611         AC_MSG_RESULT([$CC])
3613         AC_MSG_CHECKING([what C++ compiler to use])
3614         CXX="`xcrun -find clang++`"
3615         CXX_BASE=`first_arg_basename "$CXX"`
3616         if test "$host_cpu" = x86_64; then
3617             CXX+=" -target x86_64-apple-macos"
3618         else
3619             CXX+=" -target arm64-apple-macos"
3620         fi
3621         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3622         AC_MSG_RESULT([$CXX])
3624         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3625         AR=`xcrun -find ar`
3626         NM=`xcrun -find nm`
3627         STRIP=`xcrun -find strip`
3628         LIBTOOL=`xcrun -find libtool`
3629         RANLIB=`xcrun -find ranlib`
3630     fi
3632     AC_MSG_CHECKING([whether to do code signing])
3634     if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
3635         AC_MSG_RESULT([no])
3636     else
3637         if test "$enable_macosx_code_signing" = yes; then
3638             # By default use the first suitable certificate (?).
3640             # https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3641             # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3642             # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3643             # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3644             # "Developer ID Application" one.
3645             identity="Developer ID Application:"
3646         else
3647             identity=$enable_macosx_code_signing
3648         fi
3649         identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
3650         if test -n "$identity"; then
3651             MACOSX_CODESIGNING_IDENTITY=$identity
3652             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3653             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3654         else
3655             AC_MSG_ERROR([cannot determine identity to use])
3656         fi
3657     fi
3659     AC_MSG_CHECKING([whether to create a Mac App Store package])
3661     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3662         AC_MSG_RESULT([no])
3663     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3664         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3665     else
3666         if test "$enable_macosx_package_signing" = yes; then
3667             # By default use the first suitable certificate.
3668             # It should be a "3rd Party Mac Developer Installer" one
3669             identity="3rd Party Mac Developer Installer:"
3670         else
3671             identity=$enable_macosx_package_signing
3672         fi
3673         identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
3674         if test -n "$identity"; then
3675             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3676             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3677             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3678         else
3679             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3680         fi
3681     fi
3683     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3684         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3685     fi
3687     AC_MSG_CHECKING([whether to sandbox the application])
3689     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3690         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3691     elif test "$enable_macosx_sandbox" = yes; then
3692         ENABLE_MACOSX_SANDBOX=TRUE
3693         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3694         AC_MSG_RESULT([yes])
3695     else
3696         AC_MSG_RESULT([no])
3697     fi
3699     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3700     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3701     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3703     if test -n "$with_macosx_provisioning_profile" ; then
3704         if test ! -f "$with_macosx_provisioning_profile"; then
3705             AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
3706         else
3707             MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
3708             MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
3709                 xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
3710                     | //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
3711                 sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
3712         fi
3713     fi
3715 AC_SUBST(MACOSX_SDK_PATH)
3716 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3717 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3718 AC_SUBST(INSTALL_NAME_TOOL)
3719 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3720 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3721 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3722 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3723 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3724 AC_SUBST(MACOSX_PROVISIONING_INFO)
3725 AC_SUBST(MACOSX_PROVISIONING_PROFILE)
3726 AC_SUBST(MACOSX_SDK_BUILD_VERSION)
3727 AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
3729 dnl ===================================================================
3730 dnl Check iOS SDK and compiler
3731 dnl ===================================================================
3733 if test $_os = iOS; then
3734     AC_MSG_CHECKING([what iOS SDK to use])
3736     if test "$enable_ios_simulator" = "yes"; then
3737         platformlc=iphonesimulator
3738         versionmin=-mios-simulator-version-min=14.5
3739     else
3740         platformlc=iphoneos
3741         versionmin=-miphoneos-version-min=14.5
3742     fi
3744     sysroot=`xcrun --sdk $platformlc --show-sdk-path`
3746     if ! test -d "$sysroot"; then
3747         AC_MSG_ERROR([Could not find iOS SDK $sysroot])
3748     fi
3750     AC_MSG_RESULT($sysroot)
3752     stdlib="-stdlib=libc++"
3754     AC_MSG_CHECKING([what C compiler to use])
3755     CC="`xcrun -find clang`"
3756     CC_BASE=`first_arg_basename "$CC"`
3757     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3758     AC_MSG_RESULT([$CC])
3760     AC_MSG_CHECKING([what C++ compiler to use])
3761     CXX="`xcrun -find clang++`"
3762     CXX_BASE=`first_arg_basename "$CXX"`
3763     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3764     AC_MSG_RESULT([$CXX])
3766     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3767     AR=`xcrun -find ar`
3768     NM=`xcrun -find nm`
3769     STRIP=`xcrun -find strip`
3770     LIBTOOL=`xcrun -find libtool`
3771     RANLIB=`xcrun -find ranlib`
3774 AC_MSG_CHECKING([whether to treat the installation as read-only])
3776 if test $_os = Darwin; then
3777     enable_readonly_installset=yes
3778 elif test "$enable_extensions" != yes; then
3779     enable_readonly_installset=yes
3781 if test "$enable_readonly_installset" = yes; then
3782     AC_MSG_RESULT([yes])
3783     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3784 else
3785     AC_MSG_RESULT([no])
3788 dnl ===================================================================
3789 dnl Structure of install set
3790 dnl ===================================================================
3792 if test $_os = Darwin; then
3793     LIBO_BIN_FOLDER=MacOS
3794     LIBO_ETC_FOLDER=Resources
3795     LIBO_LIBEXEC_FOLDER=MacOS
3796     LIBO_LIB_FOLDER=Frameworks
3797     LIBO_LIB_PYUNO_FOLDER=Resources
3798     LIBO_SHARE_FOLDER=Resources
3799     LIBO_SHARE_HELP_FOLDER=Resources/help
3800     LIBO_SHARE_JAVA_FOLDER=Resources/java
3801     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3802     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3803     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3804     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3805     LIBO_URE_BIN_FOLDER=MacOS
3806     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3807     LIBO_URE_LIB_FOLDER=Frameworks
3808     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3809     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3810 elif test $_os = WINNT; then
3811     LIBO_BIN_FOLDER=program
3812     LIBO_ETC_FOLDER=program
3813     LIBO_LIBEXEC_FOLDER=program
3814     LIBO_LIB_FOLDER=program
3815     LIBO_LIB_PYUNO_FOLDER=program
3816     LIBO_SHARE_FOLDER=share
3817     LIBO_SHARE_HELP_FOLDER=help
3818     LIBO_SHARE_JAVA_FOLDER=program/classes
3819     LIBO_SHARE_PRESETS_FOLDER=presets
3820     LIBO_SHARE_READMES_FOLDER=readmes
3821     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3822     LIBO_SHARE_SHELL_FOLDER=program/shell
3823     LIBO_URE_BIN_FOLDER=program
3824     LIBO_URE_ETC_FOLDER=program
3825     LIBO_URE_LIB_FOLDER=program
3826     LIBO_URE_MISC_FOLDER=program
3827     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3828 else
3829     LIBO_BIN_FOLDER=program
3830     LIBO_ETC_FOLDER=program
3831     LIBO_LIBEXEC_FOLDER=program
3832     LIBO_LIB_FOLDER=program
3833     LIBO_LIB_PYUNO_FOLDER=program
3834     LIBO_SHARE_FOLDER=share
3835     LIBO_SHARE_HELP_FOLDER=help
3836     LIBO_SHARE_JAVA_FOLDER=program/classes
3837     LIBO_SHARE_PRESETS_FOLDER=presets
3838     LIBO_SHARE_READMES_FOLDER=readmes
3839     if test "$enable_fuzzers" != yes; then
3840         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3841     else
3842         LIBO_SHARE_RESOURCE_FOLDER=resource
3843     fi
3844     LIBO_SHARE_SHELL_FOLDER=program/shell
3845     LIBO_URE_BIN_FOLDER=program
3846     LIBO_URE_ETC_FOLDER=program
3847     LIBO_URE_LIB_FOLDER=program
3848     LIBO_URE_MISC_FOLDER=program
3849     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3851 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3852 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3853 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3854 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3855 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3856 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3857 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3858 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3859 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3860 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3861 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3862 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3863 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3864 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3865 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3866 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3868 # Not all of them needed in config_host.mk, add more if need arises
3869 AC_SUBST(LIBO_BIN_FOLDER)
3870 AC_SUBST(LIBO_ETC_FOLDER)
3871 AC_SUBST(LIBO_LIB_FOLDER)
3872 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3873 AC_SUBST(LIBO_SHARE_FOLDER)
3874 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3875 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3876 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3877 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3878 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3879 AC_SUBST(LIBO_URE_BIN_FOLDER)
3880 AC_SUBST(LIBO_URE_ETC_FOLDER)
3881 AC_SUBST(LIBO_URE_LIB_FOLDER)
3882 AC_SUBST(LIBO_URE_MISC_FOLDER)
3883 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3885 dnl ===================================================================
3886 dnl Windows specific tests and stuff
3887 dnl ===================================================================
3889 reg_get_value()
3891     # Return value: $regvalue
3892     unset regvalue
3894     if test "$build_os" = "wsl"; then
3895         regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null)
3896         return
3897     fi
3899     local _regentry="/proc/registry${1}/${2}"
3900     if test -f "$_regentry"; then
3901         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3902         # Registry keys read via /proc/registry* are always \0 terminated!
3903         local _regvalue=$(tr -d '\0' < "$_regentry")
3904         if test $? -eq 0; then
3905             regvalue=$_regvalue
3906         fi
3907     fi
3910 # Get a value from the 32-bit side of the Registry
3911 reg_get_value_32()
3913     reg_get_value "32" "$1"
3916 # Get a value from the 64-bit side of the Registry
3917 reg_get_value_64()
3919     reg_get_value "64" "$1"
3922 reg_list_values()
3924     # Return value: $reglist
3925     unset reglist
3927     if test "$build_os" = "wsl"; then
3928         reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
3929         return
3930     fi
3932     reglist=$(ls "/proc/registry${1}/${2}")
3935 # List values from the 32-bit side of the Registry
3936 reg_list_values_32()
3938     reg_list_values "32" "$1"
3941 # List values from the 64-bit side of the Registry
3942 reg_list_values_64()
3944     reg_list_values "64" "$1"
3947 case "$host_os" in
3948 cygwin*|wsl*)
3949     COM=MSC
3950     OS=WNT
3951     RTL_OS=Windows
3952     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3953         P_SEP=";"
3954     else
3955         P_SEP=:
3956     fi
3957     case "$host_cpu" in
3958     x86_64)
3959         CPUNAME=X86_64
3960         RTL_ARCH=X86_64
3961         PLATFORMID=windows_x86_64
3962         WINDOWS_X64=1
3963         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3964         WIN_HOST_ARCH="x64"
3965         WIN_MULTI_ARCH="x86"
3966         WIN_HOST_BITS=64
3967         ;;
3968     i*86)
3969         CPUNAME=INTEL
3970         RTL_ARCH=x86
3971         PLATFORMID=windows_x86
3972         WIN_HOST_ARCH="x86"
3973         WIN_HOST_BITS=32
3974         WIN_OTHER_ARCH="x64"
3975         ;;
3976     aarch64)
3977         CPUNAME=AARCH64
3978         RTL_ARCH=AARCH64
3979         PLATFORMID=windows_aarch64
3980         WINDOWS_X64=1
3981         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3982         WIN_HOST_ARCH="arm64"
3983         WIN_HOST_BITS=64
3984         with_ucrt_dir=no
3985         ;;
3986     *)
3987         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3988         ;;
3989     esac
3991     case "$build_cpu" in
3992     x86_64) WIN_BUILD_ARCH="x64" ;;
3993     i*86) WIN_BUILD_ARCH="x86" ;;
3994     aarch64) WIN_BUILD_ARCH="arm64" ;;
3995     *)
3996         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3997         ;;
3998     esac
4000     SCPDEFS="$SCPDEFS -D_MSC_VER"
4001     ;;
4002 esac
4004 # multi-arch is an arch, which can execute on the host (x86 on x64), while
4005 # other-arch won't, but wouldn't break the build (x64 on x86).
4006 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
4007     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
4011 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
4012     # To allow building Windows multi-arch releases without cross-tooling
4013     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
4014         cross_compiling="yes"
4015     fi
4018 if test "$cross_compiling" = "yes"; then
4019     export CROSS_COMPILING=TRUE
4020     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
4021         ENABLE_WASM_STRIP=TRUE
4022     fi
4023     if test "$_os" = "Emscripten"; then
4024         if test "$with_main_module" = "calc"; then
4025             ENABLE_WASM_STRIP_WRITER=TRUE
4026         elif test "$with_main_module" = "writer"; then
4027             ENABLE_WASM_STRIP_CALC=TRUE
4028         fi
4029     fi
4030 else
4031     CROSS_COMPILING=
4032     BUILD_TYPE="$BUILD_TYPE NATIVE"
4034 AC_SUBST(CROSS_COMPILING)
4035 AC_SUBST(ENABLE_WASM_STRIP)
4036 AC_SUBST(ENABLE_WASM_STRIP_WRITER)
4037 AC_SUBST(ENABLE_WASM_STRIP_CALC)
4039 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
4040 # NOTE: must _not_ be used for bundled external libraries!
4041 ISYSTEM=
4042 if test "$GCC" = "yes"; then
4043     AC_MSG_CHECKING( for -isystem )
4044     save_CFLAGS=$CFLAGS
4045     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
4046     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
4047     CFLAGS=$save_CFLAGS
4048     if test -n "$ISYSTEM"; then
4049         AC_MSG_RESULT(yes)
4050     else
4051         AC_MSG_RESULT(no)
4052     fi
4054 if test -z "$ISYSTEM"; then
4055     # fall back to using -I
4056     ISYSTEM=-I
4058 AC_SUBST(ISYSTEM)
4060 dnl ===================================================================
4061 dnl  Check which Visual Studio compiler is used
4062 dnl ===================================================================
4064 map_vs_year_to_version()
4066     # Return value: $vsversion
4068     unset vsversion
4070     case $1 in
4071     2019)
4072         vsversion=16;;
4073     2022)
4074         vsversion=17;;
4075     2022preview)
4076         vsversion=17.9;;
4077     *)
4078         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
4079     esac
4082 vs_versions_to_check()
4084     # Args: $1 (optional) : versions to check, in the order of preference
4085     # Return value: $vsversions
4087     unset vsversions
4089     if test -n "$1"; then
4090         map_vs_year_to_version "$1"
4091         vsversions=$vsversion
4092     else
4093         # Default version is 2019
4094         vsversions="16"
4095     fi
4098 win_get_env_from_vsdevcmdbat()
4100     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4101     printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
4102     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" >> $WRAPPERBATCHFILEPATH
4103     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4104     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4105     local result
4106     if test "$build_os" = "wsl"; then
4107         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4108     else
4109         chmod +x $WRAPPERBATCHFILEPATH
4110         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4111     fi
4112     rm -f $WRAPPERBATCHFILEPATH
4113     printf '%s' "$result"
4116 find_ucrt()
4118     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4119     if test -n "$regvalue"; then
4120         PathFormat "$regvalue"
4121         UCRTSDKDIR=$formatted_path_unix
4122         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4123         UCRTVERSION=$regvalue
4124         # Rest if not exist
4125         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4126           UCRTSDKDIR=
4127         fi
4128     fi
4129     if test -z "$UCRTSDKDIR"; then
4130         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4131         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4132         if test -f "$ide_env_file"; then
4133             PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
4134             UCRTSDKDIR=$formatted_path
4135             UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
4136             dnl Hack needed at least by tml:
4137             if test "$UCRTVERSION" = 10.0.15063.0 \
4138                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4139                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4140             then
4141                 UCRTVERSION=10.0.14393.0
4142             fi
4143         else
4144           AC_MSG_ERROR([No UCRT found])
4145         fi
4146     fi
4149 find_msvc()
4151     # Find Visual C++
4152     # Args: $1 (optional) : The VS version year
4153     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4155     unset vctest vctoolset vcnumwithdot vcbuildnumber
4157     vs_versions_to_check "$1"
4158     if test "$build_os" = wsl; then
4159         vswhere="$PROGRAMFILESX86"
4160         if test -z "$vswhere"; then
4161             vswhere="c:\\Program Files (x86)"
4162         fi
4163     else
4164         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4165     fi
4166     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4167     PathFormat "$vswhere"
4168     vswhere=$formatted_path_unix
4169     for ver in $vsversions; do
4170         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4171         if test -z "$vswhereoutput"; then
4172             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4173         fi
4174         # Fall back to all MS products (this includes VC++ Build Tools)
4175         if ! test -n "$vswhereoutput"; then
4176             AC_MSG_CHECKING([VC++ Build Tools and similar])
4177             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4178         fi
4179         if test -n "$vswhereoutput"; then
4180             PathFormat "$vswhereoutput"
4181             vctest=$formatted_path_unix
4182             break
4183         fi
4184     done
4186     if test -n "$vctest"; then
4187         vcnumwithdot="$ver"
4188         if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
4189             vcnumwithdot=$vcnumwithdot.0
4190         fi
4191         case "$vcnumwithdot" in
4192         16.0)
4193             vcyear=2019
4194             vctoolset=v142
4195             ;;
4196         17.0 | 17.9)
4197             vcyear=2022
4198             vctoolset=v143
4199             ;;
4200         esac
4201         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4203     fi
4206 test_cl_exe()
4208     AC_MSG_CHECKING([$1 compiler])
4210     CL_EXE_PATH="$2/cl.exe"
4212     if test ! -f "$CL_EXE_PATH"; then
4213         if test "$1" = "multi-arch"; then
4214             AC_MSG_WARN([no compiler (cl.exe) in $2])
4215             return 1
4216         else
4217             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4218         fi
4219     fi
4221     dnl ===========================================================
4222     dnl  Check for the corresponding mspdb*.dll
4223     dnl ===========================================================
4225     # MSVC 15.0 has libraries from 14.0?
4226     mspdbnum="140"
4228     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4229         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4230     fi
4232     # The compiles has to find its shared libraries
4233     OLD_PATH="$PATH"
4234     TEMP_PATH=`cygpath -d "$2"`
4235     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4237     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4238         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4239     fi
4241     PATH="$OLD_PATH"
4243     AC_MSG_RESULT([$CL_EXE_PATH])
4246 SOLARINC=
4247 MSBUILD_PATH=
4248 DEVENV=
4249 if test "$_os" = "WINNT"; then
4250     AC_MSG_CHECKING([Visual C++])
4251     find_msvc "$with_visual_studio"
4252     if test -z "$vctest"; then
4253         if test -n "$with_visual_studio"; then
4254             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4255         else
4256             AC_MSG_ERROR([no Visual Studio installation found])
4257         fi
4258     fi
4259     AC_MSG_RESULT([])
4261     VC_PRODUCT_DIR="$vctest/VC"
4262     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4264     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4265     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4266         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4267         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4268         if test $? -ne 0; then
4269             WIN_MULTI_ARCH=""
4270             WIN_OTHER_ARCH=""
4271         fi
4272     fi
4274     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4275         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4276         test_cl_exe "build" "$MSVC_BUILD_PATH"
4277     fi
4279     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4280         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4281         test_cl_exe "host" "$MSVC_HOST_PATH"
4282     else
4283         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4284     fi
4286     AC_MSG_CHECKING([for short pathname of VC product directory])
4287     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4288     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4290     UCRTSDKDIR=
4291     UCRTVERSION=
4293     AC_MSG_CHECKING([for UCRT location])
4294     find_ucrt
4295     # find_ucrt errors out if it doesn't find it
4296     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4297     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4298     ucrtincpath_formatted=$formatted_path
4299     # SOLARINC is used for external modules and must be set too.
4300     # And no, it's not sufficient to set SOLARINC only, as configure
4301     # itself doesn't honour it.
4302     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4303     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4304     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4305     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4307     AC_SUBST(UCRTSDKDIR)
4308     AC_SUBST(UCRTVERSION)
4310     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4311     # Find the proper version of MSBuild.exe to use based on the VS version
4312     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4313     if test -z "$regvalue" ; then
4314         if test "$WIN_BUILD_ARCH" != "x64"; then
4315             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4316         else
4317             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4318         fi
4319     fi
4320     if test -d "$regvalue" ; then
4321         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4322         AC_MSG_RESULT([$regvalue])
4323     else
4324         AC_MSG_ERROR([MSBuild.exe location not found])
4325     fi
4327     # Find the version of devenv.exe
4328     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4329     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4330     DEVENV_unix=$(cygpath -u "$DEVENV")
4331     if test ! -e "$DEVENV_unix"; then
4332         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4333     fi
4335     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4336     dnl needed when building CLR code:
4337     if test -z "$MSVC_CXX"; then
4338         # This gives us a posix path with 8.3 filename restrictions
4339         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4340     fi
4342     if test -z "$CC"; then
4343         CC=$MSVC_CXX
4344         CC_BASE=`first_arg_basename "$CC"`
4345     fi
4346     if test -z "$CXX"; then
4347         CXX=$MSVC_CXX
4348         CXX_BASE=`first_arg_basename "$CXX"`
4349     fi
4351     if test -n "$CC"; then
4352         # Remove /cl.exe from CC case insensitive
4353         AC_MSG_NOTICE([found Visual C++ $vcyear])
4355         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4356         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4358         PathFormat "$COMPATH"
4359         COMPATH=`win_short_path_for_make "$formatted_path"`
4361         VCVER=$vcnumwithdot
4362         VCTOOLSET=$vctoolset
4364         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4365         # are always "better", we list them in reverse chronological order.
4367         case "$vcnumwithdot" in
4368         16.0 | 17.0 | 17.9)
4369             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4370             ;;
4371         esac
4373         # The expectation is that --with-windows-sdk should not need to be used
4374         if test -n "$with_windows_sdk"; then
4375             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4376             *" "$with_windows_sdk" "*)
4377                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4378                 ;;
4379             *)
4380                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4381                 ;;
4382             esac
4383         fi
4385         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4386         ac_objext=obj
4387         ac_exeext=exe
4389     else
4390         AC_MSG_ERROR([Visual C++ not found after all, huh])
4391     fi
4393     # ERROR if VS version < 16.5
4394     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4395     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4396         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4397         // between Visual Studio versions and _MSC_VER:
4398         #if _MSC_VER < 1925
4399         #error
4400         #endif
4401     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4403     # WARN if VS version < 16.10
4404     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
4405     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4406         #if _MSC_VER < 1929
4407         #error
4408         #endif
4409     ]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
4411     if test $vs2019_recommended_version = yes; then
4412         AC_MSG_RESULT([yes])
4413     else
4414         AC_MSG_WARN([no])
4415         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."
4416     fi
4418     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4419     # version of the Explorer extension (and maybe other small
4420     # bits, too) needed when installing a 32-bit LibreOffice on a
4421     # 64-bit OS. The 64-bit Explorer extension is a feature that
4422     # has been present since long in OOo. Don't confuse it with
4423     # building LibreOffice itself as 64-bit code.
4425     BUILD_X64=
4426     CXX_X64_BINARY=
4428     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4429         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4430         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4431              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4432         then
4433             BUILD_X64=TRUE
4434             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4435             AC_MSG_RESULT([found])
4436         else
4437             AC_MSG_RESULT([not found])
4438             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4439         fi
4440     elif test "$WIN_HOST_ARCH" = "x64"; then
4441         CXX_X64_BINARY=$CXX
4442     fi
4443     AC_SUBST(BUILD_X64)
4445     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4446     AC_SUBST(CXX_X64_BINARY)
4448     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4449     # needed to support TWAIN scan on both 32- and 64-bit systems
4451     case "$WIN_HOST_ARCH" in
4452     x64)
4453         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4454         if test -n "$CXX_X86_BINARY"; then
4455             BUILD_X86=TRUE
4456             AC_MSG_RESULT([preset])
4457         elif test -n "$WIN_MULTI_ARCH"; then
4458             BUILD_X86=TRUE
4459             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4460             AC_MSG_RESULT([found])
4461         else
4462             AC_MSG_RESULT([not found])
4463             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4464         fi
4465         ;;
4466     x86)
4467         BUILD_X86=TRUE
4468         CXX_X86_BINARY=$MSVC_CXX
4469         ;;
4470     esac
4471     AC_SUBST(BUILD_X86)
4472     AC_SUBST(CXX_X86_BINARY)
4474 AC_SUBST(VCVER)
4475 AC_SUBST(VCTOOLSET)
4476 AC_SUBST(DEVENV)
4477 AC_SUBST(MSVC_CXX)
4479 COM_IS_CLANG=
4480 AC_MSG_CHECKING([whether the compiler is actually Clang])
4481 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4482     #ifndef __clang__
4483     you lose
4484     #endif
4485     int foo=42;
4486     ]])],
4487     [AC_MSG_RESULT([yes])
4488      COM_IS_CLANG=TRUE],
4489     [AC_MSG_RESULT([no])])
4490 AC_SUBST(COM_IS_CLANG)
4492 CLANGVER=
4493 if test "$COM_IS_CLANG" = TRUE; then
4494     AC_MSG_CHECKING([whether Clang is new enough])
4495     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4496         #if !defined __apple_build_version__
4497         #error
4498         #endif
4499         ]])],
4500         [my_apple_clang=yes],[my_apple_clang=])
4501     if test "$my_apple_clang" = yes; then
4502         AC_MSG_RESULT([assumed yes (Apple Clang)])
4503     elif test "$_os" = Emscripten; then
4504         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4505     else
4506         if test "$_os" = WINNT; then
4507             dnl In which case, assume clang-cl:
4508             my_args="/EP /TC"
4509         else
4510             my_args="-E -P"
4511         fi
4512         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4513         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4514         CLANGVER=`echo $clang_version \
4515             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4516         if test "$CLANGVER" -ge 120000; then
4517             AC_MSG_RESULT([yes ($clang_version)])
4518         else
4519             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
4520         fi
4521         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4522         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4523     fi
4526 SHOWINCLUDES_PREFIX=
4527 if test "$_os" = WINNT; then
4528     dnl We need to guess the prefix of the -showIncludes output, it can be
4529     dnl localized
4530     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4531     echo "#include <stdlib.h>" > conftest.c
4532     SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4533         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4534     rm -f conftest.c conftest.obj
4535     if test -z "$SHOWINCLUDES_PREFIX"; then
4536         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4537     else
4538         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4539     fi
4541 AC_SUBST(SHOWINCLUDES_PREFIX)
4544 # prefix C with ccache if needed
4546 if test "$CCACHE" != ""; then
4547     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4549     AC_LANG_PUSH([C])
4550     save_CFLAGS=$CFLAGS
4551     CFLAGS="$CFLAGS --ccache-skip -O2"
4552     # msvc does not fail on unknown options, check stdout
4553     if test "$COM" = MSC; then
4554         CFLAGS="$CFLAGS -nologo"
4555     fi
4556     save_ac_c_werror_flag=$ac_c_werror_flag
4557     ac_c_werror_flag=yes
4558     dnl an empty program will do, we're checking the compiler flags
4559     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4560                       [use_ccache=yes], [use_ccache=no])
4561     CFLAGS=$save_CFLAGS
4562     ac_c_werror_flag=$save_ac_c_werror_flag
4563     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4564         AC_MSG_RESULT([yes])
4565     else
4566         CC="$CCACHE $CC"
4567         CC_BASE="ccache $CC_BASE"
4568         AC_MSG_RESULT([no])
4569     fi
4570     AC_LANG_POP([C])
4573 # ===================================================================
4574 # check various GCC options that Clang does not support now but maybe
4575 # will somewhen in the future, check them even for GCC, so that the
4576 # flags are set
4577 # ===================================================================
4579 HAVE_GCC_GGDB2=
4580 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4581     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4582     save_CFLAGS=$CFLAGS
4583     CFLAGS="$CFLAGS -Werror -ggdb2"
4584     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4585     CFLAGS=$save_CFLAGS
4586     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4587         AC_MSG_RESULT([yes])
4588     else
4589         AC_MSG_RESULT([no])
4590     fi
4592     if test "$host_cpu" = "m68k"; then
4593         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4594         save_CFLAGS=$CFLAGS
4595         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4596         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4597         CFLAGS=$save_CFLAGS
4598         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4599             AC_MSG_RESULT([yes])
4600         else
4601             AC_MSG_ERROR([no])
4602         fi
4603     fi
4605 AC_SUBST(HAVE_GCC_GGDB2)
4607 dnl ===================================================================
4608 dnl  Test the gcc version
4609 dnl ===================================================================
4610 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4611     AC_MSG_CHECKING([the GCC version])
4612     _gcc_version=`$CC -dumpfullversion`
4613     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4614         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4615     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4617     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4619     if test "$gcc_full_version" -lt 120000; then
4620         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
4621     fi
4622 else
4623     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4624     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4625     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4626     # (which reports itself as GCC 4.2.1).
4627     GCC_VERSION=
4629 AC_SUBST(GCC_VERSION)
4631 dnl Set the ENABLE_DBGUTIL variable
4632 dnl ===================================================================
4633 AC_MSG_CHECKING([whether to build with additional debug utilities])
4634 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4635     ENABLE_DBGUTIL="TRUE"
4636     # this is an extra var so it can have different default on different MSVC
4637     # versions (in case there are version specific problems with it)
4638     MSVC_USE_DEBUG_RUNTIME="TRUE"
4640     AC_MSG_RESULT([yes])
4641     # cppunit and graphite expose STL in public headers
4642     if test "$with_system_cppunit" = "yes"; then
4643         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4644     else
4645         with_system_cppunit=no
4646     fi
4647     if test "$with_system_graphite" = "yes"; then
4648         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4649     else
4650         with_system_graphite=no
4651     fi
4652     if test "$with_system_orcus" = "yes"; then
4653         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4654     else
4655         with_system_orcus=no
4656     fi
4657     if test "$with_system_libcmis" = "yes"; then
4658         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4659     else
4660         with_system_libcmis=no
4661     fi
4662     if test "$with_system_hunspell" = "yes"; then
4663         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4664     else
4665         with_system_hunspell=no
4666     fi
4667     if test "$with_system_gpgmepp" = "yes"; then
4668         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4669     else
4670         with_system_gpgmepp=no
4671     fi
4672     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4673     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4674     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4675     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4676     # of those two is using the system variant:
4677     if test "$with_system_libnumbertext" = "yes"; then
4678         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4679     else
4680         with_system_libnumbertext=no
4681     fi
4682     if test "$with_system_libwps" = "yes"; then
4683         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4684     else
4685         with_system_libwps=no
4686     fi
4687 else
4688     ENABLE_DBGUTIL=""
4689     MSVC_USE_DEBUG_RUNTIME=""
4690     AC_MSG_RESULT([no])
4692 AC_SUBST(ENABLE_DBGUTIL)
4693 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4695 dnl Set the ENABLE_DEBUG variable.
4696 dnl ===================================================================
4697 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4698     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4700 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4701     if test -z "$libo_fuzzed_enable_debug"; then
4702         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4703     else
4704         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4705         enable_debug=yes
4706     fi
4709 AC_MSG_CHECKING([whether to do a debug build])
4710 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4711     ENABLE_DEBUG="TRUE"
4712     if test -n "$ENABLE_DBGUTIL" ; then
4713         AC_MSG_RESULT([yes (dbgutil)])
4714     else
4715         AC_MSG_RESULT([yes])
4716     fi
4717 else
4718     ENABLE_DEBUG=""
4719     AC_MSG_RESULT([no])
4721 AC_SUBST(ENABLE_DEBUG)
4723 dnl ===================================================================
4724 dnl Select the linker to use (gold/lld/ld.bfd/mold).
4725 dnl This is done only after compiler checks (need to know if Clang is
4726 dnl used, for different defaults) and after checking if a debug build
4727 dnl is wanted (non-debug builds get the default linker if not explicitly
4728 dnl specified otherwise).
4729 dnl All checks for linker features/options should come after this.
4730 dnl ===================================================================
4731 check_use_ld()
4733     use_ld=-fuse-ld=${1%%:*}
4734     use_ld_path=${1#*:}
4735     if test "$use_ld_path" != "$1"; then
4736         if test "$COM_IS_CLANG" = TRUE; then
4737             if test "$CLANGVER" -ge 120000; then
4738                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4739             else
4740                 use_ld="-fuse-ld=${use_ld_path}"
4741             fi
4742         else
4743             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4744             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4745             # pickup the alternative linker, when called by libtool for linking.
4746             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4747             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4748         fi
4749     fi
4750     use_ld_fail_if_error=$2
4751     use_ld_ok=
4752     AC_MSG_CHECKING([for $use_ld linker support])
4753     use_ld_ldflags_save="$LDFLAGS"
4754     LDFLAGS="$LDFLAGS $use_ld"
4755     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4756 #include <stdio.h>
4757         ],[
4758 printf ("hello world\n");
4759         ])], USE_LD=$use_ld, [])
4760     if test -n "$USE_LD"; then
4761         AC_MSG_RESULT( yes )
4762         use_ld_ok=yes
4763     else
4764         if test -n "$use_ld_fail_if_error"; then
4765             AC_MSG_ERROR( no )
4766         else
4767             AC_MSG_RESULT( no )
4768         fi
4769     fi
4770     if test -n "$use_ld_ok"; then
4771         dnl keep the value of LDFLAGS
4772         return 0
4773     fi
4774     LDFLAGS="$use_ld_ldflags_save"
4775     return 1
4777 USE_LD=
4778 if test "$enable_ld" != "no"; then
4779     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4780         if test -n "$enable_ld"; then
4781             check_use_ld "$enable_ld" fail_if_error
4782         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4783             dnl non-debug builds default to the default linker
4784             true
4785         elif test -n "$COM_IS_CLANG"; then
4786             check_use_ld lld
4787             if test $? -ne 0; then
4788                 check_use_ld gold
4789                 if test $? -ne 0; then
4790                     check_use_ld mold
4791                 fi
4792             fi
4793         else
4794             # For gcc first try gold, new versions also support lld/mold.
4795             check_use_ld gold
4796             if test $? -ne 0; then
4797                 check_use_ld lld
4798                 if test $? -ne 0; then
4799                     check_use_ld mold
4800                 fi
4801             fi
4802         fi
4803         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4804         rm conftest.out
4805         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
4806         if test -z "$ld_used"; then
4807             ld_used="unknown"
4808         fi
4809         AC_MSG_CHECKING([for linker that is used])
4810         AC_MSG_RESULT([$ld_used])
4811         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4812             if echo "$ld_used" | grep -q "^GNU ld"; then
4813                 AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
4814                 add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
4815             fi
4816         fi
4817     else
4818         if test "$enable_ld" = "yes"; then
4819             AC_MSG_ERROR([--enable-ld not supported])
4820         fi
4821     fi
4823 AC_SUBST(USE_LD)
4824 AC_SUBST(LD)
4826 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4827 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4828     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4829     bsymbolic_functions_ldflags_save=$LDFLAGS
4830     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4831     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4832 #include <stdio.h>
4833         ],[
4834 printf ("hello world\n");
4835         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4836     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4837         AC_MSG_RESULT( found )
4838     else
4839         AC_MSG_RESULT( not found )
4840     fi
4841     LDFLAGS=$bsymbolic_functions_ldflags_save
4843 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4845 LD_GC_SECTIONS=
4846 if test "$GCC" = "yes"; then
4847     for flag in "--gc-sections" "-dead_strip"; do
4848         AC_MSG_CHECKING([for $flag linker support])
4849         ldflags_save=$LDFLAGS
4850         LDFLAGS="$LDFLAGS -Wl,$flag"
4851         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4852 #include <stdio.h>
4853             ],[
4854 printf ("hello world\n");
4855             ])],[
4856             LD_GC_SECTIONS="-Wl,$flag"
4857             AC_MSG_RESULT( found )
4858             ], [
4859             AC_MSG_RESULT( not found )
4860             ])
4861         LDFLAGS=$ldflags_save
4862         if test -n "$LD_GC_SECTIONS"; then
4863             break
4864         fi
4865     done
4867 AC_SUBST(LD_GC_SECTIONS)
4869 HAVE_EXTERNAL_DWARF=
4870 if test "$enable_split_debug" != no; then
4871     use_split_debug=
4872     if test -n "$ENABLE_LTO"; then
4873         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4874     elif test "$enable_split_debug" = yes; then
4875         use_split_debug=1
4876     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4877     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4878         use_split_debug=1
4879     fi
4880     if test -n "$use_split_debug"; then
4881         if test "$_os" = "Emscripten"; then
4882             TEST_CC_FLAG=-gseparate-dwarf
4883         else
4884             TEST_CC_FLAG=-gsplit-dwarf
4885         fi
4886         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4887         save_CFLAGS=$CFLAGS
4888         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4889         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4890         CFLAGS=$save_CFLAGS
4891         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4892             AC_MSG_RESULT([yes])
4893         else
4894             if test "$enable_split_debug" = yes; then
4895                 AC_MSG_ERROR([no])
4896             else
4897                 AC_MSG_RESULT([no])
4898             fi
4899         fi
4900     fi
4901     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4902         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4903         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4904     fi
4906 AC_SUBST(HAVE_EXTERNAL_DWARF)
4908 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4909 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4910 save_CFLAGS=$CFLAGS
4911 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4912 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4913 CFLAGS=$save_CFLAGS
4914 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4915     AC_MSG_RESULT([yes])
4916 else
4917     AC_MSG_RESULT([no])
4919 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4921 ENABLE_GDB_INDEX=
4922 if test "$enable_gdb_index" != "no"; then
4923     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4924     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4925         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4926         save_CFLAGS=$CFLAGS
4927         CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
4928         have_ggnu_pubnames=
4929         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4930         if test "$have_ggnu_pubnames" != "TRUE"; then
4931             if test "$enable_gdb_index" = "yes"; then
4932                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4933             else
4934                 AC_MSG_RESULT( no )
4935             fi
4936         else
4937             AC_MSG_RESULT( yes )
4938             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4939             ldflags_save=$LDFLAGS
4940             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4941             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4942 #include <stdio.h>
4943                 ],[
4944 printf ("hello world\n");
4945                 ])], ENABLE_GDB_INDEX=TRUE, [])
4946             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4947                 AC_MSG_RESULT( yes )
4948             else
4949                 if test "$enable_gdb_index" = "yes"; then
4950                     AC_MSG_ERROR( no )
4951                 else
4952                     AC_MSG_RESULT( no )
4953                 fi
4954             fi
4955             LDFLAGS=$ldflags_save
4956         fi
4957         CFLAGS=$save_CFLAGS
4958         fi
4959     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4960         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4961         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4962     fi
4964 AC_SUBST(ENABLE_GDB_INDEX)
4966 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4967     enable_sal_log=yes
4969 if test "$enable_sal_log" = yes; then
4970     ENABLE_SAL_LOG=TRUE
4972 AC_SUBST(ENABLE_SAL_LOG)
4974 dnl Check for enable symbols option
4975 dnl ===================================================================
4976 AC_MSG_CHECKING([whether to generate debug information])
4977 if test -z "$enable_symbols"; then
4978     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4979         enable_symbols=yes
4980     else
4981         enable_symbols=no
4982     fi
4984 if test "$enable_symbols" = yes; then
4985     ENABLE_SYMBOLS_FOR=all
4986     AC_MSG_RESULT([yes])
4987 elif test "$enable_symbols" = no; then
4988     ENABLE_SYMBOLS_FOR=
4989     AC_MSG_RESULT([no])
4990 else
4991     # Selective debuginfo.
4992     ENABLE_SYMBOLS_FOR="$enable_symbols"
4993     AC_MSG_RESULT([for "$enable_symbols"])
4995 AC_SUBST(ENABLE_SYMBOLS_FOR)
4997 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4998     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4999     AC_MSG_CHECKING([whether enough memory is available for linking])
5000     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
5001     # Check for 15GB, as Linux reports a bit less than the physical memory size.
5002     if test -n "$mem_size" -a $mem_size -lt 15728640; then
5003         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
5004     else
5005         AC_MSG_RESULT([yes])
5006     fi
5009 ENABLE_OPTIMIZED=
5010 ENABLE_OPTIMIZED_DEBUG=
5011 AC_MSG_CHECKING([whether to compile with optimization flags])
5012 if test -z "$enable_optimized"; then
5013     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5014         enable_optimized=no
5015     else
5016         enable_optimized=yes
5017     fi
5019 if test "$enable_optimized" = yes; then
5020     ENABLE_OPTIMIZED=TRUE
5021     AC_MSG_RESULT([yes])
5022 elif test "$enable_optimized" = debug; then
5023     ENABLE_OPTIMIZED_DEBUG=TRUE
5024     AC_MSG_RESULT([yes (debug)])
5025     HAVE_GCC_OG=
5026     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
5027         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
5028         save_CFLAGS=$CFLAGS
5029         CFLAGS="$CFLAGS -Werror -Og"
5030         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
5031         CFLAGS=$save_CFLAGS
5032         if test "$HAVE_GCC_OG" = "TRUE"; then
5033             AC_MSG_RESULT([yes])
5034         else
5035             AC_MSG_RESULT([no])
5036         fi
5037     fi
5038     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
5039         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
5040     fi
5041 else
5042     AC_MSG_RESULT([no])
5044 AC_SUBST(ENABLE_OPTIMIZED)
5045 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
5048 # determine CPUNAME, OS, ...
5050 case "$host_os" in
5052 cygwin*|wsl*)
5053     # Already handled
5054     ;;
5056 darwin*)
5057     COM=GCC
5058     OS=MACOSX
5059     RTL_OS=MacOSX
5060     P_SEP=:
5062     case "$host_cpu" in
5063     aarch64|arm64)
5064         if test "$enable_ios_simulator" = "yes"; then
5065             OS=iOS
5066         else
5067             CPUNAME=AARCH64
5068             RTL_ARCH=AARCH64
5069             PLATFORMID=macosx_aarch64
5070         fi
5071         ;;
5072     x86_64)
5073         if test "$enable_ios_simulator" = "yes"; then
5074             OS=iOS
5075         fi
5076         CPUNAME=X86_64
5077         RTL_ARCH=X86_64
5078         PLATFORMID=macosx_x86_64
5079         ;;
5080     *)
5081         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5082         ;;
5083     esac
5084     ;;
5086 ios*)
5087     COM=GCC
5088     OS=iOS
5089     RTL_OS=iOS
5090     P_SEP=:
5092     case "$host_cpu" in
5093     aarch64|arm64)
5094         if test "$enable_ios_simulator" = "yes"; then
5095             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
5096         fi
5097         ;;
5098     *)
5099         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5100         ;;
5101     esac
5102     CPUNAME=AARCH64
5103     RTL_ARCH=AARCH64
5104     PLATFORMID=ios_arm64
5105     ;;
5107 dragonfly*)
5108     COM=GCC
5109     OS=DRAGONFLY
5110     RTL_OS=DragonFly
5111     P_SEP=:
5113     case "$host_cpu" in
5114     i*86)
5115         CPUNAME=INTEL
5116         RTL_ARCH=x86
5117         PLATFORMID=dragonfly_x86
5118         ;;
5119     x86_64)
5120         CPUNAME=X86_64
5121         RTL_ARCH=X86_64
5122         PLATFORMID=dragonfly_x86_64
5123         ;;
5124     *)
5125         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5126         ;;
5127     esac
5128     ;;
5130 freebsd*)
5131     COM=GCC
5132     RTL_OS=FreeBSD
5133     OS=FREEBSD
5134     P_SEP=:
5136     case "$host_cpu" in
5137     aarch64)
5138         CPUNAME=AARCH64
5139         PLATFORMID=freebsd_aarch64
5140         RTL_ARCH=AARCH64
5141         ;;
5142     i*86)
5143         CPUNAME=INTEL
5144         RTL_ARCH=x86
5145         PLATFORMID=freebsd_x86
5146         ;;
5147     x86_64|amd64)
5148         CPUNAME=X86_64
5149         RTL_ARCH=X86_64
5150         PLATFORMID=freebsd_x86_64
5151         ;;
5152     powerpc64)
5153         CPUNAME=POWERPC64
5154         RTL_ARCH=PowerPC_64
5155         PLATFORMID=freebsd_powerpc64
5156         ;;
5157     powerpc|powerpcspe)
5158         CPUNAME=POWERPC
5159         RTL_ARCH=PowerPC
5160         PLATFORMID=freebsd_powerpc
5161         ;;
5162     *)
5163         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5164         ;;
5165     esac
5166     ;;
5168 haiku*)
5169     COM=GCC
5170     GUIBASE=haiku
5171     RTL_OS=Haiku
5172     OS=HAIKU
5173     P_SEP=:
5175     case "$host_cpu" in
5176     i*86)
5177         CPUNAME=INTEL
5178         RTL_ARCH=x86
5179         PLATFORMID=haiku_x86
5180         ;;
5181     x86_64|amd64)
5182         CPUNAME=X86_64
5183         RTL_ARCH=X86_64
5184         PLATFORMID=haiku_x86_64
5185         ;;
5186     *)
5187         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5188         ;;
5189     esac
5190     ;;
5192 kfreebsd*)
5193     COM=GCC
5194     OS=LINUX
5195     RTL_OS=kFreeBSD
5196     P_SEP=:
5198     case "$host_cpu" in
5200     i*86)
5201         CPUNAME=INTEL
5202         RTL_ARCH=x86
5203         PLATFORMID=kfreebsd_x86
5204         ;;
5205     x86_64)
5206         CPUNAME=X86_64
5207         RTL_ARCH=X86_64
5208         PLATFORMID=kfreebsd_x86_64
5209         ;;
5210     *)
5211         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5212         ;;
5213     esac
5214     ;;
5216 linux-gnu*|linux-musl*)
5217     COM=GCC
5218     OS=LINUX
5219     RTL_OS=Linux
5220     P_SEP=:
5222     case "$host_cpu" in
5224     aarch64)
5225         CPUNAME=AARCH64
5226         PLATFORMID=linux_aarch64
5227         RTL_ARCH=AARCH64
5228         EPM_FLAGS="-a arm64"
5229         ;;
5230     alpha)
5231         CPUNAME=AXP
5232         RTL_ARCH=ALPHA
5233         PLATFORMID=linux_alpha
5234         ;;
5235     arm*)
5236         CPUNAME=ARM
5237         EPM_FLAGS="-a arm"
5238         RTL_ARCH=ARM_EABI
5239         PLATFORMID=linux_arm_eabi
5240         case "$host_cpu" in
5241         arm*-linux)
5242             RTL_ARCH=ARM_OABI
5243             PLATFORMID=linux_arm_oabi
5244             ;;
5245         esac
5246         ;;
5247     hppa)
5248         CPUNAME=HPPA
5249         RTL_ARCH=HPPA
5250         EPM_FLAGS="-a hppa"
5251         PLATFORMID=linux_hppa
5252         ;;
5253     i*86)
5254         CPUNAME=INTEL
5255         RTL_ARCH=x86
5256         PLATFORMID=linux_x86
5257         ;;
5258     ia64)
5259         CPUNAME=IA64
5260         RTL_ARCH=IA64
5261         PLATFORMID=linux_ia64
5262         ;;
5263     mips)
5264         CPUNAME=MIPS
5265         RTL_ARCH=MIPS_EB
5266         EPM_FLAGS="-a mips"
5267         PLATFORMID=linux_mips_eb
5268         ;;
5269     mips64)
5270         CPUNAME=MIPS64
5271         RTL_ARCH=MIPS64_EB
5272         EPM_FLAGS="-a mips64"
5273         PLATFORMID=linux_mips64_eb
5274         ;;
5275     mips64el)
5276         CPUNAME=MIPS64
5277         RTL_ARCH=MIPS64_EL
5278         EPM_FLAGS="-a mips64el"
5279         PLATFORMID=linux_mips64_el
5280         ;;
5281     mipsel)
5282         CPUNAME=MIPS
5283         RTL_ARCH=MIPS_EL
5284         EPM_FLAGS="-a mipsel"
5285         PLATFORMID=linux_mips_el
5286         ;;
5287     riscv64)
5288         CPUNAME=RISCV64
5289         RTL_ARCH=RISCV64
5290         EPM_FLAGS="-a riscv64"
5291         PLATFORMID=linux_riscv64
5292         ;;
5293     m68k)
5294         CPUNAME=M68K
5295         RTL_ARCH=M68K
5296         PLATFORMID=linux_m68k
5297         ;;
5298     powerpc)
5299         CPUNAME=POWERPC
5300         RTL_ARCH=PowerPC
5301         PLATFORMID=linux_powerpc
5302         ;;
5303     powerpc64)
5304         CPUNAME=POWERPC64
5305         RTL_ARCH=PowerPC_64
5306         PLATFORMID=linux_powerpc64
5307         ;;
5308     powerpc64le)
5309         CPUNAME=POWERPC64
5310         RTL_ARCH=PowerPC_64_LE
5311         PLATFORMID=linux_powerpc64_le
5312         ;;
5313     sparc)
5314         CPUNAME=SPARC
5315         RTL_ARCH=SPARC
5316         PLATFORMID=linux_sparc
5317         ;;
5318     sparc64)
5319         CPUNAME=SPARC64
5320         RTL_ARCH=SPARC64
5321         PLATFORMID=linux_sparc64
5322         ;;
5323     s390x)
5324         CPUNAME=S390X
5325         RTL_ARCH=S390x
5326         PLATFORMID=linux_s390x
5327         ;;
5328     x86_64)
5329         CPUNAME=X86_64
5330         RTL_ARCH=X86_64
5331         PLATFORMID=linux_x86_64
5332         ;;
5333     loongarch64)
5334         CPUNAME=LOONGARCH64
5335         RTL_ARCH=LOONGARCH64
5336         PLATFORMID=linux_loongarch64
5337         ;;
5338     *)
5339         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5340         ;;
5341     esac
5342     ;;
5344 linux-android*)
5345     COM=GCC
5346     OS=ANDROID
5347     RTL_OS=Android
5348     P_SEP=:
5350     case "$host_cpu" in
5352     arm|armel)
5353         CPUNAME=ARM
5354         RTL_ARCH=ARM_EABI
5355         PLATFORMID=android_arm_eabi
5356         ;;
5357     aarch64)
5358         CPUNAME=AARCH64
5359         RTL_ARCH=AARCH64
5360         PLATFORMID=android_aarch64
5361         ;;
5362     i*86)
5363         CPUNAME=INTEL
5364         RTL_ARCH=x86
5365         PLATFORMID=android_x86
5366         ;;
5367     x86_64)
5368         CPUNAME=X86_64
5369         RTL_ARCH=X86_64
5370         PLATFORMID=android_x86_64
5371         ;;
5372     *)
5373         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5374         ;;
5375     esac
5376     ;;
5378 *netbsd*)
5379     COM=GCC
5380     OS=NETBSD
5381     RTL_OS=NetBSD
5382     P_SEP=:
5384     case "$host_cpu" in
5385     i*86)
5386         CPUNAME=INTEL
5387         RTL_ARCH=x86
5388         PLATFORMID=netbsd_x86
5389         ;;
5390     powerpc)
5391         CPUNAME=POWERPC
5392         RTL_ARCH=PowerPC
5393         PLATFORMID=netbsd_powerpc
5394         ;;
5395     sparc)
5396         CPUNAME=SPARC
5397         RTL_ARCH=SPARC
5398         PLATFORMID=netbsd_sparc
5399         ;;
5400     x86_64)
5401         CPUNAME=X86_64
5402         RTL_ARCH=X86_64
5403         PLATFORMID=netbsd_x86_64
5404         ;;
5405     *)
5406         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5407         ;;
5408     esac
5409     ;;
5411 openbsd*)
5412     COM=GCC
5413     OS=OPENBSD
5414     RTL_OS=OpenBSD
5415     P_SEP=:
5417     case "$host_cpu" in
5418     i*86)
5419         CPUNAME=INTEL
5420         RTL_ARCH=x86
5421         PLATFORMID=openbsd_x86
5422         ;;
5423     x86_64)
5424         CPUNAME=X86_64
5425         RTL_ARCH=X86_64
5426         PLATFORMID=openbsd_x86_64
5427         ;;
5428     *)
5429         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5430         ;;
5431     esac
5432     SOLARINC="$SOLARINC -I/usr/local/include"
5433     ;;
5435 solaris*)
5436     COM=GCC
5437     OS=SOLARIS
5438     RTL_OS=Solaris
5439     P_SEP=:
5441     case "$host_cpu" in
5442     i*86)
5443         CPUNAME=INTEL
5444         RTL_ARCH=x86
5445         PLATFORMID=solaris_x86
5446         ;;
5447     sparc)
5448         CPUNAME=SPARC
5449         RTL_ARCH=SPARC
5450         PLATFORMID=solaris_sparc
5451         ;;
5452     sparc64)
5453         CPUNAME=SPARC64
5454         RTL_ARCH=SPARC64
5455         PLATFORMID=solaris_sparc64
5456         ;;
5457     *)
5458         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5459         ;;
5460     esac
5461     SOLARINC="$SOLARINC -I/usr/local/include"
5462     ;;
5464 emscripten*)
5465     COM=GCC
5466     OS=EMSCRIPTEN
5467     RTL_OS=Emscripten
5468     P_SEP=:
5470     case "$host_cpu" in
5471     wasm32|wasm64)
5472         ;;
5473     *)
5474         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5475         ;;
5476     esac
5477     CPUNAME=INTEL
5478     RTL_ARCH=x86
5479     PLATFORMID=linux_x86
5480     ;;
5483     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5484     ;;
5485 esac
5487 DISABLE_GUI=""
5488 if test "$enable_gui" = "no"; then
5489     if test "$using_x11" != yes; then
5490         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5491     fi
5492     USING_X11=
5493     DISABLE_GUI=TRUE
5494     test_epoxy=no
5495 else
5496     AC_DEFINE(HAVE_FEATURE_UI)
5498 AC_SUBST(DISABLE_GUI)
5500 if test "$with_x" = "no"; then
5501     USING_X11=
5504 if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
5505     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5508 if test "$using_x11" = yes; then
5509     if test "$USING_X11" = TRUE; then
5510         AC_DEFINE(USING_X11)
5511     else
5512         disable_x11_tests
5513         if test "$DISABLE_DYNLOADING" = TRUE; then
5514             test_qt5=yes
5515         fi
5516     fi
5517 else
5518     if test "$USING_X11" = TRUE; then
5519         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5520     fi
5523 WORKDIR="${BUILDDIR}/workdir"
5524 INSTDIR="${BUILDDIR}/instdir"
5525 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5526 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5527 AC_SUBST(COM)
5528 AC_SUBST(CPUNAME)
5529 AC_SUBST(RTL_OS)
5530 AC_SUBST(RTL_ARCH)
5531 AC_SUBST(EPM_FLAGS)
5532 AC_SUBST(USING_X11)
5533 AC_SUBST([INSTDIR])
5534 AC_SUBST([INSTROOT])
5535 AC_SUBST([INSTROOTBASE])
5536 AC_SUBST(OS)
5537 AC_SUBST(P_SEP)
5538 AC_SUBST(WORKDIR)
5539 AC_SUBST(PLATFORMID)
5540 AC_SUBST(WINDOWS_X64)
5541 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5542 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5544 if test "$OS" = WNT -a "$COM" = MSC; then
5545     case "$CPUNAME" in
5546     INTEL) CPPU_ENV=msci ;;
5547     X86_64) CPPU_ENV=mscx ;;
5548     AARCH64) CPPU_ENV=msca ;;
5549     *)
5550         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5551         ;;
5552     esac
5553 else
5554     CPPU_ENV=gcc3
5556 AC_SUBST(CPPU_ENV)
5558 dnl ===================================================================
5559 dnl Test which package format to use
5560 dnl ===================================================================
5561 AC_MSG_CHECKING([which package format to use])
5562 if test -n "$with_package_format" -a "$with_package_format" != no; then
5563     for i in $with_package_format; do
5564         case "$i" in
5565         bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5566             ;;
5567         *)
5568             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5569 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5570 deb - Debian software distribution
5571 pkg - Solaris software distribution
5572 rpm - RedHat software distribution
5574 LibreOffice additionally supports:
5575 archive - .tar.gz or .zip
5576 dmg - macOS .dmg
5577 installed - installation tree
5578 msi - Windows .msi
5579         ])
5580             ;;
5581         esac
5582     done
5583     # fakeroot is needed to ensure correct file ownerships/permissions
5584     # inside deb packages and tar archives created on Linux and Solaris.
5585     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5586         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5587         if test "$FAKEROOT" = "no"; then
5588             AC_MSG_ERROR(
5589                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5590         fi
5591     fi
5592     PKGFORMAT="$with_package_format"
5593     AC_MSG_RESULT([$PKGFORMAT])
5594 else
5595     PKGFORMAT=
5596     AC_MSG_RESULT([none])
5598 AC_SUBST(PKGFORMAT)
5600 dnl ===================================================================
5601 dnl handle help related options
5603 dnl If you change help related options, please update README.help
5604 dnl ===================================================================
5606 ENABLE_HTMLHELP=
5607 HELP_OMINDEX_PAGE=
5608 HELP_ONLINE=
5609 WITH_HELPPACKS=
5611 AC_MSG_CHECKING([which help to build])
5612 if test -n "$with_help" -a "$with_help" != "no"; then
5613     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5614     BUILD_TYPE="$BUILD_TYPE HELP"
5615     case "$with_help" in
5616     "html")
5617         ENABLE_HTMLHELP=TRUE
5618         WITH_HELPPACKS=TRUE
5619         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5620         AC_MSG_RESULT([HTML (local)])
5621         ;;
5622     "online")
5623         ENABLE_HTMLHELP=TRUE
5624         HELP_ONLINE=TRUE
5625         AC_MSG_RESULT([HTML (online)])
5626         ;;
5627     yes)
5628         WITH_HELPPACKS=TRUE
5629         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5630         AC_MSG_RESULT([XML (local)])
5631         ;;
5632     *)
5633         AC_MSG_ERROR([Unknown --with-help=$with_help])
5634         ;;
5635     esac
5636 else
5637     AC_MSG_RESULT([no])
5640 AC_MSG_CHECKING([if we need to build the help index tooling])
5641 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5642     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5643     test_clucene=yes
5644     AC_MSG_RESULT([yes])
5645 else
5646     AC_MSG_RESULT([no])
5649 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5650 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5651     if test "$HELP_ONLINE" != TRUE; then
5652         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5653     fi
5654     case "$with_omindex" in
5655     "server")
5656         HELP_OMINDEX_PAGE=TRUE
5657         AC_MSG_RESULT([SERVER])
5658         ;;
5659     "noxap")
5660         AC_MSG_RESULT([NOXAP])
5661         ;;
5662     *)
5663         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5664         ;;
5665     esac
5666 else
5667     AC_MSG_RESULT([no])
5670 AC_MSG_CHECKING([whether to include the XML-help support])
5671 if test "$enable_xmlhelp" = yes; then
5672     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5673     test_clucene=yes
5674     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5675     AC_MSG_RESULT([yes])
5676 else
5677     if test "$with_help" = yes; then
5678         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5679     fi
5680     AC_MSG_RESULT([no])
5683 dnl Test whether to integrate helppacks into the product's installer
5684 AC_MSG_CHECKING([for helppack integration])
5685 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5686     AC_MSG_RESULT([no integration])
5687 else
5688     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5689     AC_MSG_RESULT([integration])
5692 AC_SUBST([ENABLE_HTMLHELP])
5693 AC_SUBST([HELP_OMINDEX_PAGE])
5694 AC_SUBST([HELP_ONLINE])
5695 # WITH_HELPPACKS is used only in configure
5697 dnl ===================================================================
5698 dnl Set up a different compiler to produce tools to run on the build
5699 dnl machine when doing cross-compilation
5700 dnl ===================================================================
5702 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5703 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5704 if test "$cross_compiling" = "yes"; then
5705     AC_MSG_CHECKING([for BUILD platform configuration])
5706     echo
5707     rm -rf CONF-FOR-BUILD config_build.mk
5708     mkdir CONF-FOR-BUILD
5709     # Here must be listed all files needed when running the configure script. In particular, also
5710     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5711     # keep them in the same order as there.
5712     (cd $SRC_ROOT && tar cf - \
5713         config.guess \
5714         bin/get_config_variables \
5715         solenv/bin/getcompver.awk \
5716         solenv/inc/langlist.mk \
5717         download.lst \
5718         config_host.mk.in \
5719         config_host_lang.mk.in \
5720         Makefile.in \
5721         bin/bffvalidator.sh.in \
5722         bin/odfvalidator.sh.in \
5723         bin/officeotron.sh.in \
5724         instsetoo_native/util/openoffice.lst.in \
5725         config_host/*.in \
5726         sysui/desktop/macosx/Info.plist.in \
5727         sysui/desktop/macosx/hardened_runtime.xcent.in \
5728         sysui/desktop/macosx/lo.xcent.in \
5729         .vscode/vs-code-template.code-workspace.in \
5730         solenv/lockfile/autoconf.h.in \
5731         ) \
5732     | (cd CONF-FOR-BUILD && tar xf -)
5733     cp configure CONF-FOR-BUILD
5734     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5735     (
5736     unset COM USING_X11 OS CPUNAME
5737     unset CC CXX SYSBASE CFLAGS
5738     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5739     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5740     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5741     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5742     if test -n "$CC_FOR_BUILD"; then
5743         export CC="$CC_FOR_BUILD"
5744         CC_BASE=`first_arg_basename "$CC"`
5745     fi
5746     if test -n "$CXX_FOR_BUILD"; then
5747         export CXX="$CXX_FOR_BUILD"
5748         CXX_BASE=`first_arg_basename "$CXX"`
5749     fi
5750     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5751     cd CONF-FOR-BUILD
5753     # Handle host configuration, which affects the cross-toolset too
5754     sub_conf_opts=""
5755     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5756     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5757     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5758     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5759     if test -n "$ENABLE_JAVA"; then
5760         case "$_os" in
5761         Android)
5762             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5763             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5764             ;;
5765         *)
5766             if test -z "$with_jdk_home"; then
5767                 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.])
5768             fi
5769             ;;
5770         esac
5771     else
5772         sub_conf_opts="$sub_conf_opts --without-java"
5773     fi
5774     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5775     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5776     test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
5777     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5778     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5779     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5780     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5781     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5782     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5783     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5784     if test "$_os" = "Emscripten"; then
5785         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5786         if test "${with_main_module+set}" = set; then
5787             sub_conf_opts="$sub_conf_opts --with-main-module=${with_main_module}"
5788         else
5789             sub_conf_opts="$sub_conf_opts --with-main-module=writer"
5790         fi
5791     fi
5792     # windows uses full-internal python and that in turn relies on openssl, so also enable openssl
5793     # when cross-compiling for aarch64, overriding the defaults below
5794     test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
5796     # Don't bother having configure look for stuff not needed for the build platform anyway
5797     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5798     sub_conf_defaults=" \
5799         --build="$build_alias" \
5800         --disable-cairo-canvas \
5801         --disable-cups \
5802         --disable-customtarget-components \
5803         --disable-firebird-sdbc \
5804         --disable-gpgmepp \
5805         --disable-gstreamer-1-0 \
5806         --disable-gtk3 \
5807         --disable-gtk4 \
5808         --disable-libcmis \
5809         --disable-mariadb-sdbc \
5810         --disable-nss \
5811         --disable-online-update \
5812         --disable-opencl \
5813         --disable-openssl \
5814         --disable-pdfimport \
5815         --disable-postgresql-sdbc \
5816         --disable-skia \
5817         --disable-xmlhelp \
5818         --enable-dynamic-loading \
5819         --enable-icecream="$enable_icecream" \
5820         --without-doxygen \
5821         --without-tls \
5822         --without-webdav \
5823         --without-x \
5825     # single quotes added for better readability in case of spaces
5826     echo "    Running CONF-FOR-BUILD/configure" \
5827         $sub_conf_defaults \
5828         --with-parallelism="'$with_parallelism'" \
5829         --with-theme="'$with_theme'" \
5830         --with-vendor="'$with_vendor'" \
5831         $sub_conf_opts \
5832         $with_build_platform_configure_options \
5833         --srcdir=$srcdir
5835     ./configure \
5836         $sub_conf_defaults \
5837         --with-parallelism="$with_parallelism" \
5838         --with-theme="$with_theme" \
5839         "--with-vendor=$with_vendor" \
5840         $sub_conf_opts \
5841         $with_build_platform_configure_options \
5842         --srcdir=$srcdir \
5843         2>&1 | sed -e 's/^/    /'
5844     if test [${PIPESTATUS[0]}] -ne 0; then
5845         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5846     fi
5848     # filter permitted build targets
5849     PERMITTED_BUILD_TARGETS="
5850         AVMEDIA
5851         BOOST
5852         BZIP2
5853         CAIRO
5854         CLUCENE
5855         CURL
5856         DBCONNECTIVITY
5857         DESKTOP
5858         DRAGONBOX
5859         DYNLOADING
5860         EPOXY
5861         EXPAT
5862         FROZEN
5863         GLM
5864         GRAPHITE
5865         HARFBUZZ
5866         HELPTOOLS
5867         ICU
5868         LCMS2
5869         LIBJPEG_TURBO
5870         LIBLANGTAG
5871         LibO
5872         LIBFFI
5873         LIBPN
5874         LIBTIFF
5875         LIBWEBP
5876         LIBXML2
5877         LIBXSLT
5878         MDDS
5879         NATIVE
5880         OPENSSL
5881         ORCUS
5882         PYTHON
5883         SCRIPTING
5884         ZLIB
5885         ZXCVBN
5887     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5888     # newlined lists, to use grep as a filter
5889     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5890     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5891     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5892     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5894     cp config_host.mk ../config_build.mk
5895     cp config_host_lang.mk ../config_build_lang.mk
5896     mv config.log ../config.Build.log
5897     mkdir -p ../config_build
5898     mv config_host/*.h ../config_build
5899     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5901     # all these will get a _FOR_BUILD postfix
5902     DIRECT_FOR_BUILD_SETTINGS="
5903         CC
5904         CPPU_ENV
5905         CXX
5906         ILIB
5907         JAVA_HOME
5908         JAVAIFLAGS
5909         JDK
5910         JDK_SECURITYMANAGER_DISALLOWED
5911         LIBO_BIN_FOLDER
5912         LIBO_LIB_FOLDER
5913         LIBO_URE_LIB_FOLDER
5914         LIBO_URE_MISC_FOLDER
5915         OS
5916         SDKDIRNAME
5917         SYSTEM_LIBXML
5918         SYSTEM_LIBXSLT
5920     # these overwrite host config with build config
5921     OVERWRITING_SETTINGS="
5922         ANT
5923         ANT_HOME
5924         ANT_LIB
5925         JAVA_SOURCE_VER
5926         JAVA_TARGET_VER
5927         JAVACFLAGS
5928         JAVACOMPILER
5929         JAVADOC
5930         JAVADOCISGJDOC
5931         LOCKFILE
5932         SYSTEM_GENBRK
5933         SYSTEM_GENCCODE
5934         SYSTEM_GENCMN
5936     # these need some special handling
5937     EXTRA_HANDLED_SETTINGS="
5938         INSTDIR
5939         INSTROOT
5940         PATH
5941         WORKDIR
5943     OLD_PATH=$PATH
5944     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5945     BUILD_PATH=$PATH
5946     PATH=$OLD_PATH
5948     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5949     echo "$line" >>build-config
5951     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5952         VV='$'$V
5953         VV=`eval "echo $VV"`
5954         if test -n "$VV"; then
5955             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5956             echo "$line" >>build-config
5957         fi
5958     done
5960     for V in $OVERWRITING_SETTINGS; do
5961         VV='$'$V
5962         VV=`eval "echo $VV"`
5963         if test -n "$VV"; then
5964             line=${V}='${'${V}:-$VV'}'
5965             echo "$line" >>build-config
5966         fi
5967     done
5969     for V in INSTDIR INSTROOT WORKDIR; do
5970         VV='$'$V
5971         VV=`eval "echo $VV"`
5972         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5973         if test -n "$VV"; then
5974             line="${V}_FOR_BUILD='$VV'"
5975             echo "$line" >>build-config
5976         fi
5977     done
5979     )
5980     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5981     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])
5982     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5983              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5985     eval `cat CONF-FOR-BUILD/build-config`
5987     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5989     rm -rf CONF-FOR-BUILD
5990 else
5991     OS_FOR_BUILD="$OS"
5992     CC_FOR_BUILD="$CC"
5993     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5994     CXX_FOR_BUILD="$CXX"
5995     INSTDIR_FOR_BUILD="$INSTDIR"
5996     INSTROOT_FOR_BUILD="$INSTROOT"
5997     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5998     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5999     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
6000     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
6001     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
6002     WORKDIR_FOR_BUILD="$WORKDIR"
6004 AC_SUBST(OS_FOR_BUILD)
6005 AC_SUBST(INSTDIR_FOR_BUILD)
6006 AC_SUBST(INSTROOT_FOR_BUILD)
6007 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
6008 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
6009 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
6010 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
6011 AC_SUBST(SDKDIRNAME_FOR_BUILD)
6012 AC_SUBST(WORKDIR_FOR_BUILD)
6013 AC_SUBST(CC_FOR_BUILD)
6014 AC_SUBST(CXX_FOR_BUILD)
6015 AC_SUBST(CPPU_ENV_FOR_BUILD)
6017 dnl ===================================================================
6018 dnl Check for lockfile deps
6019 dnl ===================================================================
6020 if test -z "$CROSS_COMPILING"; then
6021     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
6022     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
6023     AC_MSG_CHECKING([which lockfile binary to use])
6024     case "$with_system_lockfile" in
6025     yes)
6026         AC_MSG_RESULT([external])
6027         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
6028         ;;
6029     no)
6030         AC_MSG_RESULT([internal])
6031         ;;
6032     *)
6033         if test -x "$with_system_lockfile"; then
6034             LOCKFILE="$with_system_lockfile"
6035         else
6036             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
6037         fi
6038         AC_MSG_RESULT([$with_system_lockfile])
6039         ;;
6040     esac
6043 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
6044     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
6047 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
6048 AC_CHECK_FUNCS([utime utimes])
6049 AC_SUBST(LOCKFILE)
6051 dnl ===================================================================
6052 dnl Check for syslog header
6053 dnl ===================================================================
6054 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
6056 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
6057 dnl ===================================================================
6058 AC_MSG_CHECKING([whether to turn warnings to errors])
6059 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
6060     ENABLE_WERROR="TRUE"
6061     PYTHONWARNINGS="error"
6062     AC_MSG_RESULT([yes])
6063 else
6064     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
6065         ENABLE_WERROR="TRUE"
6066         PYTHONWARNINGS="error"
6067         AC_MSG_RESULT([yes])
6068     else
6069         AC_MSG_RESULT([no])
6070     fi
6072 AC_SUBST(ENABLE_WERROR)
6073 AC_SUBST(PYTHONWARNINGS)
6075 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
6076 dnl ===================================================================
6077 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
6078 if test -z "$enable_assert_always_abort"; then
6079    if test "$ENABLE_DEBUG" = TRUE; then
6080        enable_assert_always_abort=yes
6081    else
6082        enable_assert_always_abort=no
6083    fi
6085 if test "$enable_assert_always_abort" = "yes"; then
6086     ASSERT_ALWAYS_ABORT="TRUE"
6087     AC_MSG_RESULT([yes])
6088 else
6089     ASSERT_ALWAYS_ABORT="FALSE"
6090     AC_MSG_RESULT([no])
6092 AC_SUBST(ASSERT_ALWAYS_ABORT)
6094 # Determine whether to use ooenv for the instdir installation
6095 # ===================================================================
6096 if test $_os != "WINNT" -a $_os != "Darwin"; then
6097     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
6098     if test -z "$enable_ooenv"; then
6099         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
6100             enable_ooenv=yes
6101         else
6102             enable_ooenv=no
6103         fi
6104     fi
6105     if test "$enable_ooenv" = "no"; then
6106         AC_MSG_RESULT([no])
6107     else
6108         ENABLE_OOENV="TRUE"
6109         AC_MSG_RESULT([yes])
6110     fi
6112 AC_SUBST(ENABLE_OOENV)
6114 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
6115     if test "$enable_qt5" = "no"; then
6116         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
6117     else
6118         enable_qt5=yes
6119     fi
6122 if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
6123     if test "$enable_qt6" = "no"; then
6124         AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
6125     else
6126         enable_qt6=yes
6127     fi
6131 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
6132 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
6133     AC_MSG_RESULT([yes])
6134     ENABLE_PAGEIN=TRUE
6135     AC_DEFINE(HAVE_FEATURE_PAGEIN)
6136 else
6137     AC_MSG_RESULT([no])
6139 AC_SUBST(ENABLE_PAGEIN)
6141 dnl ===================================================================
6142 dnl check for cups support
6143 dnl ===================================================================
6145 AC_MSG_CHECKING([whether to enable CUPS support])
6146 if test "$test_cups" = yes -a "$enable_cups" != no; then
6147     ENABLE_CUPS=TRUE
6148     AC_MSG_RESULT([yes])
6150     AC_MSG_CHECKING([whether cups support is present])
6151     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6152     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6153     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6154         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6155     fi
6156 else
6157     AC_MSG_RESULT([no])
6160 AC_SUBST(ENABLE_CUPS)
6162 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
6164 dnl whether to find & fetch external tarballs?
6165 dnl ===================================================================
6166 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6167    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6168        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6169    else
6170        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6171    fi
6173 if test -z "$TARFILE_LOCATION"; then
6174     if test -d "$SRC_ROOT/src" ; then
6175         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6176         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6177     fi
6178     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6179 else
6180     AbsolutePath "$TARFILE_LOCATION"
6181     PathFormat "${absolute_path}"
6182     TARFILE_LOCATION="${formatted_path_unix}"
6184 AC_SUBST(TARFILE_LOCATION)
6186 AC_MSG_CHECKING([whether we want to fetch tarballs])
6187 if test "$enable_fetch_external" != "no"; then
6188     if test "$with_all_tarballs" = "yes"; then
6189         AC_MSG_RESULT([yes, all of them])
6190         DO_FETCH_TARBALLS="ALL"
6191     else
6192         AC_MSG_RESULT([yes, if we use them])
6193         DO_FETCH_TARBALLS="TRUE"
6194     fi
6195 else
6196     AC_MSG_RESULT([no])
6197     DO_FETCH_TARBALLS=
6199 AC_SUBST(DO_FETCH_TARBALLS)
6201 dnl Test whether to include MySpell dictionaries
6202 dnl ===================================================================
6203 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6204 if test "$with_myspell_dicts" = "yes"; then
6205     AC_MSG_RESULT([yes])
6206     WITH_MYSPELL_DICTS=TRUE
6207     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6208     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6209 else
6210     AC_MSG_RESULT([no])
6211     WITH_MYSPELL_DICTS=
6213 AC_SUBST(WITH_MYSPELL_DICTS)
6215 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6216 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6217     if test "$with_system_dicts" = yes; then
6218         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6219     fi
6220     with_system_dicts=no
6223 AC_MSG_CHECKING([whether to use dicts from external paths])
6224 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6225     AC_MSG_RESULT([yes])
6226     SYSTEM_DICTS=TRUE
6227     AC_MSG_CHECKING([for spelling dictionary directory])
6228     if test -n "$with_external_dict_dir"; then
6229         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6230     else
6231         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6232         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6233             DICT_SYSTEM_DIR=file:///usr/share/myspell
6234         fi
6235     fi
6236     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6237     AC_MSG_CHECKING([for hyphenation patterns directory])
6238     if test -n "$with_external_hyph_dir"; then
6239         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6240     else
6241         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6242     fi
6243     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6244     AC_MSG_CHECKING([for thesaurus directory])
6245     if test -n "$with_external_thes_dir"; then
6246         THES_SYSTEM_DIR=file://$with_external_thes_dir
6247     else
6248         THES_SYSTEM_DIR=file:///usr/share/mythes
6249     fi
6250     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6251 else
6252     AC_MSG_RESULT([no])
6253     SYSTEM_DICTS=
6255 AC_SUBST(SYSTEM_DICTS)
6256 AC_SUBST(DICT_SYSTEM_DIR)
6257 AC_SUBST(HYPH_SYSTEM_DIR)
6258 AC_SUBST(THES_SYSTEM_DIR)
6260 dnl ===================================================================
6261 dnl Precompiled headers.
6262 ENABLE_PCH=""
6263 AC_MSG_CHECKING([whether to enable pch feature])
6264 if test -z "$enable_pch"; then
6265     if test "$_os" = "WINNT"; then
6266         # Enabled by default on Windows.
6267         enable_pch=yes
6268         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6269         if test -z "$enable_ccache" -a "$SCCACHE"; then
6270             CCACHE=""
6271         fi
6272     else
6273         enable_pch=no
6274     fi
6276 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6277     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6279 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6280     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6282 if test "$enable_pch" = "system"; then
6283     ENABLE_PCH="1"
6284     AC_MSG_RESULT([yes (system headers)])
6285 elif test "$enable_pch" = "base"; then
6286     ENABLE_PCH="2"
6287     AC_MSG_RESULT([yes (system and base headers)])
6288 elif test "$enable_pch" = "normal"; then
6289     ENABLE_PCH="3"
6290     AC_MSG_RESULT([yes (normal)])
6291 elif test "$enable_pch" = "full"; then
6292     ENABLE_PCH="4"
6293     AC_MSG_RESULT([yes (full)])
6294 elif test "$enable_pch" = "yes"; then
6295     # Pick a suitable default.
6296     if test "$GCC" = "yes"; then
6297         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6298         # while making the PCHs larger and rebuilds more likely.
6299         ENABLE_PCH="2"
6300         AC_MSG_RESULT([yes (system and base headers)])
6301     else
6302         # With MSVC the highest level makes a significant difference,
6303         # and it was the default when there used to be no PCH levels.
6304         ENABLE_PCH="4"
6305         AC_MSG_RESULT([yes (full)])
6306     fi
6307 elif test "$enable_pch" = "no"; then
6308     AC_MSG_RESULT([no])
6309 else
6310     AC_MSG_ERROR([Unknown value for --enable-pch])
6312 AC_SUBST(ENABLE_PCH)
6313 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6314 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6315     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6316     if test "$CCACHE_BIN" != "not found"; then
6317         AC_MSG_CHECKING([ccache version])
6318         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6319         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6320         AC_MSG_RESULT([$CCACHE_VERSION])
6321         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6322         if test "$CCACHE_NUMVER" -gt "030701"; then
6323             AC_MSG_RESULT([yes])
6324         else
6325             AC_MSG_RESULT([no (not newer than 3.7.1)])
6326             CCACHE_DEPEND_MODE=
6327         fi
6328     fi
6331 PCH_INSTANTIATE_TEMPLATES=
6332 if test -n "$ENABLE_PCH"; then
6333     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6334     save_CFLAGS=$CFLAGS
6335     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6336     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6337     CFLAGS=$save_CFLAGS
6338     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6339         AC_MSG_RESULT(yes)
6340     else
6341         AC_MSG_RESULT(no)
6342     fi
6344 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6346 BUILDING_PCH_WITH_OBJ=
6347 if test -n "$ENABLE_PCH"; then
6348     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6349     save_CFLAGS=$CFLAGS
6350     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6351     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6352     CFLAGS=$save_CFLAGS
6353     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6354         AC_MSG_RESULT(yes)
6355     else
6356         AC_MSG_RESULT(no)
6357     fi
6359 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6361 PCH_CODEGEN=
6362 PCH_NO_CODEGEN=
6363 fpch_prefix=
6364 if test "$COM" = MSC; then
6365     fpch_prefix="-Xclang "
6367 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6368     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6369     save_CFLAGS=$CFLAGS
6370     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6371     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6372         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6373     CFLAGS=$save_CFLAGS
6374     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6375     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6376         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6377     CFLAGS=$save_CFLAGS
6378     if test -n "$PCH_CODEGEN"; then
6379         AC_MSG_RESULT(yes)
6380     else
6381         AC_MSG_RESULT(no)
6382     fi
6384 AC_SUBST(PCH_CODEGEN)
6385 AC_SUBST(PCH_NO_CODEGEN)
6386 PCH_DEBUGINFO=
6387 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6388     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6389     save_CFLAGS=$CFLAGS
6390     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6391     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6392     CFLAGS=$save_CFLAGS
6393     if test -n "$PCH_DEBUGINFO"; then
6394         AC_MSG_RESULT(yes)
6395     else
6396         AC_MSG_RESULT(no)
6397     fi
6399 AC_SUBST(PCH_DEBUGINFO)
6401 TAB=`printf '\t'`
6403 AC_MSG_CHECKING([the GNU Make version])
6404 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6405 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6406 if test "$_make_longver" -ge "040000"; then
6407     AC_MSG_RESULT([$GNUMAKE $_make_version])
6408 else
6409     AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
6412 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6413 STALE_MAKE=
6414 if test "$_make_ver_check" = ""; then
6415    STALE_MAKE=TRUE
6418 HAVE_LD_HASH_STYLE=FALSE
6419 WITH_LINKER_HASH_STYLE=
6420 AC_MSG_CHECKING([for --hash-style gcc linker support])
6421 if test "$GCC" = "yes"; then
6422     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6423         hash_styles="gnu sysv"
6424     elif test "$with_linker_hash_style" = "no"; then
6425         hash_styles=
6426     else
6427         hash_styles="$with_linker_hash_style"
6428     fi
6430     for hash_style in $hash_styles; do
6431         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6432         hash_style_ldflags_save=$LDFLAGS
6433         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6435         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6436             [
6437 #include <stdio.h>
6438             ],[
6439 printf ("");
6440             ])],
6441             [
6442                   HAVE_LD_HASH_STYLE=TRUE
6443                   WITH_LINKER_HASH_STYLE=$hash_style
6444             ],
6445             [HAVE_LD_HASH_STYLE=FALSE],
6446             [HAVE_LD_HASH_STYLE=FALSE])
6447         LDFLAGS=$hash_style_ldflags_save
6448     done
6450     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6451         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6452     else
6453         AC_MSG_RESULT( no )
6454     fi
6455     LDFLAGS=$hash_style_ldflags_save
6456 else
6457     AC_MSG_RESULT( no )
6459 AC_SUBST(HAVE_LD_HASH_STYLE)
6460 AC_SUBST(WITH_LINKER_HASH_STYLE)
6462 dnl ===================================================================
6463 dnl Check whether there's a Perl version available.
6464 dnl ===================================================================
6465 if test -z "$with_perl_home"; then
6466     AC_PATH_PROG(PERL, perl)
6467 else
6468     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6469     _perl_path="$with_perl_home/bin/perl"
6470     if test -x "$_perl_path"; then
6471         PERL=$_perl_path
6472     else
6473         AC_MSG_ERROR([$_perl_path not found])
6474     fi
6477 dnl ===================================================================
6478 dnl Testing for Perl version 5 or greater.
6479 dnl $] is the Perl version variable, it is returned as an integer
6480 dnl ===================================================================
6481 if test "$PERL"; then
6482     AC_MSG_CHECKING([the Perl version])
6483     ${PERL} -e "exit($]);"
6484     _perl_version=$?
6485     if test "$_perl_version" -lt 5; then
6486         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6487     fi
6488     AC_MSG_RESULT([Perl $_perl_version])
6489 else
6490     AC_MSG_ERROR([Perl not found, install Perl 5])
6493 dnl ===================================================================
6494 dnl Testing for required Perl modules
6495 dnl ===================================================================
6497 AC_MSG_CHECKING([for required Perl modules])
6498 perl_use_string="use Cwd ; use Digest::MD5"
6499 if test "$_os" = "WINNT"; then
6500     if test -n "$PKGFORMAT"; then
6501         for i in $PKGFORMAT; do
6502             case "$i" in
6503             msi)
6504                 # for getting fonts versions to use in MSI
6505                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6506                 ;;
6507             esac
6508         done
6509     fi
6511 if test "$with_system_hsqldb" = "yes"; then
6512     perl_use_string="$perl_use_string ; use Archive::Zip"
6514 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6515     # OpenSSL needs that to build
6516     perl_use_string="$perl_use_string ; use FindBin"
6518 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6519     AC_MSG_RESULT([all modules found])
6520 else
6521     AC_MSG_RESULT([failed to find some modules])
6522     # Find out which modules are missing.
6523     for i in $perl_use_string; do
6524         if test "$i" != "use" -a "$i" != ";"; then
6525             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6526                 missing_perl_modules="$missing_perl_modules $i"
6527             fi
6528         fi
6529     done
6530     AC_MSG_ERROR([
6531     The missing Perl modules are: $missing_perl_modules
6532     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6535 dnl ===================================================================
6536 dnl Check for pkg-config
6537 dnl ===================================================================
6538 if test "$_os" != "WINNT"; then
6539     PKG_PROG_PKG_CONFIG
6541 AC_SUBST(PKG_CONFIG)
6542 AC_SUBST(PKG_CONFIG_PATH)
6543 AC_SUBST(PKG_CONFIG_LIBDIR)
6545 if test "$_os" != "WINNT"; then
6547     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6548     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6549     # explicitly. Or put /path/to/compiler in PATH yourself.
6551     toolprefix=gcc
6552     if test "$COM_IS_CLANG" = "TRUE"; then
6553         toolprefix=llvm
6554     fi
6555     AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
6556     AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
6557     AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
6558     AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
6559     AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
6560     AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
6562 AC_SUBST(AR)
6563 AC_SUBST(NM)
6564 AC_SUBST(OBJDUMP)
6565 AC_SUBST(RANLIB)
6566 AC_SUBST(READELF)
6567 AC_SUBST(STRIP)
6569 dnl ===================================================================
6570 dnl pkg-config checks on macOS
6571 dnl ===================================================================
6573 if test $_os = Darwin; then
6574     AC_MSG_CHECKING([for bogus pkg-config])
6575     if test -n "$PKG_CONFIG"; then
6576         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6577             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6578         else
6579             if test "$enable_bogus_pkg_config" = "yes"; then
6580                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6581             else
6582                 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.])
6583             fi
6584         fi
6585     else
6586         AC_MSG_RESULT([no, good])
6587     fi
6590 find_csc()
6592     # Return value: $csctest
6594     unset csctest
6596     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6597     if test -n "$regvalue"; then
6598         csctest=$regvalue
6599         return
6600     fi
6603 find_al()
6605     # Return value: $altest
6607     unset altest
6609     # We need this check to detect 4.6.1 or above.
6610     for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6611         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6612         PathFormat "$regvalue"
6613         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6614             altest=$regvalue
6615             return
6616         fi
6617     done
6619     reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
6620     for x in $reglist; do
6621         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6622         PathFormat "$regvalue"
6623         if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
6624             altest=$regvalue
6625             return
6626         fi
6627     done
6630 find_dotnetsdk()
6632     unset frametest
6634     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
6635         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6636         if test -n "$regvalue"; then
6637             frametest=$regvalue
6638             return
6639         fi
6640     done
6641     AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
6644 find_winsdk_version()
6646     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6647     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6649     unset winsdktest winsdkbinsubdir winsdklibsubdir
6651     case "$1" in
6652     8.0|8.0A)
6653         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6654         if test -n "$regvalue"; then
6655             winsdktest=$regvalue
6656             winsdklibsubdir=win8
6657             return
6658         fi
6659         ;;
6660     8.1|8.1A)
6661         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6662         if test -n "$regvalue"; then
6663             winsdktest=$regvalue
6664             winsdklibsubdir=winv6.3
6665             return
6666         fi
6667         ;;
6668     10.0)
6669         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6670         if test -n "$regvalue"; then
6671             winsdktest=$regvalue
6672             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6673             if test -n "$regvalue"; then
6674                 winsdkbinsubdir="$regvalue".0
6675                 winsdklibsubdir=$winsdkbinsubdir
6676                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6677                 local tmppath_unix=$(cygpath -u "$tmppath")
6678                 # test exist the SDK path
6679                 if test -d "$tmppath_unix"; then
6680                    # when path is convertible to a short path then path is okay
6681                    cygpath -d "$tmppath" >/dev/null 2>&1
6682                    if test $? -ne 0; then
6683                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6684                    fi
6685                 else
6686                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6687                 fi
6688             fi
6689             return
6690         fi
6691         ;;
6692     esac
6695 find_winsdk()
6697     # Return value: From find_winsdk_version
6699     unset winsdktest
6701     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6702         find_winsdk_version $ver
6703         if test -n "$winsdktest"; then
6704             return
6705         fi
6706     done
6709 find_msms()
6711     # Return value: $msmdir
6712     local version="$1"
6714     AC_MSG_CHECKING([for MSVC $version merge modules directory])
6715     local my_msm_file="Microsoft_VC${version}_CRT_x86.msm"
6716     local my_msm_dir
6718     echo "$as_me:$LINENO: searching for $my_msm_file" >&5
6720     msmdir=
6721     case "$VCVER" in
6722     16.0 | 17.0 | 17.9)
6723         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6724             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6725             echo "$as_me:$LINENO: looking for $my_msm_dir${my_msm_file}])" >&5
6726             if test -e "$my_msm_dir${my_msm_file}"; then
6727                 msmdir=$my_msm_dir
6728             fi
6729         done
6730         ;;
6731     esac
6733     if test -n "$msmdir"; then
6734         msmdir=`cygpath -m "$msmdir"`
6735         AC_MSG_RESULT([$msmdir])
6736     else
6737         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6738             AC_MSG_FAILURE([not found])
6739         else
6740             AC_MSG_WARN([not found (check config.log)])
6741             add_warning "MSM ${my_msm_file} not found"
6742         fi
6743     fi
6746 find_msvc_x64_dlls()
6748     # Return value: $msvcdllpath, $msvcdlls
6750     AC_MSG_CHECKING([for MSVC x64 DLL path])
6752     dnl Order crtver in increasing order. Then check the directories returned by
6753     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6754     dnl the result will be the highest CRT version found in the highest directory.
6756     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6757     case "$VCVER" in
6758     16.0 | 17.0 | 17.9)
6759         for crtver in 141 142 143; do
6760             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6761                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6762                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6763                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6764                 fi
6765             done
6766         done
6767         ;;
6768     esac
6769     AC_MSG_RESULT([$msvcdllpath])
6770     AC_MSG_CHECKING([for MSVC x64 DLLs])
6771     msvcdlls="msvcp140.dll vcruntime140.dll"
6772     for dll in $msvcdlls; do
6773         if ! test -f "$msvcdllpath/$dll"; then
6774             AC_MSG_FAILURE([missing $dll])
6775         fi
6776     done
6777     AC_MSG_RESULT([found all ($msvcdlls)])
6780 dnl =========================================
6781 dnl Check for the Windows  SDK.
6782 dnl =========================================
6783 if test "$_os" = "WINNT"; then
6784     AC_MSG_CHECKING([for Windows SDK])
6785     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6786         find_winsdk
6787         WINDOWS_SDK_HOME=$winsdktest
6789         # normalize if found
6790         if test -n "$WINDOWS_SDK_HOME"; then
6791             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6792             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6793         fi
6795         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6796     fi
6798     if test -n "$WINDOWS_SDK_HOME"; then
6799         # Remove a possible trailing backslash
6800         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6802         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6803              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6804              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6805             have_windows_sdk_headers=yes
6806         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6807              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6808              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6809             have_windows_sdk_headers=yes
6810         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6811              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6812              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6813             have_windows_sdk_headers=yes
6814         else
6815             have_windows_sdk_headers=no
6816         fi
6818         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6819             have_windows_sdk_libs=yes
6820         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6821             have_windows_sdk_libs=yes
6822         else
6823             have_windows_sdk_libs=no
6824         fi
6826         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6827             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6828 the  Windows SDK are installed.])
6829         fi
6830     fi
6832     if test -z "$WINDOWS_SDK_HOME"; then
6833         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6834     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6835         WINDOWS_SDK_VERSION=80
6836         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6837     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6838         WINDOWS_SDK_VERSION=81
6839         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6840     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6841         WINDOWS_SDK_VERSION=10
6842         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6843     else
6844         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6845     fi
6846     PathFormat "$WINDOWS_SDK_HOME"
6847     WINDOWS_SDK_HOME="$formatted_path"
6848     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6849     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6850         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6851         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6852             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6853         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6854             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6855         fi
6856     fi
6858     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6859     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6860     dnl but not in v8.0), so allow this to be overridden with a
6861     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6862     dnl and configuration error if no WiLangId.vbs is found would arguably be
6863     dnl better, but I do not know under which conditions exactly it is needed by
6864     dnl msiglobal.pm:
6865     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6866         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6867         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6868         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6869             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6870             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6871         fi
6872         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6873             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6874             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6875         fi
6876         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6877             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6878             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6879         fi
6880     fi
6881     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6882         if test -n "$with_package_format" -a "$with_package_format" != no; then
6883             for i in "$with_package_format"; do
6884                 if test "$i" = "msi"; then
6885                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6886                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6887                     fi
6888                 fi
6889             done
6890         fi
6891     fi
6893 AC_SUBST(WINDOWS_SDK_HOME)
6894 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6895 AC_SUBST(WINDOWS_SDK_VERSION)
6896 AC_SUBST(WINDOWS_SDK_WILANGID)
6898 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6899     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6900     dnl dir, it also determines that dir's path w/o an arch segment if any,
6901     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6902     AC_MSG_CHECKING([for midl.exe])
6904     find_winsdk
6905     PathFormat "$winsdktest"
6906     winsdktest_unix="$formatted_path_unix"
6908     if test -n "$winsdkbinsubdir" \
6909         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6910     then
6911         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6912         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
6913     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6914         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6915         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6916     elif test -f "$winsdktest_unix/Bin/midl.exe"; then
6917         MIDL_PATH=$winsdktest/Bin
6918         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
6919     fi
6920     PathFormat "$MIDL_PATH"
6921     if test ! -f "$formatted_path_unix/midl.exe"; then
6922         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6923     else
6924         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6925     fi
6927     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6928     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6930     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6931          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6932          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6933          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6934     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6935          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6936          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6937          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6938     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6939          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6940          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6941          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6942     else
6943         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6944     fi
6946     dnl Check csc.exe
6947     AC_MSG_CHECKING([for csc.exe])
6948     find_csc
6949     PathFormat "$csctest"
6950     csctest_unix="$formatted_path_unix"
6951     if test -f "$csctest_unix/csc.exe"; then
6952         CSC_PATH="$csctest"
6953     fi
6954     if test ! -f "$csctest_unix/csc.exe"; then
6955         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6956     else
6957         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6958     fi
6960     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6962     dnl Check al.exe
6963     AC_MSG_CHECKING([for al.exe])
6964     if test -n "$winsdkbinsubdir" \
6965         -a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6966     then
6967         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6968     elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
6969         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6970     elif test -f "$winsdktest_unix/Bin/al.exe"; then
6971         AL_PATH="$winsdktest/Bin"
6972     fi
6974     if test -z "$AL_PATH"; then
6975         find_al
6976         PathFormat "$altest"
6977         altest_unix="$formatted_path_unix"
6978         if test -f "$altest_unix/bin/al.exe"; then
6979             AL_PATH="$altest/bin"
6980         elif test -f "$altest_unix/al.exe"; then
6981             AL_PATH="$altest"
6982         fi
6983     fi
6984     PathFormat "$AL_PATH"
6985     if test ! -f "$formatted_path_unix/al.exe"; then
6986         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6987     else
6988         AC_MSG_RESULT([$AL_PATH/al.exe])
6989     fi
6991     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6993     dnl Check mscoree.lib / .NET Framework dir
6994     AC_MSG_CHECKING(.NET Framework)
6995     find_dotnetsdk
6996     PathFormat "$frametest"
6997     frametest="$formatted_path_unix"
6998     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6999         DOTNET_FRAMEWORK_HOME="$frametest"
7000     else
7001         if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
7002             DOTNET_FRAMEWORK_HOME="$winsdktest"
7003         fi
7004     fi
7005     PathFormat "$DOTNET_FRAMEWORK_HOME"
7006     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
7007         AC_MSG_ERROR([mscoree.lib not found])
7008     fi
7009     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
7011     PathFormat "$MIDL_PATH"
7012     MIDL_PATH="$formatted_path"
7014     PathFormat "$AL_PATH"
7015     AL_PATH="$formatted_path"
7017     PathFormat "$DOTNET_FRAMEWORK_HOME"
7018     DOTNET_FRAMEWORK_HOME="$formatted_path"
7020     PathFormat "$CSC_PATH"
7021     CSC_PATH="$formatted_path"
7024 dnl ===================================================================
7025 dnl Testing for C++ compiler and version...
7026 dnl ===================================================================
7028 if test "$_os" != "WINNT"; then
7029     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
7030     save_CXXFLAGS=$CXXFLAGS
7031     AC_PROG_CXX
7032     CXXFLAGS=$save_CXXFLAGS
7033     if test -z "$CXX_BASE"; then
7034         CXX_BASE=`first_arg_basename "$CXX"`
7035     fi
7038 dnl check for GNU C++ compiler version
7039 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
7040     AC_MSG_CHECKING([the GNU C++ compiler version])
7042     _gpp_version=`$CXX -dumpversion`
7043     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
7045     if test "$_gpp_majmin" -lt "700"; then
7046         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
7047     else
7048         AC_MSG_RESULT([ok (g++ $_gpp_version)])
7049     fi
7051     dnl see https://issuetracker.google.com/issues/36962819
7052         glibcxx_threads=no
7053         AC_LANG_PUSH([C++])
7054         AC_REQUIRE_CPP
7055         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
7056         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
7057             #include <bits/c++config.h>]],[[
7058             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
7059             && !defined(_GLIBCXX__PTHREADS) \
7060             && !defined(_GLIBCXX_HAS_GTHREADS)
7061             choke me
7062             #endif
7063         ]])],[AC_MSG_RESULT([yes])
7064         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7065         AC_LANG_POP([C++])
7066         if test $glibcxx_threads = yes; then
7067             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7068         fi
7070 AC_SUBST(BOOST_CXXFLAGS)
7073 # prefx CXX with ccache if needed
7075 if test "$CCACHE" != ""; then
7076     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7077     AC_LANG_PUSH([C++])
7078     save_CXXFLAGS=$CXXFLAGS
7079     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7080     # msvc does not fail on unknown options, check stdout
7081     if test "$COM" = MSC; then
7082         CXXFLAGS="$CXXFLAGS -nologo"
7083     fi
7084     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7085     ac_cxx_werror_flag=yes
7086     dnl an empty program will do, we're checking the compiler flags
7087     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7088                       [use_ccache=yes], [use_ccache=no])
7089     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7090         AC_MSG_RESULT([yes])
7091     else
7092         CXX="$CCACHE $CXX"
7093         CXX_BASE="ccache $CXX_BASE"
7094         AC_MSG_RESULT([no])
7095     fi
7096     CXXFLAGS=$save_CXXFLAGS
7097     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7098     AC_LANG_POP([C++])
7101 dnl ===================================================================
7102 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7103 dnl ===================================================================
7105 if test "$_os" != "WINNT"; then
7106     AC_PROG_CXXCPP
7108     dnl Check whether there's a C pre-processor.
7109     AC_PROG_CPP
7113 dnl ===================================================================
7114 dnl Find integral type sizes and alignments
7115 dnl ===================================================================
7117 if test "$_os" != "WINNT"; then
7119     AC_CHECK_SIZEOF(long)
7120     AC_CHECK_SIZEOF(short)
7121     AC_CHECK_SIZEOF(int)
7122     AC_CHECK_SIZEOF(long long)
7123     AC_CHECK_SIZEOF(double)
7124     AC_CHECK_SIZEOF(void*)
7125     AC_CHECK_SIZEOF(size_t)
7127     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7128     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7129     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7130     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7131     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7132     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7134     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7135     m4_pattern_allow([AC_CHECK_ALIGNOF])
7136     m4_ifdef([AC_CHECK_ALIGNOF],
7137         [
7138             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7139             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7140             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7141             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7142         ],
7143         [
7144             case "$_os-$host_cpu" in
7145             Linux-i686)
7146                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7147                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7148                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7149                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7150                 ;;
7151             Linux-x86_64)
7152                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7153                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7154                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7155                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7156                 ;;
7157             *)
7158                 if test -z "$ac_cv_alignof_short" -o \
7159                         -z "$ac_cv_alignof_int" -o \
7160                         -z "$ac_cv_alignof_long" -o \
7161                         -z "$ac_cv_alignof_double"; then
7162                    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.])
7163                 fi
7164                 ;;
7165             esac
7166         ])
7168     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7169     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7170     if test $ac_cv_sizeof_long -eq 8; then
7171         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7172     elif test $ac_cv_sizeof_double -eq 8; then
7173         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7174     else
7175         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7176     fi
7178     dnl Check for large file support
7179     AC_SYS_LARGEFILE
7180     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7181         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7182     fi
7183     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7184         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7185     fi
7186 else
7187     # Hardcode for MSVC
7188     SAL_TYPES_SIZEOFSHORT=2
7189     SAL_TYPES_SIZEOFINT=4
7190     SAL_TYPES_SIZEOFLONG=4
7191     SAL_TYPES_SIZEOFLONGLONG=8
7192     if test $WIN_HOST_BITS -eq 32; then
7193         SAL_TYPES_SIZEOFPOINTER=4
7194         SIZEOF_SIZE_T=4
7195     else
7196         SAL_TYPES_SIZEOFPOINTER=8
7197         SIZEOF_SIZE_T=8
7198     fi
7199     SAL_TYPES_ALIGNMENT2=2
7200     SAL_TYPES_ALIGNMENT4=4
7201     SAL_TYPES_ALIGNMENT8=8
7202     LFS_CFLAGS=''
7204 AC_SUBST(LFS_CFLAGS)
7205 AC_SUBST(SIZEOF_SIZE_T)
7207 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7208 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7209 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7210 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7211 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7212 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7213 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7214 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7216 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7217 AC_MSG_CHECKING([whether jumbo sheets are supported])
7218 if test "$_os" != "WINNT"; then
7219     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7220         AC_MSG_RESULT([yes])
7221         ENABLE_JUMBO_SHEETS=TRUE
7222         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7223     else
7224         AC_MSG_RESULT([no])
7225     fi
7226 else
7227     if test $WIN_HOST_BITS -gt 32; then
7228         # 64bit windows is special-cased for tools::Long because long is 32bit
7229         AC_MSG_RESULT([yes])
7230         ENABLE_JUMBO_SHEETS=TRUE
7231         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7232     else
7233         AC_MSG_RESULT([no])
7234     fi
7236 AC_SUBST(ENABLE_JUMBO_SHEETS)
7238 dnl ===================================================================
7239 dnl Check whether to enable runtime optimizations
7240 dnl ===================================================================
7241 ENABLE_RUNTIME_OPTIMIZATIONS=
7242 AC_MSG_CHECKING([whether to enable runtime optimizations])
7243 if test -z "$enable_runtime_optimizations"; then
7244     for i in $CC; do
7245         case $i in
7246         -fsanitize=*)
7247             enable_runtime_optimizations=no
7248             break
7249             ;;
7250         esac
7251     done
7253 if test "$enable_runtime_optimizations" != no; then
7254     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7255     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7256     AC_MSG_RESULT([yes])
7257 else
7258     AC_MSG_RESULT([no])
7260 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7262 dnl ===================================================================
7263 dnl Check if valgrind headers are available
7264 dnl ===================================================================
7265 ENABLE_VALGRIND=
7266 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7267     prev_cppflags=$CPPFLAGS
7268     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7269     # or where does it come from?
7270     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7271     AC_CHECK_HEADER([valgrind/valgrind.h],
7272         [ENABLE_VALGRIND=TRUE])
7273     CPPFLAGS=$prev_cppflags
7275 AC_SUBST([ENABLE_VALGRIND])
7276 if test -z "$ENABLE_VALGRIND"; then
7277     if test "$with_valgrind" = yes; then
7278         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7279     fi
7280     VALGRIND_CFLAGS=
7282 AC_SUBST([VALGRIND_CFLAGS])
7285 dnl ===================================================================
7286 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7287 dnl ===================================================================
7289 # We need at least the sys/sdt.h include header.
7290 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7291 if test "$SDT_H_FOUND" = "TRUE"; then
7292     # Found sys/sdt.h header, now make sure the c++ compiler works.
7293     # Old g++ versions had problems with probes in constructors/destructors.
7294     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7295     AC_LANG_PUSH([C++])
7296     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7297     #include <sys/sdt.h>
7298     class ProbeClass
7299     {
7300     private:
7301       int& ref;
7302       const char *name;
7304     public:
7305       ProbeClass(int& v, const char *n) : ref(v), name(n)
7306       {
7307         DTRACE_PROBE2(_test_, cons, name, ref);
7308       }
7310       void method(int min)
7311       {
7312         DTRACE_PROBE3(_test_, meth, name, ref, min);
7313         ref -= min;
7314       }
7316       ~ProbeClass()
7317       {
7318         DTRACE_PROBE2(_test_, dest, name, ref);
7319       }
7320     };
7321     ]],[[
7322     int i = 64;
7323     DTRACE_PROBE1(_test_, call, i);
7324     ProbeClass inst = ProbeClass(i, "call");
7325     inst.method(24);
7326     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7327           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7328     AC_LANG_POP([C++])
7330 AC_CONFIG_HEADERS([config_host/config_probes.h])
7332 dnl ===================================================================
7333 dnl GCC features
7334 dnl ===================================================================
7335 HAVE_GCC_STACK_CLASH_PROTECTION=
7336 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7337     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7338     save_CFLAGS=$CFLAGS
7339     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7340     AC_LINK_IFELSE(
7341         [AC_LANG_PROGRAM(, [[return 0;]])],
7342         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7343         [AC_MSG_RESULT([no])])
7344     CFLAGS=$save_CFLAGS
7346     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7347     save_CFLAGS=$CFLAGS
7348     CFLAGS="$CFLAGS -Werror -mno-avx"
7349     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7350     CFLAGS=$save_CFLAGS
7351     if test "$HAVE_GCC_AVX" = "TRUE"; then
7352         AC_MSG_RESULT([yes])
7353     else
7354         AC_MSG_RESULT([no])
7355     fi
7357     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7358     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7359     int v = 0;
7360     if (__sync_add_and_fetch(&v, 1) != 1 ||
7361         __sync_sub_and_fetch(&v, 1) != 0)
7362         return 1;
7363     __sync_synchronize();
7364     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7365         v != 1)
7366         return 1;
7367     return 0;
7368 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7369     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7370         AC_MSG_RESULT([yes])
7371         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7372     else
7373         AC_MSG_RESULT([no])
7374     fi
7376     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7377     AC_LANG_PUSH([C++])
7378     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7379             #include <cstddef>
7380             #include <cxxabi.h>
7381             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7382         ])], [
7383             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7384             AC_MSG_RESULT([yes])
7385         ], [AC_MSG_RESULT([no])])
7386     AC_LANG_POP([C++])
7388     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7389     AC_LANG_PUSH([C++])
7390     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7391             #include <cstddef>
7392             #include <cxxabi.h>
7393             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7394         ])], [
7395             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7396             AC_MSG_RESULT([yes])
7397         ], [AC_MSG_RESULT([no])])
7398     AC_LANG_POP([C++])
7400     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7401     AC_LANG_PUSH([C++])
7402     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7403             #include <cxxabi.h>
7404             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7405         ])], [
7406             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7407             AC_MSG_RESULT([yes])
7408         ], [AC_MSG_RESULT([no])])
7409     AC_LANG_POP([C++])
7411     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7412     AC_LANG_PUSH([C++])
7413     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7414             #include <cstddef>
7415             #include <cxxabi.h>
7416             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7417         ])], [
7418             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7419             AC_MSG_RESULT([yes])
7420         ], [AC_MSG_RESULT([no])])
7421     AC_LANG_POP([C++])
7423     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7424     AC_LANG_PUSH([C++])
7425     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7426             #include <cstddef>
7427             #include <cxxabi.h>
7428             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7429         ])], [
7430             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7431             AC_MSG_RESULT([yes])
7432         ], [AC_MSG_RESULT([no])])
7433     AC_LANG_POP([C++])
7435     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7436     AC_LANG_PUSH([C++])
7437     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7438             #include <cxxabi.h>
7439             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7440         ])], [
7441             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7442             AC_MSG_RESULT([yes])
7443         ], [AC_MSG_RESULT([no])])
7444     AC_LANG_POP([C++])
7446     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7447     AC_LANG_PUSH([C++])
7448     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7449             #include <cxxabi.h>
7450             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7451         ])], [
7452             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7453             AC_MSG_RESULT([yes])
7454         ], [AC_MSG_RESULT([no])])
7455     AC_LANG_POP([C++])
7457     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7458     AC_LANG_PUSH([C++])
7459     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7460             #include <cxxabi.h>
7461             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7462         ])], [
7463             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7464             AC_MSG_RESULT([yes])
7465         ], [AC_MSG_RESULT([no])])
7466     AC_LANG_POP([C++])
7468     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7469     AC_LANG_PUSH([C++])
7470     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7471             #include <cstddef>
7472             #include <cxxabi.h>
7473             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7474         ])], [
7475             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7476             AC_MSG_RESULT([yes])
7477         ], [AC_MSG_RESULT([no])])
7478     AC_LANG_POP([C++])
7480     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7481     AC_LANG_PUSH([C++])
7482     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7483             #include <cstddef>
7484             #include <cxxabi.h>
7485             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7486         ])], [
7487             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7488             AC_MSG_RESULT([yes])
7489         ], [AC_MSG_RESULT([no])])
7490     AC_LANG_POP([C++])
7493 AC_SUBST(HAVE_GCC_AVX)
7494 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7495 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7497 dnl ===================================================================
7498 dnl Identify the C++ library
7499 dnl ===================================================================
7501 AC_MSG_CHECKING([what the C++ library is])
7502 HAVE_LIBSTDCPP=
7503 HAVE_LIBCPP=
7504 AC_LANG_PUSH([C++])
7505 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7506 #include <utility>
7507 #ifndef __GLIBCXX__
7508 foo bar
7509 #endif
7510 ]])],
7511     [CPP_LIBRARY=GLIBCXX
7512      cpp_library_name="GNU libstdc++"
7513      HAVE_LIBSTDCPP=TRUE
7514     ],
7515     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7516 #include <utility>
7517 #ifndef _LIBCPP_VERSION
7518 foo bar
7519 #endif
7520 ]])],
7521     [CPP_LIBRARY=LIBCPP
7522      cpp_library_name="LLVM libc++"
7523      AC_DEFINE([HAVE_LIBCPP])
7524      HAVE_LIBCPP=TRUE
7525     ],
7526     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7527 #include <utility>
7528 #ifndef _MSC_VER
7529 foo bar
7530 #endif
7531 ]])],
7532     [CPP_LIBRARY=MSVCRT
7533      cpp_library_name="Microsoft"
7534     ],
7535     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7536 AC_MSG_RESULT([$cpp_library_name])
7537 AC_LANG_POP([C++])
7538 AC_SUBST([HAVE_LIBSTDCPP])
7539 AC_SUBST([HAVE_LIBCPP])
7541 if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
7542 then
7543     # Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
7544     # and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
7545     # assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
7546     # although there will be backwards compatibility).
7547     # Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
7548     # and there would be undefined references to debug functions.
7549     # Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
7550     # So check if debug mode can be used and disable or downgrade it to assertions
7551     # if needed.
7552     AC_MSG_CHECKING([if libc++ has a usable debug mode])
7553     AC_LANG_PUSH([C++])
7554     libcpp_debug_links=
7555     AC_LINK_IFELSE([AC_LANG_SOURCE([[
7556 #define _LIBCPP_DEBUG 0 // only assertions
7557 #include <vector>
7558 int main()
7560     std::vector<int> v;
7561     v.push_back( 1 );
7562     return v[ 3 ];
7564 ]])], [libcpp_debug_links=1])
7565     if test -n "$libcpp_debug_links"; then
7566         # we can use at least assertions, check if debug mode works
7567         AC_RUN_IFELSE([AC_LANG_SOURCE([[
7568 #define _LIBCPP_DEBUG 1 // debug mode
7569 #include <string>
7570 #include <vector>
7571 int foo(const std::vector<int>& v) { return *v.begin(); }
7572 int main()
7574     std::vector<int> v;
7575     v.push_back( 1 );
7576     std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
7577     return (foo(v) + s.size()) != 0 ? 0 : 1;
7579 ]])],
7580         [AC_MSG_RESULT(yes)
7581          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
7582         ],
7583         [AC_MSG_RESULT(no, using only assertions)
7584          LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
7585         ]
7586         )
7587     else
7588         AC_MSG_RESULT(no)
7589     fi
7590     AC_LANG_POP([C++])
7592 AC_SUBST([LIBCPP_DEBUG])
7594 dnl ===================================================================
7595 dnl Check for gperf
7596 dnl ===================================================================
7597 AC_PATH_PROG(GPERF, gperf)
7598 if test -z "$GPERF"; then
7599     AC_MSG_ERROR([gperf not found but needed. Install it.])
7601 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7602     GPERF=`cygpath -m $GPERF`
7604 AC_MSG_CHECKING([whether gperf is new enough])
7605 my_gperf_ver1=$($GPERF --version | head -n 1)
7606 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7607 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7608 if test "$my_gperf_ver3" -ge 301; then
7609     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7610 else
7611     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7613 AC_SUBST(GPERF)
7615 dnl ===================================================================
7616 dnl Check for system libcmis
7617 dnl ===================================================================
7618 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
7620 dnl ===================================================================
7621 dnl C++11
7622 dnl ===================================================================
7624 if test -z "${CXXFLAGS_CXX11+x}"; then
7625     AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
7626     if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7627         if test "$with_latest_c__" = yes; then
7628             CXXFLAGS_CXX11=-std:c++latest
7629         else
7630             CXXFLAGS_CXX11=-std:c++20
7631         fi
7632         CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
7633     elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7634         my_flags='-std=c++20 -std=c++2a'
7635         if test "$with_latest_c__" = yes; then
7636             my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
7637         fi
7638         for flag in $my_flags; do
7639             if test "$COM" = MSC; then
7640                 flag="-Xclang $flag"
7641             fi
7642             save_CXXFLAGS=$CXXFLAGS
7643             CXXFLAGS="$CXXFLAGS $flag -Werror"
7644             AC_LANG_PUSH([C++])
7645             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7646                 #include <algorithm>
7647                 #include <functional>
7648                 #include <vector>
7650                 void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7651                     std::sort(v.begin(), v.end(), fn);
7652                 }
7653                 ]])],[CXXFLAGS_CXX11=$flag])
7654             AC_LANG_POP([C++])
7655             CXXFLAGS=$save_CXXFLAGS
7656             if test -n "$CXXFLAGS_CXX11"; then
7657                 break
7658             fi
7659         done
7660     fi
7661     if test -n "$CXXFLAGS_CXX11"; then
7662         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7663     else
7664         AC_MSG_ERROR(no)
7665     fi
7667 AC_SUBST(CXXFLAGS_CXX11)
7669 if test "$GCC" = "yes"; then
7670     save_CXXFLAGS=$CXXFLAGS
7671     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7672     CHECK_L_ATOMIC
7673     CXXFLAGS=$save_CXXFLAGS
7674     AC_SUBST(ATOMIC_LIB)
7677 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7678 save_CXXFLAGS=$CXXFLAGS
7679 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7680 AC_LANG_PUSH([C++])
7682 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7683 #include <stddef.h>
7685 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7687 namespace
7689         struct b
7690         {
7691                 int i;
7692                 int j;
7693         };
7695 ]], [[
7696 struct a
7698         int i;
7699         int j;
7701 a thinga[]={{0,0}, {1,1}};
7702 b thingb[]={{0,0}, {1,1}};
7703 size_t i = sizeof(sal_n_array_size(thinga));
7704 size_t j = sizeof(sal_n_array_size(thingb));
7705 return !(i != 0 && j != 0);
7707     ], [ AC_MSG_RESULT(yes) ],
7708     [ AC_MSG_ERROR(no)])
7709 AC_LANG_POP([C++])
7710 CXXFLAGS=$save_CXXFLAGS
7712 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7713 if test "$GCC" = yes; then
7714     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7715     AC_LANG_PUSH([C++])
7716     save_CXXFLAGS=$CXXFLAGS
7717     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7718     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7719     CXXFLAGS=$save_CXXFLAGS
7720     AC_LANG_POP([C++])
7721     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7722         AC_MSG_RESULT([yes])
7723     else
7724         AC_MSG_RESULT([no])
7725     fi
7727 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7729 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7730 AC_LANG_PUSH([C++])
7731 save_CXXFLAGS=$CXXFLAGS
7732 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7733 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7734         #include <algorithm>
7735         #include <initializer_list>
7736         #include <vector>
7737         template<typename T> class S {
7738         private:
7739             std::vector<T> v_;
7740         public:
7741             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7742         };
7743         constinit S<int> s{3, 2, 1};
7744     ])], [
7745         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7746         AC_MSG_RESULT([yes])
7747     ], [AC_MSG_RESULT([no])])
7748 CXXFLAGS=$save_CXXFLAGS
7749 AC_LANG_POP([C++])
7751 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7752 AC_LANG_PUSH([C++])
7753 save_CXXFLAGS=$CXXFLAGS
7754 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7755 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7756         struct S1 { S1(S1 &&); };
7757         struct S2: S1 {};
7758         S1 f(S2 s) { return s; }
7759     ])], [
7760         AC_DEFINE([HAVE_P1155R3],[1])
7761         AC_MSG_RESULT([yes])
7762     ], [AC_MSG_RESULT([no])])
7763 CXXFLAGS=$save_CXXFLAGS
7764 AC_LANG_POP([C++])
7766 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7767 HAVE_CXX20_ATOMIC_REF=
7768 AC_LANG_PUSH([C++])
7769 save_CXXFLAGS=$CXXFLAGS
7770 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7771 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7772         #include <atomic>
7773         int x;
7774         std::atomic_ref<int> y(x);
7775     ])], [
7776         HAVE_CXX20_ATOMIC_REF=TRUE
7777         AC_MSG_RESULT([yes])
7778     ], [AC_MSG_RESULT([no])])
7779 CXXFLAGS=$save_CXXFLAGS
7780 AC_LANG_POP([C++])
7781 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7783 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7784 dnl which is included in -Wextra anyway):
7785 HAVE_WDEPRECATED_COPY_DTOR=
7786 if test "$GCC" = yes; then
7787     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7788     AC_LANG_PUSH([C++])
7789     save_CXXFLAGS=$CXXFLAGS
7790     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7791     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7792             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7793             AC_MSG_RESULT([yes])
7794         ], [AC_MSG_RESULT([no])])
7795     CXXFLAGS=$save_CXXFLAGS
7796     AC_LANG_POP([C++])
7798 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7800 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7801 dnl uninitialized warning for code like
7803 dnl   OString f();
7804 dnl   boost::optional<OString> * g(bool b) {
7805 dnl       boost::optional<OString> o;
7806 dnl       if (b) o = f();
7807 dnl       return new boost::optional<OString>(o);
7808 dnl   }
7810 dnl (as is e.g. present, in a slightly more elaborate form, in
7811 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7812 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7813 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7814 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7815     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7816     AC_LANG_PUSH([C++])
7817     save_CXXFLAGS=$CXXFLAGS
7818     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7819     if test "$ENABLE_OPTIMIZED" = TRUE; then
7820         CXXFLAGS="$CXXFLAGS -O2"
7821     else
7822         CXXFLAGS="$CXXFLAGS -O0"
7823     fi
7824     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7825             #include <new>
7826             void f1(int);
7827             struct S1 {
7828                 ~S1() { f1(n); }
7829                 int n = 0;
7830             };
7831             struct S2 {
7832                 S2() {}
7833                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7834                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7835                 void set(S1 s) {
7836                     new (stg) S1(s);
7837                     init = true;
7838                 }
7839                 bool init = false;
7840                 char stg[sizeof (S1)];
7841             } ;
7842             S1 f2();
7843             S2 * f3(bool b) {
7844                 S2 o;
7845                 if (b) o.set(f2());
7846                 return new S2(o);
7847             }
7848         ]])], [AC_MSG_RESULT([no])], [
7849             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7850             AC_MSG_RESULT([yes])
7851         ])
7852     CXXFLAGS=$save_CXXFLAGS
7853     AC_LANG_POP([C++])
7855 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7857 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7858 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7859 dnl hits us e.g. with GCC 10 and --enable-optimized at
7861 dnl   In file included from include/rtl/string.hxx:49,
7862 dnl                    from include/rtl/ustring.hxx:43,
7863 dnl                    from include/osl/file.hxx:35,
7864 dnl                    from include/codemaker/global.hxx:28,
7865 dnl                    from include/codemaker/options.hxx:23,
7866 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7867 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7868 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,
7869 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,
7870 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,
7871 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7872 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7873 dnl      78 |         memcpy( buffer, data, length );
7874 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7875 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7876 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7877     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7878     AC_LANG_PUSH([C++])
7879     save_CXXFLAGS=$CXXFLAGS
7880     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7881     if test "$ENABLE_OPTIMIZED" = TRUE; then
7882         CXXFLAGS="$CXXFLAGS -O2"
7883     else
7884         CXXFLAGS="$CXXFLAGS -O0"
7885     fi
7886     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7887     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7888             void fill(char const * begin, char const * end, char c);
7889             struct q {
7890                 char ids[4];
7891                 char username[6];
7892             };
7893             void test(q & c) {
7894                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7895                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7896             }
7897         ]])], [AC_MSG_RESULT([no])], [
7898             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7899             AC_MSG_RESULT([yes])
7900         ])
7901     CXXFLAGS=$save_CXXFLAGS
7902     AC_LANG_POP([C++])
7904 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7906 HAVE_DLLEXPORTINLINES=
7907 if test "$_os" = "WINNT"; then
7908     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7909     AC_LANG_PUSH([C++])
7910     save_CXXFLAGS=$CXXFLAGS
7911     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7912     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7913             HAVE_DLLEXPORTINLINES=TRUE
7914             AC_MSG_RESULT([yes])
7915         ], [AC_MSG_RESULT([no])])
7916     CXXFLAGS=$save_CXXFLAGS
7917     AC_LANG_POP([C++])
7919 AC_SUBST([HAVE_DLLEXPORTINLINES])
7921 dnl ===================================================================
7922 dnl CPU Intrinsics support - SSE, AVX
7923 dnl ===================================================================
7925 CXXFLAGS_INTRINSICS_SSE2=
7926 CXXFLAGS_INTRINSICS_SSSE3=
7927 CXXFLAGS_INTRINSICS_SSE41=
7928 CXXFLAGS_INTRINSICS_SSE42=
7929 CXXFLAGS_INTRINSICS_AVX=
7930 CXXFLAGS_INTRINSICS_AVX2=
7931 CXXFLAGS_INTRINSICS_AVX512=
7932 CXXFLAGS_INTRINSICS_AVX512F=
7933 CXXFLAGS_INTRINSICS_F16C=
7934 CXXFLAGS_INTRINSICS_FMA=
7936 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7937     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7938     flag_sse2=-msse2
7939     flag_ssse3=-mssse3
7940     flag_sse41=-msse4.1
7941     flag_sse42=-msse4.2
7942     flag_avx=-mavx
7943     flag_avx2=-mavx2
7944     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7945     flag_avx512f=-mavx512f
7946     flag_f16c=-mf16c
7947     flag_fma=-mfma
7948 else
7949     # With MSVC using -arch is in fact not necessary for being able
7950     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7951     # even if compiled with -arch:AVX, the -arch option really only affects
7952     # instructions generated for C/C++ code.
7953     # So use the matching same (or lower) -arch options, but only in order
7954     # to generate the best matching instructions for the C++ code surrounding
7955     # the intrinsics.
7956     # SSE2 is the default for x86/x64, so no need to specify the option.
7957     flag_sse2=
7958     # No specific options for these, use the next lower.
7959     flag_ssse3="$flag_sse2"
7960     flag_sse41="$flag_sse2"
7961     flag_sse42="$flag_sse2"
7962     flag_avx=-arch:AVX
7963     flag_avx2=-arch:AVX2
7964     flag_avx512=-arch:AVX512
7965     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7966     flag_avx512f=-arch:AVX2
7967     # No MSVC options for these.
7968     flag_f16c="$flag_sse2"
7969     flag_fma="$flag_sse2"
7972 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7973 AC_LANG_PUSH([C++])
7974 save_CXXFLAGS=$CXXFLAGS
7975 CXXFLAGS="$CXXFLAGS $flag_sse2"
7976 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7977     #include <emmintrin.h>
7978     int main () {
7979         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7980         c = _mm_xor_si128 (a, b);
7981         return 0;
7982     }
7983     ])],
7984     [can_compile_sse2=yes],
7985     [can_compile_sse2=no])
7986 AC_LANG_POP([C++])
7987 CXXFLAGS=$save_CXXFLAGS
7988 AC_MSG_RESULT([${can_compile_sse2}])
7989 if test "${can_compile_sse2}" = "yes" ; then
7990     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7993 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7994 AC_LANG_PUSH([C++])
7995 save_CXXFLAGS=$CXXFLAGS
7996 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7997 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7998     #include <tmmintrin.h>
7999     int main () {
8000         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8001         c = _mm_maddubs_epi16 (a, b);
8002         return 0;
8003     }
8004     ])],
8005     [can_compile_ssse3=yes],
8006     [can_compile_ssse3=no])
8007 AC_LANG_POP([C++])
8008 CXXFLAGS=$save_CXXFLAGS
8009 AC_MSG_RESULT([${can_compile_ssse3}])
8010 if test "${can_compile_ssse3}" = "yes" ; then
8011     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
8014 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
8015 AC_LANG_PUSH([C++])
8016 save_CXXFLAGS=$CXXFLAGS
8017 CXXFLAGS="$CXXFLAGS $flag_sse41"
8018 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8019     #include <smmintrin.h>
8020     int main () {
8021         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8022         c = _mm_cmpeq_epi64 (a, b);
8023         return 0;
8024     }
8025     ])],
8026     [can_compile_sse41=yes],
8027     [can_compile_sse41=no])
8028 AC_LANG_POP([C++])
8029 CXXFLAGS=$save_CXXFLAGS
8030 AC_MSG_RESULT([${can_compile_sse41}])
8031 if test "${can_compile_sse41}" = "yes" ; then
8032     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
8035 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
8036 AC_LANG_PUSH([C++])
8037 save_CXXFLAGS=$CXXFLAGS
8038 CXXFLAGS="$CXXFLAGS $flag_sse42"
8039 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8040     #include <nmmintrin.h>
8041     int main () {
8042         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
8043         c = _mm_cmpgt_epi64 (a, b);
8044         return 0;
8045     }
8046     ])],
8047     [can_compile_sse42=yes],
8048     [can_compile_sse42=no])
8049 AC_LANG_POP([C++])
8050 CXXFLAGS=$save_CXXFLAGS
8051 AC_MSG_RESULT([${can_compile_sse42}])
8052 if test "${can_compile_sse42}" = "yes" ; then
8053     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
8056 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
8057 AC_LANG_PUSH([C++])
8058 save_CXXFLAGS=$CXXFLAGS
8059 CXXFLAGS="$CXXFLAGS $flag_avx"
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;
8064         c = _mm256_xor_ps(a, b);
8065         return 0;
8066     }
8067     ])],
8068     [can_compile_avx=yes],
8069     [can_compile_avx=no])
8070 AC_LANG_POP([C++])
8071 CXXFLAGS=$save_CXXFLAGS
8072 AC_MSG_RESULT([${can_compile_avx}])
8073 if test "${can_compile_avx}" = "yes" ; then
8074     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8077 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8078 AC_LANG_PUSH([C++])
8079 save_CXXFLAGS=$CXXFLAGS
8080 CXXFLAGS="$CXXFLAGS $flag_avx2"
8081 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8082     #include <immintrin.h>
8083     int main () {
8084         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8085         c = _mm256_maddubs_epi16(a, b);
8086         return 0;
8087     }
8088     ])],
8089     [can_compile_avx2=yes],
8090     [can_compile_avx2=no])
8091 AC_LANG_POP([C++])
8092 CXXFLAGS=$save_CXXFLAGS
8093 AC_MSG_RESULT([${can_compile_avx2}])
8094 if test "${can_compile_avx2}" = "yes" ; then
8095     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8098 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8099 AC_LANG_PUSH([C++])
8100 save_CXXFLAGS=$CXXFLAGS
8101 CXXFLAGS="$CXXFLAGS $flag_avx512"
8102 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8103     #include <immintrin.h>
8104     int main () {
8105         __m512i a = _mm512_loadu_si512(0);
8106         __m512d v1 = _mm512_load_pd(0);
8107         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8108         __m512d v2 = _mm512_abs_pd(v1);
8109         return 0;
8110     }
8111     ])],
8112     [can_compile_avx512=yes],
8113     [can_compile_avx512=no])
8114 AC_LANG_POP([C++])
8115 CXXFLAGS=$save_CXXFLAGS
8116 AC_MSG_RESULT([${can_compile_avx512}])
8117 if test "${can_compile_avx512}" = "yes" ; then
8118     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8119     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8122 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8123 AC_LANG_PUSH([C++])
8124 save_CXXFLAGS=$CXXFLAGS
8125 CXXFLAGS="$CXXFLAGS $flag_f16c"
8126 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8127     #include <immintrin.h>
8128     int main () {
8129         __m128i a = _mm_set1_epi32 (0);
8130         __m128 c;
8131         c = _mm_cvtph_ps(a);
8132         return 0;
8133     }
8134     ])],
8135     [can_compile_f16c=yes],
8136     [can_compile_f16c=no])
8137 AC_LANG_POP([C++])
8138 CXXFLAGS=$save_CXXFLAGS
8139 AC_MSG_RESULT([${can_compile_f16c}])
8140 if test "${can_compile_f16c}" = "yes" ; then
8141     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8144 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8145 AC_LANG_PUSH([C++])
8146 save_CXXFLAGS=$CXXFLAGS
8147 CXXFLAGS="$CXXFLAGS $flag_fma"
8148 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8149     #include <immintrin.h>
8150     int main () {
8151         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8152         d = _mm256_fmadd_ps(a, b, c);
8153         return 0;
8154     }
8155     ])],
8156     [can_compile_fma=yes],
8157     [can_compile_fma=no])
8158 AC_LANG_POP([C++])
8159 CXXFLAGS=$save_CXXFLAGS
8160 AC_MSG_RESULT([${can_compile_fma}])
8161 if test "${can_compile_fma}" = "yes" ; then
8162     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8165 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8166 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8167 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8168 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8169 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8170 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8171 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8172 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8173 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8174 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8176 dnl ===================================================================
8177 dnl system stl sanity tests
8178 dnl ===================================================================
8179 if test "$_os" != "WINNT"; then
8181     AC_LANG_PUSH([C++])
8183     save_CPPFLAGS="$CPPFLAGS"
8184     if test -n "$MACOSX_SDK_PATH"; then
8185         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8186     fi
8188     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8189     # only.
8190     if test "$CPP_LIBRARY" = GLIBCXX; then
8191         dnl gcc#19664, gcc#22482, rhbz#162935
8192         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8193         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8194         AC_MSG_RESULT([$stlvisok])
8195         if test "$stlvisok" = "no"; then
8196             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8197         fi
8198     fi
8200     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8201     # when we don't make any dynamic libraries?
8202     if test "$DISABLE_DYNLOADING" = ""; then
8203         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8204         cat > conftestlib1.cc <<_ACEOF
8205 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8206 struct S2: S1<int> { virtual ~S2(); };
8207 S2::~S2() {}
8208 _ACEOF
8209         cat > conftestlib2.cc <<_ACEOF
8210 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8211 struct S2: S1<int> { virtual ~S2(); };
8212 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8213 _ACEOF
8214         gccvisinlineshiddenok=yes
8215         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8216             gccvisinlineshiddenok=no
8217         else
8218             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8219             dnl known to not work with -z defs (unsetting which makes the test
8220             dnl moot, though):
8221             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8222             if test "$COM_IS_CLANG" = TRUE; then
8223                 for i in $CXX $CXXFLAGS; do
8224                     case $i in
8225                     -fsanitize=*)
8226                         my_linkflagsnoundefs=
8227                         break
8228                         ;;
8229                     esac
8230                 done
8231             fi
8232             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8233                 gccvisinlineshiddenok=no
8234             fi
8235         fi
8237         rm -fr libconftest*
8238         AC_MSG_RESULT([$gccvisinlineshiddenok])
8239         if test "$gccvisinlineshiddenok" = "no"; then
8240             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8241         fi
8242     fi
8244    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8245     cat >visibility.cxx <<_ACEOF
8246 #pragma GCC visibility push(hidden)
8247 struct __attribute__ ((visibility ("default"))) TestStruct {
8248   static void Init();
8250 __attribute__ ((visibility ("default"))) void TestFunc() {
8251   TestStruct::Init();
8253 _ACEOF
8254     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8255         gccvisbroken=yes
8256     else
8257         case "$host_cpu" in
8258         i?86|x86_64)
8259             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8260                 gccvisbroken=no
8261             else
8262                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8263                     gccvisbroken=no
8264                 else
8265                     gccvisbroken=yes
8266                 fi
8267             fi
8268             ;;
8269         *)
8270             gccvisbroken=no
8271             ;;
8272         esac
8273     fi
8274     rm -f visibility.s visibility.cxx
8276     AC_MSG_RESULT([$gccvisbroken])
8277     if test "$gccvisbroken" = "yes"; then
8278         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8279     fi
8281     CPPFLAGS="$save_CPPFLAGS"
8283     AC_MSG_CHECKING([if CET endbranch is recognized])
8284 cat > endbr.s <<_ACEOF
8285 endbr32
8286 _ACEOF
8287     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8288     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8289         AC_MSG_RESULT([yes])
8290         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8291     else
8292         AC_MSG_RESULT([no])
8293     fi
8294     rm -f endbr.s endbr.o
8295     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8297     AC_LANG_POP([C++])
8300 dnl ===================================================================
8301 dnl  Clang++ tests
8302 dnl ===================================================================
8304 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8305 if test "$GCC" = "yes"; then
8306     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8307     AC_LANG_PUSH([C++])
8308     save_CXXFLAGS=$CXXFLAGS
8309     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8310     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8311     CXXFLAGS=$save_CXXFLAGS
8312     AC_LANG_POP([C++])
8313     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8314         AC_MSG_RESULT([yes])
8315     else
8316         AC_MSG_RESULT([no])
8317     fi
8319 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8321 dnl ===================================================================
8322 dnl Compiler plugins
8323 dnl ===================================================================
8325 COMPILER_PLUGINS=
8326 # currently only Clang
8328 if test "$COM_IS_CLANG" != "TRUE"; then
8329     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8330         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8331         enable_compiler_plugins=no
8332     fi
8335 COMPILER_PLUGINS_COM_IS_CLANG=
8336 if test "$COM_IS_CLANG" = "TRUE"; then
8337     if test -n "$enable_compiler_plugins"; then
8338         compiler_plugins="$enable_compiler_plugins"
8339     elif test -n "$ENABLE_DBGUTIL"; then
8340         compiler_plugins=test
8341     else
8342         compiler_plugins=no
8343     fi
8344     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8345         if test "$CLANGVER" -lt 120001; then
8346             if test "$compiler_plugins" = yes; then
8347                 AC_MSG_ERROR(
8348                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8349             else
8350                 compiler_plugins=no
8351             fi
8352         fi
8353     fi
8354     if test "$compiler_plugins" != "no"; then
8355         dnl The prefix where Clang resides, override to where Clang resides if
8356         dnl using a source build:
8357         if test -z "$CLANGDIR"; then
8358             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8359         fi
8360         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8361         if test -z "$COMPILER_PLUGINS_CXX"; then
8362             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8363         fi
8364         clangbindir=$CLANGDIR/bin
8365         if test "$build_os" = "cygwin"; then
8366             clangbindir=$(cygpath -u "$clangbindir")
8367         fi
8368         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8369         if test -n "$LLVM_CONFIG"; then
8370             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8371             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8372             if test -z "$CLANGLIBDIR"; then
8373                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8374             fi
8375             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8376             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8377             if $LLVM_CONFIG --src-root >/dev/null 2>&1; then
8378                 clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8379                 if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8380                     COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8381                 fi
8382             fi
8383             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8384             clangobjdir=$($LLVM_CONFIG --obj-root)
8385             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8386                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8387             fi
8388         fi
8389         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8390         AC_LANG_PUSH([C++])
8391         save_CXX=$CXX
8392         save_CXXCPP=$CXXCPP
8393         save_CPPFLAGS=$CPPFLAGS
8394         save_CXXFLAGS=$CXXFLAGS
8395         save_LDFLAGS=$LDFLAGS
8396         save_LIBS=$LIBS
8397         CXX=$COMPILER_PLUGINS_CXX
8398         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8399         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8400         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8401         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8402             [COMPILER_PLUGINS=TRUE],
8403             [
8404             if test "$compiler_plugins" = "yes"; then
8405                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8406             else
8407                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8408                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8409             fi
8410             ])
8411         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8412         dnl comment in compilerplugins/Makefile-clang.mk:
8413         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8414             LDFLAGS=""
8415             AC_MSG_CHECKING([for clang libraries to use])
8416             if test -z "$CLANGTOOLLIBS"; then
8417                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8418                 AC_LINK_IFELSE([
8419                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8420                         [[ clang::FullSourceLoc().dump(); ]])
8421                 ],[CLANGTOOLLIBS="$LIBS"],[])
8422             fi
8423             dnl If the above check for the combined -lclang-cpp failed, fall back to a hand-curated
8424             dnl list of individual -lclang* (but note that that list can become outdated over time,
8425             dnl see e.g. the since-reverted 5078591de9a0e65ca560a4f1913e90dfe95f66bf "CLANGTOOLLIBS
8426             dnl needs to include -lclangSupport now"):
8427             if test -z "$CLANGTOOLLIBS"; then
8428                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8429  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8430                 AC_LINK_IFELSE([
8431                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8432                         [[ clang::FullSourceLoc().dump(); ]])
8433                 ],[CLANGTOOLLIBS="$LIBS"],[])
8434             fi
8435             AC_MSG_RESULT([$CLANGTOOLLIBS])
8436             if test -z "$CLANGTOOLLIBS"; then
8437                 if test "$compiler_plugins" = "yes"; then
8438                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8439                 else
8440                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8441                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8442                 fi
8443                 COMPILER_PLUGINS=
8444             fi
8445             if test -n "$COMPILER_PLUGINS"; then
8446                 if test -z "$CLANGSYSINCLUDE"; then
8447                     if test -n "$LLVM_CONFIG"; then
8448                         # Path to the clang system headers (no idea if there's a better way to get it).
8449                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8450                     fi
8451                 fi
8452             fi
8453         fi
8454         CXX=$save_CXX
8455         CXXCPP=$save_CXXCPP
8456         CPPFLAGS=$save_CPPFLAGS
8457         CXXFLAGS=$save_CXXFLAGS
8458         LDFLAGS=$save_LDFLAGS
8459         LIBS="$save_LIBS"
8460         AC_LANG_POP([C++])
8462         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8463         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8464             #ifndef __clang__
8465             you lose
8466             #endif
8467             int foo=42;
8468             ]])],
8469             [AC_MSG_RESULT([yes])
8470              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8471             [AC_MSG_RESULT([no])])
8472         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8473     fi
8474 else
8475     if test "$enable_compiler_plugins" = "yes"; then
8476         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8477     fi
8479 COMPILER_PLUGINS_ANALYZER_PCH=
8480 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8481     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8483 AC_SUBST(COMPILER_PLUGINS)
8484 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8485 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8486 AC_SUBST(COMPILER_PLUGINS_CXX)
8487 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8488 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8489 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8490 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8491 AC_SUBST(CLANGDIR)
8492 AC_SUBST(CLANGLIBDIR)
8493 AC_SUBST(CLANGTOOLLIBS)
8494 AC_SUBST(CLANGSYSINCLUDE)
8496 # Plugin to help linker.
8497 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8498 # This makes --enable-lto build with clang work.
8499 AC_SUBST(LD_PLUGIN)
8501 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8502 AC_SUBST(HAVE_POSIX_FALLOCATE)
8504 JITC_PROCESSOR_TYPE=""
8505 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8506     # IBMs JDK needs this...
8507     JITC_PROCESSOR_TYPE=6
8508     export JITC_PROCESSOR_TYPE
8510 AC_SUBST([JITC_PROCESSOR_TYPE])
8512 # Misc Windows Stuff
8513 AC_ARG_WITH(ucrt-dir,
8514     AS_HELP_STRING([--with-ucrt-dir],
8515         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8516         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8517         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8518             Windows6.1-KB2999226-x64.msu
8519             Windows6.1-KB2999226-x86.msu
8520             Windows8.1-KB2999226-x64.msu
8521             Windows8.1-KB2999226-x86.msu
8522             Windows8-RT-KB2999226-x64.msu
8523             Windows8-RT-KB2999226-x86.msu
8524         A zip archive including those files is available from Microsoft site:
8525         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8528 UCRT_REDISTDIR="$with_ucrt_dir"
8529 if test $_os = "WINNT"; then
8530     find_msvc_x64_dlls
8531     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8532     MSVC_DLLS="$msvcdlls"
8533     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8534         with_redist=143
8535     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8536         with_redist=142
8537     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8538         with_redist=141
8539     fi
8540     for i in $PKGFORMAT; do
8541         if test "$i" = msi; then
8542             find_msms "$with_redist"
8543             if test -n "$msmdir"; then
8544                 MSM_PATH=`win_short_path_for_make "$msmdir"`
8545                 SCPDEFS="$SCPDEFS -DWITH_VC_REDIST=$with_redist"
8546             fi
8547             break
8548         fi
8549     done
8551     if test "$UCRT_REDISTDIR" = "no"; then
8552         dnl explicitly disabled
8553         UCRT_REDISTDIR=""
8554     else
8555         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8556                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8557                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8558                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8559                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8560                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8561             UCRT_REDISTDIR=""
8562             if test -n "$PKGFORMAT"; then
8563                for i in $PKGFORMAT; do
8564                    case "$i" in
8565                    msi)
8566                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8567                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8568                        ;;
8569                    esac
8570                done
8571             fi
8572         fi
8573     fi
8576 AC_SUBST(UCRT_REDISTDIR)
8577 AC_SUBST(MSVC_DLL_PATH)
8578 AC_SUBST(MSVC_DLLS)
8579 AC_SUBST(MSM_PATH)
8582 dnl ===================================================================
8583 dnl Checks for Java
8584 dnl ===================================================================
8585 if test "$ENABLE_JAVA" != ""; then
8587     # Windows-specific tests
8588     if test "$build_os" = "cygwin"; then
8589         if test -z "$with_jdk_home"; then
8590             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8591             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8592             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8593             if test -n "$regvalue"; then
8594                 ver=$regvalue
8595                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8596                 with_jdk_home=$regvalue
8597             fi
8598             howfound="found automatically"
8599         else
8600             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8601             howfound="you passed"
8602         fi
8604         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8605             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 17])
8606         fi
8607     fi
8609     # 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.
8610     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8611     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8612         with_jdk_home=`/usr/libexec/java_home`
8613     fi
8615     JAVA_HOME=; export JAVA_HOME
8616     if test -z "$with_jdk_home"; then
8617         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8618     else
8619         _java_path="$with_jdk_home/bin/$with_java"
8620         dnl Check if there is a Java interpreter at all.
8621         if test -x "$_java_path"; then
8622             JAVAINTERPRETER=$_java_path
8623         else
8624             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8625         fi
8626     fi
8628     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8629     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8630     dnl loaded by java to run JunitTests:
8631     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8632         shortjdkhome=`cygpath -d "$with_jdk_home"`
8633         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
8634             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8635             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8636         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
8637             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8638             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8639         fi
8641         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8642             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8643         fi
8644         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8645     elif test "$cross_compiling" != "yes"; then
8646         case $CPUNAME in
8647             AARCH64|AXP|X86_64|IA64|POWERPC64|S390X|SPARC64|MIPS64|RISCV64|LOONGARCH64)
8648                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8649                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8650                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8651                 fi
8652                 ;;
8653             *) # assumption: everything else 32-bit
8654                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8655                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8656                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8657                 fi
8658                 ;;
8659         esac
8660     fi
8663 dnl ===================================================================
8664 dnl Checks for JDK.
8665 dnl ===================================================================
8667 # Whether all the complexity here actually is needed any more or not, no idea.
8669 JDK_SECURITYMANAGER_DISALLOWED=
8670 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8671     _gij_longver=0
8672     AC_MSG_CHECKING([the installed JDK])
8673     if test -n "$JAVAINTERPRETER"; then
8674         dnl java -version sends output to stderr!
8675         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8676             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8677         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8678             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8679         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8680             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8681         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8682             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8683         else
8684             JDK=sun
8686             dnl Sun JDK specific tests
8687             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8688             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8690             if test "$_jdk_ver" -lt 170000; then
8691                 AC_MSG_ERROR([JDK is too old, you need at least 17 ($_jdk_ver < 170000)])
8692             fi
8693             dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be
8694             dnl completely removed in some Java version > 18 (see
8695             dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"):
8696             if test "$_jdk_ver" -ge 180000; then
8697                 JDK_SECURITYMANAGER_DISALLOWED=TRUE
8698             fi
8700             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8701             if test "$_os" = "WINNT"; then
8702                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8703             fi
8704             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8706             # set to limit VM usage for JunitTests
8707             JAVAIFLAGS=-Xmx64M
8708             # set to limit VM usage for javac
8709             JAVACFLAGS=-J-Xmx128M
8710         fi
8711     else
8712         AC_MSG_ERROR([Java not found. You need at least JDK 17])
8713     fi
8714 else
8715     if test -z "$ENABLE_JAVA"; then
8716         dnl Java disabled
8717         JAVA_HOME=
8718         export JAVA_HOME
8719     elif test "$cross_compiling" = "yes"; then
8720         # Just assume compatibility of build and host JDK
8721         JDK=$JDK_FOR_BUILD
8722         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8723     fi
8726 dnl ===================================================================
8727 dnl Checks for javac
8728 dnl ===================================================================
8729 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8730     javacompiler="javac"
8731     : ${JAVA_SOURCE_VER=8}
8732     : ${JAVA_TARGET_VER=8}
8733     if test -z "$with_jdk_home"; then
8734         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8735     else
8736         _javac_path="$with_jdk_home/bin/$javacompiler"
8737         dnl Check if there is a Java compiler at all.
8738         if test -x "$_javac_path"; then
8739             JAVACOMPILER=$_javac_path
8740         fi
8741     fi
8742     if test -z "$JAVACOMPILER"; then
8743         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8744     fi
8745     if test "$build_os" = "cygwin"; then
8746         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8747             JAVACOMPILER="${JAVACOMPILER}.exe"
8748         fi
8749         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8750     fi
8753 dnl ===================================================================
8754 dnl Checks for javadoc
8755 dnl ===================================================================
8756 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8757     if test -z "$with_jdk_home"; then
8758         AC_PATH_PROG(JAVADOC, javadoc)
8759     else
8760         _javadoc_path="$with_jdk_home/bin/javadoc"
8761         dnl Check if there is a javadoc at all.
8762         if test -x "$_javadoc_path"; then
8763             JAVADOC=$_javadoc_path
8764         else
8765             AC_PATH_PROG(JAVADOC, javadoc)
8766         fi
8767     fi
8768     if test -z "$JAVADOC"; then
8769         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8770     fi
8771     if test "$build_os" = "cygwin"; then
8772         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8773             JAVADOC="${JAVADOC}.exe"
8774         fi
8775         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8776     fi
8778     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8779     JAVADOCISGJDOC="yes"
8780     fi
8782 AC_SUBST(JAVADOC)
8783 AC_SUBST(JAVADOCISGJDOC)
8785 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8786     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8787     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8788         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8789            # try to recover first by looking whether we have an alternative
8790            # system as in Debian or newer SuSEs where following /usr/bin/javac
8791            # over /etc/alternatives/javac leads to the right bindir where we
8792            # just need to strip a bit away to get a valid JAVA_HOME
8793            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8794         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8795             # maybe only one level of symlink (e.g. on Mac)
8796             JAVA_HOME=$(readlink $JAVACOMPILER)
8797             if test "$(dirname $JAVA_HOME)" = "."; then
8798                 # we've got no path to trim back
8799                 JAVA_HOME=""
8800             fi
8801         else
8802             # else warn
8803             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8804             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8805             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8806             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8807         fi
8808         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8809         if test "$JAVA_HOME" != "/usr"; then
8810             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8811                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8812                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8813                 dnl Tiger already returns a JDK path...
8814                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8815             else
8816                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8817                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8818                 dnl that checks which version to run
8819                 if test -f "$JAVA_HOME"; then
8820                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8821                 fi
8822             fi
8823         fi
8824     fi
8825     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8827     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8828     if test -z "$JAVA_HOME"; then
8829         if test "x$with_jdk_home" = "x"; then
8830             cat > findhome.java <<_ACEOF
8831 [import java.io.File;
8833 class findhome
8835     public static void main(String args[])
8836     {
8837         String jrelocation = System.getProperty("java.home");
8838         File jre = new File(jrelocation);
8839         System.out.println(jre.getParent());
8840     }
8842 _ACEOF
8843             AC_MSG_CHECKING([if javac works])
8844             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8845             AC_TRY_EVAL(javac_cmd)
8846             if test $? = 0 -a -f ./findhome.class; then
8847                 AC_MSG_RESULT([javac works])
8848             else
8849                 echo "configure: javac test failed" >&5
8850                 cat findhome.java >&5
8851                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8852             fi
8853             AC_MSG_CHECKING([if gij knows its java.home])
8854             JAVA_HOME=`$JAVAINTERPRETER findhome`
8855             if test $? = 0 -a "$JAVA_HOME" != ""; then
8856                 AC_MSG_RESULT([$JAVA_HOME])
8857             else
8858                 echo "configure: java test failed" >&5
8859                 cat findhome.java >&5
8860                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8861             fi
8862             # clean-up after ourselves
8863             rm -f ./findhome.java ./findhome.class
8864         else
8865             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8866         fi
8867     fi
8869     # now check if $JAVA_HOME is really valid
8870     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8871         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8872             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8873             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8874             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8875             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8876             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8877             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8878         fi
8879     fi
8880     PathFormat "$JAVA_HOME"
8881     JAVA_HOME="$formatted_path"
8884 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8885     "$_os" != Darwin
8886 then
8887     AC_MSG_CHECKING([for JAWT lib])
8888     if test "$_os" = WINNT; then
8889         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8890         JAWTLIB=jawt.lib
8891     else
8892         case "$host_cpu" in
8893         arm*)
8894             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8895             JAVA_ARCH=$my_java_arch
8896             ;;
8897         i*86)
8898             my_java_arch=i386
8899             ;;
8900         m68k)
8901             my_java_arch=m68k
8902             ;;
8903         powerpc)
8904             my_java_arch=ppc
8905             ;;
8906         powerpc64)
8907             my_java_arch=ppc64
8908             ;;
8909         powerpc64le)
8910             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8911             JAVA_ARCH=$my_java_arch
8912             ;;
8913         sparc64)
8914             my_java_arch=sparcv9
8915             ;;
8916         x86_64)
8917             my_java_arch=amd64
8918             ;;
8919         *)
8920             my_java_arch=$host_cpu
8921             ;;
8922         esac
8923         # This is where JDK9 puts the library
8924         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8925             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8926         else
8927             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8928         fi
8929         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8930     fi
8931     AC_MSG_RESULT([$JAWTLIB])
8933 AC_SUBST(JAWTLIB)
8935 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8936     case "$host_os" in
8938     cygwin*|wsl*)
8939         JAVAINC="-I$JAVA_HOME/include/win32"
8940         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8941         ;;
8943     darwin*)
8944         if test -d "$JAVA_HOME/include/darwin"; then
8945             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8946         else
8947             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8948         fi
8949         ;;
8951     dragonfly*)
8952         JAVAINC="-I$JAVA_HOME/include"
8953         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8954         ;;
8956     freebsd*)
8957         JAVAINC="-I$JAVA_HOME/include"
8958         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8959         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8960         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8961         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8962         ;;
8964     k*bsd*-gnu*)
8965         JAVAINC="-I$JAVA_HOME/include"
8966         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8967         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8968         ;;
8970     linux-gnu*)
8971         JAVAINC="-I$JAVA_HOME/include"
8972         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8973         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8974         ;;
8976     *netbsd*)
8977         JAVAINC="-I$JAVA_HOME/include"
8978         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8979         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8980        ;;
8982     openbsd*)
8983         JAVAINC="-I$JAVA_HOME/include"
8984         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8985         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8986         ;;
8988     solaris*)
8989         JAVAINC="-I$JAVA_HOME/include"
8990         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8991         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8992         ;;
8993     esac
8995 SOLARINC="$SOLARINC $JAVAINC"
8997 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8998     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8999     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
9000     JDK_FOR_BUILD=$JDK
9001     JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED
9004 AC_SUBST(JAVACFLAGS)
9005 AC_SUBST(JAVACOMPILER)
9006 AC_SUBST(JAVAINTERPRETER)
9007 AC_SUBST(JAVAIFLAGS)
9008 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
9009 AC_SUBST(JAVA_HOME)
9010 AC_SUBST(JAVA_HOME_FOR_BUILD)
9011 AC_SUBST(JDK)
9012 AC_SUBST(JDK_FOR_BUILD)
9013 AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD)
9014 AC_SUBST(JAVA_SOURCE_VER)
9015 AC_SUBST(JAVA_TARGET_VER)
9018 dnl ===================================================================
9019 dnl Export file validation
9020 dnl ===================================================================
9021 AC_MSG_CHECKING([whether to enable export file validation])
9022 if test "$with_export_validation" != "no"; then
9023     if test -z "$ENABLE_JAVA"; then
9024         if test "$with_export_validation" = "yes"; then
9025             AC_MSG_ERROR([requested, but Java is disabled])
9026         else
9027             AC_MSG_RESULT([no, as Java is disabled])
9028         fi
9029     elif ! test -d "${SRC_ROOT}/schema"; then
9030         if test "$with_export_validation" = "yes"; then
9031             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
9032         else
9033             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
9034         fi
9035     else
9036         AC_MSG_RESULT([yes])
9037         AC_DEFINE(HAVE_EXPORT_VALIDATION)
9039         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
9040         if test -z "$ODFVALIDATOR"; then
9041             # remember to download the ODF toolkit with validator later
9042             AC_MSG_NOTICE([no odfvalidator found, will download it])
9043             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
9044             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
9046             # and fetch name of odfvalidator jar name from download.lst
9047             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9048             AC_SUBST(ODFVALIDATOR_JAR)
9050             if test -z "$ODFVALIDATOR_JAR"; then
9051                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
9052             fi
9053         fi
9054         if test "$build_os" = "cygwin"; then
9055             # In case of Cygwin it will be executed from Windows,
9056             # so we need to run bash and absolute path to validator
9057             # so instead of "odfvalidator" it will be
9058             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9059             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
9060         else
9061             ODFVALIDATOR="sh $ODFVALIDATOR"
9062         fi
9063         AC_SUBST(ODFVALIDATOR)
9066         AC_PATH_PROGS(OFFICEOTRON, officeotron)
9067         if test -z "$OFFICEOTRON"; then
9068             # remember to download the officeotron with validator later
9069             AC_MSG_NOTICE([no officeotron found, will download it])
9070             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9071             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9073             # and fetch name of officeotron jar name from download.lst
9074             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9075             AC_SUBST(OFFICEOTRON_JAR)
9077             if test -z "$OFFICEOTRON_JAR"; then
9078                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9079             fi
9080         else
9081             # check version of existing officeotron
9082             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9083             if test 0"$OFFICEOTRON_VER" -lt 704; then
9084                 AC_MSG_ERROR([officeotron too old])
9085             fi
9086         fi
9087         if test "$build_os" = "cygwin"; then
9088             # In case of Cygwin it will be executed from Windows,
9089             # so we need to run bash and absolute path to validator
9090             # so instead of "odfvalidator" it will be
9091             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9092             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9093         else
9094             OFFICEOTRON="sh $OFFICEOTRON"
9095         fi
9096     fi
9097     AC_SUBST(OFFICEOTRON)
9098 else
9099     AC_MSG_RESULT([no])
9102 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9103 if test "$with_bffvalidator" != "no"; then
9104     AC_DEFINE(HAVE_BFFVALIDATOR)
9106     if test "$with_export_validation" = "no"; then
9107         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9108     fi
9110     if test "$with_bffvalidator" = "yes"; then
9111         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9112     else
9113         BFFVALIDATOR="$with_bffvalidator"
9114     fi
9116     if test "$build_os" = "cygwin"; then
9117         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9118             AC_MSG_RESULT($BFFVALIDATOR)
9119         else
9120             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9121         fi
9122     elif test -n "$BFFVALIDATOR"; then
9123         # We are not in Cygwin but need to run Windows binary with wine
9124         AC_PATH_PROGS(WINE, wine)
9126         # so swap in a shell wrapper that converts paths transparently
9127         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9128         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9129         AC_SUBST(BFFVALIDATOR_EXE)
9130         AC_MSG_RESULT($BFFVALIDATOR)
9131     else
9132         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9133     fi
9134     AC_SUBST(BFFVALIDATOR)
9135 else
9136     AC_MSG_RESULT([no])
9139 dnl ===================================================================
9140 dnl Check for epm (not needed for Windows)
9141 dnl ===================================================================
9142 AC_MSG_CHECKING([whether to enable EPM for packing])
9143 if test "$enable_epm" = "yes"; then
9144     AC_MSG_RESULT([yes])
9145     if test "$_os" != "WINNT"; then
9146         if test $_os = Darwin; then
9147             EPM=internal
9148         elif test -n "$with_epm"; then
9149             EPM=$with_epm
9150         else
9151             AC_PATH_PROG(EPM, epm, no)
9152         fi
9153         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9154             AC_MSG_NOTICE([EPM will be built.])
9155             BUILD_TYPE="$BUILD_TYPE EPM"
9156             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9157         else
9158             # Gentoo has some epm which is something different...
9159             AC_MSG_CHECKING([whether the found epm is the right epm])
9160             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9161                 AC_MSG_RESULT([yes])
9162             else
9163                 AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9164             fi
9165             AC_MSG_CHECKING([epm version])
9166             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9167             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9168                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9169                 AC_MSG_RESULT([OK, >= 3.7])
9170             else
9171                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9172                 AC_MSG_ERROR([Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm])
9173             fi
9174         fi
9175     fi
9177     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9178         AC_MSG_CHECKING([for rpm])
9179         for a in "$RPM" rpmbuild rpm; do
9180             $a --usage >/dev/null 2> /dev/null
9181             if test $? -eq 0; then
9182                 RPM=$a
9183                 break
9184             else
9185                 $a --version >/dev/null 2> /dev/null
9186                 if test $? -eq 0; then
9187                     RPM=$a
9188                     break
9189                 fi
9190             fi
9191         done
9192         if test -z "$RPM"; then
9193             AC_MSG_ERROR([not found])
9194         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9195             RPM_PATH=`which $RPM`
9196             AC_MSG_RESULT([$RPM_PATH])
9197             SCPDEFS="$SCPDEFS -DWITH_RPM"
9198         else
9199             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9200         fi
9201     fi
9202     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9203         AC_PATH_PROG(DPKG, dpkg, no)
9204         if test "$DPKG" = "no"; then
9205             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9206         fi
9207     fi
9208     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9209        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9210         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9211             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9212                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9213                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9214                     AC_MSG_RESULT([yes])
9215                 else
9216                     AC_MSG_RESULT([no])
9217                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9218                         _pt="rpm"
9219                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9220                         add_warning "the rpms will need to be installed with --nodeps"
9221                     else
9222                         _pt="pkg"
9223                     fi
9224                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9225                     add_warning "the ${_pt}s will not be relocatable"
9226                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9227                                  relocation will work, you need to patch your epm with the
9228                                  patch in epm/epm-3.7.patch or build with
9229                                  --with-epm=internal which will build a suitable epm])
9230                 fi
9231             fi
9232         fi
9233     fi
9234     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9235         AC_PATH_PROG(PKGMK, pkgmk, no)
9236         if test "$PKGMK" = "no"; then
9237             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9238         fi
9239     fi
9240     AC_SUBST(RPM)
9241     AC_SUBST(DPKG)
9242     AC_SUBST(PKGMK)
9243 else
9244     for i in $PKGFORMAT; do
9245         case "$i" in
9246         bsd | deb | pkg | rpm | native | portable)
9247             AC_MSG_ERROR(
9248                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9249             ;;
9250         esac
9251     done
9252     AC_MSG_RESULT([no])
9253     EPM=NO
9255 AC_SUBST(EPM)
9257 ENABLE_LWP=
9258 if test "$enable_lotuswordpro" = "yes"; then
9259     ENABLE_LWP="TRUE"
9261 AC_SUBST(ENABLE_LWP)
9263 dnl ===================================================================
9264 dnl Check for building ODK
9265 dnl ===================================================================
9266 AC_MSG_CHECKING([whether to build the ODK])
9267 if test "$enable_odk" = yes; then
9268     if test "$DISABLE_DYNLOADING" = TRUE; then
9269         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9270     fi
9271     AC_MSG_RESULT([yes])
9272     BUILD_TYPE="$BUILD_TYPE ODK"
9273 else
9274     AC_MSG_RESULT([no])
9277 if test "$enable_odk" != yes; then
9278     unset DOXYGEN
9279 else
9280     if test "$with_doxygen" = no; then
9281         AC_MSG_CHECKING([for doxygen])
9282         unset DOXYGEN
9283         AC_MSG_RESULT([no])
9284     else
9285         if test "$with_doxygen" = yes; then
9286             AC_PATH_PROG([DOXYGEN], [doxygen])
9287             if test -z "$DOXYGEN"; then
9288                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9289             fi
9290             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9291                 if ! dot -V 2>/dev/null; then
9292                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9293                 fi
9294             fi
9295         else
9296             AC_MSG_CHECKING([for doxygen])
9297             DOXYGEN=$with_doxygen
9298             AC_MSG_RESULT([$DOXYGEN])
9299         fi
9300         if test -n "$DOXYGEN"; then
9301             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9302             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9303             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9304                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9305             fi
9306         fi
9307     fi
9309 AC_SUBST([DOXYGEN])
9311 dnl ==================================================================
9312 dnl libfuzzer
9313 dnl ==================================================================
9314 AC_MSG_CHECKING([whether to enable fuzzers])
9315 if test "$enable_fuzzers" != yes; then
9316     AC_MSG_RESULT([no])
9317 else
9318     if test -z $LIB_FUZZING_ENGINE; then
9319       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9320     fi
9321     AC_MSG_RESULT([yes])
9322     ENABLE_FUZZERS="TRUE"
9323     AC_DEFINE([ENABLE_FUZZERS],1)
9324     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9326 AC_SUBST(LIB_FUZZING_ENGINE)
9328 dnl ===================================================================
9329 dnl Check for system zlib
9330 dnl ===================================================================
9331 if test "$with_system_zlib" = "auto"; then
9332     case "$_os" in
9333     WINNT)
9334         with_system_zlib="$with_system_libs"
9335         ;;
9336     *)
9337         if test "$enable_fuzzers" != "yes"; then
9338             with_system_zlib=yes
9339         else
9340             with_system_zlib=no
9341         fi
9342         ;;
9343     esac
9346 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9347 dnl and has no pkg-config for it at least on some tinderboxes,
9348 dnl so leaving that out for now
9349 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9350 AC_MSG_CHECKING([which zlib to use])
9351 if test "$with_system_zlib" = "yes"; then
9352     AC_MSG_RESULT([external])
9353     SYSTEM_ZLIB=TRUE
9354     AC_CHECK_HEADER(zlib.h, [],
9355         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9356     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9357         [AC_MSG_ERROR(zlib not found or functional)], [])
9358 else
9359     AC_MSG_RESULT([internal])
9360     SYSTEM_ZLIB=
9361     BUILD_TYPE="$BUILD_TYPE ZLIB"
9362     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9363     if test "$COM" = "MSC"; then
9364         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
9365     else
9366         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9367     fi
9369 AC_SUBST(ZLIB_CFLAGS)
9370 AC_SUBST(ZLIB_LIBS)
9371 AC_SUBST(SYSTEM_ZLIB)
9373 dnl ===================================================================
9374 dnl Check for system jpeg
9375 dnl ===================================================================
9376 AC_MSG_CHECKING([which libjpeg to use])
9377 if test "$with_system_jpeg" = "yes"; then
9378     AC_MSG_RESULT([external])
9379     SYSTEM_LIBJPEG=TRUE
9380     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9381         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9382     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9383         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9384 else
9385     SYSTEM_LIBJPEG=
9386     AC_MSG_RESULT([internal, libjpeg-turbo])
9387     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9389     case "$host_cpu" in
9390     x86_64 | amd64 | i*86 | x86 | ia32)
9391         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9392         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9393             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9394                 NASM="$LODE_HOME/opt/bin/nasm"
9395             elif test -x "/opt/lo/bin/nasm"; then
9396                 NASM="/opt/lo/bin/nasm"
9397             fi
9398         fi
9400         if test -n "$NASM"; then
9401             AC_MSG_CHECKING([for object file format of host system])
9402             case "$host_os" in
9403               cygwin* | mingw* | pw32* | wsl*)
9404                 case "$host_cpu" in
9405                   x86_64)
9406                     objfmt='Win64-COFF'
9407                     ;;
9408                   *)
9409                     objfmt='Win32-COFF'
9410                     ;;
9411                 esac
9412               ;;
9413               msdosdjgpp* | go32*)
9414                 objfmt='COFF'
9415               ;;
9416               os2-emx*) # not tested
9417                 objfmt='MSOMF' # obj
9418               ;;
9419               linux*coff* | linux*oldld*)
9420                 objfmt='COFF' # ???
9421               ;;
9422               linux*aout*)
9423                 objfmt='a.out'
9424               ;;
9425               linux*)
9426                 case "$host_cpu" in
9427                   x86_64)
9428                     objfmt='ELF64'
9429                     ;;
9430                   *)
9431                     objfmt='ELF'
9432                     ;;
9433                 esac
9434               ;;
9435               kfreebsd* | freebsd* | netbsd* | openbsd*)
9436                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9437                   objfmt='BSD-a.out'
9438                 else
9439                   case "$host_cpu" in
9440                     x86_64 | amd64)
9441                       objfmt='ELF64'
9442                       ;;
9443                     *)
9444                       objfmt='ELF'
9445                       ;;
9446                   esac
9447                 fi
9448               ;;
9449               solaris* | sunos* | sysv* | sco*)
9450                 case "$host_cpu" in
9451                   x86_64)
9452                     objfmt='ELF64'
9453                     ;;
9454                   *)
9455                     objfmt='ELF'
9456                     ;;
9457                 esac
9458               ;;
9459               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9460                 case "$host_cpu" in
9461                   x86_64)
9462                     objfmt='Mach-O64'
9463                     ;;
9464                   *)
9465                     objfmt='Mach-O'
9466                     ;;
9467                 esac
9468               ;;
9469               *)
9470                 objfmt='ELF ?'
9471               ;;
9472             esac
9474             AC_MSG_RESULT([$objfmt])
9475             if test "$objfmt" = 'ELF ?'; then
9476               objfmt='ELF'
9477               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9478             fi
9480             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9481             case "$objfmt" in
9482               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9483               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9484               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9485               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9486               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9487               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9488               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9489               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9490               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9491               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9492               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9493             esac
9494             AC_MSG_RESULT([$NAFLAGS])
9496             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9497             cat > conftest.asm << EOF
9498             [%line __oline__ "configure"
9499                     section .text
9500                     global  _main,main
9501             _main:
9502             main:   xor     eax,eax
9503                     ret
9504             ]
9506             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9507             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9508               AC_MSG_RESULT(yes)
9509             else
9510               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9511               cat conftest.asm >&AS_MESSAGE_LOG_FD
9512               rm -rf conftest*
9513               AC_MSG_RESULT(no)
9514               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9515               NASM=""
9516             fi
9518         fi
9520         if test -z "$NASM"; then
9521 cat << _EOS
9522 ****************************************************************************
9523 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9524 To get one please:
9526 _EOS
9527             if test "$build_os" = "cygwin"; then
9528 cat << _EOS
9529 install a pre-compiled binary for Win32
9531 mkdir -p /opt/lo/bin
9532 cd /opt/lo/bin
9533 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9534 chmod +x nasm
9536 or get and install one from https://www.nasm.us/
9538 Then re-run autogen.sh
9540 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9541 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9543 _EOS
9544             else
9545 cat << _EOS
9546 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md
9548 _EOS
9549             fi
9550             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9551             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9552         fi
9553       ;;
9554     esac
9557 AC_SUBST(NASM)
9558 AC_SUBST(NAFLAGS)
9559 AC_SUBST(LIBJPEG_CFLAGS)
9560 AC_SUBST(LIBJPEG_LIBS)
9561 AC_SUBST(SYSTEM_LIBJPEG)
9563 dnl ===================================================================
9564 dnl Check for system clucene
9565 dnl ===================================================================
9566 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9567 if test "$SYSTEM_CLUCENE" = TRUE; then
9568     AC_LANG_PUSH([C++])
9569     save_CXXFLAGS=$CXXFLAGS
9570     save_CPPFLAGS=$CPPFLAGS
9571     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9572     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9573     dnl https://sourceforge.net/p/clucene/bugs/200/
9574     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9575     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9576                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9577     CXXFLAGS=$save_CXXFLAGS
9578     CPPFLAGS=$save_CPPFLAGS
9579     AC_LANG_POP([C++])
9580     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9583 dnl ===================================================================
9584 dnl Check for system expat
9585 dnl ===================================================================
9586 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9588 dnl ===================================================================
9589 dnl Check for system xmlsec
9590 dnl ===================================================================
9591 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.35])
9593 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9594 if test "$enable_eot" = "yes"; then
9595     ENABLE_EOT="TRUE"
9596     AC_DEFINE([ENABLE_EOT])
9597     AC_MSG_RESULT([yes])
9599     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9600 else
9601     ENABLE_EOT=
9602     AC_MSG_RESULT([no])
9604 AC_SUBST([ENABLE_EOT])
9606 dnl ===================================================================
9607 dnl Check for DLP libs
9608 dnl ===================================================================
9609 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9610 AS_IF([test "$COM" = "MSC"],
9611       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9612       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9614 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9615 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9617 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9619 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9621 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9622 AS_IF([test "$COM" = "MSC"],
9623       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9624       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9626 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9627 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9629 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9631 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9632 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.14])
9634 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9636 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9638 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9640 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.21])
9641 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9643 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9644 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9646 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9648 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9649 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9651 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9653 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9655 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9657 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9659 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9660 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9662 dnl ===================================================================
9663 dnl Check for system lcms2
9664 dnl ===================================================================
9665 if test "$with_system_lcms2" != "yes"; then
9666     SYSTEM_LCMS2=
9668 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9669 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9670 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9671 if test "$GCC" = "yes"; then
9672     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9674 if test "$COM" = "MSC"; then # override the above
9675     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9678 dnl ===================================================================
9679 dnl Check for system cppunit
9680 dnl ===================================================================
9681 if test "$_os" != "Android" ; then
9682     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9685 dnl ===================================================================
9686 dnl Check whether freetype is available
9688 dnl FreeType has 3 different kinds of versions
9689 dnl * release, like 2.4.10
9690 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9691 dnl * soname
9692 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9694 dnl 9.9.3 is 2.2.0
9695 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9696 dnl ===================================================================
9697 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9698 if test "x$ac_config_site_64bit_host" = xYES; then
9699     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9700 else
9701     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9703 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9705 # ===================================================================
9706 # Check for system libxslt
9707 # to prevent incompatibilities between internal libxml2 and external libxslt,
9708 # or vice versa, use with_system_libxml here
9709 # ===================================================================
9710 if test "$with_system_libxml" = "auto"; then
9711     case "$_os" in
9712     WINNT|iOS|Android)
9713         with_system_libxml="$with_system_libs"
9714         ;;
9715     Emscripten)
9716         with_system_libxml=no
9717         ;;
9718     *)
9719         if test "$enable_fuzzers" != "yes"; then
9720             with_system_libxml=yes
9721         else
9722             with_system_libxml=no
9723         fi
9724         ;;
9725     esac
9728 AC_MSG_CHECKING([which libxslt to use])
9729 if test "$with_system_libxml" = "yes"; then
9730     AC_MSG_RESULT([external])
9731     SYSTEM_LIBXSLT=TRUE
9732     if test "$_os" = "Darwin"; then
9733         dnl make sure to use SDK path
9734         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9735         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9736         dnl omit -L/usr/lib
9737         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9738         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9739     else
9740         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9741         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9742         FilterLibs "${LIBXSLT_LIBS}"
9743         LIBXSLT_LIBS="${filteredlibs}"
9744         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9745         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9746         FilterLibs "${LIBEXSLT_LIBS}"
9747         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9748     fi
9750     dnl Check for xsltproc
9751     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9752     if test "$XSLTPROC" = "no"; then
9753         AC_MSG_ERROR([xsltproc is required])
9754     fi
9755 else
9756     AC_MSG_RESULT([internal])
9757     SYSTEM_LIBXSLT=
9758     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9760 AC_SUBST(SYSTEM_LIBXSLT)
9761 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9762     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9764 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9766 AC_SUBST(LIBEXSLT_CFLAGS)
9767 AC_SUBST(LIBEXSLT_LIBS)
9768 AC_SUBST(LIBXSLT_CFLAGS)
9769 AC_SUBST(LIBXSLT_LIBS)
9770 AC_SUBST(XSLTPROC)
9772 # ===================================================================
9773 # Check for system libxml
9774 # ===================================================================
9775 AC_MSG_CHECKING([which libxml to use])
9776 if test "$with_system_libxml" = "yes"; then
9777     AC_MSG_RESULT([external])
9778     SYSTEM_LIBXML=TRUE
9779     if test "$_os" = "Darwin"; then
9780         dnl make sure to use SDK path
9781         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9782         dnl omit -L/usr/lib
9783         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9784     elif test $_os = iOS; then
9785         dnl make sure to use SDK path
9786         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9787         LIBXML_CFLAGS="-I$usr/include/libxml2"
9788         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9789     else
9790         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9791         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9792         FilterLibs "${LIBXML_LIBS}"
9793         LIBXML_LIBS="${filteredlibs}"
9794     fi
9796     dnl Check for xmllint
9797     AC_PATH_PROG(XMLLINT, xmllint, no)
9798     if test "$XMLLINT" = "no"; then
9799         AC_MSG_ERROR([xmllint is required])
9800     fi
9801 else
9802     AC_MSG_RESULT([internal])
9803     SYSTEM_LIBXML=
9804     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9805     if test "$COM" = "MSC"; then
9806         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9807     fi
9808     if test "$COM" = "MSC"; then
9809         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9810     else
9811         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9812         if test "$DISABLE_DYNLOADING" = TRUE; then
9813             LIBXML_LIBS="$LIBXML_LIBS -lm"
9814         fi
9815     fi
9816     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9818 AC_SUBST(SYSTEM_LIBXML)
9819 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9820     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9822 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9823 AC_SUBST(LIBXML_CFLAGS)
9824 AC_SUBST(LIBXML_LIBS)
9825 AC_SUBST(XMLLINT)
9827 # =====================================================================
9828 # Checking for a Python interpreter with version >= 3.3.
9829 # Optionally user can pass an option to configure, i. e.
9830 # ./configure PYTHON=/usr/bin/python
9831 # =====================================================================
9832 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9833     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9834     # unless PYTHON is defined as above which allows 'system'
9835     enable_python=internal
9837 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9838     if test -n "$PYTHON"; then
9839         PYTHON_FOR_BUILD=$PYTHON
9840     else
9841         # This allows a lack of system python with no error, we use internal one in that case.
9842         AM_PATH_PYTHON([3.3],, [:])
9843         # Clean PYTHON_VERSION checked below if cross-compiling
9844         PYTHON_VERSION=""
9845         if test "$PYTHON" != ":"; then
9846             PYTHON_FOR_BUILD=$PYTHON
9847         fi
9848     fi
9851 # Checks for Python to use for Pyuno
9852 AC_MSG_CHECKING([which Python to use for Pyuno])
9853 case "$enable_python" in
9854 no|disable)
9855     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9856         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9857         # requirement from the choice whether to include Python stuff in the installer, but why
9858         # bother?
9859         AC_MSG_ERROR([Python is required at build time.])
9860     fi
9861     enable_python=no
9862     AC_MSG_RESULT([none])
9863     ;;
9864 ""|yes|auto)
9865     if test "$DISABLE_SCRIPTING" = TRUE; then
9866         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9867             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9868         fi
9869         AC_MSG_RESULT([none, overridden by --disable-scripting])
9870         enable_python=no
9871     elif test $build_os = cygwin -o $build_os = wsl; then
9872         dnl When building on Windows we don't attempt to use any installed
9873         dnl "system"  Python.
9874         AC_MSG_RESULT([fully internal])
9875         enable_python=internal
9876     elif test "$cross_compiling" = yes; then
9877         AC_MSG_RESULT([system])
9878         enable_python=system
9879     else
9880         # Unset variables set by the above AM_PATH_PYTHON so that
9881         # we actually do check anew.
9882         AC_MSG_RESULT([])
9883         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
9884         AM_PATH_PYTHON([3.3],, [:])
9885         AC_MSG_CHECKING([which Python to use for Pyuno])
9886         if test "$PYTHON" = ":"; then
9887             if test -z "$PYTHON_FOR_BUILD"; then
9888                 AC_MSG_RESULT([fully internal])
9889             else
9890                 AC_MSG_RESULT([internal])
9891             fi
9892             enable_python=internal
9893         else
9894             AC_MSG_RESULT([system])
9895             enable_python=system
9896         fi
9897     fi
9898     ;;
9899 internal)
9900     AC_MSG_RESULT([internal])
9901     ;;
9902 fully-internal)
9903     AC_MSG_RESULT([fully internal])
9904     enable_python=internal
9905     ;;
9906 system)
9907     AC_MSG_RESULT([system])
9908     if test "$_os" = Darwin -a -z "$PYTHON"; then
9909         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9910     fi
9911     ;;
9913     AC_MSG_ERROR([Incorrect --enable-python option])
9914     ;;
9915 esac
9917 if test $enable_python != no; then
9918     BUILD_TYPE="$BUILD_TYPE PYUNO"
9921 if test $enable_python = system; then
9922     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9923         # Fallback: Accept these in the environment, or as set above
9924         # for MacOSX.
9925         :
9926     elif test "$cross_compiling" != yes; then
9927         # Unset variables set by the above AM_PATH_PYTHON so that
9928         # we actually do check anew.
9929         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
9930         # This causes an error if no python command is found
9931         AM_PATH_PYTHON([3.3])
9932         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9933         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9934         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9935         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9936         if test -z "$PKG_CONFIG"; then
9937             PYTHON_CFLAGS="-I$python_include"
9938             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9939         elif $PKG_CONFIG --exists python-$python_version-embed; then
9940             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9941             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9942         elif $PKG_CONFIG --exists python-$python_version; then
9943             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9944             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9945         else
9946             PYTHON_CFLAGS="-I$python_include"
9947             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9948         fi
9949         FilterLibs "${PYTHON_LIBS}"
9950         PYTHON_LIBS="${filteredlibs}"
9951     else
9952         dnl How to find out the cross-compilation Python installation path?
9953         AC_MSG_CHECKING([for python version])
9954         AS_IF([test -n "$PYTHON_VERSION"],
9955               [AC_MSG_RESULT([$PYTHON_VERSION])],
9956               [AC_MSG_RESULT([not found])
9957                AC_MSG_ERROR([no usable python found])])
9958         test -n "$PYTHON_CFLAGS" && break
9959     fi
9961     dnl Check if the headers really work
9962     save_CPPFLAGS="$CPPFLAGS"
9963     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9964     AC_CHECK_HEADER(Python.h)
9965     CPPFLAGS="$save_CPPFLAGS"
9967     # let the PYTHON_FOR_BUILD match the same python installation that
9968     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9969     # better for PythonTests.
9970     PYTHON_FOR_BUILD=$PYTHON
9973 if test "$with_lxml" != no; then
9974     if test -z "$PYTHON_FOR_BUILD"; then
9975         case $build_os in
9976             cygwin)
9977                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9978                 ;;
9979             *)
9980                 if test "$cross_compiling" != yes ; then
9981                     BUILD_TYPE="$BUILD_TYPE LXML"
9982                 fi
9983                 ;;
9984         esac
9985     else
9986         AC_MSG_CHECKING([for python lxml])
9987         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9988             AC_MSG_RESULT([yes])
9989         else
9990             case $build_os in
9991                 cygwin)
9992                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9993                     ;;
9994                 *)
9995                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9996                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9997                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9998                         else
9999                             BUILD_TYPE="$BUILD_TYPE LXML"
10000                             AC_MSG_RESULT([no, using internal lxml])
10001                         fi
10002                     else
10003                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
10004                     fi
10005                     ;;
10006             esac
10007         fi
10008     fi
10011 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
10012     SYSTEM_PYTHON=
10013     PYTHON_VERSION_MAJOR=3
10014     PYTHON_VERSION_MINOR=8
10015     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.18
10016     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
10017         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
10018     fi
10019     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
10021     # Embedded Python dies without Home set
10022     if test "$HOME" = ""; then
10023         export HOME=""
10024     fi
10027 dnl By now enable_python should be "system", "internal" or "no"
10028 case $enable_python in
10029 system)
10030     SYSTEM_PYTHON=TRUE
10032     if test "x$ac_cv_header_Python_h" != "xyes"; then
10033        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
10034     fi
10036     AC_LANG_PUSH(C)
10037     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
10038     AC_MSG_CHECKING([for correct python library version])
10039        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10040 #include <Python.h>
10042 int main(int argc, char **argv) {
10043    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
10044    else return 1;
10046        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
10047     AC_LANG_POP(C)
10049     dnl FIXME Check if the Python library can be linked with, too?
10050     ;;
10052 internal)
10053     BUILD_TYPE="$BUILD_TYPE PYTHON"
10054     if test "$OS" = LINUX -o "$OS" = WNT ; then
10055         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10056     fi
10057     ;;
10059     DISABLE_PYTHON=TRUE
10060     SYSTEM_PYTHON=
10061     ;;
10063     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10064     ;;
10065 esac
10067 AC_SUBST(DISABLE_PYTHON)
10068 AC_SUBST(SYSTEM_PYTHON)
10069 AC_SUBST(PYTHON_CFLAGS)
10070 AC_SUBST(PYTHON_FOR_BUILD)
10071 AC_SUBST(PYTHON_LIBS)
10072 AC_SUBST(PYTHON_VERSION)
10073 AC_SUBST(PYTHON_VERSION_MAJOR)
10074 AC_SUBST(PYTHON_VERSION_MINOR)
10076 AC_MSG_CHECKING([whether to build LibreLogo])
10077 case "$enable_python" in
10078 no|disable)
10079     AC_MSG_RESULT([no; Python disabled])
10080     ;;
10082     if test "${enable_librelogo}" = "no"; then
10083         AC_MSG_RESULT([no])
10084     else
10085         AC_MSG_RESULT([yes])
10086         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10087         AC_DEFINE([ENABLE_LIBRELOGO],1)
10088     fi
10089     ;;
10090 esac
10091 AC_SUBST(ENABLE_LIBRELOGO)
10093 ENABLE_MARIADBC=
10094 MARIADBC_MAJOR=1
10095 MARIADBC_MINOR=0
10096 MARIADBC_MICRO=2
10097 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10098 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10099     ENABLE_MARIADBC=TRUE
10100     AC_MSG_RESULT([yes])
10101     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10102 else
10103     AC_MSG_RESULT([no])
10105 AC_SUBST(ENABLE_MARIADBC)
10106 AC_SUBST(MARIADBC_MAJOR)
10107 AC_SUBST(MARIADBC_MINOR)
10108 AC_SUBST(MARIADBC_MICRO)
10110 if test "$ENABLE_MARIADBC" = "TRUE"; then
10111     dnl ===================================================================
10112     dnl Check for system MariaDB
10113     dnl ===================================================================
10114     AC_MSG_CHECKING([which MariaDB to use])
10115     if test "$with_system_mariadb" = "yes"; then
10116         AC_MSG_RESULT([external])
10117         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10118         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10119         if test -z "$MARIADBCONFIG"; then
10120             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10121             if test -z "$MARIADBCONFIG"; then
10122                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10123                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10124             fi
10125         fi
10126         AC_MSG_CHECKING([MariaDB version])
10127         MARIADB_VERSION=`$MARIADBCONFIG --version`
10128         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10129         if test "$MARIADB_MAJOR" -ge "5"; then
10130             AC_MSG_RESULT([OK])
10131         else
10132             AC_MSG_ERROR([too old, use 5.0.x or later])
10133         fi
10134         AC_MSG_CHECKING([for MariaDB Client library])
10135         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10136         if test "$COM_IS_CLANG" = TRUE; then
10137             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10138         fi
10139         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10140         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10141         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10142         dnl linux32:
10143         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10144             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10145             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10146                 | sed -e 's|/lib64/|/lib/|')
10147         fi
10148         FilterLibs "${MARIADB_LIBS}"
10149         MARIADB_LIBS="${filteredlibs}"
10150         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10151         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10152         if test "$enable_bundle_mariadb" = "yes"; then
10153             AC_MSG_RESULT([yes])
10154             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10155             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10157 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10159 /g' | grep -E '(mysqlclient|mariadb)')
10160             if test "$_os" = "Darwin"; then
10161                 LIBMARIADB=${LIBMARIADB}.dylib
10162             elif test "$_os" = "WINNT"; then
10163                 LIBMARIADB=${LIBMARIADB}.dll
10164             else
10165                 LIBMARIADB=${LIBMARIADB}.so
10166             fi
10167             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10168             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10169             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10170                 AC_MSG_RESULT([found.])
10171                 PathFormat "$LIBMARIADB_PATH"
10172                 LIBMARIADB_PATH="$formatted_path"
10173             else
10174                 AC_MSG_ERROR([not found.])
10175             fi
10176         else
10177             AC_MSG_RESULT([no])
10178             BUNDLE_MARIADB_CONNECTOR_C=
10179         fi
10180     else
10181         AC_MSG_RESULT([internal])
10182         SYSTEM_MARIADB_CONNECTOR_C=
10183         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10184         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10185         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10186     fi
10188     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10189     AC_SUBST(MARIADB_CFLAGS)
10190     AC_SUBST(MARIADB_LIBS)
10191     AC_SUBST(LIBMARIADB)
10192     AC_SUBST(LIBMARIADB_PATH)
10193     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10196 dnl ===================================================================
10197 dnl Check for system hsqldb
10198 dnl ===================================================================
10199 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10200     AC_MSG_CHECKING([which hsqldb to use])
10201     if test "$with_system_hsqldb" = "yes"; then
10202         AC_MSG_RESULT([external])
10203         SYSTEM_HSQLDB=TRUE
10204         if test -z $HSQLDB_JAR; then
10205             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10206         fi
10207         if ! test -f $HSQLDB_JAR; then
10208                AC_MSG_ERROR(hsqldb.jar not found.)
10209         fi
10210         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10211         export HSQLDB_JAR
10212         if $PERL -e \
10213            'use Archive::Zip;
10214             my $file = "$ENV{'HSQLDB_JAR'}";
10215             my $zip = Archive::Zip->new( $file );
10216             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10217             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10218             {
10219                 push @l, split(/\n/, $mf);
10220                 foreach my $line (@l)
10221                 {
10222                     if ($line =~ m/Specification-Version:/)
10223                     {
10224                         ($t, $version) = split (/:/,$line);
10225                         $version =~ s/^\s//;
10226                         ($a, $b, $c, $d) = split (/\./,$version);
10227                         if ($c == "0" && $d > "8")
10228                         {
10229                             exit 0;
10230                         }
10231                         else
10232                         {
10233                             exit 1;
10234                         }
10235                     }
10236                 }
10237             }
10238             else
10239             {
10240                 exit 1;
10241             }'; then
10242             AC_MSG_RESULT([yes])
10243         else
10244             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10245         fi
10246     else
10247         AC_MSG_RESULT([internal])
10248         SYSTEM_HSQLDB=
10249         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10250         NEED_ANT=TRUE
10251     fi
10252 else
10253     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10254         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10255     fi
10257 AC_SUBST(SYSTEM_HSQLDB)
10258 AC_SUBST(HSQLDB_JAR)
10260 dnl ===================================================================
10261 dnl Check for PostgreSQL stuff
10262 dnl ===================================================================
10263 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10264 if test "x$enable_postgresql_sdbc" != "xno"; then
10265     AC_MSG_RESULT([yes])
10266     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10268     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10269         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10270     fi
10271     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10272         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10273     fi
10275     postgres_interface=""
10276     if test "$with_system_postgresql" = "yes"; then
10277         postgres_interface="external PostgreSQL"
10278         SYSTEM_POSTGRESQL=TRUE
10279         if test "$_os" = Darwin; then
10280             supp_path=''
10281             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10282                 pg_supp_path="$P_SEP$d$pg_supp_path"
10283             done
10284         fi
10285         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10286         if test -n "$PGCONFIG"; then
10287             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10288             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10289         else
10290             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10291               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10292               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10293             ],[
10294               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10295             ])
10296         fi
10297         FilterLibs "${POSTGRESQL_LIB}"
10298         POSTGRESQL_LIB="${filteredlibs}"
10299     else
10300         # if/when anything else than PostgreSQL uses Kerberos,
10301         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10302         WITH_KRB5=
10303         WITH_GSSAPI=
10304         case "$_os" in
10305         Darwin)
10306             # macOS has system MIT Kerberos 5 since 10.4
10307             if test "$with_krb5" != "no"; then
10308                 WITH_KRB5=TRUE
10309                 save_LIBS=$LIBS
10310                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10311                 # that the libraries where these functions are located on macOS will change, is it?
10312                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10313                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10314                 KRB5_LIBS=$LIBS
10315                 LIBS=$save_LIBS
10316                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10317                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10318                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10319                 LIBS=$save_LIBS
10320             fi
10321             if test "$with_gssapi" != "no"; then
10322                 WITH_GSSAPI=TRUE
10323                 save_LIBS=$LIBS
10324                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10325                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10326                 GSSAPI_LIBS=$LIBS
10327                 LIBS=$save_LIBS
10328             fi
10329             ;;
10330         WINNT)
10331             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10332                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10333             fi
10334             ;;
10335         Linux|GNU|*BSD|DragonFly)
10336             if test "$with_krb5" != "no"; then
10337                 WITH_KRB5=TRUE
10338                 save_LIBS=$LIBS
10339                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10340                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10341                 KRB5_LIBS=$LIBS
10342                 LIBS=$save_LIBS
10343                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10344                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10345                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10346                 LIBS=$save_LIBS
10347             fi
10348             if test "$with_gssapi" != "no"; then
10349                 WITH_GSSAPI=TRUE
10350                 save_LIBS=$LIBS
10351                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10352                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10353                 GSSAPI_LIBS=$LIBS
10354                 LIBS=$save_LIBS
10355             fi
10356             ;;
10357         *)
10358             if test "$with_krb5" = "yes"; then
10359                 WITH_KRB5=TRUE
10360                 save_LIBS=$LIBS
10361                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10362                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10363                 KRB5_LIBS=$LIBS
10364                 LIBS=$save_LIBS
10365                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10366                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10367                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10368                 LIBS=$save_LIBS
10369             fi
10370             if test "$with_gssapi" = "yes"; then
10371                 WITH_GSSAPI=TRUE
10372                 save_LIBS=$LIBS
10373                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10374                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10375                 LIBS=$save_LIBS
10376                 GSSAPI_LIBS=$LIBS
10377             fi
10378         esac
10380         if test -n "$with_libpq_path"; then
10381             SYSTEM_POSTGRESQL=TRUE
10382             postgres_interface="external libpq"
10383             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10384             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10385         else
10386             SYSTEM_POSTGRESQL=
10387             postgres_interface="internal"
10388             POSTGRESQL_LIB=""
10389             POSTGRESQL_INC="%OVERRIDE_ME%"
10390             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10391         fi
10392     fi
10394     AC_MSG_CHECKING([PostgreSQL C interface])
10395     AC_MSG_RESULT([$postgres_interface])
10397     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10398         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10399         save_CFLAGS=$CFLAGS
10400         save_CPPFLAGS=$CPPFLAGS
10401         save_LIBS=$LIBS
10402         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10403         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10404         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10405         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10406             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10407         CFLAGS=$save_CFLAGS
10408         CPPFLAGS=$save_CPPFLAGS
10409         LIBS=$save_LIBS
10410     fi
10411     BUILD_POSTGRESQL_SDBC=TRUE
10412 else
10413     AC_MSG_RESULT([no])
10415 AC_SUBST(WITH_KRB5)
10416 AC_SUBST(WITH_GSSAPI)
10417 AC_SUBST(GSSAPI_LIBS)
10418 AC_SUBST(KRB5_LIBS)
10419 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10420 AC_SUBST(SYSTEM_POSTGRESQL)
10421 AC_SUBST(POSTGRESQL_INC)
10422 AC_SUBST(POSTGRESQL_LIB)
10424 dnl ===================================================================
10425 dnl Check for Firebird stuff
10426 dnl ===================================================================
10427 ENABLE_FIREBIRD_SDBC=
10428 if test "$enable_firebird_sdbc" = "yes" ; then
10429     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10431     dnl ===================================================================
10432     dnl Check for system Firebird
10433     dnl ===================================================================
10434     AC_MSG_CHECKING([which Firebird to use])
10435     if test "$with_system_firebird" = "yes"; then
10436         AC_MSG_RESULT([external])
10437         SYSTEM_FIREBIRD=TRUE
10438         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10439         if test -z "$FIREBIRDCONFIG"; then
10440             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10441             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10442                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10443             ])
10444             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10445         else
10446             AC_MSG_NOTICE([fb_config found])
10447             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10448             AC_MSG_CHECKING([for Firebird Client library])
10449             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10450             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10451             FilterLibs "${FIREBIRD_LIBS}"
10452             FIREBIRD_LIBS="${filteredlibs}"
10453         fi
10454         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10455         AC_MSG_CHECKING([Firebird version])
10456         if test -n "${FIREBIRD_VERSION}"; then
10457             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10458             if test "$FIREBIRD_MAJOR" -ge "3"; then
10459                 AC_MSG_RESULT([OK])
10460             else
10461                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10462             fi
10463         else
10464             save_CFLAGS="${CFLAGS}"
10465             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10466             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10467 #if defined(FB_API_VER) && FB_API_VER == 30
10468 int fb_api_is_30(void) { return 0; }
10469 #else
10470 #error "Wrong Firebird API version"
10471 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10472             CFLAGS="$save_CFLAGS"
10473         fi
10474         ENABLE_FIREBIRD_SDBC=TRUE
10475         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10476     elif test "$enable_database_connectivity" = no; then
10477         AC_MSG_RESULT([none])
10478     elif test "$cross_compiling" = "yes"; then
10479         AC_MSG_RESULT([none])
10480     else
10481         dnl Embedded Firebird has version 3.0
10482         dnl We need libatomic_ops for any non X86/X64 system
10483         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10484             dnl ===================================================================
10485             dnl Check for system libatomic_ops
10486             dnl ===================================================================
10487             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10488             if test "$with_system_libatomic_ops" = "yes"; then
10489                 SYSTEM_LIBATOMIC_OPS=TRUE
10490                 AC_CHECK_HEADERS(atomic_ops.h, [],
10491                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10492             else
10493                 SYSTEM_LIBATOMIC_OPS=
10494                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10495                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10496                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10497             fi
10498         fi
10500         AC_MSG_RESULT([internal])
10501         SYSTEM_FIREBIRD=
10502         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10503         FIREBIRD_LIBS="-lfbclient"
10505         if test "$with_system_libtommath" = "yes"; then
10506             SYSTEM_LIBTOMMATH=TRUE
10507             dnl check for tommath presence
10508             save_LIBS=$LIBS
10509             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10510             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10511             LIBS=$save_LIBS
10512         else
10513             SYSTEM_LIBTOMMATH=
10514             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10515             LIBTOMMATH_LIBS="-ltommath"
10516             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10517         fi
10519         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10520         ENABLE_FIREBIRD_SDBC=TRUE
10521         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10522     fi
10524 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10525 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10526 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10527 AC_SUBST(LIBATOMIC_OPS_LIBS)
10528 AC_SUBST(SYSTEM_FIREBIRD)
10529 AC_SUBST(FIREBIRD_CFLAGS)
10530 AC_SUBST(FIREBIRD_LIBS)
10531 AC_SUBST(SYSTEM_LIBTOMMATH)
10532 AC_SUBST(LIBTOMMATH_CFLAGS)
10533 AC_SUBST(LIBTOMMATH_LIBS)
10535 dnl ===================================================================
10536 dnl Check for system curl
10537 dnl ===================================================================
10538 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10540 dnl ===================================================================
10541 dnl Check for system boost
10542 dnl ===================================================================
10543 AC_MSG_CHECKING([which boost to use])
10544 if test "$with_system_boost" = "yes"; then
10545     AC_MSG_RESULT([external])
10546     SYSTEM_BOOST=TRUE
10547     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10548     AX_BOOST_DATE_TIME
10549     AX_BOOST_FILESYSTEM
10550     AX_BOOST_IOSTREAMS
10551     AX_BOOST_LOCALE
10552     AC_LANG_PUSH([C++])
10553     save_CXXFLAGS=$CXXFLAGS
10554     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10555     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10556        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10557     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10558        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10559     CXXFLAGS=$save_CXXFLAGS
10560     AC_LANG_POP([C++])
10561     # this is in m4/ax_boost_base.m4
10562     FilterLibs "${BOOST_LDFLAGS}"
10563     BOOST_LDFLAGS="${filteredlibs}"
10564 else
10565     AC_MSG_RESULT([internal])
10566     BUILD_TYPE="$BUILD_TYPE BOOST"
10567     SYSTEM_BOOST=
10568     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10569         # use warning-suppressing wrapper headers
10570         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10571     else
10572         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10573     fi
10575 AC_SUBST(SYSTEM_BOOST)
10577 dnl ===================================================================
10578 dnl Check for system mdds
10579 dnl ===================================================================
10580 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10581 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.1 >= 2.1.0])
10583 dnl ===================================================================
10584 dnl Check for system dragonbox
10585 dnl ===================================================================
10586 AC_MSG_CHECKING([which dragonbox to use])
10587 if test "$with_system_dragonbox" = "yes"; then
10588     AC_MSG_RESULT([external])
10589     SYSTEM_DRAGONBOX=TRUE
10590     AC_LANG_PUSH([C++])
10591     save_CPPFLAGS=$CPPFLAGS
10592     # This is where upstream installs to, unfortunately no .pc or so...
10593     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.1.3
10594     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10595     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10596        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10597     AC_LANG_POP([C++])
10598     CPPFLAGS=$save_CPPFLAGS
10599 else
10600     AC_MSG_RESULT([internal])
10601     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10602     SYSTEM_DRAGONBOX=
10604 AC_SUBST([SYSTEM_DRAGONBOX])
10605 AC_SUBST([DRAGONBOX_CFLAGS])
10607 dnl ===================================================================
10608 dnl Check for system frozen
10609 dnl ===================================================================
10610 AC_MSG_CHECKING([which frozen to use])
10611 if test "$with_system_frozen" = "yes"; then
10612     AC_MSG_RESULT([external])
10613     SYSTEM_FROZEN=TRUE
10614     AC_LANG_PUSH([C++])
10615     save_CPPFLAGS=$CPPFLAGS
10616     AC_CHECK_HEADER([frozen/unordered_map.h], [],
10617        [AC_MSG_ERROR([frozen/unordered_map.h not found. install frozen headers])], [])
10618     AC_LANG_POP([C++])
10619     CPPFLAGS=$save_CPPFLAGS
10620 else
10621     AC_MSG_RESULT([internal])
10622     BUILD_TYPE="$BUILD_TYPE FROZEN"
10623     SYSTEM_FROZEN=
10625 AC_SUBST([SYSTEM_FROZEN])
10626 AC_SUBST([FROZEN_CFLAGS])
10628 dnl ===================================================================
10629 dnl Check for system libfixmath
10630 dnl ===================================================================
10631 AC_MSG_CHECKING([which libfixmath to use])
10632 if test "$with_system_libfixmath" = "yes"; then
10633     AC_MSG_RESULT([external])
10634     SYSTEM_LIBFIXMATH=TRUE
10635     AC_LANG_PUSH([C++])
10636     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10637        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10638     AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib not found or functional)], [])
10639     AC_LANG_POP([C++])
10640 else
10641     AC_MSG_RESULT([internal])
10642     SYSTEM_LIBFIXMATH=
10644 AC_SUBST([SYSTEM_LIBFIXMATH])
10646 dnl ===================================================================
10647 dnl Check for system glm
10648 dnl ===================================================================
10649 AC_MSG_CHECKING([which glm to use])
10650 if test "$with_system_glm" = "yes"; then
10651     AC_MSG_RESULT([external])
10652     SYSTEM_GLM=TRUE
10653     AC_LANG_PUSH([C++])
10654     AC_CHECK_HEADER([glm/glm.hpp], [],
10655        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10656     AC_LANG_POP([C++])
10657 else
10658     AC_MSG_RESULT([internal])
10659     BUILD_TYPE="$BUILD_TYPE GLM"
10660     SYSTEM_GLM=
10661     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10663 AC_SUBST([GLM_CFLAGS])
10664 AC_SUBST([SYSTEM_GLM])
10666 dnl ===================================================================
10667 dnl Check for system odbc
10668 dnl ===================================================================
10669 AC_MSG_CHECKING([which odbc headers to use])
10670 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
10671     AC_MSG_RESULT([external])
10672     SYSTEM_ODBC_HEADERS=TRUE
10674     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10675         save_CPPFLAGS=$CPPFLAGS
10676         find_winsdk
10677         PathFormat "$winsdktest"
10678         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"
10679         AC_CHECK_HEADER(sqlext.h, [],
10680             [AC_MSG_ERROR(odbc not found. install odbc)],
10681             [#include <windows.h>])
10682         CPPFLAGS=$save_CPPFLAGS
10683     else
10684         AC_CHECK_HEADER(sqlext.h, [],
10685             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10686     fi
10687 elif test "$enable_database_connectivity" = no; then
10688     AC_MSG_RESULT([none])
10689 else
10690     AC_MSG_RESULT([internal])
10691     SYSTEM_ODBC_HEADERS=
10693 AC_SUBST(SYSTEM_ODBC_HEADERS)
10695 dnl ===================================================================
10696 dnl Check for system NSS
10697 dnl ===================================================================
10698 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10699     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8],,system-if-linux)
10700     AC_DEFINE(HAVE_FEATURE_NSS)
10701     ENABLE_NSS=TRUE
10702 elif test $_os != iOS -a "$enable_openssl" != "no"; then
10703     with_tls=openssl
10705 AC_SUBST(ENABLE_NSS)
10707 dnl ===================================================================
10708 dnl Enable LDAP support
10709 dnl ===================================================================
10711 if test "$test_openldap" = yes; then
10712     AC_MSG_CHECKING([whether to enable LDAP support])
10713     if test "$enable_ldap" = yes -a \( "$enable_openssl" = yes -o "$with_system_openldap" = yes \); then
10714         AC_MSG_RESULT([yes])
10715         ENABLE_LDAP=TRUE
10716     else
10717         if test "$enable_ldap" != "yes"; then
10718             AC_MSG_RESULT([no])
10719         else
10720             AC_MSG_RESULT([no (needs OPENSSL or system openldap)])
10721         fi
10722     fi
10724 dnl ===================================================================
10725 dnl Check for system openldap
10726 dnl ===================================================================
10728     if test "$ENABLE_LDAP" = TRUE; then
10729         AC_MSG_CHECKING([which openldap library to use])
10730         if test "$with_system_openldap" = yes; then
10731             AC_MSG_RESULT([external])
10732             SYSTEM_OPENLDAP=TRUE
10733             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10734             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10735             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10736         else
10737             AC_MSG_RESULT([internal])
10738             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10739         fi
10740     fi
10743 AC_SUBST(ENABLE_LDAP)
10744 AC_SUBST(SYSTEM_OPENLDAP)
10746 dnl ===================================================================
10747 dnl Check for TLS/SSL and cryptographic implementation to use
10748 dnl ===================================================================
10749 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10750 if test -n "$with_tls"; then
10751     case $with_tls in
10752     openssl)
10753         AC_DEFINE(USE_TLS_OPENSSL)
10754         TLS=OPENSSL
10755         AC_MSG_RESULT([$TLS])
10757         if test "$enable_openssl" != "yes"; then
10758             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10759         fi
10761         # warn that OpenSSL has been selected but not all TLS code has this option
10762         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10763         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10764         ;;
10765     nss)
10766         AC_DEFINE(USE_TLS_NSS)
10767         TLS=NSS
10768         AC_MSG_RESULT([$TLS])
10769         ;;
10770     no)
10771         AC_MSG_RESULT([none])
10772         AC_MSG_WARN([Skipping TLS/SSL])
10773         ;;
10774     *)
10775         AC_MSG_RESULT([])
10776         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10777 openssl - OpenSSL
10778 nss - Mozilla's Network Security Services (NSS)
10779     ])
10780         ;;
10781     esac
10782 else
10783     # default to using NSS, it results in smaller oox lib
10784     AC_DEFINE(USE_TLS_NSS)
10785     TLS=NSS
10786     AC_MSG_RESULT([$TLS])
10788 AC_SUBST(TLS)
10790 dnl ===================================================================
10791 dnl Check for system sane
10792 dnl ===================================================================
10793 AC_MSG_CHECKING([which sane header to use])
10794 if test "$with_system_sane" = "yes"; then
10795     AC_MSG_RESULT([external])
10796     AC_CHECK_HEADER(sane/sane.h, [],
10797       [AC_MSG_ERROR(sane not found. install sane)], [])
10798 else
10799     AC_MSG_RESULT([internal])
10800     BUILD_TYPE="$BUILD_TYPE SANE"
10803 dnl ===================================================================
10804 dnl Check for system icu
10805 dnl ===================================================================
10806 ICU_MAJOR=73
10807 ICU_MINOR=2
10808 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10809 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10810 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 66])
10811 if test "$SYSTEM_ICU" = TRUE; then
10812     AC_LANG_PUSH([C++])
10813     AC_MSG_CHECKING([for unicode/rbbi.h])
10814     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10815     AC_LANG_POP([C++])
10817     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10818     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10819     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10821     if test "$CROSS_COMPILING" != TRUE; then
10822         # using the system icu tools can lead to version confusion, use the
10823         # ones from the build environment when cross-compiling
10824         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10825         if test -z "$SYSTEM_GENBRK"; then
10826             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10827         fi
10828         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10829         if test -z "$SYSTEM_GENCCODE"; then
10830             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10831         fi
10832         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10833         if test -z "$SYSTEM_GENCMN"; then
10834             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10835         fi
10836     fi
10839 AC_SUBST(SYSTEM_GENBRK)
10840 AC_SUBST(SYSTEM_GENCCODE)
10841 AC_SUBST(SYSTEM_GENCMN)
10842 AC_SUBST(ICU_MAJOR)
10843 AC_SUBST(ICU_MINOR)
10845 dnl ==================================================================
10846 dnl CURL
10847 dnl ==================================================================
10848 if test "$enable_curl" == "yes"; then
10849     AC_DEFINE([HAVE_FEATURE_CURL])
10852 dnl ==================================================================
10853 dnl Breakpad
10854 dnl ==================================================================
10855 DEFAULT_CRASHDUMP_VALUE="true"
10856 AC_MSG_CHECKING([whether to enable breakpad])
10857 if test "$enable_breakpad" != yes; then
10858     AC_MSG_RESULT([no])
10859 else
10860     if test "$enable_curl" != "yes"; then
10861         AC_MSG_ERROR([--disable-breakpad must be used when --disable-curl is used])
10862     fi
10863     AC_MSG_RESULT([yes])
10864     ENABLE_BREAKPAD="TRUE"
10865     AC_DEFINE(ENABLE_BREAKPAD)
10866     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10867     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10869     AC_MSG_CHECKING([for disable crash dump])
10870     if test "$enable_crashdump" = no; then
10871         DEFAULT_CRASHDUMP_VALUE="false"
10872         AC_MSG_RESULT([yes])
10873     else
10874        AC_MSG_RESULT([no])
10875     fi
10877     AC_MSG_CHECKING([for crashreport config])
10878     if test "$with_symbol_config" = "no"; then
10879         BREAKPAD_SYMBOL_CONFIG="invalid"
10880         AC_MSG_RESULT([no])
10881     else
10882         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10883         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10884         AC_MSG_RESULT([yes])
10885     fi
10886     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10888 AC_SUBST(ENABLE_BREAKPAD)
10889 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10891 dnl ==================================================================
10892 dnl libcmis
10893 dnl ==================================================================
10894 if test "$enable_libcmis" == "yes"; then
10895     if test "$enable_curl" != "yes"; then
10896         AC_MSG_ERROR([--disable-libcmis must be used when --disable-curl is used])
10897     fi
10900 dnl ===================================================================
10901 dnl Orcus
10902 dnl ===================================================================
10903 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.18 >= 0.19.1])
10904 if test "$with_system_orcus" != "yes"; then
10905     if test "$SYSTEM_BOOST" = "TRUE"; then
10906         dnl Link with Boost.System
10907         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10908         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10909         dnl in documentation has no effect.
10910         AX_BOOST_SYSTEM
10911     fi
10913 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10914 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10915 AC_SUBST([BOOST_SYSTEM_LIB])
10916 AC_SUBST(SYSTEM_LIBORCUS)
10918 dnl ===================================================================
10919 dnl HarfBuzz
10920 dnl ===================================================================
10921 harfbuzz_required_version=5.1.0
10923 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10924 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10925 case "$_os" in
10926     Linux)
10927         GRAPHITE_LIBS_internal="${WORKDIR}/LinkTarget/StaticLibrary/libgraphite.a"
10928         HARFBUZZ_LIBS_internal="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.a"
10929         ;;
10930     *)
10931         GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10932         HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10933         ;;
10934 esac
10935 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10936 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= $harfbuzz_required_version])
10938 if test "$COM" = "MSC"; then # override the above
10939     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10940     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10943 if test "$with_system_harfbuzz" = "yes"; then
10944     if test "$with_system_graphite" = "no"; then
10945         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10946     fi
10947     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10948     save_LIBS="$LIBS"
10949     save_CFLAGS="$CFLAGS"
10950     LIBS="$LIBS $HARFBUZZ_LIBS"
10951     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10952     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10953     LIBS="$save_LIBS"
10954     CFLAGS="$save_CFLAGS"
10955 else
10956     if test "$with_system_graphite" = "yes"; then
10957         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10958     fi
10961 if test "$USING_X11" = TRUE; then
10962     AC_PATH_X
10963     AC_PATH_XTRA
10964     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10966     if test -z "$x_includes"; then
10967         x_includes="default_x_includes"
10968     fi
10969     if test -z "$x_libraries"; then
10970         x_libraries="default_x_libraries"
10971     fi
10972     CFLAGS="$CFLAGS $X_CFLAGS"
10973     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10974     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10975 else
10976     x_includes="no_x_includes"
10977     x_libraries="no_x_libraries"
10980 if test "$USING_X11" = TRUE; then
10981     dnl ===================================================================
10982     dnl Check for extension headers
10983     dnl ===================================================================
10984     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10985      [#include <X11/extensions/shape.h>])
10987     # vcl needs ICE and SM
10988     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10989     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10990         [AC_MSG_ERROR(ICE library not found)])
10991     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10992     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10993         [AC_MSG_ERROR(SM library not found)])
10996 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10997     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10998     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
11001 dnl ===================================================================
11002 dnl Check for system Xrender
11003 dnl ===================================================================
11004 AC_MSG_CHECKING([whether to use Xrender])
11005 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
11006     AC_MSG_RESULT([yes])
11007     PKG_CHECK_MODULES(XRENDER, xrender)
11008     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11009     FilterLibs "${XRENDER_LIBS}"
11010     XRENDER_LIBS="${filteredlibs}"
11011     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
11012       [AC_MSG_ERROR(libXrender not found or functional)], [])
11013     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
11014       [AC_MSG_ERROR(Xrender not found. install X)], [])
11015 else
11016     AC_MSG_RESULT([no])
11018 AC_SUBST(XRENDER_CFLAGS)
11019 AC_SUBST(XRENDER_LIBS)
11021 dnl ===================================================================
11022 dnl Check for XRandr
11023 dnl ===================================================================
11024 AC_MSG_CHECKING([whether to enable RandR support])
11025 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
11026     AC_MSG_RESULT([yes])
11027     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
11028     if test "$ENABLE_RANDR" != "TRUE"; then
11029         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
11030                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
11031         XRANDR_CFLAGS=" "
11032         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
11033           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
11034         XRANDR_LIBS="-lXrandr "
11035         ENABLE_RANDR="TRUE"
11036     fi
11037     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11038     FilterLibs "${XRANDR_LIBS}"
11039     XRANDR_LIBS="${filteredlibs}"
11040 else
11041     ENABLE_RANDR=""
11042     AC_MSG_RESULT([no])
11044 AC_SUBST(XRANDR_CFLAGS)
11045 AC_SUBST(XRANDR_LIBS)
11046 AC_SUBST(ENABLE_RANDR)
11048 if test -z "$with_webdav"; then
11049     with_webdav=$test_webdav
11052 AC_MSG_CHECKING([for WebDAV support])
11053 case "$with_webdav" in
11055     AC_MSG_RESULT([no])
11056     WITH_WEBDAV=""
11057     ;;
11059     AC_MSG_RESULT([yes])
11060     # curl is already mandatory (almost) and checked elsewhere
11061     if test "$enable_curl" = "no"; then
11062         AC_MSG_ERROR(["--without-webdav must be used when --disable-curl is used"])
11063     fi
11064     WITH_WEBDAV=TRUE
11065     ;;
11066 esac
11067 AC_SUBST(WITH_WEBDAV)
11069 dnl ===================================================================
11070 dnl Check for disabling cve_tests
11071 dnl ===================================================================
11072 AC_MSG_CHECKING([whether to execute CVE tests])
11073 # If not explicitly enabled or disabled, default
11074 if test -z "$enable_cve_tests"; then
11075     case "$OS" in
11076     WNT)
11077         # Default cves off for Windows with its wild and wonderful
11078         # variety of AV software kicking in and panicking
11079         enable_cve_tests=no
11080         ;;
11081     *)
11082         # otherwise yes
11083         enable_cve_tests=yes
11084         ;;
11085     esac
11087 if test "$enable_cve_tests" = "no"; then
11088     AC_MSG_RESULT([no])
11089     DISABLE_CVE_TESTS=TRUE
11090     AC_SUBST(DISABLE_CVE_TESTS)
11091 else
11092     AC_MSG_RESULT([yes])
11095 dnl ===================================================================
11096 dnl Check for system openssl
11097 dnl ===================================================================
11098 ENABLE_OPENSSL=
11099 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11100 if test "$enable_openssl" = "yes"; then
11101     AC_MSG_RESULT([no])
11102     ENABLE_OPENSSL=TRUE
11103     if test "$_os" = Darwin ; then
11104         # OpenSSL is deprecated when building for 10.7 or later.
11105         #
11106         # https://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11107         # https://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11109         with_system_openssl=no
11110         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11111     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11112             && test "$with_system_openssl" != "no"; then
11113         with_system_openssl=yes
11114         SYSTEM_OPENSSL=TRUE
11115         OPENSSL_CFLAGS=
11116         OPENSSL_LIBS="-lssl -lcrypto"
11117     else
11118         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11119         if test -n "${SYSTEM_OPENSSL}"; then
11120             AC_DEFINE([SYSTEM_OPENSSL])
11121         fi
11122     fi
11123     if test "$with_system_openssl" = "yes"; then
11124         AC_MSG_CHECKING([whether openssl supports SHA512])
11125         AC_LANG_PUSH([C])
11126         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11127             SHA512_CTX context;
11128 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11129         AC_LANG_POP(C)
11130     fi
11131 else
11132     AC_MSG_RESULT([yes])
11134     # warn that although OpenSSL is disabled, system libraries may depend on it
11135     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11136     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11139 AC_SUBST([ENABLE_OPENSSL])
11141 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11142     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11143         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11144         enable_cipher_openssl_backend=no
11145     else
11146         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11147     fi
11149 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11150 ENABLE_CIPHER_OPENSSL_BACKEND=
11151 if test "$enable_cipher_openssl_backend" = yes; then
11152     AC_MSG_RESULT([yes])
11153     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11154 else
11155     AC_MSG_RESULT([no])
11157 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11159 dnl ===================================================================
11160 dnl Select the crypto backends used by LO
11161 dnl ===================================================================
11163 if test "$build_crypto" = yes; then
11164     if test "$OS" = WNT; then
11165         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11166         AC_DEFINE([USE_CRYPTO_MSCAPI])
11167     elif test "$ENABLE_NSS" = TRUE; then
11168         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11169         AC_DEFINE([USE_CRYPTO_NSS])
11170     fi
11173 dnl ===================================================================
11174 dnl Check for system redland
11175 dnl ===================================================================
11176 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11177 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11178 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11179 if test "$with_system_redland" = "yes"; then
11180     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11181             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11182 else
11183     RAPTOR_MAJOR="0"
11184     RASQAL_MAJOR="3"
11185     REDLAND_MAJOR="0"
11187 AC_SUBST(RAPTOR_MAJOR)
11188 AC_SUBST(RASQAL_MAJOR)
11189 AC_SUBST(REDLAND_MAJOR)
11191 dnl ===================================================================
11192 dnl Check for system hunspell
11193 dnl ===================================================================
11194 AC_MSG_CHECKING([which libhunspell to use])
11195 if test "$with_system_hunspell" = "yes"; then
11196     AC_MSG_RESULT([external])
11197     SYSTEM_HUNSPELL=TRUE
11198     AC_LANG_PUSH([C++])
11199     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11200     if test "$HUNSPELL_PC" != "TRUE"; then
11201         AC_CHECK_HEADER(hunspell.hxx, [],
11202             [
11203             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11204             [AC_MSG_ERROR(hunspell headers not found.)], [])
11205             ], [])
11206         AC_CHECK_LIB([hunspell], [main], [:],
11207            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11208         HUNSPELL_LIBS=-lhunspell
11209     fi
11210     AC_LANG_POP([C++])
11211     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11212     FilterLibs "${HUNSPELL_LIBS}"
11213     HUNSPELL_LIBS="${filteredlibs}"
11214 else
11215     AC_MSG_RESULT([internal])
11216     SYSTEM_HUNSPELL=
11217     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11218     if test "$COM" = "MSC"; then
11219         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11220     else
11221         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11222     fi
11223     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11225 AC_SUBST(SYSTEM_HUNSPELL)
11226 AC_SUBST(HUNSPELL_CFLAGS)
11227 AC_SUBST(HUNSPELL_LIBS)
11229 dnl ===================================================================
11230 dnl Check for system zxcvbn
11231 dnl ===================================================================
11232 AC_MSG_CHECKING([which zxcvbn to use])
11233 if test "$with_system_zxcvbn" = "yes"; then
11234     AC_MSG_RESULT([external])
11235     SYSTEM_ZXCVBN=TRUE
11236     AC_CHECK_HEADER(zxcvbn.h, [],
11237        [ AC_MSG_ERROR(zxcvbn headers not found.)], [])
11238     AC_CHECK_LIB(zxcvbn, ZxcvbnMatch, [],
11239         [ AC_MSG_ERROR(zxcvbn library not found.)], [])
11240 else
11241    AC_MSG_RESULT([internal])
11242    BUILD_TYPE="$BUILD_TYPE ZXCVBN"
11243    SYSTEM_ZXCVBN=
11245 AC_SUBST(SYSTEM_ZXCVBN)
11247 dnl ===================================================================
11248 dnl Check for system zxing
11249 dnl ===================================================================
11250 AC_MSG_CHECKING([whether to use zxing])
11251 if test "$enable_zxing" = "no"; then
11252     AC_MSG_RESULT([no])
11253     ENABLE_ZXING=
11254     SYSTEM_ZXING=
11255 else
11256     AC_MSG_RESULT([yes])
11257     ENABLE_ZXING=TRUE
11258     AC_MSG_CHECKING([which libzxing to use])
11259     if test "$with_system_zxing" = "yes"; then
11260         AC_MSG_RESULT([external])
11261         SYSTEM_ZXING=TRUE
11262         ZXING_CFLAGS=
11263         AC_LANG_PUSH([C++])
11264         save_CXXFLAGS=$CXXFLAGS
11265         save_IFS=$IFS
11266         IFS=$P_SEP
11267         for i in $CPLUS_INCLUDE_PATH /usr/include; do
11268             dnl Reset IFS as soon as possible, to avoid unexpected side effects (and the
11269             dnl "/usr/include" fallback makes sure we get here at least once; resetting rather than
11270             dnl unsetting follows the advice at <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;
11271             dnl a=commitdiff;h=e51c9919f2cf70185b7916ac040bc0bbfd0f743b> "Add recommendation on (not)
11272             dnl unsetting IFS."):
11273             IFS=$save_IFS
11274             dnl TODO: GCC and Clang treat empty paths in CPLUS_INCLUDE_PATH like ".", but we simply
11275             dnl ignore them here:
11276             if test -z "$i"; then
11277                 continue
11278             fi
11279             dnl TODO: White space in $i would cause problems:
11280             CXXFLAGS="$save_CXXFLAGS ${CXXFLAGS_CXX11} -I$i/ZXing"
11281             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break],
11282                 [unset ac_cv_header_MultiFormatWriter_h], [#include <stdexcept>])
11283         done
11284         CXXFLAGS=$save_CXXFLAGS
11285         if test -z "$ZXING_CFLAGS"; then
11286             AC_MSG_ERROR(zxing headers not found.)
11287         fi
11288         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11289             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11290             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11291         AC_LANG_POP([C++])
11292         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11293         FilterLibs "${ZXING_LIBS}"
11294         ZXING_LIBS="${filteredlibs}"
11295     else
11296         AC_MSG_RESULT([internal])
11297         SYSTEM_ZXING=
11298         BUILD_TYPE="$BUILD_TYPE ZXING"
11299         ZXING_CFLAGS="-I${WORKDIR}/UnpackedTarball/zxing/core/src"
11300     fi
11301     if test "$ENABLE_ZXING" = TRUE; then
11302         AC_DEFINE(ENABLE_ZXING)
11303     fi
11304     AC_MSG_CHECKING([whether zxing::tosvg function is available])
11305     AC_LANG_PUSH([C++])
11306     save_CXXFLAGS=$CXXFLAGS
11307     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 $ZXING_CFLAGS"
11308     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11309             #include <BitMatrix.h>
11310             #include <BitMatrixIO.h>
11311             int main(){
11312                 ZXing::BitMatrix matrix(1, 1);
11313                 matrix.set(0, 0, true);
11314                 ZXing::ToSVG(matrix);
11315                 return 0;
11316             }
11317         ])], [
11318             AC_DEFINE([HAVE_ZXING_TOSVG],[1])
11319             AC_MSG_RESULT([yes])
11320         ], [AC_MSG_RESULT([no])])
11321     CXXFLAGS=$save_CXXFLAGS
11322     AC_LANG_POP([C++])
11323     AC_SUBST(HAVE_ZXING_TOSVG)
11325 AC_SUBST(SYSTEM_ZXING)
11326 AC_SUBST(ENABLE_ZXING)
11327 AC_SUBST(ZXING_CFLAGS)
11328 AC_SUBST(ZXING_LIBS)
11330 dnl ===================================================================
11331 dnl Check for system box2d
11332 dnl ===================================================================
11333 AC_MSG_CHECKING([which box2d to use])
11334 if test "$with_system_box2d" = "yes"; then
11335     AC_MSG_RESULT([external])
11336     SYSTEM_BOX2D=TRUE
11337     AC_LANG_PUSH([C++])
11338     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11339         [BOX2D_H_FOUND='FALSE'])
11340     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11341         _BOX2D_LIB=box2d
11342         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11343     else
11344         # fail this. there's no other alternative to check when we are here.
11345         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11346             [AC_MSG_ERROR(box2d headers not found.)])
11347         _BOX2D_LIB=Box2D
11348         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11349     fi
11350     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11351         [ AC_MSG_ERROR(box2d library not found.) ], [])
11352     BOX2D_LIBS=-l$_BOX2D_LIB
11353     AC_LANG_POP([C++])
11354     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11355     FilterLibs "${BOX2D_LIBS}"
11356     BOX2D_LIBS="${filteredlibs}"
11357 else
11358     AC_MSG_RESULT([internal])
11359     SYSTEM_BOX2D=
11360     BUILD_TYPE="$BUILD_TYPE BOX2D"
11362 AC_SUBST(SYSTEM_BOX2D)
11363 AC_SUBST(BOX2D_CFLAGS)
11364 AC_SUBST(BOX2D_LIBS)
11366 dnl ===================================================================
11367 dnl Checking for altlinuxhyph
11368 dnl ===================================================================
11369 AC_MSG_CHECKING([which altlinuxhyph to use])
11370 if test "$with_system_altlinuxhyph" = "yes"; then
11371     AC_MSG_RESULT([external])
11372     SYSTEM_HYPH=TRUE
11373     AC_CHECK_HEADER(hyphen.h, [],
11374        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11375     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11376        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11377        [#include <hyphen.h>])
11378     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11379         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11380     if test -z "$HYPHEN_LIB"; then
11381         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11382            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11383     fi
11384     if test -z "$HYPHEN_LIB"; then
11385         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11386            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11387     fi
11388 else
11389     AC_MSG_RESULT([internal])
11390     SYSTEM_HYPH=
11391     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11392     if test "$COM" = "MSC"; then
11393         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11394     else
11395         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11396     fi
11398 AC_SUBST(SYSTEM_HYPH)
11399 AC_SUBST(HYPHEN_LIB)
11401 dnl ===================================================================
11402 dnl Checking for mythes
11403 dnl ===================================================================
11404 AC_MSG_CHECKING([which mythes to use])
11405 if test "$with_system_mythes" = "yes"; then
11406     AC_MSG_RESULT([external])
11407     SYSTEM_MYTHES=TRUE
11408     AC_LANG_PUSH([C++])
11409     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11410     if test "$MYTHES_PKGCONFIG" = "no"; then
11411         AC_CHECK_HEADER(mythes.hxx, [],
11412             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11413         AC_CHECK_LIB([mythes-1.2], [main], [:],
11414             [ MYTHES_FOUND=no], [])
11415     if test "$MYTHES_FOUND" = "no"; then
11416         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11417                 [ MYTHES_FOUND=no], [])
11418     fi
11419     if test "$MYTHES_FOUND" = "no"; then
11420         AC_MSG_ERROR([mythes library not found!.])
11421     fi
11422     fi
11423     AC_LANG_POP([C++])
11424     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11425     FilterLibs "${MYTHES_LIBS}"
11426     MYTHES_LIBS="${filteredlibs}"
11427 else
11428     AC_MSG_RESULT([internal])
11429     SYSTEM_MYTHES=
11430     BUILD_TYPE="$BUILD_TYPE MYTHES"
11431     if test "$COM" = "MSC"; then
11432         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11433     else
11434         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11435     fi
11437 AC_SUBST(SYSTEM_MYTHES)
11438 AC_SUBST(MYTHES_CFLAGS)
11439 AC_SUBST(MYTHES_LIBS)
11441 dnl ===================================================================
11442 dnl How should we build the linear programming solver ?
11443 dnl ===================================================================
11445 ENABLE_COINMP=
11446 AC_MSG_CHECKING([whether to build with CoinMP])
11447 if test "$enable_coinmp" != "no"; then
11448     ENABLE_COINMP=TRUE
11449     AC_MSG_RESULT([yes])
11450     if test "$with_system_coinmp" = "yes"; then
11451         SYSTEM_COINMP=TRUE
11452         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11453         FilterLibs "${COINMP_LIBS}"
11454         COINMP_LIBS="${filteredlibs}"
11455     else
11456         BUILD_TYPE="$BUILD_TYPE COINMP"
11457     fi
11458 else
11459     AC_MSG_RESULT([no])
11461 AC_SUBST(ENABLE_COINMP)
11462 AC_SUBST(SYSTEM_COINMP)
11463 AC_SUBST(COINMP_CFLAGS)
11464 AC_SUBST(COINMP_LIBS)
11466 ENABLE_LPSOLVE=
11467 AC_MSG_CHECKING([whether to build with lpsolve])
11468 if test "$enable_lpsolve" != "no"; then
11469     ENABLE_LPSOLVE=TRUE
11470     AC_MSG_RESULT([yes])
11471 else
11472     AC_MSG_RESULT([no])
11474 AC_SUBST(ENABLE_LPSOLVE)
11476 if test "$ENABLE_LPSOLVE" = TRUE; then
11477     AC_MSG_CHECKING([which lpsolve to use])
11478     if test "$with_system_lpsolve" = "yes"; then
11479         AC_MSG_RESULT([external])
11480         SYSTEM_LPSOLVE=TRUE
11481         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11482            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11483         save_LIBS=$LIBS
11484         # some systems need this. Like Ubuntu...
11485         AC_CHECK_LIB(m, floor)
11486         AC_CHECK_LIB(dl, dlopen)
11487         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11488             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11489         LIBS=$save_LIBS
11490     else
11491         AC_MSG_RESULT([internal])
11492         SYSTEM_LPSOLVE=
11493         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11494     fi
11496 AC_SUBST(SYSTEM_LPSOLVE)
11498 dnl ===================================================================
11499 dnl Checking for libexttextcat
11500 dnl ===================================================================
11501 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11502 if test "$with_system_libexttextcat" = "yes"; then
11503     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11505 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11507 dnl ===================================================================
11508 dnl Checking for libnumbertext
11509 dnl ===================================================================
11510 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11511 if test "$with_system_libnumbertext" = "yes"; then
11512     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11513     SYSTEM_LIBNUMBERTEXT=YES
11514 else
11515     SYSTEM_LIBNUMBERTEXT=
11517 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11518 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11520 dnl ***************************************
11521 dnl testing libc version for Linux...
11522 dnl ***************************************
11523 if test "$_os" = "Linux"; then
11524     AC_MSG_CHECKING([whether the libc is recent enough])
11525     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11526     #include <features.h>
11527     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11528     #error glibc >= 2.1 is required
11529     #endif
11530     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11533 dnl =========================================
11534 dnl Check for uuidgen
11535 dnl =========================================
11536 if test "$_os" = "WINNT"; then
11537     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11538     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11539     UUIDGEN=uuidgen.exe
11540     AC_SUBST(UUIDGEN)
11541 else
11542     AC_PATH_PROG([UUIDGEN], [uuidgen])
11543     if test -z "$UUIDGEN"; then
11544         AC_MSG_WARN([uuid is needed for building installation sets])
11545     fi
11548 dnl ***************************************
11549 dnl Checking for bison and flex
11550 dnl ***************************************
11551 AC_PATH_PROG(BISON, bison)
11552 if test -z "$BISON"; then
11553     AC_MSG_ERROR([no bison found in \$PATH, install it])
11554 else
11555     AC_MSG_CHECKING([the bison version])
11556     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11557     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11558     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11559     dnl cause
11560     dnl
11561     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]
11562     dnl   typedef union YYSTYPE
11563     dnl           ~~~~~~^~~~~~~
11564     dnl
11565     dnl while at least 3.4.1 is know to be good:
11566     if test "$COMPILER_PLUGINS" = TRUE; then
11567         if test "$_bison_longver" -lt 2004; then
11568             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11569         fi
11570     else
11571         if test "$_bison_longver" -lt 2000; then
11572             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11573         fi
11574     fi
11576 AC_SUBST([BISON])
11578 AC_PATH_PROG(FLEX, flex)
11579 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11580     FLEX=`cygpath -m $FLEX`
11582 if test -z "$FLEX"; then
11583     AC_MSG_ERROR([no flex found in \$PATH, install it])
11584 else
11585     AC_MSG_CHECKING([the flex version])
11586     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11587     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11588         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11589     fi
11591 AC_SUBST([FLEX])
11593 AC_PATH_PROG(DIFF, diff)
11594 if test -z "$DIFF"; then
11595     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11597 AC_SUBST([DIFF])
11599 AC_PATH_PROG(UNIQ, uniq)
11600 if test -z "$UNIQ"; then
11601     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11603 AC_SUBST([UNIQ])
11605 dnl ***************************************
11606 dnl Checking for patch
11607 dnl ***************************************
11608 AC_PATH_PROG(PATCH, patch)
11609 if test -z "$PATCH"; then
11610     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11613 dnl On Solaris or macOS, check if --with-gnu-patch was used
11614 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11615     if test -z "$with_gnu_patch"; then
11616         GNUPATCH=$PATCH
11617     else
11618         if test -x "$with_gnu_patch"; then
11619             GNUPATCH=$with_gnu_patch
11620         else
11621             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11622         fi
11623     fi
11625     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11626     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11627         AC_MSG_RESULT([yes])
11628     else
11629         if $GNUPATCH --version | grep "2\.0-.*-Apple" >/dev/null 2>/dev/null; then
11630             AC_MSG_RESULT([no, but accepted (Apple patch)])
11631             add_warning "patch utility is not GNU patch. Apple's patch should work OK, but it might experience issues where GNU patch doesn't."
11632         else
11633             AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11634         fi
11635     fi
11636 else
11637     GNUPATCH=$PATCH
11640 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11641     GNUPATCH=`cygpath -m $GNUPATCH`
11644 dnl We also need to check for --with-gnu-cp
11646 if test -z "$with_gnu_cp"; then
11647     # check the place where the good stuff is hidden on Solaris...
11648     if test -x /usr/gnu/bin/cp; then
11649         GNUCP=/usr/gnu/bin/cp
11650     else
11651         AC_PATH_PROGS(GNUCP, gnucp cp)
11652     fi
11653     if test -z $GNUCP; then
11654         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11655     fi
11656 else
11657     if test -x "$with_gnu_cp"; then
11658         GNUCP=$with_gnu_cp
11659     else
11660         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11661     fi
11664 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11665     GNUCP=`cygpath -m $GNUCP`
11668 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11669 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11670     AC_MSG_RESULT([yes])
11671 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11672     AC_MSG_RESULT([yes])
11673 else
11674     case "$build_os" in
11675     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*)
11676         x_GNUCP=[\#]
11677         GNUCP=''
11678         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11679         ;;
11680     *)
11681         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11682         ;;
11683     esac
11686 AC_SUBST(GNUPATCH)
11687 AC_SUBST(GNUCP)
11688 AC_SUBST(x_GNUCP)
11690 dnl ***************************************
11691 dnl testing assembler path
11692 dnl ***************************************
11693 ML_EXE=""
11694 if test "$_os" = "WINNT"; then
11695     case "$WIN_HOST_ARCH" in
11696     x86) assembler=ml.exe ;;
11697     x64) assembler=ml64.exe ;;
11698     arm64) assembler=armasm64.exe ;;
11699     esac
11701     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11702     if test -f "$MSVC_HOST_PATH/$assembler"; then
11703         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11704         AC_MSG_RESULT([$ML_EXE])
11705     else
11706         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11707     fi
11710 AC_SUBST(ML_EXE)
11712 dnl ===================================================================
11713 dnl We need zip and unzip
11714 dnl ===================================================================
11715 AC_PATH_PROG(ZIP, zip)
11716 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11717 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11718     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],,)
11721 AC_PATH_PROG(UNZIP, unzip)
11722 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11724 dnl ===================================================================
11725 dnl Zip must be a specific type for different build types.
11726 dnl ===================================================================
11727 if test $build_os = cygwin; then
11728     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11729         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11730     fi
11733 dnl ===================================================================
11734 dnl We need touch with -h option support.
11735 dnl ===================================================================
11736 AC_PATH_PROG(TOUCH, touch)
11737 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11738 touch "$WARNINGS_FILE"
11739 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11740     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],,)
11743 dnl ===================================================================
11744 dnl Check for system epoxy
11745 dnl ===================================================================
11746 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11747 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11749 dnl ===================================================================
11750 dnl Show which vclplugs will be built.
11751 dnl ===================================================================
11752 R=""
11754 libo_ENABLE_VCLPLUG([gen])
11755 libo_ENABLE_VCLPLUG([gtk3])
11756 libo_ENABLE_VCLPLUG([gtk3_kde5])
11757 libo_ENABLE_VCLPLUG([gtk4])
11758 libo_ENABLE_VCLPLUG([kf5])
11759 libo_ENABLE_VCLPLUG([kf6])
11760 libo_ENABLE_VCLPLUG([qt5])
11761 libo_ENABLE_VCLPLUG([qt6])
11763 if test "$_os" = "WINNT"; then
11764     R="$R win"
11765 elif test "$_os" = "Darwin"; then
11766     R="$R osx"
11767 elif test "$_os" = "iOS"; then
11768     R="ios"
11769 elif test "$_os" = Android; then
11770     R="android"
11773 build_vcl_plugins="$R"
11774 if test -z "$build_vcl_plugins"; then
11775     build_vcl_plugins=" none"
11777 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11778 VCL_PLUGIN_INFO=$R
11779 AC_SUBST([VCL_PLUGIN_INFO])
11781 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11782     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11785 dnl ===================================================================
11786 dnl Check for GTK libraries
11787 dnl ===================================================================
11789 GTK3_CFLAGS=""
11790 GTK3_LIBS=""
11791 ENABLE_GTKTILEDVIEWER=""
11792 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11793     if test "$with_system_cairo" = no; then
11794         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.'
11795     fi
11796     : ${with_system_cairo:=yes}
11797     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)
11798     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11799     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11800     FilterLibs "${GTK3_LIBS}"
11801     GTK3_LIBS="${filteredlibs}"
11803     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11804     if test "$with_system_epoxy" != "yes"; then
11805         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11806         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11807                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11808     fi
11809 elif test -n "$with_gtk3_build" -a "$OS" = "WNT"; then
11810     PathFormat "${with_gtk3_build}/lib/pkgconfig"
11811     if test "$build_os" = "cygwin"; then
11812         dnl cygwin's pkg-config does not recognize "C:/..."-style paths, only "/cygdrive/c/..."
11813         formatted_path_unix=`cygpath -au "$formatted_path_unix"`
11814     fi
11816     PKG_CONFIG_PATH="$formatted_path_unix"; export PKG_CONFIG_PATH
11817     PKG_CHECK_MODULES(GTK3, cairo gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0)
11818     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11819     FilterLibs "${GTK3_LIBS}"
11820     GTK3_LIBS="${filteredlibs}"
11821     ENABLE_GTKTILEDVIEWER="yes"
11823 AC_SUBST(GTK3_LIBS)
11824 AC_SUBST(GTK3_CFLAGS)
11825 AC_SUBST(ENABLE_GTKTILEDVIEWER)
11827 GTK4_CFLAGS=""
11828 GTK4_LIBS=""
11829 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11830     if test "$with_system_cairo" = no; then
11831         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11832     fi
11833     : ${with_system_cairo:=yes}
11834     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11835     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11836     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11837     FilterLibs "${GTK4_LIBS}"
11838     GTK4_LIBS="${filteredlibs}"
11840     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11841     if test "$with_system_epoxy" != "yes"; then
11842         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11843         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11844                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11845     fi
11847 AC_SUBST(GTK4_LIBS)
11848 AC_SUBST(GTK4_CFLAGS)
11850 if test "$enable_introspection" = yes; then
11851     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11852         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11853     else
11854         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11855     fi
11858 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
11859 if ! test "$ENABLE_GTK3" = TRUE; then
11860     if test "$enable_atspi_tests" = yes; then
11861         AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
11862     fi
11863     enable_atspi_tests=no
11865 if ! test "$enable_atspi_tests" = no; then
11866     AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
11867     if ! test "$XVFB_RUN" = no; then
11868         dnl make sure the found xvfb-run actually works
11869         AC_MSG_CHECKING([whether $XVFB_RUN works...])
11870         if $XVFB_RUN true >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
11871             AC_MSG_RESULT([yes])
11872         else
11873             AC_MSG_RESULT([no])
11874             XVFB_RUN=no
11875         fi
11876     fi
11877     if test "$XVFB_RUN" = no; then
11878         if test "$enable_atspi_tests" = yes; then
11879             AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
11880         fi
11881         enable_atspi_tests=no
11882     fi
11884 if ! test "$enable_atspi_tests" = no; then
11885     AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
11886     if test "$DBUS_LAUNCH" = no; then
11887         if test "$enable_atspi_tests" = yes; then
11888             AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not found])
11889         fi
11890         enable_atspi_tests=no
11891     fi
11893 if ! test "$enable_atspi_tests" = no; then
11894     PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
11895                       [if test "$enable_atspi_tests" = yes; then
11896                            AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
11897                        else
11898                            enable_atspi_tests=no
11899                        fi])
11901 if ! test "x$enable_atspi_tests" = xno; then
11902     PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
11903                       [have_atspi_scroll_to=1],
11904                       [have_atspi_scroll_to=0])
11905     AC_DEFINE_UNQUOTED([HAVE_ATSPI2_SCROLL_TO], [$have_atspi_scroll_to],
11906                        [Whether AT-SPI2 has the scrollTo API])
11908 ENABLE_ATSPI_TESTS=
11909 test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
11910 AC_SUBST([ENABLE_ATSPI_TESTS])
11912 dnl ===================================================================
11913 dnl check for dbus support
11914 dnl ===================================================================
11915 ENABLE_DBUS=""
11916 DBUS_CFLAGS=""
11917 DBUS_LIBS=""
11918 DBUS_GLIB_CFLAGS=""
11919 DBUS_GLIB_LIBS=""
11920 DBUS_HAVE_GLIB=""
11922 if test "$enable_dbus" = "no"; then
11923     test_dbus=no
11926 AC_MSG_CHECKING([whether to enable DBUS support])
11927 if test "$test_dbus" = "yes"; then
11928     ENABLE_DBUS="TRUE"
11929     AC_MSG_RESULT([yes])
11930     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11931     AC_DEFINE(ENABLE_DBUS)
11932     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11933     FilterLibs "${DBUS_LIBS}"
11934     DBUS_LIBS="${filteredlibs}"
11936     # Glib is needed for BluetoothServer
11937     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11938     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11939         [
11940             DBUS_HAVE_GLIB="TRUE"
11941             AC_DEFINE(DBUS_HAVE_GLIB,1)
11942         ],
11943         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11944     )
11945 else
11946     AC_MSG_RESULT([no])
11949 AC_SUBST(ENABLE_DBUS)
11950 AC_SUBST(DBUS_CFLAGS)
11951 AC_SUBST(DBUS_LIBS)
11952 AC_SUBST(DBUS_GLIB_CFLAGS)
11953 AC_SUBST(DBUS_GLIB_LIBS)
11954 AC_SUBST(DBUS_HAVE_GLIB)
11956 AC_MSG_CHECKING([whether to enable Impress remote control])
11957 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11958     AC_MSG_RESULT([yes])
11959     ENABLE_SDREMOTE=TRUE
11960     SDREMOTE_ENTITLEMENT="      <key>com.apple.security.network.server</key>
11961         <true/>"
11962     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11964     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11965         # The Bluetooth code doesn't compile with macOS SDK 10.15
11966         if test "$enable_sdremote_bluetooth" = yes; then
11967             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11968         fi
11969         add_warning "not building the bluetooth part of the sdremote - used api was removed from macOS SDK 10.15"
11970         enable_sdremote_bluetooth=no
11971     fi
11972     # If not explicitly enabled or disabled, default
11973     if test -z "$enable_sdremote_bluetooth"; then
11974         case "$OS" in
11975         LINUX|MACOSX|WNT)
11976             # Default to yes for these
11977             enable_sdremote_bluetooth=yes
11978             ;;
11979         *)
11980             # otherwise no
11981             enable_sdremote_bluetooth=no
11982             ;;
11983         esac
11984     fi
11985     # $enable_sdremote_bluetooth is guaranteed non-empty now
11987     if test "$enable_sdremote_bluetooth" != "no"; then
11988         if test "$OS" = "LINUX"; then
11989             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11990                 AC_MSG_RESULT([yes])
11991                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11992                 dnl ===================================================================
11993                 dnl Check for system bluez
11994                 dnl ===================================================================
11995                 AC_MSG_CHECKING([which Bluetooth header to use])
11996                 if test "$with_system_bluez" = "yes"; then
11997                     AC_MSG_RESULT([external])
11998                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11999                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
12000                     SYSTEM_BLUEZ=TRUE
12001                 else
12002                     AC_MSG_RESULT([internal])
12003                     SYSTEM_BLUEZ=
12004                 fi
12005             else
12006                 AC_MSG_RESULT([no, dbus disabled])
12007                 ENABLE_SDREMOTE_BLUETOOTH=
12008                 SYSTEM_BLUEZ=
12009             fi
12010         else
12011             AC_MSG_RESULT([yes])
12012             ENABLE_SDREMOTE_BLUETOOTH=TRUE
12013             SYSTEM_BLUEZ=
12014             SDREMOTE_ENTITLEMENT="$SDREMOTE_ENTITLEMENT
12015         <key>com.apple.security.device.bluetooth</key>
12016         <true/>"
12017         fi
12018     else
12019         AC_MSG_RESULT([no])
12020         ENABLE_SDREMOTE_BLUETOOTH=
12021         SYSTEM_BLUEZ=
12022     fi
12023 else
12024     ENABLE_SDREMOTE=
12025     SYSTEM_BLUEZ=
12026     AC_MSG_RESULT([no])
12028 AC_SUBST(ENABLE_SDREMOTE)
12029 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
12030 AC_SUBST(SDREMOTE_ENTITLEMENT)
12031 AC_SUBST(SYSTEM_BLUEZ)
12033 dnl ===================================================================
12034 dnl Check whether to enable GIO support
12035 dnl ===================================================================
12036 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
12037     AC_MSG_CHECKING([whether to enable GIO support])
12038     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
12039         dnl Need at least 2.26 for the dbus support.
12040         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
12041                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
12042         if test "$ENABLE_GIO" = "TRUE"; then
12043             AC_DEFINE(ENABLE_GIO)
12044             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12045             FilterLibs "${GIO_LIBS}"
12046             GIO_LIBS="${filteredlibs}"
12047         fi
12048     else
12049         AC_MSG_RESULT([no])
12050     fi
12052 AC_SUBST(ENABLE_GIO)
12053 AC_SUBST(GIO_CFLAGS)
12054 AC_SUBST(GIO_LIBS)
12057 dnl ===================================================================
12059 SPLIT_APP_MODULES=""
12060 if test "$enable_split_app_modules" = "yes"; then
12061     SPLIT_APP_MODULES="TRUE"
12063 AC_SUBST(SPLIT_APP_MODULES)
12065 SPLIT_OPT_FEATURES=""
12066 if test "$enable_split_opt_features" = "yes"; then
12067     SPLIT_OPT_FEATURES="TRUE"
12069 AC_SUBST(SPLIT_OPT_FEATURES)
12071 dnl ===================================================================
12072 dnl Check whether the GStreamer libraries are available.
12073 dnl ===================================================================
12075 ENABLE_GSTREAMER_1_0=""
12077 if test "$test_gstreamer_1_0" = yes; then
12079     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
12080     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
12081         ENABLE_GSTREAMER_1_0="TRUE"
12082         AC_MSG_RESULT([yes])
12083         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
12084         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12085         FilterLibs "${GSTREAMER_1_0_LIBS}"
12086         GSTREAMER_1_0_LIBS="${filteredlibs}"
12087         AC_DEFINE(ENABLE_GSTREAMER_1_0)
12088     else
12089         AC_MSG_RESULT([no])
12090     fi
12092 AC_SUBST(GSTREAMER_1_0_CFLAGS)
12093 AC_SUBST(GSTREAMER_1_0_LIBS)
12094 AC_SUBST(ENABLE_GSTREAMER_1_0)
12096 ENABLE_OPENGL_TRANSITIONS=
12097 ENABLE_OPENGL_CANVAS=
12098 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
12099    : # disable
12100 elif test "$_os" = "Darwin"; then
12101     # We use frameworks on macOS, no need for detail checks
12102     ENABLE_OPENGL_TRANSITIONS=TRUE
12103     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12104     ENABLE_OPENGL_CANVAS=TRUE
12105 elif test $_os = WINNT; then
12106     ENABLE_OPENGL_TRANSITIONS=TRUE
12107     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12108     ENABLE_OPENGL_CANVAS=TRUE
12109 else
12110     if test "$USING_X11" = TRUE; then
12111         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
12112         ENABLE_OPENGL_TRANSITIONS=TRUE
12113         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
12114         ENABLE_OPENGL_CANVAS=TRUE
12115     fi
12118 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
12119 AC_SUBST(ENABLE_OPENGL_CANVAS)
12121 dnl =================================================
12122 dnl Check whether to build with OpenCL support.
12123 dnl =================================================
12125 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
12126     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
12127     # platform (optional at run-time, used through clew).
12128     BUILD_TYPE="$BUILD_TYPE OPENCL"
12129     AC_DEFINE(HAVE_FEATURE_OPENCL)
12132 dnl =================================================
12133 dnl Check whether to build with dconf support.
12134 dnl =================================================
12136 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
12137     PKG_CHECK_MODULES([DCONF], [dconf >= 0.40.0], [], [
12138         if test "$enable_dconf" = yes; then
12139             AC_MSG_ERROR([dconf not found])
12140         else
12141             enable_dconf=no
12142         fi])
12144 AC_MSG_CHECKING([whether to enable dconf])
12145 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
12146     DCONF_CFLAGS=
12147     DCONF_LIBS=
12148     ENABLE_DCONF=
12149     AC_MSG_RESULT([no])
12150 else
12151     ENABLE_DCONF=TRUE
12152     AC_DEFINE(ENABLE_DCONF)
12153     AC_MSG_RESULT([yes])
12155 AC_SUBST([DCONF_CFLAGS])
12156 AC_SUBST([DCONF_LIBS])
12157 AC_SUBST([ENABLE_DCONF])
12159 # pdf import?
12160 AC_MSG_CHECKING([whether to build the PDF import feature])
12161 ENABLE_PDFIMPORT=
12162 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12163     AC_MSG_RESULT([yes])
12164     ENABLE_PDFIMPORT=TRUE
12165     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12166 else
12167     AC_MSG_RESULT([no])
12170 # Pdfium?
12171 AC_MSG_CHECKING([whether to build PDFium])
12172 ENABLE_PDFIUM=
12173 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12174     AC_MSG_RESULT([yes])
12175     ENABLE_PDFIUM=TRUE
12176     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12177 else
12178     AC_MSG_RESULT([no])
12180 AC_SUBST(ENABLE_PDFIUM)
12182 if test "$ENABLE_PDFIUM" = "TRUE"; then
12183     AC_MSG_CHECKING([which OpenJPEG library to use])
12184     if test "$with_system_openjpeg" = "yes"; then
12185         SYSTEM_OPENJPEG2=TRUE
12186         AC_MSG_RESULT([external])
12187         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12188         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12189         FilterLibs "${OPENJPEG2_LIBS}"
12190         OPENJPEG2_LIBS="${filteredlibs}"
12191     else
12192         SYSTEM_OPENJPEG2=FALSE
12193         AC_MSG_RESULT([internal])
12194     fi
12196     AC_MSG_CHECKING([which Abseil library to use])
12197     if test "$with_system_abseil" = "yes"; then
12198         AC_MSG_RESULT([external])
12199         SYSTEM_ABSEIL=TRUE
12200         AC_LANG_PUSH([C++])
12201         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
12202                         [AC_MSG_ERROR(abseil headers not found.)], [])
12203         AC_CHECK_HEADER(absl/types/bad_variant_access.h, [],
12204                         [AC_MSG_ERROR(abseil headers not found.)], [])
12205         AC_CHECK_LIB([absl_bad_optional_access], [main], [],
12206                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
12207         AC_CHECK_LIB([absl_bad_variant_access], [main], [],
12208                      [AC_MSG_ERROR([libabsl_bad_variant_access library not found.])])
12209         ABSEIL_LIBS="-labsl_bad_optional_access -labsl_bad_variant_access"
12210         AC_LANG_POP([C++])
12211         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12212         FilterLibs "${ABSEIL_LIBS}"
12213         ABSEIL_LIBS="${filteredlibs}"
12214     else
12215         AC_MSG_RESULT([internal])
12216     fi
12218 AC_SUBST(SYSTEM_OPENJPEG2)
12219 AC_SUBST(SYSTEM_ABSEIL)
12220 AC_SUBST(ABSEIL_CFLAGS)
12221 AC_SUBST(ABSEIL_LIBS)
12223 dnl ===================================================================
12224 dnl Check for poppler
12225 dnl ===================================================================
12226 ENABLE_POPPLER=
12227 AC_MSG_CHECKING([whether to build Poppler])
12228 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12229     AC_MSG_RESULT([yes])
12230     ENABLE_POPPLER=TRUE
12231     AC_DEFINE(HAVE_FEATURE_POPPLER)
12232 else
12233     AC_MSG_RESULT([no])
12235 AC_SUBST(ENABLE_POPPLER)
12237 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12238     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12241 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12242     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12245 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12246     dnl ===================================================================
12247     dnl Check for system poppler
12248     dnl ===================================================================
12249     AC_MSG_CHECKING([which PDF import poppler to use])
12250     if test "$with_system_poppler" = "yes"; then
12251         AC_MSG_RESULT([external])
12252         SYSTEM_POPPLER=TRUE
12253         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12254         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12255         FilterLibs "${POPPLER_LIBS}"
12256         POPPLER_LIBS="${filteredlibs}"
12257     else
12258         AC_MSG_RESULT([internal])
12259         SYSTEM_POPPLER=
12260         BUILD_TYPE="$BUILD_TYPE POPPLER"
12261     fi
12262     AC_DEFINE([ENABLE_PDFIMPORT],1)
12264 AC_SUBST(ENABLE_PDFIMPORT)
12265 AC_SUBST(SYSTEM_POPPLER)
12266 AC_SUBST(POPPLER_CFLAGS)
12267 AC_SUBST(POPPLER_LIBS)
12269 # Skia?
12270 ENABLE_SKIA=
12271 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12272     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12273     if test "$SYSTEM_FREETYPE" = TRUE; then
12274         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12275             [skia_freetype_ok=yes],
12276             [skia_freetype_ok=no])
12277     else # internal is ok
12278         skia_freetype_ok=yes
12279     fi
12280     AC_MSG_CHECKING([whether to build Skia])
12281     if test "$skia_freetype_ok" = "yes"; then
12282         if test "$enable_skia" = "debug"; then
12283             AC_MSG_RESULT([yes (debug)])
12284             ENABLE_SKIA_DEBUG=TRUE
12285         else
12286             AC_MSG_RESULT([yes])
12287             ENABLE_SKIA_DEBUG=
12288         fi
12289         ENABLE_SKIA=TRUE
12290         if test "$ENDIANNESS" = "big" && test "$ENABLE_SKIA" = "TRUE"; then
12291             AC_MSG_ERROR([skia doesn't work/isn't supported upstream on big-endian. Use --disable-skia])
12292         fi
12294         AC_DEFINE(HAVE_FEATURE_SKIA)
12295         BUILD_TYPE="$BUILD_TYPE SKIA"
12297         if test "$OS" = "MACOSX"; then
12298             AC_DEFINE(SK_GANESH,1)
12299             AC_DEFINE(SK_METAL,1)
12300             SKIA_GPU=METAL
12301             AC_SUBST(SKIA_GPU)
12302         else
12303             AC_DEFINE(SK_GANESH,1)
12304             AC_DEFINE(SK_VULKAN,1)
12305             SKIA_GPU=VULKAN
12306             AC_SUBST(SKIA_GPU)
12307         fi
12308     else
12309         AC_MSG_RESULT([no (freetype too old)])
12310         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12311     fi
12313 else
12314     AC_MSG_CHECKING([whether to build Skia])
12315     AC_MSG_RESULT([no])
12317 AC_SUBST(ENABLE_SKIA)
12318 AC_SUBST(ENABLE_SKIA_DEBUG)
12320 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12321 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12322 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12323 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12324 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12325 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12326 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12327 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12328 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12329 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12330 LO_CLANG_VERSION=
12331 HAVE_LO_CLANG_DLLEXPORTINLINES=
12333 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12334     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12335         AC_MSG_CHECKING([for Clang])
12336         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12337     else
12338         if test "$_os" = "WINNT"; then
12339             AC_MSG_CHECKING([for clang-cl])
12340             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12341                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12342             elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
12343                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12344             elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then
12345                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12346             fi
12347             if test -n "$LO_CLANG_CC"; then
12348                 dnl explicitly set -m32/-m64
12349                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12350                 LO_CLANG_CXX="$LO_CLANG_CC"
12351                 AC_MSG_RESULT([$LO_CLANG_CC])
12352             else
12353                 AC_MSG_RESULT([no])
12354             fi
12356             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12357             echo "#include <stdlib.h>" > conftest.c
12358             LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12359                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12360             rm -f conftest.c conftest.obj
12361             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12362                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12363             else
12364                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12365             fi
12366         else
12367             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12368             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12369         fi
12370     fi
12371     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12372         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12373         LO_CLANG_VERSION=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12374         if test "$LO_CLANG_VERSION" -lt 50002; then
12375             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12376             LO_CLANG_CC=
12377             LO_CLANG_CXX=
12378         fi
12379     fi
12380     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12381         save_CXX="$CXX"
12382         CXX="$LO_CLANG_CXX"
12383         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12384         AC_LANG_PUSH([C++])
12385         save_CXXFLAGS=$CXXFLAGS
12386         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12387         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12388                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12389                 AC_MSG_RESULT([yes])
12390             ], [AC_MSG_RESULT([no])])
12391         CXXFLAGS=$save_CXXFLAGS
12392         AC_LANG_POP([C++])
12393         CXX="$save_CXX"
12394         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12395             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.])
12396         fi
12397     fi
12398     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12399         # Skia is the default on Windows and Mac, so hard-require Clang.
12400         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12401         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12402             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12403         else
12404             AC_MSG_WARN([Clang compiler not found.])
12405         fi
12406     else
12408         save_CXX="$CXX"
12409         CXX="$LO_CLANG_CXX"
12410         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12411         flag_sse2=-msse2
12412         flag_ssse3=-mssse3
12413         flag_sse41=-msse4.1
12414         flag_sse42=-msse4.2
12415         flag_avx=-mavx
12416         flag_avx2=-mavx2
12417         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12418         flag_avx512f=-mavx512f
12419         flag_f16c=-mf16c
12420         flag_fma=-mfma
12422         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12423         AC_LANG_PUSH([C++])
12424         save_CXXFLAGS=$CXXFLAGS
12425         CXXFLAGS="$CXXFLAGS $flag_sse2"
12426         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12427             #include <emmintrin.h>
12428             int main () {
12429                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12430                 c = _mm_xor_si128 (a, b);
12431                 return 0;
12432             }
12433             ])],
12434             [can_compile_sse2=yes],
12435             [can_compile_sse2=no])
12436         AC_LANG_POP([C++])
12437         CXXFLAGS=$save_CXXFLAGS
12438         AC_MSG_RESULT([${can_compile_sse2}])
12439         if test "${can_compile_sse2}" = "yes" ; then
12440             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12441         fi
12443         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12444         AC_LANG_PUSH([C++])
12445         save_CXXFLAGS=$CXXFLAGS
12446         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12447         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12448             #include <tmmintrin.h>
12449             int main () {
12450                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12451                 c = _mm_maddubs_epi16 (a, b);
12452                 return 0;
12453             }
12454             ])],
12455             [can_compile_ssse3=yes],
12456             [can_compile_ssse3=no])
12457         AC_LANG_POP([C++])
12458         CXXFLAGS=$save_CXXFLAGS
12459         AC_MSG_RESULT([${can_compile_ssse3}])
12460         if test "${can_compile_ssse3}" = "yes" ; then
12461             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12462         fi
12464         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12465         AC_LANG_PUSH([C++])
12466         save_CXXFLAGS=$CXXFLAGS
12467         CXXFLAGS="$CXXFLAGS $flag_sse41"
12468         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12469             #include <smmintrin.h>
12470             int main () {
12471                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12472                 c = _mm_cmpeq_epi64 (a, b);
12473                 return 0;
12474             }
12475             ])],
12476             [can_compile_sse41=yes],
12477             [can_compile_sse41=no])
12478         AC_LANG_POP([C++])
12479         CXXFLAGS=$save_CXXFLAGS
12480         AC_MSG_RESULT([${can_compile_sse41}])
12481         if test "${can_compile_sse41}" = "yes" ; then
12482             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12483         fi
12485         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12486         AC_LANG_PUSH([C++])
12487         save_CXXFLAGS=$CXXFLAGS
12488         CXXFLAGS="$CXXFLAGS $flag_sse42"
12489         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12490             #include <nmmintrin.h>
12491             int main () {
12492                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12493                 c = _mm_cmpgt_epi64 (a, b);
12494                 return 0;
12495             }
12496             ])],
12497             [can_compile_sse42=yes],
12498             [can_compile_sse42=no])
12499         AC_LANG_POP([C++])
12500         CXXFLAGS=$save_CXXFLAGS
12501         AC_MSG_RESULT([${can_compile_sse42}])
12502         if test "${can_compile_sse42}" = "yes" ; then
12503             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12504         fi
12506         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12507         AC_LANG_PUSH([C++])
12508         save_CXXFLAGS=$CXXFLAGS
12509         CXXFLAGS="$CXXFLAGS $flag_avx"
12510         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12511             #include <immintrin.h>
12512             int main () {
12513                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12514                 c = _mm256_xor_ps(a, b);
12515                 return 0;
12516             }
12517             ])],
12518             [can_compile_avx=yes],
12519             [can_compile_avx=no])
12520         AC_LANG_POP([C++])
12521         CXXFLAGS=$save_CXXFLAGS
12522         AC_MSG_RESULT([${can_compile_avx}])
12523         if test "${can_compile_avx}" = "yes" ; then
12524             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12525         fi
12527         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12528         AC_LANG_PUSH([C++])
12529         save_CXXFLAGS=$CXXFLAGS
12530         CXXFLAGS="$CXXFLAGS $flag_avx2"
12531         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12532             #include <immintrin.h>
12533             int main () {
12534                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12535                 c = _mm256_maddubs_epi16(a, b);
12536                 return 0;
12537             }
12538             ])],
12539             [can_compile_avx2=yes],
12540             [can_compile_avx2=no])
12541         AC_LANG_POP([C++])
12542         CXXFLAGS=$save_CXXFLAGS
12543         AC_MSG_RESULT([${can_compile_avx2}])
12544         if test "${can_compile_avx2}" = "yes" ; then
12545             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12546         fi
12548         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12549         AC_LANG_PUSH([C++])
12550         save_CXXFLAGS=$CXXFLAGS
12551         CXXFLAGS="$CXXFLAGS $flag_avx512"
12552         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12553             #include <immintrin.h>
12554             int main () {
12555                 __m512i a = _mm512_loadu_si512(0);
12556                 __m512d v1 = _mm512_load_pd(0);
12557                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12558                 __m512d v2 = _mm512_abs_pd(v1);
12559                 return 0;
12560             }
12561             ])],
12562             [can_compile_avx512=yes],
12563             [can_compile_avx512=no])
12564         AC_LANG_POP([C++])
12565         CXXFLAGS=$save_CXXFLAGS
12566         AC_MSG_RESULT([${can_compile_avx512}])
12567         if test "${can_compile_avx512}" = "yes" ; then
12568             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12569             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12570         fi
12572         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12573         AC_LANG_PUSH([C++])
12574         save_CXXFLAGS=$CXXFLAGS
12575         CXXFLAGS="$CXXFLAGS $flag_f16c"
12576         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12577             #include <immintrin.h>
12578             int main () {
12579                 __m128i a = _mm_set1_epi32 (0);
12580                 __m128 c;
12581                 c = _mm_cvtph_ps(a);
12582                 return 0;
12583             }
12584             ])],
12585             [can_compile_f16c=yes],
12586             [can_compile_f16c=no])
12587         AC_LANG_POP([C++])
12588         CXXFLAGS=$save_CXXFLAGS
12589         AC_MSG_RESULT([${can_compile_f16c}])
12590         if test "${can_compile_f16c}" = "yes" ; then
12591             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12592         fi
12594         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12595         AC_LANG_PUSH([C++])
12596         save_CXXFLAGS=$CXXFLAGS
12597         CXXFLAGS="$CXXFLAGS $flag_fma"
12598         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12599             #include <immintrin.h>
12600             int main () {
12601                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12602                 d = _mm256_fmadd_ps(a, b, c);
12603                 return 0;
12604             }
12605             ])],
12606             [can_compile_fma=yes],
12607             [can_compile_fma=no])
12608         AC_LANG_POP([C++])
12609         CXXFLAGS=$save_CXXFLAGS
12610         AC_MSG_RESULT([${can_compile_fma}])
12611         if test "${can_compile_fma}" = "yes" ; then
12612             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12613         fi
12615         CXX="$save_CXX"
12616     fi
12619 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12621 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12622     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12623     AC_LANG_PUSH([C])
12624     save_CC="$CC"
12625     CC="$LO_CLANG_CC"
12626     save_CFLAGS=$CFLAGS
12627     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12628     dnl an empty program will do, we're checking the compiler flags
12629     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12630                       [use_ccache=yes], [use_ccache=no])
12631     CFLAGS=$save_CFLAGS
12632     CC=$save_CC
12633     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12634         AC_MSG_RESULT([yes])
12635     else
12636         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12637         AC_MSG_RESULT([no])
12638     fi
12639     AC_LANG_POP([C])
12641     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12642     AC_LANG_PUSH([C++])
12643     save_CXX="$CXX"
12644     CXX="$LO_CLANG_CXX"
12645     save_CXXFLAGS=$CXXFLAGS
12646     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12647     dnl an empty program will do, we're checking the compiler flags
12648     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12649                       [use_ccache=yes], [use_ccache=no])
12650     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12651         AC_MSG_RESULT([yes])
12652     else
12653         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12654         AC_MSG_RESULT([no])
12655     fi
12656     CXXFLAGS=$save_CXXFLAGS
12657     CXX=$save_CXX
12658     AC_LANG_POP([C++])
12661 AC_SUBST(LO_CLANG_CC)
12662 AC_SUBST(LO_CLANG_CXX)
12663 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12664 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12665 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12666 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12667 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12668 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12669 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12670 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12671 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12672 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12673 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12674 AC_SUBST(LO_CLANG_VERSION)
12675 AC_SUBST(CLANG_USE_LD)
12676 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12678 SYSTEM_GPGMEPP=
12680 AC_MSG_CHECKING([whether to enable gpgmepp])
12681 if test "$enable_gpgmepp" = no; then
12682     AC_MSG_RESULT([no])
12683 elif test "$enable_mpl_subset" = "yes"; then
12684     AC_MSG_RESULT([no (MPL only)])
12685 elif test "$enable_fuzzers" = "yes"; then
12686     AC_MSG_RESULT([no (oss-fuzz)])
12687 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12688     AC_MSG_RESULT([yes])
12689     dnl ===================================================================
12690     dnl Check for system gpgme
12691     dnl ===================================================================
12692     AC_MSG_CHECKING([which gpgmepp to use])
12693     if test "$with_system_gpgmepp" = "yes"; then
12694         AC_MSG_RESULT([external])
12695         SYSTEM_GPGMEPP=TRUE
12697         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12698         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12699             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12700         AC_CHECK_HEADER(gpgme.h, [],
12701             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12702         AC_CHECK_LIB(gpgmepp, main, [],
12703             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12704         GPGMEPP_LIBS=-lgpgmepp
12705     else
12706         AC_MSG_RESULT([internal])
12707         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12709         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12710         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12711         if test "$_os" != "WINNT"; then
12712             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12713             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12714         fi
12715     fi
12716     ENABLE_GPGMEPP=TRUE
12717     AC_DEFINE([HAVE_FEATURE_GPGME])
12718     AC_PATH_PROG(GPG, gpg)
12719     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12720     # so let's exclude that manually for the moment
12721     if test -n "$GPG" -a "$_os" != "WINNT"; then
12722         # make sure we not only have a working gpgme, but a full working
12723         # gpg installation to run OpenPGP signature verification
12724         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12725     fi
12726     if test "$_os" = "Linux"; then
12727       uid=`id -u`
12728       AC_MSG_CHECKING([for /run/user/$uid])
12729       if test -d /run/user/$uid; then
12730         AC_MSG_RESULT([yes])
12731         AC_PATH_PROG(GPGCONF, gpgconf)
12733         # Older versions of gpgconf are not working as expected, since
12734         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12735         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12736         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12737         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12738         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12739         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12740         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12741           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12742           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12743           if $GPGCONF --dump-options > /dev/null ; then
12744             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12745               AC_MSG_RESULT([yes])
12746               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12747               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12748             else
12749               AC_MSG_RESULT([no])
12750             fi
12751           else
12752             AC_MSG_RESULT([no. missing or broken gpgconf?])
12753           fi
12754         else
12755           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12756         fi
12757       else
12758         AC_MSG_RESULT([no])
12759      fi
12760    fi
12761 else
12762     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12764 AC_SUBST(ENABLE_GPGMEPP)
12765 AC_SUBST(SYSTEM_GPGMEPP)
12766 AC_SUBST(GPG_ERROR_CFLAGS)
12767 AC_SUBST(GPG_ERROR_LIBS)
12768 AC_SUBST(LIBASSUAN_CFLAGS)
12769 AC_SUBST(LIBASSUAN_LIBS)
12770 AC_SUBST(GPGMEPP_CFLAGS)
12771 AC_SUBST(GPGMEPP_LIBS)
12773 AC_MSG_CHECKING([whether to build Java Websocket for the UNO remote websocket client])
12774 if test "$with_java" != "no"; then
12775     AC_MSG_RESULT([yes])
12776     ENABLE_JAVA_WEBSOCKET=TRUE
12777     BUILD_TYPE="$BUILD_TYPE JAVA_WEBSOCKET"
12778     NEED_ANT=TRUE
12779 else
12780     AC_MSG_RESULT([no])
12781     ENABLE_JAVA_WEBSOCKET=
12783 AC_SUBST(ENABLE_JAVA_WEBSOCKET)
12785 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12786 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12787     AC_MSG_RESULT([yes])
12788     ENABLE_MEDIAWIKI=TRUE
12789     BUILD_TYPE="$BUILD_TYPE XSLTML"
12790     if test  "x$with_java" = "xno"; then
12791         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12792     fi
12793 else
12794     AC_MSG_RESULT([no])
12795     ENABLE_MEDIAWIKI=
12796     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12798 AC_SUBST(ENABLE_MEDIAWIKI)
12800 AC_MSG_CHECKING([whether to build the Report Builder])
12801 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12802     AC_MSG_RESULT([yes])
12803     ENABLE_REPORTBUILDER=TRUE
12804     AC_MSG_CHECKING([which jfreereport libs to use])
12805     if test "$with_system_jfreereport" = "yes"; then
12806         SYSTEM_JFREEREPORT=TRUE
12807         AC_MSG_RESULT([external])
12808         if test -z $SAC_JAR; then
12809             SAC_JAR=/usr/share/java/sac.jar
12810         fi
12811         if ! test -f $SAC_JAR; then
12812              AC_MSG_ERROR(sac.jar not found.)
12813         fi
12815         if test -z $LIBXML_JAR; then
12816             if test -f /usr/share/java/libxml-1.0.0.jar; then
12817                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12818             elif test -f /usr/share/java/libxml.jar; then
12819                 LIBXML_JAR=/usr/share/java/libxml.jar
12820             else
12821                 AC_MSG_ERROR(libxml.jar replacement not found.)
12822             fi
12823         elif ! test -f $LIBXML_JAR; then
12824             AC_MSG_ERROR(libxml.jar not found.)
12825         fi
12827         if test -z $FLUTE_JAR; then
12828             if test -f /usr/share/java/flute-1.3.0.jar; then
12829                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12830             elif test -f /usr/share/java/flute.jar; then
12831                 FLUTE_JAR=/usr/share/java/flute.jar
12832             else
12833                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12834             fi
12835         elif ! test -f $FLUTE_JAR; then
12836             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12837         fi
12839         if test -z $JFREEREPORT_JAR; then
12840             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12841                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12842             elif test -f /usr/share/java/flow-engine.jar; then
12843                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12844             else
12845                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12846             fi
12847         elif ! test -f  $JFREEREPORT_JAR; then
12848                 AC_MSG_ERROR(jfreereport.jar not found.)
12849         fi
12851         if test -z $LIBLAYOUT_JAR; then
12852             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12853                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12854             elif test -f /usr/share/java/liblayout.jar; then
12855                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12856             else
12857                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12858             fi
12859         elif ! test -f $LIBLAYOUT_JAR; then
12860                 AC_MSG_ERROR(liblayout.jar not found.)
12861         fi
12863         if test -z $LIBLOADER_JAR; then
12864             if test -f /usr/share/java/libloader-1.0.0.jar; then
12865                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12866             elif test -f /usr/share/java/libloader.jar; then
12867                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12868             else
12869                 AC_MSG_ERROR(libloader.jar replacement not found.)
12870             fi
12871         elif ! test -f  $LIBLOADER_JAR; then
12872             AC_MSG_ERROR(libloader.jar not found.)
12873         fi
12875         if test -z $LIBFORMULA_JAR; then
12876             if test -f /usr/share/java/libformula-0.2.0.jar; then
12877                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12878             elif test -f /usr/share/java/libformula.jar; then
12879                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12880             else
12881                 AC_MSG_ERROR(libformula.jar replacement not found.)
12882             fi
12883         elif ! test -f $LIBFORMULA_JAR; then
12884                 AC_MSG_ERROR(libformula.jar not found.)
12885         fi
12887         if test -z $LIBREPOSITORY_JAR; then
12888             if test -f /usr/share/java/librepository-1.0.0.jar; then
12889                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12890             elif test -f /usr/share/java/librepository.jar; then
12891                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12892             else
12893                 AC_MSG_ERROR(librepository.jar replacement not found.)
12894             fi
12895         elif ! test -f $LIBREPOSITORY_JAR; then
12896             AC_MSG_ERROR(librepository.jar not found.)
12897         fi
12899         if test -z $LIBFONTS_JAR; then
12900             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12901                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12902             elif test -f /usr/share/java/libfonts.jar; then
12903                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12904             else
12905                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12906             fi
12907         elif ! test -f $LIBFONTS_JAR; then
12908                 AC_MSG_ERROR(libfonts.jar not found.)
12909         fi
12911         if test -z $LIBSERIALIZER_JAR; then
12912             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12913                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12914             elif test -f /usr/share/java/libserializer.jar; then
12915                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12916             else
12917                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12918             fi
12919         elif ! test -f $LIBSERIALIZER_JAR; then
12920                 AC_MSG_ERROR(libserializer.jar not found.)
12921         fi
12923         if test -z $LIBBASE_JAR; then
12924             if test -f /usr/share/java/libbase-1.0.0.jar; then
12925                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12926             elif test -f /usr/share/java/libbase.jar; then
12927                 LIBBASE_JAR=/usr/share/java/libbase.jar
12928             else
12929                 AC_MSG_ERROR(libbase.jar replacement not found.)
12930             fi
12931         elif ! test -f $LIBBASE_JAR; then
12932             AC_MSG_ERROR(libbase.jar not found.)
12933         fi
12935     else
12936         AC_MSG_RESULT([internal])
12937         SYSTEM_JFREEREPORT=
12938         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12939         NEED_ANT=TRUE
12940     fi
12941 else
12942     AC_MSG_RESULT([no])
12943     ENABLE_REPORTBUILDER=
12944     SYSTEM_JFREEREPORT=
12946 AC_SUBST(ENABLE_REPORTBUILDER)
12947 AC_SUBST(SYSTEM_JFREEREPORT)
12948 AC_SUBST(SAC_JAR)
12949 AC_SUBST(LIBXML_JAR)
12950 AC_SUBST(FLUTE_JAR)
12951 AC_SUBST(JFREEREPORT_JAR)
12952 AC_SUBST(LIBBASE_JAR)
12953 AC_SUBST(LIBLAYOUT_JAR)
12954 AC_SUBST(LIBLOADER_JAR)
12955 AC_SUBST(LIBFORMULA_JAR)
12956 AC_SUBST(LIBREPOSITORY_JAR)
12957 AC_SUBST(LIBFONTS_JAR)
12958 AC_SUBST(LIBSERIALIZER_JAR)
12960 # scripting provider for BeanShell?
12961 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12962 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12963     AC_MSG_RESULT([yes])
12964     ENABLE_SCRIPTING_BEANSHELL=TRUE
12966     dnl ===================================================================
12967     dnl Check for system beanshell
12968     dnl ===================================================================
12969     AC_MSG_CHECKING([which beanshell to use])
12970     if test "$with_system_beanshell" = "yes"; then
12971         AC_MSG_RESULT([external])
12972         SYSTEM_BSH=TRUE
12973         if test -z $BSH_JAR; then
12974             BSH_JAR=/usr/share/java/bsh.jar
12975         fi
12976         if ! test -f $BSH_JAR; then
12977             AC_MSG_ERROR(bsh.jar not found.)
12978         fi
12979     else
12980         AC_MSG_RESULT([internal])
12981         SYSTEM_BSH=
12982         BUILD_TYPE="$BUILD_TYPE BSH"
12983     fi
12984 else
12985     AC_MSG_RESULT([no])
12986     ENABLE_SCRIPTING_BEANSHELL=
12987     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12989 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12990 AC_SUBST(SYSTEM_BSH)
12991 AC_SUBST(BSH_JAR)
12993 # scripting provider for JavaScript?
12994 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12995 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12996     AC_MSG_RESULT([yes])
12997     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12999     dnl ===================================================================
13000     dnl Check for system rhino
13001     dnl ===================================================================
13002     AC_MSG_CHECKING([which rhino to use])
13003     if test "$with_system_rhino" = "yes"; then
13004         AC_MSG_RESULT([external])
13005         SYSTEM_RHINO=TRUE
13006         if test -z $RHINO_JAR; then
13007             RHINO_JAR=/usr/share/java/js.jar
13008         fi
13009         if ! test -f $RHINO_JAR; then
13010             AC_MSG_ERROR(js.jar not found.)
13011         fi
13012     else
13013         AC_MSG_RESULT([internal])
13014         SYSTEM_RHINO=
13015         BUILD_TYPE="$BUILD_TYPE RHINO"
13016         NEED_ANT=TRUE
13017     fi
13018 else
13019     AC_MSG_RESULT([no])
13020     ENABLE_SCRIPTING_JAVASCRIPT=
13021     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
13023 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
13024 AC_SUBST(SYSTEM_RHINO)
13025 AC_SUBST(RHINO_JAR)
13027 # This is only used in Qt5/Qt6/KF5/KF6 checks to determine if /usr/lib64
13028 # paths should be added to library search path. So lets put all 64-bit
13029 # platforms there.
13030 supports_multilib=
13031 case "$host_cpu" in
13032 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
13033     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
13034         supports_multilib="yes"
13035     fi
13036     ;;
13038     ;;
13039 esac
13041 dnl ===================================================================
13042 dnl QT5 Integration
13043 dnl ===================================================================
13045 QT5_CFLAGS=""
13046 QT5_LIBS=""
13047 QMAKE5="qmake"
13048 MOC5="moc"
13049 QT5_GOBJECT_CFLAGS=""
13050 QT5_GOBJECT_LIBS=""
13051 QT5_HAVE_GOBJECT=""
13052 QT5_PLATFORMS_SRCDIR=""
13053 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13054         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
13055         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13056 then
13057     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
13058     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
13060     if test -n "$supports_multilib"; then
13061         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
13062     fi
13064     qt5_test_include="QtWidgets/qapplication.h"
13065     if test "$_os" = "Emscripten"; then
13066         qt5_test_library="libQt5Widgets.a"
13067     else
13068         qt5_test_library="libQt5Widgets.so"
13069     fi
13071     dnl Check for qmake5
13072     if test -n "$QT5DIR"; then
13073         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
13074     else
13075         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
13076     fi
13077     if test "$QMAKE5" = "no"; then
13078         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13079     else
13080         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
13081         if test -z "$qmake5_test_ver"; then
13082             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13083         fi
13084         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
13085         qt5_minimal_minor="15"
13086         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
13087             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
13088         else
13089             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
13090         fi
13091     fi
13093     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
13094     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
13095     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
13096     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
13098     AC_MSG_CHECKING([for Qt5 headers])
13099     qt5_incdir="no"
13100     for inc_dir in $qt5_incdirs; do
13101         if test -r "$inc_dir/$qt5_test_include"; then
13102             qt5_incdir="$inc_dir"
13103             break
13104         fi
13105     done
13106     AC_MSG_RESULT([$qt5_incdir])
13107     if test "x$qt5_incdir" = "xno"; then
13108         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13109     fi
13110     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
13111     AC_LANG_PUSH([C++])
13112     save_CPPFLAGS=$CPPFLAGS
13113     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
13114     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13115         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13116     CPPFLAGS=$save_CPPFLAGS
13117     AC_LANG_POP([C++])
13119     AC_MSG_CHECKING([for Qt5 libraries])
13120     qt5_libdir="no"
13121     for lib_dir in $qt5_libdirs; do
13122         if test -r "$lib_dir/$qt5_test_library"; then
13123             qt5_libdir="$lib_dir"
13124             break
13125         fi
13126     done
13127     AC_MSG_RESULT([$qt5_libdir])
13128     if test "x$qt5_libdir" = "xno"; then
13129         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
13130     fi
13132     if test "$_os" = "Emscripten"; then
13133         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13134             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13135         fi
13136         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
13137             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
13138         fi
13140         EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
13141         if ! test -x "$EMSDK_LLVM_NM"; then
13142             AC_MSG_ERROR([Missing llvm-nm expected to be found at "$EMSDK_LLVM_NM".])
13143         fi
13144         if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
13145             AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
13146         fi
13147         QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 2>/dev/null | $GREP emscripten_longjmp`"
13148         if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
13149             AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a (missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
13150         fi
13151         if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
13152             AC_MSG_ERROR(['emscripten_longjmp' symbol not found in libQt5Gui.a. You probably use an incompatible Qt build with '-s SUPPORT_LONGJMP=wasm'.])
13153         fi
13154     fi
13156     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13157     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13158     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13159     if test "$_os" = "Emscripten"; then
13160         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
13161     fi
13163     if test "$USING_X11" = TRUE; then
13164         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
13165         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
13166         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
13167         QT5_USING_X11=1
13168         AC_DEFINE(QT5_USING_X11)
13169     fi
13171     dnl Check for Meta Object Compiler
13173     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
13174     if test "$MOC5" = "no"; then
13175         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13176 the root of your Qt installation by exporting QT5DIR before running "configure".])
13177     fi
13179     if test "$test_gstreamer_1_0" = yes; then
13180         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13181                 QT5_HAVE_GOBJECT=1
13182                 AC_DEFINE(QT5_HAVE_GOBJECT)
13183             ],
13184             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13185         )
13186     fi
13188 AC_SUBST(QT5_CFLAGS)
13189 AC_SUBST(QT5_LIBS)
13190 AC_SUBST(MOC5)
13191 AC_SUBST(QT5_GOBJECT_CFLAGS)
13192 AC_SUBST(QT5_GOBJECT_LIBS)
13193 AC_SUBST(QT5_HAVE_GOBJECT)
13194 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13196 dnl ===================================================================
13197 dnl QT6 Integration
13198 dnl ===================================================================
13200 QT6_CFLAGS=""
13201 QT6_LIBS=""
13202 QMAKE6="qmake"
13203 MOC6="moc"
13204 QT6_PLATFORMS_SRCDIR=""
13205 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \) -o \
13206         \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13207 then
13208     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13209     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13211     if test -n "$supports_multilib"; then
13212         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13213     fi
13215     qt6_test_include="QtWidgets/qapplication.h"
13216     if test "$_os" = "Emscripten"; then
13217         qt6_test_library="libQt6Widgets.a"
13218     else
13219         qt6_test_library="libQt6Widgets.so"
13220     fi
13222     dnl Check for qmake6
13223     if test -n "$QT6DIR"; then
13224         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13225     else
13226         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake6 qmake], no)
13227     fi
13228     if test "$QMAKE6" = "no"; then
13229         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13230     else
13231         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13232         if test -z "$qmake6_test_ver"; then
13233             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13234         fi
13235         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13236     fi
13238     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13239     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13240     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13241     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13243     AC_MSG_CHECKING([for Qt6 headers])
13244     qt6_incdir="no"
13245     for inc_dir in $qt6_incdirs; do
13246         if test -r "$inc_dir/$qt6_test_include"; then
13247             qt6_incdir="$inc_dir"
13248             break
13249         fi
13250     done
13251     AC_MSG_RESULT([$qt6_incdir])
13252     if test "x$qt6_incdir" = "xno"; then
13253         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13254     fi
13255     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13256     AC_LANG_PUSH([C++])
13257     save_CPPFLAGS=$CPPFLAGS
13258     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13259     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13260         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13261     CPPFLAGS=$save_CPPFLAGS
13262     AC_LANG_POP([C++])
13264     AC_MSG_CHECKING([for Qt6 libraries])
13265     qt6_libdir="no"
13266     for lib_dir in $qt6_libdirs; do
13267         if test -r "$lib_dir/$qt6_test_library"; then
13268             qt6_libdir="$lib_dir"
13269             break
13270         fi
13271     done
13272     AC_MSG_RESULT([$qt6_libdir])
13273     if test "x$qt6_libdir" = "xno"; then
13274         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13275     fi
13277     if test "$_os" = "Emscripten"; then
13278         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13279             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13280         fi
13281         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13282             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13283         fi
13284     fi
13286     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13287     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13288     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13289     if test "$_os" = "Emscripten"; then
13290         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13291     fi
13293     if test "$USING_X11" = TRUE; then
13294         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13295         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13296         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13297         QT6_USING_X11=1
13298         AC_DEFINE(QT6_USING_X11)
13299     fi
13301     dnl Check for Meta Object Compiler
13303     for lib_dir in $qt6_libdirs; do
13304         if test -z "$qt6_libexec_dirs"; then
13305             qt6_libexec_dirs="$lib_dir/libexec"
13306         else
13307             qt6_libexec_dirs="$qt6_libexec_dirs:$lib_dir/libexec"
13308         fi
13309     done
13310     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$qt6_libexec_dirs:`echo $qt6_libdirs | $SED -e 's/ /:/g'`:$PATH])
13311     if test "$MOC6" = "no"; then
13312         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13313 the root of your Qt installation by exporting QT6DIR before running "configure".])
13314     else
13315         moc6_test_ver="`$MOC6 -v 2>&1 | $SED -n -e 's/^moc \(6.*\)/\1/p'`"
13316         if test -z "$moc6_test_ver"; then
13317             AC_MSG_ERROR([Wrong moc for Qt6 found.])
13318         fi
13319         AC_MSG_NOTICE([Detected moc version: $moc_test_ver])
13320     fi
13322 AC_SUBST(QT6_CFLAGS)
13323 AC_SUBST(QT6_LIBS)
13324 AC_SUBST(MOC6)
13325 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13327 dnl ===================================================================
13328 dnl KF5 Integration
13329 dnl ===================================================================
13331 KF5_CFLAGS=""
13332 KF5_LIBS=""
13333 KF5_CONFIG="kf5-config"
13334 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13335         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13336 then
13337     if test "$OS" = "HAIKU"; then
13338         haiku_arch="`echo $RTL_ARCH | tr X x`"
13339         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13340         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13341     fi
13343     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13344     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13345     if test -n "$supports_multilib"; then
13346         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13347     fi
13349     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13350     kf5_test_library="libKF5KIOFileWidgets.so"
13351     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13353     dnl kf5 KDE4 support compatibility installed
13354     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13355     if test "$KF5_CONFIG" != "no"; then
13356         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13357         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13358     fi
13360     dnl Check for KF5 headers
13361     AC_MSG_CHECKING([for KF5 headers])
13362     kf5_incdir="no"
13363     for kf5_check in $kf5_incdirs; do
13364         if test -r "$kf5_check/$kf5_test_include"; then
13365             kf5_incdir="$kf5_check/KF5"
13366             break
13367         fi
13368     done
13369     AC_MSG_RESULT([$kf5_incdir])
13370     if test "x$kf5_incdir" = "xno"; then
13371         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13372     fi
13374     dnl Check for KF5 libraries
13375     AC_MSG_CHECKING([for KF5 libraries])
13376     kf5_libdir="no"
13377     for kf5_check in $kf5_libdirs; do
13378         if test -r "$kf5_check/$kf5_test_library"; then
13379             kf5_libdir="$kf5_check"
13380             break
13381         fi
13382     done
13384     AC_MSG_RESULT([$kf5_libdir])
13385     if test "x$kf5_libdir" = "xno"; then
13386         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13387     fi
13389     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"
13390     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13391     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13393     if test "$USING_X11" = TRUE; then
13394         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13395     fi
13397     AC_LANG_PUSH([C++])
13398     save_CXXFLAGS=$CXXFLAGS
13399     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13400     AC_MSG_CHECKING([whether KDE is >= 5.0])
13401        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13402 #include <kcoreaddons_version.h>
13404 int main(int argc, char **argv) {
13405        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13406        else return 1;
13408        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13409     CXXFLAGS=$save_CXXFLAGS
13410     AC_LANG_POP([C++])
13412 AC_SUBST(KF5_CFLAGS)
13413 AC_SUBST(KF5_LIBS)
13415 dnl ===================================================================
13416 dnl KF6 Integration
13417 dnl ===================================================================
13419 KF6_CFLAGS=""
13420 KF6_LIBS=""
13421 if test \( "$test_kf6" = "yes" -a "$ENABLE_KF6" = "TRUE" \)
13422 then
13423     if test "$OS" = "HAIKU"; then
13424         haiku_arch="`echo $RTL_ARCH | tr X x`"
13425         kf6_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13426         kf6_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13427     fi
13429     kf6_incdirs="$KF6INC /usr/include $kf6_haiku_incdirs $x_includes"
13430     kf6_libdirs="$KF6LIB /usr/lib /usr/lib/kf6 /usr/lib/kf6/devel $kf6_haiku_libdirs $x_libraries"
13431     if test -n "$supports_multilib"; then
13432         kf6_libdirs="$kf6_libdirs /usr/lib64 /usr/lib64/kf6 /usr/lib64/kf6/devel"
13433     fi
13435     kf6_test_include="KF6/KIOFileWidgets/KFileWidget"
13436     kf6_test_library="libKF6KIOFileWidgets.so"
13437     kf6_libdirs="$qt6_libdir $kf6_libdirs"
13439     dnl Check for KF6 headers
13440     AC_MSG_CHECKING([for KF6 headers])
13441     kf6_incdir="no"
13442     for kf6_check in $kf6_incdirs; do
13443         if test -r "$kf6_check/$kf6_test_include"; then
13444             kf6_incdir="$kf6_check/KF6"
13445             break
13446         fi
13447     done
13448     AC_MSG_RESULT([$kf6_incdir])
13449     if test "x$kf6_incdir" = "xno"; then
13450         AC_MSG_ERROR([KF6 headers not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13451     fi
13453     dnl Check for KF6 libraries
13454     AC_MSG_CHECKING([for KF6 libraries])
13455     kf6_libdir="no"
13456     for kf6_check in $kf6_libdirs; do
13457         if test -r "$kf6_check/$kf6_test_library"; then
13458             kf6_libdir="$kf6_check"
13459             break
13460         fi
13461     done
13463     AC_MSG_RESULT([$kf6_libdir])
13464     if test "x$kf6_libdir" = "xno"; then
13465         AC_MSG_ERROR([KF6 libraries not found.  Please specify the root of your KF6 installation by exporting KF6DIR before running "configure".])
13466     fi
13468     KF6_CFLAGS="-I$kf6_incdir -I$kf6_incdir/KCoreAddons -I$kf6_incdir/KI18n -I$kf6_incdir/KConfigCore -I$kf6_incdir/KWindowSystem -I$kf6_incdir/KIO -I$kf6_incdir/KIOCore -I$kf6_incdir/KIOWidgets -I$kf6_incdir/KIOFileWidgets -I$qt6_incdir -I$qt6_incdir/QtCore -I$qt6_incdir/QtGui -I$qt6_incdir/QtWidgets -I$qt6_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13469     KF6_LIBS="-L$kf6_libdir -lKF6CoreAddons -lKF6I18n -lKF6ConfigCore -lKF6WindowSystem -lKF6KIOCore -lKF6KIOWidgets -lKF6KIOFileWidgets -L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13470     KF6_CFLAGS=$(printf '%s' "$KF6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13472     AC_LANG_PUSH([C++])
13473     save_CXXFLAGS=$CXXFLAGS
13474     CXXFLAGS="$CXXFLAGS $KF6_CFLAGS"
13475     dnl KF6 development version as of 2023-06 uses version number 5.240
13476     AC_MSG_CHECKING([whether KDE is >= 5.240])
13477        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13478 #include <kcoreaddons_version.h>
13480 int main(int argc, char **argv) {
13481        if (KCOREADDONS_VERSION_MAJOR == 6 || (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 240)) return 0;
13482        else return 1;
13484        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13485     CXXFLAGS=$save_CXXFLAGS
13486     AC_LANG_POP([C++])
13488 AC_SUBST(KF6_CFLAGS)
13489 AC_SUBST(KF6_LIBS)
13491 dnl ===================================================================
13492 dnl Test whether to include Evolution 2 support
13493 dnl ===================================================================
13494 AC_MSG_CHECKING([whether to enable evolution 2 support])
13495 if test "$enable_evolution2" = yes; then
13496     AC_MSG_RESULT([yes])
13497     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13498     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13499     FilterLibs "${GOBJECT_LIBS}"
13500     GOBJECT_LIBS="${filteredlibs}"
13501     ENABLE_EVOAB2="TRUE"
13502 else
13503     AC_MSG_RESULT([no])
13505 AC_SUBST(ENABLE_EVOAB2)
13506 AC_SUBST(GOBJECT_CFLAGS)
13507 AC_SUBST(GOBJECT_LIBS)
13509 dnl ===================================================================
13510 dnl Test which themes to include
13511 dnl ===================================================================
13512 AC_MSG_CHECKING([which themes to include])
13513 # if none given use default subset of available themes
13514 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13515     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg colibre_dark colibre_dark_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_dark sukapura_dark_svg sukapura_svg"
13518 WITH_THEMES=""
13519 if test "x$with_theme" != "xno"; then
13520     for theme in $with_theme; do
13521         case $theme in
13522         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|colibre_dark|colibre_dark_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_dark|sukapura_dark_svg|sukapura_svg) WITH_THEMES="${WITH_THEMES:+$WITH_THEMES }$theme" ;;
13523         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13524         esac
13525     done
13527 AC_MSG_RESULT([$WITH_THEMES])
13528 AC_SUBST([WITH_THEMES])
13530 ###############################################################################
13531 # Extensions checking
13532 ###############################################################################
13533 AC_MSG_CHECKING([for extensions integration])
13534 if test "x$enable_extension_integration" != "xno"; then
13535     WITH_EXTENSION_INTEGRATION=TRUE
13536     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13537     AC_MSG_RESULT([yes, use integration])
13538 else
13539     WITH_EXTENSION_INTEGRATION=
13540     AC_MSG_RESULT([no, do not integrate])
13542 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13544 dnl Should any extra extensions be included?
13545 dnl There are standalone tests for each of these below.
13546 WITH_EXTRA_EXTENSIONS=
13547 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13549 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13550 if test "x$with_java" != "xno"; then
13551     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13554 AC_MSG_CHECKING([whether to build opens___.ttf])
13555 if test "$enable_build_opensymbol" = "yes"; then
13556     AC_MSG_RESULT([yes])
13557     AC_PATH_PROG(FONTFORGE, fontforge)
13558     if test -z "$FONTFORGE"; then
13559         AC_MSG_ERROR([fontforge not installed])
13560     fi
13561 else
13562     AC_MSG_RESULT([no])
13563     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13565 AC_SUBST(FONTFORGE)
13567 dnl ===================================================================
13568 dnl Test whether to include fonts
13569 dnl ===================================================================
13570 AC_MSG_CHECKING([whether to include third-party fonts])
13571 if test "$with_fonts" != "no"; then
13572     AC_MSG_RESULT([yes])
13573     WITH_FONTS=TRUE
13574     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13575     AC_DEFINE(HAVE_MORE_FONTS)
13576 else
13577     AC_MSG_RESULT([no])
13578     WITH_FONTS=
13579     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13581 AC_SUBST(WITH_FONTS)
13584 dnl ===================================================================
13585 dnl Test whether to enable online update service
13586 dnl ===================================================================
13587 AC_MSG_CHECKING([whether to enable online update])
13588 ENABLE_ONLINE_UPDATE=
13589 ENABLE_ONLINE_UPDATE_MAR=
13590 UPDATE_CONFIG=
13591 if test "$enable_online_update" = ""; then
13592     AC_MSG_RESULT([no])
13593 else
13594     if test "$enable_online_update" = "mar"; then
13595         AC_MSG_RESULT([yes - MAR-based online update])
13596         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13597         if test "$with_update_config" = ""; then
13598             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13599         fi
13600         UPDATE_CONFIG="$with_update_config"
13601         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13602     elif test "$enable_online_update" = "yes"; then
13603         if test "$enable_curl" != "yes"; then
13604             AC_MSG_ERROR([--disable-online-update must be used when --disable-curl is used])
13605         fi
13606         AC_MSG_RESULT([yes])
13607         ENABLE_ONLINE_UPDATE="TRUE"
13608     else
13609         AC_MSG_RESULT([no])
13610     fi
13612 AC_SUBST(ENABLE_ONLINE_UPDATE)
13613 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13614 AC_SUBST(UPDATE_CONFIG)
13617 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13618 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13619     if test "x$with_privacy_policy_url" = "xundefined"; then
13620         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13621     fi
13623 AC_SUBST(PRIVACY_POLICY_URL)
13624 dnl ===================================================================
13625 dnl Test whether we need bzip2
13626 dnl ===================================================================
13627 SYSTEM_BZIP2=
13628 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
13629     AC_MSG_CHECKING([whether to use system bzip2])
13630     if test "$with_system_bzip2" = yes; then
13631         SYSTEM_BZIP2=TRUE
13632         AC_MSG_RESULT([yes])
13633         PKG_CHECK_MODULES(BZIP2, bzip2)
13634         FilterLibs "${BZIP2_LIBS}"
13635         BZIP2_LIBS="${filteredlibs}"
13636     else
13637         AC_MSG_RESULT([no])
13638         BUILD_TYPE="$BUILD_TYPE BZIP2"
13639     fi
13641 AC_SUBST(SYSTEM_BZIP2)
13642 AC_SUBST(BZIP2_CFLAGS)
13643 AC_SUBST(BZIP2_LIBS)
13645 dnl ===================================================================
13646 dnl Test whether to enable extension update
13647 dnl ===================================================================
13648 AC_MSG_CHECKING([whether to enable extension update])
13649 ENABLE_EXTENSION_UPDATE=
13650 if test "x$enable_extension_update" = "xno"; then
13651     AC_MSG_RESULT([no])
13652 else
13653     AC_MSG_RESULT([yes])
13654     ENABLE_EXTENSION_UPDATE="TRUE"
13655     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13656     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13658 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13661 dnl ===================================================================
13662 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13663 dnl ===================================================================
13664 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13665 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13666     AC_MSG_RESULT([no])
13667     ENABLE_SILENT_MSI=
13668 else
13669     AC_MSG_RESULT([yes])
13670     ENABLE_SILENT_MSI=TRUE
13671     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13673 AC_SUBST(ENABLE_SILENT_MSI)
13675 dnl ===================================================================
13676 dnl Check for WiX tools.
13677 dnl ===================================================================
13678 if test "$enable_wix" = "" -o "enable_wix" = "no"; then
13679     AC_MSG_RESULT([no])
13680     ENABLE_WIX=
13681 else
13682     AC_MSG_RESULT([yes])
13683     # FIXME: this should do proper detection, but the path is currently
13684     # hardcoded in msicreator/createmsi.py
13685     if ! test -x "/cygdrive/c/Program Files (x86)/WiX Toolset v3.11/bin/candle"; then
13686       AC_MSG_ERROR([WiX requested but WiX toolset v3.11 not found at the expected location])
13687     fi
13688     ENABLE_WIX=TRUE
13690 AC_SUBST(ENABLE_WIX)
13692 AC_MSG_CHECKING([whether and how to use Xinerama])
13693 if test "$USING_X11" = TRUE; then
13694     if test "$x_libraries" = "default_x_libraries"; then
13695         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13696         if test "x$XINERAMALIB" = x; then
13697            XINERAMALIB="/usr/lib"
13698         fi
13699     else
13700         XINERAMALIB="$x_libraries"
13701     fi
13702     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13703         # we have both versions, let the user decide but use the dynamic one
13704         # per default
13705         USE_XINERAMA=TRUE
13706         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13707             XINERAMA_LINK=dynamic
13708         else
13709             XINERAMA_LINK=static
13710         fi
13711     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13712         # we have only the dynamic version
13713         USE_XINERAMA=TRUE
13714         XINERAMA_LINK=dynamic
13715     elif test -e "$XINERAMALIB/libXinerama.a"; then
13716         # static version
13717         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13718             USE_XINERAMA=TRUE
13719             XINERAMA_LINK=static
13720         else
13721             USE_XINERAMA=
13722             XINERAMA_LINK=none
13723         fi
13724     else
13725         # no Xinerama
13726         USE_XINERAMA=
13727         XINERAMA_LINK=none
13728     fi
13729     if test "$USE_XINERAMA" = "TRUE"; then
13730         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13731         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13732             [AC_MSG_ERROR(Xinerama header not found.)], [])
13733         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13734         if test "x$XEXTLIB" = x; then
13735            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13736         fi
13737         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13738         if test "$_os" = "FreeBSD"; then
13739             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13740         fi
13741         if test "$_os" = "Linux"; then
13742             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13743         fi
13744         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13745             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13746     else
13747         AC_MSG_ERROR([libXinerama not found or wrong architecture.])
13748     fi
13749 else
13750     USE_XINERAMA=
13751     XINERAMA_LINK=none
13752     AC_MSG_RESULT([no])
13754 AC_SUBST(XINERAMA_LINK)
13756 AC_MSG_CHECKING([whether to use non-standard RGBA32 cairo pixel order])
13757 if test -z "$enable_cairo_rgba" -a "$_os" = "Android"; then
13758     enable_cairo_rgba=yes
13760 if test "$enable_cairo_rgba" = yes; then
13761     AC_DEFINE(ENABLE_CAIRO_RGBA)
13762     ENABLE_CAIRO_RGBA=TRUE
13763     AC_MSG_RESULT([yes])
13764 else
13765     ENABLE_CAIRO_RGBA=
13766     AC_MSG_RESULT([no])
13768 AC_SUBST(ENABLE_CAIRO_RGBA)
13770 dnl ===================================================================
13771 dnl Test whether to build cairo or rely on the system version
13772 dnl ===================================================================
13774 if test "$test_cairo" = "yes"; then
13775     AC_MSG_CHECKING([whether to use the system cairo])
13777     : ${with_system_cairo:=$with_system_libs}
13778     if test "$with_system_cairo" = "yes" -a "$enable_cairo_rgba" != "yes"; then
13779         SYSTEM_CAIRO=TRUE
13780         AC_MSG_RESULT([yes])
13782         PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
13783         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13784         FilterLibs "${CAIRO_LIBS}"
13785         CAIRO_LIBS="${filteredlibs}"
13787         if test "$test_xrender" = "yes"; then
13788             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13789             AC_LANG_PUSH([C])
13790             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13791 #ifdef PictStandardA8
13792 #else
13793       return fail;
13794 #endif
13795 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13797             AC_LANG_POP([C])
13798         fi
13799     else
13800         AC_MSG_RESULT([no])
13801         BUILD_TYPE="$BUILD_TYPE CAIRO"
13802     fi
13804     if test "$enable_cairo_canvas" != no; then
13805         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13806         ENABLE_CAIRO_CANVAS=TRUE
13807     fi
13810 AC_SUBST(CAIRO_CFLAGS)
13811 AC_SUBST(CAIRO_LIBS)
13812 AC_SUBST(ENABLE_CAIRO_CANVAS)
13813 AC_SUBST(SYSTEM_CAIRO)
13815 dnl ===================================================================
13816 dnl Test whether to use avahi
13817 dnl ===================================================================
13818 if test "$_os" = "WINNT"; then
13819     # Windows uses bundled mDNSResponder
13820     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13821 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13822     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13823                       [ENABLE_AVAHI="TRUE"])
13824     AC_DEFINE(HAVE_FEATURE_AVAHI)
13825     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13826     FilterLibs "${AVAHI_LIBS}"
13827     AVAHI_LIBS="${filteredlibs}"
13830 AC_SUBST(ENABLE_AVAHI)
13831 AC_SUBST(AVAHI_CFLAGS)
13832 AC_SUBST(AVAHI_LIBS)
13834 dnl ===================================================================
13835 dnl Test whether to use liblangtag
13836 dnl ===================================================================
13837 SYSTEM_LIBLANGTAG=
13838 AC_MSG_CHECKING([whether to use system liblangtag])
13839 if test "$with_system_liblangtag" = yes; then
13840     SYSTEM_LIBLANGTAG=TRUE
13841     AC_MSG_RESULT([yes])
13842     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13843     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13844     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13845     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13846     FilterLibs "${LIBLANGTAG_LIBS}"
13847     LIBLANGTAG_LIBS="${filteredlibs}"
13848 else
13849     SYSTEM_LIBLANGTAG=
13850     AC_MSG_RESULT([no])
13851     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13852     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13853     if test "$COM" = "MSC"; then
13854         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13855     else
13856         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13857     fi
13859 AC_SUBST(SYSTEM_LIBLANGTAG)
13860 AC_SUBST(LIBLANGTAG_CFLAGS)
13861 AC_SUBST(LIBLANGTAG_LIBS)
13863 dnl ===================================================================
13864 dnl Test whether to build libpng or rely on the system version
13865 dnl ===================================================================
13867 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13868 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13869 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13871 dnl ===================================================================
13872 dnl Test whether to build libtiff or rely on the system version
13873 dnl ===================================================================
13875 libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff-4])
13877 dnl ===================================================================
13878 dnl Test whether to build libwebp or rely on the system version
13879 dnl ===================================================================
13881 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13883 dnl ===================================================================
13884 dnl Check for runtime JVM search path
13885 dnl ===================================================================
13886 if test "$ENABLE_JAVA" != ""; then
13887     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13888     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13889         AC_MSG_RESULT([yes])
13890         if ! test -d "$with_jvm_path"; then
13891             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13892         fi
13893         if ! test -d "$with_jvm_path"jvm; then
13894             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13895         fi
13896         JVM_ONE_PATH_CHECK="$with_jvm_path"
13897         AC_SUBST(JVM_ONE_PATH_CHECK)
13898     else
13899         AC_MSG_RESULT([no])
13900     fi
13903 dnl ===================================================================
13904 dnl Test for the presence of Ant and that it works
13905 dnl ===================================================================
13907 # java takes the encoding from LC_ALL, and since autoconf forces it to C it
13908 # breaks filename decoding, so for the ant section, set it to LANG
13909 LC_ALL=$LANG
13910 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13911     ANT_HOME=; export ANT_HOME
13912     WITH_ANT_HOME=; export WITH_ANT_HOME
13913     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13914         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13915             if test "$_os" = "WINNT"; then
13916                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13917             else
13918                 with_ant_home="$LODE_HOME/opt/ant"
13919             fi
13920         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13921             with_ant_home="$LODE_HOME/opt/ant"
13922         fi
13923     fi
13924     if test -z "$with_ant_home"; then
13925         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13926     else
13927         if test "$_os" = "WINNT"; then
13928             # AC_PATH_PROGS needs unix path
13929             with_ant_home=`cygpath -u "$with_ant_home"`
13930         fi
13931         AbsolutePath "$with_ant_home"
13932         with_ant_home=$absolute_path
13933         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13934         WITH_ANT_HOME=$with_ant_home
13935         ANT_HOME=$with_ant_home
13936     fi
13938     if test -z "$ANT"; then
13939         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13940     else
13941         # resolve relative or absolute symlink
13942         while test -h "$ANT"; do
13943             a_cwd=`pwd`
13944             a_basename=`basename "$ANT"`
13945             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13946             cd "`dirname "$ANT"`"
13947             cd "`dirname "$a_script"`"
13948             ANT="`pwd`"/"`basename "$a_script"`"
13949             cd "$a_cwd"
13950         done
13952         AC_MSG_CHECKING([if $ANT works])
13953         mkdir -p conftest.dir
13954         a_cwd=$(pwd)
13955         cd conftest.dir
13956         cat > conftest.java << EOF
13957         public class conftest {
13958             int testmethod(int a, int b) {
13959                     return a + b;
13960             }
13961         }
13964         cat > conftest.xml << EOF
13965         <project name="conftest" default="conftest">
13966         <target name="conftest">
13967             <javac srcdir="." includes="conftest.java">
13968             </javac>
13969         </target>
13970         </project>
13973         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13974         if test $? = 0 -a -f ./conftest.class; then
13975             AC_MSG_RESULT([Ant works])
13976             if test -z "$WITH_ANT_HOME"; then
13977                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13978                 if test -z "$ANT_HOME"; then
13979                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13980                 fi
13981             else
13982                 ANT_HOME="$WITH_ANT_HOME"
13983             fi
13984         else
13985             echo "configure: Ant test failed" >&5
13986             cat conftest.java >&5
13987             cat conftest.xml >&5
13988             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13989         fi
13990         cd "$a_cwd"
13991         rm -fr conftest.dir
13992     fi
13993     if test -z "$ANT_HOME"; then
13994         ANT_HOME="NO_ANT_HOME"
13995     else
13996         PathFormat "$ANT_HOME"
13997         ANT_HOME="$formatted_path"
13998         PathFormat "$ANT"
13999         ANT="$formatted_path"
14000     fi
14002     dnl Checking for ant.jar
14003     if test "$ANT_HOME" != "NO_ANT_HOME"; then
14004         AC_MSG_CHECKING([Ant lib directory])
14005         if test -f $ANT_HOME/lib/ant.jar; then
14006             ANT_LIB="$ANT_HOME/lib"
14007         else
14008             if test -f $ANT_HOME/ant.jar; then
14009                 ANT_LIB="$ANT_HOME"
14010             else
14011                 if test -f /usr/share/java/ant.jar; then
14012                     ANT_LIB=/usr/share/java
14013                 else
14014                     if test -f /usr/share/ant-core/lib/ant.jar; then
14015                         ANT_LIB=/usr/share/ant-core/lib
14016                     else
14017                         if test -f $ANT_HOME/lib/ant/ant.jar; then
14018                             ANT_LIB="$ANT_HOME/lib/ant"
14019                         else
14020                             if test -f /usr/share/lib/ant/ant.jar; then
14021                                 ANT_LIB=/usr/share/lib/ant
14022                             else
14023                                 AC_MSG_ERROR([Ant libraries not found!])
14024                             fi
14025                         fi
14026                     fi
14027                 fi
14028             fi
14029         fi
14030         PathFormat "$ANT_LIB"
14031         ANT_LIB="$formatted_path"
14032         AC_MSG_RESULT([Ant lib directory found.])
14033     fi
14035     ant_minver=1.6.0
14036     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
14038     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
14039     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
14040     ant_version_major=`echo $ant_version | cut -d. -f1`
14041     ant_version_minor=`echo $ant_version | cut -d. -f2`
14042     echo "configure: ant_version $ant_version " >&5
14043     echo "configure: ant_version_major $ant_version_major " >&5
14044     echo "configure: ant_version_minor $ant_version_minor " >&5
14045     if test "$ant_version_major" -ge "2"; then
14046         AC_MSG_RESULT([yes, $ant_version])
14047     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
14048         AC_MSG_RESULT([yes, $ant_version])
14049     else
14050         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
14051     fi
14053     rm -f conftest* core core.* *.core
14055 AC_SUBST(ANT)
14056 AC_SUBST(ANT_HOME)
14057 AC_SUBST(ANT_LIB)
14059 OOO_JUNIT_JAR=
14060 HAMCREST_JAR=
14061 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
14062     AC_MSG_CHECKING([for JUnit 4])
14063     if test "$with_junit" = "yes"; then
14064         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
14065             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
14066         elif test -e /usr/share/java/junit4.jar; then
14067             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
14068         else
14069            if test -e /usr/share/lib/java/junit.jar; then
14070               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
14071            else
14072               OOO_JUNIT_JAR=/usr/share/java/junit.jar
14073            fi
14074         fi
14075     else
14076         OOO_JUNIT_JAR=$with_junit
14077     fi
14078     if test "$_os" = "WINNT"; then
14079         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
14080     fi
14081     printf 'import org.junit.Before;' > conftest.java
14082     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14083         AC_MSG_RESULT([$OOO_JUNIT_JAR])
14084     else
14085         AC_MSG_ERROR(
14086 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
14087  specify its pathname via --with-junit=..., or disable it via --without-junit])
14088     fi
14089     rm -f conftest.class conftest.java
14090     if test $OOO_JUNIT_JAR != ""; then
14091         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
14092     fi
14094     AC_MSG_CHECKING([for included Hamcrest])
14095     printf 'import org.hamcrest.BaseDescription;' > conftest.java
14096     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
14097         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
14098     else
14099         AC_MSG_RESULT([Not included])
14100         AC_MSG_CHECKING([for standalone hamcrest jar.])
14101         if test "$with_hamcrest" = "yes"; then
14102             if test -e /usr/share/lib/java/hamcrest.jar; then
14103                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
14104             elif test -e /usr/share/java/hamcrest/core.jar; then
14105                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
14106             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
14107                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
14108             else
14109                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
14110             fi
14111         else
14112             HAMCREST_JAR=$with_hamcrest
14113         fi
14114         if test "$_os" = "WINNT"; then
14115             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
14116         fi
14117         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
14118             AC_MSG_RESULT([$HAMCREST_JAR])
14119         else
14120             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),
14121                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
14122         fi
14123     fi
14124     rm -f conftest.class conftest.java
14126 AC_SUBST(OOO_JUNIT_JAR)
14127 AC_SUBST(HAMCREST_JAR)
14128 # set back LC_ALL to C after the java related tests...
14129 LC_ALL=C
14131 AC_SUBST(SCPDEFS)
14134 # check for wget and curl
14136 WGET=
14137 CURL=
14139 if test "$enable_fetch_external" != "no"; then
14141 CURL=`which curl 2>/dev/null`
14143 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
14144     # wget new enough?
14145     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
14146     if test $? -eq 0; then
14147         WGET=$i
14148         break
14149     fi
14150 done
14152 if test -z "$WGET" -a -z "$CURL"; then
14153     AC_MSG_ERROR([neither wget nor curl found!])
14158 AC_SUBST(WGET)
14159 AC_SUBST(CURL)
14162 # check for sha256sum
14164 SHA256SUM=
14166 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
14167     eval "$i -a 256 --version" > /dev/null 2>&1
14168     ret=$?
14169     if test $ret -eq 0; then
14170         SHA256SUM="$i -a 256"
14171         break
14172     fi
14173 done
14175 if test -z "$SHA256SUM"; then
14176     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
14177         eval "$i --version" > /dev/null 2>&1
14178         ret=$?
14179         if test $ret -eq 0; then
14180             SHA256SUM=$i
14181             break
14182         fi
14183     done
14186 if test -z "$SHA256SUM"; then
14187     AC_MSG_ERROR([no sha256sum found!])
14190 AC_SUBST(SHA256SUM)
14192 dnl ===================================================================
14193 dnl Dealing with l10n options
14194 dnl ===================================================================
14195 AC_MSG_CHECKING([which languages to be built])
14196 # get list of all languages
14197 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
14198 # the sed command does the following:
14199 #   + if a line ends with a backslash, append the next line to it
14200 #   + adds " on the beginning of the value (after =)
14201 #   + adds " at the end of the value
14202 #   + removes en-US; we want to put it on the beginning
14203 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
14204 [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)]
14205 ALL_LANGS="en-US $completelangiso"
14206 # check the configured localizations
14207 WITH_LANG="$with_lang"
14209 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
14210 # (Norwegian is "nb" and "nn".)
14211 if test "$WITH_LANG" = "no"; then
14212     WITH_LANG=
14215 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
14216     AC_MSG_RESULT([en-US])
14217 else
14218     AC_MSG_RESULT([$WITH_LANG])
14219     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
14220     if test -z "$MSGFMT"; then
14221         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
14222             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
14223         elif test -x "/opt/lo/bin/msgfmt"; then
14224             MSGFMT="/opt/lo/bin/msgfmt"
14225         else
14226             AC_CHECK_PROGS(MSGFMT, [msgfmt])
14227             if test -z "$MSGFMT"; then
14228                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
14229             fi
14230         fi
14231     fi
14232     if test -z "$MSGUNIQ"; then
14233         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
14234             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
14235         elif test -x "/opt/lo/bin/msguniq"; then
14236             MSGUNIQ="/opt/lo/bin/msguniq"
14237         else
14238             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
14239             if test -z "$MSGUNIQ"; then
14240                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
14241             fi
14242         fi
14243     fi
14245 AC_SUBST(MSGFMT)
14246 AC_SUBST(MSGUNIQ)
14247 # check that the list is valid
14248 for lang in $WITH_LANG; do
14249     test "$lang" = "ALL" && continue
14250     # need to check for the exact string, so add space before and after the list of all languages
14251     for vl in $ALL_LANGS; do
14252         if test "$vl" = "$lang"; then
14253            break
14254         fi
14255     done
14256     if test "$vl" != "$lang"; then
14257         # if you're reading this - you prolly quoted your languages remove the quotes ...
14258         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
14259     fi
14260 done
14261 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
14262     echo $WITH_LANG | grep -q en-US
14263     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
14265 # list with substituted ALL
14266 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
14267 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
14268 test "$WITH_LANG" = "en-US" && WITH_LANG=
14269 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
14270     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
14271     ALL_LANGS=`echo $ALL_LANGS qtz`
14273 AC_SUBST(ALL_LANGS)
14274 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
14275 AC_SUBST(WITH_LANG)
14276 AC_SUBST(WITH_LANG_LIST)
14277 AC_SUBST(GIT_NEEDED_SUBMODULES)
14279 WITH_POOR_HELP_LOCALIZATIONS=
14280 if test -d "$SRC_ROOT/translations/source"; then
14281     for l in `ls -1 $SRC_ROOT/translations/source`; do
14282         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
14283             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
14284         fi
14285     done
14287 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
14289 if test -n "$with_locales" -a "$with_locales" != ALL; then
14290     WITH_LOCALES="$with_locales"
14292     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
14293     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
14294     # config_host/config_locales.h.in
14295     for locale in $WITH_LOCALES; do
14296         lang=${locale%_*}
14298         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14300         case $lang in
14301         hi|mr*ne)
14302             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14303             ;;
14304         bg|ru)
14305             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14306             ;;
14307         esac
14308     done
14309 else
14310     AC_DEFINE(WITH_LOCALE_ALL)
14312 AC_SUBST(WITH_LOCALES)
14314 dnl git submodule update --reference
14315 dnl ===================================================================
14316 if test -n "${GIT_REFERENCE_SRC}"; then
14317     for repo in ${GIT_NEEDED_SUBMODULES}; do
14318         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14319             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14320         fi
14321     done
14323 AC_SUBST(GIT_REFERENCE_SRC)
14325 dnl git submodules linked dirs
14326 dnl ===================================================================
14327 if test -n "${GIT_LINK_SRC}"; then
14328     for repo in ${GIT_NEEDED_SUBMODULES}; do
14329         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14330             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14331         fi
14332     done
14334 AC_SUBST(GIT_LINK_SRC)
14336 dnl branding
14337 dnl ===================================================================
14338 AC_MSG_CHECKING([for alternative branding images directory])
14339 # initialize mapped arrays
14340 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14341 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14343 if test -z "$with_branding" -o "$with_branding" = "no"; then
14344     AC_MSG_RESULT([none])
14345     DEFAULT_BRAND_IMAGES="$brand_files"
14346 else
14347     if ! test -d $with_branding ; then
14348         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14349     else
14350         AC_MSG_RESULT([$with_branding])
14351         CUSTOM_BRAND_DIR="$with_branding"
14352         for lfile in $brand_files
14353         do
14354             if ! test -f $with_branding/$lfile ; then
14355                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14356                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14357             else
14358                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14359             fi
14360         done
14361         check_for_progress="yes"
14362     fi
14364 AC_SUBST([BRAND_INTRO_IMAGES])
14365 AC_SUBST([CUSTOM_BRAND_DIR])
14366 AC_SUBST([CUSTOM_BRAND_IMAGES])
14367 AC_SUBST([DEFAULT_BRAND_IMAGES])
14370 AC_MSG_CHECKING([for 'intro' progress settings])
14371 PROGRESSBARCOLOR=
14372 PROGRESSSIZE=
14373 PROGRESSPOSITION=
14374 PROGRESSFRAMECOLOR=
14375 PROGRESSTEXTCOLOR=
14376 PROGRESSTEXTBASELINE=
14378 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14379     source "$with_branding/progress.conf"
14380     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14381 else
14382     AC_MSG_RESULT([none])
14385 AC_SUBST(PROGRESSBARCOLOR)
14386 AC_SUBST(PROGRESSSIZE)
14387 AC_SUBST(PROGRESSPOSITION)
14388 AC_SUBST(PROGRESSFRAMECOLOR)
14389 AC_SUBST(PROGRESSTEXTCOLOR)
14390 AC_SUBST(PROGRESSTEXTBASELINE)
14393 dnl ===================================================================
14394 dnl Custom build version
14395 dnl ===================================================================
14396 AC_MSG_CHECKING([for extra build ID])
14397 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14398     EXTRA_BUILDID="$with_extra_buildid"
14400 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14401 if test -n "$EXTRA_BUILDID" ; then
14402     AC_MSG_RESULT([$EXTRA_BUILDID])
14403 else
14404     AC_MSG_RESULT([not set])
14406 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14408 OOO_VENDOR=
14409 AC_MSG_CHECKING([for vendor])
14410 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14411     OOO_VENDOR="$USERNAME"
14413     if test -z "$OOO_VENDOR"; then
14414         OOO_VENDOR="$USER"
14415     fi
14417     if test -z "$OOO_VENDOR"; then
14418         OOO_VENDOR="`id -u -n`"
14419     fi
14421     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14422 else
14423     OOO_VENDOR="$with_vendor"
14424     AC_MSG_RESULT([$OOO_VENDOR])
14426 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14427 AC_SUBST(OOO_VENDOR)
14429 if test "$_os" = "Android" ; then
14430     ANDROID_PACKAGE_NAME=
14431     AC_MSG_CHECKING([for Android package name])
14432     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14433         if test -n "$ENABLE_DEBUG"; then
14434             # Default to the package name that makes ndk-gdb happy.
14435             ANDROID_PACKAGE_NAME="org.libreoffice"
14436         else
14437             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14438         fi
14440         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14441     else
14442         ANDROID_PACKAGE_NAME="$with_android_package_name"
14443         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14444     fi
14445     AC_SUBST(ANDROID_PACKAGE_NAME)
14448 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14449 if test "$with_compat_oowrappers" = "yes"; then
14450     WITH_COMPAT_OOWRAPPERS=TRUE
14451     AC_MSG_RESULT(yes)
14452 else
14453     WITH_COMPAT_OOWRAPPERS=
14454     AC_MSG_RESULT(no)
14456 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14458 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14459 AC_MSG_CHECKING([for install dirname])
14460 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14461     INSTALLDIRNAME="$with_install_dirname"
14463 AC_MSG_RESULT([$INSTALLDIRNAME])
14464 AC_SUBST(INSTALLDIRNAME)
14466 AC_MSG_CHECKING([for prefix])
14467 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14468 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14469 PREFIXDIR="$prefix"
14470 AC_MSG_RESULT([$PREFIXDIR])
14471 AC_SUBST(PREFIXDIR)
14473 LIBDIR=[$(eval echo $(eval echo $libdir))]
14474 AC_SUBST(LIBDIR)
14476 DATADIR=[$(eval echo $(eval echo $datadir))]
14477 AC_SUBST(DATADIR)
14479 MANDIR=[$(eval echo $(eval echo $mandir))]
14480 AC_SUBST(MANDIR)
14482 DOCDIR=[$(eval echo $(eval echo $docdir))]
14483 AC_SUBST(DOCDIR)
14485 BINDIR=[$(eval echo $(eval echo $bindir))]
14486 AC_SUBST(BINDIR)
14488 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14489 AC_SUBST(INSTALLDIR)
14491 TESTINSTALLDIR="${BUILDDIR}/test-install"
14492 AC_SUBST(TESTINSTALLDIR)
14495 # ===================================================================
14496 # OAuth2 id and secrets
14497 # ===================================================================
14499 AC_MSG_CHECKING([for Google Drive client id and secret])
14500 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14501     AC_MSG_RESULT([not set])
14502     GDRIVE_CLIENT_ID="\"\""
14503     GDRIVE_CLIENT_SECRET="\"\""
14504 else
14505     AC_MSG_RESULT([set])
14506     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14507     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14509 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14510 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14512 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14513 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14514     AC_MSG_RESULT([not set])
14515     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14516     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14517 else
14518     AC_MSG_RESULT([set])
14519     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14520     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14522 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14523 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14525 AC_MSG_CHECKING([for OneDrive client id and secret])
14526 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14527     AC_MSG_RESULT([not set])
14528     ONEDRIVE_CLIENT_ID="\"\""
14529     ONEDRIVE_CLIENT_SECRET="\"\""
14530 else
14531     AC_MSG_RESULT([set])
14532     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14533     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14535 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14536 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14539 dnl ===================================================================
14540 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14541 dnl --enable-dependency-tracking configure option
14542 dnl ===================================================================
14543 AC_MSG_CHECKING([whether to enable dependency tracking])
14544 if test "$enable_dependency_tracking" = "no"; then
14545     nodep=TRUE
14546     AC_MSG_RESULT([no])
14547 else
14548     AC_MSG_RESULT([yes])
14550 AC_SUBST(nodep)
14552 dnl ===================================================================
14553 dnl Number of CPUs to use during the build
14554 dnl ===================================================================
14555 AC_MSG_CHECKING([for number of processors to use])
14556 # plain --with-parallelism is just the default
14557 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14558     if test "$with_parallelism" = "no"; then
14559         PARALLELISM=0
14560     else
14561         PARALLELISM=$with_parallelism
14562     fi
14563 else
14564     if test "$enable_icecream" = "yes"; then
14565         PARALLELISM="40"
14566     else
14567         case `uname -s` in
14569         Darwin|FreeBSD|NetBSD|OpenBSD)
14570             PARALLELISM=`sysctl -n hw.ncpu`
14571             ;;
14573         Linux)
14574             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14575         ;;
14576         # what else than above does profit here *and* has /proc?
14577         *)
14578             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14579             ;;
14580         esac
14582         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14583         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14584     fi
14587 if test $PARALLELISM -eq 0; then
14588     AC_MSG_RESULT([explicit make -j option needed])
14589 else
14590     AC_MSG_RESULT([$PARALLELISM])
14592 AC_SUBST(PARALLELISM)
14595 # Set up ILIB for MSVC build
14597 ILIB1=
14598 if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
14599     ILIB="."
14600     if test -n "$JAVA_HOME"; then
14601         ILIB="$ILIB;$JAVA_HOME/lib"
14602     fi
14603     ILIB1=-link
14604     PathFormat "${COMPATH}/lib/$WIN_HOST_ARCH"
14605     ILIB="$ILIB;$formatted_path"
14606     ILIB1="$ILIB1 -LIBPATH:$formatted_path"
14607     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14608     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14609     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14610         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14611         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14612     fi
14613     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14614     ucrtlibpath_formatted=$formatted_path
14615     ILIB="$ILIB;$ucrtlibpath_formatted"
14616     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14617     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14618         PathFormat "$DOTNET_FRAMEWORK_HOME/lib"
14619         ILIB="$ILIB;$formatted_path"
14620     else
14621         PathFormat "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14622         ILIB="$ILIB;$formatted_path"
14623     fi
14625     if test "$cross_compiling" != "yes"; then
14626         ILIB_FOR_BUILD="$ILIB"
14627     fi
14629 AC_SUBST(ILIB)
14630 AC_SUBST(ILIB_FOR_BUILD)
14632 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14633 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14634 dnl from consteval constructor initializing const variable",
14635 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14636 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14637 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14638 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'" (which should be
14639 dnl fixed since Clang 14), <https://developercommunity.visualstudio.com/t/1581879> "Bogus error
14640 dnl C7595 with consteval constructor in ternary expression (/std:c++latest)", or
14641 dnl <https://github.com/llvm/llvm-project/issues/54612> "C++20, consteval, anonymous union:
14642 dnl llvm/lib/IR/Instructions.cpp:1491: void llvm::StoreInst::AssertOK(): Assertion
14643 dnl `cast<PointerType>(getOperand(1)->getType())->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType())
14644 dnl && "Ptr must be a pointer to Val type!"' failed." (which should be fixed since Clang 17):
14645 AC_LANG_PUSH([C++])
14646 save_CXX=$CXX
14647 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14648     CXX="env LIB=$ILIB $CXX"
14650 save_CXXFLAGS=$CXXFLAGS
14651 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14652 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14653         struct S {
14654             consteval S() { i = 1; }
14655             int i = 0;
14656         };
14657         S const s;
14659         struct S1 { consteval S1(int) {} };
14660         struct S2 {
14661             S1 x;
14662             S2(): x(0) {}
14663         };
14665         struct S3 {
14666             consteval S3() {}
14667             union {
14668                 int a;
14669                 unsigned b = 0;
14670             };
14671         };
14672         void f() { S3(); }
14674         struct S4 { consteval S4() = default; };
14675         void f4(bool b) { b ? S4() : S4(); }
14677         struct S5 {
14678             consteval S5() { c = 0; }
14679             char * f() { return &c; }
14680             union {
14681                 char c;
14682                 int i;
14683             };
14684         };
14685         auto s5 = S5().f();
14686     ], [
14687         return (s.i == 1) ? 0 : 1;
14688     ])], [
14689         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14690         AC_MSG_RESULT([yes])
14691     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14692 CXX=$save_CXX
14693 CXXFLAGS=$save_CXXFLAGS
14694 AC_LANG_POP([C++])
14696 # ===================================================================
14697 # Creating bigger shared library to link against
14698 # ===================================================================
14699 AC_MSG_CHECKING([whether to create huge library])
14700 MERGELIBS=
14702 if test $_os = iOS -o $_os = Android; then
14703     # Never any point in mergelibs for these as we build just static
14704     # libraries anyway...
14705     enable_mergelibs=no
14708 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14709     if test $_os != Linux -a $_os != WINNT; then
14710         add_warning "--enable-mergelibs is not tested for this platform"
14711     fi
14712     MERGELIBS="TRUE"
14713     AC_MSG_RESULT([yes])
14714     AC_DEFINE(ENABLE_MERGELIBS)
14715 else
14716     AC_MSG_RESULT([no])
14718 AC_SUBST([MERGELIBS])
14720 dnl ===================================================================
14721 dnl icerun is a wrapper that stops us spawning tens of processes
14722 dnl locally - for tools that can't be executed on the compile cluster
14723 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14724 dnl ===================================================================
14725 AC_MSG_CHECKING([whether to use icerun wrapper])
14726 ICECREAM_RUN=
14727 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14728     ICECREAM_RUN=icerun
14729     AC_MSG_RESULT([yes])
14730 else
14731     AC_MSG_RESULT([no])
14733 AC_SUBST(ICECREAM_RUN)
14735 dnl ===================================================================
14736 dnl Setup the ICECC_VERSION for the build the same way it was set for
14737 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14738 dnl ===================================================================
14739 x_ICECC_VERSION=[\#]
14740 if test -n "$ICECC_VERSION" ; then
14741     x_ICECC_VERSION=
14743 AC_SUBST(x_ICECC_VERSION)
14744 AC_SUBST(ICECC_VERSION)
14746 dnl ===================================================================
14748 AC_MSG_CHECKING([MPL subset])
14749 MPL_SUBSET=
14750 LICENSE="LGPL"
14752 if test "$enable_mpl_subset" = "yes"; then
14753     mpl_error_string=
14754     newline=$'\n    *'
14755     warn_report=false
14756     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14757         warn_report=true
14758     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14759         warn_report=true
14760     fi
14761     if test "$warn_report" = "true"; then
14762         mpl_error_string="$mpl_error_string$newline Need to --disable-report-builder - extended database report builder."
14763     fi
14764     if test "x$enable_postgresql_sdbc" != "xno"; then
14765         mpl_error_string="$mpl_error_string$newline Need to --disable-postgresql-sdbc - the PostgreSQL database backend."
14766     fi
14767     if test "$enable_lotuswordpro" = "yes"; then
14768         mpl_error_string="$mpl_error_string$newline Need to --disable-lotuswordpro - a Lotus Word Pro file format import filter."
14769     fi
14770     if test -n "$ENABLE_POPPLER"; then
14771         if test "x$SYSTEM_POPPLER" = "x"; then
14772             mpl_error_string="$mpl_error_string$newline Need to disable PDF import via poppler (--disable-poppler) or use system library."
14773         fi
14774     fi
14775     # cf. m4/libo_check_extension.m4
14776     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14777         mpl_error_string="$mpl_error_string$newline Need to disable extra extensions enabled using --enable-ext-XXXX."
14778     fi
14779     denied_themes=
14780     filtered_themes=
14781     for theme in $WITH_THEMES; do
14782         case $theme in
14783         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14784             denied_themes="${denied_themes:+$denied_themes }$theme" ;;
14785         *)
14786             filtered_themes="${filtered_themes:+$filtered_themes }$theme" ;;
14787         esac
14788     done
14789     if test "x$denied_themes" != "x"; then
14790         if test "x$filtered_themes" == "x"; then
14791             filtered_themes="colibre"
14792         fi
14793         mpl_error_string="$mpl_error_string$newline Need to disable icon themes: $denied_themes, use --with-theme=$filtered_themes."
14794     fi
14796     ENABLE_OPENGL_TRANSITIONS=
14798     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14799         mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
14800     fi
14802     if test "x$mpl_error_string" != "x"; then
14803         AC_MSG_ERROR([$mpl_error_string])
14804     fi
14806     MPL_SUBSET="TRUE"
14807     LICENSE="MPL-2.0"
14808     AC_DEFINE(MPL_HAVE_SUBSET)
14809     AC_MSG_RESULT([only])
14810 else
14811     AC_MSG_RESULT([no restrictions])
14813 AC_SUBST(MPL_SUBSET)
14814 AC_SUBST(LICENSE)
14816 dnl ===================================================================
14818 AC_MSG_CHECKING([formula logger])
14819 ENABLE_FORMULA_LOGGER=
14821 if test "x$enable_formula_logger" = "xyes"; then
14822     AC_MSG_RESULT([yes])
14823     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14824     ENABLE_FORMULA_LOGGER=TRUE
14825 elif test -n "$ENABLE_DBGUTIL" ; then
14826     AC_MSG_RESULT([yes])
14827     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14828     ENABLE_FORMULA_LOGGER=TRUE
14829 else
14830     AC_MSG_RESULT([no])
14833 AC_SUBST(ENABLE_FORMULA_LOGGER)
14835 dnl ===================================================================
14836 dnl Checking for active Antivirus software.
14837 dnl ===================================================================
14839 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14840     AC_MSG_CHECKING([for active Antivirus software])
14841     PathFormat "$SRC_ROOT/antivirusDetection.vbs"
14842     ANTIVIRUS_LIST=`cscript.exe //Nologo ${formatted_path}`
14843     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14844         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14845             AC_MSG_RESULT([found])
14846             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14847             echo $EICAR_STRING > $SRC_ROOT/eicar
14848             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14849             rm $SRC_ROOT/eicar
14850             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14851                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14852             fi
14853             echo $EICAR_STRING > $BUILDDIR/eicar
14854             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14855             rm $BUILDDIR/eicar
14856             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14857                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14858             fi
14859             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"
14860         else
14861             AC_MSG_RESULT([not found])
14862         fi
14863     else
14864         AC_MSG_RESULT([n/a])
14865     fi
14868 dnl ===================================================================
14870 AC_MSG_CHECKING([for coredumpctl support])
14871 if test -z "$with_coredumpctl" && test $_os != Linux; then
14872     with_coredumpctl=no
14874 if test "$with_coredumpctl" = no; then
14875     WITH_COREDUMPCTL=
14876 else
14877     AC_PATH_PROG(COREDUMPCTL, coredumpctl)
14878     AC_PATH_PROG(JQ, jq)
14879     AC_PATH_PROG(SYSTEMD_ESCAPE, systemd-escape)
14880     AC_PATH_PROG(SYSTEMD_RUN, systemd-run)
14881     if test -z "$COREDUMPCTL" || test -z "$JQ" || test -z "$SYSTEMD_ESCAPE" \
14882         || test -z "$SYSTEMD_RUN"
14883     then
14884         if test -z "$with_coredumpctl"; then
14885             WITH_COREDUMPCTL=
14886         else
14887             if test -z "$COREDUMPCTL"; then
14888                 AC_MSG_ERROR([coredumpctl not found])
14889             fi
14890             if test -z "$JQ"; then
14891                 AC_MSG_ERROR([jq not found])
14892             fi
14893             if test -z "$SYSTEMD_ESCAPE"; then
14894                 AC_MSG_ERROR([systemd-escape not found])
14895             fi
14896             if test -z "$SYSTEMD_RUN"; then
14897                 AC_MSG_ERROR([systemd-run not found])
14898             fi
14899         fi
14900     else
14901         WITH_COREDUMPCTL=TRUE
14902     fi
14904 if test -z "$WITH_COREDUMPCTL"; then
14905     AC_MSG_RESULT([no])
14906 else
14907     AC_MSG_RESULT([yes])
14909 AC_SUBST(COREDUMPCTL)
14910 AC_SUBST(JQ)
14911 AC_SUBST(SYSTEMD_ESCAPE)
14912 AC_SUBST(SYSTEMD_RUN)
14913 AC_SUBST(WITH_COREDUMPCTL)
14915 dnl ===================================================================
14916 dnl Setting up the environment.
14917 dnl ===================================================================
14918 AC_MSG_NOTICE([setting up the build environment variables...])
14920 AC_SUBST(COMPATH)
14922 if test "$build_os" = "cygwin" -o "$build_os" = wsl; then
14923     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14924         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14925         ATL_INCLUDE="$COMPATH/atlmfc/include"
14926     elif test -d "$COMPATH/atlmfc/lib"; then
14927         ATL_LIB="$COMPATH/atlmfc/lib"
14928         ATL_INCLUDE="$COMPATH/atlmfc/include"
14929     else
14930         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14931         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14932     fi
14933     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14934     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14935     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14938 if test "$build_os" = "cygwin"; then
14939     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14940     PathFormat "/usr/bin/find.exe"
14941     FIND="$formatted_path"
14942     PathFormat "/usr/bin/sort.exe"
14943     SORT="$formatted_path"
14944     PathFormat "/usr/bin/grep.exe"
14945     WIN_GREP="$formatted_path"
14946     PathFormat "/usr/bin/ls.exe"
14947     WIN_LS="$formatted_path"
14948     PathFormat "/usr/bin/touch.exe"
14949     WIN_TOUCH="$formatted_path"
14950 else
14951     FIND=find
14952     SORT=sort
14955 AC_SUBST(ATL_INCLUDE)
14956 AC_SUBST(ATL_LIB)
14957 AC_SUBST(FIND)
14958 AC_SUBST(SORT)
14959 AC_SUBST(WIN_GREP)
14960 AC_SUBST(WIN_LS)
14961 AC_SUBST(WIN_TOUCH)
14963 AC_SUBST(BUILD_TYPE)
14965 AC_SUBST(SOLARINC)
14967 PathFormat "$PERL"
14968 PERL="$formatted_path"
14969 AC_SUBST(PERL)
14971 if test -n "$TMPDIR"; then
14972     TEMP_DIRECTORY="$TMPDIR"
14973 else
14974     TEMP_DIRECTORY="/tmp"
14976 CYGWIN_BASH="C:/cygwin64/bin/bash.exe"
14977 if test "$build_os" = "cygwin"; then
14978     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14979     CYGWIN_BASH=`cygpath -m /usr/bin/bash`
14981 AC_SUBST(TEMP_DIRECTORY)
14982 AC_SUBST(CYGWIN_BASH)
14984 # setup the PATH for the environment
14985 if test -n "$LO_PATH_FOR_BUILD"; then
14986     LO_PATH="$LO_PATH_FOR_BUILD"
14987     case "$host_os" in
14988     cygwin*|wsl*)
14989         pathmunge "$MSVC_HOST_PATH" "before"
14990         ;;
14991     esac
14992 else
14993     LO_PATH="$PATH"
14995     case "$host_os" in
14997     dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14998         if test "$ENABLE_JAVA" != ""; then
14999             pathmunge "$JAVA_HOME/bin" "after"
15000         fi
15001         ;;
15003     cygwin*|wsl*)
15004         # Win32 make needs native paths
15005         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
15006             LO_PATH=`cygpath -p -m "$PATH"`
15007         fi
15008         if test "$WIN_BUILD_ARCH" = "x64"; then
15009             # needed for msi packaging
15010             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
15011         fi
15012         if test "$WIN_BUILD_ARCH" = "arm64"; then
15013             # needed for msi packaging - as of 10.0.22621 SDK no arm64 ones yet
15014             # the x86 ones probably would work just as well...
15015             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/arm" "before"
15016         fi
15017         # .NET 4.6 and higher don't have bin directory
15018         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
15019             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
15020         fi
15021         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
15022         pathmunge "$CSC_PATH" "before"
15023         pathmunge "$MIDL_PATH" "before"
15024         pathmunge "$AL_PATH" "before"
15025         pathmunge "$MSVC_MULTI_PATH" "before"
15026         pathmunge "$MSVC_BUILD_PATH" "before"
15027         if test -n "$MSBUILD_PATH" ; then
15028             pathmunge "$MSBUILD_PATH" "before"
15029         fi
15030         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
15031         if test "$ENABLE_JAVA" != ""; then
15032             if test -d "$JAVA_HOME/jre/bin/client"; then
15033                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
15034             fi
15035             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
15036                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
15037             fi
15038             pathmunge "$JAVA_HOME/bin" "before"
15039         fi
15040         pathmunge "$MSVC_HOST_PATH" "before"
15041         ;;
15043     solaris*)
15044         pathmunge "/usr/css/bin" "before"
15045         if test "$ENABLE_JAVA" != ""; then
15046             pathmunge "$JAVA_HOME/bin" "after"
15047         fi
15048         ;;
15049     esac
15052 AC_SUBST(LO_PATH)
15054 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
15055 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
15056     x_LO_ELFCHECK_ALLOWLIST=
15057 else
15058     x_LO_ELFCHECK_ALLOWLIST=[\#]
15060 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
15061 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
15063 libo_FUZZ_SUMMARY
15065 # Generate a configuration sha256 we can use for deps
15066 if test -f config_host.mk; then
15067     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
15069 if test -f config_host_lang.mk; then
15070     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
15073 CFLAGS=$my_original_CFLAGS
15074 CXXFLAGS=$my_original_CXXFLAGS
15075 CPPFLAGS=$my_original_CPPFLAGS
15077 AC_CONFIG_LINKS([include:include])
15079 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
15080 # BUILD platform configuration] - otherwise breaks cross building
15081 AC_CONFIG_FILES([config_host.mk
15082                  config_host_lang.mk
15083                  Makefile
15084                  bin/bffvalidator.sh
15085                  bin/odfvalidator.sh
15086                  bin/officeotron.sh
15087                  instsetoo_native/util/openoffice.lst
15088                  sysui/desktop/macosx/Info.plist
15089                  hardened_runtime.xcent:sysui/desktop/macosx/hardened_runtime.xcent.in
15090                  lo.xcent:sysui/desktop/macosx/lo.xcent.in
15091                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
15093 AC_CONFIG_HEADERS([config_host/config_atspi.h])
15094 AC_CONFIG_HEADERS([config_host/config_buildconfig.h])
15095 AC_CONFIG_HEADERS([config_host/config_buildid.h])
15096 AC_CONFIG_HEADERS([config_host/config_box2d.h])
15097 AC_CONFIG_HEADERS([config_host/config_clang.h])
15098 AC_CONFIG_HEADERS([config_host/config_crypto.h])
15099 AC_CONFIG_HEADERS([config_host/config_dconf.h])
15100 AC_CONFIG_HEADERS([config_host/config_eot.h])
15101 AC_CONFIG_HEADERS([config_host/config_extensions.h])
15102 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
15103 AC_CONFIG_HEADERS([config_host/config_cairo_rgba.h])
15104 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
15105 AC_CONFIG_HEADERS([config_host/config_dbus.h])
15106 AC_CONFIG_HEADERS([config_host/config_features.h])
15107 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
15108 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
15109 AC_CONFIG_HEADERS([config_host/config_firebird.h])
15110 AC_CONFIG_HEADERS([config_host/config_folders.h])
15111 AC_CONFIG_HEADERS([config_host/config_fonts.h])
15112 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
15113 AC_CONFIG_HEADERS([config_host/config_gio.h])
15114 AC_CONFIG_HEADERS([config_host/config_global.h])
15115 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
15116 AC_CONFIG_HEADERS([config_host/config_java.h])
15117 AC_CONFIG_HEADERS([config_host/config_langs.h])
15118 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
15119 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
15120 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
15121 AC_CONFIG_HEADERS([config_host/config_locales.h])
15122 AC_CONFIG_HEADERS([config_host/config_mpl.h])
15123 AC_CONFIG_HEADERS([config_host/config_oox.h])
15124 AC_CONFIG_HEADERS([config_host/config_options.h])
15125 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
15126 AC_CONFIG_HEADERS([config_host/config_zxing.h])
15127 AC_CONFIG_HEADERS([config_host/config_skia.h])
15128 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
15129 AC_CONFIG_HEADERS([config_host/config_validation.h])
15130 AC_CONFIG_HEADERS([config_host/config_vendor.h])
15131 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
15132 AC_CONFIG_HEADERS([config_host/config_version.h])
15133 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
15134 AC_CONFIG_HEADERS([config_host/config_poppler.h])
15135 AC_CONFIG_HEADERS([config_host/config_python.h])
15136 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
15137 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
15138 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
15139 AC_OUTPUT
15141 if test "$CROSS_COMPILING" = TRUE; then
15142     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
15145 # touch the config timestamp file
15146 if test ! -f config_host.mk.stamp; then
15147     echo > config_host.mk.stamp
15148 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
15149     echo "Host Configuration unchanged - avoiding scp2 stamp update"
15150 else
15151     echo > config_host.mk.stamp
15154 # touch the config lang timestamp file
15155 if test ! -f config_host_lang.mk.stamp; then
15156     echo > config_host_lang.mk.stamp
15157 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
15158     echo "Language Configuration unchanged - avoiding scp2 stamp update"
15159 else
15160     echo > config_host_lang.mk.stamp
15164 if test \( "$STALE_MAKE" = "TRUE" \) \
15165         -a "$build_os" = "cygwin"; then
15167 cat << _EOS
15168 ****************************************************************************
15169 WARNING:
15170 Your make version is known to be horribly slow, and hard to debug
15171 problems with. To get a reasonably functional make please do:
15173 to install a pre-compiled binary make for Win32
15175  mkdir -p /opt/lo/bin
15176  cd /opt/lo/bin
15177  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
15178  cp make-4.2.1-msvc.exe make
15179  chmod +x make
15181 to install from source:
15182 place yourself in a working directory of you choice.
15184  git clone git://git.savannah.gnu.org/make.git
15186  [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"]
15187  set PATH=%PATH%;C:\Cygwin\bin
15188  [or Cygwin64, if that is what you have]
15189  cd path-to-make-repo-you-cloned-above
15190  build_w32.bat --without-guile
15192 should result in a WinRel/gnumake.exe.
15193 Copy it to the Cygwin /opt/lo/bin directory as make.exe
15195 Then re-run autogen.sh
15197 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
15198 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
15200 _EOS
15204 cat << _EOF
15205 ****************************************************************************
15207 To show information on various make targets and make flags, run:
15208 $GNUMAKE help
15210 To just build, run:
15211 $GNUMAKE
15213 _EOF
15215 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
15216     cat << _EOF
15217 After the build has finished successfully, you can immediately run what you built using the command:
15218 _EOF
15220     if test $_os = Darwin; then
15221         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
15222     else
15223         echo instdir/program/soffice
15224     fi
15225     cat << _EOF
15227 If you want to run the unit tests, run:
15228 $GNUMAKE check
15230 _EOF
15233 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
15234     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
15235     cat "$WARNINGS_FILE_FOR_BUILD"
15236     echo
15239 if test -s "$WARNINGS_FILE"; then
15240     echo "HOST config ($WARNINGS_FILE)"
15241     cat "$WARNINGS_FILE"
15244 # Remove unneeded emconfigure artifacts
15245 rm -f a.out a.wasm a.out.js a.out.wasm
15247 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: